summaryrefslogtreecommitdiff
path: root/2025
diff options
context:
space:
mode:
Diffstat (limited to '2025')
-rwxr-xr-x2025/01/python.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/2025/01/python.py b/2025/01/python.py
new file mode 100755
index 0000000..2ba0bbd
--- /dev/null
+++ b/2025/01/python.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+from fileinput import input
+from itertools import accumulate
+
+lines = [line.strip() for line in input()]
+
+add = lambda p, m: (p + int(m[1:]) * ((m[0] == "R") * 2 - 1)) % 100
+
+silver = sum(p == 0 for p in accumulate(lines, add, initial=50))
+gold = 0
+
+print("silver:", silver)
+print("gold:", gold)