"""
Given n and m which are
the dimensions of a matrix initialized by zeros and 
given an array indices where indices[i] = [ri, ci].
For each pair of [ri, ci] you have to increment all 
cells in row ri and column ci by 1.

Return the number of cells with odd values in the 
matrix after applying the increment to all indices.
"""

n = 2
m = 3
indices = [[0,1],[1,1]]

row = [0]*n
col = [0]*m


for r,c in indices:
    row[r] += 1
    col[c] += 1

print(sum([ (r+c)%2 for c in col for r in row]) )