2024/1 challenge

This commit is contained in:
stupidcomputer 2024-12-19 17:10:50 -06:00
parent f99892ba74
commit d5079efa4c
4 changed files with 1029 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__/

14
2024/1/1.py Normal file
View File

@ -0,0 +1,14 @@
input = [i.rstrip() for i in open("input").readlines()]
splitted = [i.split(' ') for i in input]
left = [int(i[0]) for i in splitted]
left = sorted(left)
right = [int(i[1]) for i in splitted]
right = sorted(right)
output = []
for index in range(len(left)):
signed_dist = int(left[index]) - int(right[index])
output.append(abs(signed_dist))
print(sum(output))

14
2024/1/2.py Normal file
View File

@ -0,0 +1,14 @@
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)

1000
2024/1/input Normal file

File diff suppressed because it is too large Load Diff