This commit is contained in:
thib8956 committed 2026-11-11 15:36:53 +01:00
1 parent 0232b9326d
commit 5c3fb89870
50 files changed
+97 -117

No files matched your search

+2 -2
View File
@@ -17,7 +17,7 @@ def main(lines):
c = Counter(line)
total_twice += 1 if [k for k,v in c.items() if v == 2] != [] else 0
total_thrice += 1 if [k for k,v in c.items() if v == 3] != [] else 0
print(f"Part 1: ", total_twice * total_thrice)
print("Part 1: ", total_twice * total_thrice)
part2(lines)
@@ -26,5 +26,5 @@ if __name__ == "__main__":
import sys
infile = sys.argv[1] if len(sys.argv) > 1 else "example.txt"
with open(infile) as inp:
main([l.rstrip() for l in inp.readlines()])
main([l.rstrip() for l in inp])
+3 -4
View File
@@ -1,8 +1,7 @@
#!/usr/bin/env python3
import re
import itertools
from dataclasses import dataclass
from collections import defaultdict
from dataclasses import dataclass
@dataclass
@@ -35,7 +34,7 @@ def main(inp):
regions[x, y].add(id_)
total = sum(len(x) > 1 for x in regions.values())
print(f"Part 1: ", total)
print("Part 1: ", total)
all_ids = set()
overlapping_ids = set()
@@ -51,5 +50,5 @@ if __name__ == '__main__':
import sys
infile = sys.argv[1] if len(sys.argv) > 1 else "example.txt"
with open(infile) as inp:
main([l.rstrip() for l in inp.readlines()])
main([l.rstrip() for l in inp])
+1 -2
View File
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
import re
from collections import defaultdict, Counter
from pprint import pprint
from collections import defaultdict
def main(inp):
-1
View File
@@ -1,6 +1,5 @@
from collections import defaultdict, namedtuple
Point = namedtuple('Point', ['x', 'y'])
+1 -1
View File
@@ -84,5 +84,5 @@ if __name__ == '__main__':
import sys
infile = sys.argv[1] if len(sys.argv) > 1 else "example.txt"
with open(infile) as inp:
main([l.rstrip() for l in inp.readlines()])
main([l.rstrip() for l in inp])