#K32782. Count Higher Total Scores

    ID: 24942 Type: Default 1000ms 256MiB

Count Higher Total Scores

Count Higher Total Scores

You are given the number of participants M, the number of contests K, and a table of scores where each row represents the scores of a participant in each contest. The total score for a participant is the sum of their scores across all contests. Your task is to determine, for each participant, how many other participants have a strictly higher total score.

Mathematical formulation:

Let \(S_i\) be the total score of the \(i\)-th participant, i.e., \[ S_i = \sum_{j=1}^{K} s_{i,j} \] You need to compute an array \(R\) of length \(M\), where \[ R_i = |\{ j \mid S_j > S_i \}| \]

Input and Output details are given below.

inputFormat

The first line contains two integers M and K separated by a space, where M is the number of participants and K is the number of contests.

Each of the following M lines contains K integers separated by spaces, representing the scores of a participant in each contest.

outputFormat

Output a single line containing M integers separated by spaces. The i-th integer should be the number of participants whose total score is strictly greater than the total score of the i-th participant.

## sample
3 2
100 200
150 150
200 100
0 0 0

</p>