Binary Matrix
/

## Algorithms, Greedy Algorithms, Implementation, String Manipulation

Problem
Editorial
Analytics

N numbers were converted into their respective Binary form of M length and arranged in an NxM matrix.

Your task is to find the index of row (1 based indexing) which contains the binary number with maximum value. If multiple rows have maximum value then print the row with minimum index.

Input:

The first line contains two space separated integers N and M, denoting number of rows and number of columns in matrix respectively.

Each of the next N lines contains a number in binary form.

Output:

Print the index of row in a single line.

Constraints:

$1 \le N,M \le 10^3$
$0 \le mat[i][j] \le 1$

SAMPLE INPUT
4 4
1010
0100
0010
0011
SAMPLE OUTPUT
1
Explanation

1st row value  =  2*1  +  2*0 + 21 *1 + 2*0  =  10

2nd row value =  2*0  +  2*1 + 21 *0 + 2*0  =  4

3rd row value  =  2*0  +  2*0 + 21 *1 + 2*0  =  2

4th row value  =  2*0  +  2*0 + 21 *1 + 2*1  =  3

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

## This Problem was Asked in

Initializing Code Editor...