diff --git a/2025/day05/part1.py b/2025/day05/part1.py new file mode 100644 index 0000000..88cb004 --- /dev/null +++ b/2025/day05/part1.py @@ -0,0 +1,24 @@ +text: str + +with open("input.txt") as f: + text = f.read() + +total: int = 0 + + +ranges_str, dates = text.split("\n\n") + +ranges: list[tuple[int, int]] = [] +for range_str in ranges_str.splitlines(): + start, stop = range_str.split("-") + ranges.append((int(start), int(stop))) + +dates: list[int] = [int(date) for date in dates.splitlines()] +dates.sort() + +for date in dates: + for start, stop in ranges: + if (start <= date <= stop): + total += 1 + break +print(total) \ No newline at end of file