AoC2020/04-2-1.py

3 lines
495 B
Python
Raw Normal View History

2020-12-04 10:52:46 +00:00
u=lambda x:7==sum(map(lambda y:len(y)>5 and{'by':lambda x:1920<=int(x)<=2002,'iy':lambda x:2010<=int(x)<=2020,'ey':lambda x:2020<=int(x)<=2030,'hg':lambda x:(x[-1]=='m'and 150<=int(x[:-2])<=193)or(x[-1]=='n'and 59<=int(x[:-2])<=76),'hc':lambda x:x[0]=='#'and len(x)==7 and int(x[1:],16)>=0,'ec':lambda x:x in'ambblubrngrygrnhzloth','pi':lambda x:len(x)==9,'ci':lambda x:False}[y[:2]](y[4:]),x))
2020-12-04 08:11:08 +00:00
print(sum(map(lambda x:u(x.replace('\n',' ').split(' ')),open("/dev/stdin").read().split("\n\n"))))