#C2214. Compute Participant Scores

    ID: 45506 Type: Default 1000ms 256MiB

Compute Participant Scores

Compute Participant Scores

You are given the total number of participants P, the number of problems solved M, and a base score S for each problem.

For each problem solved, a submission record is provided in the form of three integers: the problem number, the participant's ID, and the time taken to solve the problem. Each participant's score for a problem is computed as:

$$score = S - t,$$

where t is the time taken. The total score for a participant is the sum of the scores from all their submissions. If a participant does not solve any problem, their score remains 0.

Your task is to calculate and output the total scores for each participant.

inputFormat

The input is given from standard input (stdin) with the following format:

  • The first line contains three space-separated integers: P (the number of participants), M (the number of problems solved), and S (the base score for each problem).
  • The next M lines each contain three space-separated integers: the problem number, the participant ID (1-indexed), and the time taken to solve that problem.

You may assume that all input values are valid.

outputFormat

Output the total scores of each participant (from participant 1 to P) separated by a space on a single line to standard output (stdout).

## sample
4 5 100
1 1 50
2 2 60
3 3 70
4 1 50
5 2 30
100 110 30 0