b.py (323B) [raw]
1 #!/usr/bin/env python3 2 import sys 3 4 prev = None 5 mem = [] 6 count = 0 7 i = 0 8 for l in sys.stdin: 9 curr = int(l.strip()) 10 11 if len(mem) < 3: 12 mem.append(curr) 13 continue 14 else: 15 mem[i % 3] = curr 16 i += 1 17 18 s = sum(mem) 19 if prev and s > prev: 20 count += 1 21 prev = s 22 23 print(count)