题解 | #合并表记录#
合并表记录
http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
while True:
try:
d={}
n=eval(input())
for i in range(n):
a,b=input().split()
a=eval(a)
if a not in d:
d[a]=b
else:
d[a]=str(eval(d[a])+eval(b))
for c in sorted(d.keys()):
print(c,d[c])
except:
break