about summary refs log tree commit diff stats
path: root/wiki/lib/plugins/cli.php
Commit message (Collapse)AuthorAgeFilesLines
* installed dokuwiki, added to navbar, updated newsahriman2018-12-031-0/+11
/a> 31 32 33 34 35 36 37 38 39
#!/usr/bin/env python

curr = None
count = 0

with open("day1.txt") as input:
    for line in input:
        line = int(line)
        if not curr:
            curr = line
            continue
        if line > curr:
            count += 1
        curr = line

print(count)


curr = None
count = 0
with open("day1.txt") as input:
    first = int(next(input))
    second = int(next(input))
    third = int(next(input))
    while True:
        if not curr:
            curr = first + second + third
            continue
        if first + second + third > curr:
            count += 1
        curr = first + second + third
        try:
            first = second
            second = third
            third = int(next(input))
        except StopIteration:
            break

print(count)