ผลต่างระหว่างรุ่นของ "01204212/scores"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
(หน้าที่ถูกสร้างด้วย ': ''This is part of 01204212'' Write a program that maintains scores for each team in a world-wide game competition. Your program...')
 
แถว 7: แถว 7:
 
== Input ==
 
== Input ==
  
First line: an integer '''M''', the total number of updates  ('''M''' <= 1,000,000)
+
First line: an integer '''M''', the total number of updates  ('''M''' <= 1,000,000) The number of teams will not be more than 100,000.
  
 
Next '''M'' lines: a team name which is a string consisting of 'A'-'Z','a'-'z','0'-'9' and '_' of length at most 20 and an additional score which is an integer of value at most 1,000.
 
Next '''M'' lines: a team name which is a string consisting of 'A'-'Z','a'-'z','0'-'9' and '_' of length at most 20 and an additional score which is an integer of value at most 1,000.

รุ่นแก้ไขเมื่อ 22:41, 23 พฤศจิกายน 2559

This is part of 01204212

Write a program that maintains scores for each team in a world-wide game competition.

Your program will read a list of names and additional scores and print out the current score of that team. Initially, every team has score of 0.

เนื้อหา

Input

First line: an integer M, the total number of updates (M <= 1,000,000) The number of teams will not be more than 100,000.

Next 'M lines: a team name which is a string consisting of 'A'-'Z','a'-'z','0'-'9' and '_' of length at most 20 and an additional score which is an integer of value at most 1,000.

Output

For each line of the input, output the current score of that team.

Examples

Input

5
hello 10
world 15
hello 123
Hello 15
Hello-world 100

Output

10
15
133
15
100

Codes