1.py 256 B

12345678910
  1. import util
  2. from more_itertools.recipes import sliding_window as sw
  3. input = util.get_input("1.input", int)
  4. def day_1(input, size):
  5. return len([1 for [a, b] in sw(sw(input, size), 2) if sum(a) < sum(b)])
  6. print(day_1(input, 1))
  7. print(day_1(input, 3))