summaryrefslogtreecommitdiff
path: root/2024/1B.py
blob: 655d808ee82b50b6656d055802d970ed0660690f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
loc1 = []
loc2 = []

with open('1.txt', 'r') as file:
    for line in file:
        parts = line.strip().split("   ")
        if len(parts) == 2:
            val1 = int(parts[0])
            val2 = int(parts[1])

            loc1.append(val1)
            loc2.append(val2)
res = 0
dic = {}

for i in loc1:
    dic[i] = 0
    for j in loc2:
        dic[j] = 0

for i in loc1:
    dic[i] += 1

for j in loc2:
    res += j * dic[j]

print(res)