+/AoC
advent of code
git clone https://git.julia.blue/+/AoC
d2cfa7f
master
1nums = lambda l : {int (i )for i in l .split ()} 2lines = [map (nums ,l .split (":" )[- 1 ].split ("|" ))for l in open ("input" )] 3score = lambda n :1 << n - 1 if n > 0 else 0 4matches = [len (winners & yours )for winners ,yours in lines ] 5sum (map (score ,matches ))) 6 7counts = [1 ]* len (matches ) 8for i in range (len (matches )): 9for j in range (i + 1 ,i + 1 + matches [i ]): 10counts [j ]+= counts [i ] 11sum (counts ))