#C6280. Maximum Strawberries Collection
Maximum Strawberries Collection
Maximum Strawberries Collection
You are given a grid of non-negative integers representing the number of strawberries in each cell. The grid has m rows and n columns. There is a special (risky) strawberry count denoted by X. A row is considered non-risky if it does not contain the value X. Your task is to determine the maximum total number of strawberries that Masha can collect from a single non-risky row.
If every row is risky (i.e. each row contains the value X), print 0.
The solution should read input from the standard input (stdin) and write the output to the standard output (stdout).
inputFormat
The first line contains three integers m, n, and X separated by spaces, where m is the number of rows, n is the number of columns, and X is the risky strawberry count.
The following m lines each contain n space-separated integers, representing the grid.
outputFormat
Output a single integer — the maximum sum of strawberries in any non-risky row. If no non-risky row exists, output 0.
## sample3 4 10
1 2 3 4
5 10 5 5
7 8 9 10
10