Compare commits

..

No commits in common. "ae8759d766439c7186fbe6d0c73d8a9c793ed1e7" and "1df896c32ca8a62739cfcdb648744c1a405d744b" have entirely different histories.

4 changed files with 0 additions and 2050 deletions

View file

@ -1,25 +0,0 @@
#!/usr/bin/env python
import sys
def solve(input: list[str]) -> int:
def parse(input: list[str]) -> tuple[list[int], list[int]]:
left, right = [], []
for line in input:
lhs, rhs = line.split()
left.append(int(lhs))
right.append(int(rhs))
return left, right
left, right = parse(input)
return sum(abs(lhs - rhs) for lhs, rhs in zip(sorted(left), sorted(right)))
def main() -> None:
input = sys.stdin.read().splitlines()
print(solve(input))
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load diff

View file

@ -1,25 +0,0 @@
#!/usr/bin/env python
import sys
def solve(input: list[str]) -> int:
def parse(input: list[str]) -> tuple[list[int], list[int]]:
left, right = [], []
for line in input:
lhs, rhs = line.split()
left.append(int(lhs))
right.append(int(rhs))
return left, right
left, right = parse(input)
return sum(lhs * right.count(lhs) for lhs in left)
def main() -> None:
input = sys.stdin.read().splitlines()
print(solve(input))
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load diff