remove readlines
This commit is contained in:
parent
51c8d0d12a
commit
8a4688ecab
|
@ -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])
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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"))))
|
||||
|
|
|
@ -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")))
|
||||
|
|
|
@ -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)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user