#C11315. Taco Scoring Leaderboard

    ID: 40618 Type: Default 1000ms 256MiB

Taco Scoring Leaderboard

Taco Scoring Leaderboard

In a programming contest, contestants answer problems where each correct answer adds 10 points and each incorrect answer subtracts 5 points. Given the number of contestants and a series of attempts, your task is to compute each contestant's final score and then display a leaderboard.

The scoring is defined by the formula:

$$score = 10 \times (\text{number of correct answers}) - 5 \times (\text{number of incorrect answers})$$

The leaderboard should be sorted by score in descending order. In case of a tie, the contestant with the lower number comes first.

inputFormat

The input begins with two integers: N (the number of contestants) and M (the number of attempts). This is followed by M lines, each containing an integer and a string separated by a space. The integer indicates the contestant number (1-indexed) and the string is either 'correct' or 'incorrect'.

Example: 3 5 1 correct 2 incorrect 3 correct 1 incorrect 2 correct

outputFormat

Output the leaderboard with each line containing two values: the contestant number and their computed score separated by a space. The leaderboard is sorted by score in descending order; if scores are equal, the contestant with the smaller number appears first.

Example: 3 10 1 5 2 5## sample

1
3
1 correct
1 incorrect
1 correct
1 15

</p>