aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

a.py (187B)


      1 import fileinput
      2 
      3 p = 50
      4 c = 0
      5 with fileinput.input() as lines:
      6 	for line in lines:
      7 		s = 1 if line[0] == "R" else -1
      8 		p = (p + s * int(line[1:])) % 100
      9 		if p == 0:
     10 			c += 1
     11 
     12 print(c)