14 lines
309 B
Python
14 lines
309 B
Python
from collections import Counter
|
|
input = [i.rstrip() for i in open("input").readlines()]
|
|
splitted = [i.split(' ') for i in input]
|
|
|
|
left = [int(i[0]) for i in splitted]
|
|
right = [int(i[1]) for i in splitted]
|
|
|
|
counted = Counter(right)
|
|
|
|
score = 0
|
|
for item in left:
|
|
score += item * counted[item]
|
|
|
|
print(score) |