aoc

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

a.py (217B)


      1 import fileinput
      2 
      3 a = {}
      4 with fileinput.input() as lines:
      5 	for line in lines:
      6 		v, l2 = line[:-1].split(': ')
      7 		a[v] = l2.split(' ')
      8 
      9 def np(v):
     10 	return 1 if v == 'out' else sum(np(w) for w in a[v])
     11 
     12 print(np('you'))