aboutsummaryrefslogtreecommitdiff
path: root/2023/04/puzzle-1.py
diff options
context:
space:
mode:
Diffstat (limited to '2023/04/puzzle-1.py')
-rw-r--r--2023/04/puzzle-1.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/2023/04/puzzle-1.py b/2023/04/puzzle-1.py
new file mode 100644
index 0000000..8c221d8
--- /dev/null
+++ b/2023/04/puzzle-1.py
@@ -0,0 +1,14 @@
+def main() -> None:
+ acc = 0
+ with open("input", "r") as f:
+ while line := f.readline():
+ l, r = map(str.split, line.split('|'))
+ l = set(filter(str.isdigit, l))
+ r = set(filter(str.isdigit, r))
+ if s := l & r:
+ acc += 1 << (len(s) - 1)
+ print(acc)
+
+
+if __name__ == "__main__":
+ main() \ No newline at end of file