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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s719241496 | p00444 | u350508326 | 1393169920 | Python | Python | py | Runtime Error | 0 | 0 | 299 | coins = [500, 100, 50, 10, 5, 1]
def count(x, y):
ret = 0
while x >= y:
x -= y
ret += 1
return ret
while True:
n = input()
if n == 0:
break
ans = 0
n = 1000 - n
for val in coins:
n, t = count(n, val)
ans += t
print(ans) | Traceback (most recent call last):
File "/tmp/tmp02lnuta8/tmppu25inca.py", line 11, in <module>
n = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s129807274 | p00444 | u633068244 | 1395079465 | Python | Python | py | Runtime Error | 0 | 0 | 228 | c = [500,100,50,10,5,1]
while True:
e = int(raw_input())
if e == 0: break
i,m = 0,0
while e > 0:
if e >= c[i]:
e -= c[i]
count += 1
else:
i += 1
print count | File "/tmp/tmpbfwb8xpd/tmp3t29_hl9.py", line 12
print count
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s777539094 | p00444 | u633068244 | 1395079530 | Python | Python | py | Runtime Error | 0 | 0 | 227 | c = [500,100,50,10,5,1]
while True:
e = 1000 - int(raw_input())
if e == 0: break
i,m = 0,0
while e > 0:
if e >= c[i]:
e -= c[i]
m += 1
else:
i += 1
print m | File "/tmp/tmpxgfd8jiw/tmp6j8ra2hi.py", line 12
print m
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s353792979 | p00445 | u355726239 | 1427118692 | Python | Python3 | py | Runtime Error | 0 | 0 | 347 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
while True:
s = input('')
if s == '':
break
cut_ss = [s[i:i+3] for i in range(len(s[:-2]))]
n_joi = 0
n_ioi = 0
for cut_s in cut_ss:
if cut_s == 'JOI':
n_joi += 1
if cut_s == 'IOI':
n_ioi += 1
print(n_joi)
print(n_ioi) | Traceback (most recent call last):
File "/tmp/tmpqwi85v3i/tmpl5iokcmq.py", line 5, in <module>
s = input('')
^^^^^^^^^
EOFError: EOF when reading a line
| |
s001373565 | p00445 | u811773570 | 1475426911 | Python | Python3 | py | Runtime Error | 0 | 0 | 276 | while True:
s = input()
if s == "":
break
joi = 0
ioi = 0
for i in range(len(s) - 2):
x = s[i] + s[i + 1] + s[i + 2]
if (x == "JOI"):
joi += 1
elif (x == "IOI"):
ioi += 1
print(joi)
print(ioi) | Traceback (most recent call last):
File "/tmp/tmplr8ziw2g/tmpv2b1hlym.py", line 2, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s389894781 | p00445 | u811773570 | 1475427229 | Python | Python3 | py | Runtime Error | 0 | 0 | 271 | while True:
s = input()
if s == "":
break
joi = 0
ioi = 0
s_list = [s[i:i+3] for i in range(len(s) - 2)]
for i in s_list:
if i == "JOI":
joi += 1
if i == "IOI":
ioi += 1
print(joi)
print(ioi) | Traceback (most recent call last):
File "/tmp/tmp_vh7mj7o/tmpzupztnpr.py", line 2, in <module>
s = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s815227269 | p00446 | u150984829 | 1525497421 | Python | Python3 | py | Runtime Error | 0 | 0 | 272 | import bisect
for e in iter(input,'0'):
n=int(e)
c=[sorted(int(input())for _ in[0]*n)]
c+=[sorted(set(range(1,2*n+1))-set(c[0]))]
t=f=0
while 1:
if not c[t]:break
x=bisect.bisect(c[t],f)
f=c[t].pop(x)if x<=len(c[t])else 0
t^=1
for i in[1,0]:print(len(c[i]))
| Traceback (most recent call last):
File "/tmp/tmpw2kmc6ht/tmpz5lf1e_3.py", line 2, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s087801317 | p00447 | u408260374 | 1417464257 | Python | Python3 | py | Runtime Error | 0 | 0 | 806 | board = [[False]*1000001]*1000001
while True:
m = int(input())
if m == 0: break
sx, sy = map(int, input().split())
star = []
for i in range(m-1):
x, y = map(int, input().split())
star.append((x-sx, y-sy))
n = int(input())
starlist = [tuple(map(int, input().split())) for i in range(n)]
for i in range(n):
board[starlist[i][0]][starlist[i][1]] = True
for i in range(n):
flag = True
for j in range(len(star)):
dx = starlist[i][0] + star[j][0]
dy = starlist[i][1] + star[j][1]
if board[dx][dy] == False:
flag = False
break
if flag == True:
print("{} {}".format(str(starlist[i][0] - sx), str(starlist[i][1] -sy)))
break
| Traceback (most recent call last):
File "/tmp/tmp8vrpc3wc/tmpl1ljo463.py", line 3, in <module>
m = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s183982371 | p00447 | u811434779 | 1440409020 | Python | Python | py | Runtime Error | 0 | 0 | 562 | import numpy as np
while 1:
n = input()
if n == 0: break
p = np.array(sorted([map(int, raw_input().split()) for i in range(n)]))
dist = [p[i] - p[0] for i in range(1,n)]
m = input()
q = np.array(sorted([map(int, raw_input().split()) for i in xrange(m)]))
for p1 in q:
for i in range(n-1):
f = True
for p2 in q:
if np.all(p1 + dist[i] == p2):
f = False
break
if f: break
else:
print p1[0] - p[0][0], p1[1] - p[0][1] | File "/tmp/tmp_tdhpn7a/tmpo_8bqx39.py", line 18
print p1[0] - p[0][0], p1[1] - p[0][1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s841499843 | p00447 | u352394527 | 1525001826 | Python | Python3 | py | Runtime Error | 0 | 0 | 556 | def main()
while True:
m = int(input())
if not m: break
seiza = []
for i in range(m):
seiza.append(list(map(int,input().split())))
kijun = seiza.pop(0)
n = int(input())
hosi = []
point = {}
for i in range(n):
x,y = map(int,input().split())
point[x,y] = 1
hosi.append([x,y])
for a in hosi:
dx,dy = a[0] - kijun[0], a[1] - kijun[1]
for b in seiza:
if not (b[0] + dx, b[1] + dy) in point:
break
else:
print(dx,dy)
break
main()
| File "/tmp/tmp8fbyt_a4/tmp6k2z9s_3.py", line 1
def main()
^
SyntaxError: expected ':'
| |
s081701910 | p00447 | u150984829 | 1525498377 | Python | Python3 | py | Runtime Error | 0 | 0 | 284 | for e in iter(input,'0'):
a=sorted([list(map(int,input().split()))for _ in[0]*int(e)],key=lambda x:x[0])
b=sorted([tuple(map(int,input().split()))for _ in[0]*int(input())],key=lambda x:x[0])
for s,t in b:
if not set((u+s-a[0][0],v+t-a[0][1])for u,v in a)-set(b):print(x,y);break
| Traceback (most recent call last):
File "/tmp/tmpi8qzcd0c/tmp_9ygarff.py", line 1, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s290788629 | p00447 | u150984829 | 1525498574 | Python | Python3 | py | Runtime Error | 0 | 0 | 299 | for e in iter(input,'0'):
a=sorted([list(map(int,input().split()))for _ in[0]*int(e)],key=lambda x:x[0])
b=sorted([tuple(map(int,input().split()))for _ in[0]*int(input())],key=lambda x:x[0])
for s,t in b:
u,v=a[0]
x,y=s-u,t-v
for u,v in a:
if (u+x,v+y)not in b:break
else:print(x,y)
| File "/tmp/tmp06jxipoq/tmpldrray2m.py", line 1
for e in iter(input,'0'):
^
SyntaxError: invalid non-printable character U+0001
| |
s617723116 | p00447 | u150984829 | 1525498643 | Python | Python3 | py | Runtime Error | 0 | 0 | 297 | for e in iter(input,'0'):
a=sorted([list(map(int,input().split()))for _ in[0]*int(e)],key=lambda x:x[0])
b=sorted([list(map(int,input().split()))for _ in[0]*int(input())],key=lambda x:x[0])
for s,t in b:
u,v=a[0]
x,y=s-u,t-v
for u,v in a:
if[u+x,v+y]not in b:break
else:print(x,y)
| File "/tmp/tmp66wye6ue/tmpbi_nsptw.py", line 1
for e in iter(input,'0'):
^
SyntaxError: invalid non-printable character U+0001
| |
s077417851 | p00447 | u150984829 | 1525498728 | Python | Python3 | py | Runtime Error | 0 | 0 | 245 | for e in iter(input,'0'):
a=[list(map(int,input().split()))for _ in[0]*int(e)]
b=[list(map(int,input().split()))for _ in[0]*int(input())]
for s,t in b:
u,v=a[0]
x,y=s-u,t-v
for u,v in a:
if[u+x,v+y]not in b:break
else:print(x,y)
| File "/tmp/tmpjz7hsge_/tmpii3w995c.py", line 1
for e in iter(input,'0'):
^
SyntaxError: invalid non-printable character U+0001
| |
s118681441 | p00447 | u150984829 | 1525499376 | Python | Python3 | py | Runtime Error | 0 | 0 | 257 | def f():
for e in iter(input,'0'):
a=[list(map(int,input().split()))for _ in[0]*int(m)]
u,v=a[0]
b=[tuple(map(int,input().split()))for _ in[0]*int(input())]
for x,y in b:
for s,t in a[1:]:
if(x+s-u,y+t-v)not in b:return print(x-sx,y-sy)
f()
| Traceback (most recent call last):
File "/tmp/tmp3mw2r5ij/tmprxl_ot5c.py", line 9, in <module>
f()
File "/tmp/tmp3mw2r5ij/tmprxl_ot5c.py", line 2, in f
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s898630289 | p00447 | u150984829 | 1525499396 | Python | Python3 | py | Runtime Error | 0 | 0 | 257 | def f():
for e in iter(input,'0'):
a=[list(map(int,input().split()))for _ in[0]*int(e)]
u,v=a[0]
b=[tuple(map(int,input().split()))for _ in[0]*int(input())]
for x,y in b:
for s,t in a[1:]:
if(x+s-u,y+t-v)not in b:return print(x-sx,y-sy)
f()
| Traceback (most recent call last):
File "/tmp/tmp83wrrlv4/tmp_9zvgf4x.py", line 9, in <module>
f()
File "/tmp/tmp83wrrlv4/tmp_9zvgf4x.py", line 2, in f
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s956625494 | p00447 | u150984829 | 1525500314 | Python | Python3 | py | Runtime Error | 0 | 0 | 333 | for e in iter(input,'0'):
a=list({tuple(map(int,input().split())) for _ in range(int(e))})
s,t=a[0]
b={list(map(int,input().split())) for _ in range(int(input()))}
for x,y in b:
flag = True
for u,v in a[1:]:
if [x + u - s, y + v - t] not in b:
flag = False
break
if flag == True:
print(x - s, y - t)
break
| Traceback (most recent call last):
File "/tmp/tmp6eetyftg/tmpd6ynj4q2.py", line 1, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s641322712 | p00447 | u150984829 | 1525500426 | Python | Python3 | py | Runtime Error | 0 | 0 | 317 | for e in iter(input,'0'):
a={tuple(map(int,input().split())) for _ in range(int(e))}
s,t=a[0]
b={tuple(map(int,input().split())) for _ in range(int(input()))}
for x,y in b:
flag = True
for u,v in a[1:]:
if(x+u-s,y+v-t}not in b:
flag = False
break
if flag == True:
print(x - s, y - t)
break
| File "/tmp/tmpy7no5c_n/tmp0t93zaq7.py", line 8
if(x+u-s,y+v-t}not in b:
^
SyntaxError: closing parenthesis '}' does not match opening parenthesis '('
| |
s786660575 | p00447 | u150984829 | 1525500439 | Python | Python3 | py | Runtime Error | 0 | 0 | 317 | for e in iter(input,'0'):
a={tuple(map(int,input().split())) for _ in range(int(e))}
s,t=a[0]
b={tuple(map(int,input().split())) for _ in range(int(input()))}
for x,y in b:
flag = True
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:
flag = False
break
if flag == True:
print(x - s, y - t)
break
| Traceback (most recent call last):
File "/tmp/tmp8030hzk7/tmpknfc0dry.py", line 1, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s866388352 | p00447 | u150984829 | 1525500998 | Python | Python3 | py | Runtime Error | 0 | 0 | 267 | def f(e):
a=list([*map(int,input().split())]for _ in range(int(e)))
s,t=a[0]
b={(*map(int,input().split()))for _ in range(int(input()))}
for x,y in b:
for u,v in a[1:]:
if(x+u-s,y+v-t)not in b:break
else:return print(x-s,y-t)
for e in iter(input,'0'):f(e)
| File "/tmp/tmpq_xe4f9p/tmp9amt1mcz.py", line 4
b={(*map(int,input().split()))for _ in range(int(input()))}
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot use starred expression here
| |
s902543133 | p00447 | u150984829 | 1525501494 | Python | Python3 | py | Runtime Error | 0 | 0 | 560 | import operator
for e in iter(input,'0'):
target = [[*map(int,input().split()))]for _ in[0]*int(e)]
bx, by = min(target)
target = {(x - bx, y - by) for x, y in target}
max_tx = max(map(operator.itemgetter(0), target))
b = {tuple(map(int,input().split()))for _ in[0]*int(input())}
max_sx = max(map(operator.itemgetter(0), b))
lim_x = max_sx - max_tx
for x,y in b:
if x > lim_x:continue
for u,v in a:
if (x + tx, y + ty) not in b:break
else:
print(x - bx, y - by)
break
| File "/tmp/tmp9p36yznc/tmp8a85_h_p.py", line 3
target = [[*map(int,input().split()))]for _ in[0]*int(e)]
^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '['
| |
s260971710 | p00447 | u150984829 | 1525501513 | Python | Python3 | py | Runtime Error | 0 | 0 | 559 | import operator
for e in iter(input,'0'):
target = [[*map(int,input().split())]for _ in[0]*int(e)]
bx, by = min(target)
target = {(x - bx, y - by) for x, y in target}
max_tx = max(map(operator.itemgetter(0), target))
b = {tuple(map(int,input().split()))for _ in[0]*int(input())}
max_sx = max(map(operator.itemgetter(0), b))
lim_x = max_sx - max_tx
for x,y in b:
if x > lim_x:continue
for u,v in a:
if (x + tx, y + ty) not in b:break
else:
print(x - bx, y - by)
break
| Traceback (most recent call last):
File "/tmp/tmpbd4ng5v9/tmpgakdyofg.py", line 2, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s660744415 | p00447 | u150984829 | 1525501544 | Python | Python3 | py | Runtime Error | 0 | 0 | 564 | import operator
for e in iter(input,'0'):
target = [[*map(int,input().split())]for _ in[0]*int(e)]
bx, by = min(target)
target = {(x - bx, y - by) for x, y in target}
max_tx = max(map(operator.itemgetter(0), target))
b = {tuple(map(int,input().split()))for _ in[0]*int(input())}
max_sx = max(map(operator.itemgetter(0), b))
lim_x = max_sx - max_tx
for x,y in b:
if x > lim_x:continue
for u,v in target:
if (x + tx, y + ty) not in b:break
else:
print(x - bx, y - by)
break
| Traceback (most recent call last):
File "/tmp/tmp4kpua22c/tmpivfiekga.py", line 2, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s362393694 | p00447 | u150984829 | 1525501781 | Python | Python3 | py | Runtime Error | 0 | 0 | 550 | import operator
for e in iter(input,'0'):
target = [[*map(int,input().split())]for _ in[0]*int(e)]
s,t = min(target)
target = {(x - bx, y - by) for x, y in target}
max_tx = max(map(lambda x:x[0], target))
b = {tuple(map(int,input().split()))for _ in[0]*int(input())}
max_sx = max(map(operator.itemgetter(0), b))
lim_x = max_sx - max_tx
for x,y in b:
if x > lim_x:continue
for u,v in target:
if (x + u, y + v) not in b:break
else:
print(x - bx, y - by)
break
| Traceback (most recent call last):
File "/tmp/tmpg0tinjbk/tmpgibyscf8.py", line 2, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s743995126 | p00447 | u150984829 | 1525501798 | Python | Python3 | py | Runtime Error | 0 | 0 | 548 | import operator
for e in iter(input,'0'):
target = [[*map(int,input().split())]for _ in[0]*int(e)]
s,t = min(target)
target = {(x - bx, y - by) for x, y in target}
max_tx = max(map(lambda x:x[0], target))
b = {tuple(map(int,input().split()))for _ in[0]*int(input())}
max_sx = max(map(operator.itemgetter(0), b))
lim_x = max_sx - max_tx
for x,y in b:
if x > lim_x:continue
for u,v in target:
if (x + u, y + v) not in b:break
else:
print(x - s, y - t)
break
| Traceback (most recent call last):
File "/tmp/tmpcm5fb618/tmpwva6r9zv.py", line 2, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s841786689 | p00448 | u945345165 | 1495624515 | Python | Python3 | py | Runtime Error | 0 | 0 | 1794 | import copy
import itertools
import numpy
def solve():
max = 0
for i in range(-1,H):
for rs in itertools.combinations(range(H),i+1):
tmpMap = copy.deepcopy(osenbei)
tmpMap = reverseR(tmpMap, rs)
#print(numpy.array(tmpMap),'=>')
cs = []
for j in range(W):
if needReverse(tmpMap,j):
cs.append(j)
tmpMap = reverseC(tmpMap, cs)
#print(numpy.array(tmpMap))
tmp = countZero(tmpMap)
if max < tmp:
max = tmp
return max
def needReverse(tmpMap,j):
#?????£???????????????????????????????????????
sum = 0
for a in range(H):
sum += int(tmpMap[a][j])
#print('sum is :', sum)
return sum>(H/2)
def countZero(tmpO):
c = 0
for i in range(H):
c += tmpO[i].count('0')
return c
def countReverse(rs,cs):
tmpO = copy.deepcopy(osenbei)
tmpO = reverseR(tmpO, rs)
tmpO = reverseC(tmpO, cs)
return countZero(tmpO)
def reverseR(tmpO, rs):
for r in rs:
for i in range(W):
if tmpO[r][i] == '0': tmpO[r][i] = '1'
elif tmpO[r][i] == '1': tmpO[r][i] = '0'
return tmpO
def reverseC(tmpO, cs):
for c in cs:
for i in range(H):
if tmpO[i][c] == '0': tmpO[i][c] = '1'
elif tmpO[i][c] == '1': tmpO[i][c] = '0'
return tmpO
H = -1
W = -1
osenbei = []
counter = -1
line = input()
while line!='0 0':
if H == -1:
H,W = map(int,line.split())
osenbei = [[-1 for i in range(W)] for j in range(H)]
counter = 0
else:
osenbei[counter] = line.split()
counter += 1
if counter == H:
print(solve())
H = -1
W = -1
line = input() | Traceback (most recent call last):
File "/tmp/tmptqxqurio/tmph068u__9.py", line 61, in <module>
line = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s387614484 | p00448 | u577311000 | 1495628815 | Python | Python | py | Runtime Error | 0 | 0 | 485 | while 1:
????????r, c = map(int, raw_input().split())
????????if r == 0: break
????????old = [raw_input().split() for i in range(r)]
????????old = map(list, zip(*old))
????????new = [int("".join(lst),2) for lst in old]
????????ans = 0
????????for i in range(1<<(r-1)):
????????????????ret = 0
????????????????for j in new:
????????????????????????cnt = bin(i^j).count('1')
????????????????????????ret += cnt if cnt > r/2 else r-cnt
????????????????ans = max(ans, ret)
????????print ans | File "/tmp/tmpvhfgfz92/tmpff9gq928.py", line 2
????????r, c = map(int, raw_input().split())
^
IndentationError: expected an indented block after 'while' statement on line 1
| |
s181272938 | p00448 | u577311000 | 1495628848 | Python | Python | py | Runtime Error | 0 | 0 | 485 | while 1:
????????r, c = map(int, raw_input().split())
????????if r == 0: break
????????old = [raw_input().split() for i in range(r)]
????????old = map(list, zip(*old))
????????new = [int("".join(lst),2) for lst in old]
????????ans = 0
????????for i in range(1<<(r-1)):
????????????????ret = 0
????????????????for j in new:
????????????????????????cnt = bin(i^j).count('1')
????????????????????????ret += cnt if cnt > r/2 else r-cnt
????????????????ans = max(ans, ret)
????????print ans | File "/tmp/tmprc7g1v8p/tmpwef9k1cd.py", line 2
????????r, c = map(int, raw_input().split())
^
IndentationError: expected an indented block after 'while' statement on line 1
| |
s116253616 | p00448 | u577311000 | 1495628854 | Python | Python | py | Runtime Error | 0 | 0 | 483 | while 1:
????????r, c = map(int, raw_input().split())
????????if r == 0: break
????????old = [raw_input().split() for i in range(r)]
????????old = map(list, zip(*old))
????????new = [int("".join(lst),2) for lst in old]
????????ans = 0
????????for i in range(1<<(r)):
????????????????ret = 0
????????????????for j in new:
????????????????????????cnt = bin(i^j).count('1')
????????????????????????ret += cnt if cnt > r/2 else r-cnt
????????????????ans = max(ans, ret)
????????print ans | File "/tmp/tmph7u9picj/tmpnktpt2fx.py", line 2
????????r, c = map(int, raw_input().split())
^
IndentationError: expected an indented block after 'while' statement on line 1
| |
s391784552 | p00448 | u964207033 | 1495628917 | Python | Python3 | py | Runtime Error | 0 | 0 | 713 | import sys
def solve(A, R, C):
result = 0
for i in range(2 ** (R-1)):
s = 0
for j in range(C):
number_of_0s = 0
for k in range(R):
a = A[k][j]
flip_kth_row = (i >> k) & 1
if a ^ flip_kth_row: # XOR
number_of_0s += 1
number_of_1s = R - number_of_0s
max_column += max(number_of_0s, number_of_1s)
result = max(result, max_column)
print(result)
while True:
R, C = map(int, sys.stdin.readline().split())
if R == 0 and C == 0:
break
A = []
for _ in range(R):
A.append(list(map(int, sys.stdin.readline().split())))
solve(A, R, C) | Traceback (most recent call last):
File "/tmp/tmpzqt6i4fm/tmp0e8zfm6_.py", line 20, in <module>
R, C = map(int, sys.stdin.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s282569432 | p00448 | u150984829 | 1525504632 | Python | Python3 | py | Runtime Error | 0 | 0 | 229 | for e in iter(input,'0 0'):
H,W=map(int,e.split())
s=[[*map(int,input().split())]for _ in[0]*H]
print(max(sum(max(sum(c),H-sum(c))for c in zip([c^int(b)for c in r]for r,b in zip(s,bin(x)[2:].zfill(H)))))for x in range(2**H)))
| File "/tmp/tmpzkjr_ziz/tmp4jrxcaoq.py", line 4
print(max(sum(max(sum(c),H-sum(c))for c in zip([c^int(b)for c in r]for r,b in zip(s,bin(x)[2:].zfill(H)))))for x in range(2**H)))
^
SyntaxError: unmatched ')'
| |
s545274165 | p00448 | u150984829 | 1525504665 | Python | Python3 | py | Runtime Error | 0 | 0 | 228 | for e in iter(input,'0 0'):
H,W=map(int,e.split())
s=[[*map(int,input().split())]for _ in[0]*H]
print(max(sum(max(sum(c),H-sum(c))for c in zip([c^int(b)for c in r]for r,b in zip(s,bin(x)[2:].zfill(H)))for x in range(2**H))))
| Traceback (most recent call last):
File "/tmp/tmpksqo7o6s/tmpn6nn7tc6.py", line 1, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s572565509 | p00448 | u150984829 | 1525504723 | Python | Python3 | py | Runtime Error | 0 | 0 | 228 | for e in iter(input,'0 0'):
H,W=map(int,e.split())
s=[[*map(int,input().split())]for _ in[0]*H]
print(max(sum(max(sum(c),H-sum(c))for x in range(2**H)for c in zip([c^int(b)for c in r]for r,b in zip(s,bin(x)[2:].zfill(H))))))
| Traceback (most recent call last):
File "/tmp/tmpo1d9m2ae/tmpbqg6rwhb.py", line 1, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s894524802 | p00448 | u150984829 | 1525504809 | Python | Python3 | py | Runtime Error | 0 | 0 | 228 | for e in iter(input,'0 0'):
H,W=map(int,e.split())
s=[[*map(int,input().split())]for _ in[0]*H]
print(max(sum(max(sum(c),H-sum(c))for x in range(2**H))for c in zip([c^int(b)for c in r]for r,b in zip(s,bin(x)[2:].zfill(H)))))
| Traceback (most recent call last):
File "/tmp/tmpfke2e978/tmp9cr_jbo4.py", line 1, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s258720048 | p00448 | u150984829 | 1525504943 | Python | Python3 | py | Runtime Error | 0 | 0 | 228 | for e in iter(input,'0 0'):
H,W=map(int,e.split())
s=[[*map(int,input().split())]for _ in[0]*H]
print(max(sum(max(sum(c),H-sum(c))for c in zip([c^int(b)for c in r]for r,b in zip(s,bin(x)[2:].zfill(H))))for x in range(2**H)))
| Traceback (most recent call last):
File "/tmp/tmpsunp984c/tmp_3csrtoy.py", line 1, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s780100192 | p00448 | u150984829 | 1525508777 | Python | Python3 | py | Runtime Error | 0 | 0 | 281 | for e in iter(input,'0 0'):
r=int(e.split()[0])
d=[int(''.join(x),2)for x in zip(*[input().split()for _ in[0]*r])]
a=0
b=1<<r
c=[1]*b
for m in range(b):
if c[m]:
c[~m]=0
t=0
for s in d:
c=bin(m^s).count('1')
t+=c if c>r//2 else r-c
if a<t:a=t
print(a)
| Traceback (most recent call last):
File "/tmp/tmp25gfmkov/tmpg_nybgcv.py", line 1, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s769077780 | p00449 | u901080241 | 1489060986 | Python | Python3 | py | Runtime Error | 0 | 0 | 1015 | inf = 10**6+1
def dijkstra(a,b):
global inf
global n
global cost
d = [inf]*n
d[a] = 0
prev= [-1]*n
q = [x for x in range(n)]
while(len(q) != 0):
pmin = inf
for idx in q:
if pmin>d[idx]:
pmin = d[idx]
q.remove(d.index(pmin))
u = d.index(pmin)
for v in range(n):
if cost[u][v] != inf:
if d[v] > d[u] + cost[u][v]:
d[v] = d[u] + cost[u][v]
prev[v] = u
return d[b]
while True:
n,k = map(int, input().split())
if (n|k)==0: break
cost = [[inf]*n for i in range (n)]
for inline in range(k):
query = list(map(int, input().split()))
if query[0]:
cost[query[1]-1][query[2]-1] = min(cost[query[1]-1][query[2]-1], query[3])
cost[query[2]-1][query[1]-1] = cost[query[1]-1][query[2]-1]
else:
mon = dijkstra(query[1]-1,query[2]-1)
print(mon if mon != inf else -1) | Traceback (most recent call last):
File "/tmp/tmpm_20f3uy/tmpr0u7cf9y.py", line 30, in <module>
n,k = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s041523674 | p00449 | u352394527 | 1524063500 | Python | Python3 | py | Runtime Error | 0 | 0 | 828 | INF = 1000000000
def solve(s,g,E,n):
D = [0 if i == s else INF for i in range(n)]
U = [0 for i in range(n)]
V = [s]
while V:
v = V.pop(0)
if v == g:
break
for e in E[v]:
if and D[v] + e[1] < D[e[0]]:
D[e[0]] = D[v] + e[1]
V.append(e[0])
V = sorted(V,key=lambda x:D[x])
if D[g] >= INF:
print(-1)
else:
print(D[g])
while True:
try:
n,k = list(map(int,input().split()))
if n == 0 and k == 0:
break
E = [[] for i in range(n)]
for i in range(k):
lst = list(map(int,input().split()))
a = min(lst[1],lst[2])
b = max(lst[1],lst[2])
if lst[0] == 0:
solve(a - 1, b - 1, E, n)
elif lst[0] == 1:
E[a - 1].append([b - 1, lst[3]])
E[b - 1].append([a - 1, lst[3]])
except EOFError:
break
| File "/tmp/tmp4q_n8tql/tmpsch9cjqr.py", line 12
if and D[v] + e[1] < D[e[0]]:
^^^
SyntaxError: invalid syntax
| |
s460803100 | p00449 | u150984829 | 1526051015 | Python | Python3 | py | Runtime Error | 0 | 0 | 433 | from heapq import*
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:F[v]=t;heappush(H,(t,v))
return-1
def s():
for e in iter(input,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=[*map(int,input().split())]
if f[0]:
c,d,e=f[1:]
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(*f[1:]))
if'__main__'==__name__:s()
| Traceback (most recent call last):
File "/tmp/tmpun6nuw05/tmp0f0lwl3g.py", line 22, in <module>
if'__main__'==__name__:s()
^^^
File "/tmp/tmpun6nuw05/tmp0f0lwl3g.py", line 13, in s
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s594306124 | p00449 | u150984829 | 1526051365 | Python | Python3 | py | Runtime Error | 0 | 0 | 412 | import sys
from heapq import*
s=sys.stdin.readline
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:F[v]=t;heappush(H,(t,v))
return-1
for e in iter(s,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=[*map(int,s().split())]
if f[0]:
c,d,e=f[1:]
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(*f[1:]))
| Traceback (most recent call last):
File "/tmp/tmpixmwik77/tmpew3dahhc.py", line 15, in <module>
n,k=map(int,e.split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s730856966 | p00449 | u150984829 | 1526052011 | Python | Python3 | py | Runtime Error | 0 | 0 | 409 | import sys
from heapq import*
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
for e in iter(input,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=input()
if f[0]:
c,d,e=map(int,f.split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(map(int,f[2:])))
| Traceback (most recent call last):
File "/tmp/tmpm1bz04md/tmp628edm8z.py", line 15, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s378120296 | p00449 | u150984829 | 1526052034 | Python | Python3 | py | Runtime Error | 0 | 0 | 421 | import sys
from heapq import*
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
for e in iter(input,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=input()
if f[0]:
c,d,e=map(int,f[2;].split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(map(int,f[2:].split())))
| File "/tmp/tmpm47j99j8/tmpaueavf9r.py", line 21
c,d,e=map(int,f[2;].split())
^
SyntaxError: invalid syntax
| |
s685614698 | p00449 | u150984829 | 1526052046 | Python | Python3 | py | Runtime Error | 0 | 0 | 421 | import sys
from heapq import*
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
for e in iter(input,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=input()
if f[0]:
c,d,e=map(int,f[2:].split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(map(int,f[2:].split())))
| Traceback (most recent call last):
File "/tmp/tmpb04smb1i/tmpvxqgd_85.py", line 15, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s824100551 | p00449 | u150984829 | 1526052058 | Python | Python3 | py | Runtime Error | 0 | 0 | 422 | import sys
from heapq import*
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
for e in iter(input,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=input()
if f[0]:
c,d,e=map(int,f[2:].split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(*map(int,f[2:].split())))
| Traceback (most recent call last):
File "/tmp/tmpccmrf_wq/tmp0vu2mgfl.py", line 15, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s572838772 | p00449 | u150984829 | 1526052203 | Python | Python3 | py | Runtime Error | 0 | 0 | 426 | import sys
from heapq import*
def g(s,g):
F=[1e7]*-~n;F[s]=0
H=[(0,s)]
while H:
c,u=heappop(H)
if u==g:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
for e in iter(input,'0 0'):
n,k=map(int,e.split())
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=input()
if'0'==f[0]:
c,d,e=map(int,f[2:].split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
else:print(g(*map(int,f[2:].split())))
| Traceback (most recent call last):
File "/tmp/tmpgz155la_/tmpqlnyq2_f.py", line 15, in <module>
for e in iter(input,'0 0'):
EOFError: EOF when reading a line
| |
s177563188 | p00449 | u150984829 | 1526052695 | Python | Python3 | py | Runtime Error | 0 | 0 | 487 | import sys
from heapq import*
r=sys.stdin.readline
def g(n,E,S,G):
F=[1e7]*-~n;F[S]=0
H=[(0,S)]
while H:
c,u=heappop(H)
if u==G:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
def s(n,k):
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=r()
if'0'==f[0]:print(g(n,E,*map(int,f[2:].split())))
else:
c,d,e=map(int,f[2:].split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
if'__main__'==__name__:s()
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
| File "/tmp/tmpr79toiwd/tmpmhvhmv2e.py", line 25
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
IndentationError: unexpected indent
| |
s382415902 | p00449 | u150984829 | 1526052790 | Python | Python3 | py | Runtime Error | 0 | 0 | 485 | import sys
r=sys.stdin.readline
def g(n,E,S,G):
from heapq import*
F=[1e7]*-~n;F[S]=0
H=[(0,S)]
while H:
c,u=heappop(H)
if u==G:return c
for f,v in E[u]:
t=c+f
if t<F[v]:
F[v]=t
heappush(H,(t,v))
return-1
def s(n,k):
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=r()
if'0'==f[0]:print(g(n,E,*map(int,f[2:].split())))
else:
c,d,e=map(int,f[2:].split())
E[c]+=[(e,d)];E[d]+=[(e,c)]
if'__main__'==__name__:
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
| File "/tmp/tmp6tachu8z/tmpr0xf7pua.py", line 4
from heapq import*
^
SyntaxError: import * only allowed at module level
| |
s961701927 | p00449 | u150984829 | 1526053268 | Python | Python3 | py | Runtime Error | 0 | 0 | 441 | from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
F=[1e7]*-~n;F[S]=0;H=[(0,S)]
while H:
c,u=heappop(H)
if u==G:return c
for f,v in E[u]:
t=c+f
if t<F[v]:F[v]=t;heappush(H,(t,v))
return-1
def s(n,k):
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=r()
if'0'==f[0]:print(g(n,E,*map(int,f[2:].split())))
else:c=[*map(int,f[2:].split())];E[c]+=[[e,d]];E[d]+=[[e,c]]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
| Traceback (most recent call last):
File "/tmp/tmpu7nvo5iz/tmpp64qsdog.py", line 19, in <module>
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
^^^^^^^^^^^^^^^^^^^^^^
TypeError: s() missing 2 required positional arguments: 'n' and 'k'
| |
s573649251 | p00449 | u150984829 | 1526056625 | Python | Python3 | py | Runtime Error | 0 | 0 | 433 | from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
F=[1e7]*-~n;F[S],H=0,[(0,S)]
while H:
c,u=heappop(H)
if u==G:return c
for f,v in E[u]:
t=c+f
if t<F[v]:F[v]=t;heappush(H,(t,v))
return-1
def s(n,k):
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=r();p=map(int,f[2:].split())
if'0'==f[0]:print(g(n,E,*p))
else:c,d,e=p;E[c],E[d]=E[c]+[(e,d)],E[d],[(e,c)]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
| Traceback (most recent call last):
File "/tmp/tmp0vgx84z5/tmp7883edqi.py", line 19, in <module>
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
^^^^^^^^^^^^^^^^^^^^^^
TypeError: s() missing 2 required positional arguments: 'n' and 'k'
| |
s943022409 | p00449 | u150984829 | 1526057185 | Python | Python3 | py | Runtime Error | 0 | 0 | 494 | def main():
from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
F=[1e7]*-~n;F[S],H=0,[(0,S)]
while H:
c,u=heappop(H)
if u==G:return c
for f,v in E[u]:
t=c+f
if t<F[v]:F[v]=t;heappush(H,(t,v))
return-1
def s(n,k):
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=r();p=map(int,f[2:].split())
if'0'==f[0]:print(g(n,E,*p))
else:c,d,e=p;E[c]+=[(e,d)];E[d]+=[(e,c)]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
if __name__ == '__main__':
main()
| File "/tmp/tmpsttlhi2f/tmpaotqb7_x.py", line 2
from heapq import*
^
SyntaxError: import * only allowed at module level
| |
s466804215 | p00449 | u150984829 | 1526057192 | Python | Python3 | py | Runtime Error | 0 | 0 | 494 | def main():
from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
F=[1e7]*-~n;F[S],H=0,[(0,S)]
while H:
c,u=heappop(H)
if u==G:return c
for f,v in E[u]:
t=c+f
if t<F[v]:F[v]=t;heappush(H,(t,v))
return-1
def s(n,k):
E=[[]for _ in[0]*-~n]
for _ in[0]*k:
f=r();p=map(int,f[2:].split())
if'0'==f[0]:print(g(n,E,*p))
else:c,d,e=p;E[c]+=[(e,d)];E[d]+=[(e,c)]
for e in iter(r,'0 0\n'):s(*map(int,e.split()))
if __name__ == '__main__':
main()
| File "/tmp/tmpect0f5o8/tmpbnul4l65.py", line 2
from heapq import*
^
SyntaxError: import * only allowed at module level
| |
s788505325 | p00449 | u150984829 | 1526062208 | Python | Python3 | py | Runtime Error | 0 | 0 | 416 | import sys
r=sys.stdin.readline
I=float('inf')
for e in iter(r,'0 0'):
n,k=map(int,e.split())
F=[[I]*-~n for _ in[0]*-~n]
for i in range(1,n+1):F[i][i]=0
for _ in[0]*k:
f=r();g=map(int,f[2:].split())
if'0'==f[0]:a,b=g;A=F[a][b];print([A,-1][A==I])
else:
c,d,e=g
if e<F[c][d]:
for i in range(2,n+1):
for j in range(1,i):
F[i][j]=F[j][i]=min(F[i][j],F[i][c]+e+F[d][j],F[i][d]+e+F[c][j])
| Traceback (most recent call last):
File "/tmp/tmpg5_62r54/tmpo83gc2v6.py", line 5, in <module>
n,k=map(int,e.split())
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s871388182 | p00450 | u266872031 | 1422193695 | Python | Python | py | Runtime Error | 0 | 0 | 654 | while (1):
n=int(raw_input())
if n==0:
break
else:
top=-1
fault=[0]
S=0
for i in range(n/2): #i=0,2,... is othello i=1,3,...is donothing
s=int(raw_input()) #oddstone
if top!=s:
fault.append(i)
top=s
s=int(raw_input()) #evenstone
if top!=s:
fault.pop()
top=s
i=len(fault)-1
while i>0:
S=S+(fault[i]-fault[i-1])*2
i=i-2
if not top:
S=2*(n/2)-S
if n%2==1:
s=int(raw_input())
S=S+(1-s)
print S | File "/tmp/tmpzy0s7eb_/tmpo7fv51ya.py", line 27
print S
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s696212904 | p00450 | u203261375 | 1467033934 | Python | Python3 | py | Runtime Error | 0 | 0 | 515 | f = open('input.txt')
fo = open('output.txt',"w")
while True:
n = int(f.readline())
if n == 0:
f.close
fo.close
break
arr = [0 for i in range(n)]
for i in range(n):
stone = int(f.readline())
if i%2 == 0:
arr[i] = stone
else:
for j in reversed(range(i)):
if arr[j] != stone:
arr[j] = stone
else:
break
arr[i] = stone
fo.write(arr.count(0)) | Traceback (most recent call last):
File "/tmp/tmpr6xwxzgr/tmp1hetvjtp.py", line 1, in <module>
f = open('input.txt')
^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'input.txt'
| |
s503148290 | p00450 | u621997536 | 1389632660 | Python | Python | py | Runtime Error | 0 | 0 | 481 |
stones = [0, 0]
n = input()
stones.append(input())
stones[0] = (stones[2] + 1) % 2
stones.append(1)
for i in range(n - 1):
m = input()
if i % 2 == 1:
if stones[-2] == m:
stones[-1] += 1
else:
stones.append(m)
stones.append(1)
else:
if stones[-2] == m:
stones[-1] += 1
else:
stones[-3] += stones[-1] + 1
stones = stones[:-2]
ans = 0
for j in range(0, len(stones), 2):
if stones[j] == 0:
ans += stones[j + 1]
print ans | File "/tmp/tmpzq8yauji/tmpwmj1oxn9.py", line 25
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s170063993 | p00450 | u621997536 | 1389632744 | Python | Python | py | Runtime Error | 0 | 0 | 563 |
while True:
stones = [0, 0]
n = input()
if not n:
break
stones.append(input())
stones[0] = (stones[2] + 1) % 2
stones.append(1)
for i in range(n - 1):
m = input()
if i % 2 == 1:
if stones[-2] == m:
stones[-1] += 1
else:
stones.append(m)
stones.append(1)
else:
if stones[-2] == m:
stones[-1] += 1
else:
stones[-3] += stones[-1] + 1
stones = stones[:-2]
ans = 0
for j in range(0, len(stones), 2):
if stones[j] == 0:
ans += stones[j + 1]
print ans | File "/tmp/tmpfhfhtnar/tmp4ra18sdu.py", line 28
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s349830615 | p00451 | u621997536 | 1388558850 | Python | Python | py | Runtime Error | 0 | 0 | 420 |
while True:
try:
a = raw_input()
b = raw_input()
ans = 0
dp = [[0 for j in range(4000)] for i in range(4000)]
for i in range(1, len(a) + 1):
for j in range(1, len(b) + 1):
if a[i - 1] == b[j - 1]:
dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1, dp[i - 1][j])
ans = max(ans, dp[i][j])
else:
dp[i][j] = 0
print ans
except EOFError:
break | File "/tmp/tmpys8z9ej0/tmp01m5cjl_.py", line 16
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s453779554 | p00452 | u894114233 | 1473696646 | Python | Python | py | Runtime Error | 0 | 0 | 661 | n,m=map(int,raw_input().split())
if n==m==0:break
p=[0]+[int(raw_input()) for _ in xrange(n)]
com=[None]*((n+1)**2)
for i in xrange(n+1):
for j in xrange(n+1):
com[(n+1)*i+j]=p[i]+p[j]
com.sort()
ans=0
for i in xrange(n+1):
for j in xrange(n+1):
tmp=m-com[(n+1)*i+j]
if tmp<0:continue
index=bisect.bisect_left(com,tmp)
if index==(n+1)**2:continue
if com[index]>tmp:
if index==0:continue
else:
index-=1
ans=max(ans,com[(n+1)*i+j]+com[index])
if ans==m:
break | File "/tmp/tmpszeez0mu/tmpa_g9mpq7.py", line 1
n,m=map(int,raw_input().split())
IndentationError: unexpected indent
| |
s161347315 | p00452 | u901080241 | 1489072962 | Python | Python3 | py | Runtime Error | 0 | 0 | 1061 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Main {
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true){
String line[] = br.readLine().split(" ");
int n = Integer.parseInt(line[0]);
int m = Integer.parseInt(line[1]);
if (n==0) {break;}
int[] onelist = new int [n+1];
for(int i=1; i<=n; i++){
onelist[i] = Integer.parseInt(br.readLine());
}
int[] twolist = new int [(n+2)*(n+1)/2];
for(int i=0; i<=n; i++){
for(int j=i; j<=n; j++){
twolist[i*(n+1)-i*(i+1)/2 + j] = onelist[i] + onelist[j];
}
}
Arrays.sort(twolist);
int answer = 0;
int maxi = (n+2)*(n+1)/2-1;
KOKO: for(int i=0; i<m; i++){
for(int j=0; j<=maxi; j++){
while(twolist[j]+twolist[maxi] > m-i ){maxi--;}
if (twolist[j] + twolist[maxi] == m-i){
answer = m-i;
break KOKO;
}
}
}
System.out.println(answer);
}
}
} | File "/tmp/tmpe90tciku/tmpkbhd7k6w.py", line 6
public class Main {
^^^^^
SyntaxError: invalid syntax
| |
s712207507 | p00453 | u894114233 | 1475223420 | Python | Python | py | Runtime Error | 0 | 0 | 928 | def calc(now,nx,w):
return (now+nx)*abs(w)
while 1:
n,m=map(int,raw_input().split())
if n==m==0:break
isi=[[0]*11]+[[float('inf')]*11 for _ in xrange(n)]+[[0]*11]
for i in xrange(1,n+1):
en=map(int,raw_input().split())
num=en[0]
for j in xrange(num):
isi[i][en[j*2+1]]=en[j*2+2]
dp=[[[float('inf')]*(m+1) for _ in xrange(11)] for _ in xrange(n+2)]
for j in xrange(11):
dp[0][j][0]=0
for i in xrange(n+1):
for j in xrange(1,11):
for k in xrange(m+1):
for l in xrange(1,11):
dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][l][k]+calc(isi[i][l],isi[i+1][j],j-l))
if i-1>=0 and k>=1:
dp[i+1][j][k]=min(dp[i+1][j][k],dp[i-1][l][k-1]+calc(isi[i-1][l],isi[i+1][j],j-l))
ans=float('inf')
for j in xrange(11):
ans=min(ans,dp[n+1][j][m])
print(ans) | Traceback (most recent call last):
File "/tmp/tmp6makrplt/tmpeybedadd.py", line 4, in <module>
n,m=map(int,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s456189536 | p00454 | u797673668 | 1458210590 | Python | Python3 | py | Runtime Error | 0 | 0 | 777 | def paint(i, j, prev=0):
global w, h, board
board[i][j] = 0
if i + 1 < h and board[i + 1][j]:
paint(i + 1, j)
if prev != 2 and j > 0 and board[i][j - 1]:
paint(i, j - 1, 1)
if prev != 1 and j + 1 < w and board[i][j + 1]:
paint(i, j + 1, 2)
while True:
w, h = map(int, input().split())
if not w:
break
board = [[1] * w for _ in range(h)]
n = int(input())
for _ in range(n):
x1, y1, x2, y2 = map(int, input().split())
tape_row = [0] * (x2 - x1)
for i in range(y1, y2):
board[i][x1:x2] = tape_row
counter = 0
for i in range(h):
for j in range(w):
if board[i][j]:
paint(i, j)
counter += 1
print(counter) | Traceback (most recent call last):
File "/tmp/tmpyihen3w0/tmpsdj_m649.py", line 14, in <module>
w, h = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s308048118 | p00454 | u901080241 | 1496196275 | Python | Python3 | py | Runtime Error | 0 | 0 | 1790 | import bisect
def xins(x):
if not x in xlist:
insp = bisect.bisect(xlist,x)
xlist.insert(insp,x)
for lst in zaatu:
ins = 1 if insp == 0 else lst[insp-1]
lst.insert(insp,ins)
def yins(y):
if not y in ylist:
insp = bisect.bisect(ylist,y)
ylist.insert(insp,y)
a = [1]*(len(xlist)+1)
if insp > 0:
for i in range(len(ylist)):
a[i] = zaatu[insp-1][i]
zaatu.insert(insp,a)
def addmask(x1,y1,x2,y2):
xins(x1)
yins(y1)
xins(x2)
yins(y2)
x1 = xlist.index(x1)
y1 = ylist.index(y1)
x2 = xlist.index(x2)
y2 = ylist.index(y2)
for i in range(y1,y2):
for j in range(x1,x2):
zaatu[i][j] = 0
def printcolor(zaatu,no,x,y,xlen,ylen):
if zaatu[y][x] == 1:
zaatu[y][x] = no
if x > 0:
printcolor(zaatu,no,x-1,y,xlen,ylen)
if x < xlen:
printcolor(zaatu,no,x+1,y,xlen,ylen)
if y > 0:
printcolor(zaatu,no,x,y-1,xlen,ylen)
if y < ylen:
printcolor(zaatu,no,x,y+1,xlen,ylen)
while True:
xlist = []
ylist = []
zaatu = [[1]]
h,w = map(int, input().split())
if h == 0: break
masn = int(input())
for i in range(masn):
a,b,c,d = map(int,input().split())
addmask(a,b,c,d)
if xlist[0] != 0: xins(0)
if ylist[0] != 0: yins(0)
if xlist[-1] == h: xlist.pop()
if ylist[-1] == w: ylist.pop()
ylist.pop()
xlen = len(xlist)
ylen = len(ylist)
no = 2
for y in range(ylen):
for x in range(xlen):
printcolor(zaatu,no,x,y,xlen,ylen)
if zaatu[y][x] == no: no += 1
mx = 0
for lst in zaatu:
mx = max(mx,max(lst))
print(mx-1) | Traceback (most recent call last):
File "/tmp/tmpvlftiks8/tmpcyrry1ti.py", line 52, in <module>
h,w = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s858215481 | p00454 | u901080241 | 1496196567 | Python | Python3 | py | Runtime Error | 920 | 57012 | 1831 | import bisect
import sys
sys.setrecursionlimit(100000)
def xins(x):
if not x in xlist:
insp = bisect.bisect(xlist,x)
xlist.insert(insp,x)
for lst in zaatu:
ins = 1 if insp == 0 else lst[insp-1]
lst.insert(insp,ins)
def yins(y):
if not y in ylist:
insp = bisect.bisect(ylist,y)
ylist.insert(insp,y)
a = [1]*(len(xlist)+1)
if insp > 0:
for i in range(len(xlist)):
a[i] = zaatu[insp-1][i]
zaatu.insert(insp,a)
def addmask(x1,y1,x2,y2):
xins(x1)
yins(y1)
xins(x2)
yins(y2)
x1 = xlist.index(x1)
y1 = ylist.index(y1)
x2 = xlist.index(x2)
y2 = ylist.index(y2)
for i in range(y1,y2):
for j in range(x1,x2):
zaatu[i][j] = 0
def printcolor(zaatu,no,x,y,xlen,ylen):
if zaatu[y][x] == 1:
zaatu[y][x] = no
if x > 0:
printcolor(zaatu,no,x-1,y,xlen,ylen)
if x < xlen:
printcolor(zaatu,no,x+1,y,xlen,ylen)
if y > 0:
printcolor(zaatu,no,x,y-1,xlen,ylen)
if y < ylen:
printcolor(zaatu,no,x,y+1,xlen,ylen)
while True:
xlist = []
ylist = []
zaatu = [[1]]
h,w = map(int, input().split())
if h == 0: break
masn = int(input())
for i in range(masn):
a,b,c,d = map(int,input().split())
addmask(a,b,c,d)
if xlist[0] != 0: xins(0)
if ylist[0] != 0: yins(0)
if xlist[-1] == h: xlist.pop()
if ylist[-1] == w: ylist.pop()
ylist.pop()
xlen = len(xlist)
ylen = len(ylist)
no = 2
for y in range(ylen):
for x in range(xlen):
printcolor(zaatu,no,x,y,xlen,ylen)
if zaatu[y][x] == no: no += 1
mx = 0
for lst in zaatu:
mx = max(mx,max(lst))
print(mx-1) | Traceback (most recent call last):
File "/tmp/tmpb1jzv4us/tmpwc14twop.py", line 54, in <module>
h,w = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s288214081 | p00454 | u352394527 | 1527049517 | Python | Python3 | py | Runtime Error | 0 | 0 | 1357 | while True:
w, h = map(int, input().split())
if not w:
break
n = int(input())
xlst = [0, w - 1]
ylst = [0, h - 1]
plst = []
for i in range(n):
x1, y1, x2, y2 = map(int, input().split())
plst.append([x1,y1,x2,y2])
xlst.append(x1)
# xlst.append(x1 + 1)
xlst.append(x2)
# xlst.append(x2 + 1)
ylst.append(y1)
# ylst.append(y1 + 1)
ylst.append(y2)
# ylst.append(y2 + 1)
xlst = list(set(xlst))
ylst = list(set(ylst))
sorted_xlst = sorted(xlst)
sorted_ylst = sorted(ylst)
xdic = {}
ydic = {}
for i, v in enumerate(xlst):
xdic[v] = i
for i, v in enumerate(ylst):
ydic[v] = i
neww = len(xlst) - 1
newh = len(ylst) - 1
painted = [[0] * newh for _ in range(neww)]
def paint_area(x, y):
painted[x][y] = 1
to_lst = [(x - 1, y), (x + 1, y), (x, y - 1), (x, y + 1)]
for tx, ty in to_lst:
if 0 <= tx <= neww - 1 and 0 <= ty <= newh - 1 and not painted[tx][ty]:
paint_area(tx, ty)
for p in plst:
x1, y1, x2, y2 = p
x1, y1, x2, y2 = xdic[x1], ydic[y1], xdic[x2], ydic[y2]
for x in range(x1, x2):
for y in range(y1, y2):
painted[x][y] = 1
# for area in painted:
# print(area)
ans = 0
for x in range(neww):
for y in range(newh):
if not painted[x][y]:
ans += 1
paint_area(x, y)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpr9pgc1ev/tmpup7h8mvm.py", line 2, in <module>
w, h = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s117541593 | p00455 | u889593139 | 1511930909 | Python | Python3 | py | Runtime Error | 0 | 0 | 716 | import datetime
def while_in_time(two_times):
times = two_times.split() # ???????????????
in_time_str = ' '.join(times[:3]) # ??\????????????????????????
out_time_str = ' '.join(times[3:]) # ???????????????????????????
in_time = datetime.datetime.strptime(in_time_str, '%H %M %S') #??\??????????????????
out_time = datetime.datetime.strptime(out_time_str, '%H %M %S')
while_time = out_time - in_time # ?????????????????????????¨??????????
str_while_time = while_time.datetime.strftime(while_time, '%H %M %S')
return str_while_time
A_time = input()
B_time = input()
C_time = input()
print(while_in_time(A_time))
print(while_in_time(B_time))
print(while_in_time(C_time)) | Traceback (most recent call last):
File "/tmp/tmp7v8njoht/tmp83qnqxsi.py", line 19, in <module>
A_time = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s390332757 | p00455 | u350508326 | 1401601633 | Python | Python3 | py | Runtime Error | 0 | 0 | 560 | ef main():
data = list(map(int, input().split()))
# print(data)
a = data[:3]
# print(a)
b = data[3:]
# print(b)
ans = [0 for x in range(3)]
t = b[2] - a[2]
if t < 0:
ans[2] = t + 60
b[1] -= 1
else:
ans[2] = t
t = b[1] - a[1]
if t < 0:
ans[1] = t + 60
b[0] -= 1
else:
ans[1] = t
ans[0] = b[0] - a[0]
# print(ans)
for a in ans[:-1]:
print(a, end=' ')
print(ans[-1])
if __name__ == '__main__':
for a in range(3):
main() | File "/tmp/tmpg1hg19h3/tmpgl8zz_sr.py", line 1
ef main():
^^^^
SyntaxError: invalid syntax
| |
s464015669 | p00456 | u537067968 | 1551620367 | Python | Python3 | py | Runtime Error | 0 | 0 | 257 | #import math
while True:
w = []
k = []
for i in range(10):
w.append(int(input()))
for i in range(10):
k.append(int(input()))
w.sort()
w.reverse()
k.sort()
k.reverse()
print(w[0]+w[1]+w[2],k[0]+k[1]+k[2])
| Traceback (most recent call last):
File "/tmp/tmpnwbc4opg/tmpfqfabdd1.py", line 7, in <module>
w.append(int(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s976956715 | p00456 | u537067968 | 1551620516 | Python | Python3 | py | Runtime Error | 0 | 0 | 219 | #import math
while True:
w = []
k = []
for i in range(10):
w.append(int(input()))
for i in range(10):
k.append(int(input()))
w.sort()
k.sort()
print(sum(w[-3:]),sum(k[-3:]))
| Traceback (most recent call last):
File "/tmp/tmprh7iq9nb/tmpmorzbx1j.py", line 7, in <module>
w.append(int(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s907777988 | p00456 | u537067968 | 1551620631 | Python | Python3 | py | Runtime Error | 0 | 0 | 217 | #import math
while True:
w = []
k = []
for i in range(10):
w.append(int(input()))
for i in range(10):
k.append(int(input()))
w.sort()
k.sort()
print(sum(w[7:]),sum(k[7:]))
| Traceback (most recent call last):
File "/tmp/tmpfcb5sha8/tmp_ildnub4.py", line 7, in <module>
w.append(int(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s326211027 | p00456 | u105854386 | 1555698042 | Python | Python3 | py | Runtime Error | 0 | 0 | 206 | W = []
K = []
for i in range(20):
W.append(int(input()))
for i in range(20):
K.append(int(input()))
W.sort(reverse=True)
K.sort(reverse=True)
print(W[0] + W[1] + W[2])
print(K[0] + K[1] + K[2])
| Traceback (most recent call last):
File "/tmp/tmpvi0tmsb6/tmp1aq0vsei.py", line 5, in <module>
W.append(int(input()))
^^^^^^^
EOFError: EOF when reading a line
| |
s994578339 | p00456 | u104911888 | 1367544728 | Python | Python | py | Runtime Error | 0 | 0 | 103 | W=[input() for i in range(10)].sort()
K=[input() for i in range(10)].sort()
print sum(W[:3]),sum(K[:3]) | File "/tmp/tmpktq1m21f/tmpq1_lmkvr.py", line 3
print sum(W[:3]),sum(K[:3])
^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s440512341 | p00456 | u633068244 | 1395079917 | Python | Python | py | Runtime Error | 0 | 0 | 158 | w, k = [],[]
for i in range(10):
w.append(int(raw_input())
for i in range(10):
k.append(int(raw_input())
print sum(sorted(w)[-3:]),sum(sorted(k)[-3:]) | File "/tmp/tmppv1233x9/tmppe3mt9s6.py", line 4
for i in range(10):
^
SyntaxError: invalid syntax
| |
s451467143 | p00457 | u901080241 | 1489092490 | Python | Python3 | py | Runtime Error | 0 | 0 | 902 | def product4(a):
return a[0]*a[1]*a[2]*a[3]
def puyo(a):
ans = len(a)
for i in range(len(a)-3):
if a[i] == a[i+1] == a[i+2] == a[i+3]:
hit = a[i]
ren = 3
while i+ren+1 < len(a):
if a[i+ren+1] != hit: break
ren += 1
ans = min(ans, puyo(a[:i]+a[i+ren+1:]))
return ans
while True:
n = int(input())
if n==0: break
cha = []
for i in range(n):
cha.append(int(input()))
ans = n
for i in range(len(cha)-3):
chain = cha.copy()
if product4(chain[i:i+4]) in [2,3,8,24,27,54]:
hit = chain[i]
if hit == chain[i+1]:
chain[i+2] = chain[i+3] = hit
elif hit == chain[i+2]:
chain[i+1] = hit
else:
chain[i] = chain[i+1]
ans = min(ans,puyo(chain))
print(ans) | Traceback (most recent call last):
File "/tmp/tmpz_zv20z4/tmpkgsrr2vy.py", line 17, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s713609444 | p00457 | u150984829 | 1526069644 | Python | Python3 | py | Runtime Error | 0 | 0 | 422 | import sys
r=sys.stdin.readline
w={*'123'}
for e in iter(r,'0'):
n=m=int(e);a=[r()for _ in[0]*n]
for i in range(n):
for j in w-{a[i]}:
b=a[:i]+[j]+a[i+1:]
f=1
while f:
s=t=f=0;c=b[0]
while t<len(b):
t=len(b)
for x in w-{c}:
if x in b[s+1:]:t=min(t,b.index(x,s+1))
if t-s>3:t-=1;f=1;b=b[:s]+b[t+1:];break
elif t==len(b):break
else:s,c=t,b[t]
m=min(m,len(b))
print(m)
| Traceback (most recent call last):
File "/tmp/tmphbvvkqsu/tmp2ni69ts8.py", line 5, in <module>
n=m=int(e);a=[r()for _ in[0]*n]
^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s773505790 | p00458 | u150984829 | 1526104646 | Python | Python3 | py | Runtime Error | 0 | 0 | 489 | import sys
r=sys.stdin.readline
def s():
def b(M,x,y,n=1):
M[x][y]=0;a=n
if M[x-1][y]:a=max(a,b(M,x-1,y,n+1))
if M[x][y-1]:a=max(a,b(M,x,y-1,n+1))
if M[x+1][y]:a=max(a,b(M,x+1,y,n+1))
if M[x][y+1]:a=max(a,b(M,x,y+1,n+1))
M[x][y]=1
return a
for e in iter(r,'0'):
n,m=int(e),int(r())
P=[[0]*(n+2)for _ in[0]*(m+2)]
for i in range(m):P[i+1][1:-1]=map(int,r().split())
print(max(b(P,i,j)for i in range(1,m+1)for j in range(1,n+1)if P[i][j]))
if'__main__'==__name__:s()
| Traceback (most recent call last):
File "/tmp/tmppd0gjto6/tmp5x7r9dsw.py", line 17, in <module>
if'__main__'==__name__:s()
^^^
File "/tmp/tmppd0gjto6/tmp5x7r9dsw.py", line 13, in s
n,m=int(e),int(r())
^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s233989444 | p00458 | u150984829 | 1526105454 | Python | Python3 | py | Runtime Error | 0 | 0 | 514 | def s():
def b(M,x,y,n=1):
M[x][y]=0;a=n
if M[x-1][y]:
t=b(M,x-1,y,n+1)
if a<t:a=t
if M[x][y-1]:
t=b(M,x,y-1,n+1)
if a<t:a=t
if M[x+1][y]:
t=b(M,x+1,y1,n+1)
if a<t:a=t
if M[x][y+1]:
t=b(M,x,y+1,n+1)
if a<t:a=t
M[x][y]=1
return a
for e in iter(input,'0'):
n,m=int(e),int(input())
P=[[0]*(n+2)for _ in[0]*(m+2)]
for i in range(m):P[i+1][1:-1]=map(int,input().split())
print(max(b(P,i,j)for i in range(1,m+1)for j in range(1,n+1)if P[i][j]))
if'__main__'==__name__:s()
| Traceback (most recent call last):
File "/tmp/tmprrb0jab4/tmpewkfq1s0.py", line 23, in <module>
if'__main__'==__name__:s()
^^^
File "/tmp/tmprrb0jab4/tmpewkfq1s0.py", line 18, in s
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s306539020 | p00458 | u150984829 | 1526105490 | Python | Python3 | py | Runtime Error | 0 | 0 | 515 | def s():
def b(M,x,y,n=1):
M[x][y]=0;a=n
if M[x-1][y]:
t=b(M,x-1,y,n+1)
if a<t:a=t
if M[x][y-1]:
t=b(M,x,y-1,n+1)
if a<t:a=t
if M[x+1][y]:
t=b(M,x+1,y+1,n+1)
if a<t:a=t
if M[x][y+1]:
t=b(M,x,y+1,n+1)
if a<t:a=t
M[x][y]=1
return a
for e in iter(input,'0'):
n,m=int(e),int(input())
P=[[0]*(n+2)for _ in[0]*(m+2)]
for i in range(m):P[i+1][1:-1]=map(int,input().split())
print(max(b(P,i,j)for i in range(1,m+1)for j in range(1,n+1)if P[i][j]))
if'__main__'==__name__:s()
| Traceback (most recent call last):
File "/tmp/tmpb5y61wne/tmp7fjpngks.py", line 23, in <module>
if'__main__'==__name__:s()
^^^
File "/tmp/tmpb5y61wne/tmp7fjpngks.py", line 18, in s
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s465314659 | p00459 | u150984829 | 1526106285 | Python | Python3 | py | Runtime Error | 0 | 0 | 209 | for e in iter(input,'0'):
n=int(e)
C=[*range(1,n+1)]
m=int(input())
p,q,r=map(int,input().split())
for _ in[0]*m:
x,y=map(int,input().split())
C=C[y:]+C[x:y]+C[:x]
print(sum(x<=r for x in C[p-1:q]))
| Traceback (most recent call last):
File "/tmp/tmpasqvsdeo/tmpz_ucho21.py", line 1, in <module>
for e in iter(input,'0'):
EOFError: EOF when reading a line
| |
s753377223 | p00459 | u150984829 | 1526114935 | Python | Python3 | py | Runtime Error | 0 | 0 | 1937 | def solve():
import sys
r = sys.stdin.readline
for e in iter(r, '0'):
n = int(e)
Cards = [(n, 1, n)]
m = int(r())
p, q, r = map(int, r().split())
for _ in [0] * m:
x, y = map(int, r().split())
total = 0
A, B, C = [], [], []
for k, s, t in Cards:
if y < total + k:
if total < y:
C += [(total + k - y, s + y - total, t)]
if total < x:
B += [(y - x, s + x - total, s + y - total - 1)]
A += [(x - total, s, s + x - total - 1)]
else:
B += [(y - total, s, s + y - total - 1)]
else:
C += [(k, s, t)]
elif x < total + k:
if total < x:
B += [(total + k - x, s + x - total, t)]
A += [(x - total, s, s + x - total - 1)]
else:
B += [(k, s, t)]
else:
A += [(k, s, t)]
total += k
Cards = C + B + A
total = 0
D = []
p = p - 1
for k, s, t in Cards:
if q < total + k:
if total < q:
if total < p:
D += [(s + x - total, s + q - total - 1)]
else:
D += [(s, s + q - total - 1)]
elif p < total + k:
if total < p:
D += [(s + p - total, t)]
else:
D += [(s, t)]
total += k
ans = 0
for s, t in D:
if t < r:
ans += t - s + 1
elif s <= r <= t:
ans += r - s + 1
print(ans)
if __name__ == '__main__':
solve()
| Traceback (most recent call last):
File "/tmp/tmpanm953y2/tmpzfu940f0.py", line 60, in <module>
solve()
File "/tmp/tmpanm953y2/tmpzfu940f0.py", line 5, in solve
n = int(e)
^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s926674423 | p00459 | u150984829 | 1526114949 | Python | Python3 | py | Runtime Error | 0 | 0 | 1939 | def solve():
import sys
r = sys.stdin.readline
for e in iter(r, '0\n'):
n = int(e)
Cards = [(n, 1, n)]
m = int(r())
p, q, r = map(int, r().split())
for _ in [0] * m:
x, y = map(int, r().split())
total = 0
A, B, C = [], [], []
for k, s, t in Cards:
if y < total + k:
if total < y:
C += [(total + k - y, s + y - total, t)]
if total < x:
B += [(y - x, s + x - total, s + y - total - 1)]
A += [(x - total, s, s + x - total - 1)]
else:
B += [(y - total, s, s + y - total - 1)]
else:
C += [(k, s, t)]
elif x < total + k:
if total < x:
B += [(total + k - x, s + x - total, t)]
A += [(x - total, s, s + x - total - 1)]
else:
B += [(k, s, t)]
else:
A += [(k, s, t)]
total += k
Cards = C + B + A
total = 0
D = []
p = p - 1
for k, s, t in Cards:
if q < total + k:
if total < q:
if total < p:
D += [(s + x - total, s + q - total - 1)]
else:
D += [(s, s + q - total - 1)]
elif p < total + k:
if total < p:
D += [(s + p - total, t)]
else:
D += [(s, t)]
total += k
ans = 0
for s, t in D:
if t < r:
ans += t - s + 1
elif s <= r <= t:
ans += r - s + 1
print(ans)
if __name__ == '__main__':
solve()
| Traceback (most recent call last):
File "/tmp/tmp0xzbk8xm/tmp9n7qptvw.py", line 60, in <module>
solve()
File "/tmp/tmp0xzbk8xm/tmp9n7qptvw.py", line 5, in solve
n = int(e)
^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s608787920 | p00459 | u104911888 | 1369447001 | Python | Python | py | Runtime Error | 0 | 0 | 271 | while True:
n=input()
if n==0:break
L=range(1,n+1)
m=input()
p,q,r=map(int,raw_input().split())
for i in range(m):
x,y=map(int,raw_input().split())
A,B,C=L[:x],L[x:y],L[y:]
L=C+B+A
print sum(1 for i in L[p-1:q] if i<=r) | File "/tmp/tmpl6k_u9_9/tmp3vofdo1i.py", line 11
print sum(1 for i in L[p-1:q] if i<=r)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s978873961 | p00460 | u901080241 | 1496201899 | Python | Python3 | py | Runtime Error | 0 | 0 | 419 | def listrep(n,m,s):
tab = [[[0]*(s+1) for j in range(n+1)]
tab[0][0] = 1
for i in range(1,n+1):
for k in range(s+1):
if i <= k:
tab[i][k] += tab[i][k-i] + tab[i-1][k-i]
if j-1 >= m:
tab[i][k] -= tab[i-1][j-1-m]
return tab[n][m][s]
while True:
n,m,s = map(int,input().split())
if n == 0 : break
n *= n
print(listrep(n,m,s)) | File "/tmp/tmprq9zmvzt/tmpjes6ssjj.py", line 2
tab = [[[0]*(s+1) for j in range(n+1)]
^
SyntaxError: '[' was never closed
| |
s663833793 | p00461 | u847467233 | 1530432529 | Python | Python3 | py | Runtime Error | 0 | 0 | 345 | # AOJ 0538: IOIOI
# Python3 2018.7.1 bal4u
while True:
n = int(input())
if n == 0: break
m = int(input())
s = input().strip()
ans, cnt, w, i = 0, 0, len(s), -1
while i < w:
i += 1
if i+1 < w and s[i:i+2] == 'IO':
cnt += 1
i += 1
elif cnt > 0:
if s[i] == 'O': cnt -= 1
if cnt >= n: ans += cnt-n+1
cnt = 0
print(ans)
| Traceback (most recent call last):
File "/tmp/tmptqnhbkf0/tmp1l4wx7a_.py", line 5, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s005493110 | p00461 | u633068244 | 1397389322 | Python | Python | py | Runtime Error | 0 | 0 | 185 | while 1:
n=input()
if n==0:break
m=input()
a=raw_input()
P="I"+"OI"*n
l=1+2*n
c=0
for i in range(m-l+1):
for k in range(l):
if a[i+k]!=P[k]
break
else:c+=1
print c
| File "/tmp/tmpbq9uhgw7/tmpaovjyec4.py", line 11
if a[i+k]!=P[k]
^
SyntaxError: expected ':'
| |
s703737493 | p00461 | u633068244 | 1397389436 | Python | Python | py | Runtime Error | 0 | 0 | 158 | while 1:
n=int(raw_input())
if n==0:break
m=int(raw_input())
a=raw_input()
P="I"+"OI"*n
l=1+2*n
c=0
for i in range(m-l+1):
if a[i:i+l]=P:
print c
| File "/tmp/tmp2tzhghy2/tmplklm1wyb.py", line 10
if a[i:i+l]=P:
^^^^^^^^
SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?
| |
s251707768 | p00462 | u745360181 | 1540199233 | Python | Python3 | py | Runtime Error | 0 | 0 | 619 | while True:
d = input()
if d == 0:
break
n = input()
m = input()
dis = []
for i in range(n-1):
s = input()
dis.append(s)
dis.append(0)
k = []
for i in range(m):
s = input()
k.append(s)
ans = 0
for i in k:
mini = 1000000000
for j in dis:
a = i
b = j
if a < b:
a,b = b,a
dist = a - b
if dist > round(d/2):
dist = d - a + b
if dist < mini:
mini = dist
ans = ans + mini
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpf0fwrr0l/tmpvw3lda_o.py", line 2, in <module>
d = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s053843660 | p00462 | u745360181 | 1540200682 | Python | Python3 | py | Runtime Error | 0 | 0 | 620 | while True:
d = input()
if d == 0:
break
n = input()
m = input()
dis = []
for i in range(n-1):
s = input()
dis.append(s)
dis.append(0)
k = []
for i in range(m):
s = input()
k.append(s)
ans = 0
for i in k:
mini = 10000000000
for j in dis:
a = i
b = j
if a < b:
a,b = b,a
dist = a - b
if dist > round(d/2):
dist = d - a + b
if dist < mini:
mini = dist
ans = ans + mini
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpxirr72hn/tmpai1urllj.py", line 2, in <module>
d = input()
^^^^^^^
EOFError: EOF when reading a line
| |
s303621132 | p00462 | u797673668 | 1456749638 | Python | Python3 | py | Runtime Error | 0 | 0 | 471 | from bisect import bisect_left
while True:
d = int(input())
if not d:
break
n = int(input())
m = int(input())
stores = {0, d}
for i in range(2, n + 1):
stores.add(int(input()))
sorted_stores = sorted(stores)
total_dist = 0
while m:
k = int(input())
i = bisect_left(sorted_stores, k)
l, r = sorted_stores[i - 1:i + 1]
total_dist += min(k - l, r - k)
m -= 1
print(total_dist) | Traceback (most recent call last):
File "/tmp/tmpjwa4ok28/tmpbh4r2762.py", line 4, in <module>
d = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s649455597 | p00462 | u970269944 | 1486624321 | Python | Python | py | Runtime Error | 0 | 0 | 348 | f = open("input.txt", "r")
input = map(lambda x : int(x), f.read().strip().split("\n"))
f.close()
d, n, m = input[0], input[1], input[2]
S, K = set(sorted([0]+input[3:3+n-1])), input[3+n-1:]
sum = 0
for k in K:
i = 1
while (True):
if (k+i)%8 in S or (k-i)%8 in S: break
i += 1
sum += i
f = open("output.txt", "w")
f.write(str(sum))
f.close() | Traceback (most recent call last):
File "/tmp/tmpi2afc5tw/tmpywt8tues.py", line 1, in <module>
f = open("input.txt", "r")
^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'input.txt'
| |
s761783185 | p00462 | u970269944 | 1486676388 | Python | Python | py | Runtime Error | 0 | 0 | 798 | def find(l, e, start, end):
mid = (start+end)//2
if (l[mid] == e):
return (e, e)
elif (l[mid] > e):
if (l[mid-1] < e):
return (l[mid-1], l[mid])
return find(l, e, start, mid)
elif (l[mid] < e):
if (l[mid+1] > e):
return (l[mid], l[mid+1])
return find(l, e, mid, end)
def calc_sum(input):
d, n, m = input[0], input[1], input[2]
S, K = input[3:3+n-1], input[3+n-1:]
S = sorted(S)
S = [S[-1]-d, 0] + S + [d]
sum = 0
for k in K:
low, high = find(S, k, 0, len(S))
sum += min(k-low, high-k)
return sum
output = []
while (True):
d = int(raw_input())
if d == 0: break
n, m = int(raw_input()), int(raw_input())
input = [d, n, m]
for i in range(n-1+m):
next_int = int(raw_input())
input.append(next_int)
output.append[str(calc_sum(input))]
print "\n".join(output) | File "/tmp/tmpinhurvb4/tmpfjt4qp42.py", line 35
print "\n".join(output)
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s934322381 | p00462 | u811733736 | 1505664110 | Python | Python3 | py | Runtime Error | 0 | 0 | 964 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0539
"""
import sys
from sys import stdin
from bisect import bisect_right
input = stdin.readline
def main(args):
while True:
d = int(input())
if d == 0:
break
n = int(input())
m = int(input())
cw_pos = [int(input()) for _ in range(n-1)]
dests = [int(input()) for _ in range(m)]
cw_pos.append(0)
cw_pos.append(d)
cw_pos.sort()
ccw_pos = [d-x for x in cw_pos]
ccw_pos.sort()
total_distance = 0
for t in dests:
i = bisect_right(cw_pos, t)
a1 = min(t-cw_pos[i-1], cw_pos[i]-t)
j = bisect_right(ccw_pos, d-t)
a2 = min(d-t-ccw_pos[j-1], ccw_pos[j]-(d-t))
ans = min(a1, a2)
total_distance += ans
print(total_distance)
if __name__ == '__main__':
main(sys.argv[1:])
| Traceback (most recent call last):
File "/tmp/tmptoa0nbi1/tmpcopia504.py", line 47, in <module>
main(sys.argv[1:])
File "/tmp/tmptoa0nbi1/tmpcopia504.py", line 16, in main
d = int(input())
^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s421943376 | p00467 | u093607836 | 1403875549 | Python | Python3 | py | Runtime Error | 0 | 0 | 248 | n = -1
while n != 0:
n,m = map(int,input().split())
nn = [int(input()) for i in range(n)]
mm = [int(input()) for i in range(m)]
p = 0
c = 0
while p <= n - 1:
p += nn[p]
p += mm[c]
c += 1
print(c) | Traceback (most recent call last):
File "/tmp/tmp9rht4gw2/tmp7nqrqqom.py", line 4, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s857940601 | p00467 | u160041984 | 1467290892 | Python | Python3 | py | Runtime Error | 0 | 0 | 395 | import sys
def line():return sys.stdin.readline().strip()
def cin():return sys.stdin.readline().strip().split()
while True:
N,M = [int(i) for i in cin()]
if N == 0:break
X = [int(line()) for _ in range(N)]
c = 1
for i in range(M):
c+=int(line())
if c < N and X[c - 1] != 0:
c+=X[c - 1]
if c >= N:
print(i + 1)
break | Traceback (most recent call last):
File "/tmp/tmparqnywix/tmp4qh9kns1.py", line 5, in <module>
N,M = [int(i) for i in cin()]
^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s921047620 | p00467 | u889593139 | 1521680041 | Python | Python3 | py | Runtime Error | 0 | 0 | 509 | def sugoroku(list_cube, list_X, N):
now_position = 0
num = 0
for cube in list_cube:
num += 1
now_position += cube
if now_position <= N:
now_position += list_X[now_position]
else:
break
print(num)
while True:
N, M = map(int, input().split(' '))
if N == M == 0:
break
list_X = [int(input()) for i in range(N)]
list_cube = [int(input()) for i in range(M)]
sugoroku(list_cube=list_cube, list_X=list_X, N=N)
| Traceback (most recent call last):
File "/tmp/tmpbj_101m7/tmpxadysk5e.py", line 16, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s347917258 | p00467 | u889593139 | 1521680157 | Python | Python3 | py | Runtime Error | 0 | 0 | 509 | def sugoroku(list_cube, list_X, N):
now_position = 0
num = 0
for cube in list_cube:
num += 1
now_position += cube
if now_position <= N:
now_position += list_X[now_position]
else:
break
print(num)
while True:
N, M = map(int, input().split(' '))
if N == M == 0:
break
list_X = [int(input()) for i in range(N)]
list_cube = [int(input()) for i in range(M)]
sugoroku(list_cube=list_cube, list_X=list_X, N=N)
| Traceback (most recent call last):
File "/tmp/tmpxz_ba_2b/tmpptvcvd8g.py", line 16, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s974903350 | p00467 | u889593139 | 1521680666 | Python | Python3 | py | Runtime Error | 0 | 0 | 554 | nums = []
def sugoroku(list_cube, list_X, N):
now_position = 0
num = 0
for cube in list_cube:
num += 1
now_position += cube
if now_position <= N:
now_position += list_X[now_position]
else:
break
nums.append(num)
while True:
N, M = map(int, input().split(' '))
if N == M == 0:
break
list_X = [int(input()) for i in range(N)]
list_cube = [int(input()) for i in range(M)]
sugoroku(list_cube=list_cube, list_X=list_X, N=N)
for i in nums:
print(i)
| Traceback (most recent call last):
File "/tmp/tmpgl3zjoei/tmpvpp11t6s.py", line 18, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s786968663 | p00467 | u889593139 | 1521681272 | Python | Python3 | py | Runtime Error | 0 | 0 | 463 | nums = []
def sugoroku(list_cube, list_X, N):
now_position = 0
num = 0
while now_position < N:
now_position += list_cube[num]
now_position += list_X[now_position]
num += 1
print(num)
while True:
N, M = map(int, input().split(' '))
if N == M == 0:
break
list_X = [int(input()) for i in range(N)]
list_cube = [int(input()) for i in range(M)]
sugoroku(list_cube=list_cube, list_X=list_X, N=N)
| Traceback (most recent call last):
File "/tmp/tmpwky9e9ou/tmpyp83w4jj.py", line 15, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s475174924 | p00467 | u889593139 | 1521681372 | Python | Python3 | py | Runtime Error | 0 | 0 | 498 | nums = []
def sugoroku(list_cube, list_X, N):
now_position = 0
num = 0
while now_position < N:
now_position += list_cube[num]
now_position += list_X[now_position]
num += 1
nums.append(num)
while True:
N, M = map(int, input().split(' '))
if N == M == 0:
break
list_X = [int(input()) for i in range(N)]
list_cube = [int(input()) for i in range(M)]
sugoroku(list_cube=list_cube, list_X=list_X, N=N)
for i in nums:
print(i)
| Traceback (most recent call last):
File "/tmp/tmpr3jx_gor/tmp07sgco0i.py", line 15, in <module>
N, M = map(int, input().split(' '))
^^^^^^^
EOFError: EOF when reading a line
| |
s691385476 | p00467 | u889593139 | 1521683883 | Python | Python3 | py | Runtime Error | 0 | 0 | 406 | while True:
N, M = map(int, input().split())
if n == 0:
break
mapp = [int(input()) for _ in range(N)]
mas = 0
ans = 0
for dice in range(M):
mas += int(input())
if mas >= n - 1 and ans == 0:
ans = dice + 1
if mas < n - 1:
lmas += mapp[ans]
if mas >= n - 1 and ans == 0: ans = dice + 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpzutg7xs3/tmpspadp2re.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s557185184 | p00467 | u889593139 | 1521683898 | Python | Python3 | py | Runtime Error | 0 | 0 | 390 | while True:
N, M = map(int, input().split())
if N == 0:
break
mapp = [int(input()) for _ in range(N)]
mas = 0
ans = 0
for dice in range(M):
mas += int(input())
if mas >= n - 1 and ans == 0:
ans = dice + 1
if mas < n - 1:
lmas += mapp[ans]
if mas >= n - 1 and ans == 0: ans = dice + 1
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpcaur6kxk/tmpwes58utl.py", line 2, in <module>
N, M = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.