|
|
@ -1,6 +1,7 @@ |
|
|
|
pairs = [[[int(n) for n in m.split("-")] for m in l.split(",")] for l in [i for i in open("input.txt", 'r').read().splitlines()]] |
|
|
|
pairs = [[[int(n) for n in m.split("-")] for m in l.split(",")] for l in [i for i in open("input.txt", 'r').read().splitlines()]] |
|
|
|
|
|
|
|
|
|
|
|
sum = 0 |
|
|
|
sum = 0 |
|
|
|
|
|
|
|
sum2 = 0 |
|
|
|
|
|
|
|
|
|
|
|
for p in pairs: |
|
|
|
for p in pairs: |
|
|
|
if p[0][0] <= p[1][0] and p[0][1] >= p[1][1]: |
|
|
|
if p[0][0] <= p[1][0] and p[0][1] >= p[1][1]: |
|
|
@ -8,4 +9,10 @@ for p in pairs: |
|
|
|
elif p[0][0] >= p[1][0] and p[0][1] <= p[1][1]: |
|
|
|
elif p[0][0] >= p[1][0] and p[0][1] <= p[1][1]: |
|
|
|
sum += 1 |
|
|
|
sum += 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if p[0][0] <= p[1][1] and p[0][1] >= p[1][0]: |
|
|
|
|
|
|
|
sum2 += 1 |
|
|
|
|
|
|
|
elif p[1][0] <= p[0][1] and p[1][1] >= p[0][0]: |
|
|
|
|
|
|
|
sum2 += 1 |
|
|
|
|
|
|
|
|
|
|
|
print(sum) |
|
|
|
print(sum) |
|
|
|
|
|
|
|
print(sum2) |