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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s726869500 | p00118 | u104911888 | 1370443119 | Python | Python | py | Runtime Error | 0 | 0 | 464 | mv=((0,1),(0,-1),(1,0),(-1,0))
def dfs(y,x):
c=L[y][x]
L[y][x]="."
for dx,dy in mv:
mx=x+dx
my=y+dy
if 0<=mx<W and 0<=my<H and L[my][mx]==c:
dfs(my,mx)
while True:
H,W=map(int,raw_input().split())
if H==W==0:break
L=[list(raw_input()) for i in range(H)]
cnt=0
for i in range(H):
for j in range(W):
if L[i][j]!=".":
dfs(i,j)
cnt+=1
print cnt | File "/tmp/tmptvr9qsdm/tmpbln4vdwp.py", line 20
print cnt
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s566944681 | p00118 | u633068244 | 1399193290 | Python | Python | py | Runtime Error | 0 | 0 | 494 | def solve(s,i,x,y):
A[y][x] = i
if x < W-1 and A[y][x+1] == s: solve(s,i,x+1,y)
if y < H-1 and A[y+1][x] == s: solve(s,i,x,y+1)
if x > 0 and A[y][x-1] == s: solve(s,i,x-1,y)
if y > 0 and A[y-1][x] == s: solve(s,i,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
i = 1
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
solve(A[y][x],i,x,y)
i += 1
print max([max(A[i]) for i in range(H)]) | File "/tmp/tmpzbp4skvj/tmp_s84tsx0.py", line 18
print max([max(A[i]) for i in range(H)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s591899040 | p00118 | u633068244 | 1399193773 | Python | Python | py | Runtime Error | 0 | 0 | 448 | def fill0(s,x,y):
A[y][x] = 0
if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
i = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
i += 1
print i | File "/tmp/tmpd4irobnv/tmpua06dwx0.py", line 18
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s845204267 | p00118 | u633068244 | 1399193832 | Python | Python | py | Runtime Error | 0 | 0 | 459 | def fill0(s,x,y):
A[y][x] = 0
if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0 and W == 0: break
A = [list(raw_input()) for i in range(H)]
i = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
i += 1
print i | File "/tmp/tmpgi9p548r/tmp70mm9zib.py", line 18
print i
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s977223317 | p00118 | u633068244 | 1399194220 | Python | Python | py | Runtime Error | 0 | 0 | 466 | def fill0(A,s,x,y):
A[y][x] = 0
if x < W-1 and A[y][x+1] == s: fill0(A,s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(A,s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(A,s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(A,s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A,A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmp473iwglw/tmpko89y3yv.py", line 18
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s038812201 | p00118 | u633068244 | 1399204392 | Python | Python | py | Runtime Error | 0 | 0 | 386 | def fill0(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmpw1l39733/tmpqxsc1wbj.py", line 16
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s006416354 | p00118 | u633068244 | 1399204504 | Python | Python | py | Runtime Error | 0 | 0 | 393 | def fill0(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
return
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmp9a5v5zoz/tmpqf6w0ewr.py", line 16
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s276553282 | p00118 | u633068244 | 1399204805 | Python | Python | py | Runtime Error | 0 | 0 | 386 | def fill0(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print(ans) | Traceback (most recent call last):
File "/tmp/tmpevmuu0xr/tmpww7x7kus.py", line 6, in <module>
H,W = map(int,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s994137520 | p00118 | u633068244 | 1399204891 | Python | Python | py | Runtime Error | 0 | 0 | 222 | def fill0(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
print 1 | File "/tmp/tmpoky4ymuc/tmpsayx6tsu.py", line 8
print 1
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s710452918 | p00118 | u633068244 | 1399204900 | Python | Python | py | Runtime Error | 0 | 0 | 213 | def fill0(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break | Traceback (most recent call last):
File "/tmp/tmp66xc5wr2/tmpfoydc6x1.py", line 6, in <module>
H,W = map(int,raw_input().split())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s167900983 | p00118 | u633068244 | 1399205038 | Python | Python | py | Runtime Error | 0 | 0 | 383 | def fill0(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(s,x+1,y); fill0(s,x,y+1); fill0(s,x-1,y); fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print 0 | File "/tmp/tmpphq7v_y4/tmp1uv9c7gt.py", line 15
print 0
^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s227513265 | p00118 | u633068244 | 1399205170 | Python | Python | py | Runtime Error | 0 | 0 | 419 | def fill0(A,H,W,s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill0(A,H,W,s,x+1,y); fill0(A,H,W,s,x,y+1); fill0(A,H,W,s,x-1,y); fill0(A,H,W,s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(H,W,A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmppb6vbq2k/tmpl2wbte8x.py", line 15
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s198980601 | p00118 | u633068244 | 1399205364 | Python | Python | py | Runtime Error | 0 | 0 | 367 | def fill(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill(s,x+1,y); fill(s,x,y+1); fill(s,x-1,y); fill(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] != 0:
fill(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmpauq46o_3/tmpcnlu04ml.py", line 15
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s825814472 | p00118 | u633068244 | 1399205469 | Python | Python | py | Runtime Error | 0 | 0 | 367 | def fill(s,x,y):
if 0 <= x <= W-1 and 0 <= y <= H-1 and A[y][x] == s:
A[y][x] = 0
fill(s,x+1,y); fill(s,x,y+1); fill(s,x-1,y); fill(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for b in range(H):
for a in range(W):
if A[b][a] != 0:
fill(A[b][a],a,b)
ans += 1
print ans | File "/tmp/tmp_q3jz7_g/tmpsg6knym3.py", line 15
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s505126420 | p00118 | u633068244 | 1400122435 | Python | Python | py | Runtime Error | 0 | 0 | 616 | def fill0(s,x,y):
A[y][x] = 0
if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
try:
fill0(A[y][x],x,y)
ans += 1
except:
pass
print ans | File "/tmp/tmp3cbt6c8q/tmp731o_3dg.py", line 16
try:
TabError: inconsistent use of tabs and spaces in indentation
| |
s801372266 | p00118 | u633068244 | 1400122507 | Python | Python | py | Runtime Error | 0 | 0 | 473 | def fill0(s,x,y):
try: A[y][x] = 0
except: pass
if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmpow5sn4lv/tmpp1uf0l0f.py", line 19
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s824668782 | p00118 | u633068244 | 1400122614 | Python | Python | py | Runtime Error | 0 | 0 | 462 | def fill0(s,x,y):
A[y][x] = 0
if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for yi in range(H):
for xi in range(W):
if A[yi][xi] in ["#","@","*"]:
fill0(A[yi][xi],xi,yi)
ans += 1
print ans | File "/tmp/tmpuut5r9km/tmpxirfcl92.py", line 18
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s681045379 | p00118 | u633068244 | 1400122804 | Python | Python | py | Runtime Error | 0 | 0 | 530 | def fill0(s,x,y):
A[y][x] = 0
try: if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
except: pass
try: if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
except: pass
try: if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
except: pass
try: if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
except: pass
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmpwqsq9pms/tmpqonk47wn.py", line 3
try: if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
^^
SyntaxError: invalid syntax
| |
s430528704 | p00118 | u633068244 | 1400122848 | Python | Python | py | Runtime Error | 0 | 0 | 549 | def fill0(s,x,y):
try: A[y][x] = 0
except: pass
try: if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
except: pass
try: if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
except: pass
try: if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
except: pass
try: if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
except: pass
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmp8bcnzt01/tmpdyqyd81p.py", line 4
try: if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
^^
SyntaxError: invalid syntax
| |
s987440849 | p00118 | u633068244 | 1400122996 | Python | Python | py | Runtime Error | 0 | 0 | 464 | def fill0(s,x,y):
global A
A[y][x] = 0
if x < W-1 and A[y][x+1] == s: fill0(s,x+1,y)
if y < H-1 and A[y+1][x] == s: fill0(s,x,y+1)
if x > 0 and A[y][x-1] == s: fill0(s,x-1,y)
if y > 0 and A[y-1][x] == s: fill0(s,x,y-1)
while 1:
H,W = map(int,raw_input().split())
if H == 0: break
A = [list(raw_input()) for i in range(H)]
ans = 0
for y in range(H):
for x in range(W):
if A[y][x] in ["#","@","*"]:
fill0(A[y][x],x,y)
ans += 1
print ans | File "/tmp/tmpb2b5h_xo/tmplycnrq79.py", line 19
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s623010221 | p00119 | u462831976 | 1494788020 | Python | Python3 | py | Runtime Error | 20 | 7784 | 662 | # -*- coding: utf-8 -*-
import sys
import os
import math
m = int(input())
n = int(input())
# Manage people who entered earlier than me in a list
G = [[] for i in range(m)]
for i in range(n):
x, y = map(int, input().split())
x -= 1
y -= 1
G[y].append(x)
printed = [False] * m
while printed.count(False) > 1:
# Delete node with degree 0
for i, node in enumerate(G):
if not printed[i] and len(node) == 0:
print(i+1)
printed[i] = True
# Erase his existence
for node in G:
if i in node:
node.remove(i)
# cat
i = printed.index(False)
print(i+1) | Traceback (most recent call last):
File "/tmp/tmpj7mjd45e/tmpsfalgahs.py", line 7, in <module>
m = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s436478476 | p00119 | u633068244 | 1396259663 | Python | Python | py | Runtime Error | 0 | 0 | 228 | m = [i+1 for i in range(int(raw_input()))]
n = int(raw_input())
for i in range(n):
x,y = map(int, raw_input().split())
if m.index(x) > m.index(y):
r = m.pop(m.index(x))
m.insert(m.index(y),r)
for i in range(n):
print m[i] | File "/tmp/tmp7fejetfa/tmp5pf5hiu7.py", line 9
print m[i]
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s059201532 | p00120 | u873482706 | 1435665549 | Python | Python | py | Runtime Error | 0 | 0 | 2152 | import math
def f1():
total = []
for i in range(len(c_l)-1):
x2 = 0
if (i+1) % 2 == 0:
x2 = (c_l[i+1]+c_l[i])**2 - (c_l[i+1]-c_l[i])**2
else:
x2 = (c_l[i]+c_l[i+1])**2 - (c_l[i]-c_l[i+1])**2
x = math.sqrt(x2)
total.append(x)
else:
total.append(c_l[0])
total.append(c_l[-1])
return f3(total)
def f2():
total = []
for i in range(len(c_l)-1):
x2 = 0
if (i+1) % 2 == 0:
x2 = (c_l[i]+c_l[i+1])**2 - (c_l[i]-c_l[i+1])**2
else:
x2 = (c_l[i+1]+c_l[i])**2 - (c_l[i+1]-c_l[i])**2
x = math.sqrt(x2)
total.append(x)
else:
total.append(c_l[0])
total.append(c_l[-1])
return f3(total)
def f3(total):
if sum(total) <= l:
return True
else:
return False
while True:
try:
line = map(int, raw_input().split())
l = line[0]
lis = sorted(line[1:])
c_lis = lis[:]
c_l = []
if len(lis) % 2 == 0:
while True:
c_l.append(lis[-1])
c_l.append(lis[0])
del lis[-1]
del lis[0]
if len(lis) == 0:
break
if f1():
print 'OK'
else:
print 'NA'
else:
while True:
c_l.append(lis[-1])
c_l.append(lis[0])
del lis[-1]
del lis[0]
if len(lis) == 1:
c_l.append(lis[0])
break
if f1():
print 'OK'
else:
c_l = []
while True:
c_l.append(c_lis[0])
c_l.append(c_lis[-1])
del c_lis[0]
del c_lis[-1]
if len(c_lis) == 1:
c_l.append(c_lis[0])
break
if f2():
print 'OK'
else:
print 'NA'
except EOFError:
break | File "/tmp/tmpxuqptkxf/tmpmln6ui1n.py", line 55
print 'OK'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s675152272 | p00120 | u873482706 | 1435665907 | Python | Python | py | Runtime Error | 0 | 0 | 2177 | import math
def f1():
total = []
for i in range(len(c_l)-1):
x2 = 0
if (i+1) % 2 == 0:
x2 = (c_l[i+1]+c_l[i])**2 - (c_l[i+1]-c_l[i])**2
else:
x2 = (c_l[i]+c_l[i+1])**2 - (c_l[i]-c_l[i+1])**2
x = math.sqrt(x2)
total.append(x)
else:
total.append(c_l[0])
total.append(c_l[-1])
return f3(total)
def f2():
total = []
for i in range(len(c_l)-1):
x2 = 0
if (i+1) % 2 == 0:
x2 = (c_l[i]+c_l[i+1])**2 - (c_l[i]-c_l[i+1])**2
else:
x2 = (c_l[i+1]+c_l[i])**2 - (c_l[i+1]-c_l[i])**2
x = math.sqrt(x2)
total.append(x)
else:
total.append(c_l[0])
total.append(c_l[-1])
return f3(total)
def f3(total):
if sum(total) <= l:
return True
else:
return False
while True:
try:
line = map(int, raw_input().split())
l = line[0]
lis = sorted(line[1:])
c_lis = lis[:]
if len(lis) % 2 == 0:
c_l = []
while True:
c_l.append(lis[-1])
c_l.append(lis[0])
del lis[-1]
del lis[0]
if len(lis) == 0:
break
if f1():
print 'OK'
else:
print 'NA'
else:
c_l = []
while True:
c_l.append(lis[-1])
c_l.append(lis[0])
del lis[-1]
del lis[0]
if len(lis) == 1:
c_l.append(lis[0])
break
if f1():
print 'OK'
else:
c_l = []
while True:
c_l.append(c_lis[0])
c_l.append(c_lis[-1])
del c_lis[0]
del c_lis[-1]
if len(c_lis) == 1:
c_l.append(c_lis[0])
break
if f2():
print 'OK'
else:
print 'NA'
except EOFError:
break | File "/tmp/tmpu7or3vpd/tmphdv4708u.py", line 55
print 'OK'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s725578392 | p00120 | u260980560 | 1437223871 | Python | Python | py | Runtime Error | 0 | 0 | 647 | import math
while True:
l = 0; r = []
try:
inp = map(int, raw_input().split())
l = inp[0]
r = inp[1:]
except EOFError:
break
n = len(r)
if 2*sum(r) <= l:
print "OK"
else:
r.sort()
s = []
for i in xrange(n/2):
s = [r[i]] + s[::-1] + [r[-i-1]]
if n&1:
if abs(s[0]-r[n/2]) < abs(s[-1]-r[n/2]):
s.append(r[n/2])
else:
s = [r[n/2]] + s
ans = s[0] + s[-1]
for i in xrange(n-1):
ans += 2*math.sqrt(s[i]*s[i+1])
print "OK" if ans < 0.000000001+l else "NA" | File "/tmp/tmpo8dw69ol/tmppbmcn0x1.py", line 12
print "OK"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s557473559 | p00120 | u462831976 | 1494881265 | Python | Python3 | py | Runtime Error | 0 | 0 | 1086 | # -*- coding: utf-8 -*-
import sys
import os
import math
def pythagoras(a, b):
return 2 * math.sqrt(a * b)
for s in sys.stdin:
lst = list(map(int, s.split()))
W = lst[0]
R = lst[1:]
R.sort()
n = len(R)
left = []
right = []
left.append(R.pop(0))
right.append(R.pop(0))
l = left[0] + right[0]
while R:
min_R = R[0]
max_R = R[-1]
left_R = left[-1]
right_R = right[-1]
if left_R <= right_R:
if right_R - min_R >= max_R - left_R:
right.append(R.pop(0))
l += pythagoras(right_R, min_R)
else:
left.append(R.pop(-1))
l += pythagoras(max_R, left_R)
else:
if left_R - min_R >= max_R - right_R:
left.append(R.pop(0))
l += pythagoras(left_R, min_R)
else:
right.append(R.pop(-1))
l += pythagoras(max_R, right_R)
l += pythagoras(left[-1], right[-1])
if l <= W:
print('OK')
else:
print('NA') | ||
s910378822 | p00121 | u260980560 | 1436290112 | Python | Python | py | Runtime Error | 0 | 0 | 859 | import sys
memo = {}
sys.setrecursionlimit(40320)
def swap(state, a, b):
state[a], state[b] = state[b], state[a]
def dfs(state, pos, c):
key = "".join(map(str, state))
if memo.has_key(key):
return memo[key]
memo[key] = c
if pos!=0 and pos!=4:
swap(state, pos-1, pos)
dfs(state, pos-1, c+1)
swap(state, pos-1, pos)
if pos!=3 and pos!=7:
swap(state, pos+1, pos)
dfs(state, pos+1, c+1)
swap(state, pos+1, pos)
if pos<4:
swap(state, pos+4, pos)
dfs(state, pos+4, c+1)
swap(state, pos+4, pos)
else:
swap(state, pos-4, pos)
dfs(state, pos-4, c+1)
swap(state, pos-4, pos)
return c
dfs(range(8), 0, 0)
while True:
try:
state = raw_input().replace(" ","")
print memo[state]
except IOError:
break | File "/tmp/tmpsfb05up_/tmp3z9k__zd.py", line 33
print memo[state]
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s934915372 | p00121 | u260980560 | 1436290215 | Python | Python | py | Runtime Error | 0 | 0 | 893 | import sys
memo = {}
sys.setrecursionlimit(40320)
def swap(state, a, b):
state[a], state[b] = state[b], state[a]
def dfs(state, pos, c):
key = "".join(map(str, state))
if memo.has_key(key):
return memo[key]
memo[key] = c
if pos!=0 and pos!=4:
swap(state, pos-1, pos)
dfs(state, pos-1, c+1)
swap(state, pos-1, pos)
if pos!=3 and pos!=7:
swap(state, pos+1, pos)
dfs(state, pos+1, c+1)
swap(state, pos+1, pos)
if pos<4:
swap(state, pos+4, pos)
dfs(state, pos+4, c+1)
swap(state, pos+4, pos)
else:
swap(state, pos-4, pos)
dfs(state, pos-4, c+1)
swap(state, pos-4, pos)
return c
dfs(range(8), 0, 0)
while True:
try:
state = raw_input().replace(" ","")
print memo[state]
except KeyError:
pass
except IOError:
break | File "/tmp/tmpi5xxmcqu/tmp9heg8i2e.py", line 33
print memo[state]
^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s255773141 | p00121 | u577311000 | 1494004892 | Python | Python3 | py | Runtime Error | 0 | 0 | 2023 | # -*- coding: utf-8 -*-
#// left rotate
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
#// right rotate
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
def solve(seq):
init_step = 0
# let CACHE[0]==0 and calculate init step
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
global step
return step[tuple(seq)]+init_step
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
print(solve(seq))
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmp5j9r86ns/tmpytrmjrsl.py", line 84, in <module>
main()
File "/tmp/tmp5j9r86ns/tmpytrmjrsl.py", line 77, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s551281681 | p00121 | u577311000 | 1494005017 | Python | Python3 | py | Runtime Error | 0 | 0 | 2023 | # -*- coding: utf-8 -*-
#// left rotate
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
#// right rotate
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
def solve(seq):
global step
init_step = 0
# let CACHE[0]==0 and calculate init step
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
print(solve(seq))
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpoqjfy_6p/tmp81_v0036.py", line 84, in <module>
main()
File "/tmp/tmpoqjfy_6p/tmp81_v0036.py", line 77, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s542515340 | p00121 | u577311000 | 1494005169 | Python | Python3 | py | Runtime Error | 0 | 0 | 2003 | # -*- coding: utf-8 -*-
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
def solve(seq):
global step
init_step = 0
# let CACHE[0]==0 and calculate initilizing step size
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
print(solve(seq))
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmp6vqn9c5c/tmp2cwv2gjv.py", line 83, in <module>
main()
File "/tmp/tmp6vqn9c5c/tmp2cwv2gjv.py", line 76, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s158550511 | p00121 | u577311000 | 1494005342 | Python | Python3 | py | Runtime Error | 0 | 0 | 2013 | # -*- coding: utf-8 -*-
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
"""
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
"""
def solve(seq):
global step
init_step = 0
# let CACHE[0]==0 and calculate initilizing step size
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
print(solve(seq))
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmp6r43j1pu/tmpw_ppy44l.py", line 85, in <module>
main()
File "/tmp/tmp6r43j1pu/tmpw_ppy44l.py", line 78, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s716070847 | p00121 | u577311000 | 1494005360 | Python | Python3 | py | Runtime Error | 0 | 0 | 2033 | # -*- coding: utf-8 -*-
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
"""
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
"""
def solve(seq):
"""
global step
init_step = 0
# let CACHE[0]==0 and calculate initilizing step size
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
"""
return 0
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
print(solve(seq))
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpq1jhr_k_/tmpod82k28q.py", line 88, in <module>
main()
File "/tmp/tmpq1jhr_k_/tmpod82k28q.py", line 81, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s099253039 | p00121 | u577311000 | 1494005398 | Python | Python3 | py | Runtime Error | 0 | 0 | 2033 | # -*- coding: utf-8 -*-
"""
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
def solve(seq):
global step
init_step = 0
# let CACHE[0]==0 and calculate initilizing step size
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
return 0
"""
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
# print(solve(seq))
print(0)
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmp51lohxan/tmpfec_a2rl.py", line 87, in <module>
main()
File "/tmp/tmp51lohxan/tmpfec_a2rl.py", line 78, in main
init_step()
^^^^^^^^^
NameError: name 'init_step' is not defined
| |
s631014569 | p00121 | u577311000 | 1494005411 | Python | Python3 | py | Runtime Error | 0 | 0 | 2033 | # -*- coding: utf-8 -*-
"""
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
def solve(seq):
global step
init_step = 0
# let CACHE[0]==0 and calculate initilizing step size
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
return 0
"""
def main():
init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
# print(solve(seq))
print(0)
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmptyr_yqnu/tmp3ki05mrm.py", line 87, in <module>
main()
File "/tmp/tmptyr_yqnu/tmp3ki05mrm.py", line 78, in main
init_step()
^^^^^^^^^
NameError: name 'init_step' is not defined
| |
s398914402 | p00121 | u577311000 | 1494005423 | Python | Python3 | py | Runtime Error | 0 | 0 | 2034 | # -*- coding: utf-8 -*-
"""
def rotate1L(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[5],seq[4],seq[1]
return tuple(seq)
def rotate2L(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[2],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate3L(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[2],seq[3],seq[7],seq[6],seq[5],seq[4],seq[1]
return tuple(seq)
def rotate1R(seq):
seq = list(seq)
seq[1],seq[5],seq[4]=seq[4],seq[1],seq[5]
return tuple(seq)
def rotate2R(seq):
seq = list(seq)
seq[1],seq[2],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[6],seq[5]
return tuple(seq)
def rotate3R(seq):
seq = list(seq)
seq[1],seq[2],seq[3],seq[7],seq[6],seq[5],seq[4]=seq[4],seq[1],seq[2],seq[3],seq[7],seq[6],seq[5]
return tuple(seq)
def gen_new(seq,d):
yield rotate1L(seq),d+4
yield rotate2L(seq),d+6
yield rotate3L(seq),d+8
yield rotate1R(seq),d+4
yield rotate2R(seq),d+6
yield rotate3R(seq),d+8
from collections import defaultdict
step = defaultdict(int)
def init_step():
global step
seq = tuple(list(range(8)))
current = set()
current.add(seq)
step[seq]=0
while len(current)!=0:
candidate = set()
for s in current:
for ss,d in gen_new(s,step[s]):
if ss not in step:
candidate.add(ss)
step[ss]=d
continue
if d < step[ss]:
step[ss]=d
candidate.add(ss)
current = candidate
def solve(seq):
global step
init_step = 0
# let CACHE[0]==0 and calculate initilizing step size
zero_position = seq.index(0)
col,row = zero_position%4,zero_position//4
if row==1:
init_step += 1
seq[col],seq[col+4]=seq[col+4],seq[col]
while col!=0:
init_step += 1
seq[col],seq[col-1]=seq[col-1],seq[col]
col -= 1
return step[tuple(seq)]+init_step
return 0
"""
def main():
# init_step()
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
# print(solve(seq))
print(0)
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpkmaf9zl1/tmpw7pmw63e.py", line 87, in <module>
main()
File "/tmp/tmpkmaf9zl1/tmpw7pmw63e.py", line 79, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s311802555 | p00121 | u577311000 | 1494005514 | Python | Python3 | py | Runtime Error | 0 | 0 | 147 | # -*- coding: utf-8 -*-
def main():
line = input().strip()
while line!='':
print(0)
line = input().strip()
if __name__=='__main__':
main() | Traceback (most recent call last):
File "/tmp/tmpwpuqctm3/tmpsqixt3jb.py", line 10, in <module>
main()
File "/tmp/tmpwpuqctm3/tmpsqixt3jb.py", line 4, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s784461812 | p00121 | u577311000 | 1494005540 | Python | Python3 | py | Runtime Error | 0 | 0 | 126 | # -*- coding: utf-8 -*-
if __name__=='__main__':
line = input().strip()
while line!='':
print(0)
line = input().strip() | Traceback (most recent call last):
File "/tmp/tmp1l9wzn97/tmpkd3xda78.py", line 4, in <module>
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s681620068 | p00121 | u577311000 | 1494005552 | Python | Python3 | py | Runtime Error | 0 | 0 | 97 | # -*- coding: utf-8 -*-
line = input().strip()
while line!='':
print(0)
line = input().strip() | Traceback (most recent call last):
File "/tmp/tmpnrbi045u/tmpq78zpqwd.py", line 3, in <module>
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s241320054 | p00121 | u577311000 | 1494005561 | Python | Python3 | py | Runtime Error | 0 | 0 | 72 | line = input().strip()
while line!='':
print(0)
line = input().strip() | Traceback (most recent call last):
File "/tmp/tmp30w37tn8/tmpayz81j82.py", line 1, in <module>
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s068172438 | p00121 | u577311000 | 1494005642 | Python | Python3 | py | Runtime Error | 0 | 0 | 261 | # -*- coding: utf-8 -*-
def main():
line = input().strip()
while line!='':
seq = list(map(int,line.split(' ')))
print(0)
line = input().strip()
if __name__=='__main__':
main()
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpqz8qddpg/tmp5mer3xqx.py", line 11, in <module>
main()
File "/tmp/tmpqz8qddpg/tmp5mer3xqx.py", line 4, in main
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s791327717 | p00121 | u577311000 | 1494006016 | Python | Python3 | py | Runtime Error | 0 | 0 | 143 | while True:
line = input().strip()
if len(line)==0:break
print(0)
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpihfkwz3j/tmpiik05goi.py", line 2, in <module>
line = input().strip()
^^^^^^^
EOFError: EOF when reading a line
| |
s884613295 | p00121 | u577311000 | 1494006058 | Python | Python3 | py | Runtime Error | 0 | 0 | 165 | while 1:
try:
print ans[raw_input().replace(" ","")]
except:
break
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | File "/tmp/tmp12fcx8jg/tmpn_jg2s71.py", line 3
print ans[raw_input().replace(" ","")]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s562651604 | p00121 | u577311000 | 1494006073 | Python | Python3 | py | Runtime Error | 0 | 0 | 182 | try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpzyobxxfu/tmpth766d3d.py", line 3, in <module>
v=raw_input().split()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s243039174 | p00121 | u577311000 | 1494006082 | Python | Python3 | py | Runtime Error | 0 | 0 | 182 | try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass
"""
/*
0 1 2 3 4 5 6 7
1 0 2 3 4 5 6 7
7 6 5 4 3 2 1 0
0
1
28
*/
""" | Traceback (most recent call last):
File "/tmp/tmpj0nhbg1x/tmpg95l5l_g.py", line 3, in <module>
v=raw_input().split()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s542834838 | p00121 | u577311000 | 1494006130 | Python | Python3 | py | Runtime Error | 0 | 0 | 113 | m={}
try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass | Traceback (most recent call last):
File "/tmp/tmpb4ajc7di/tmpzmg7ugl3.py", line 4, in <module>
v=raw_input().split()
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s360489958 | p00121 | u577311000 | 1494006142 | Python | Python3 | py | Runtime Error | 0 | 0 | 213 | from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input
X=4
Y=2
i=0
m={}
try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass | ||
s803533227 | p00121 | u577311000 | 1494006160 | Python | Python3 | py | Runtime Error | 0 | 0 | 330 | from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input
X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
break
try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass | ||
s778998180 | p00121 | u577311000 | 1494006206 | Python | Python3 | py | Runtime Error | 0 | 0 | 330 | from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input
X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
break
try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass | ||
s789739954 | p00121 | u695154284 | 1505492209 | Python | Python3 | py | Runtime Error | 0 | 0 | 819 | from collections import deque
import copy
swap = [[1, 4], [0, 2, 5], [1, 3, 6], [2, 7], [0, 5], [1, 4, 6], [2, 5, 7], [3, 6]]
def bfs():
ia = list(range(8))
count = {str(ia): 0}
que = deque()
que.append((ia, 0))
while len(que) != 0:
state, cnt = que.popleft()
# pos:0?????????
pos = state.index(0)
swap_target = swap[pos]
for i in swap_target:
tmp_state = copy.copy(state)
tmp_state[i], tmp_state[pos] = tmp_state[pos], tmp_state[i]
if str(tmp_state) not in count:
count[str(tmp_state)] = cnt + 1
que.append((tmp_state, cnt + 1))
return count
if __name__ == '__main__':
count = bfs()
while True:
prob = list(map(int, input().split()))
print(count[str(prob)]) | Traceback (most recent call last):
File "/tmp/tmppoo1wnft/tmp2n3ry_fm.py", line 29, in <module>
prob = list(map(int, input().split()))
^^^^^^^
EOFError: EOF when reading a line
| |
s147770044 | p00121 | u672443148 | 1515426139 | Python | Python3 | py | Runtime Error | 0 | 0 | 2891 | from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input
X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
v=q.pop(0)
coor=m[''.join(v)][0]
x=coor%X
y=coor//X
depth=m[''.join(v)][1]
nextstr=''.join(v)
if 0<x:
v[coor],v[coor-1]=v[coor-1],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor-1,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'R']
v[coor],v[coor-1]=v[coor-1],v[coor]
if x<X-1:
v[coor],v[coor+1]=v[coor+1],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor+1,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'L']
v[coor],v[coor+1]=v[coor+1],v[coor]
if 0<y:
v[coor],v[coor-X]=v[coor-X],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor-X,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'D']
v[coor],v[coor-X]=v[coor-X],v[coor]
if y<Y-1:
v[coor],v[coor+X]=v[coor+X],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor+X,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'U']
v[coor],v[coor+X]=v[coor+X],v[coor]
try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
passfrom __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input
X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
v=q.pop(0)
coor=m[''.join(v)][0]
x=coor%X
y=coor//X
depth=m[''.join(v)][1]
nextstr=''.join(v)
if 0<x:
v[coor],v[coor-1]=v[coor-1],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor-1,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'R']
v[coor],v[coor-1]=v[coor-1],v[coor]
if x<X-1:
v[coor],v[coor+1]=v[coor+1],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor+1,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'L']
v[coor],v[coor+1]=v[coor+1],v[coor]
if 0<y:
v[coor],v[coor-X]=v[coor-X],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor-X,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'D']
v[coor],v[coor-X]=v[coor-X],v[coor]
if y<Y-1:
v[coor],v[coor+X]=v[coor+X],v[coor]
if ''.join(v) not in m:
m[''.join(v)]=[coor+X,depth+1]
q.append(v[:])
prev[''.join(v)]=[nextstr,'U']
v[coor],v[coor+X]=v[coor+X],v[coor]
try:
while True:
v=raw_input().split()
print(m[''.join(v)][1])
except EOFError:
pass
| File "/tmp/tmpnc_3epac/tmp51_pkk4p.py", line 56
passfrom __future__ import division
^^^^^^^^^^
SyntaxError: invalid syntax
| |
s060747182 | p00121 | u104911888 | 1373173027 | Python | Python | py | Runtime Error | 0 | 0 | 1102 | class Puzzle:
def __init__(self,panel,space,cnt):
self.panel=panel
self.space=space
self.cnt=cnt
d=(1,-1,4,-4)
model=map(str,range(8)):
def check(s):
if s==model
return True
return False
def bfs(s):
m=set()
que=[s]
m.add(tuple(s.panel))
while que!=[]:
now=que[0]
del que[0]
if check(now.panel):
return now.cnt
idx1=now.space
for i in range(4):
idx2=idx1+d[i]
if idx2<0 or idx2>7:
continue
if (idx1==3 and d[i]==1) or (idx1==4 and d[i]==-1):
continue
next_panel=now.panel[:]
next_panel[idx2],next_panel[idx1]=now.panel[idx1],now.panel[idx2]
next=Puzzle(next_panel,idx2,now.cnt+1)
if tuple(next.panel) not in m:
m.add(tuple(next.panel))
que.append(next)
return -1
while True:
try:
panel=raw_input().split()
except EOFError:
break
space=panel.index("0")
s=Puzzle(panel,space,0)
ans=bfs(s)
print ans | File "/tmp/tmptvcc51vu/tmpxy7_as7u.py", line 8
model=map(str,range(8)):
^
SyntaxError: invalid syntax
| |
s297135538 | p00121 | u104911888 | 1373173062 | Python | Python | py | Runtime Error | 0 | 0 | 1101 | class Puzzle:
def __init__(self,panel,space,cnt):
self.panel=panel
self.space=space
self.cnt=cnt
d=(1,-1,4,-4)
model=map(str,range(8))
def check(s):
if s==model
return True
return False
def bfs(s):
m=set()
que=[s]
m.add(tuple(s.panel))
while que!=[]:
now=que[0]
del que[0]
if check(now.panel):
return now.cnt
idx1=now.space
for i in range(4):
idx2=idx1+d[i]
if idx2<0 or idx2>7:
continue
if (idx1==3 and d[i]==1) or (idx1==4 and d[i]==-1):
continue
next_panel=now.panel[:]
next_panel[idx2],next_panel[idx1]=now.panel[idx1],now.panel[idx2]
next=Puzzle(next_panel,idx2,now.cnt+1)
if tuple(next.panel) not in m:
m.add(tuple(next.panel))
que.append(next)
return -1
while True:
try:
panel=raw_input().split()
except EOFError:
break
space=panel.index("0")
s=Puzzle(panel,space,0)
ans=bfs(s)
print ans | File "/tmp/tmpoz2czbvi/tmpld3g83ch.py", line 10
if s==model
^
SyntaxError: expected ':'
| |
s224598966 | p00122 | u939118618 | 1432204759 | Python | Python | py | Runtime Error | 0 | 0 | 743 | def check(here, count):
return ((abs(here[0]-s[count][0]))**2 + (abs(here[1]-s[count][1]))**2 <= 2)
def dfs(here, count):
if count == 10:
result = True
else:
result = False
for dx, dy in delta:
next = (here[0]+dx,here[1]+dy)
if lb[0] <= next[0] <= ub[0] and lb[1] <= next[1] <= ub[1] and check(next, count):
result |= dfs(next, count+1)
return result
delta = ((2, 0), (2, 1), (2, -1), (0, 2), (1, 2), (-1, 2),
(-2, 0), (-2, 1), (-2, -1), (0, -2), (1, -2), (-1, -2))
lb = (0,0)
ub = (9,9)
while 1:
here = map(int,raw_input().split(" "))
if here == [0,0]:
break
n = int(raw_input())
s = map(int,raw_input().split(" "))
s = [(s[i*2],s[i*2+1]) for i in range(n)]
if dfs(here, 0):
print "OK"
else:
print "NA" | File "/tmp/tmp09zawrt7/tmppinxlc0d.py", line 27
print "OK"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s863395345 | p00122 | u939118618 | 1432204887 | Python | Python | py | Runtime Error | 0 | 0 | 786 | import sys
def check(here, count):
return ((abs(here[0]-s[count][0]))**2 + (abs(here[1]-s[count][1]))**2 <= 2)
def dfs(here, count):
if count == 10:
result = True
else:
result = False
for dx, dy in delta:
next = (here[0]+dx,here[1]+dy)
if lb[0] <= next[0] <= ub[0] and lb[1] <= next[1] <= ub[1] and check(next, count):
result |= dfs(next, count+1)
return result
delta = ((2, 0), (2, 1), (2, -1), (0, 2), (1, 2), (-1, 2),
(-2, 0), (-2, 1), (-2, -1), (0, -2), (1, -2), (-1, -2))
sys.setrecursionlimit = 1000000
lb = (0,0)
ub = (9,9)
while 1:
here = map(int,raw_input().split(" "))
if here == [0,0]:
break
n = int(raw_input())
s = map(int,raw_input().split(" "))
s = [(s[i*2],s[i*2+1]) for i in range(n)]
if dfs(here, 0):
print "OK"
else:
print "NA" | File "/tmp/tmpho9qvhbn/tmp1dtvw7yl.py", line 29
print "OK"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s834458319 | p00122 | u873482706 | 1435327186 | Python | Python | py | Runtime Error | 0 | 0 | 1130 | def phyonkichi(p, n):
yoko = 0
tate = 1
s = dic[n]
p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
c_lis = []
for v in list(set(p_lis) & set(s_lis)):
if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
c_lis.append(v)
if n == N:
if c_lis:
print 'OK'
return True
else:
return
for v in c_lis:
if phyonkichi(v, n+1): return True
jump = [(2,-1),(2,0),(2,1),
(-1,-2),(0,-2),(1,-2),
(-2,1),(-2,0),(-2,-1),
(-1,2),(0,2),(1,2)]
sprinkler = [(0,0),(1,0),(1,-1),
(0,-1),(-1,-1),(-1,0),
(-1,1),(0,1),(1,1)]
while True:
w, h = map(int, raw_input().split(' '))
if w == 0 and h == 0: break
N = int(raw_input())
lis = raw_input().split(' ')
c_lis = [lis[i:i+2] for i in range(0, 20, 2)]
dic = {}
for i, c in enumerate(c_lis):
dic[i+1] = (int(c[0]), int(c[1]))
else:
if not phyonkichi((w, h), 1):
print 'NA' | File "/tmp/tmpn1kp_3mp/tmpv12wamjk.py", line 14
print 'OK'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s030470316 | p00122 | u873482706 | 1435328001 | Python | Python | py | Runtime Error | 0 | 0 | 1123 | def phyonkichi(p, n):
yoko = 0
tate = 1
s = dic[n]
p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
c_lis = []
for v in list(set(p_lis) & set(s_lis)):
if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
c_lis.append(v)
else:
if not c_lis:
return
if n == N:
print 'YES'
return True
for v in c_lis:
if phyonkichi(v, n+1): return True
jump = [(2,-1),(2,0),(2,1),
(-1,-2),(0,-2),(1,-2),
(-2,1),(-2,0),(-2,-1),
(-1,2),(0,2),(1,2)]
sprinkler = [(0,0),(1,0),(1,-1),
(0,-1),(-1,-1),(-1,0),
(-1,1),(0,1),(1,1)]
while True:
w, h = map(int, raw_input().split(' '))
if w == 0 and h == 0: break
N = int(raw_input())
lis = raw_input().split(' ')
c_lis = [lis[i:i+2] for i in range(0, 20, 2)]
dic = {}
for i, c in enumerate(c_lis):
dic[i+1] = (int(c[0]), int(c[1]))
else:
if not phyonkichi((w, h), 1):
print 'NA' | File "/tmp/tmpic_374sn/tmp_5xo_ba7.py", line 16
print 'YES'
^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s526268389 | p00122 | u873482706 | 1435330548 | Python | Python | py | Runtime Error | 0 | 0 | 1309 | def phyonkichi(p, n):
yoko = 0
tate = 1
if n[-1] == '0':
n = 10
else:
n = int(n[-1])
s = dic[n]
p_lis = [(p[yoko]+a[yoko], p[tate]+a[tate]) for a in jump]
s_lis = [(s[yoko]+a[yoko], s[tate]+a[tate]) for a in sprinkler]
c_lis = []
for v in list(set(p_lis) & set(s_lis)):
if 0 <= v[yoko] <= 9 and 0 <= v[tate] <= 9:
c_lis.append(v)
else:
if not c_lis:
return
for v in c_lis:
if not v in res:
res.append(v)
if phyonkichi(v, str(n+1)): return True
del res[-1]
else:
print v, res
print 'OK'
return True
jump = [(2,-1),(2,0),(2,1),
(-1,-2),(0,-2),(1,-2),
(-2,1),(-2,0),(-2,-1),
(-1,2),(0,2),(1,2)]
sprinkler = [(0,0),(1,0),(1,-1),
(0,-1),(-1,-1),(-1,0),
(-1,1),(0,1),(1,1)]
while True:
w, h = map(int, raw_input().split(' '))
if w == 0 and h == 0: break
N = int(raw_input())
lis = raw_input().split(' ')
c_lis = [lis[i:i+2] for i in range(0, 20, 2)]
dic = {}
res = []
for i, c in enumerate(c_lis):
dic[i+1] = (int(c[0]), int(c[1]))
else:
if not phyonkichi((w, h), '1'):
print 'NA' | File "/tmp/tmpmn23tkx4/tmpzf8hps0s.py", line 25
print v, res
^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s821876806 | p00122 | u672443148 | 1516413266 | Python | Python3 | py | Runtime Error | 0 | 0 | 1621 | import queue
import copy
def makeList(splist,n):
for i in range(n):
springs=[]
springs.append(splist[i*2:i*2+2])
springs.append(i)
yield springs
def isSafe(wfs,safe):
while not wfs.empty():
flog=wfs.get()
flogArea=[]
spn=flog[1]+1
for i in range(-1,2):
for j in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for j in range(-1,2):
for i in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for i in range(len(safe[spn])):
if safe[spn][i] in flogArea:
if spn==9:
return True
if spn<9:
wfs.put(safe[spn][i])
return False
while True:
fx,fy=map(int,input().split())
if fx==0 and fy==0:
break
n=int(input())
splist=list(map(int,input().split()))
safe=[]
k=makeList(splist,n)
for spring in k:
temp=[]
for i in range(-1,2):
for j in range(-1,2):
dw=spring[0][0]+i
dh=spring[0][1]+j
if dw>=0 and dw<10 and dh>=0 and dh<10:
temp.append([[dw,dh],spring[1]])
safe.append(temp)
wfs=queue.Queue()
first=[[fx,fy],-1]
wfs.put(first)
if isSafe(wfs,safe):
print("OK")
else:
print("NA")
| Traceback (most recent call last):
File "/tmp/tmpab_56mc5/tmplljw1rr2.py", line 39, in <module>
fx,fy=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s981079976 | p00122 | u672443148 | 1516413440 | Python | Python3 | py | Runtime Error | 0 | 0 | 1621 | import queue
import copy
def makeList(splist,n):
for i in range(n):
springs=[]
springs.append(splist[i*2:i*2+2])
springs.append(i)
yield springs
def isSafe(wfs,safe):
while not wfs.empty():
flog=wfs.get()
flogArea=[]
spn=flog[1]+1
for i in range(-1,2):
for j in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for j in range(-1,2):
for i in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for i in range(len(safe[spn])):
if safe[spn][i] in flogArea:
if spn==9:
return True
if spn<9:
wfs.put(safe[spn][i])
return False
while True:
fx,fy=map(int,input().split())
if fx==0 and fy==0:
break
n=int(input())
splist=list(map(int,input().split()))
safe=[]
k=makeList(splist,n)
for spring in k:
temp=[]
for i in range(-1,2):
for j in range(-1,2):
dw=spring[0][0]+i
dh=spring[0][1]+j
if dw>=0 and dw<10 and dh>=0 and dh<10:
temp.append([[dw,dh],spring[1]])
safe.append(temp)
wfs=queue.Queue()
first=[[fx,fy],-1]
wfs.put(first)
if isSafe(wfs,safe):
print("OK")
else:
print("NA")
| Traceback (most recent call last):
File "/tmp/tmp3zxijk28/tmp2j77w62h.py", line 39, in <module>
fx,fy=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s824186894 | p00122 | u672443148 | 1516413874 | Python | Python3 | py | Runtime Error | 0 | 0 | 19 | import collectoins
| Traceback (most recent call last):
File "/tmp/tmp1l0eyuqo/tmpb6hpkn9c.py", line 1, in <module>
import collectoins
ModuleNotFoundError: No module named 'collectoins'
| |
s534395448 | p00122 | u672443148 | 1516414847 | Python | Python3 | py | Runtime Error | 0 | 0 | 1637 | from collections import deque
import copy
def makeList(splist,n):
for i in range(n):
springs=[]
springs.append(splist[i*2:i*2+2])
springs.append(i)
yield springs
def isSafe(wfs,safe):
while len(wfs)>0:
flog=wfs.popleft()
flogArea=[]
spn=flog[1]+1
for i in range(-1,2):
for j in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for j in range(-1,2):
for i in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for i in range(len(safe[spn])):
if safe[spn][i] in flogArea:
if spn==9:
return True
if spn<9:
wfs.append(safe[spn][i])
return False
while True:
fx,fy=map(int,input().split())
if fx==0 and fy==0:
break
n=int(input())
splist=list(map(int,input().split()))
safe=[]
k=makeList(splist,n)
for spring in k:
temp=[]
for i in range(-1,2):
for j in range(-1,2):
dw=spring[0][0]+i
dh=spring[0][1]+j
if dw>=0 and dw<10 and dh>=0 and dh<10:
temp.append([[dw,dh],spring[1]])
safe.append(temp)
wfs=deque()
first=[[fx,fy],-1]
wfs.append(first)
if isSafe(wfs,safe):
print("OK")
else:
print("NA")
| Traceback (most recent call last):
File "/tmp/tmprys60tso/tmp6c9wux5m.py", line 39, in <module>
fx,fy=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s800037865 | p00122 | u672443148 | 1516415013 | Python | Python3 | py | Runtime Error | 0 | 0 | 1637 | from collections import deque
import copy
def makeList(splist,n):
for i in range(n):
springs=[]
springs.append(splist[i*2:i*2+2])
springs.append(i)
yield springs
def isSafe(wfs,safe):
while len(wfs)>0:
flog=wfs.popleft()
flogArea=[]
spn=flog[1]+1
for i in range(-1,2):
for j in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for j in range(-1,2):
for i in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for i in range(len(safe[spn])):
if safe[spn][i] in flogArea:
if spn==9:
return True
if spn<9:
wfs.append(safe[spn][i])
return False
while True:
fx,fy=map(int,input().split())
if fx==0 and fy==0:
break
n=int(input())
splist=list(map(int,input().split()))
safe=[]
k=makeList(splist,n)
for spring in k:
temp=[]
for i in range(-1,2):
for j in range(-1,2):
dw=spring[0][0]+i
dh=spring[0][1]+j
if dw>=0 and dw<10 and dh>=0 and dh<10:
temp.append([[dw,dh],spring[1]])
safe.append(temp)
wfs=deque()
first=[[fx,fy],-1]
wfs.append(first)
if isSafe(wfs,safe):
print("OK")
else:
print("NA")
| Traceback (most recent call last):
File "/tmp/tmp2gr_m8sb/tmpjb8weod9.py", line 39, in <module>
fx,fy=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s884599615 | p00122 | u672443148 | 1516415149 | Python | Python3 | py | Runtime Error | 0 | 0 | 1637 | from collections import deque
import copy
def makeList(splist,n):
for i in range(n):
springs=[]
springs.append(splist[i*2:i*2+2])
springs.append(i)
yield springs
def isSafe(wfs,safe):
while len(wfs)>0:
flog=wfs.popleft()
flogArea=[]
spn=flog[1]+1
for i in range(-1,2):
for j in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for j in range(-1,2):
for i in [-2,2]:
dx=flog[0][0]+j
dy=flog[0][1]+i
if dx>=0 and dx<10 and dy>=0 and dy<10:
flogArea.append([[dx,dy],spn])
for i in range(len(safe[spn])):
if safe[spn][i] in flogArea:
if spn==9:
return True
if spn<9:
wfs.append(safe[spn][i])
return False
while True:
fx,fy=map(int,input().split())
if fx==0 and fy==0:
break
n=int(input())
splist=list(map(int,input().split()))
safe=[]
k=makeList(splist,n)
for spring in k:
temp=[]
for i in range(-1,2):
for j in range(-1,2):
dw=spring[0][0]+i
dh=spring[0][1]+j
if dw>=0 and dw<10 and dh>=0 and dh<10:
temp.append([[dw,dh],spring[1]])
safe.append(temp)
wfs=deque()
first=[[fx,fy],-1]
wfs.append(first)
if isSafe(wfs,safe):
print("OK")
else:
print("NA")
| Traceback (most recent call last):
File "/tmp/tmplvr9hmo8/tmpdxaigjmi.py", line 39, in <module>
fx,fy=map(int,input().split())
^^^^^^^
EOFError: EOF when reading a line
| |
s332360160 | p00122 | u104911888 | 1373181101 | Python | Python | py | Runtime Error | 0 | 0 | 749 | mv=((2,0),(2,1),(2,-1),(-2,0),(-2,1),(-2,-1),
(0,2),(1,2),(-1,2),(0,-2),(1,-2),(-1,-2))
while True:
x,y=map(int,raw_input().split())
if x==y==0:break
n=input()
pos=map(int,raw_input().split())
pos=[(pos[2*i],pos[2*i+1]) for i in range(n)]
que=[(x,y,0)]
while que!=[]:
X,Y,p=que[0][0],que[0][1],que[0][2]
del que[0]
S=set()
if p>=10:
print "OK"
break
for k in range(-1,2):
for l in range(-1,2):
S.add((pos[p][0]+k,pos[p][1]+l,p+1))
for dx,dy in mv:
mx=X+dx
my=Y+dy
if 0<=mx<10 and 0<=my<10 and (mx,my,p+1) in S:
que.append((mx,my,p+1))
else:
print "NA" | File "/tmp/tmpdjaxehoi/tmput5e7pw9.py", line 17
print "OK"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s113296130 | p00123 | u440959703 | 1398524437 | Python | Python | py | Runtime Error | 0 | 0 | 415 | # -*- coding: utf-8 -*-
rank = ["AAA", "AA", "A", "B", "C", "D", "E"]
ref0 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
ref1 = [71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0]
while True:
try:
t1,t2 = map(float,input().split())
except EOFError:
break
#print(len(rank))
for i in range(len(rank)):
if t1 < ref0[i] and t2 < ref1[i]:
print(rank[i])
break
else:
print("NA")
| ||
s763861490 | p00123 | u440959703 | 1398524453 | Python | Python | py | Runtime Error | 0 | 0 | 415 | # -*- coding: utf-8 -*-
rank = ["AAA", "AA", "A", "B", "C", "D", "E"]
ref0 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
ref1 = [71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0]
while True:
try:
t1,t2 = map(float,input().split())
except EOFError:
break
#print(len(rank))
for i in range(len(rank)):
if t1 < ref0[i] and t2 < ref1[i]:
print(rank[i])
break
else:
print("NA")
| ||
s205546542 | p00124 | u873482706 | 1435757660 | Python | Python | py | Runtime Error | 0 | 0 | 437 | c = 1
while True:
N = int(raw_input())
if N == 0:
break
elif c != 1:
print ''
dic = {}
for i in range(N):
lis = raw_input().split()
name = lis[0]
lis = map(int, lis[1:])
point = lis[0]*3 + lis[2]
dic[name] = [point, N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
c += 1 | File "/tmp/tmpl5rtnk2i/tmp97qmd0yd.py", line 7
print ''
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s097618331 | p00124 | u873482706 | 1435758097 | Python | Python | py | Runtime Error | 0 | 0 | 399 | while True:
N = int(raw_input())
if N == 0:
break
dic = {}
for i in range(N):
lis = raw_input().split()
name = lis[0]
lis = map(int, lis[1:])
point = lis[0]*3 + lis[2]
dic[name] = [point, N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
print '' | File "/tmp/tmpi34u074i/tmpoa_5umqb.py", line 15
print '%s,%s' % (k, v[0])
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s924689744 | p00124 | u873482706 | 1435758811 | Python | Python | py | Runtime Error | 0 | 0 | 439 | c = 0
while True:
N = int(raw_input())
if N == 0:
break
elif c != 0:
print ''
dic = {}
for i in range(N):
lis = raw_input().split()
name = lis[0]
lis = map(int, lis[1:])
point = lis[0]*3 + lis[2]
dic[name] = [point, N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
c = 1 | File "/tmp/tmpjptdryle/tmpymqnjm2_.py", line 7
print ''
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s085591673 | p00124 | u873482706 | 1435759102 | Python | Python | py | Runtime Error | 0 | 0 | 437 | c = 0
while True:
N = int(raw_input())
if N == 0:
break
if c != 0:
print ''
dic = {}
for i in range(N):
lis = raw_input().split()
name = lis[0]
lis = map(int, lis[1:])
point = lis[0]*3 + lis[2]
dic[name] = [point, N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
c = 1 | File "/tmp/tmp3c1xnbj0/tmpd9d0ei18.py", line 7
print ''
^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s943926980 | p00124 | u873482706 | 1435759255 | Python | Python | py | Runtime Error | 0 | 0 | 434 | c = 0
while True:
N = int(raw_input())
if N == 0:
break
if c != 0:
print
dic = {}
for i in range(N):
lis = raw_input().split()
name = lis[0]
lis = map(int, lis[1:])
point = lis[0]*3 + lis[2]
dic[name] = [point, N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
c = 1 | File "/tmp/tmpk948yvip/tmpixqr28hj.py", line 18
print '%s,%s' % (k, v[0])
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s054335594 | p00124 | u873482706 | 1435759403 | Python | Python | py | Runtime Error | 0 | 0 | 386 | N = input()
while True:
dic = {}
for i in range(N):
lis = raw_input().split()
name = lis[0]
lis = map(int, lis[1:])
point = lis[0]*3 + lis[2]
dic[name] = [point, N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
N = input()
if N == 0: break
print | File "/tmp/tmpu3trruod/tmp6n7w6dxq.py", line 12
print '%s,%s' % (k, v[0])
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s396016034 | p00124 | u873482706 | 1435760237 | Python | Python | py | Runtime Error | 0 | 0 | 320 | N = input()
while True:
dic = {}
for i in range(N):
lis = raw_input().split()
dic[lis[0]] = [3*int(lis[1])+int(lis[3]), N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
N = input()
if N == 0: break
print | File "/tmp/tmp8wvlvof9/tmpqoivq6u_.py", line 9
print '%s,%s' % (k, v[0])
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s349716962 | p00124 | u873482706 | 1435760471 | Python | Python | py | Runtime Error | 0 | 0 | 323 | N = input()
while True:
dic = {}
for i in range(N):
lis = raw_input().split()
dic[lis[0]] = [3*int(lis[1])+int(lis[3]), N-i]
for k, v in sorted(dic.items(), key=lambda x: (x[0][0], x[0][1]), reverse=True):
print '%s,%s' % (k, v[0])
N = input()
if N == 0: break
print '' | File "/tmp/tmpddqrgu_r/tmp7y_ubdyy.py", line 9
print '%s,%s' % (k, v[0])
^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s265750961 | p00124 | u546285759 | 1488781731 | Python | Python3 | py | Runtime Error | 0 | 0 | 443 | b=False
while True:
n = int(input())
if n==0:break
d=dict()
if b:print()
b=True
for _ in range(n):
line = input().split()
tmp = int(line[1])*3+int(line[3]*1)
if tmp in d:
d[tmp].append(line[0])
else:
d[tmp] = []
d[tmp].append(line[0])
for k, vs in sorted(d.items(), key=lambda x: x[0])[::-1]:
for v in vs:
print('%s,%d'%(k, v)) | Traceback (most recent call last):
File "/tmp/tmpvlkfe8ne/tmp7do3h4v4.py", line 3, in <module>
n = int(input())
^^^^^^^
EOFError: EOF when reading a line
| |
s077270210 | p00124 | u633068244 | 1396533786 | Python | Python | py | Runtime Error | 0 | 0 | 232 | n=input()
while 1:
m=[raw_input().split() for i in range(n)]
p={}
for t in m:
p[t[0]] = 3*int(t[1])+1*int(t[3])
for k,v in sorted(p.items(),key=lambda x:x[1])[::-1]:
print "%s,%d"%(k,v)
c+=1
n=input()
if n==0:break
print | File "/tmp/tmpvo39zosh/tmprxfi8wf_.py", line 8
print "%s,%d"%(k,v)
^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s120149297 | p00125 | u912237403 | 1415428723 | Python | Python | py | Runtime Error | 0 | 0 | 239 | M=[0,1,-1,0,0,1,1,2,3,3,4,4]
def L(y,m):
if m<=2: y-=1
return y/4-y/100+y/400+M[m]
while 1:
x=map(int,raw_input().split(" "))
if any([e<0 for e in x]): break
a,b,c,d,e,f=x
ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b)
print ans | File "/tmp/tmpfowlykk0/tmpsv1l_4h9.py", line 11
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s936687485 | p00125 | u912237403 | 1415429101 | Python | Python | py | Runtime Error | 0 | 0 | 233 | M=[0,1,-1,0,0,1,1,2,3,3,4,4]
def L(y,m):
if m<=2: y-=1
return y/4-y/100+y/400+M[m]
while 1:
a,b,c,d,e,f=x=map(int,raw_input().split(" "))
if any([i<0 for i in x]): break
ans=(d-a)*365+(e-b)*30+f-c+L(d,e)-L(a,b)
print ans | File "/tmp/tmpmx9i2qiy/tmpp_d2htk2.py", line 10
print ans
^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s081400373 | p00126 | u912237403 | 1415444316 | Python | Python | py | Runtime Error | 0 | 0 | 460 | def f(A): return A.count(a)>1
R=[0,3,6]
N=range(9)
Z=[0]*9
n=input()
while n:
F=[[" " for _ in Z] for _ in Z]
M=[map(int,raw_input().split()) for _ in Z]
M1=[[M[y][x] for y in N] for x in N]
M2=[M[y][x:x+3]+M[y+1][x:x+3]+M[y+2][x:x+3] for y in R for x in R]
for y in N:
p0=y/3*3
for x in N:
a=A[x]
if any(map(f,[M[y],M1[x],M2[p0+x/3]])): F[y][x]="*"
print "".join([a+b for a,b in zip(F[y],map(str,A))])
if n>1: print
n-=1 | File "/tmp/tmppnr5jcj7/tmp5o4y09br.py", line 17
print "".join([a+b for a,b in zip(F[y],map(str,A))])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s827081349 | p00126 | u912237403 | 1415444341 | Python | Python | py | Runtime Error | 0 | 0 | 463 | def f(A): return A.count(a)>1
R=[0,3,6]
N=range(9)
Z=[0]*9
n=input()
while n:
F=[[" " for _ in Z] for _ in Z]
M=[map(int,raw_input().split()) for _ in Z]
M1=[[M[y][x] for y in N] for x in N]
M2=[M[y][x:x+3]+M[y+1][x:x+3]+M[y+2][x:x+3] for y in R for x in R]
for y in N:
p0=y/3*3
for x in N:
a=M[y][x]
if any(map(f,[M[y],M1[x],M2[p0+x/3]])): F[y][x]="*"
print "".join([a+b for a,b in zip(F[y],map(str,A))])
if n>1: print
n-=1 | File "/tmp/tmp2qe9bk9y/tmpxa3ve5_0.py", line 17
print "".join([a+b for a,b in zip(F[y],map(str,A))])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s726290308 | p00127 | u873482706 | 1435827541 | Python | Python | py | Runtime Error | 0 | 0 | 477 | import sys
s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
for t in range(1, 6):
d[(str(y),str(t))] = s[0]
s = s[1:]
for line in sys.stdin:
line = line.rstrip()
if len(line) % 2 != 0:
print 'NA'
continue
ans = ''
for i in range(0, len(line), 2):
if d[(line[i],line[i+1])]:
ans += d[(line[i],line[i+1])]
else:
print 'NA'
break
else:
print ans | File "/tmp/tmpvkhvtlet/tmp2alpf8y1.py", line 13
print 'NA'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s703987451 | p00127 | u873482706 | 1435827866 | Python | Python | py | Runtime Error | 0 | 0 | 495 | import sys
s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
for t in range(1, 6):
d[(str(y),str(t))] = s[0]
s = s[1:]
for line in sys.stdin:
line = line.rstrip()
if len(line) == 0 or len(line) % 2 != 0:
print 'NA'
continue
ans = ''
for i in range(0, len(line), 2):
if d[(line[i],line[i+1])]:
ans += d[(line[i],line[i+1])]
else:
print 'NA'
break
else:
print ans | File "/tmp/tmpcg7uvill/tmp82rf3aep.py", line 13
print 'NA'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s530051613 | p00127 | u873482706 | 1435828216 | Python | Python | py | Runtime Error | 0 | 0 | 566 | s = 'abcdefghijklmnopqrstuvwxyz.?! '
d = {}
for y in range(1, 7):
for t in range(1, 6):
d[(str(y),str(t))] = s[0]
s = s[1:]
while True:
try:
line = raw_input()
if len(line) == 0 or len(line) % 2 != 0:
print 'NA'
continue
ans = ''
for i in range(0, len(line), 2):
if d[(line[i],line[i+1])]:
ans += d[(line[i],line[i+1])]
else:
print 'NA'
break
else:
print ans
except EOFError:
break | File "/tmp/tmp12a96q94/tmpsxa7fx0v.py", line 12
print 'NA'
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s177263221 | p00127 | u957021183 | 1505454922 | Python | Python3 | py | Runtime Error | 0 | 0 | 549 | # Aizu Problem 00127: Pocket Pager Input
#
import sys, math, os, copy
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
code = {1: "afkpuz", 2: "ablqv.", 3: "chmrw?", 4: "dinsx!", 5: "ejoty "}
def pocket_pager(string):
if len(string) % 2 == 1:
return "NA"
res = ""
for k in range(len(string) // 2):
i = int(string[2*k])
j = int(string[2*k+1])
res += code[j][i-1]
return res
for line in sys.stdin:
print(pocket_pager(line.strip())) | ||
s795500515 | p00127 | u808429775 | 1517783278 | Python | Python3 | py | Runtime Error | 0 | 0 | 818 | import sys
convert = {"1": {"1": "a", "2": "b", "3": "c", "4": "d", "5": "e"},
"2": {"1": "f", "2": "g", "3": "h", "4": "i", "5": "j"},
"3": {"1": "k", "2": "l", "3": "m", "4": "n", "5": "o"},
"4": {"1": "p", "2": "q", "3": "r", "4": "s", "5": "t"},
"5": {"1": "u", "2": "v", "3": "w", "4": "x", "5": "y"},
"6": {"1": "z", "2": ".", "3": "?", "4": "!", "5": " "},
}
for line in sys.stdin:
line = line[:-1]
if len(line) % 2 != 0:
print("NA")
continue
message = ""
line = iter(line)
for first, second in zip(*[line, line]):
result = convert[first][second]
if result != None:
message += result
else:
print("NA")
break
else:
print(message)
| ||
s007473206 | p00127 | u808429775 | 1517783432 | Python | Python3 | py | Runtime Error | 0 | 0 | 826 | import sys
convert = {"1": {"1": "a", "2": "b", "3": "c", "4": "d", "5": "e"},
"2": {"1": "f", "2": "g", "3": "h", "4": "i", "5": "j"},
"3": {"1": "k", "2": "l", "3": "m", "4": "n", "5": "o"},
"4": {"1": "p", "2": "q", "3": "r", "4": "s", "5": "t"},
"5": {"1": "u", "2": "v", "3": "w", "4": "x", "5": "y"},
"6": {"1": "z", "2": ".", "3": "?", "4": "!", "5": " "},
}
for line in sys.stdin:
line = line[:-1]
if len(line) % 2 != 0:
print("NA")
continue
message = ""
line = iter(line)
for first, second in zip(*[line, line]):
result = convert.get(first).get(second)
if result != None:
message += result
else:
print("NA")
break
else:
print(message)
| ||
s136565974 | p00127 | u104911888 | 1369405881 | Python | Python | py | Runtime Error | 0 | 0 | 370 | import itertools
dic={"61":"z","62":".","63":"?","64":"!","65":" "}
cnt=ord("a")
for i in itertools.product(range(1,6),repeat=2):
dic["".join(map(str,i))]=chr(cnt)
cnt+=1
while True:
try:
s=raw_input()
except EOFError:
break
if len(s)%2!=0:
print "NA"
else:
print "".join(dic[s[i:i+2]] for i in range(0,len(s),2)) | File "/tmp/tmpr_yx8ldo/tmpjp3skc74.py", line 14
print "NA"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s862565694 | p00127 | u759934006 | 1373680024 | Python | Python | py | Runtime Error | 0 | 0 | 711 | from sys import stdout
cs = {
1: [None] + list("abcde"),
2: [None] + list("fghij"),
3: [None] + list("klmno"),
4: [None] + list("pqrst"),
5: [None] + list("uvwxy"),
6: [None] + list("z.?! "),
}
while True:
try:
it = iter(raw_input().strip())
except ValueError:
break
try:
r = c = None
s = []
while True:
r = int(it.next())
c = int(it.next())
s += [cs[r][c]]
r = c = None
except IndexError:
stdout.write("NA\n")
except StopIteration:
if not r and not c:
stdout.write(''.join(s) + "\n")
else:
stdout.write("NA\n")
continue | Traceback (most recent call last):
File "/tmp/tmpr5ml9_dm/tmp9kbz7qzp.py", line 14, in <module>
it = iter(raw_input().strip())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s722045536 | p00127 | u759934006 | 1373680063 | Python | Python | py | Runtime Error | 0 | 0 | 761 | from sys import stdout
cs = {
1: [None] + list("abcde"),
2: [None] + list("fghij"),
3: [None] + list("klmno"),
4: [None] + list("pqrst"),
5: [None] + list("uvwxy"),
6: [None] + list("z.?! "),
}
while True:
try:
it = iter(raw_input().strip())
except ValueError:
break
try:
r = c = None
s = []
while True:
r = int(it.next())
c = int(it.next())
s += [cs[r][c]]
r = c = None
except KeyError:
stdout.write("NA\n")
except IndexError:
stdout.write("NA\n")
except StopIteration:
if not r and not c:
stdout.write(''.join(s) + "\n")
else:
stdout.write("NA\n")
continue | Traceback (most recent call last):
File "/tmp/tmp_0eegrf7/tmp1qobzby1.py", line 14, in <module>
it = iter(raw_input().strip())
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s585654578 | p00127 | u647766105 | 1383401789 | Python | Python | py | Runtime Error | 0 | 0 | 409 | decode = ["afkpuz",
"bglqv.",
"chmrw?",
"dinsx!",
"ejoty "]
while True:
try:
line = raw_input()
except EOFError:
break
if len(line)%2 == 1:
print "NA"
continue
try:
print "".join(decode[j-1][i-1]
for i,j in zip(map(int,line[::2]),map(int,line[1::2])))
except KeyError:
print "NA" | File "/tmp/tmp49xvz7s7/tmpjtf1xoyf.py", line 12
print "NA"
^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s702687072 | p00128 | u912237403 | 1415448893 | Python | Python | py | Runtime Error | 0 | 0 | 275 | import sys
d={}
B1=['* =',' *=']
B2=[' ****','* ***','** **','*** *','**** ']
f=0
for i in range(9): d[str(i)]=B1[i/5]+B2[i%5]
for s in sys.stdin:
A=[d[e] for e in ('0'*5+s[:-1])[-5:]]
if f: print
for y in range(8): print "".join([A[x][y] for x in range(len(A))])
f=1 | File "/tmp/tmpcp9l8gc7/tmpnvxs62wz.py", line 10
for y in range(8): print "".join([A[x][y] for x in range(len(A))])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s666255224 | p00128 | u759934006 | 1373684846 | Python | Python | py | Runtime Error | 0 | 0 | 569 | from sys import stdout
def upper(n):
if n < 5:
return list("* ")
else:
return list(" *")
def lower(n):
m = n % 5
a = ['*'] * m + [' ']
a = a + ['*'] * (5 - len(a))
return a
def abacus(n):
return upper(n) + ['='] + lower(n)
while True:
try:
ns = map(int, ("0" + raw_input().strip())[-6:])
except EOFError:
break
ab = []
for n in ns:
ab.append(abacus(n))
for i in range(8):
for j in range(5):
stdout.write(ab[j][i])
stdout.write("\n")
print | Traceback (most recent call last):
File "/tmp/tmpn_rp1j2u/tmpv9qeq2rl.py", line 24, in <module>
ns = map(int, ("0" + raw_input().strip())[-6:])
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s158784048 | p00128 | u759934006 | 1373685023 | Python | Python | py | Runtime Error | 0 | 0 | 569 | from sys import stdout
def upper(n):
if n < 5:
return list("* ")
else:
return list(" *")
def lower(n):
m = n % 5
a = ['*'] * m + [' ']
a = a + ['*'] * (5 - len(a))
return a
def abacus(n):
return upper(n) + ['='] + lower(n)
while True:
try:
ns = map(int, ("0" + raw_input().strip())[-5:])
except EOFError:
break
ab = []
for n in ns:
ab.append(abacus(n))
for i in range(8):
for j in range(5):
stdout.write(ab[j][i])
stdout.write("\n")
print | Traceback (most recent call last):
File "/tmp/tmpga6sy6no/tmpxlmpi2sz.py", line 24, in <module>
ns = map(int, ("0" + raw_input().strip())[-5:])
^^^^^^^^^
NameError: name 'raw_input' is not defined
| |
s869390157 | p00128 | u759934006 | 1373685128 | Python | Python | py | Runtime Error | 0 | 0 | 560 | from sys import stdout
def upper(n):
if n < 5:
return list("* ")
else:
return list(" *")
def lower(n):
m = n % 5
a = ['*'] * m + [' ']
a = a + ['*'] * (5 - len(a))
return a
def abacus(n):
return upper(n) + ['='] + lower(n)
while True:
try:
ns = map(int, ('0' + raw_input().strip())[-5:])
except:
break
ab = []
for n in ns:
ab.append(abacus(n))
for i in range(8):
for j in range(5):
stdout.write(ab[j][i])
stdout.write("\n")
print | ||
s013921449 | p00128 | u260980560 | 1385269073 | Python | Python | py | Runtime Error | 0 | 0 | 288 | import sys
for s in sys.stdin.readlines():
n = s.zfill(5)
for i in xrange(2):
print "".join(["*" if int(n[j])-5*i in range(5) else " " for j in xrange(5)])
print "="*5
for i in xrange(5):
print "".join([" " if (int(n[j])%5)==i else "*" for j in xrange(5)]) | File "/tmp/tmpoomxnsik/tmpngmtd0qm.py", line 5
print "".join(["*" if int(n[j])-5*i in range(5) else " " for j in xrange(5)])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
| |
s181351588 | p00129 | u912237403 | 1415497175 | Python | Python | py | Runtime Error | 0 | 0 | 673 | import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def f(e1):
tx,ty,sx,sy=e1
x=[]
for e2 in WP:
wx,wy,r=e2
wt=[tx-wx,ty-wy]; rwt=R(wt)
sw=[wx-sx,wy-sy]; rsw=R(sw)
st=[tx-sx,ty-sy]; rst=R(st)
F=[rwt<r,rsw<r]
if F==[1,1]: c=1
elif F==[1,0] or F==[0,1]: c=0
elif F==[0,0]:
a=M.pi/2-M.acos(r/rsw)
b=M.acos((sw[0]*st[0]+sw[1]*st[1])/rsw/rst)
if (a>b or abs(a-b)<1e-6) and rst>(rsw**2-r**2)**.5: c=0
else: c=1
x.append(c)
return all(x)
while 1:
n=input()
if n==0: break
WP=I(n)
P=I(input())
for e in P: print ["Safe","Danger"][f(e)] | Traceback (most recent call last):
File "/tmp/tmp6imq0lnb/tmp_se345ka.py", line 24, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s962753345 | p00129 | u912237403 | 1415497925 | Python | Python | py | Runtime Error | 0 | 0 | 696 | import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def f(e1):
tx,ty,sx,sy=e1
x=[]
for e2 in WP:
wx,wy,r=e2
wt=[tx-wx,ty-wy]; rwt=R(wt)
sw=[wx-sx,wy-sy]; rsw=R(sw)
st=[tx-sx,ty-sy]; rst=R(st)
F=[rwt<r,rsw<r]
if rst==0: c=1
elif F==[1,1]: c=1
elif F==[1,0] or F==[0,1]: c=0
elif F==[0,0]:
a=M.pi/2-M.acos(r/rsw)
b=M.acos((sw[0]*st[0]+sw[1]*st[1])/rsw/rst)
if (a>=b or abs(a-b)<1e-6) and rst>=(rsw**2-r**2)**.5: c=0
else: c=1
x.append(c)
return all(x)
while 1:
n=input()
if n==0: break
WP=I(n)
P=I(input())
for e in P: print ["Safe","Danger"][f(e)] | Traceback (most recent call last):
File "/tmp/tmpluhxaj7k/tmp2hucsj0r.py", line 25, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s256220677 | p00129 | u912237403 | 1415501206 | Python | Python | py | Runtime Error | 0 | 0 | 718 | import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def C(a,b): return a>b or abs(a-b)<1e-6
def f(e1):
tx,ty,sx,sy=e1
x=[]
for e2 in WP:
wx,wy,r=e2
wt=[tx-wx,ty-wy]; rwt=R(wt)
sw=[wx-sx,wy-sy]; rsw=R(sw)
st=[tx-sx,ty-sy]; rst=R(st)
F=[rwt<r,rsw<r]
if rst==0: c=1
elif F==[1,1]: c=1
elif F==[1,0] or F==[0,1]: c=0
elif F==[0,0]:
a=M.pi/2-M.acos(r/rsw)
b=M.acos((sw[0]*st[0]+sw[1]*st[1])/rsw/rst)
if C(a,b) and C(rst**2,rsw**2-r**2): c=0
else: c=1
x.append(c)
return all(x)
while 1:
n=input()
if n==0: break
WP=I(n)
P=I(input())
for e in P: print ["Safe","Danger"][f(e)] | Traceback (most recent call last):
File "/tmp/tmp3dw97lxt/tmp5xl09yol.py", line 26, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
| |
s131503937 | p00129 | u912237403 | 1415501303 | Python | Python | py | Runtime Error | 0 | 0 | 728 | import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def C(a,b): return a>b or abs(a-b)<1e-6
def f(e1):
tx,ty,sx,sy=e1
x=[]
for e2 in WP:
wx,wy,r=e2
wt=[tx-wx,ty-wy]; rwt=R(wt)
sw=[wx-sx,wy-sy]; rsw=R(sw)
st=[tx-sx,ty-sy]; rst=R(st)
F=[rwt<r,rsw<r]
c=0
if rst==0: c=1
elif F==[1,1]: c=1
elif F==[1,0] or F==[0,1]: c=0
elif F==[0,0]:
a=M.pi/2-M.acos(r/rsw)
b=M.acos((sw[0]*st[0]+sw[1]*st[1])/rsw/rst)
# if C(a,b) and C(rst**2,rsw**2-r**2): c=0
# else: c=1
x.append(c)
return all(x)
while 1:
n=input()
if n==0: break
WP=I(n)
P=I(input())
for e in P: print ["Safe","Danger"][f(e)] | Traceback (most recent call last):
File "/tmp/tmp54h3lmal/tmpmjyx6a47.py", line 27, in <module>
n=input()
^^^^^^^
EOFError: EOF when reading a line
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.