26 lines
391 B
Python
Executable File
26 lines
391 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
last = -1
|
|
count = 0
|
|
|
|
with open('input') as f:
|
|
window = []
|
|
for line in f:
|
|
depth = int(line)
|
|
|
|
window.append(depth)
|
|
if len(window) < 3:
|
|
continue
|
|
|
|
if len(window) > 3:
|
|
window.pop(0)
|
|
|
|
cur = sum(window)
|
|
|
|
if last > 0 and last < cur:
|
|
count = count +1
|
|
last = cur
|
|
|
|
print(count)
|
|
|