<gh_stars>0
import numpy
import os


def main():
    # Part 1
    # Get file in lines
    with open("input.txt", "r", encoding="utf-8") as file:
        # strip out the new line
        puzzle_lines = [line.rstrip('\n') for line in file]
    # Convert to int
    puzzle_lines_int = [int(elem) for elem in puzzle_lines]
    # Diff
    line_diff = numpy.diff(puzzle_lines_int)
    # Check for larger keys in row
    meas_increasing = 0
    for i, value in enumerate(line_diff):
        if(value > 0):
            meas_increasing += 1
    # Output
    print("Part1: Elements increasing: " + str(meas_increasing))

    # Part 2
    # Start on 1 and use two rolling windows
    meas_increasing = 0
    for i in range(1, len(puzzle_lines_int)):
        meas_prev = numpy.sum(puzzle_lines_int[i-1:i+2])
        meas_cur = numpy.sum(puzzle_lines_int[i:i+3])

        if meas_prev < meas_cur:
            meas_increasing += 1
    # Output
    print("Part2: Elements increasing: " + str(meas_increasing))

if __name__ == "__main__":
    main()

import numpy
import os


def main():
    # Part 1
    # Get file in lines
    with open("input.txt", "r", encoding="utf-8") as file:
        # strip out the new line
        puzzle_lines = [line.rstrip('\n') for line in file]
    # Convert to int
    puzzle_lines_int = [int(elem) for elem in puzzle_lines]
    # Diff
    line_diff = numpy.diff(puzzle_lines_int)
    # Check for larger keys in row
    meas_increasing = 0
    for i, value in enumerate(line_diff):
        if(value > 0):
            meas_increasing += 1
    # Output
    print("Part1: Elements increasing: " + str(meas_increasing))

    # Part 2
    # Start on 1 and use two rolling windows
    meas_increasing = 0
    for i in range(1, len(puzzle_lines_int)):
        meas_prev = numpy.sum(puzzle_lines_int[i-1:i+2])
        meas_cur = numpy.sum(puzzle_lines_int[i:i+3])

        if meas_prev < meas_cur:
            meas_increasing += 1
    # Output
    print("Part2: Elements increasing: " + str(meas_increasing))

if __name__ == "__main__":
    main()
# Part 1 # Get file in lines # strip out the new line # Convert to int # Diff # Check for larger keys in row # Output # Part 2 # Start on 1 and use two rolling windows # Output