20 lines
413 B
Python
Executable File
20 lines
413 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
INPUT_FILE = 'input.txt'
|
|
|
|
def main():
|
|
left, right = [], []
|
|
contents = open(INPUT_FILE, 'r').readlines()
|
|
for line in contents:
|
|
fields = line.split(' ')
|
|
left.append(int(fields[0]))
|
|
right.append(int(fields[-1]))
|
|
similarity = 0
|
|
for id in left:
|
|
similarity += id * right.count(id)
|
|
print(similarity)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|