26 lines
478 B
Python
26 lines
478 B
Python
with open("input", "r") as f:
|
|
lines = f.read().splitlines()
|
|
|
|
ranges = []
|
|
ingredients = []
|
|
|
|
for line in lines:
|
|
if not line:
|
|
continue
|
|
if "-" in line:
|
|
start, end = line.split("-")
|
|
ranges.append((int(start), int(end)))
|
|
else:
|
|
ingredients.append(int(line))
|
|
|
|
s = 0
|
|
|
|
for ingredient in ingredients:
|
|
for range_ in ranges:
|
|
start, end = range_
|
|
if start <= ingredient <= end:
|
|
s += 1
|
|
break
|
|
|
|
print(s)
|