#C2164. Count Participant Rounds
Count Participant Rounds
Count Participant Rounds
In this problem, you are given data representing multiple rounds of a competition. In each round, a list of participant IDs is provided. A participant can appear multiple times in a round and across rounds. Your task is to compute the total number of rounds in which each participant appears (each occurrence in a round counts as one participation).
You need to read the input from standard input. The first line contains an integer R representing the number of rounds. Each of the following R lines contains a round's data: space-separated integers denoting the IDs of participants in that round. Note that a single round may contain duplicated participant IDs, and each occurrence should be counted.
Finally, output the result to standard output by printing one line per participant with the participant ID followed by the corresponding count. The output should be sorted in ascending order of participant IDs.
inputFormat
The first line contains an integer R (the number of rounds). Each of the next R lines contains space-separated integers representing the participant IDs for that round.
outputFormat
For every participant that appears in any round, output a line containing two integers separated by a space: the participant's ID and the total count of appearances across rounds. The lines must be sorted in ascending order by participant ID.
## sample4
1 2 3
4 1
2 3
1 4
1 3
2 2
3 2
4 2
</p>