s_id string | p_id string | u_id string | date string | language string | original_language string | filename_ext string | status string | cpu_time string | memory string | code_size string | code string | error string | stdout string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s724021207 | p01137 | u361804125 | 1381842243 | Python | Python | py | Runtime Error | 39870 | 4212 | 220 | while 1:
e = input()
if e == 0:
break;
else:
mini = 10000000
for z in range(100):
for y in range(1000):
x = e - y*y - z*z*z
if x >= 0:
if x + y + z < mini:
mini = x + y + z
print mini | File "/tmp/tmp07uynri2/tmpbb3q3ueq.py", line 13
print mini
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s282049929 | p01137 | u361804125 | 1381843154 | Python | Python | py | Runtime Error | 39870 | 4212 | 219 | while 1:
e = input()
if e == 0:
break;
else:
mini = 1000000
for z in range(100):
for y in range(1000):
x = e - y*y - z*z*z
if x >= 0:
if x + y + z < mini:
mini = x + y + z
print mini | File "/tmp/tmp6auujywq/tmp21a1u7td.py", line 13
print mini
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s665218091 | p01137 | u361804125 | 1381843844 | Python | Python | py | Runtime Error | 39860 | 4224 | 260 | while 1:
e = input()
if e == 0:
break;
else:
mini = 1000000
for z in range(100):
if z*z*z > e: break
for y in range(1000):
x = e - y*y - z*z*z
if x >= 0:
if x + y + z < mini:
mini = x + y + z
else:
break
print mini | File "/tmp/tmp5bh60_ky/tmpm9ny4_99.py", line 16
print mini
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s072501425 | p01137 | u361804125 | 1381844118 | Python | Python | py | Runtime Error | 39870 | 4220 | 260 | while 1:
e = input()
if e == 0:
break;
else:
mini = 1000000
for z in range(101):
if z*z*z > e: break
for y in range(1001):
x = e - y*y - z*z*z
if x >= 0:
if x + y + z < mini:
mini = x + y + z
else:
break
print mini | File "/tmp/tmpikap3h1c/tmp7uohi9e_.py", line 16
print mini
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s298444313 | p01137 | u361804125 | 1381844516 | Python | Python | py | Runtime Error | 39860 | 4220 | 260 | while 1:
e = input()
if e == 0:
break;
else:
mini = 1000000
for z in range(101):
if z*z*z > e: break
for y in range(1001):
x = e - y*y - z*z*z
if x >= 0:
if x + y + z < mini:
mini = x + y + z
else:
break
print mini | File "/tmp/tmphdxex4ij/tmpbg1j1d9u.py", line 16
print mini
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s404907283 | p01137 | u361804125 | 1381844726 | Python | Python | py | Runtime Error | 39870 | 4220 | 260 | while 1:
e = input()
if e == 0:
break;
else:
mini = 1000000
for z in range(101):
if z*z*z > e: break
for y in range(1001):
x = e - y*y - z*z*z
if x >= 0:
if x + y + z < mini:
mini = x + y + z
else:
break
print mini | File "/tmp/tmpdr1z3xu3/tmppwdprz_y.py", line 16
print mini
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s877010545 | p01137 | u553881259 | 1391324697 | Python | Python | py | Runtime Error | 39870 | 4196 | 240 | while 1:
e = input()
if e==0 : break
m = 1<<30
z = 0
while z*z*z <= e:
y = 0
while y*y + z*z*z <= e:
x = e - z*z*z - y*y
m = min(m, x+y+z)
y+=1
z+=1
print m | File "/tmp/tmp7plh33hp/tmph50g6xw6.py", line 13
print m
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s966999818 | p01137 | u633068244 | 1398235307 | Python | Python | py | Runtime Error | 39850 | 74004 | 227 | while 1:
e = input()
if e == 0: break
ans = 3*e
for z in range(e+1):
z3 = z**3
if z3 > e: break
for y in range(e+1):
y2 = y**2
x = e - y2 - z3
if x >= 0:
ans = min(ans,x+y+z)
else:
break
print ans | File "/tmp/tmpi7vp7e6t/tmp_lii936a.py", line 15
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s079925468 | p01137 | u633068244 | 1398235407 | Python | Python | py | Runtime Error | 39850 | 73940 | 216 | while 1:
e = input()
if e == 0: break
ans = 3*e
for z in range(e+1):
z3 = z**3
if z3 > e: break
for y in range(e+1):
x = e - y**2 - z3
if x >= 0:
ans = min(ans,x+y+z)
else:
break
print ans | File "/tmp/tmpcjmyglah/tmpmderjt7w.py", line 14
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s623018802 | p01137 | u633068244 | 1398237659 | Python | Python | py | Runtime Error | 0 | 0 | 164 | while 1:
e = ans = input()
if e == 0: break
for z in range(e):
z3 = z**3
if z3 > e: break
y = int((e-z3)**0.5)
ans = min(ans,e+y+z-y**2-z3)
print ans | File "/tmp/tmpxl2qhuwz/tmps4qt8ruc.py", line 6
if z3 > e: break
TabError: inconsistent use of tabs and spaces in indentation
| |
s402806384 | p01138 | u633068244 | 1422552576 | Python | Python | py | Runtime Error | 0 | 0 | 364 | def to_sec(a):
h,m,s = map(int,a.split(":"))
return 3600*h+60*m+s
while 1:
n = int(raw_input())
if n == 0: break
used = [0]*84401
for loop in range(n):
a,b = raw_input().split()
a,b = to_sec(a),to_sec(b)
used[a] += 1
used[b] -= 1
for i in range(1,84400):
used[i] += used[i-1]
print max(used) | File "/tmp/tmpf1d_ao20/tmpvxplllrt.py", line 16
print max(used)
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s729530130 | p01138 | u214600613 | 1498470771 | Python | Python | py | Runtime Error | 0 | 0 | 270 | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
a,b,c=map(int,a.split(':'));
d,e,f=map(int,d.split(':'));
dp[a*3600+b*60+c]+=1
dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmp_jsf9vw_/tmpant47rwq.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s327248861 | p01138 | u214600613 | 1498470913 | Python | Python | py | Runtime Error | 0 | 0 | 270 | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
a,b,c=map(int,a.split(':'));
d,e,f=map(int,d.split(':'));
dp[a*3600+b*60+c]+=1
dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmpppjbgij1/tmp1q9zmsle.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s001815991 | p01138 | u214600613 | 1498471014 | Python | Python | py | Runtime Error | 0 | 0 | 272 | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
a,b,c=map(int,a.split(':'));
d,e,f=map(int,d.split(':'));
# dp[a*3600+b*60+c]+=1
# dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmpq0ku3_nx/tmpifkxxmdm.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s556001507 | p01138 | u214600613 | 1498471030 | Python | Python | py | Runtime Error | 0 | 0 | 274 | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
# a,b,c=map(int,a.split(':'));
# d,e,f=map(int,d.split(':'));
# dp[a*3600+b*60+c]+=1
# dp[d*3600+e*60+f]-=1
for i in range(m):
dp[i+1]+=dp[i]
print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmp3vm299zu/tmp2cea70qs.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s973795760 | p01138 | u214600613 | 1498471049 | Python | Python | py | Runtime Error | 0 | 0 | 277 | m=24*60*60
while True:
n=int(input())
if n==0:break
dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
# a,b,c=map(int,a.split(':'));
# d,e,f=map(int,d.split(':'));
# dp[a*3600+b*60+c]+=1
# dp[d*3600+e*60+f]-=1
# for i in range(m):
# dp[i+1]+=dp[i]
# print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmpas3clr0i/tmpvwactp_r.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s207518192 | p01138 | u214600613 | 1498471065 | Python | Python | py | Runtime Error | 0 | 0 | 278 | m=24*60*60
while True:
n=int(input())
if n==0:break
# dp=[0]*(m+1)
for _ in range(n):
a,d=input().split()
# a,b,c=map(int,a.split(':'));
# d,e,f=map(int,d.split(':'));
# dp[a*3600+b*60+c]+=1
# dp[d*3600+e*60+f]-=1
# for i in range(m):
# dp[i+1]+=dp[i]
# print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmp705r0s5k/tmp1kcopftm.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s890488780 | p01138 | u214600613 | 1498471082 | Python | Python | py | Runtime Error | 0 | 0 | 280 | m=24*60*60
while True:
n=int(input())
if n==0:break
# dp=[0]*(m+1)
# for _ in range(n):
# a,d=input().split()
# a,b,c=map(int,a.split(':'));
# d,e,f=map(int,d.split(':'));
# dp[a*3600+b*60+c]+=1
# dp[d*3600+e*60+f]-=1
# for i in range(m):
# dp[i+1]+=dp[i]
# print(max(dp)) | Traceback (most recent call last):
File "/tmp/tmpjy2h4vzc/tmp4lnie22k.py", line 3, in <module>
n=int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s550272295 | p01138 | u779627195 | 1353409897 | Python | Python | py | Runtime Error | 19930 | 6796 | 488 | while 1:
n = int(raw_input())
if not n: break
cnt = 1
t = [0 for i in xrange(24*60*60)]
for i in xrange(n):
a = raw_input().split()
h,m,s = [0,0],[0,0],[0,0]
for i in xrange(2):
h[i],m[i],s[i] = map(int, a[i].split(':'))
t1 = h[0]*60**2 + m[0]*60 + s[0]
t2 = h[1]*60**2 + m[1]*60 + s[1]
for i in xrange(t1,t2):
t[i] += 1
for i in xrange(24*60*60):
cnt = max(t[i], cnt)
print cnt | File "/tmp/tmphey_c6q6/tmpc3f6cu9w.py", line 19
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s718969122 | p01139 | u633068244 | 1422554407 | Python | Python | py | Runtime Error | 0 | 0 | 601 | def rec(x,y,c):
if A[y][x] == ".": A[y][x] = c
elif A[y][x] != c : A[y][x] = "x"
for dx,dy in zip([1,0,-1,0],[0,1,0,-1]):
nx,ny = x+dx,y+dy
if 0 <= nx < w and 0 <= ny < h and A[ny][nx] in [".","b" if c == "w" else "w"]:
rec(nx,ny,c)
while 1:
w,h = map(int,raw_input().split())
if w == 0: break
A = [list(raw_input()) for _ in range(h)]
for y in range(h):
for x in range(w):
if A[y][x] == "W": rec(x,y,"w")
if A[y][x] == "B": rec(x,y,"b")
print sum(Ai.count("b") for Ai in A),sum(Ai.count("w") for Ai in A) | File "/tmp/tmp00uf0kbk/tmpwg0b2tdh.py", line 17
print sum(Ai.count("b") for Ai in A),sum(Ai.count("w") for Ai in A)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s178173644 | p01139 | u316268279 | 1426006884 | Python | Python3 | py | Runtime Error | 0 | 0 | 1026 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def dfs(x, y, symbol,land):
if land[y][x] != '.':
return ([land[y][x]] if not str(land[y][x]).isnumeric() else False), 0
land[y][x] = symbol
count = 1
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
owner_list = []
for dx,dy in dxdy:
if 0 <= x + dx < len(land[0]) and 0 <= y + dy < len(land):
ret,c = dfs(x + dx, y + dy, symbol,land)
count += c
if ret is not False:
owner_list += ret
return (list(set(owner_list)), count)
while True:
w,h = map(int,input().split())
if w == 0 and h == 0:
break
land = [list(input()) for i in range(0,h)]
symbol = 0
count_dict = {'W' :0, 'B' :0}
for y in range(h):
for x in range(w):
if land[y][x] == '.':
ret, count = dfs(x,y,symbol,land)
if len(ret) == 1:
count_dict[ret[0]] += count
symbol += 1
print(count_dict['B'],count_dict['W']) | Traceback (most recent call last):
File "/tmp/tmp6h33_gd4/tmpovfxx_84.py", line 22, in <module>
w,h = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s113658624 | p01139 | u316268279 | 1426006975 | Python | Python3 | py | Runtime Error | 0 | 0 | 1026 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def dfs(x, y, symbol,land):
if land[y][x] != '.':
return ([land[y][x]] if not str(land[y][x]).isnumeric() else False), 0
land[y][x] = symbol
count = 1
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
owner_list = []
for dx,dy in dxdy:
if 0 <= x + dx < len(land[0]) and 0 <= y + dy < len(land):
ret,c = dfs(x + dx, y + dy, symbol,land)
count += c
if ret is not False:
owner_list += ret
return (list(set(owner_list)), count)
while True:
w,h = map(int,input().split())
if w == 0 and h == 0:
break
land = [list(input()) for i in range(0,h)]
symbol = 0
count_dict = {'W' :0, 'B' :0}
for y in range(h):
for x in range(w):
if land[y][x] == '.':
ret, count = dfs(x,y,symbol,land)
if len(ret) == 1:
count_dict[ret[0]] += count
symbol += 1
print(count_dict['B'],count_dict['W']) | Traceback (most recent call last):
File "/tmp/tmp7aevpf2k/tmpocfwm65b.py", line 22, in <module>
w,h = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s932529514 | p01139 | u408260374 | 1435401370 | Python | Python3 | py | Runtime Error | 0 | 0 | 1207 | def dfs(r, c, n):
if board[r][c] == n:
return
if board[r][c] in 'WB':
pile.append(board[r][c])
return
board[r][c] = n
drc = [(-1, 0), (0, 1), (1, 0), (0, -1)]
for dr, dc in drc:
nr, nc = r + dr, c + dc
if 0 <= nr < h and 0 <= nc < w:
dfs(nr, nc, n)
while True:
w, h = map(int, input().split())
if w == 0 and h == 0: break
board = [list(input()) for _ in range(h)]
place = 0
piles = []
black, white = [], []
for r in range(h):
for c in range(w):
if board[r][c] == '.':
pile = []
place += 1
dfs(r, c, place)
piles.append(pile)
for i, pile in enumerate(piles):
if not pile: continue
for p in pile:
if p != 'B':
break
else:
black.append(i+1)
for p in pile:
if p != 'W':
break
else:
white.append(i+1)
ans_b, ans_w = 0, 0
for row in board:
for c in row:
if c in black:
ans_b += 1
elif c in white:
ans_w += 1
print(ans_b, ans_w) | Traceback (most recent call last):
File "/tmp/tmpxmiy81um/tmp0xsv4csy.py", line 15, in <module>
w, h = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s612272186 | p01139 | u774593007 | 1436430453 | Python | Python | py | Runtime Error | 0 | 0 | 1580 | class Area:
def __init__(self,m,x,y):
self.m = m
self.f_W = False
self.f_B = False
self.side = 0
self.count = 0
self.standardx = x
self.standardy = y
self.check(x,y)
self.getSide()
def check(self,x,y):
if(y<0 or y >= len(m) or x<0 or x>=len(m[0])):
return
c = self.m[y][x]
if(c!=0):
if(c==1):
self.f_B=True
if(c==2):
self.f_W=True
return
else:
if(c==0):
self.m[y][x]=3
self.count += 1
self.check(x-1,y)
self.check(x+1,y)
self.check(x,y-1)
self.check(x,y+1)
def getSide(self):
if(self.f_B and self.f_W):
self.side = 0
elif(self.f_B):
self.side = 1
elif(self.f_W):
self.side = 2
else:
self.side = 0
return self.side
while True:
w,h = map(int,raw_input().split())
if(not w) :
break
m = []
for i in range(h):
m.append([])
l = raw_input()
for ii in range(w):
dic = {".":0,"B":1,"W":2}
m[i].append(dic[l[ii]])
B = 0
W = 0
for i,l in enumerate(m):
for ii,c in enumerate(l):
if(c==0):
a = Area(m,ii,i)
if(a.getSide() == 1):
B += a.count
elif(a.getSide() == 2):
W += a.count
print B,W | File "/tmp/tmp17zvk8u3/tmpd0ih551h.py", line 66
print B,W
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s617883593 | p01139 | u774593007 | 1436430538 | Python | Python | py | Runtime Error | 0 | 0 | 1580 | class Area:
def __init__(self,m,x,y):
self.m = m
self.f_W = False
self.f_B = False
self.side = 0
self.count = 0
self.standardx = x
self.standardy = y
self.check(x,y)
self.getSide()
def check(self,x,y):
if(y<0 or y >= len(m) or x<0 or x>=len(m[0])):
return
c = self.m[y][x]
if(c!=0):
if(c==1):
self.f_B=True
if(c==2):
self.f_W=True
return
else:
if(c==0):
self.m[y][x]=3
self.count += 1
self.check(x-1,y)
self.check(x+1,y)
self.check(x,y-1)
self.check(x,y+1)
def getSide(self):
if(self.f_B and self.f_W):
self.side = 0
elif(self.f_B):
self.side = 1
elif(self.f_W):
self.side = 2
else:
self.side = 0
return self.side
while True:
w,h = map(int,raw_input().split())
if(not w) :
break
m = []
for i in range(h):
m.append([])
l = raw_input()
for ii in range(w):
dic = {".":0,"B":1,"W":2}
m[i].append(dic[l[ii]])
B = 0
W = 0
for i,l in enumerate(m):
for ii,c in enumerate(l):
if(c==0):
a = Area(m,ii,i)
if(a.getSide() == 1):
B += a.count
elif(a.getSide() == 2):
W += a.count
print B,W | File "/tmp/tmpjjs2xvh6/tmpil7mtywj.py", line 66
print B,W
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s773747206 | p01139 | u774593007 | 1436430743 | Python | Python | py | Runtime Error | 0 | 0 | 1581 | class Area:
def __init__(self,m,x,y):
self.m = m
self.f_W = False
self.f_B = False
self.side = 0
self.count = 0
self.standardx = x
self.standardy = y
self.check(x,y)
self.getSide()
def check(self,x,y):
if(y<0 or y >= len(m) or x<0 or x>=len(m[0])):
return
c = self.m[y][x]
if(c!=0):
if(c==1):
self.f_B=True
if(c==2):
self.f_W=True
return
else:
if(c==0):
self.m[y][x]=3
self.count += 1
self.check(x-1,y)
self.check(x+1,y)
self.check(x,y-1)
self.check(x,y+1)
def getSide(self):
if(self.f_B and self.f_W):
self.side = 0
elif(self.f_B):
self.side = 1
elif(self.f_W):
self.side = 2
else:
self.side = 0
return self.side
while True:
w,h = map(int,raw_input().split())
if(not w) :
break
m = []
for i in range(h):
m.append([])
l = raw_input()
for ii in range(w):
dic = {".":0,"B":1,"W":2}
m[i].append(dic[l[ii]])
b = 0
w = 0
for i,l in enumerate(m):
for ii,c in enumerate(l):
if(c==0):
a = Area(m,ii,i)
if(a.getSide() == 1):
B += a.count
elif(a.getSide() == 2):
W += a.count
print B,W | File "/tmp/tmpe5e1qhm4/tmp5joru69u.py", line 67
print B,W
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s692870397 | p01139 | u774593007 | 1436430929 | Python | Python | py | Runtime Error | 0 | 0 | 1581 | class Area:
def __init__(self,m,x,y):
self.m = m
self.f_W = False
self.f_B = False
self.side = 0
self.count = 0
self.standardx = x
self.standardy = y
self.check(x,y)
self.getSide()
def check(self,x,y):
if(y<0 or y >= len(m) or x<0 or x>=len(m[0])):
return
c = self.m[y][x]
if(c!=0):
if(c==1):
self.f_B=True
if(c==2):
self.f_W=True
return
else:
if(c==0):
self.m[y][x]=3
self.count += 1
self.check(x-1,y)
self.check(x+1,y)
self.check(x,y-1)
self.check(x,y+1)
def getSide(self):
if(self.f_B and self.f_W):
self.side = 0
elif(self.f_B):
self.side = 1
elif(self.f_W):
self.side = 2
else:
self.side = 0
return self.side
while True:
w,h = map(int,raw_input().split())
if(not w) :
break
m = []
for i in range(h):
m.append([])
l = raw_input()
for ii in range(w):
dic = {".":0,"B":1,"W":2}
m[i].append(dic[l[ii]])
B = 0
W = 0
for i,l in enumerate(m):
for ii,c in enumerate(l):
if(c==0):
a = Area(m,ii,i)
if(a.getSide() == 1):
B += a.count
elif(a.getSide() == 2):
W += a.count
print B,W | File "/tmp/tmpx4m2lj84/tmp7tp3o_nn.py", line 67
print B,W
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s531738913 | p01139 | u797673668 | 1510310211 | Python | Python3 | py | Runtime Error | 0 | 0 | 1029 | from collections import Counter
def paint(field, i, j, b, f, moves={(-1, 0), (1, 0), (0, 1), (0, -1)}):
fij = field[i][j]
if fij & f:
return
if fij & 4 and not fij & b:
return
field[i][j] |= b | f
for di, dj in moves:
ni = i + di
nj = j + dj
if nj < 0 or w <= nj or ni < 0 or h <= ni:
continue
paint(field, ni, nj, b, f)
buf = []
chardict = {'.': 0, 'W': 5, 'B': 6}
while True:
w, h = map(int, input().split())
if w == 0:
break
field = []
init_w, init_b = 0, 0
for _ in range(h):
line = input().strip()
init_w += line.count('W')
init_b += line.count('B')
field.append([chardict[c] for c in line])
for i in range(h):
for j in range(w):
fij = field[i][j]
if fij & 4 and not fij & 24:
paint(field, i, j, fij & 3, (fij & 3) << 3)
result = Counter(b & 3 for row in field for b in row)
print(result[2] - init_b, result[1] - init_w) | Traceback (most recent call last):
File "/tmp/tmpyi00q4fe/tmp870jus1c.py", line 22, in <module>
w, h = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s330821932 | p01139 | u797673668 | 1510310295 | Python | Python3 | py | Runtime Error | 0 | 0 | 1073 | import sys
from collections import Counter
sys.set_coroutine_wrapper(2500)
def paint(field, i, j, b, f, moves={(-1, 0), (1, 0), (0, 1), (0, -1)}):
fij = field[i][j]
if fij & f:
return
if fij & 4 and not fij & b:
return
field[i][j] |= b | f
for di, dj in moves:
ni = i + di
nj = j + dj
if nj < 0 or w <= nj or ni < 0 or h <= ni:
continue
paint(field, ni, nj, b, f)
buf = []
chardict = {'.': 0, 'W': 5, 'B': 6}
while True:
w, h = map(int, input().split())
if w == 0:
break
field = []
init_w, init_b = 0, 0
for _ in range(h):
line = input().strip()
init_w += line.count('W')
init_b += line.count('B')
field.append([chardict[c] for c in line])
for i in range(h):
for j in range(w):
fij = field[i][j]
if fij & 4 and not fij & 24:
paint(field, i, j, fij & 3, (fij & 3) << 3)
result = Counter(b & 3 for row in field for b in row)
print(result[2] - init_b, result[1] - init_w) | Traceback (most recent call last):
File "/tmp/tmpqnel8xs4/tmpkhvt9zqu.py", line 4, in <module>
sys.set_coroutine_wrapper(2500)
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'sys' has no attribute 'set_coroutine_wrapper'
| |
s564411829 | p01139 | u248416507 | 1510728205 | Python | Python | py | Runtime Error | 0 | 0 | 2010 |
W = 0
H = 0
island = list()
NOT_SUR = 0
BLACK = 1
WHITE = 2
def read_island():
island = list()
w, h = map(int, raw_input().split())
for i in xrange(h):
line = raw_input()
chars = list()
for ch in line:
chars.append(ch)
island.append(chars)
return w, h, island
dir_x = [0, 1, 0, -1] # up, right, down, left
dir_y = [-1, 0, 1, 0]
def check_ex_adj(x, y, color):
global island
if island[y][x] != ".":
return False
for i in xrange(4):
next_x = x + dir_x[i]
next_y = y + dir_y[i]
if not (0 <= next_x < W) or not (0 <= next_y < H):
continue
if island[y + dir_y[i]][x + dir_x[i]] == color:
return True
for i in xrange(4):
next_x = x + dir_x[i]
next_y = y + dir_y[i]
if not (0 <= next_x < W) or not (0 <= next_y < H):
continue
island[y][x] = "B" if color == "W" else "W"
is_ex_adj = check_ex_adj(next_x, next_y, color)
island[y][x] = "."
if is_ex_adj:
return is_ex_adj
return False
def check_surrounded(x, y):
is_adj_b = check_ex_adj(x, y, "B")
is_adj_w = check_ex_adj(x, y, "W")
if is_adj_b and not is_adj_w:
return BLACK
elif not is_adj_b and is_adj_w:
return WHITE
return NOT_SUR
def solve():
global W
global H
global island
while True:
W, H, island = read_island()
if W == 0 and H == 0:
break
black_area = 0
white_area = 0
for x in xrange(W):
for y in xrange(H):
surrounded_by = check_surrounded(x, y)
if surrounded_by == NOT_SUR:
continue
if surrounded_by == BLACK: # Black
black_area += 1
elif surrounded_by == WHITE:
white_area += 1
print "{} {}".format(black_area, white_area)
if __name__ == "__main__":
solve() | File "/tmp/tmp_fmpuspl/tmpelgae334.py", line 90
print "{} {}".format(black_area, white_area)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s316675885 | p01139 | u248416507 | 1510728432 | Python | Python | py | Runtime Error | 0 | 0 | 2010 |
W = 0
H = 0
island = list()
NOT_SUR = 0
BLACK = 1
WHITE = 2
def read_island():
island = list()
w, h = map(int, raw_input().split())
for i in xrange(h):
line = raw_input()
chars = list()
for ch in line:
chars.append(ch)
island.append(chars)
return w, h, island
dir_x = [0, 1, 0, -1] # up, right, down, left
dir_y = [-1, 0, 1, 0]
def check_ex_adj(x, y, color):
global island
if island[y][x] != ".":
return False
for i in xrange(4):
next_x = x + dir_x[i]
next_y = y + dir_y[i]
if not (0 <= next_x < W) or not (0 <= next_y < H):
continue
if island[y + dir_y[i]][x + dir_x[i]] == color:
return True
for i in xrange(4):
next_x = x + dir_x[i]
next_y = y + dir_y[i]
if not (0 <= next_x < W) or not (0 <= next_y < H):
continue
island[y][x] = "B" if color == "W" else "W"
is_ex_adj = check_ex_adj(next_x, next_y, color)
island[y][x] = "."
if is_ex_adj:
return is_ex_adj
return False
def check_surrounded(x, y):
is_adj_b = check_ex_adj(x, y, "B")
is_adj_w = check_ex_adj(x, y, "W")
if is_adj_b and not is_adj_w:
return BLACK
elif not is_adj_b and is_adj_w:
return WHITE
return NOT_SUR
def solve():
global W
global H
global island
while True:
W, H, island = read_island()
if W == 0 and H == 0:
break
black_area = 0
white_area = 0
for x in xrange(W):
for y in xrange(H):
surrounded_by = check_surrounded(x, y)
if surrounded_by == NOT_SUR:
continue
if surrounded_by == BLACK: # Black
black_area += 1
elif surrounded_by == WHITE:
white_area += 1
print "{} {}".format(black_area, white_area)
if __name__ == "__main__":
solve() | File "/tmp/tmp6hoi36l9/tmpcmnpsu46.py", line 90
print "{} {}".format(black_area, white_area)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s174245490 | p01139 | u672443148 | 1517365550 | Python | Python3 | py | Runtime Error | 0 | 0 | 1277 | def fill(MAP,xy,stick):
global w,h
if stick=='B': sflag=0
else: sflag=1
x,y=(xy[0],xy[1])
if MAP[y][x][sflag]==0: MAP[y][x][sflag]=1
xlist=[1,-1,0,0]
ylist=[0,0,1,-1]
for dx,dy in zip(xlist,ylist):
nx=x+dx
ny=y+dy
if 0<=nx<w and 0<=ny<h:
if MAP[ny][nx][0]==-1 or MAP[ny][nx][1]==-1:
continue
elif MAP[ny][nx][sflag]==0:
fill(MAP,[nx,ny],stick)
def countMAP(MAP):
global w,h
countB=0
countW=0
for x in range(w):
for y in range(h):
if MAP[y][x]==[1,0]:
countB+=1
elif MAP[y][x]==[0,1]:
countW+=1
return countB,countW
while True:
w,h=map(int,input().split())
if w==h==0: break
MAP=[]
for i in range(h):
temp=input()
MAP.append([])
for j in range(w):
if temp[j]=='.': MAP[i].append([0,0])
elif temp[j]=='B': MAP[i].append([-1,0])
else: MAP[i].append([0,-1])
for y in range(h):
for x in range(w):
if MAP[y][x][0]==-1:
fill(MAP,[x,y],'B')
elif MAP[y][x][1]==-1:
fill(MAP,[x,y],'W')
countB,countW=countMAP(MAP)
print(countB,countW)
| Traceback (most recent call last):
File "/tmp/tmplr0jst6y/tmpx5fshdhu.py", line 31, in <module>
w,h=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s560275938 | p01139 | u672443148 | 1517365583 | Python | Python3 | py | Runtime Error | 0 | 0 | 1277 | def fill(MAP,xy,stick):
global w,h
if stick=='B': sflag=0
else: sflag=1
x,y=(xy[0],xy[1])
if MAP[y][x][sflag]==0: MAP[y][x][sflag]=1
xlist=[1,-1,0,0]
ylist=[0,0,1,-1]
for dx,dy in zip(xlist,ylist):
nx=x+dx
ny=y+dy
if 0<=nx<w and 0<=ny<h:
if MAP[ny][nx][0]==-1 or MAP[ny][nx][1]==-1:
continue
elif MAP[ny][nx][sflag]==0:
fill(MAP,[nx,ny],stick)
def countMAP(MAP):
global w,h
countB=0
countW=0
for x in range(w):
for y in range(h):
if MAP[y][x]==[1,0]:
countB+=1
elif MAP[y][x]==[0,1]:
countW+=1
return countB,countW
while True:
w,h=map(int,input().split())
if w==h==0: break
MAP=[]
for i in range(h):
temp=input()
MAP.append([])
for j in range(w):
if temp[j]=='.': MAP[i].append([0,0])
elif temp[j]=='B': MAP[i].append([-1,0])
else: MAP[i].append([0,-1])
for y in range(h):
for x in range(w):
if MAP[y][x][0]==-1:
fill(MAP,[x,y],'B')
elif MAP[y][x][1]==-1:
fill(MAP,[x,y],'W')
countB,countW=countMAP(MAP)
print(countB,countW)
| Traceback (most recent call last):
File "/tmp/tmpjk6xwauc/tmpw8blgy9g.py", line 31, in <module>
w,h=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s354789033 | p01139 | u104911888 | 1372657944 | Python | Python | py | Runtime Error | 0 | 0 | 906 | dx=(1,-1,0,0)
dy=(0,0,1,-1)
def dfsW(y,x):
if L[y][x]==".":
L[y][x]="P"
for i in range(4):
mx=x+dx[i]
my=y+dy[i]
if 0<=mx<w and 0<=my<h and L[my][mx]==".":
dfsW(my,mx)
def dfsB(y,x):
if L[y][x]==".":
L[y][x]="Q"
elif L[y][x]=="P":
L[y][x]="N"
for i in range(4):
mx=x+dx[i]
my=y+dy[i]
if 0<=mx<w and 0<=my<h and (L[my][mx]=="." or L[my][mx]=="P"):
dfsB(my,mx)
while True:
w,h=map(int,raw_input().split())
if w==h==0:break
L=[list(raw_input()) for i in range(h)]
for i in range(h):
for j in range(w):
if L[i][j]=="W":
dfsW(i,j)
for i in range(h):
for j in range(w):
if L[i][j]=="B":
dfsB(i,j)
cntW=cntB=0
for i in range(h):
cntW+=L[i].count("P")
cntB+=L[i].count("Q")
print cntB,cntW | File "/tmp/tmpsq5c89bt/tmp9laj2a5b.py", line 38
cntW+=L[i].count("P")
TabError: inconsistent use of tabs and spaces in indentation
| |
s162400790 | p01140 | u125742989 | 1559570919 | Python | Python3 | py | Runtime Error | 0 | 0 | 830 | from collections import Counter
while True:
N, M = map(int, input().split())
if N == 0 and M == 0:
break
H = [int(input()) for _ in range(N)]
W = [int(input()) for _ in range(M)]
for i in range(1, N):
H[i] += H[i-1]
for i in range(1, N):
W[i] += W[i-1]
all_H = [H[j] - H[i] for i in range(N) for j in range(i+1, N)]
all_H += H
all_W = {}
for i in range(M):
for j in range(i+1, M):
if all_W.get(W[j] - W[i]) is not None:
all_W[W[j] - W[i]] += 1
else:
all_W[W[j] - W[i]] = 1
for i in range(M):
if all_W.get(W[i]) is not None:
all_W[W[i]] += 1
else:
all_W[W[i]] = 1
ans = 0
for i in all_H:
ans += all_W[i]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp2mv23_rl/tmpxb2x14g8.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s584624029 | p01140 | u125742989 | 1559571044 | Python | Python3 | py | Runtime Error | 0 | 0 | 830 | from collections import Counter
while True:
N, M = map(int, input().split())
if N == 0 and M == 0:
break
H = [int(input()) for _ in range(N)]
W = [int(input()) for _ in range(M)]
for i in range(1, N):
H[i] += H[i-1]
for i in range(1, M):
W[i] += W[i-1]
all_H = [H[j] - H[i] for i in range(N) for j in range(i+1, N)]
all_H += H
all_W = {}
for i in range(M):
for j in range(i+1, M):
if all_W.get(W[j] - W[i]) is not None:
all_W[W[j] - W[i]] += 1
else:
all_W[W[j] - W[i]] = 1
for i in range(M):
if all_W.get(W[i]) is not None:
all_W[W[i]] += 1
else:
all_W[W[i]] = 1
ans = 0
for i in all_H:
ans += all_W[i]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpnio_m8sp/tmpz_gjl8ra.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s909207427 | p01140 | u125742989 | 1559571178 | Python | Python3 | py | Runtime Error | 0 | 0 | 834 | from collections import Counter
while True:
N, M = map(int, input().split())
if N == 0 and M == 0:
break
H = [int(input()) for _ in range(N)]
W = [int(input()) for _ in range(M)]
for i in range(1, N):
H[i] += H[i-1]
for i in range(1, M):
W[i] += W[i-1]
all_H = [H[j] - H[i] for i in range(N) for j in range(i+1, N)]
all_H += H
all_W = {}
for i in range(M):
for j in range(i+1, M):
if all_W.get(W[j] - W[i]) is not None:
all_W[W[j] - W[i]] += 1
else:
all_W[W[j] - W[i]] = 1
for i in range(M):
if all_W.get(W[i]) is not None:
all_W[W[i]] += 1
else:
all_W[W[i]] = 1
ans = 0
for i in all_H:
ans += all_W.get(i)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpaw_88j0k/tmpu9sl_exh.py", line 4, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s197074995 | p01140 | u633068244 | 1422358657 | Python | Python | py | Runtime Error | 0 | 0 | 514 | while 1:
N,M = map(int,raw_input().split())
if N == 0: break
h = [int(raw_input()) for _ in range(N)]
w = [int(raw_input()) for _ in range(M)]
ans = 0
H,W = h[:],w[:]
for i in range(N):
s = h[i]
for j in range(i+1,N):
s += h[j]
H.append(s)
for i in range(M):
s = w[i]
for j in range(i+1,N):
s += w[j]
W.append(s)
for hi in H:
for wi in W:
if hi == wi: ans += 1
print ans | File "/tmp/tmpcn31bbus/tmp43607_em.py", line 21
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s791499474 | p01140 | u633068244 | 1422358690 | Python | Python | py | Runtime Error | 19930 | 4548 | 514 | while 1:
N,M = map(int,raw_input().split())
if N == 0: break
h = [int(raw_input()) for _ in range(N)]
w = [int(raw_input()) for _ in range(M)]
ans = 0
H,W = h[:],w[:]
for i in range(N):
s = h[i]
for j in range(i+1,N):
s += h[j]
H.append(s)
for i in range(M):
s = w[i]
for j in range(i+1,M):
s += w[j]
W.append(s)
for hi in H:
for wi in W:
if hi == wi: ans += 1
print ans | File "/tmp/tmpt9v88_p4/tmplf_pf4_4.py", line 21
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s427311913 | p01140 | u266872031 | 1422720691 | Python | Python | py | Runtime Error | 19930 | 4348 | 665 | while(1):
[N,M]=[int(x) for x in raw_input().split()]
if N==0:
break
else:
H=[]
W=[]
for i in range(N):
H.append(int(raw_input()))
for i in range(M):
W.append(int(raw_input()))
S=0
for top in range(N):
for left in range(M):
h=0
w=0
right=left
for bottom in range(top,N):
h=h+H[bottom]
while w<h and right<M:
w=w+W[right]
right=right+1
if w==h:
S=S+1
print S | File "/tmp/tmp7epdf5me/tmpkwxhfxj1.py", line 25
print S
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s850250799 | p01140 | u731235119 | 1422946493 | Python | Python | py | Runtime Error | 19930 | 57428 | 1440 | from math import log
class SegmentTree :
def __init__ (self, N):
self.N = N
self.tree = [0 for i in range(2 * N - 1)]
def update(self,i,x):
node = i + self.N - 1
self.tree[node] += x
while node > 0:
node = (node-1) / 2
self.tree[node] += x
def sum(self,here,l,r,hl,hr): #init : hl = 0, hr = N = 2 ** x - 1
if here >= self.N - 1 or l == hl and r == hr:
return self.tree[here]
midle = (hl + hr + 1) / 2 # belong to rchild
result = 0
if l < midle :
result += self.sum(2 * here + 1, l, min(r,midle - 1), hl, midle - 1)
if r >= midle :
result += self.sum(2 * here + 2, max(l,midle), r, midle, hr)
return result
while 1 :
n, m = map(int,raw_input().split(" "))
if (n, m) == (0,0):
break
Lon_idx = log(n,2)
Lat_idx = log(m,2)
LonN = 2 ** (int(Lon_idx) if Lon_idx.is_integer() else (int(Lon_idx)+1))
LatN = 2 ** (int(Lat_idx) if Lat_idx.is_integer() else (int(Lat_idx)+1))
LonST = SegmentTree(LonN)
LatST = SegmentTree(LatN)
for i in range(0,n):
LonST.update(i,int(raw_input()))
for i in range(0,m):
LatST.update(i,int(raw_input()))
Lon = [0 for i in range(n*1000+1)]
Lat = [0 for i in range(m*1000+1)]
for i in range(1,n+1):
for j in range(n+1-i):
Lon[LonST.sum(0,j,j+i-1,0,LonN-1)]+=1
for i in range(1,m+1):
for j in range(m+1-i):
Lat[LatST.sum(0,j,j+i-1,0,LatN-1)]+=1
max_width = min(LonST.tree[0],LatST.tree[0])
print sum([Lon[i]*Lat[i] for i in range(1,max_width+1)]) | File "/tmp/tmp3gbgegdx/tmpbyfml_ev.py", line 47
print sum([Lon[i]*Lat[i] for i in range(1,max_width+1)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s421772319 | p01140 | u316268279 | 1430131169 | Python | Python3 | py | Runtime Error | 19930 | 42480 | 771 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
N,M = map(int,input().split())
if N == 0 and M == 0:
break
square_count_w = [0 for i in range(1000*1500+1)]
square_count_h = [0 for i in range(1000*1500+1)]
heights = []
widths = []
for i in range(N):
height = int(input())
square_count_h[height] += 1
for h in heights[::-1]:
square_count_h[height+h] += 1
heights.append(height)
for i in range(M):
width = int(input())
square_count_w[width] += 1
for w in widths[::-1]:
square_count_w[width+w] += 1
widths.append(width)
ans = 0
for i in range(1000*1500+1):
ans += square_count_w[i] * square_count_h[i]
print(ans) | Traceback (most recent call last):
File "/tmp/tmp6ri6_6as/tmpqs7icvs_.py", line 5, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s073891114 | p01140 | u408260374 | 1430134448 | Python | Python | py | Runtime Error | 19920 | 100932 | 593 | while True:
N, M = map(int, raw_input().split())
if N == 0 and M == 0: break
h = [input() for _ in range(N)]
for i in range(N-1):
h[i+1] += h[i]
w = [input() for _ in range(M)]
for i in range(M-1):
w[i+1] += w[i]
h = [0] + h
w = [0] + w
hl = [0] * (1000 * 1000)
wl = [0] * (1000 * 1000)
for i in range(N):
for j in range(i+1, N+1):
hl[h[j]-h[i]] += 1
for i in range(M):
for j in range(i+1, M+1):
wl[w[j]-w[i]] += 1
ans = 0
for i, j in zip(hl, wl):
ans += i*j
print ans | File "/tmp/tmpkeev1fdh/tmp2ye7msee.py", line 24
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s953695896 | p01140 | u408260374 | 1430134537 | Python | Python | py | Runtime Error | 19930 | 100916 | 601 | while True:
N, M = map(int, raw_input().split())
if N == 0 and M == 0: break
h = [input() for _ in range(N)]
for i in range(N-1):
h[i+1] += h[i]
w = [input() for _ in range(M)]
for i in range(M-1):
w[i+1] += w[i]
h = [0] + h
w = [0] + w
hl = [0] * (1000 * 1000 + 1)
wl = [0] * (1000 * 1000 + 1)
for i in range(N):
for j in range(i+1, N+1):
hl[h[j]-h[i]] += 1
for i in range(M):
for j in range(i+1, M+1):
wl[w[j]-w[i]] += 1
ans = 0
for i, j in zip(hl, wl):
ans += i*j
print ans | File "/tmp/tmp2y04q1kl/tmpcruder87.py", line 24
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s538430113 | p01140 | u572790226 | 1466063246 | Python | Python3 | py | Runtime Error | 40000 | 7888 | 593 | while True:
N, M = map(int, input().split())
if N == M == 0:
break
L = []
C = []
for i in range(N):
L.append(int(input()))
for i in range(M):
C.append(int(input()))
for i in range(2, N+1):
sL = []
for j in range(N + 1 - i):
sL.append(sum(L[j:i+j]))
L += sL
for i in range(2, M+1):
sC = []
for j in range(M +1 - i):
sC.append(sum(C[j:i+j]))
C += sC
count = 0
for x in C:
for y in L:
if x == y:
count += 1
print(count) | Traceback (most recent call last):
File "/tmp/tmpn1w6z5_d/tmp6jtaa8c5.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s878195211 | p01140 | u572790226 | 1466068652 | Python | Python3 | py | Runtime Error | 40000 | 41080 | 799 | while True:
N, M = map(int, input().split())
if N == M == 0:
break
L = []
C = []
dL = {}
count = 0
for i in range(N):
l = int(input())
L.append(l)
if not l in dL:
dL[l] = 1
else:
dL[l] += 1
sL = []
for i in range(2, N+1):
for j in range(N + 1 - i):
l = sum(L[j:i+j])
if not l in dL:
dL[l] = 1
else:
dL[l] += 1
for i in range(M):
c = int(input())
C.append(c)
if c in dL:
count += dL[c]
for i in range(2, M+1):
for j in range(M +1 - i):
c = sum(C[j:i+j])
if c in dL:
count += dL[c]
print(count)
| Traceback (most recent call last):
File "/tmp/tmpg2v19vzc/tmp8f415i09.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s314211946 | p01140 | u892219101 | 1474038878 | Python | Python3 | py | Runtime Error | 0 | 0 | 406 | import collections
cnt1=collections.Counter()
cnt2=collections.Counter()
n,m=map(int, input().split())
ll=[0]*1500
for i in range(n):
x=int(input())
for j in range(i):
ll[j]+=x
cnt1[ll[j]]+=1
for i in range(m):
x=int(input())
for j in range(i):
ll[j]+=x
cnt2[ll[j]]+=1
sets=set(cnt1.keys().cnt2.keys())
ans=0
for s in sets:
ans+=cnt1[s]*cnt2[s]
print(s) | Traceback (most recent call last):
File "/tmp/tmpznm25qvi/tmp469j4ozy.py", line 4, in <module>
n,m=map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s796117875 | p01140 | u358919705 | 1475493410 | Python | Python3 | py | Runtime Error | 40000 | 9120 | 510 | import itertools
while True:
N, M = map(int, input().split())
if not N:
break
hs = [0] + [int(input()) for i in range(N)]
ws = [0] + [int(input()) for i in range(M)]
for i in range(N):
hs[i + 1] += hs[i]
for i in range(M):
ws[i + 1] += ws[i]
xs = sorted(map(lambda x: x[1] - x[0], itertools.combinations(hs, 2)))
ys = sorted(map(lambda x: x[1] - x[0], itertools.combinations(ws, 2)))
ans = 0
for x in xs:
ans += ys.count(x)
print(ans) | Traceback (most recent call last):
File "/tmp/tmpte5i_ylm/tmpobzyh6qx.py", line 3, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s764993598 | p01140 | u797673668 | 1510299325 | Python | Python3 | py | Runtime Error | 0 | 0 | 601 | from collections import defaultdict
from itertools import accumulate
buf = []
while True:
n, m = int(input())
if n == 0:
break
hs = [int(input()) for _ in range(n)]
ws = [int(input()) for _ in range(m)]
ha = accumulate(hs)
wa = accumulate(ws)
hd = defaultdict(int)
wd = defaultdict(int)
for i in range(n):
for j in range(i + 1, n):
hd[ha[j] - ha[i]] += 1
wd[wa[j] - wa[i]] += 1
ans = 0
for h, cnt in hd.items():
if h in wd:
ans += cnt * wd[h]
buf.append(ans)
print('\n'.join(map(str, buf))) | Traceback (most recent call last):
File "/tmp/tmpolnhid_g/tmpg2sctxq8.py", line 6, in <module>
n, m = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s705007521 | p01140 | u234579471 | 1521992008 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | while True:
n, m = map(int, input().split())
if n == 0 and m == 0:
break
h = [0]
for i in range(n):
h.append(int(input()) + h[i])
w = [0]
for i in range(m):
w.append(int(input()) + w[i])
hList = [0] * 1000
for i in range(n + 1):
for j in range(i, n + 1):
if i == j:
continue
else:
hList[abs(h[i] - h[j])] += 1
wList = [0] * 1000
for i in range(m + 1):
for j in range(i, m + 1):
if i == j:
continue
else:
wList[abs(w[i] - w[j])] += 1
squareList = []
for i in range(1000):
squareList.append(hList[i] * wList[i])
print(sum(squareList))
| Traceback (most recent call last):
File "/tmp/tmpucill0l2/tmp5ir746ro.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s217399743 | p01140 | u234579471 | 1521992098 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | while True:
n, m = map(int, input().split())
if n == 0 and m == 0:
break
h = [0]
for i in range(n):
h.append(int(input()) + h[i])
w = [0]
for i in range(m):
w.append(int(input()) + w[i])
hList = [0] * 1000
for i in range(n + 1):
for j in range(i, n + 1):
if i == j:
continue
else:
hList[abs(h[i] - h[j])] += 1
wList = [0] * 1000
for i in range(m + 1):
for j in range(i, m + 1):
if i == j:
continue
else:
wList[abs(w[i] - w[j])] += 1
squareList = []
for i in range(1000):
squareList.append(hList[i] * wList[i])
print(sum(squareList))
| Traceback (most recent call last):
File "/tmp/tmpjcqma839/tmp9f64npnq.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s738013127 | p01140 | u234579471 | 1521992098 | Python | Python3 | py | Runtime Error | 0 | 0 | 747 | while True:
n, m = map(int, input().split())
if n == 0 and m == 0:
break
h = [0]
for i in range(n):
h.append(int(input()) + h[i])
w = [0]
for i in range(m):
w.append(int(input()) + w[i])
hList = [0] * 1000
for i in range(n + 1):
for j in range(i, n + 1):
if i == j:
continue
else:
hList[abs(h[i] - h[j])] += 1
wList = [0] * 1000
for i in range(m + 1):
for j in range(i, m + 1):
if i == j:
continue
else:
wList[abs(w[i] - w[j])] += 1
squareList = []
for i in range(1000):
squareList.append(hList[i] * wList[i])
print(sum(squareList))
| Traceback (most recent call last):
File "/tmp/tmpudzyp4ns/tmpljbiyc5q.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s503292402 | p01140 | u734301890 | 1522052262 | Python | Python3 | py | Runtime Error | 0 | 0 | 742 | import math
def ans(N, M, h, w):
count = 0
for hr1 in range(N+1):
for hr2 in range(N+1):
if hr2 <= hr1: continue
height = sum(h[e] for e in range(hr1, hr2))
for wr1 in range(M+1):
for wr2 in range(M+1):
if wr2 <= wr1: continue
width = sum(w[e] for e in range(wr1, wr2))
if height == width:
count += 1
return count
while True:
N, M = [int(e) for e in input().strip().split()]
if N == 0 and M == 0:
break
h = [int(input()) for e in range(N)]
w = [int(input()) for e in range(M)]
answer = ans(N,M,h,w)
print(answer)
| Traceback (most recent call last):
File "/tmp/tmppio12jhs/tmpz7u_yaz_.py", line 21, in <module>
N, M = [int(e) for e in input().strip().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s965790950 | p01140 | u734301890 | 1522052607 | Python | Python3 | py | Runtime Error | 0 | 0 | 728 | def ans(N, M, h, w):
count = 0
for hr1 in range(N+1):
for hr2 in range(N+1):
if hr2 <= hr1: continue
height = sum(h[e] for e in range(hr1, hr2))
for wr1 in range(M+1):
for wr2 in range(M+1):
if wr2 <= wr1: continue
width = sum(w[e] for e in range(wr1, wr2))
if height == width:
count += 1
return count
while True:
N, M = [int(e) for e in input().strip().split()]
if N == 0 and M == 0:
break
h = [int(input()) for e in range(N)]
w = [int(input()) for e in range(M)]
answer = ans(N,M,h,w)
print(answer)
| Traceback (most recent call last):
File "/tmp/tmpbgbzbt4f/tmpzerfcxfe.py", line 18, in <module>
N, M = [int(e) for e in input().strip().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s140923269 | p01140 | u734301890 | 1522052725 | Python | Python3 | py | Runtime Error | 0 | 0 | 728 | def ans(N, M, h, w):
count = 0
for hr1 in range(N+1):
for hr2 in range(N+1):
if hr2 <= hr1: continue
height = sum(h[e] for e in range(hr1, hr2))
for wr1 in range(M+1):
for wr2 in range(M+1):
if wr2 <= wr1: continue
width = sum(w[e] for e in range(wr1, wr2))
if height == width:
count += 1
return count
while True:
N, M = [int(e) for e in input().strip().split()]
if N == 0 and M == 0:
break
h = [int(input()) for e in range(N)]
w = [int(input()) for e in range(M)]
answer = ans(N,M,h,w)
print(answer)
| Traceback (most recent call last):
File "/tmp/tmpgbkf_ooa/tmpp1o_tdwk.py", line 18, in <module>
N, M = [int(e) for e in input().strip().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s661484081 | p01140 | u734301890 | 1522052925 | Python | Python3 | py | Runtime Error | 0 | 0 | 733 | def ans(N, M, h, w):
count = 0
for hr1 in range(N+1):
for hr2 in range(N+1):
if hr2 <= hr1: continue
height = sum(h[e] for e in range(hr1, hr2))
for wr1 in range(M+1):
for wr2 in range(M+1):
if wr2 <= wr1: continue
width = sum([w[e] for e in range(wr1, wr2)])
if height == width:
count += 1
return count
while True:
N, M = [int(e) for e in input().strip().split()]
if N == 0 and M == 0:
break
h = [int(input()) for e in range(N)]
w = [int(input()) for e in range(M)]
answer = ans(N,M,h,w)
print(answer)
| Traceback (most recent call last):
File "/tmp/tmpenfw3wst/tmpxlvo_fi4.py", line 18, in <module>
N, M = [int(e) for e in input().strip().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s084998955 | p01140 | u734301890 | 1522053230 | Python | Python3 | py | Runtime Error | 0 | 0 | 773 | def ans(N, M, h, w):
count = 0
for hr1 in range(N+1):
for hr2 in range(N+1):
if hr2 <= hr1:
continue
height = sum(h[e] for e in range(hr1, hr2))
for wr1 in range(M+1):
for wr2 in range(M+1):
if wr2 <= wr1:
continue
width = sum([w[e] for e in range(wr1, wr2)])
if height == width:
count += 1
return count
while True:
N, M = [int(e) for e in input().strip().split()]
if N == 0 and M == 0:
break
h = [int(input()) for e in range(N)]
w = [int(input()) for e in range(M)]
answer = ans(N,M,h,w)
print(answer)
| Traceback (most recent call last):
File "/tmp/tmpke80xru8/tmpi3mqapms.py", line 20, in <module>
N, M = [int(e) for e in input().strip().split()]
^^^^^^^
EOFError: EOF when reading a line
| |
s033427147 | p01140 | u269391636 | 1523873064 | Python | Python3 | py | Runtime Error | 0 | 0 | 553 | while(True):
tmp = list(map(int,input().split()))
N, M = tmp[0],tmp[1]
if N == 0:
quit()
hs = [0]
ws = [0]
hlen = []
wlen = []
ans = 0
for i in range(N):
hs.append(hs[-1] + int(input()))
for i in range(M):
ws.append(ws[-1] + int(input()))
for i in range(N):
for j in range(i+1,N+1):
hlen.append(hs[j]-hs[i])
for i in range(M):
for j in range(i+1,M+1):
wlen.append(ws[j]-ws[i])
for i in hlen:
ans += wlen.count(i)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpai5u6tpo/tmpf3ca3e2a.py", line 2, in <module>
tmp = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s974541369 | p01140 | u584093205 | 1525003996 | Python | Python3 | py | Runtime Error | 0 | 0 | 411 | while(1):
N, M = map(int, input().split())
if N == 0 and M == 0:
break
H = [int(input()) for i in range(N)]
HD = [0] * 1500 ** 2
for i in range(N):
for j in range(i + 1, N + 1):
HD[sum(H[i:j])] += 1
ans = 0
W = [int(input()) for i in range(M)]
for i in range(M):
for j in range(i + 1, M + 1):
ans += HD[sum(W[i:j])]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpj4ru7ssj/tmpxjw1w2t_.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s647109466 | p01140 | u316584871 | 1529981266 | Python | Python3 | py | Runtime Error | 0 | 0 | 710 | n,m = map(int, input().split())
while (n != 0 or m != 0):
nlist = []
mlist = []
for i in range(n):
t = int(input())
nlist.append(t)
for i in range(m):
t = int(input())
mlist.append(t)
nsum = []
for i in range(n):
for k in range(n-i):
c = 0
for l in range(i+1):
c += nlist[k+l]
nsum.append(c)
msum = []
for i in range(m):
for k in range(m-i):
c = 0
for l in range(i+1):
c += mlist[k+l]
msum.append(c)
count = 0
for i in nsum:
count += msum.count(i)
print(count)
n,m = map(int, input().split())
| Traceback (most recent call last):
File "/tmp/tmpdz_08mal/tmpdspwhbbp.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s018492525 | p01140 | u316584871 | 1529982380 | Python | Python3 | py | Runtime Error | 0 | 0 | 601 | n,m = map(int, input().split())
while (n != 0 or m != 0):
nlist = [int(input())for i in range(n)]
mlist = [int(input())for i in range(m)]
nsum = []
for i in range(n):
for k in range(n-i):
c = 0
for l in range(i+1):
c += nlist[k+l]
nsum.append(c)
count = 0
for i in range(m):
for k in range(m-i):
c = 0
for l in range(i+1):
c += mlist[k+l]
if (c in nsum):
count += nsum.count(c)
print(count)
n,m = map(int, input().split())
| Traceback (most recent call last):
File "/tmp/tmp782opavh/tmpcatl4dus.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s473588684 | p01140 | u316584871 | 1529987159 | Python | Python3 | py | Runtime Error | 0 | 0 | 613 | n,m = map(int, input().split())
while (n != 0 or m != 0):
nlist = [0]
mlist = [0]
for i in range(n):
nlist += [nlist[-1] + int(input())]
for i in range(m):
mlist += [mlist[-1] + int(input())]
nsum = []
msum = []
for i in range(n):
for k in range(i+1,n+1):
c = nlist[k] - nlist[i]
nsum.append(c)
for i in range(m):
for k in range(i+1,m+1):
c = mlist[k] - mlist[i]
msum.append(c)
count = 0
for i in nsum:
count += msum.count(i)
print(count)
n,m = map(int, input().split())
| Traceback (most recent call last):
File "/tmp/tmpqi1ix492/tmpbx3d3kl6.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s518419492 | p01140 | u316584871 | 1529987319 | Python | Python3 | py | Runtime Error | 0 | 0 | 598 | n,m = map(int, input().split())
while (n != 0 or m != 0):
nlist = [0]
mlist = [0]
for i in range(n):
nlist += [nlist[-1] + int(input())]
for i in range(m):
mlist += [mlist[-1] + int(input())]
nsum = []
msum = []
count = 0
for i in range(n):
for k in range(i+1,n+1):
c = nlist[k] - nlist[i]
nsum.append(c)
for i in range(m):
for k in range(i+1,m+1):
c = mlist[k] - mlist[i]
if (c in nsum):
count += nsum.count(c)
print(count)
n,m = map(int, input().split())
| Traceback (most recent call last):
File "/tmp/tmp7khybdem/tmpwicc1tyo.py", line 1, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s780262339 | p01140 | u316584871 | 1529987585 | Python | Python3 | py | Runtime Error | 0 | 0 | 592 | while True:
n,m = map(int, input().split())
if n == 0 and m == 0:
break
nlist = [0]
mlist = [0]
for i in range(n):
nlist += [nlist[-1] + int(input())]
for i in range(m):
mlist += [mlist[-1] + int(input())]
nsum = []
msum = []
count = 0
for i in range(n):
for k in range(i+1,n+1):
c = nlist[k] - nlist[i]
nsum.append(c)
for i in range(m):
for k in range(i+1,m+1):
c = mlist[k] - mlist[i]
if (c in nsum):
count += nsum.count(c)
print(count)
| Traceback (most recent call last):
File "/tmp/tmpy6dgpj8l/tmpz0306ibn.py", line 2, in <module>
n,m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s610125876 | p01140 | u109084363 | 1361010871 | Python | Python | py | Runtime Error | 19930 | 47420 | 710 | import sys
import math
import collections
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = collections.Counter()
lateral = collections.Counter()
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
vertical[sum(road_v[i:j])] += 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
lateral[sum(road_l[i:j])] += 1
result = 0
for v in vertical:
result += vertical[v] * lateral[v]
print result | File "/tmp/tmpanxwtasm/tmp9gcujqt5.py", line 29
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s058927331 | p01140 | u109084363 | 1361011051 | Python | Python | py | Runtime Error | 19920 | 47348 | 710 | import sys
import math
import collections
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = collections.Counter()
lateral = collections.Counter()
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
vertical[sum(road_v[i:j])] += 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
lateral[sum(road_l[i:j])] += 1
result = 0
for v in vertical:
result += vertical[v] * lateral[v]
print result | File "/tmp/tmpineayzup/tmpe19vozy2.py", line 29
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s686978559 | p01140 | u109084363 | 1361011485 | Python | Python | py | Runtime Error | 19930 | 47404 | 612 | import sys
import math
import collections
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = collections.Counter()
lateral = collections.Counter()
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
vertical[sum(road_v[i:j])] += 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
lateral[sum(road_l[i:j])] += 1 | Traceback (most recent call last):
File "/tmp/tmpu2gfjvai/tmph2kzjqoi.py", line 6, in <module>
N, M = map(int, sys.stdin.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s383548495 | p01140 | u109084363 | 1361011703 | Python | Python | py | Runtime Error | 0 | 0 | 760 | import sys
import math
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = {}
lateral = {}
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
temp = sum(road_v[i:j])
vertical[temp] = vertical.setdefault(temp, 0) + 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
temp = sum(road_l[i:j])
lateral[temp] = lateral.setdefault(temp, 0) + 1
result = 0
for v in vertical:
result += vertical[v] * lateral[v]
print result | File "/tmp/tmpm220u5o8/tmp364jzr9c.py", line 30
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s721227004 | p01140 | u109084363 | 1361011732 | Python | Python | py | Runtime Error | 0 | 0 | 760 | import sys
import math
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = {}
lateral = {}
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
temp = sum(road_v[i:j])
vertical[temp] = vertical.setdefault(temp, 0) + 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
temp = sum(road_l[i:j])
lateral[temp] = lateral.setdefault(temp, 0) + 1
result = 0
for v in vertical:
result += vertical[v] * lateral[v]
print result | File "/tmp/tmp24ff_lhm/tmpy7i3qwqq.py", line 30
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s897482315 | p01140 | u109084363 | 1361011821 | Python | Python | py | Runtime Error | 0 | 0 | 894 | import sys
import math
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = {}
lateral = {}
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
temp = sum(road_v[i:j])
if temp in vertical:
vertical[temp] += 1
else:
vertical[temp] = 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
temp = sum(road_l[i:j])
if temp in lateral:
lateral[temp] = lateral[temp] + 1
else:
lateral[temp] = 1
result = 0
for v in vertical:
result += vertical[v] * lateral[v]
print result | File "/tmp/tmpnl667qcv/tmpp5gesntw.py", line 36
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s005102151 | p01140 | u109084363 | 1361011929 | Python | Python | py | Runtime Error | 0 | 0 | 906 | import sys
import math
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = {}
lateral = {}
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
temp = sum(road_v[i:j])
if temp in vertical:
vertical[temp] += 1
else:
vertical[temp] = 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
temp = sum(road_l[i:j])
if temp in lateral:
lateral[temp] = lateral[temp] + 1
else:
lateral[temp] = 1
result = 0
for v in vertical:
result += vertical[v] * lateral[v]
print result
sys.exit(0) | File "/tmp/tmpb1a6wxoy/tmp4ve5fy2a.py", line 36
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s313162059 | p01140 | u109084363 | 1361012013 | Python | Python | py | Runtime Error | 19930 | 47120 | 923 | import sys
import math
while True:
N, M = map(int, sys.stdin.readline().split())
if N == 0:
break
vertical = {}
lateral = {}
road_v = []
road_l = []
for i in xrange(N):
h = int(raw_input())
road_v.append(h)
for i in xrange(M):
w = int(raw_input())
road_l.append(w)
for i in xrange(N):
for j in xrange(i + 1, N + 1):
temp = sum(road_v[i:j])
if temp in vertical:
vertical[temp] += 1
else:
vertical[temp] = 1
for i in xrange(M):
for j in xrange(i + 1, M + 1):
temp = sum(road_l[i:j])
if temp in lateral:
lateral[temp] = lateral[temp] + 1
else:
lateral[temp] = 1
result = 0
for v in vertical:
if v in lateral:
result += vertical[v] * lateral[v]
print result | File "/tmp/tmp0kgz_zt0/tmphob538b1.py", line 37
print result
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s007877628 | p01140 | u553881259 | 1391346662 | Python | Python | py | Runtime Error | 39860 | 6892 | 689 | from collections import Counter
def add(s, tw):
if tw in s:
s[tw] += 1
else:
s[tw] = 1
while 1:
ws, hs, w, h = {}, {}, [], []
n, m = map(int, raw_input().split())
if n|m == 0: break
for i in range(n):
t = s = input()
add(ws, s)
for pw in reversed(w):
s+=pw
add(ws, s)
w.append(t)
for i in range(m):
t = s = input()
add(hs, s)
for pw in reversed(h):
s+=pw
add(hs, s)
h.append(t)
ans = 0
for w, wn in ws.iteritems():
for h, hn in hs.iteritems():
if w == h:
ans += wn * hn
print ans | File "/tmp/tmpwi4qp03b/tmpvzytdlio.py", line 36
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s054582194 | p01140 | u553881259 | 1391347147 | Python | Python | py | Runtime Error | 39870 | 6892 | 642 | from collections import defaultdict
while 1:
ws, hs, w, h = defaultdict(lambda:0), defaultdict(lambda:0), [], []
n, m = map(int, raw_input().split())
if n|m == 0: break
for i in range(n):
t = s = input()
ws[s]+=1
for pw in reversed(w):
s+=pw
ws[s]+=1
w.append(t)
for i in range(m):
t = s = input()
hs[s]+=1
for pw in reversed(h):
s+=pw
hs[s]+=1
h.append(t)
ans = 0
for w, wn in ws.iteritems():
for h, hn in hs.iteritems():
if w == h:
ans += wn * hn
print ans | File "/tmp/tmp779q50mi/tmppxca9nv9.py", line 29
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s538409255 | p01143 | u672443148 | 1517326892 | Python | Python3 | py | Runtime Error | 0 | 0 | 319 | while True:
N,M,P=map(int,input().split())
if N==M==P: break
divSum=0
for i in range(N):
temp=int(input())
divSum+=temp*100
if i==M-1:
numWin=temp
divSum*=(100-P)/100
if temp!=0:
dividents=int(divSum/numWin)
else: dividents=0
print(dividents)
| Traceback (most recent call last):
File "/tmp/tmptlw98h5t/tmpq7139oe4.py", line 2, in <module>
N,M,P=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s499619637 | p01144 | u741801763 | 1531314014 | Python | Python3 | py | Runtime Error | 0 | 0 | 506 | while 1:
n,m= list(map(int,input().split(' ')))
if n ==m ==0:break
D =[]
for _ in range(n):
d_i,p_i = list(map(int,input().split(' ')))
D.append((d_i,p_i))
sorted(D,key = lambda x:x[0])
while m > 0:
temp = D.pop(0)
if temp[0] > m:
temp = (temp[0] - m,temp[1])
m=0
else:
m -= temp[0]
temp = (0,temp[1])
D.append(temp)
ans = 0
for i in D:
ans += i[0]*i[1]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpbsceh805/tmpjn1u4t52.py", line 2, in <module>
n,m= list(map(int,input().split(' ')))
^^^^^^^
EOFError: EOF when reading a line
| |
s465865211 | p01144 | u741801763 | 1531314107 | Python | Python3 | py | Runtime Error | 0 | 0 | 506 | while 1:
n,m= list(map(int,input().split(' ')))
if n ==m ==0:break
D =[]
for _ in range(n):
d_i,p_i = list(map(int,input().split(' ')))
D.append((d_i,p_i))
sorted(D,key = lambda x:x[0])
while m > 0:
temp = D.pop(0)
if temp[0] > m:
temp = (temp[0] - m,temp[1])
m=0
else:
m -= temp[0]
temp = (0,temp[1])
D = D + [temp]
ans = 0
for i in D:
ans += i[0]*i[1]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmprkgfga5q/tmp8n4mabdr.py", line 2, in <module>
n,m= list(map(int,input().split(' ')))
^^^^^^^
EOFError: EOF when reading a line
| |
s626593961 | p01144 | u741801763 | 1531314436 | Python | Python3 | py | Runtime Error | 0 | 0 | 547 | import collections
while 1:
n,m= list(map(int,input().split(' ')))
if n ==m ==0:break
D = collections.deque()
for _ in range(n):
d_i,p_i = list(map(int,input().split(' ')))
D.append((d_i,p_i))
sorted(D,key = lambda x:x[0])
while m > 0:
temp = D.popleft()
if temp[0] > m:
temp = (temp[0] - m,temp[1])
m=0
else:
m -= temp[0]
temp = (0,temp[1])
D.append(temp)
ans = 0
for i in D:
ans += i[0]*i[1]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpyu0h1dan/tmpedwi0nuf.py", line 3, in <module>
n,m= list(map(int,input().split(' ')))
^^^^^^^
EOFError: EOF when reading a line
| |
s274374224 | p01144 | u741801763 | 1531314484 | Python | Python3 | py | Runtime Error | 0 | 0 | 579 | import collections
import time
while 1:
n,m= list(map(int,input().split(' ')))
if n ==m ==0:break
D = collections.deque()
time.sleep(20)
for _ in range(n):
d_i,p_i = list(map(int,input().split(' ')))
D.append((d_i,p_i))
sorted(D,key = lambda x:x[0])
while m > 0:
temp = D.popleft()
if temp[0] > m:
temp = (temp[0] - m,temp[1])
m=0
else:
m -= temp[0]
temp = (0,temp[1])
D.append(temp)
ans = 0
for i in D:
ans += i[0]*i[1]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpmugr7463/tmp8pgtz68j.py", line 4, in <module>
n,m= list(map(int,input().split(' ')))
^^^^^^^
EOFError: EOF when reading a line
| |
s527660860 | p01144 | u741801763 | 1531314803 | Python | Python3 | py | Runtime Error | 0 | 0 | 577 | import collections
while 1:
n,m= list(map(int,input().split(' ')))
if n == m ==0:break
D = collections.deque()
for _ in range(n):
d_i,p_i = list(map(int,input().split(' ')))
if p_i !=0:
D.append((d_i,p_i))
sorted(D,key = lambda x:x[0])
while m > 0:
temp = D.popleft()
if temp[0] > m:
temp = (temp[0] - m,temp[1])
m=0
D.append(temp)
else:
m -= temp[0]
temp = (0,temp[1])
ans = 0
for i in D:
ans += i[0]*i[1]
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpy3tm05mw/tmpde5odj1b.py", line 3, in <module>
n,m= list(map(int,input().split(' ')))
^^^^^^^
EOFError: EOF when reading a line
| |
s286364605 | p01144 | u025180675 | 1540437324 | Python | Python3 | py | Runtime Error | 0 | 0 | 523 | while True:
N,M = map(int,input().strip().split(" "))
if [N,M] == [0,0]:
break
L = []
S = 0
for i in range(N):
l = list(map(int,input().strip().split(" ")))
l.reverse()
L.append(l)
S = S + l[0]*l[1]
L.sort()
j = 0
while M > 0:
if M >= L[N-j-1][1]:
S = S - L[N-j-1][0]*L[N-j-1][1]
M = M - L[N-j-1][1]
j = j + 1
else:
S = S - L[N-j-1][0]*M
M = M - L[N-j-1][1]
print(S)
| Traceback (most recent call last):
File "/tmp/tmpe05bq2b0/tmpi44ptgre.py", line 2, in <module>
N,M = map(int,input().strip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s609591183 | p01144 | u025180675 | 1540441835 | Python | Python3 | py | Runtime Error | 0 | 0 | 1084 | #Princess's Marriage
#http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2019&lang=jp
#席の位置:右中央
#Nは区間の個数
#Mは予算
#Dは区間の距離
#Pはその間を1単位距離移動したときに襲われる回数の期待値
#お姫様が予算Mを持っていて,刺客に襲われる回数の期待値が最小になるように護衛を雇ったときの,目的地までに刺客に襲われる回数の期待値
while True:
N,M = map(int,input().strip().split(" "))
if [N,M] == [0,0]:
break
L = []
S = 0 #Sが襲われる回数の期待値
for i in range(N):
l = list(map(int,input().strip().split(" ")))
l.reverse() #ソートするとき具合がわるいので[P,D]の順に入れ替え
L.append(l)
S = S + l[0]*l[1]
L.sort()
j = 0
while M > 0:
if M >= L[N-j-1][1]:
S = S - L[N-j-1][0]*L[N-j-1][1]
M = M - L[N-j-1][1]
j = j + 1
else:
S = S - L[N-j-1][0]*M
M = M - L[N-j-1][1]
print(S)
| Traceback (most recent call last):
File "/tmp/tmpjm9l5o43/tmpbyopsdhh.py", line 14, in <module>
N,M = map(int,input().strip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s001588251 | p01144 | u025180675 | 1540447283 | Python | Python3 | py | Runtime Error | 0 | 0 | 628 | while True:
N,M = map(int,input().strip().split(" "))
if [N,M] == [0,0]:
break
L = []
S = 0 #Sが襲われる回数の期待値
for i in range(N):
l = list(map(int,input().strip().split(" ")))
l.reverse() #ソートするとき具合がわるいので[P,D]の順に入れ替え
L.append(l)
S = S + l[0]*l[1]
L.sort()
j = 0
while M > 0:
if M >= L[N-j-1][1]:
S = S - L[N-j-1][0]*L[N-j-1][1]
M = M - L[N-j-1][1]
j = j + 1
else:
S = S - L[N-j-1][0]*M
M = M - L[N-j-1][1]
print(S)
| Traceback (most recent call last):
File "/tmp/tmpzaye7z_1/tmpenzikkb3.py", line 2, in <module>
N,M = map(int,input().strip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s308647786 | p01144 | u025180675 | 1540465499 | Python | Python3 | py | Runtime Error | 0 | 0 | 606 | while True:
N,M = map(int,input().strip().split(" "))
if [N,M] == [0,0]:
break
L = []
S = 0 #Sが襲われる回数の期待値
for i in range(N):
l = list(map(int,input().strip().split(" ")))
l.reverse() #ソートするとき具合がわるいので[P,D]の順に入れ替え
L.append(l)
S = S + l[0]*l[1]
L.sort()
j = N
while M > 0:
if M >= L[j-1][1]:
S = S - L[j][0]*L[j][1]
M = M - L[j][1]
j = j - 1
else:
S = S - L[j][0]*M
M = M - L[j][1]
print(S)
| Traceback (most recent call last):
File "/tmp/tmpp3bthans/tmpflaqfb50.py", line 2, in <module>
N,M = map(int,input().strip().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s708280800 | p01144 | u698762975 | 1555929959 | Python | Python3 | py | Runtime Error | 0 | 0 | 304 | n,m=map(int,input().split())
l=[]
for i in range(n):
l1=list(map(input().split()))
l1=l1[::-1]
l.append(l1)
l=sorted(l)
s=0
for i in range(n):
s+=l[i][0]*l[i][1]
for i in range(n):
if m-l[i][1]>=0:
s-=l[i][0]*l[i][1]
m-=l[i][1]
else:
s-=l[i][0]*m
print(s)
| Traceback (most recent call last):
File "/tmp/tmp88zzpanc/tmpviyp4k_b.py", line 1, in <module>
n,m=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s958678746 | p01144 | u026821956 | 1555930899 | Python | Python3 | py | Runtime Error | 0 | 0 | 395 | while True:
N,M = map(int,input().split())
if N == M == 0:
break
else:
L = []
for i in range(N):
L.append(list(map(int,input().split())))
L = sorted(L, key = lambda x:x[1])
L.reverse()
ans = 0
for i in range(len(L)):
if M > 0:
if M-L[i][0] >= 0:
M -= L[i][0]
else:
ans += (L[i][0]-M)*L[i][1]
M = 0
else:
ans += L[i][0]*L[i][1]
print(ans)
| File "/tmp/tmp9mj41eum/tmpy7jlhe58.py", line 7
for i in range(N):
TabError: inconsistent use of tabs and spaces in indentation
| |
s950442291 | p01144 | u910909659 | 1555990562 | Python | Python3 | py | Runtime Error | 0 | 0 | 711 | while True:
N,M = map(int,input().split())
if N == 0:
break
expect = 0
a = []
exsum = 0
for i in range(N): #二次元配列を作る
a.append(list(map(int,input().split())))
exsum += a[i][0]*a[i][1] #誰も雇わなかった場合の期待値
b = sorted(a, key=lambda x: x[1]) #危険度の高い区間ほど後ろにくるように並べる
i = N-1
while M > 0: #危険度が高い区間(配列のうしろ)から順に人を雇っていく
if b[i][0] <= M:
exsum -= b[i][0]*b[i][1]
M -= b[i][0]
i -= 1
else:
exsum -= b[i][1]*M
M = 0
i -= 1
print(exsum)
| Traceback (most recent call last):
File "/tmp/tmpd6a1dcop/tmpr4db131d.py", line 2, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s088856343 | p01144 | u910909659 | 1555990615 | Python | Python3 | py | Runtime Error | 0 | 0 | 711 | while True:
N,M = map(int,input().split())
if N == 0:
break
expect = 0
a = []
exsum = 0
for i in range(N): #二次元配列を作る
a.append(list(map(int,input().split())))
exsum += a[i][0]*a[i][1] #誰も雇わなかった場合の期待値
b = sorted(a, key=lambda x: x[1]) #危険度の高い区間ほど後ろにくるように並べる
i = N-1
while M > 0: #危険度が高い区間(配列のうしろ)から順に人を雇っていく
if b[i][0] <= M:
exsum -= b[i][0]*b[i][1]
M -= b[i][0]
i -= 1
else:
exsum -= b[i][1]*M
M = 0
i -= 1
print(exsum)
| Traceback (most recent call last):
File "/tmp/tmpqy3p3kf2/tmp18wszb2d.py", line 2, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s710683311 | p01144 | u910909659 | 1555990926 | Python | Python3 | py | Runtime Error | 0 | 0 | 711 | while True:
N,M = map(int,input().split())
if N == 0:
break
expect = 0
a = []
exsum = 0
for i in range(N): #二次元配列を作る
a.append(list(map(int,input().split())))
exsum += a[i][0]*a[i][1] #誰も雇わなかった場合の期待値
b = sorted(a, key=lambda x: x[1]) #危険度の高い区間ほど後ろにくるように並べる
i = N-1
while M > 0: #危険度が高い区間(配列のうしろ)から順に人を雇っていく
if b[i][0] <= M:
exsum -= b[i][0]*b[i][1]
M -= b[i][0]
i -= 1
else:
exsum -= b[i][1]*M
M = 0
i -= 1
print(exsum)
| Traceback (most recent call last):
File "/tmp/tmpqbh9074l/tmp6wom4a98.py", line 2, in <module>
N,M = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s815272883 | p01144 | u528682978 | 1556001897 | Python | Python3 | py | Runtime Error | 0 | 0 | 417 | while True:
res=0
n,m = map(int,input().split())
if n == 0:
break
DandP = []
for _ in range(n):
DandP.append(list(map(int,input().split())))
DandP.sort(key=lambda x:x[1],reverse = True)
for _ in range(m):
if DandP[0][0]==0:
DandP = DandP[1:]
DandP[0][0] -= 1
for i in range(len(DandP)):
res += DandP[i][0]*DandP[i][1]
print(res)
| Traceback (most recent call last):
File "/tmp/tmp5ixi98kk/tmpinhhgugg.py", line 3, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s790262259 | p01144 | u528682978 | 1556003480 | Python | Python3 | py | Runtime Error | 0 | 0 | 448 | while True:
res=0
n,m = map(int,input().split())
if n == 0:
break
DandP = []
for _ in range(n):
DandP.append(list(map(int,input().split())))
DandP.sort(key=lambda x:x[1],reverse = True)
for _ in range(m):
if DandP[0][0]==0:
DandP = DandP[1:]
if len(DandP) >0:
DandP[0][0] -= 1
for i in range(len(DandP)):
res += DandP[i][0]*DandP[i][1]
print(res)
| Traceback (most recent call last):
File "/tmp/tmpxmg5wm0a/tmp0dns6t2a.py", line 3, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s873810204 | p01144 | u844945939 | 1414411698 | Python | Python | py | Runtime Error | 0 | 0 | 408 | while True:
n, m = (int(s) for s in input().split())
if not n:
break
sections = sorted(([int(s) for s in input().split()] for i in range(n)),
key=lambda x: x[1], reverse=True)
for i, (d, p) in enumerate(sections):
m -= d
if m <= 0:
print(sum(s[0] * s[1] for s in sections[i+1:]) - p * m)
break
else:
print(0) | Traceback (most recent call last):
File "/tmp/tmp_h5zq9oa/tmpki9ftw4f.py", line 2, in <module>
n, m = (int(s) for s in input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s219275050 | p01144 | u124909914 | 1426650468 | Python | Python3 | py | Runtime Error | 0 | 0 | 355 | while True:
n, m = map(int, input().split())
ls = []
if n == 0: break
for i in range(n):
d, p = map(int, input().split())
ls.append([d,p])
ls.sort(key=lambda x:x[1], reverse=True)
j = 0
for i in range(m):
ls[j][0] -= 1
if ls[j][0] == 0:
j += 1
print(sum(x[0] * x[1] for x in ls)) | Traceback (most recent call last):
File "/tmp/tmpsbbnbaeu/tmpnvudow4b.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s264641113 | p01144 | u124909914 | 1426665004 | Python | Python3 | py | Runtime Error | 19930 | 8148 | 408 | while True:
n, m = map(int, input().split())
ls = []
if n == 0: break
for i in range(n):
d, p = map(int, input().split())
ls.append([d,p])
ls.sort(key=lambda x:x[1], reverse=True)
j = 0
for i in range(m):
ls[j][0] -= 1
if ls[j][0] == 0:
j += 1
if j == (len(ls)):
break
print(sum(x[0] * x[1] for x in ls)) | Traceback (most recent call last):
File "/tmp/tmp8z2exkjd/tmptmjjpk7q.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s943390069 | p01144 | u797180951 | 1438485116 | Python | Python | py | Runtime Error | 0 | 0 | 362 | loop {
n, m = gets.split.map &:to_i
break if n == 0
road = (1..n).map{ gets.split.map &:to_i }
road.sort_by!(&:last).reverse!
while !road.empty?
if road[0][0] > m
road[0][0] -= m
break
else
m -= road[0][0]
road.shift
end
end
p road.map{|d, q| d * q}.inject &:+
} | File "/tmp/tmpz_bl5n5g/tmplk4mkknb.py", line 2
n, m = gets.split.map &:to_i
^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s326753517 | p01144 | u797180951 | 1438485212 | Python | Python | py | Runtime Error | 0 | 0 | 366 | loop {
n, m = gets.split.map &:to_i
break if n == 0
road = (1..n).map{ gets.split.map &:to_i }
road.sort_by!(&:last).reverse!
while !road.empty?
if road[0][0] > m
road[0][0] -= m
break
else
m -= road[0][0]
road.shift
end
end
p road.map{|d, q| d * q}.inject(0, &:+)
} | File "/tmp/tmp92m7_ae6/tmppfbqff6d.py", line 2
n, m = gets.split.map &:to_i
^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='?
| |
s649295086 | p01144 | u798803522 | 1470240170 | Python | Python3 | py | Runtime Error | 0 | 0 | 568 | roadcnt,money = (int(n) for n in input().split(" "))
while True:
road = []
for r in range(roadcnt):
road.append([int(n) for n in input().split(" ")])
road = sorted(road,key=lambda x:x[1])
while money > 0:
if road[-1][0] - money < 0:
money -= road[-1][0]
road.pop()
else:
road[-1][0] -= money
break
ans = 0
for ro in road:
ans += ro[0] * ro[1]
print(ans)
roadcnt,money = (int(n) for n in input().split(" "))
if roadcnt == 0 and money == 0:
break | Traceback (most recent call last):
File "/tmp/tmp4i64b5js/tmpq5rqs8lj.py", line 1, in <module>
roadcnt,money = (int(n) for n in input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s194907328 | p01144 | u947762778 | 1508048829 | Python | Python3 | py | Runtime Error | 40000 | 9276 | 544 | while True:
n, m = map(int, input().split())
dpList = []
if n + m < 1:
break
for i in range(n):
row = list(map(int,input().split()))
dpList.append(row)
dpList = sorted(dpList, key = lambda x:x[1], reverse = True)
for i in range(n):
if m - dpList[i][0] <= 0:
num = (dpList[i][0] - m) * dpList[i][1]
for j in range(i + 1, n):
num += dpList[j][0] * dpList[j][1]
print(num)
break
else:
m -= dpList[i][0] | Traceback (most recent call last):
File "/tmp/tmp7vf7fvjm/tmpjgv4jqk5.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s098038288 | p01144 | u947762778 | 1508049273 | Python | Python3 | py | Runtime Error | 40000 | 9260 | 436 | while True:
n, m = map(int, input().split())
dpList = []
if n + m < 1:
break
for i in range(n):
row = list(map(int,input().split()))
dpList.append(row)
dpList = sorted(dpList, key = lambda x:x[1], reverse = True)
num = 0
for i in range(n):
if m >= dpList[i][0]:
m -= dpList[i][0]
else:
num = (dpList[i][0] - m) * dpList[i][1]
print(num) | Traceback (most recent call last):
File "/tmp/tmprtmqzgyi/tmp6re4e__q.py", line 2, in <module>
n, m = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s336846157 | p01144 | u947762778 | 1508049349 | Python | Python3 | py | Runtime Error | 0 | 0 | 339 | while True:
n, m = map(int, input().split())
if (n, m) == (0, 0):
break
dp = [list(map(int, input().split())) for i in range(n)]
dp = sorted(dp, key=lambda kv:kv[1], reverse=True)
r = 0
for d,p in dp:
if m >= d:
m -= d
else:
r += p*(d-m)
m = 0
print(r | File "/tmp/tmp7bt13dmi/tmplb6qulem.py", line 14
print(r
^
SyntaxError: '(' was never closed
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.