Limits 1s, 512 MB

From different countries and different universities, too many teams are coming to Bangladesh to participate in the 45th45^{th} Annual ICPC World Finals. The organizer team wanted to provide a suitable contest environment for the participants. So they select a big hall room where they set NN rows of PCs and each row has MM PCs. One team will use one PC. After completing the seat plan they have some extra seats and want to allow some extra teams.

Though everyone is busy with different types of activities, so for the given configuration of the hall you need to calculate the number of extra teams that can participate in the contest.


The first line will take two integers NN and MM, which denote respectively the total row numbers and PC numbers in each row.

The next NN line will take the MM character 1“1” or 0“0” (1“1” means the seat is booked for a team, and 0“0” means the seat is empty).



You have to output an integer — the number of extra teams that can participate in the contest.


5 5
1 1 0 1 1
1 1 1 1 0
0 1 1 1 1
1 1 1 1 1
0 0 0 1 1

Be careful about the newline(‘\n’) at the end.


Login to submit.


97% Solution Ratio
Fuad.749068Earliest, Dec '22
esh.29Lightest, 4.9 MB
Nusab19Shortest, 34B
Toph uses cookies. By continuing you agree to our Cookie Policy.