

N = 2
M = 3
G = [{ 1, 0, 1 }, { 0, 1, 1} ]
Explanation :
One of the possible ways is first applicant gets internship 1 and second applicant gets internship 3.
Another possible way can be that the first applicant gets internship 3 and second applicant gets internship 2.
Hence, both of them can get internships.
The first line contains an integer 'T' which denotes the number of test cases to be run. Then the test cases follow.
The first line of each test case contains two integers ‘N’ and ‘M’ denoting the dimensions of the given grid.
The next ‘N’ lines contain ‘M’ integers each. Each integer is guaranteed to be ‘0’ or ‘1’.
For each test case, print a single integer denoting the maximum number of applicants that can be assigned an internship.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 100
1 <= M <= 100
G[i][j] = ‘0’ or G[i][j] = ‘1’
Time Limit : 1 sec
Algorithm :