import sys lines = sys.stdin.read().splitlines() values = [int(line) for line in lines] # part 1 answer_1 = sum(v2 > v1 for v1, v2 in zip(values[:-1], values[1:])) print(f"answer 1 is {answer_1}") # part 2 runnings = [sum(values[i : i + 3]) for i in range(len(values) - 2)] answer_2 = sum(v2 > v1 for v1, v2 in zip(runnings[:-1], runnings[1:])) print(f"answer 2 is {answer_2}")