#C8149. Replace Speeds Above Average

    ID: 52099 Type: Default 1000ms 256MiB

Replace Speeds Above Average

Replace Speeds Above Average

In this problem, you are given a 2D array representing the speeds recorded during a race. Your task is to replace each speed in the first row that is greater than the average speed of the entire array with 0. The average speed is computed as follows:

\(\text{Average} = \frac{\sum_{i=1}^{n} x_i}{n}\)

You must read the input from standard input and write the output to standard output.

inputFormat

The first line of input contains two integers, r and c, representing the number of rows and columns of the 2D array respectively. This is followed by r lines, each containing c integers separated by spaces, which represent the speeds in the race.

outputFormat

Output the modified 2D array in the same dimensions. Each row should be printed on a new line with values separated by a single space.## sample

3 3
120 130 125
125 135 120
135 140 130
120 0 125

125 135 120 135 140 130

</p>