Most Frequent Row XOR
Given a binary matrix (containing only 0s and 1s), where each row represents a binary number, calculate the XOR sum of all rows. Then, find the binary number that appears most frequently as a row XOR sum. If there are multiple such numbers with the same highest frequency, return the largest one. The matrix dimensions are M x N. Each row is treated as an N-bit binary number.
Input
The first line contains two integers M and N. The next M lines each contain N binary digits (0 or 1), representing the rows of the matrix.
Output
Print a single integer representing the most frequent row XOR sum. This sum should be interpreted as an N-bit binary number and printed as a decimal integer.
Constraints
1 <= M, N <= 1000. The total number of elements in the matrix (M*N) is at most 200000.
Example 1
3 4 1010 0110 1010
10
Row values are 10, 6, 10. '10' appears twice, '6' once. The most frequent is 10.
Example 2
4 2 11 01 10 11
3
Row values are 3, 1, 2, 3. '3' appears twice, '1' and '2' once. The most frequent is 3.
Hints
# Read the input from stdin and print the answer.
import sys
def main():
data = sys.stdin.read().split()
# your code here
main()
3 4 1010 0110 1010
4 2 11 01 10 11