+/AoC
advent of code
git clone https://git.julia.blue/+/AoC
a7718a0
master
1from itertools import accumulate ,starmap 2from operator import mul 3 4steps = [0 ,1 ] 5for line in open ("input" ): 6steps += [0 ]if line .startswith ("n" )else [0 ,int (line .split ()[- 1 ])] 7cycles = list (accumulate (steps )) 8sum (starmap (mul ,list (enumerate (cycles ))[20 ::40 ]))) 9for i in range (1 ,len (steps )- 1 ): 10pos = (i - 1 )% 40 11if not pos : 12"#" if abs (pos - cycles [i ])< 2 else "." ,end = "" ) 14