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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s213547597 | p00193 | u647766105 | 1394984468 | Python | Python | py | Runtime Error | 0 | 0 | 1232 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpjcyk8fn4/tmp41svo5si.py", line 39
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s663745440 | p00193 | u647766105 | 1394984759 | Python | Python | py | Runtime Error | 0 | 0 | 1161 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dy, dx in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min(sc[y][x] for sc in scover):
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmp5tz45op1/tmpl9a0ss0p.py", line 38
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s465131873 | p00193 | u647766105 | 1394984839 | Python | Python | py | Runtime Error | 0 | 0 | 1256 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0 and len(q) <= (10 ** 5):
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpw73mhggn/tmpbd0p77fs.py", line 39
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s938521084 | p00193 | u647766105 | 1394984896 | Python | Python | py | Runtime Error | 0 | 0 | 1256 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0 and len(q) <= (10 ** 3):
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpqwva9qrw/tmpqo3lbfhg.py", line 39
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s430958620 | p00193 | u647766105 | 1394984921 | Python | Python | py | Runtime Error | 0 | 0 | 1249 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
return cover
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpeblg6foq/tmpkekxd93l.py", line 40
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s111522687 | p00193 | u647766105 | 1394984999 | Python | Python | py | Runtime Error | 0 | 0 | 1268 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
return cover
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
return ret
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpwh7xx62i/tmpnygw2l2w.py", line 41
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s633746211 | p00193 | u647766105 | 1394985141 | Python | Python | py | Runtime Error | 0 | 0 | 1259 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
return cover
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def count(cover, min_cover):
ret = 0
return ret
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
return max(count(func(pos[1] - 1, pos[0] - 1), min_cover) for pos in tpos)
while True:
data = raw_input()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmp70lfvmhq/tmp0hkmdzsu.py", line 42
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s340393940 | p00193 | u647766105 | 1394985502 | Python | Python | py | Runtime Error | 0 | 0 | 1240 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input().strip()
if data == "0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmp8o2iydz9/tmpfql47qwa.py", line 39
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s897709501 | p00193 | u647766105 | 1394985919 | Python | Python | py | Runtime Error | 0 | 0 | 1278 | #Deven-Eleven:
import re
p = re.compile("\d+\s\d+")
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input()
if p.match(data) is None:
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpbezt357h/tmprn6y6n0t.py", line 41
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s070521774 | p00193 | u647766105 | 1394985973 | Python | Python | py | Runtime Error | 0 | 0 | 1251 | #Deven-Eleven:
import re
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input().sprit()
if data == "0 0":
break
m, n = map(int, data.split())
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpf6rqt0ei/tmp_664g9ru.py", line 40
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s500031220 | p00193 | u647766105 | 1394986019 | Python | Python | py | Runtime Error | 0 | 0 | 1238 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input().sprit()
m, n = map(int, data.split())
if m | n == 0:
break
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmpgkyao3tx/tmppp3kchj_.py", line 39
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s120287770 | p00193 | u647766105 | 1394986064 | Python | Python | py | Runtime Error | 0 | 0 | 1234 | #Deven-Eleven:
D = (((-1, -1), (0, -1), (1, 0), (0, 1), (-1, 1), (-1, 0)),
((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 0)))
def func(y, x):
q = [(y, x, 0)]
cover = [[-1] * m for _ in xrange(n)]
while len(q) != 0:
y, x, step = q.pop(0)
if cover[y][x] >= 0:
continue
cover[y][x] = step
for dx, dy in D[y % 2]:
ny, nx = y + dy, x + dx
if 0 <= ny < n and 0 <= nx < m:
q.append((ny, nx, step + 1))
return cover
def solve():
scover = [func(pos[1] - 1, pos[0] - 1) for pos in spos]
min_cover = [[min(sc[y][x] for sc in scover) for x in xrange(m)] for y in xrange(n)]
def count(cover):
ret = 0
for y in xrange(n):
for x in xrange(m):
if cover[y][x] < min_cover[y][x]:
ret += 1
return ret
return max(count(func(pos[1] - 1, pos[0] - 1)) for pos in tpos)
while True:
data = raw_input().sprit()
m, n = map(int, data.split())
if m == 0:
break
s = input()
spos = [map(int, raw_input().split()) for _ in xrange(s)]
t = input()
tpos = [map(int, raw_input().split()) for _ in xrange(t)]
print solve() | File "/tmp/tmp67k1ybk9/tmpseys6i8a.py", line 39
print solve()
^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s448673627 | p00195 | u140201022 | 1464795827 | Python | Python | py | Runtime Error | 0 | 0 | 184 | l=[]
while 1:
n,k=map(int,raw_input().split())
cnt+=1
if n==k==0:
break
l.append(n+k)
if cnt%5==0:
print chr(l.index(max(l))+65),max(l)
l=[] | File "/tmp/tmpq0gme387/tmp3klfghsq.py", line 9
print chr(l.index(max(l))+65),max(l)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s718142771 | p00196 | u567380442 | 1427370442 | Python | Python3 | py | Runtime Error | 0 | 0 | 333 | import sys
f = sys.stdin
while True:
n = int(f.readline())
if n == 0:
break
teams = [f.readline().split() for i in range(n)]
teams = [(t[0], -t.count('0'), t.count('1'), i) for i, t in enumerate(teams)]
teams.sort(key=operator.itemgetter(1,2,3))
print('\n'.join([t[0] for t in teams])) | Traceback (most recent call last):
File "/tmp/tmpebm2vgvn/tmp8i_q5xb6.py", line 5, in <module>
n = int(f.readline())
^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s172392892 | p00199 | u871745100 | 1368972046 | Python | Python | py | Runtime Error | 0 | 0 | 1515 | def downA(chair):
for i in range(1,n+1):
if chair[i]=="#":
chair[i]="A"
return
def downB(chair):
for i in range(n,0,-1):
if chair[i]=="#" and chair[i-1]!="A" and chair[i+1]!="A":
chair[i]="B"
return
else:
chair[chair.index("#")]="B"
def downC(chair):
if set(chair[1:-1])==set(['#']):
if n%2==0:
chair[n/2+2]="C"
else:
chair[(n+1)/2+1]="C"
return
for i in range(1,n+1):
if chair[i]!="#":
if chair[i+1]=="#":
chair[i+1]="C"
return
elif i-1>=1 and chair[i-1]=="#":
chair[i-1]="C"
return
def downD(chair):
if set(chair[1:-1])==set(["#"]):
chair[1]="D"
return
t=[0]*n
cnt=0
for i in range(1,n+1):
if chair[i]!="#":
cnt=0
else:
cnt+=1
t[i]=cnt
cnt=0
for i in range(n,0,-1):
if chair[i]!="#":
cnt=0
else:
cnt+=1
t[i]=min(cnt,t[i])
maxInt=max(t)
chair[t.index(maxInt)]="D"
while True:
n,m=map(int,raw_input().split())
if n==m==0:break
chair=["X"]+["#"]*n+["X"]
for i in range(m):
p=raw_input()
if p=="A":
downA(chair)
elif p=="B":
downB(chair)
elif p=="C":
downC(chair)
elif p=="D":
downD(chair)
print "".join(chair[1:-1]) | File "/tmp/tmpqtz39c05/tmp4014k7z3.py", line 68
print "".join(chair[1:-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s283817305 | p00200 | u580607517 | 1422714335 | Python | Python | py | Runtime Error | 0 | 0 | 939 |
inf = 0x10101010
def solve(A, strt):
cost = [inf]*m
visited = [False]*m
cost[strt] = 0
while 1:
min = inf
next = -1
visited[strt] = True
for i in range(m):
if visited[i]:
continue
if A[strt][i]:
d = cost[strt] + A[strt][i]
if d < cost[i]:
cost[i] = d
if cost[i] < min:
min = cost[i]
next = i
strt = next
if next == -1: break
return cost
while 1:
# 経路の情報の数n,駅の数m
n, m = map(int, raw_input().split())
if n == 0:
break
T = [[0]*m for i in range(m)]
C = [[0]*m for i in range(m)]
for i in range(n):
a, b, c, t = map(int, raw_input().split()) # 駅 駅 time cost
T[a-1][b-1] = T[b-1][a-1] = t
C[a-1][b-1] = C[b-1][a-1] = c
TS = [solve(T, i) for i in range(m)]
CS = [solve(C, i) for i in range(m)]
for i in range(input()):
a, b, q = map(int, raw_input().split())
if q == 0:
print CS[a-1][b-1]
else:
print TS[a-1][b-1] | File "/tmp/tmprpimt0pa/tmpntw5361s.py", line 47
print CS[a-1][b-1]
^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s531352564 | p00200 | u879226672 | 1424264144 | Python | Python | py | Runtime Error | 0 | 0 | 2041 | # -*- coding: utf-8 -*-
def MakeRouteList(ite,start,end):
'''make all routes list from start to end station'''
ite.sort()
output = []
# 1個め
for k in range(len(ite)):
# from start
route = []
if ite[k][0]==start:
route = [ite[k]]
output.append(route)
# 2個め以降
for j in range(len(output)):
for k in range(len(ite)):
if output[j][-1][1] == ite[k][0]:
output[j].append(ite[k])
'''output = [[(1, 2, 200, 10), (2, 4, 100, 10), (4, 5, 150, 20)],
[(1, 3, 250, 25), (3, 5, 300, 20)],[(1, 4, 400, 15), (4, 5, 150, 20)]]'''
for k in range(len(output)):
output[k].append(0)
output[k].append(0)
for j in range(len(output[k])-2):
output[k][-2] += output[k][j][2] # cost
output[k][-1] += output[k][j][3] # time
"""output = [[[1, 2, 200, 10], [2, 4, 100, 10], [4, 5, 150, 20], 450, 40],
[[1, 3, 250, 25], [3, 5, 300, 20], 550, 45],
[[1, 4, 400, 15], [4, 5, 150, 20], 550, 35]]
"""
return output
def MinMoney(output):
cost_temp = []
for k in range(len(output)):
cost_temp.append(output[k][-2])
return min(cost_temp)
def MinTime(output):
time_temp = []
for k in range(len(output)):
time_temp.append(output[k][-1])
return min(time_temp)
while True:
# n = senro_num; m = station_num
n,m = map(int,raw_input().split())
senro_list = []
for j in range(n):
senro = map(int,raw_input().split())
senro_list.append(senro)
# toiawase_num
k = int(raw_input())
toiawase_list=[]
for jj in range(k):
toiawase = map(int,raw_input().split())
toiawase_list.append(toiawase)
for p,q,r in toiawase_list:
route = MakeRouteList(senro_list,p,q)
if r == 0:
print MinMoney(route)
elif r == 1:
print MinTime(route)
zero = map(int,raw_input().split())
if zero == [0,0]:
break | File "/tmp/tmpbfdmzsdd/tmpxsti4wnp.py", line 65
print MinMoney(route)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s445098430 | p00200 | u879226672 | 1424264217 | Python | Python | py | Runtime Error | 0 | 0 | 2084 | # -*- coding: utf-8 -*-
def MakeRouteList(ite,start,end):
'''make all routes list from start to end station'''
ite.sort()
output = []
# 1個め
for k in range(len(ite)):
# from start
route = []
if ite[k][0]==start:
route = [ite[k]]
output.append(route)
# 2個め以降
for j in range(len(output)):
for k in range(len(ite)):
if output[j][-1][1] == ite[k][0]:
output[j].append(ite[k])
'''output = [[(1, 2, 200, 10), (2, 4, 100, 10), (4, 5, 150, 20)],
[(1, 3, 250, 25), (3, 5, 300, 20)],[(1, 4, 400, 15), (4, 5, 150, 20)]]'''
for k in range(len(output)):
output[k].append(0)
output[k].append(0)
for j in range(len(output[k])-2):
output[k][-2] += output[k][j][2] # cost
output[k][-1] += output[k][j][3] # time
"""output = [[[1, 2, 200, 10], [2, 4, 100, 10], [4, 5, 150, 20], 450, 40],
[[1, 3, 250, 25], [3, 5, 300, 20], 550, 45],
[[1, 4, 400, 15], [4, 5, 150, 20], 550, 35]]
"""
return output
def MinMoney(output):
cost_temp = []
for k in range(len(output)):
cost_temp.append(output[k][-2])
return min(cost_temp)
def MinTime(output):
time_temp = []
for k in range(len(output)):
time_temp.append(output[k][-1])
return min(time_temp)
while True:
# n = senro_num; m = station_num
try:
n,m = map(int,raw_input().split())
except EOFError:
break
senro_list = []
for j in range(n):
senro = map(int,raw_input().split())
senro_list.append(senro)
# toiawase_num
k = int(raw_input())
toiawase_list=[]
for jj in range(k):
toiawase = map(int,raw_input().split())
toiawase_list.append(toiawase)
for p,q,r in toiawase_list:
route = MakeRouteList(senro_list,p,q)
if r == 0:
print MinMoney(route)
elif r == 1:
print MinTime(route)
zero = map(int,raw_input().split())
if zero == [0,0]:
break | File "/tmp/tmp6ytr75j3/tmp7obftk7d.py", line 67
print MinMoney(route)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s224882666 | p00200 | u879226672 | 1424264314 | Python | Python | py | Runtime Error | 0 | 0 | 1734 | # -*- coding: utf-8 -*-
def MakeRouteList(ite,start,end):
'''make all routes list from start to end station'''
ite.sort()
output = []
#
for k in range(len(ite)):
# from start
route = []
if ite[k][0]==start:
route = [ite[k]]
output.append(route)
#
for j in range(len(output)):
for k in range(len(ite)):
if output[j][-1][1] == ite[k][0]:
output[j].append(ite[k])
for k in range(len(output)):
output[k].append(0)
output[k].append(0)
for j in range(len(output[k])-2):
output[k][-2] += output[k][j][2] # cost
output[k][-1] += output[k][j][3] # time
return output
def MinMoney(output):
cost_temp = []
for k in range(len(output)):
cost_temp.append(output[k][-2])
return min(cost_temp)
def MinTime(output):
time_temp = []
for k in range(len(output)):
time_temp.append(output[k][-1])
return min(time_temp)
while True:
# n = senro_num; m = station_num
try:
n,m = map(int,raw_input().split())
except EOFError:
break
senro_list = []
for j in range(n):
senro = map(int,raw_input().split())
senro_list.append(senro)
# toiawase_num
k = int(raw_input())
toiawase_list=[]
for jj in range(k):
toiawase = map(int,raw_input().split())
toiawase_list.append(toiawase)
for p,q,r in toiawase_list:
route = MakeRouteList(senro_list,p,q)
if r == 0:
print MinMoney(route)
elif r == 1:
print MinTime(route)
zero = map(int,raw_input().split())
if zero == [0,0]:
break | File "/tmp/tmpgooebutz/tmp4gpor3vu.py", line 61
print MinMoney(route)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s102863486 | p00200 | u879226672 | 1424264369 | Python | Python | py | Runtime Error | 0 | 0 | 2096 | # -*- coding: utf-8 -*-
def MakeRouteList(ite,start,end):
'''make all routes list from start to end station'''
ite.sort()
output = []
# 1個め
for k in range(len(ite)):
# from start
route = []
if ite[k][0]==start:
route = [ite[k]]
output.append(route)
# 2個め以降
for j in range(len(output)):
for k in range(len(ite)):
if output[j][-1][1] == ite[k][0]:
output[j].append(ite[k])
'''output = [[(1, 2, 200, 10), (2, 4, 100, 10), (4, 5, 150, 20)],
[(1, 3, 250, 25), (3, 5, 300, 20)],[(1, 4, 400, 15), (4, 5, 150, 20)]]'''
for k in range(len(output)):
output[k].append(0)
output[k].append(0)
for j in range(len(output[k])-2):
output[k][-2] += output[k][j][2] # cost
output[k][-1] += output[k][j][3] # time
"""output = [[[1, 2, 200, 10], [2, 4, 100, 10], [4, 5, 150, 20], 450, 40],
[[1, 3, 250, 25], [3, 5, 300, 20], 550, 45],
[[1, 4, 400, 15], [4, 5, 150, 20], 550, 35]]
"""
return output
def MinMoney(output):
cost_temp = []
for k in range(len(output)):
cost_temp.append(output[k][-2])
return min(cost_temp)
def MinTime(output):
time_temp = []
for k in range(len(output)):
time_temp.append(output[k][-1])
return min(time_temp)
while True:
# n = senro_num; m = station_num
try:
n,m = map(int,raw_input().split())
except EOFError:
break
senro_list = []
for j in range(n):
senro = map(int,raw_input().split())
senro_list.append(senro)
# toiawase_num
k = int(raw_input())
toiawase_list=[]
for jj in range(k):
toiawase = map(int,raw_input().split())
toiawase_list.append(toiawase)
for p,q,r in toiawase_list:
route = MakeRouteList(senro_list,p,q)
if r == 0:
print MinMoney(route)
elif r == 1:
print MinTime(route)
zero = map(int,raw_input().split())
if zero == [0,0]:
break | File "/tmp/tmpd3jpz18v/tmpwfl5eevd.py", line 67
print MinMoney(route)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s684599226 | p00200 | u879226672 | 1424264630 | Python | Python | py | Runtime Error | 0 | 0 | 2097 | # -*- coding: utf-8 -*-
def MakeRouteList(ite,start,end):
'''make all routes list from start to end station'''
ite.sort()
output = []
# 1個め
for k in range(len(ite)):
# from start
route = []
if ite[k][0]==start:
route = [ite[k]]
output.append(route)
# 2個め以降
for j in range(len(output)):
for k in range(len(ite)):
if output[j][-1][1] == ite[k][0]:
output[j].append(ite[k])
'''output = [[(1, 2, 200, 10), (2, 4, 100, 10), (4, 5, 150, 20)],
[(1, 3, 250, 25), (3, 5, 300, 20)],[(1, 4, 400, 15), (4, 5, 150, 20)]]'''
for k in range(len(output)):
output[k].append(0)
output[k].append(0)
for j in range(len(output[k])-2):
output[k][-2] += output[k][j][2] # cost
output[k][-1] += output[k][j][3] # timee
"""output = [[[1, 2, 200, 10], [2, 4, 100, 10], [4, 5, 150, 20], 450, 40],
[[1, 3, 250, 25], [3, 5, 300, 20], 550, 45],
[[1, 4, 400, 15], [4, 5, 150, 20], 550, 35]]
"""
return output
def MinMoney(output):
cost_temp = []
for k in range(len(output)):
cost_temp.append(output[k][-2])
return min(cost_temp)
def MinTime(output):
time_temp = []
for k in range(len(output)):
time_temp.append(output[k][-1])
return min(time_temp)
while True:
# n = senro_num; m = station_num
try:
n,m = map(int,raw_input().split())
except EOFError:
break
senro_list = []
for j in range(n):
senro = map(int,raw_input().split())
senro_list.append(senro)
# toiawase_num
k = int(raw_input())
toiawase_list=[]
for jj in range(k):
toiawase = map(int,raw_input().split())
toiawase_list.append(toiawase)
for p,q,r in toiawase_list:
route = MakeRouteList(senro_list,p,q)
if r == 0:
print MinMoney(route)
elif r == 1:
print MinTime(route)
zero = map(int,raw_input().split())
if zero == [0,0]:
break | File "/tmp/tmp56ozgaw9/tmpyjunolvw.py", line 67
print MinMoney(route)
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s681212582 | p00200 | u685815919 | 1473837709 | Python | Python | py | Runtime Error | 0 | 0 | 1074 | import sys
def dijkstra(m, start, goal, matrix):
defnode = [False] * (m+1)
cost = [sys.maxint] * (m+1)
cost[start] = 0
node = start
while True:
defnode[node] = True
minnode = sys.maxint
mincost = sys.maxint
for i in xrange(1, m+1):
if defnode[i]:
continue
if matrix[node][i] == sys.maxint:
continue
cost[i] = min(cost[i], cost[node]+matrix[node][i])
if cost[i] < mincost:
minnode = i
mincost = cost[i]
if minnode == goal:
print cost[goal]
return
node = minnode
while True:
n, m = map(int, raw_input().split())
if n == 0 and m == 0:
break
cost = [[sys.maxint] * (m+1) for j in xrange(m+1)]
time = [[sys.maxint] * (m+1) for j in xrange(m+1)]
for i in xrange(n):
a, b, c, t = map(int, raw_input().split())
cost[a][b] = c
cost[b][a] = c
time[a][b] = t
time[b][a] = t
k = int(raw_input())
for i in xrange(k):
p, q, r = map(int, raw_input().split())
if r == 0:
dijkstra(m, p, q, cost)
else:
dijkstra(m, p, q, time) | File "/tmp/tmp3igizpz8/tmpnej6xfj8.py", line 22
print cost[goal]
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s852521135 | p00200 | u589276934 | 1500362222 | Python | Python3 | py | Runtime Error | 0 | 0 | 1810 | # coding: utf-8
import queue
class Route:
def __init__(self, station_number, price, time):
self.station_number = station_number
self.price = price
self.time = time
class Station:
def __init__(self):
self.routes = []
def addRoute(self,route):
self.routes.append(route)
class Path:
def __init__(self, now_station, next_station, price, time):
self.now_station = now_station
self.next_station = next_station
self.price = price
self.time = time
def search_path(stations, come_from, go_to, search_type):
result = []
q = queue.Queue()
for distination in stations[come_from].routes:
new_path = Path(come_from, distination.station_number, distination.price, distination.time)
q.put(new_path)
while not q.empty():
path = q.get()
if path.next_station == go_to:
r = path.price if search_type == 0 else path.time
result.append(r)
for distination in stations[path.next_station].routes:
update_price = path.price + distination.price
update_time = path.time + distination.time
next_path = Path(path.next_station, distination.station_number, update_price, update_time)
q.put(next_path)
print(sorted(result)[0])
route_count, station_count = map(int, input().split(" "))
stations = [Station() for i in range(station_count)]
for read_line in range(route_count):
come_from, go_to, price, time = map(int, input().split(" "))
route = Route(go_to - 1, price, time)
stations[come_from - 1].addRoute(route)
search_count = int(input())
for read_line in range(search_count):
come_from, go_to, search_type = map(int, input().split())
search_path(stations, come_from - 1, go_to - 1, search_type) | Traceback (most recent call last):
File "/tmp/tmpvhhwmbcq/tmpcohvgkp_.py", line 41, in <module>
route_count, station_count = map(int, input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s260545712 | p00200 | u589276934 | 1500362622 | Python | Python3 | py | Runtime Error | 0 | 0 | 1789 | # coding: utf-8
class Route:
def __init__(self, station_number, price, time):
self.station_number = station_number
self.price = price
self.time = time
class Station:
def __init__(self):
self.routes = []
def addRoute(self,route):
self.routes.append(route)
class Path:
def __init__(self, now_station, next_station, price, time):
self.now_station = now_station
self.next_station = next_station
self.price = price
self.time = time
def search_path(stations, come_from, go_to, search_type):
result = []
q = []
for distination in stations[come_from].routes:
new_path = Path(come_from, distination.station_number, distination.price, distination.time)
q.append(new_path)
while len(q) > 0:
path = q.pop(0)
if path.next_station == go_to:
r = path.price if search_type == 0 else path.time
result.append(r)
for distination in stations[path.next_station].routes:
update_price = path.price + distination.price
update_time = path.time + distination.time
next_path = Path(path.next_station, distination.station_number, update_price, update_time)
q.append(next_path)
print(sorted(result)[0])
route_count, station_count = map(int, input().split(" "))
stations = [Station() for i in range(station_count)]
for read_line in range(route_count):
come_from, go_to, price, time = map(int, input().split(" "))
route = Route(go_to - 1, price, time)
stations[come_from - 1].addRoute(route)
search_count = int(input())
for read_line in range(search_count):
come_from, go_to, search_type = map(int, input().split())
search_path(stations, come_from - 1, go_to - 1, search_type) | Traceback (most recent call last):
File "/tmp/tmpcsilgbvu/tmpw6xiqsmk.py", line 39, in <module>
route_count, station_count = map(int, input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s960986632 | p00200 | u589276934 | 1500365117 | Python | Python3 | py | Runtime Error | 0 | 0 | 1699 | # coding: utf-8
class Route:
def __init__(self, next_station, need_price, need_time):
self.next_station = next_station
self.need_price = need_price
self.need_time = need_time
class Station:
def __init__(self):
self.routes = []
def addRoute(self,route):
self.routes.append(route)
class Status:
def __init__(self, now_station, use_price, use_time):
self.now_station = now_station
self.use_price = use_price
self.use_time = use_time
def search(stations, start, end, search_type):
result = []
queue = []
for route in stations[start].routes:
queue.append(Status(route.next_station, route.need_price, route.need_time))
while len(queue) > 0:
status = queue.pop(0)
if status.now_station == end:
r = status.use_price if search_type == 0 else status.use_time
result.append(r)
for route in stations[status.now_station].routes:
update_price = route.need_price + status.use_price
update_time = route.need_time + status.use_time
queue.append(Status(route.next_station, update_price, update_time))
print(sorted(result)[0])
route_count, station_count = map(int, input().split(" "))
stations = [Station() for station in range(station_count)]
for count in range(route_count):
now_station, next_station, need_price, need_time = map(int, input().split(" "))
stations[now_station - 1].addRoute(Route(next_station - 1, need_price, need_time))
search_count = int(input())
for count in range(search_count):
start, end, search_type = map(int, input().split(" "))
search(stations, start - 1, end - 1, search_type) | Traceback (most recent call last):
File "/tmp/tmpfjda8tde/tmpx10yvzm0.py", line 36, in <module>
route_count, station_count = map(int, input().split(" "))
^^^^^^^
EOFError: EOF when reading a line
| |
s598236590 | p00200 | u754367965 | 1508502108 | Python | Python | py | Runtime Error | 0 | 0 | 860 | while True:
n, m = list(map(int,input().split()))
if n == 0 and m == 0:
break
# ??°????????\???
cost = [[10000000 for i in range(m+1)] for j in range(m+1)]
time = [[10000000 for i in range(m+1)] for j in range(m+1)]
for i in range(n):
a, b, c, t = list(map(int, input().split()))
cost[a][b] = cost[b][a] = c
time[a][b] = time[b][a] = t
# ???????????£???????????????
for k in range(m+1):
for i in range(m+1):
for j in range(m+1):
cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
time[i][j] = min(time[i][j], time[i][k] + time[k][j])
# ????????????
k = int(input())
p = []
for i in range(k):
p = list(map(int, input().split()))
if p[2] == 0: print(cost[p[0]][p[1]])
else: print(time[p[0]][p[1]]) | Traceback (most recent call last):
File "/tmp/tmpe99pq334/tmpt37t7aaq.py", line 2, in <module>
n, m = list(map(int,input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s387474998 | p00200 | u742505495 | 1528254260 | Python | Python3 | py | Runtime Error | 0 | 0 | 1388 | import queue
def Dijkstra_mode(vertex,edges,start,end,mode):
weight = [0 if i==start else float("inf") for i in range(vertex)]
Q = queue.PriorityQueue()
Q.put((weight[start],start))
while(not Q.empty()):
cur = Q.get()
if weight[cur[1]] < cur[0]:
continue
if mode == 0:
for j in range(len(edges[cur[1]])):
if weight[edges[cur[1]][j][1]] > weight[cur[1]] + edges[cur[1]][j][2]:
weight[edges[cur[1]][j][1]] = weight[cur[1]] + edges[cur[1]][j][2]
Q.put((weight[edges[cur[1]][j][1]],edges[cur[1]][j][1]))
else:
for j in range(len(edges[cur[1]])):
if weight[edges[cur[1]][j][1]] > weight[cur[1]] + edges[cur[1]][j][3]:
weight[edges[cur[1]][j][1]] = weight[cur[1]] + edges[cur[1]][j][3]
Q.put((weight[edges[cur[1]][j][1]],edges[cur[1]][j][1]))
if weight[end] != float("inf"):
return weight[end]
return weight
n,m = map(int,input().split())
edges = [[] for i in range(m)]
for i in range(n):
data = list(map(input().split()))
data_b = [data[1],data[0],data[2],data[3]]
edges[data[0]].append(data)
edges[data_b[0]].append(data_b)
k = int(input())
for i in range(k):
p,q,r = map(int,input().split())
ans = Dijkstra_mode(m,edges,p,q,r)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmp0uuz0lc1/tmprlyuygn_.py", line 26, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s513694327 | p00200 | u742505495 | 1528254417 | Python | Python3 | py | Runtime Error | 0 | 0 | 1390 | import queue
def Dijkstra_mode(vertex,edges,start,end,mode):
weight = [0 if i==start else float("inf") for i in range(vertex)]
Q = queue.PriorityQueue()
Q.put((weight[start],start))
while(not Q.empty()):
cur = Q.get()
if weight[cur[1]] < cur[0]:
continue
if mode == 0:
for j in range(len(edges[cur[1]])):
if weight[edges[cur[1]][j][1]] > weight[cur[1]] + edges[cur[1]][j][2]:
weight[edges[cur[1]][j][1]] = weight[cur[1]] + edges[cur[1]][j][2]
Q.put((weight[edges[cur[1]][j][1]],edges[cur[1]][j][1]))
else:
for j in range(len(edges[cur[1]])):
if weight[edges[cur[1]][j][1]] > weight[cur[1]] + edges[cur[1]][j][3]:
weight[edges[cur[1]][j][1]] = weight[cur[1]] + edges[cur[1]][j][3]
Q.put((weight[edges[cur[1]][j][1]],edges[cur[1]][j][1]))
if weight[end] != float("inf"):
return weight[end]
return weight
n,m = map(int,input().split())
edges = [[] for i in range(m+1)]
for i in range(n):
data = list(map(input().split()))
data_b = [data[1],data[0],data[2],data[3]]
edges[data[0]].append(data)
edges[data_b[0]].append(data_b)
k = int(input())
for i in range(k):
p,q,r = map(int,input().split())
ans = Dijkstra_mode(m,edges,p,q,r)
print(ans)
| Traceback (most recent call last):
File "/tmp/tmpgfs4ayne/tmpiv8ovj_p.py", line 26, in <module>
n,m = map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s830170991 | p00200 | u180584272 | 1381664093 | Python | Python | py | Runtime Error | 0 | 0 | 1174 | n,m = map(int,raw_input().split()) #n = the number of lines, m = the numer of stations
err = 100000
drcs = [] #the seq of direct route and cost
drts = [] #the seq of direct route and time
for i in xrange(n):
a,b,cost,time = map(int,raw_input().split())
a,b = a-1,b-1
drcs.append((a,b,cost))
drts.append((a,b,time))
rcs = [[0 if i==j else err for j in xrange(m)] for i in xrange(m)] #the seq from route to cost
rts = [[0 if i==j else err for j in xrange(m)] for i in xrange(m)] #the seq from route to time
while len(drcs) != 0:
(a,b,cost) = drcs.pop()
for i in xrange(m):
for j in xrange(m):
rcs[i][j] = min(rcs[i][j],rcs[i][a]+cost+rcs[b][j],rcs[i][b]+cost+rcs[a][j])
while len(drts) != 0:
(a,b,time) = drts.pop()
for i in xrange(m):
for j in xrange(m):
rts[i][j] = min(rts[i][j],rts[i][a]+time+rts[b][j],rts[i][b]+time+rts[a][j])
k = int(raw_input())
for k in xrange(k):
p,q,r = map(int,raw_input().split())
p,q = p-1,q-1
if r == 0:
print rcs[p][q]
elif r == 1:
print rts[p][q]
else:
raise "??"
gomi = raw_input()
if gomi != "0 0":
raise "?????" | File "/tmp/tmp8g2nxowa/tmpn1zqr7us.py", line 34
print rcs[p][q]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s587789722 | p00200 | u647766105 | 1388034359 | Python | Python | py | Runtime Error | 0 | 0 | 87 | 6 5
1 2 200 10
1 4 400 15
1 3 250 25
2 4 100 10
4 5 150 20
3 5 300 20
2
1 5 0
1 5 1
0 0 | File "/tmp/tmpf7wzhiin/tmp90cnizvy.py", line 1
6 5
^
SyntaxError: invalid syntax
| |
s805727230 | p00200 | u621997536 | 1388512612 | Python | Python | py | Runtime Error | 0 | 0 | 782 |
import numpy
INF = 1000000000
def dj(s, e, r):
d = [INF] * 100
done = [0] * 100
d[s] = 0
while True:
v = -1
for i in range(V):
if not done[i] and (v == -1 or d[i] < d[v]):
v = i
if v == e:
return d[e]
done[v] = True
for i in range(V):
d[i] = min(d[i], d[v] + cost[v][i][r])
while True:
cost = numpy.array([[[INF for k in range(2)] for j in range(100)] for i in range(100)])
E, V = map(int, raw_input().split())
if not E:
break
for i in range(E):
a, b, c, d = map(int, raw_input().split())
a -= 1
b -= 1
cost[a][b][0] = cost[b][a][0] = c
cost[a][b][1] = cost[b][a][1] = d
k = input()
for i in range(k):
p, q, r = map(int, raw_input().split())
p -= 1
q -= 1
print dj(p, q, r) | File "/tmp/tmp4uu4fs4z/tmp1z6ptmsn.py", line 36
print dj(p, q, r)
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s761075157 | p00200 | u621997536 | 1388540288 | Python | Python | py | Runtime Error | 0 | 0 | 1097 | import sys
import math
def subsolve(ofs,range,array,data,dofs,mode,target):
ret = []
if range == 0:
if data[ofs][array[0]][mode] == -1:
return []
ref = dofs+data[ofs][array[i]][mode]
ret.append(ref)
return ret
for i in xrange(range):
if data[ofs][array[i]][mode] == -1:
continue
ref = dofs+data[ofs][array[i]][mode]
if array[i] == target - 1:
ret.append(ref)
return ret
ar = list(array)
ar.remove(ofs)
ap = subsolve(array[i],range-1,ar,data,ref,mode,target)
ret.extend(ap)
return ret
def solve():
first = map(int,sys.stdin.readline().split())
station = [[] for _ in xrange(first[1])]
for i in xrange(first[1]):
station[i] = [[] for _ in xrange(first[1])]
for j in xrange(first[1]):
station[i][j]=[-1,-1]
for line in xrange(first[0]):
linedat = map(int,sys.stdin.readline().split())
station[linedat[0]-1][linedat[1]-1] = [linedat[2],linedat[3]]
order = int(sys.stdin.readline())
for i in xrange(order):
od = map(int,sys.stdin.readline().split())
#main loop
print min(subsolve(0,first[1],range(first[1]),station,0,od[2],od[1]))
solve() | File "/tmp/tmp9qj3e8wn/tmpk6jd99l7.py", line 37
print min(subsolve(0,first[1],range(first[1]),station,0,od[2],od[1]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s799142415 | p00200 | u621997536 | 1388540786 | Python | Python | py | Runtime Error | 0 | 0 | 1153 | import sys
import math
def subsolve(ofs,range,array,data,dofs,mode,target):
ret = []
if range == 0:
if data[ofs][array[0]][mode] == -1:
return []
ref = dofs+data[ofs][array[i]][mode]
ret.append(ref)
return ret
for i in xrange(range):
if data[ofs][array[i]][mode] == -1:
continue
ref = dofs+data[ofs][array[i]][mode]
if array[i] == target - 1:
ret.append(ref)
return ret
ar = list(array)
ar.remove(ofs)
ap = subsolve(array[i],range-1,ar,data,ref,mode,target)
ret.extend(ap)
return ret
def solve():
while True:
first = map(int,sys.stdin.readline().split())
if not first[0]:
break;
station = [[] for _ in xrange(first[1])]
for i in xrange(first[1]):
station[i] = [[] for _ in xrange(first[1])]
for j in xrange(first[1]):
station[i][j]=[-1,-1]
for line in xrange(first[0]):
linedat = map(int,sys.stdin.readline().split())
station[linedat[0]-1][linedat[1]-1] = [linedat[2],linedat[3]]
order = int(sys.stdin.readline())
for i in xrange(order):
od = map(int,sys.stdin.readline().split())
#main loop
print min(subsolve(0,first[1],range(first[1]),station,0,od[2],od[1]))
solve() | File "/tmp/tmpd_xp16c2/tmpxrxaduaj.py", line 40
print min(subsolve(0,first[1],range(first[1]),station,0,od[2],od[1]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s588544733 | p00200 | u350508326 | 1398874938 | Python | Python | py | Runtime Error | 0 | 0 | 1708 | cost_ans = []
time_ans = []
def set_ans(cost , time):
cost_ans.append(cost)
time_ans.append(time)
class Sta(object):
"""station"""
def __init__(self, station_name):
super(Sta, self).__init__()
self.station_name = station_name
self.route = []
def add_route(self, route):
self.route.append(route)
class Route(object):
"""route"""
def __init__(self, cost, time, next_station):
super(Route, self).__init__()
self.time = time
self.cost = cost
self.next_station = next_station
def search_route(now_station, gool_station, cost, time):
"""search route"""
if now_station.station_name == gool_station.station_name:
set_ans(cost, time)
return
elif len(now_station.route) == 0:
return
for r in now_station.route:
search_route(
r.next_station,
gool_station,
cost + r.cost,
time + r.time)
def main():
while True:
cost_ans = []
time_ans = []
n,m = map(int, raw_input().split())
if n == 0 and m == 0:
return
stations = [Sta(x) for x in xrange(1,m+1) ]
for i in xrange(n):
a, b, cost, time = map(int, raw_input().split())
tmp = Route(cost, time, stations[b-1])
stations[a-1].add_route(tmp)
k = input()
for i in xrange(k):
p, q, r = map(int, raw_input().split())
search_route(stations[p-1], stations[q-1], 0, 0)
if r == 0:
print(min(cost_ans))
else:
print(min(time_ans))
if __name__ == '__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpjvyt5wpf/tmp8c0fjeyx.py", line 73, in <module>
main()
File "/tmp/tmpjvyt5wpf/tmp8c0fjeyx.py", line 50, in main
n,m = map(int, raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s872280509 | p00200 | u350508326 | 1398875328 | Python | Python | py | Runtime Error | 0 | 0 | 1782 | cost_ans = []
time_ans = []
def set_ans(cost , time):
cost_ans.append(cost)
time_ans.append(time)
def reset_ans():
global cost_ans
global time_ans
cost_ans = []
time_ans = []
class Sta(object):
"""station"""
def __init__(self, station_name):
super(Sta, self).__init__()
self.station_name = station_name
self.route = []
def add_route(self, route):
self.route.append(route)
class Route(object):
"""route"""
def __init__(self, cost, time, next_station):
super(Route, self).__init__()
self.time = time
self.cost = cost
self.next_station = next_station
def search_route(now_station, gool_station, cost, time):
"""search route"""
if now_station.station_name == gool_station.station_name:
set_ans(cost, time)
return
elif len(now_station.route) == 0:
return
for r in now_station.route:
search_route(
r.next_station,
gool_station,
cost + r.cost,
time + r.time)
def main():
while True:
reset_ans([],[])
n,m = map(int, raw_input().split())
if n == 0 and m == 0:
return
stations = [Sta(x) for x in xrange(1,m+1) ]
for i in xrange(n):
a, b, cost, time = map(int, raw_input().split())
tmp = Route(cost, time, stations[b-1])
stations[a-1].add_route(tmp)
k = input()
for i in xrange(k):
p, q, r = map(int, raw_input().split())
search_route(stations[p-1], stations[q-1], 0, 0)
if r == 0:
print(min(cost_ans))
else:
print(min(time_ans))
if __name__ == '__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpd5mnwgf_/tmpi_m6keex.py", line 77, in <module>
main()
File "/tmp/tmpd5mnwgf_/tmpi_m6keex.py", line 53, in main
reset_ans([],[])
TypeError: reset_ans() takes 0 positional arguments but 2 were given
| |
s740804791 | p00200 | u350508326 | 1398875364 | Python | Python | py | Runtime Error | 0 | 0 | 1779 | cost_ans = []
time_ans = []
def set_ans(cost , time):
cost_ans.append(cost)
time_ans.append(time)
def reset_ans():
global cost_ans
global time_ans
cost_ans = []
time_ans = []
class Sta(object):
"""station"""
def __init__(self, station_name):
super(Sta, self).__init__()
self.station_name = station_name
self.route = []
def add_route(self, route):
self.route.append(route)
class Route(object):
"""route"""
def __init__(self, cost, time, next_station):
super(Route, self).__init__()
self.time = time
self.cost = cost
self.next_station = next_station
def search_route(now_station, gool_station, cost, time):
"""search route"""
if now_station.station_name == gool_station.station_name:
set_ans(cost, time)
return
elif len(now_station.route) == 0:
return
for r in now_station.route:
search_route(
r.next_station,
gool_station,
cost + r.cost,
time + r.time)
def main():
while True:
reset_ans()
n,m = map(int, raw_input().split())
if n == 0 and m == 0:
return
stations = [Sta(x) for x in xrange(1,m+1) ]
for i in xrange(n):
a, b, cost, time = map(int, raw_input().split())
tmp = Route(cost, time, stations[b-1])
stations[a-1].add_route(tmp)
k = input()
for i in xrange(k):
p, q, r = map(int, raw_input().split())
search_route(stations[p-1], stations[q-1], 0, 0)
if r == 0:
print(min(cost_ans))
else:
print(min(time_ans))
if __name__ == '__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpuu66vx8z/tmp7k5wuxz2.py", line 79, in <module>
main()
File "/tmp/tmpuu66vx8z/tmp7k5wuxz2.py", line 56, in main
n,m = map(int, raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s555749045 | p00200 | u557208833 | 1402150072 | Python | Python | py | Runtime Error | 0 | 0 | 1042 | import sys
import math
def readnums():
return map(int,raw_input().rstrip().split())
def makingpath(network,param='cost'):
N = len(network)
path = [[float("inf") for j in range(0,N)] for i in range(0,N)]
for i in range(1,N):
for j in range(i+1,N):
if j in network[i]:
path[i][j] = path[j][i] = network[i][j][param]
for k in range(1,N):
for i in range(1,N):
for j in range(i+1,N):
if path[i][j] > path[i][k] + path[k][j]:
path[i][j] = path[i][k] + path[k][j]
return path
[n,m] = readnums()
stations = [{} for i in range(0,m+1)]
for i in range(0,n):
[a,b,cost,time] = readnums()
stations[a][b] = stations[b][a] = {'cost':float(cost), 'time':float(time) }
costnet = makingpath(stations,'cost')
timenet = makingpath(stations,'time')
[k] = readnums()
for i in range(0,k):
[start,goal,inquiry] = readnums()
if inquiry == 0:
print int(costnet[start][goal])
else:
print int(timenet[start][goal]) | File "/tmp/tmpxy8u6li0/tmp15vc4zdp.py", line 33
print int(costnet[start][goal])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s617058812 | p00200 | u557208833 | 1402150445 | Python | Python | py | Runtime Error | 0 | 0 | 1033 | import sys
import math
def readnums():
return map(int,raw_input().split())
def makingpath(network,param='cost'):
N = len(network)
path = [[float("inf") for j in range(0,N)] for i in range(0,N)]
for i in range(1,N):
for j in range(i+1,N):
if j in network[i]:
path[i][j] = path[j][i] = network[i][j][param]
for k in range(1,N):
for i in range(1,N):
for j in range(i+1,N):
if path[i][j] > path[i][k] + path[k][j]:
path[i][j] = path[i][k] + path[k][j]
return path
[n,m] = readnums()
stations = [{} for i in range(0,m+1)]
for i in range(0,n):
[a,b,cost,time] = readnums()
stations[a][b] = stations[b][a] = {'cost':float(cost), 'time':float(time) }
costnet = makingpath(stations,'cost')
timenet = makingpath(stations,'time')
[k] = readnums()
for i in range(0,k):
[start,goal,inquiry] = readnums()
if inquiry == 0:
print int(costnet[start][goal])
else:
print int(timenet[start][goal]) | File "/tmp/tmpv5gw1p1r/tmpnaj2zrom.py", line 33
print int(costnet[start][goal])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s998426014 | p00200 | u557208833 | 1402150745 | Python | Python | py | Runtime Error | 0 | 0 | 1017 | def readnums():
return map(int,raw_input().split())
def makingpath(network,param='cost'):
N = len(network)
path = [[float("inf") for j in range(0,N)] for i in range(0,N)]
for i in range(1,N):
for j in range(i+1,N):
if j in network[i]:
path[i][j] = path[j][i] = network[i][j][param]
for k in range(1,N):
for i in range(1,N):
for j in range(i+1,N):
if path[i][j] > path[i][k] + path[k][j]:
path[i][j] = path[i][k] + path[k][j]
return path
[n,m] = readnums()
stations = [{} for i in range(0,m+1)]
for i in range(0,n):
[a,b,cost,time] = readnums()
stations[a][b] = stations[b][a] = {'cost':float(cost), 'time':float(time) }
costnet = makingpath(stations,'cost')
timenet = makingpath(stations,'time')
[k] = readnums()
for i in range(0,k):
[start,goal,inquiry] = readnums()
if inquiry == 0:
print int(costnet[start][goal])
else:
print int(timenet[start][goal])
exit(0) | File "/tmp/tmpoaldaml4/tmpy59hxeuj.py", line 30
print int(costnet[start][goal])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s832187705 | p00201 | u567380442 | 1427434925 | Python | Python3 | py | Runtime Error | 0 | 0 | 587 | def price(target, item, recipe):
ret = []
if target in recipe:
ret.append(sum(price(r,item, recipe) for r in recipe[target]))
if target in item:
ret.append(item[target])
return min(ret)
import sys
f = sys.stdin
while True:
n = int(f.readline())
if n == 0:
break
item = [f.readline().split() for _ in range(n)]
item = {name:int(price) for name, price in item}
recipe = [f.readline().split() for _ in range(int(f.readline()))]
recipe = {r[0]:r[2:] for r in recipe}
print(price(f.readline().strip(), item, recipe)) | Traceback (most recent call last):
File "/tmp/tmpi9fx5ssa/tmp3e1zws3_.py", line 15, in <module>
n = int(f.readline())
^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s620406058 | p00201 | u567380442 | 1427436754 | Python | Python3 | py | Runtime Error | 0 | 0 | 601 | def price(target, item, recipe):
ret = []
if target in recipe:
ret.append(sum(price(r,item, recipe) for r in recipe[target]))
if target in item:
ret.append(item[target])
return min(ret)
import sys
f = sys.stdin
while True:
n = int(f.readline())
if n == 0:
break
item = [f.readline().split() for _ in range(n)]
item = {name:int(price) for name, price in item}
recipe = [f.readline().strip().split() for _ in range(int(f.readline()))]
recipe = {r[0]:r[2:] for r in recipe}
print(price(f.readline().strip(), item, recipe)) | Traceback (most recent call last):
File "/tmp/tmpiw6bln8a/tmpmrtxfhc4.py", line 16, in <module>
n = int(f.readline())
^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s891562176 | p00201 | u567380442 | 1427437023 | Python | Python3 | py | Runtime Error | 0 | 0 | 608 | def price(target, item, recipe):
ret = []
if target in recipe:
ret.append(sum(price(r,item, recipe) for r in recipe[target]))
if target in item:
ret.append(item[target])
return min(ret)
import sys
f = sys.stdin
while True:
n = int(f.readline())
if n == 0:
break
item = [f.readline().split() for _ in range(n)]
item = {name:int(price) for name, price in item}
recipe = [f.readline().strip().split() for _ in range(int(f.readline()))]
recipe = {r[0]:r[2:2 + int(r[1])] for r in recipe}
print(price(f.readline().strip(), item, recipe)) | Traceback (most recent call last):
File "/tmp/tmp09d94ng3/tmp49twvi_8.py", line 15, in <module>
n = int(f.readline())
^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''
| |
s484625629 | p00201 | u379499530 | 1432704782 | Python | Python | py | Runtime Error | 0 | 0 | 703 | def check(item):
price = 0
for i in recipe[item[-1]]:
if recipe.has_key(i) == False:
price += pricelist[i]
else:
item.append(i)
price += min(check(item), pricelist[item[-1]])
item.pop()
return price
while True:
pricelist = {}
recipe = {}
n = input()
if n == 0: break
for i in range(n):
item, price = raw_input().split()
pricelist[item] = int(price)
m = input()
for i in range(m):
data = raw_input().split()
recipe[data[0]] = []
for j in range(int(data[1])):
recipe[data[0]].append(data[j + 2])
price = check([raw_input()])
print price | File "/tmp/tmpdio2x19w/tmpvrew1itm.py", line 31
print price
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s671063428 | p00201 | u460331583 | 1346922392 | Python | Python | py | Runtime Error | 0 | 0 | 742 | while True:
count =int(input())
if count == 0:break
thing1,money1=[],[]
for i in range(count):
hoge = map(str,raw_input().split())
thing1.append(hoge[0])
a = int(hoge[1])
money1.append(a)
count2 = int(input())
if count2 == 0:
a = map(str,raw_input())
a = ''.join(a)
b = thing1.index(a)
print money1[b]
for i in range(count2):
hage=map(str,raw_input().split())
hage[1] = int(hage[1])
x,h=2,0
for j in range(hage[1]):
t = thing1.index(hage[x])
h += money1[t]
x+=1
t = thing1.index(hage[0])
g = money1[t]
if h < g: money1[t] = h
a = map(str,raw_input())
a =''.join(a)
ans =thing1.index(a)
print money1[ans] | File "/tmp/tmpvvimvxvy/tmpzu30j9o5.py", line 15
print money1[b]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s172874944 | p00201 | u460331583 | 1346922521 | Python | Python | py | Runtime Error | 0 | 0 | 732 | while True:
count =int(input())
if count == 0:break
thing1,money1=[],[]
for i in range(count):
hoge = map(str,raw_input().split())
thing1.append(hoge[0])
a = int(hoge[1])
money1.append(a)
count2 = int(input())
if count2 == 0:
a = map(str,raw_input())
a = ''.join(a)
b = thing1.index(a)
print money1[b]
for i in range(count2):
hage=map(str,raw_input().split())
hage[1] = int(hage[1])
x,h=2,0
for j in range(hage[1]):
t = thing1.index(hage[x])
h += money1[t]
x+=1
t = thing1.index(hage[0])
g = money1[t]
if h < g: money1[t] = h
a = map(str,raw_input())
a =''.join(a)
ans =thing1.index(a)
print money1[ans] | File "/tmp/tmpk0q4_boi/tmph8gbupt8.py", line 15
print money1[b]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s676390875 | p00201 | u460331583 | 1347031679 | Python | Python | py | Runtime Error | 0 | 0 | 678 | while True:
count = int(input())
if count == 0: break
thing1,thing2,money=[],[],[]
for i in range(count):
hoge = map(str,raw_input().split())
q = int(hoge[1])
thing1.append(hoge[0])
money.append(q)
count = int(input())
if count == 0 :
hoge = raw_input()
ans=thing1.index(hoge)
print money[ans]
else:
for i in range(count):
hoge = map(str,raw_input().split())
q = int(hoge[1])
kn=0
for j in range(q):
e = thing1.index(hoge[j+2])
kn += money[e]
e =thing1.index(hoge[0])
money[e] = kn
ans = raw_input()
hagehage =thing1.index(ans)
ans = int(money[hagehage])
print ans | File "/tmp/tmp6dr7r1y5/tmp64s7645i.py", line 14
print money[ans]
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s886220912 | p00201 | u460331583 | 1347031925 | Python | Python | py | Runtime Error | 0 | 0 | 702 | while True:
count = int(input())
if count == 0: break
thing1,thing2,money=[],[],[]
for i in range(count):
hoge = map(str,raw_input().split())
q = int(hoge[1])
thing1.append(hoge[0])
money.append(q)
count = int(input())
if count == 0 :
hoge = raw_input()
ans=thing1.index(hoge)
print money[ans]
else:
for i in range(count):
hoge = map(str,raw_input().split())
q = int(hoge[1])
kn=0
vv=2
for j in range(q):
e = thing1.index(hoge[vv])
kn += money[e]
vv+=1
e =thing1.index(hoge[0])
money[e] = kn
ans = raw_input()
hagehage =thing1.index(ans)
ans = int(money[hagehage])
print ans | File "/tmp/tmpvczu0341/tmp477k5krr.py", line 14
print money[ans]
^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s805226758 | p00201 | u460331583 | 1347075357 | Python | Python | py | Runtime Error | 0 | 0 | 613 | while True:
count = int(input())
if count == 0: break
thing,money = [],[]
for i in range(count):
hoge= map(str,raw_input().split())
q = int(hoge[1])
thing.append(hoge[0])
money.append(q)
count2 = int(input())
if count2 == 0:
hoge= raw_input()
kz = thing.index(hoge)
print money[kz]
else:
for j in range(count2):
hoge = map(str,raw_input().split())
q = int(hoge[1])
x,y = 2,0
for i in range(q):
w = thing.index(hoge[x])
y +=money[w]
x+=1
w = thing.index(hoge[0])
money[w] = y
ans = raw_input()
w = thing.index(ans)
print money[w]
| File "/tmp/tmp7mfckdrj/tmp6x7hasjd.py", line 14
print money[kz]
^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s727639560 | p00201 | u460331583 | 1347523793 | Python | Python | py | Runtime Error | 0 | 1008 | 678 | while True:
count = int(input())
if count == 0: break
money,thing = [],[]
for i in range(count):
hoge = map(str,raw_input().split())
t = int(hoge[1])
money.append(t)
thing.append(hoge[0])
count = int(input())
if count == 0:
hoge = raw_input()
t = thing.index(hoge)
print money[t]
else:
for j in range(count):
hoge = map(str,raw_input().split())
if hoge[0] in thing:
t = int(hoge[1])
x,kane=2,0
for i in range(t):
kz = thing.index(hoge[x])
kane += money[kz]
x+=1
t = thing.index(hoge[0])
money[t] = kane
hoge = raw_input()
ans = thing.index(hoge)
print money[ans] | File "/tmp/tmp330ufj4q/tmpc31us2vu.py", line 14
print money[t]
^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s016501955 | p00201 | u460331583 | 1347610688 | Python | Python | py | Runtime Error | 0 | 0 | 744 | while True:
count = int(input())
if count == 0: break
thing,money=[],[]
for i in range(count):
hoge = map(str,raw_input().split())
t = int(hoge[1])
thing.append(hoge[0])
money.append(t)
count = int(input())
if count == 0:
hoge = raw_input()
if hoge not in thing:
print 0
continue
t = thing.index(hoge)
print money[t]
else:
for i in range(count):
hoge = map(str,raw_input().split())
if hoge[0] not in thing:
print 0
t = int(hoge[1])
x,y = 2,0
for j in range(t):
r = thing.index(hoge[x])
y += money[r]
x+=1
e = thing.index(hoge[0])
money[e]= y
g = raw_input()
ans = thing.index(g)
print money[ans] | File "/tmp/tmp6eg744t1/tmp_dmazp1b.py", line 14
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s118501528 | p00201 | u460331583 | 1347610834 | Python | Python | py | Runtime Error | 0 | 0 | 761 | while True:
count = int(input())
if count == 0: break
thing,money=[],[]
for i in range(count):
hoge = map(str,raw_input().split())
t = int(hoge[1])
thing.append(hoge[0])
money.append(t)
count = int(input())
if count == 0:
hoge = raw_input()
if hoge not in thing:
print 0
continue
t = thing.index(hoge)
print money[t]
else:
for i in range(count):
hoge = map(str,raw_input().split())
if hoge[0] not in thing:
print 0
continue
t = int(hoge[1])
x,y = 2,0
for j in range(t):
r = thing.index(hoge[x])
y += money[r]
x+=1
e = thing.index(hoge[0])
money[e]= y
g = raw_input()
ans = thing.index(g)
print money[ans] | File "/tmp/tmpf2l3wkax/tmpsq9netkr.py", line 14
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s933642927 | p00201 | u147801965 | 1364009650 | Python | Python | py | Runtime Error | 0 | 0 | 492 | while True:
things = {}
count = input()
if count == 0: break
for i in range(count):
fuga = raw_input().split()
things[fuga[0]] = int(fuga[1])
for i in range(input()):
fuga = raw_input().split()
money =0
for j in range(int(fuga[1])):
money+= things[fuga[j+2]]
things[fuga[0]] = things[fuga[0]] if money > things[fuga[0]] else money
ans = raw_input()
fin = things[ans] if ans in things else 0
print fin | File "/tmp/tmpfa9kncjx/tmpua5bzwzf.py", line 16
print fin
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s784126119 | p00201 | u147801965 | 1364438934 | Python | Python | py | Runtime Error | 0 | 0 | 858 | while True:
    ts={}
    c=input()
    if c==0: break
    for i in range(c):
        f=raw_input().split()
        ts[f[0]]=int(f[1])
    for i in range(input()):
        f=raw_input().split()
        m=0
        for j in range(int(f[1])):
            h=ts[f[j+2]] if f[j+2] in ts else 0
            m+=h
q=ts[f[0]]
        ts[f[0]]=q if m > q else m
    print ts[raw_input()] | File "/tmp/tmph4ag_lw6/tmpiqzo6gis.py", line 2
    ts={}
^
IndentationError: expected an indented block after 'while' statement on line 1
| |
s510808683 | p00201 | u599161451 | 1375197053 | Python | Python | py | Runtime Error | 0 | 0 | 1509 | #!/usr/bin/python
import sys
class Alchemey(object):
def __init__(self):
self.prices = {}
self.recipes = {}
def add_to_price_list(self, line):
name, price = line.split()
self.prices[name] = int(price)
def add_to_recipe_list(self, line):
xs = line.split()
dst = xs[0]
n = int(xs[1])
srcs = xs[2:]
self.recipes[dst] = srcs
def plan(self, name):
if name not in self.recipes:
return self.prices[name]
return sum([self.plan(n) for n in self.recipes[name]])
al = Alchemey()
'PRICE'
'RECIPE'
'REQUEST'
state = None
offset = 0
price_to_read = 0
recipe_to_read = 0
for i, line in enumerate(sys.stdin):
i = i - offset
if state is None:
price_to_read = int(line)
state = 'PRICE'
continue
elif state == 'PRICE' and price_to_read == 0:
recipe_to_read = int(line)
state = 'RECIPE'
continue
elif state == 'RECIPE' and recipe_to_read == 0:
state = 'REQUEST'
pass
if price_to_read > 0:
assert state == 'PRICE'
al.add_to_price_list(line)
price_to_read -= 1
elif recipe_to_read > 0:
assert state == 'RECIPE'
al.add_to_recipe_list(line)
recipe_to_read -= 1
else:
assert state == 'REQUEST'
assert recipe_to_read == 0 and price_to_read == 0
request = line.split()[0]
offset +=i
print al.plan(request)
state = None | File "/tmp/tmp5huid1oa/tmp4uy359fj.py", line 68
print al.plan(request)
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s841830188 | p00201 | u599161451 | 1375197187 | Python | Python | py | Runtime Error | 0 | 0 | 1505 | #!/usr/bin/python
import sys
class Alchemey(object):
def __init__(self):
self.prices = {}
self.recipes = {}
def add_to_price_list(self, line):
name, price = line.split()
self.prices[name] = int(price)
def add_to_recipe_list(self, line):
xs = line.split()
dst = xs[0]
n = int(xs[1])
srcs = xs[2:]
self.recipes[dst] = srcs
def plan(self, name):
if name not in self.recipes:
return self.prices[name]
return sum([self.plan(n) for n in self.recipes[name]])
al = Alchemey()
'PRICE'
'RECIPE'
'REQUEST'
state = None
offset = 0
price_to_read = 0
recipe_to_read = 0
for i, line in enumerate(sys.stdin):
i = i - offset
if state is None:
price_to_read = int(line)
state = 'PRICE'
continue
elif state == 'PRICE' and price_to_read == 0:
recipe_to_read = int(line)
state = 'RECIPE'
continue
elif state == 'RECIPE' and recipe_to_read == 0:
state = 'REQUEST'
pass
if price_to_read > 0:
assert state == 'PRICE'
al.add_to_price_list(line)
price_to_read -= 1
elif recipe_to_read > 0:
assert state == 'RECIPE'
al.add_to_recipe_list(line)
recipe_to_read -= 1
else:
assert state == 'REQUEST'
assert recipe_to_read == 0 and price_to_read == 0
request = line.split()[0]
offset +=i
print al.plan(request)
state = None | File "/tmp/tmpiv28hkz0/tmpyjdsfqz_.py", line 64
print al.plan(request)
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s576437827 | p00201 | u147801965 | 1380904102 | Python | Python | py | Runtime Error | 0 | 0 | 252 | q,w,e=range,input,raw_input
while True:
n=w()
if n==0:break
d={}
for i in q(n):
o=e().split()
d[o[0]]=int(o[1])
for j in q(w()):
t=e().split()
a=sum([d[i] for i in t[2:]])
d[t[0]]=a if a<d[t[0]] else d[t[0]]
print d[e()] | File "/tmp/tmpra_b20i8/tmpvx1rpc9_.py", line 13
print d[e()]
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s699171988 | p00201 | u647766105 | 1388151163 | Python | Python | py | Runtime Error | 0 | 0 | 338 | while True:
n = input()
if n == 0:
break
dic = {}
for _ in xrange(n):
name, cost = raw_input().split()
dic[name] = int(cost)
for _ in xrange(input()):
items = raw_input().split()
dic[items[0]] = min(dic[items[0]], sum(map(lambda x:dic[x], items[2:])))
print dic[raw_input()] | File "/tmp/tmpvp54w_yk/tmp3utavcp0.py", line 12
print dic[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s480452056 | p00201 | u647766105 | 1388151281 | Python | Python | py | Runtime Error | 0 | 0 | 385 | while True:
n = input()
if n == 0:
break
dic = {}
for _ in xrange(n):
name, cost = raw_input().split()
dic[name] = int(cost)
for _ in xrange(input()):
items = raw_input().split()
if items[1] == 0:
continue
dic[items[0]] = min(dic[items[0]], sum(map(lambda x:dic[x], items[2:])))
print dic[raw_input()] | File "/tmp/tmp8_h7ho1a/tmpn1coo226.py", line 14
print dic[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s730113808 | p00201 | u647766105 | 1388151429 | Python | Python | py | Runtime Error | 0 | 0 | 500 | while True:
n = input()
if n == 0:
break
dic = {}
for _ in xrange(n):
name, cost = raw_input().split()
dic[name] = int(cost)
for _ in xrange(input()):
items = raw_input().split()
if items[1] == 0:
continue
if items[0] not in dic:
dic[items[0]] = sum(map(lambda x:dic[x], items[2:]))
else:
dic[items[0]] = min(dic[items[0]], sum(map(lambda x:dic[x], items[2:])))
print dic[raw_input()] | File "/tmp/tmpyfjieggi/tmppiwzhh6b.py", line 17
print dic[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s148616566 | p00201 | u647766105 | 1388152634 | Python | Python | py | Runtime Error | 0 | 0 | 505 | while True:
n = input()
if n == 0:
break
dic = {}
for _ in xrange(n):
name, cost = raw_input().split()
dic[name] = int(cost)
m = input()
recipe = []
for _ in xrange(m):
data = raw_input().split()
recipe.append([data[0]]+data[2:])
for _ in xrange(m):
for i in xrange(m):
dic[recipe[i][0]] = min(recipe[i][0],
sum(map(lambda x:dic[x], recipe[i][1:])))
print dic[raw_input()] | File "/tmp/tmpg5g2nd74/tmp6on1xzj3.py", line 18
print dic[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s305973862 | p00201 | u647766105 | 1388153399 | Python | Python | py | Runtime Error | 0 | 0 | 570 | while True:
n = input()
if n == 0:
break
dic = {}
for _ in xrange(n):
name, cost = raw_input().split()
dic[name] = int(cost)
m = input()
recipe = []
for _ in xrange(m):
data = raw_input().split()
if data[1] <= 0:
m -= 1
continue
recipe.append([data[0]]+data[2:])
for _ in xrange(m):
for i in xrange(m):
dic[recipe[i][0]] = min(recipe[i][0],
sum(map(lambda x:dic[x], recipe[i][1:])))
print dic[raw_input()] | File "/tmp/tmpki43ly40/tmpmo9cftde.py", line 21
print dic[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s733997063 | p00201 | u104911888 | 1389234325 | Python | Python | py | Runtime Error | 0 | 0 | 496 | def rec(name):
if name not in combs:
return items[name]
s = 0
for nm in combs[name]:
s += rec(nm)
return min(s, items[name])
while True:
items = {}
combs = {}
n = input()
if n == 0:
break
for i in range(n):
name, cost = raw_input().split()
items[name] = int(cost)
m = input()
for i in range(m):
tmp = raw_input().split()
combs[tmp[0]] = tmp[2:]
itemname = raw_input()
print rec(itemname) | File "/tmp/tmpuelo8iq9/tmpw7ins7ev.py", line 23
print rec(itemname)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s412959058 | p00201 | u266872031 | 1396538844 | Python | Python | py | Runtime Error | 0 | 0 | 821 | import sys
def cheaperprice(item):
rawprice=rawprices[item]
if item not in menus:
return rawprice
else:
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1 | File "/tmp/tmphbijyjn0/tmp14lrlcli.py", line 28
print cheaperprice(line)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s760892829 | p00201 | u266872031 | 1396539599 | Python | Python | py | Runtime Error | 0 | 0 | 852 | import sys
sys.setrecursionlimit(10000)
def cheaperprice(item):
rawprice=rawprices[item]
if item not in menus:
return rawprice
else:
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1 | File "/tmp/tmpcw_eqclz/tmppajsa7z8.py", line 31
print cheaperprice(line)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s176677071 | p00201 | u266872031 | 1396539629 | Python | Python | py | Runtime Error | 0 | 0 | 856 | import sys
sys.setrecursionlimit(1024*1024)
def cheaperprice(item):
rawprice=rawprices[item]
if item not in menus:
return rawprice
else:
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1 | File "/tmp/tmpwcbo_hmk/tmpxhwxmq31.py", line 31
print cheaperprice(line)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s298242859 | p00201 | u266872031 | 1396541180 | Python | Python | py | Runtime Error | 0 | 0 | 942 | import sys
def cheaperprice(item):
rawprice=rawprices[item]
if item not in menus or item in checkloop:
checkloop.append(item)
return rawprice
else:
checkloop.append(item)
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
checkloop=[]
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
checkloop=[]
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1 | File "/tmp/tmpr4ys3ks_/tmpmp5siba0.py", line 31
print cheaperprice(line)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s844063132 | p00201 | u266872031 | 1396541393 | Python | Python | py | Runtime Error | 0 | 0 | 972 | import sys
def cheaperprice(item):
rawprice=rawprices[item]
if item in checkloop:
return rawprice
elif item not in menus
checkloop.append(item)
return rawprice
else:
checkloop.append(item)
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
checkloop=[]
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
checkloop=[]
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1 | File "/tmp/tmpqdgvjfgx/tmpajf5ry0s.py", line 7
elif item not in menus
^
SyntaxError: expected ':'
| |
s635363101 | p00201 | u266872031 | 1396541753 | Python | Python | py | Runtime Error | 0 | 0 | 972 | import sys
def cheaperprice(item):
rawprice=rawprices[item]
if item in checkloop:
return rawprice
elif item not in menus:
checkloop.append(item)
return rawprice
else:
checkloop.append(item)
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
checkloop=[]
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
checkloop=[]
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1 | File "/tmp/tmphitznr4x/tmp8s6fmmym.py", line 32
print cheaperprice(line)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s056737105 | p00201 | u266872031 | 1396541914 | Python | Python | py | Runtime Error | 0 | 0 | 1108 | import sys
def cheaperprice(item):
rawprice=rawprices[item]
if item in checkloop:
return rawprice
elif item not in menus:
checkloop.append(item)
return rawprice
else:
checkloop.append(item)
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i)
return min(combinedprice,rawprice)
def main():
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
checkloop=[]
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line)
rawprices={}
menus={}
checkloop=[]
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1
return 0
main() | File "/tmp/tmpakdold92/tmpueyuru0r.py", line 32
print cheaperprice(line)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s182859125 | p00201 | u266872031 | 1397021947 | Python | Python | py | Runtime Error | 0 | 0 | 1186 | import sys
def cheaperprice(item,checkloop,rawprices,menus):
rawprice=rawprices[item]
if item in checkloop:
return rawprice
elif item not in menus:
checkloop.append(item)
return rawprice
else:
checkloop.append(item)
indegrients=menus[item]
combinedprice=0
for i in indegrients:
combinedprice+=cheaperprice(i,checkloop,rawprices,menus)
return min(combinedprice,rawprice)
def main():
n=0 #how many numbers of lists
flag=0
rawprices={}
menus={}
checkloop=[]
for line in sys.stdin:
line=line.strip()
if n==0:
if flag==0 and line=='0':
break
elif flag!=2:
n=int(line)
else:
print cheaperprice(line,checkloop,rawprices,menus)
rawprices={}
menus={}
checkloop=[]
flag=(flag+1)%3
else:
line=line.split(' ')
if flag==1: #rawprices
rawprices[line[0]]=int(line[1])
elif flag==2:
menus[line[0]]=line[2:]
n-=1
return 0
main() | File "/tmp/tmpppjq8ipt/tmpe1ix5eja.py", line 32
print cheaperprice(line,checkloop,rawprices,menus)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s132945927 | p00201 | u633068244 | 1399299717 | Python | Python | py | Runtime Error | 0 | 0 | 424 | while 1:
n = input()
if n == 0: break
item = {}
for i in range(n):
n,c = map(str,raw_input().split())
item[n] = int(c)
m = input()
recipes = [map(str,raw_input().split()) for i in range(m)]
recipes = sorted(recipes, key = lambda x:item[x[0]])
for recipe in recipes:
needs = recipe[2:]
cost = 0
for need in needs:
cost += item[need]
item[recipe[0]] = min(cost, item[recipe[0]])
print item[raw_input()] | File "/tmp/tmp7zbt0ajy/tmp_tcjl8v4.py", line 17
print item[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s275822702 | p00201 | u633068244 | 1399299998 | Python | Python | py | Runtime Error | 0 | 0 | 427 | while 1:
n = input()
if n == 0: break
item = {}
for i in range(n):
name,cost = raw_input().split()
item[name] = int(cost)
m = input()
recipes = [raw_input().split() for i in range(m)]
recipes = sorted(recipes, key = lambda x:item[x[0]])
for recipe in recipes:
name = recipe[0]
needs = recipe[2:]
cost = 0
for need in needs:
cost += item[need]
item[name] = min(cost, item[name])
print item[raw_input()] | File "/tmp/tmpcz72qj69/tmppe2g32_l.py", line 18
print item[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s323207854 | p00201 | u633068244 | 1399300240 | Python | Python | py | Runtime Error | 0 | 0 | 481 | while 1:
n = input()
if n == 0: break
item = {}
for i in range(n):
name,cost = raw_input().split()
item[name] = int(cost)
m = input()
recipes = [raw_input().split() for i in range(m)]
recipes = sorted(recipes, key = lambda x: item[x[0]] if x[0] in item else 2<<31)
for recipe in recipes:
name = recipe[0]
needs = recipe[2:]
cost = 0
for need in needs:
cost += item[need]
item[name] = min(cost, item[name]) if name in item else cost
print item[raw_input()] | File "/tmp/tmpzu2y598x/tmpy50qo080.py", line 18
print item[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s260622368 | p00201 | u633068244 | 1399300547 | Python | Python | py | Runtime Error | 0 | 0 | 507 | while 1:
n = input()
if n == 0: break
item = {}
for i in range(n):
name,cost = raw_input().split()
item[name] = int(cost)
m = input()
recipes = [raw_input().split() for i in range(m)]
for recipe in recipes:
if recipe[0] not in item:
item[recipe[0]] = 2<<31
recipes = sorted(recipes, key = lambda x: item[x[0]])
for recipe in recipes:
name = recipe[0]
needs = recipe[2:]
cost = 0
for need in needs:
cost += item[need]
item[name] = min(cost, item[name])
print item[raw_input()] | File "/tmp/tmpjn7zf5cm/tmp3_p1q8_1.py", line 21
print item[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s605671686 | p00201 | u633068244 | 1399300718 | Python | Python | py | Runtime Error | 0 | 0 | 357 | while 1:
n = input()
if n == 0: break
item = {}
for i in range(n):
name,cost = raw_input().split()
item[name] = int(cost)
m = input()
recipes = [raw_input().split() for i in range(m)]
for recipe in recipes:
name = recipe[0]
cost = 0
for need in recipe[2:]:
cost += item[need]
item[name] = min(cost, item[name])
print item[raw_input()] | File "/tmp/tmpxln9mllm/tmpscnjh_yq.py", line 16
print item[raw_input()]
^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s600644842 | p00202 | u352394527 | 1531034284 | Python | Python3 | py | Runtime Error | 0 | 0 | 533 | def main():
tf = [True] * 1000001
tf[0] = tf[1] = False
for i in range(2, 1001):
if tf[i]:
for j in range(i ** 2 , 1000001, i):
tf[j] = False
while True:
n, x = map(int, input().split())
if n == 0:
break
can = [False] * (x + 1)
can[0] = True
for _ in range(n):
v = int(input())
for i in range(x - v + 1):
if can[i]: can[i + v] = True
for i in range(x, -1, -1):
if can[i] and tf[i]:
print(i)
break
else:
print("NA")
main()
| Traceback (most recent call last):
File "/tmp/tmpmrox7xmm/tmpmyhez150.py", line 25, in <module>
main()
File "/tmp/tmpmrox7xmm/tmpmyhez150.py", line 10, in main
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s447173515 | p00202 | u352394527 | 1531034554 | Python | Python3 | py | Runtime Error | 0 | 0 | 633 | def main():
tf = [True] * 1000001
tf[0] = tf[1] = False
for i in range(2, 1001):
if tf[i]:
for j in range(i ** 2 , 1000001, i):
tf[j] = False
primes = [i for i in range(1000001) if tf[i]]
while True:
n, x = map(int, input().split())
if n == 0:
break
can = [False] * (x + 1)
can[0] = True
for _ in range(n):
v = int(input())
for i in range(x - v + 1):
if can[i]: can[i + v] = True
can_nums = [i for i in range(x, -1, -1) if can[i]]
for num in can_nums:
if num in primes:
print(num)
break
else:
print("NA")
main()
| Traceback (most recent call last):
File "/tmp/tmpv_u6v615/tmp4j7s24qa.py", line 28, in <module>
main()
File "/tmp/tmpv_u6v615/tmp4j7s24qa.py", line 11, in main
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s179013328 | p00202 | u352394527 | 1531035969 | Python | Python3 | py | Runtime Error | 0 | 0 | 706 | from bisect import bisect_left as bl
def main():
tf = [True] * 1000004
tf[0] = tf[1] = False
for i in range(2, 1001):
if tf[i]:
for j in range(i ** 2 , 1000004, i):
tf[j] = False
primes = [i for i in range(1000004) if tf[i]]
while True:
n, x = map(int, input().split())
if n == 0:
break
can = [False] * (x + 1)
can[0] = True
for _ in range(n):
v = int(input())
for i in range(x - v + 1):
if can[i] and not can[i + v]: can[i + v] = True
can_nums = [i for i in range(x, -1, -1) if can[i]]
for num in can_nums:
if primes[bl(primes, num)] == num:
print(num)
break
else:
print("NA")
main()
| Traceback (most recent call last):
File "/tmp/tmpqcx45i92/tmpw1rs5e3g.py", line 29, in <module>
main()
File "/tmp/tmpqcx45i92/tmpw1rs5e3g.py", line 12, in main
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s602649456 | p00202 | u352394527 | 1531036298 | Python | Python3 | py | Runtime Error | 0 | 0 | 626 | from bisect import bisect_left as bl
def main():
tf = [True] * 1000004
tf[0] = tf[1] = False
for i in range(2, 1001):
if tf[i]:
for j in range(i ** 2 , 1000004, i):
tf[j] = False
primes = [i for i in range(1000004) if tf[i]]
while True:
n, x = map(int, input().split())
if n == 0:
break
can = [False] * (x + 1)
can[0] = True
for _ in range(n):
v = int(input())
for i in range(x - v + 1):
can[i + v] = can[i] or can[i + v]
for i in range(x, -1, -1):
if tf[i] and can[i]:
print(i)
break
else:
print("NA")
main()
| Traceback (most recent call last):
File "/tmp/tmprdm430d1/tmp98lt463u.py", line 28, in <module>
main()
File "/tmp/tmprdm430d1/tmp98lt463u.py", line 12, in main
n, x = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s297141770 | p00202 | u567380442 | 1427456605 | Python | Python3 | py | Runtime Error | 19930 | 112284 | 761 | def sieve():
n = 10000001
p = [1] * n
p[0] = p[1] = 0
for i in range(int(n ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (x + 1)
for i in range(0,len(num),menu[0]):
num[i] = 1
for mi in menu[1:]:
for i in range(mi, len(num)):
if num[i - mi]:
num[i] = i
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmp367cue_0/tmph54eikro.py", line 34, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s931509058 | p00202 | u567380442 | 1427457038 | Python | Python3 | py | Runtime Error | 19920 | 41976 | 759 | def sieve():
n = 1000001
p = [1] * n
p[0] = p[1] = 0
for i in range(int(n ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (x + 1)
for i in range(0,len(num),menu[0]):
num[i] = 1
for mi in menu[1:]:
for i in range(mi, len(num)):
if num[i - mi]:
num[i] = i
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmp914j17fr/tmp2xftss8z.py", line 33, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s567163114 | p00202 | u567380442 | 1427457664 | Python | Python3 | py | Runtime Error | 19930 | 28432 | 790 | def sieve():
n = 1000001
p = [1] * n
p[0] = p[1] = 0
for i in range(int(n ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
def solve(p, menu, x):
menu.sort(reverse=True)
num = [0] * (x + 1)
for i in range(0,len(num),menu[-1]):
num[i] = 1
for mi in menu[:-1]:
for i in range(len(num) - mi):
if num[i]:
num[i + mi] = 1
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmpmsltz8uw/tmpbdii3m74.py", line 33, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s444445106 | p00202 | u567380442 | 1427462179 | Python | Python3 | py | Runtime Error | 19930 | 28436 | 778 | def sieve():
p = [1] * 1000001
p[0] = p[1] = 0
for i in range(1000):
if p[i]:
for j in range(i * i, 1000001, i):
p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (x + 1)
for i in range(0,len(num),menu[0]):
num[i] = 1
for mi in menu[1:]:
for i in range(len(num) - mi):
if num[i] and not num[i + mi]:
num[i + mi] = 1
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmpf3ttq7u7/tmpr6h27ull.py", line 32, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s253001370 | p00202 | u567380442 | 1427496975 | Python | Python3 | py | Runtime Error | 19930 | 28364 | 708 | def sieve():
p = [1] * 1000001
p[0] = p[1] = 0
for i in range(1000):
if p[i]:
for j in range(i * i, 1000001, i):
p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (x + 1)
num[0] = 1
for mi in menu:
for i in range(len(num) - mi):
if num[i]:
pass
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmpblf0580o/tmpo8wwuwco.py", line 32, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s181531444 | p00202 | u567380442 | 1427510732 | Python | Python3 | py | Runtime Error | 19930 | 43736 | 701 | def sieve():
p = [1] * 1000001;p[0] = p[1] = 0
for i in range(1000):
if p[i]:
for j in range(i * i, 1000001, i):p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (max(menu) + x + 1);num[0] = 1
for i in range(x + 1):
for mi in menu:
if num[i - mi]:
num[i] = 1
break
for i in reversed(range(1, x + 1)):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmptfv5i8na/tmp7h6zigs0.py", line 29, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s716846282 | p00202 | u567380442 | 1427512173 | Python | Python3 | py | Runtime Error | 0 | 0 | 760 | def sieve():
p = [1] * 1000001;p[0] = p[1] = 0
for i in range(1000):
if p[i]:
for j in range(i * i, 1000001, i):p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (x + 1)
num[0] = 1
for mi in menu:
if num[mi]:
continue
for i in range(len(num) - mi):
if num[i] and not num[i + mi]:
num[i + mi] = 1
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmpkq_ctpup/tmp91ilvg77.py", line 33, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s495561015 | p00202 | u567380442 | 1427512442 | Python | Python3 | py | Runtime Error | 0 | 0 | 760 | def sieve():
p = [1] * 1000001;p[0] = p[1] = 0
for i in range(1000):
if p[i]:
for j in range(i * i, 1000001, i):p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (x + 1)
num[0] = 1
for mi in menu:
if num[mi]:
continue
for i in range(len(num) - mi):
if num[i] and not num[i + mi]:
num[i + mi] = 1
for i in reversed(range(1, len(num))):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmpxgmubef9/tmpb70huh9x.py", line 33, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s016245537 | p00202 | u567380442 | 1427518516 | Python | Python3 | py | Runtime Error | 19930 | 43756 | 911 | def sieve():
p = [1] * 1000001;p[0] = p[1] = 0
for i in range(1000):
if p[i]:
for j in range(i * i, 1000001, i):p[j] = 0
return p
def solve(p, menu, x):
menu.sort()
num = [0] * (max(menu) + x + 1);num[0] = 1
cnt = 0
for i in range(x + 1):
if p[i]:
cnt += 2 * len(menu)
for mi in menu:num[i + mi] = 1
if i < cnt:break
for j in range(i,x + 1):
for mj in menu:
if num[j - mj]:
num[j] = 1
break
for i in reversed(range(1, x + 1)):
if p[i] and num[i]:
return i
return 'NA'
import sys
f = sys.stdin
p = sieve()
while True:
n, x = map(int, f.readline().split())
if n == 0:
break
menu = [int(f.readline()) for _ in range(n)]
print(solve(p, menu, x)) | Traceback (most recent call last):
File "/tmp/tmp_fz2z2si/tmp07r5o4ed.py", line 38, in <module>
n, x = map(int, f.readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s433666708 | p00202 | u567380442 | 1429013333 | Python | Python3 | py | Runtime Error | 19920 | 28500 | 806 | from sys import stdin
readline = stdin.readline
import math
def sieve(n):
p = [1] * (n + 1)
p[0] = p[1] = 0
for i in range(math.ceil((n + 1) ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
prime = sieve(1000000)
def solve(price, x):
dp = [0] * (x + 1)
dp[0] = 1
price.sort()
for pi in price:
for i in range(pi, len(dp)):
if dp[i - pi]:dp[i] = 1
for i in reversed(range(2, len(dp))):
if dp[i] and prime[i]:return i
return None
def main():
while True:
n, x = map(int, readline().split())
if n == 0:
break
price = [int(readline()) for _ in range(n)]
amount = solve(price, x)
print(amount if amount else 'NA')
main() | Traceback (most recent call last):
File "/tmp/tmpe3nb3gkk/tmpce6ayhvd.py", line 38, in <module>
main()
File "/tmp/tmpe3nb3gkk/tmpce6ayhvd.py", line 32, in main
n, x = map(int, readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s110138120 | p00202 | u567380442 | 1429013628 | Python | Python3 | py | Runtime Error | 19930 | 28516 | 933 | from sys import stdin
readline = stdin.readline
import math
def sieve(n):
p = [1] * (n + 1)
p[0] = p[1] = 0
for i in range(math.ceil((n + 1) ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
prime = sieve(1000000)
def solve(price, x):
dp = [0] * (x + 1)
dp[0] = 1
price.sort()
for pi in price:
for i in range(0, len(dp), pi):
dp[i] = 1
for pi in price:
for i in range(pi, len(dp)):
if not dp[i] and dp[i - pi]:
dp[i] = 1
for i in reversed(range(2, len(dp))):
if dp[i] and prime[i]:
return i
return None
def main():
while True:
n, x = map(int, readline().split())
if n == 0:
break
price = [int(readline()) for _ in range(n)]
amount = solve(price, x)
print(amount if amount else 'NA')
main() | Traceback (most recent call last):
File "/tmp/tmp6ks4af3p/tmpl9h1uq94.py", line 43, in <module>
main()
File "/tmp/tmp6ks4af3p/tmpl9h1uq94.py", line 37, in main
n, x = map(int, readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s475710077 | p00202 | u567380442 | 1429013897 | Python | Python3 | py | Runtime Error | 19930 | 28584 | 937 | from sys import stdin
readline = stdin.readline
import math
def sieve(n):
p = [1] * (n + 1)
p[0] = p[1] = 0
for i in range(math.ceil((n + 1) ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
prime = sieve(1000000)
def solve(price, x):
dp = [0] * (x + 1)
dp[0] = 1
price.sort()
for pi in price:
for i in range(0, len(dp), pi):
dp[i] = 1
for pi in price[1:]:
for i in range(pi, len(dp)):
if not dp[i] and dp[i - pi]:
dp[i] = 1
for i in reversed(range(2, len(dp))):
if dp[i] and prime[i]:
return i
return None
def main():
while True:
n, x = map(int, readline().split())
if n == 0:
break
price = [int(readline()) for _ in range(n)]
amount = solve(price, x)
print(amount if amount else 'NA')
main() | Traceback (most recent call last):
File "/tmp/tmp1bmpxuzr/tmpf7ah0otd.py", line 43, in <module>
main()
File "/tmp/tmp1bmpxuzr/tmpf7ah0otd.py", line 37, in main
n, x = map(int, readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s214870376 | p00202 | u567380442 | 1429015623 | Python | Python3 | py | Runtime Error | 19930 | 28536 | 1104 | from sys import stdin
readline = stdin.readline
import math
def sieve(n):
p = [1] * (n + 1)
p[0] = p[1] = 0
for i in range(math.ceil((n + 1) ** 0.5)):
if p[i]:
for j in range(2 * i, len(p), i):
p[j] = 0
return p
prime = sieve(1000000)
def solve(price, x):
dp = [0] * (x + 1)
dp[0] = 1
price.sort()
for i in reversed(range(1, len(price))):
for j in range(i):
if price[i] % price[j] == 0:
del price[i]
break
for pi in price:
for i in range(0, len(dp), pi):
dp[i] = 1
for pi in price[1:]:
for i in range(pi, len(dp)):
if not dp[i] and dp[i - pi]:
dp[i] = 1
for i in reversed(range(2, len(dp))):
if dp[i] and prime[i]:
return i
return None
def main():
while True:
n, x = map(int, readline().split())
if n == 0:
break
price = [int(readline()) for _ in range(n)]
amount = solve(price, x)
print(amount if amount else 'NA')
main() | Traceback (most recent call last):
File "/tmp/tmphrs8os3j/tmpufzqighi.py", line 51, in <module>
main()
File "/tmp/tmphrs8os3j/tmpufzqighi.py", line 45, in main
n, x = map(int, readline().split())
^^^^
ValueError: not enough values to unpack (expected 2, got 0)
| |
s751097858 | p00202 | u162387221 | 1431777819 | Python | Python | py | Runtime Error | 19930 | 63364 | 575 | while True:
n, x = map(int, raw_input().split())
if n == x == 0: break
p, ls = [1] * x, [0]*x
p[0] = p[1] = 0
ls[0] = 1
m, s = [], 0
for i in range(2, int(x**0.5)+1):
if p[i]:
for j in range(i*2, x, i):
p[j] = 0
for i in range(n):
m.append(input())
for i in range(x):
if ls[i] == 1:
for j in m:
if i+j < x:
ls[i+j] = 1
for i in range(x)[:0:-1]:
if p[i] == ls[i] == 1:
print i
break
else: print 'NA' | File "/tmp/tmpn2cgjh2f/tmp0ejtey0v.py", line 21
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s404812267 | p00202 | u162387221 | 1431778338 | Python | Python | py | Runtime Error | 19930 | 63364 | 576 | while True:
n, x = map(int, raw_input().split())
if n == x == 0: break
x += 1
p, ls, m = [1] * x, [0]*x, []
p[0] = p[1] = 0
ls[0] = 1
for i in range(2, int(x**0.5)+1):
if p[i]:
for j in range(i*2, x, i):
p[j] = 0
for i in range(n):
m.append(input())
for i in range(x):
if ls[i] == 1:
for j in m:
if i+j < x:
ls[i+j] = 1
for i in range(x)[:0:-1]:
if p[i] == ls[i] == 1:
print i
break
else: print 'NA' | File "/tmp/tmpwtetjhr0/tmp48_qgc7s.py", line 21
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s963285813 | p00202 | u316268279 | 1432205995 | Python | Python | py | Runtime Error | 19930 | 58952 | 1049 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
#must import library 'math'
def sieve_of_erastosthenes(num):
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
input_list[0] = input_list[1] = False
input_list[2] = input_list[3] = input_list[5] = True
sqrt = math.sqrt(num)
for serial in range(3, num, 2):
if serial >= sqrt:
return input_list
for s in range(serial ** 2, num, serial):
input_list[s] = False
primeTable = sieve_of_erastosthenes((10**6))
while True:
n,x = map(int,raw_input().split())
if n == 0 and x == 0:
break
dishes = []
dp = [False for i in range(x+1)]
dp[0] = True
for i in range(n):
dishes.append(int(raw_input()))
ans = 'NA'
for dish in dishes:
for i in range(0,x+1):
if (i + dish < x+1) and dp[i] is not False:
if primeTable[i+dish] is True:
ans = i+dish
dp[i + dish] = True
print(ans) | Traceback (most recent call last):
File "/tmp/tmpygbf4rt0/tmp3o090trh.py", line 21, in <module>
n,x = map(int,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s442961381 | p00202 | u408260374 | 1432208664 | Python | Python | py | Runtime Error | 19930 | 63868 | 653 | from math import sqrt
prime = [1 for _ in xrange(10**6+1)]
prime[1] = 0
prime[0] = 0
for i in xrange(2, int(sqrt(10**6+1))+1):
if prime[i] == 1:
for j in xrange(i+i, 10**6+1, i):
prime[j] = 0
while True:
N, X = map(int, raw_input().split())
if (N, X) == (0, 0): break
price = [input() for _ in xrange(N)]
dp = [0] * (X+1)
dp[0] = 1
for i in xrange(X+1):
if dp[i] == 0: continue
for p in price:
if i + p <= X:
dp[i+p] = 1
for i in range(X, -1, -1):
if dp[i] == 1 and prime[i] == 1:
print(i)
break
else:
print("NA") | Traceback (most recent call last):
File "/tmp/tmpuyejnq_q/tmpqqeda339.py", line 2, in <module>
prime = [1 for _ in xrange(10**6+1)]
^^^^^^
NameError: name 'xrange' is not defined. Did you mean: 'range'?
| |
s583304336 | p00202 | u408260374 | 1432208764 | Python | Python | py | Runtime Error | 19930 | 35412 | 654 | from math import sqrt
prime = [1 for _ in xrange(10**6+1)]
prime[1] = 0
prime[0] = 0
for i in xrange(2, int(sqrt(10**6+1))+1):
if prime[i] == 1:
for j in xrange(i+i, 10**6+1, i):
prime[j] = 0
while True:
N, X = map(int, raw_input().split())
if (N, X) == (0, 0): break
price = [input() for _ in xrange(N)]
dp = [0] * (X+1)
dp[0] = 1
for i in xrange(X+1):
if dp[i] == 0: continue
for p in price:
if i + p <= X:
dp[i+p] = 1
for i in xrange(X, -1, -1):
if dp[i] == 1 and prime[i] == 1:
print(i)
break
else:
print("NA") | Traceback (most recent call last):
File "/tmp/tmpkqwml0ow/tmptcmfzv5a.py", line 2, in <module>
prime = [1 for _ in xrange(10**6+1)]
^^^^^^
NameError: name 'xrange' is not defined. Did you mean: 'range'?
| |
s193584839 | p00202 | u408260374 | 1432216165 | Python | Python | py | Runtime Error | 19930 | 35668 | 664 | from math import sqrt
prime = [1 for _ in xrange(10**6+1)]
prime[1] = 0
prime[0] = 0
for i in xrange(2, int(sqrt(10**6+1))+1):
if prime[i] == 1:
for j in xrange(i+i, 10**6+1, i):
prime[j] = 0
while True:
N, X = map(int, raw_input().split())
if (N, X) == (0, 0): break
price = [input() for _ in xrange(N)]
dp = [0] * (X+1)
dp[0] = 1
for i in xrange(X+1):
if dp[i] == 0: continue
for p in price:
if i + p <= X:
dp[i+p] = 1
for i in xrange(X, -1, -1):
if i > 0 and dp[i] == 1 and prime[i] == 1:
print(i)
break
else:
print("NA") | Traceback (most recent call last):
File "/tmp/tmpy0c0mn1k/tmpg8vg767g.py", line 2, in <module>
prime = [1 for _ in xrange(10**6+1)]
^^^^^^
NameError: name 'xrange' is not defined. Did you mean: 'range'?
| |
s381919517 | p00202 | u408260374 | 1432218970 | Python | Python3 | py | Runtime Error | 19920 | 33712 | 1052 | from math import sqrt
class Prime:
""" make prime numbers lists """
def __init__(self, n):
self.is_prime = [True for _ in range(n+1)]
self.primeList = []
self.is_prime[0] = False
self.is_prime[1] = False
for i in range(2, int(pow(n, 0.5))+1):
if self.is_prime[i] == True:
self.primeList.append(i)
for j in range(2*i, n+1, i):
self.is_prime[j] = False
def isPrime(self, n):
return self.is_prime[n]
def nthPrime(self, n):
return self.primeList[n-1]
prime = Prime(10**6)
while True:
N, X = map(int, input().split())
if (N, X) == (0, 0): break
price = [int(input()) for _ in range(N)]
dp = [0] * (X+1)
dp[0] = 1
for i in range(X+1):
if dp[i] == 0: continue
for p in price:
if i + p <= X:
dp[i+p] = 1
for i in range(X, -1, -1):
if dp[i] == 1 and prime.isPrime(i) == 1:
print(i)
break
else:
print('NA') | Traceback (most recent call last):
File "/tmp/tmphrq4u37f/tmph07g6m1t.py", line 24, in <module>
N, X = map(int, input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s612737745 | p00202 | u032662562 | 1519307433 | Python | Python3 | py | Runtime Error | 0 | 0 | 2406 | # -*- coding: utf-8 -*-
import pdb
import sys,math,time
#Debug=True
Debug=False
nmax=1000000
#unit_cost = [500,305,260,129]
#total_cost = 15000
#unit_cost = [12,9,5]
#total_cost = 200909
unit_cost = []
total_cost=0
primes=[]
pmax=-1
def ip(f,g):
s=0
for i in zip(f,g):
s += i[0]*i[1]
return(s)
def prime():
fl = [True for _ in range(nmax+1)]
yield 2
yield 3
k=5
while k < nmax:
if fl[k]:
yield(k)
for i in range(k+k, nmax+1, k):
fl[i] = False
k += 2
def cost_gen1(money, lvl=0, lst=[]):
uc = unit_cost[lvl]
if lvl==len(unit_cost)-1:
yield uc * math.floor(money/uc)
else:
for i in range(int(money/uc),-1,-1):
tot_uc = uc*i
rem = money - tot_uc
if rem < unit_cost[lvl+1]:
yield tot_uc
else:
for j in cost_gen1(rem, lvl+1):
yield j + tot_uc
def check_mutually_prime(v):
s = min(v)
for i in range(2,s+1):
if sum(map(lambda x:x%i, v))==0:
return False
return True
def main():
global unit_cost, total_cost, primes, pmax
if not Debug:
fh=sys.stdin
else:
#fh=open('vol2_0202b.txt', 'r')
fh=open('vol2_0202.txt', 'r')
pdb.set_trace()
if True:
primes=[x for x in prime() if x<nmax+1]
else:
for i in prime():
primes.append(i)
if i >= nmax:
break
while True:
m, total_cost = list(map(int, fh.readline().strip().split()))
if m==0 and total_cost==0:
break
v=[]
for _ in range(m):
v.append(int(fh.readline()))
unit_cost = sorted(v, reverse=True) # 大きい順
# 互いに素(relative prime)、でないときの処理
if not check_mutually_prime(unit_cost):
print('NA')
continue
t0=time.time()
p=[]
pmax=-1
gen=cost_gen1(total_cost, 0)
for i in gen:
if i > pmax and i in primes:
p.append(i)
pmax=max(p)
if pmax==total_cost:
break
print(max(p))
if Debug:
print('t=', time.time()-t0)
fh.close()
if __name__ == "__main__":
main()
| Traceback (most recent call last):
File "/tmp/tmp_qm078v4/tmpun0_8kz8.py", line 100, in <module>
main()
File "/tmp/tmp_qm078v4/tmpun0_8kz8.py", line 72, in main
m, total_cost = list(map(int, fh.readline().strip().split()))
^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 0)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.