24 lines
495 B
Python
24 lines
495 B
Python
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) |