25. For the People (2)

Time Limit: 1 seconds

Memory Limit: 128 MB

Rating: 1000

Problem Statement

I don’t know how but social credit system has made it into reality. Allow the user to input the name of the hero and their actions. At the end, output the supe and their social credit. All heroes start at $0$.

Input

On the first line, you are given two space-separated integers $N$ and $M$ $(1 \le N, M \le 10^6)$, the number of actions given in the input and the number of superheroes to track. On the next $N$ lines, you are given integers $A_i$ $(1 \le A_i \le M)$ and $S_i$ $(1 \le S_i \le 2 \cdot 10^8)$, $A_i$ being the ID of the superhero and $S_i$ being the change in social credit.

Output

Output the answer on the first line (excluding units)

Sample Cases
Sample Output 1:
89
Explanation

Note: the sample output given is not the answer.

Sources

KL Coding Cup 2022 > Problem 8 > Intermediate League

Submit | Back