F. Squid Art
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Example
Input
6 10
0100000001
0011010100
1001101101
1010011010
0011101101
0101001011
Output
2