remove readlines

This commit is contained in:
Lynn Ochs 2020-12-03 23:48:33 +01:00
parent 51c8d0d12a
commit 8a4688ecab
6 changed files with 6 additions and 6 deletions

View File

@ -1,2 +1,2 @@
l=set(map(int,open("/dev/stdin").readlines()))
l=set(map(int,open("/dev/stdin")))
print([a*(2020-a) for a in l if 2020-a in l])

View File

@ -1,2 +1,2 @@
l=list(map(int,open("/dev/stdin").readlines()))
l=list(map(int,open("/dev/stdin")))
print([a*b*c for a in l for b in l for c in l if a+b+c==2020])

View File

@ -1 +1 @@
print(sum(int((s:=l[0].split('-'))[0])<=l[2].count(l[1][0])<=int(s[1]) for l in map(str.split,open("/dev/stdin").readlines())))
print(sum(int((s:=l[0].split('-'))[0])<=l[2].count(l[1][0])<=int(s[1]) for l in map(str.split,open("/dev/stdin"))))

View File

@ -1,4 +1,4 @@
def f(k):
a,b,c=*map(int,k[0].split('-')),k[1][0]
return (k[2][a-1]==c)^(k[2][b-1]==c)
print(sum(f(x.split()) for x in open("/dev/stdin").readlines()))
print(sum(f(x.split()) for x in open("/dev/stdin")))

View File

@ -1 +1 @@
print(sum('#'==open('/dev/stdin').readlines()[i][(i*3)%31] for i in range(323)))
print(sum('#'==list(open('/dev/stdin'))[i][(i*3)%31] for i in range(323)))

View File

@ -1,3 +1,3 @@
d=open("/dev/stdin").readlines()
d=list(open("/dev/stdin"))
def f(y,x=1):return sum(d[i][i*y//x%31]=='#' for i in range(0,323,x))
print(f(1)*f(3)*f(5)*f(7)*f(1,2))