Traversing matrix to calculate XOR values
for i in range ( n ) : NEW_LINE INDENT for j in range ( mm ) : NEW_LINE INDENT if i - 1 >= 0 : NEW_LINE INDENT a = xor [ i - 1 ] [ j ] NEW_LINE DEDENT else : NEW_LINE INDENT a = 0 NEW_LINE DEDENT if j - 1 >= 0 : NEW_LINE INDENT b = xor [ i ] [ j - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT b = 0 NEW_LINE DEDENT if i - 1 >= 0 and j - 1 >= 0 : NEW_LINE INDENT c = xor [ i - 1 ] [ j - 1 ] NEW_LINE DEDENT else : NEW_LINE INDENT c = 0 NEW_LINE DEDENT xor [ i ] [ j ] = m [ i ] [ j ] ^ a ^ b ^ c NEW_LINE DEDENT DEDENT