From a5b0fe494dfea1d96c3ca23731ff3f467d97fefc Mon Sep 17 00:00:00 2001 From: Fedor Lyanguzov Date: Sun, 8 Dec 2024 08:30:58 +0300 Subject: [PATCH] 08.1, 08.2 python --- 08/08.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 08/08.py diff --git a/08/08.py b/08/08.py new file mode 100644 index 0000000..60cd581 --- /dev/null +++ b/08/08.py @@ -0,0 +1,46 @@ +from collections import defaultdict +import string +from itertools import combinations + +data = open("input.txt").read().strip().split("\n") + +d = defaultdict(list) +t = set(string.ascii_letters+string.digits) +for i, l in enumerate(data): + for j, c in enumerate(l): + if c in t: + d[c].append((i, j)) +width = len(data[0]) +height = len(data) + +def bound(x, width, height): + i, j = x + return 0<=i