Advent of Code 2022 - 2nd attempt in c++
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

8 lines
370 B

#!/usr/bin/env python3
from sys import stdin
data = [(range(a1, a2+1), range(b1, b2+1)) for (a1, a2), (b1, b2) in
[(map(int, a.split("-")), map(int, b.split("-")))
for a, b in [x.split(",") for x in stdin.readlines()]]]
print(sum(all(x in b for x in a) or all(x in a for x in b) for a, b in data))
print(sum(bool(set(a) & set(b)) for a, b in data))