Please anyone help me with this problem?MATXOR

Question link-CodeChef: Practical coding for everyone
My soln link-CodeChef: Practical coding for everyone
I have tried to count the occurences of each of the element in the 2d matrix.I have done it by finding a pattern.My soln is working properly with given test case but dont why it is showing wrong answer when i submit it.Can anyone help me or provide some test cases where my code fails?

Are you sure about the solution?
Here’s mine for reference.