From 6b733982f9f240c1c97f1fa705bfbe4cd93c640e Mon Sep 17 00:00:00 2001 From: mhsn Date: Fri, 12 Sep 2025 20:20:58 +0100 Subject: simplify python file structure --- 2024/01/python.py | 14 ++++++++++++++ 2024/01/python/main.py | 12 ------------ 2024/01/python/pyproject.toml | 6 ------ 3 files changed, 14 insertions(+), 18 deletions(-) create mode 100755 2024/01/python.py delete mode 100644 2024/01/python/main.py delete mode 100644 2024/01/python/pyproject.toml (limited to '2024/01') diff --git a/2024/01/python.py b/2024/01/python.py new file mode 100755 index 0000000..425f6c7 --- /dev/null +++ b/2024/01/python.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +from collections import Counter +from fileinput import input + +L, R = zip(*[[int(n) for n in s.split()] for s in input()]) + +silver = sum(abs(left - right) for left, right in zip(sorted(L), sorted(R))) + +L, R = Counter(L), Counter(R) +gold = sum(n * L[n] * R[n] for n in list(L & R)) + +print("silver:", silver) +print("gold:", gold) diff --git a/2024/01/python/main.py b/2024/01/python/main.py deleted file mode 100644 index f920d5d..0000000 --- a/2024/01/python/main.py +++ /dev/null @@ -1,12 +0,0 @@ -from collections import Counter -from fileinput import input - -L, R = zip(*[[int(n) for n in s.split()] for s in input()]) - -silver = sum(abs(left - right) for left, right in zip(sorted(L), sorted(R))) - -L, R = Counter(L), Counter(R) -gold = sum(n * L[n] * R[n] for n in list(L & R)) - -print("silver:", silver) -print("gold:", gold) diff --git a/2024/01/python/pyproject.toml b/2024/01/python/pyproject.toml deleted file mode 100644 index ed9dd6f..0000000 --- a/2024/01/python/pyproject.toml +++ /dev/null @@ -1,6 +0,0 @@ -[project] -name = "aoc-2024-01" -version = "0.1.0" -description = "advent of code 2024-01" -requires-python = ">=3.13" -dependencies = [] -- cgit v1.2.3