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
s673009871
p00713
u685815919
1481271946
Python
Python
py
Runtime Error
40000
9868
772
import math while True: n=int(raw_input()) if n==0: break if n==1: raw_input() print 1 continue p=[] for _ in xrange(n): x,y=raw_input().split() p.append((float(x),float(y))) cs=[] for i in xrange(n-1): for j in xrange(i+1,n): v=(p[j][0]-p[i][0], p[j][1]-p[i][1]) l=math.sqrt(pow(v[0],2.0)+pow(v[1],2.0)) if l>2.0: continue r = math.sqrt(1.0-pow(l/2.0,2.0)) v=(v[0]/l*r, v[1]/l*r) m=((p[j][0]+p[i][0])/2.0, (p[j][1]+p[i][1])/2.0) cs.append((m[0]-v[1], m[1]+v[0])) cs.append((m[0]+v[1], m[1]-v[0])) maxCount=0 for c in cs: count=0 for d in p: if pow((c[0]-d[0]),2.0)+pow((c[1]-d[1]),2.0) <= 1.0000001: count+=1 if maxCount < count: maxCount = count print maxCount
File "/tmp/tmpx1r4kyv6/tmplki_ntk3.py", line 7 print 1 ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s753794503
p00713
u269391636
1529317106
Python
Python3
py
Runtime Error
0
0
747
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2) n = abs(p1-p2) t = r * 1j * ((1-r*2)**0.5/r) return(q + t, q - t) while(True): ans = 0 n = int(input()) ps = [] for _ in range(n): x,y = map(int,input().split()) ps.append(x+yj) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p1,p2 = cent(ps[i],ps[j]) if p1 != None: for m in range(n): if abs(p1-ps[m]) <= 1: ans1 += 1 if abs(p2-ps[m]) <= 1: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmpo8xulz6k/tmpv8boa_ir.py", line 13, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s833596879
p00713
u269391636
1529337625
Python
Python3
py
Runtime Error
0
0
789
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2)/2 n = abs(r) t = r * 1j * ((1-n**2)**0.5/n) return(q + t, q - t) while(True): ans = 0 n = int(input()) if n == 0: quit() ps = [] for _ in range(n): x,y = map(float,input().split()) ps.append(x+y*1j) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p1,p2 = cent(ps[i],ps[j]) if p1 != None: for m in range(n): if abs(p1-ps[m]) <= 1.001: ans1 += 1 if abs(p2-ps[m]) <= 1.001: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmpmb907mdb/tmpmuskct1z.py", line 13, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s868338305
p00713
u269391636
1529337842
Python
Python3
py
Runtime Error
0
0
789
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2)/2 n = abs(r) t = r * 1j * ((1-n**2)**0.5/n) return(q + t, q - t) while(True): ans = 1 n = int(input()) if n == 0: quit() ps = [] for _ in range(n): x,y = map(float,input().split()) ps.append(x+y*1j) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p1,p2 = cent(ps[i],ps[j]) if p1 != None: for m in range(n): if abs(p1-ps[m]) <= 1.001: ans1 += 1 if abs(p2-ps[m]) <= 1.001: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmpiu0f4qgd/tmpacbkc8m1.py", line 13, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s329048031
p00713
u467175809
1530264912
Python
Python
py
Runtime Error
0
0
1102
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) while True: N = input() if N == 0: break pos = [] for loop in range(N): S = map(float, raw_input().split()) pos.append(S) ans = 0 for i in range(N): for j in range(N): v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in range(N): if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print ans
File "/tmp/tmp_z3fkk2_/tmpvo3294aj.py", line 40 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s335330208
p00713
u467175809
1530265251
Python
Python
py
Runtime Error
0
0
1288
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) def func(): while True: N = input() if N == 0: break pos = [] for loop in range(N): S = map(float, raw_input().split()) pos.append(S) ans = 0 for i in range(N): for j in range(N): v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in range(N): if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) if ans == 53: return 0 print ans func()
File "/tmp/tmp8ybey9tj/tmptfq9bzwo.py", line 43 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s504332358
p00713
u467175809
1530265935
Python
Python
py
Runtime Error
0
0
1277
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) def func(): while True: N = input() if N == 0: break R = range(N) pos = [] for loop in R: S = map(float, raw_input().split()) pos.append(S) ans = 0 for i in R: for j in R: v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in R: if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print max(1, ans) if __name__ == '__main__': func()
File "/tmp/tmp4rt324nf/tmpaa4a3vvb.py", line 42 print max(1, ans) ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s680734073
p00713
u467175809
1530266091
Python
Python3
py
Runtime Error
0
0
1278
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) def func(): while True: N = input() if N == 0: break R = range(N) pos = [] for loop in R: S = map(float, raw_input().split()) pos.append(S) ans = 0 for i in R: for j in R: v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in R: if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print(max(1, ans)) if __name__ == '__main__': func()
Traceback (most recent call last): File "/tmp/tmpahgjtl1d/tmpnehvjll4.py", line 45, in <module> func() File "/tmp/tmpahgjtl1d/tmpnehvjll4.py", line 12, in func N = input() ^^^^^^^ EOFError: EOF when reading a line
s992197695
p00713
u467175809
1530266299
Python
Python3
py
Runtime Error
0
0
1285
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) def func(): while True: N = int(input()) if N == 0: break R = range(N) pos = [] for loop in R: S = list(map(float, input().split())) pos.append(S) ans = 0 for i in R: for j in R: v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in R: if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print(max(1, ans)) if __name__ == '__main__': func()
Traceback (most recent call last): File "/tmp/tmp4_aol_58/tmpqm9ucqp2.py", line 45, in <module> func() File "/tmp/tmp4_aol_58/tmpqm9ucqp2.py", line 12, in func N = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s889626725
p00713
u467175809
1530266641
Python
Python3
py
Runtime Error
0
0
1429
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) def func(): lst = [] while True: S = input() lst.append(S) if S == '0': break lst = list(reversed(lst)) while True: N = int(lst.pop()) if N == 0: break R = range(N) pos = [] for loop in R: S = list(map(float, lst.pop().split())) pos.append(S) ans = 0 for i in R: for j in R: v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in R: if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print(max(1, ans)) if __name__ == '__main__': func()
Traceback (most recent call last): File "/tmp/tmpn5azhevi/tmptmy2qqn5.py", line 52, in <module> func() File "/tmp/tmpn5azhevi/tmptmy2qqn5.py", line 13, in func S = input() ^^^^^^^ EOFError: EOF when reading a line
s477127082
p00713
u467175809
1530266705
Python
Python3
py
Runtime Error
0
0
1333
#!/usr/bin/env python import math def func(): lst = [] while True: S = input() lst.append(S) if S == '0': break lst = list(reversed(lst)) while True: N = int(lst.pop()) if N == 0: break R = range(N) pos = [] for loop in R: S = list(map(float, lst.pop().split())) pos.append(S) ans = 0 for i in R: for j in R: v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or norm == 0: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in R: if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print(max(1, ans)) if __name__ == '__main__': func()
Traceback (most recent call last): File "/tmp/tmpn3zrlrbc/tmpr34vfm0t.py", line 47, in <module> func() File "/tmp/tmpn3zrlrbc/tmpr34vfm0t.py", line 8, in func S = input() ^^^^^^^ EOFError: EOF when reading a line
s011781794
p00713
u467175809
1530267909
Python
Python3
py
Runtime Error
0
0
1433
#!/usr/bin/env python from collections import deque import itertools as it import sys import math sys.setrecursionlimit(1000000) def func(): lst = [] while True: S = input() lst.append(S) if S == '0': break lst = list(reversed(lst)) while True: N = int(lst.pop()) if N == 0: break pos = [] for loop in range(N): S = list(map(float, lst.pop().split())) pos.append(S) ans = 0 for i in range(N): for j in range(N): v = [pos[j][0] - pos[i][0], pos[j][1] - pos[i][1]] norm = math.sqrt(v[0] * v[0] + v[1] * v[1]) if norm > 2 or i == j: continue vn = [v[0] / norm, v[1] / norm] norm /= 2 norm2 = math.sqrt(1 - norm * norm) v90 = [-vn[1], vn[0]] cent = [pos[i][0] + v[0] / 2 + v90[0] * norm2, pos[i][1] + v[1] / 2 + v90[1] * norm2] S = 2 for k in range(N): if i == k or j == k: continue x = cent[0] - pos[k][0] y = cent[1] - pos[k][1] if x * x + y * y <= 1: S += 1 ans = max(S, ans) print(max(1, ans)) if __name__ == '__main__': func()
Traceback (most recent call last): File "/tmp/tmp83cs7vga/tmp7lyfgvvw.py", line 51, in <module> func() File "/tmp/tmp83cs7vga/tmp7lyfgvvw.py", line 13, in func S = input() ^^^^^^^ EOFError: EOF when reading a line
s510064682
p00713
u269391636
1530559889
Python
Python3
py
Runtime Error
0
0
794
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2)/2 n = abs(r) t = r * 1j * ((1-n**2)**0.5/n) return(q + t, q - t) while(True): ans = 1 n = int(input()) if n == 0: quit() ps = [] for _ in range(n): x,y = map(float,input().split()) ps.append(x+y*1j) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p_1,p_2 = cent(ps[i],ps[j]) if p_1 != None: for m in range(n): if abs(p_1-ps[m]) <= 1.001: ans1 += 1 if abs(p_2-ps[m]) <= 1.001: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmp2i5ew2jr/tmpqmw7fq9t.py", line 13, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s730563198
p00713
u269391636
1530559980
Python
Python3
py
Runtime Error
0
0
828
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2)/2 n = abs(r) t = r * 1j * ((1-n**2)**0.5/n) return(q + t, q - t) while(True): ans = 1 n = int(input()) if n == 0: quit() elif n == 1: print(1) ps = [] for _ in range(n): x,y = map(float,input().split()) ps.append(x+y*1j) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p_1,p_2 = cent(ps[i],ps[j]) if p_1 != None: for m in range(n): if abs(p_1-ps[m]) <= 1.001: ans1 += 1 if abs(p_2-ps[m]) <= 1.001: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmpxhxthn6s/tmpqivqvpbi.py", line 13, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s175181314
p00713
u269391636
1530560169
Python
Python3
py
Runtime Error
0
0
876
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2)/2 n = abs(r) if n == 0: return None,None t = r * 1j * ((1-n**2)**0.5/n) return(q + t, q - t) while(True): ans = 1 n = int(input()) if n == 0: quit() elif n == 1: print(1) ps = [] for _ in range(n): x,y = map(float,input().split()) ps.append(x+y*1j) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p_1,p_2 = cent(ps[i],ps[j]) if p_1 != None: for m in range(n): if abs(p_1-ps[m]) <= 1.001: ans1 += 1 if abs(p_2-ps[m]) <= 1.001: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmp9333xe8u/tmp8ou8pkn0.py", line 15, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s227291516
p00713
u269391636
1530560592
Python
Python3
py
Runtime Error
0
0
940
def cent(p1,p2): if abs(p1-p2) >= 2: return None,None else: q = (p1+p2)/2 r = (p1-p2)/2 n = abs(r) if n == 0: return None,None t = r * 1j * ((1-n**2)**0.5/n) return(q + t, q - t) def abs(x): return(((x.real) ** 2 + (x.imag) ** 2) ** 0.5) while(True): ans = 1 n = int(input()) if n == 0: quit() elif n == 1: print(1) ps = [] for _ in range(n): x,y = map(float,input().split()) ps.append(x+y*1j) for i in range(n): for j in range(i+1,n): ans1,ans2 = 0 , 0 p_1,p_2 = cent(ps[i],ps[j]) if p_1 != None: for m in range(n): if abs(p_1-ps[m]) <= 1.001: ans1 += 1 if abs(p_2-ps[m]) <= 1.001: ans2 += 1 ans = max(ans,ans1,ans2) print(ans)
Traceback (most recent call last): File "/tmp/tmpbc_5wdxz/tmpvcs45ftf.py", line 18, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s867185790
p00713
u633068244
1399890687
Python
Python
py
Runtime Error
39860
6164
342
import random ans = 0 while 1: n = input() if n == 0: break xy = [map(float,raw_input().split()) for i in range(n)] for r in range(20000): cx,cy = 10*random.random(),10*random.random() cur = 0 for i in range(n): x,y = xy[i] if (cx-x)**2 + (cy-y)**2 <= 1: cur += 1 if n - cur < ans: break ans = max(ans,cur) print ans
File "/tmp/tmptd29j_xr/tmpfzr5ty50.py", line 16 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s473453105
p00717
u338932851
1456231234
Python
Python
py
Runtime Error
0
0
1402
import sys while(True): n=int(raw_input()) if (n==0):break Map=[] for i in range(n+1): m=int(raw_input()) res=[] for j in range(m): x = map(int, sys.stdin.readline().replace('\n','').split(' ')) res.append(complex(x[0],x[1])) Map.append(res) for i in range(1,n+1): flag=True for k in range(4): for j in range(m): Map[0][j]*=1j success=True ox1=Map[0][0].real; oy1=Map[0][0].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][j].real - ox1 != Map[i][j].real -ox2): success=False; flag=False; break if (Map[0][j].imag - oy1 != Map[i][j].imag - oy2): success=False; flag=False; break if (success):print i; flag=False; break #if (not flag):break success=True ox1=Map[0][m-1].real; oy1=Map[0][m-1].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][m-1-j].real - ox1 !=Map[i][j].real -ox2): success=False; break if (Map[0][m-1-j].imag - oy1 != Map[i][j].imag -oy2): success=False; break if (success):print i; break print '+'*5
File "/tmp/tmp5psxnsem/tmpzxd2xjn1.py", line 31 if (success):print i; flag=False; break ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s738641828
p00717
u338932851
1456231454
Python
Python
py
Runtime Error
0
0
1402
import sys while(True): n=int(raw_input()) if (n==0):break Map=[] for i in range(n+1): m=int(raw_input()) res=[] for j in range(m): x = map(int, sys.stdin.readline().replace('\n','').split(' ')) res.append(complex(x[0],x[1])) Map.append(res) for i in range(1,n+1): flag=True for k in range(4): for j in range(m): Map[0][j]*=1j success=True ox1=Map[0][0].real; oy1=Map[0][0].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][j].real - ox1 != Map[i][j].real -ox2): success=False; flag=False; break if (Map[0][j].imag - oy1 != Map[i][j].imag - oy2): success=False; flag=False; break if (success):print i; flag=False; break #if (not flag):break success=True ox1=Map[0][m-1].real; oy1=Map[0][m-1].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][m-1-j].real - ox1 !=Map[i][j].real -ox2): success=False; break if (Map[0][m-1-j].imag - oy1 != Map[i][j].imag -oy2): success=False; break if (success):print i; break print '+'*5
File "/tmp/tmp623f0u67/tmp59wqe0xz.py", line 31 if (success):print i; flag=False; break ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s695771989
p00717
u338932851
1456231468
Python
Python
py
Runtime Error
0
0
1402
import sys while(True): n=int(raw_input()) if (n==0):break Map=[] for i in range(n+1): m=int(raw_input()) res=[] for j in range(m): x = map(int, sys.stdin.readline().replace('\n','').split(' ')) res.append(complex(x[0],x[1])) Map.append(res) for i in range(1,n+1): flag=True for k in range(4): for j in range(m): Map[0][j]*=1j success=True ox1=Map[0][0].real; oy1=Map[0][0].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][j].real - ox1 != Map[i][j].real -ox2): success=False; flag=False; break if (Map[0][j].imag - oy1 != Map[i][j].imag - oy2): success=False; flag=False; break if (success):print i; flag=False; break #if (not flag):break success=True ox1=Map[0][m-1].real; oy1=Map[0][m-1].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][m-1-j].real - ox1 !=Map[i][j].real -ox2): success=False; break if (Map[0][m-1-j].imag - oy1 != Map[i][j].imag -oy2): success=False; break if (success):print i; break print '+'*5
File "/tmp/tmpimjn1epb/tmpxenen3wz.py", line 31 if (success):print i; flag=False; break ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s275808440
p00717
u338932851
1456231621
Python
Python
py
Runtime Error
0
0
1402
import sys while(True): n=int(raw_input()) if (n==0):break Map=[] for i in range(n+1): m=int(raw_input()) res=[] for j in range(m): x = map(int, sys.stdin.readline().replace('\n','').split(' ')) res.append(complex(x[0],x[1])) Map.append(res) for i in range(1,n+1): flag=True for k in range(4): for j in range(m): Map[0][j]*=1j success=True ox1=Map[0][0].real; oy1=Map[0][0].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][j].real - ox1 != Map[i][j].real -ox2): success=False; flag=False; break if (Map[0][j].imag - oy1 != Map[i][j].imag - oy2): success=False; flag=False; break if (success):print i; flag=False; break #if (not flag):break success=True ox1=Map[0][m-1].real; oy1=Map[0][m-1].imag ox2=Map[i][0].real; oy2=Map[i][0].imag for j in range(m): if (Map[0][m-1-j].real - ox1 !=Map[i][j].real -ox2): success=False; break if (Map[0][m-1-j].imag - oy1 != Map[i][j].imag -oy2): success=False; break if (success):print i; break print '+'*5
File "/tmp/tmpco5w8an1/tmp1wh6_fcl.py", line 31 if (success):print i; flag=False; break ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s192468749
p00718
u328199937
1555848948
Python
Python
py
Runtime Error
0
0
1237
ans_list = [] n = int(input()) def mcxl2digit(s): ans = 0 dig = 1 for i in range(len(s)): if "2" <= s[i] <= "9": dig = int(s[i]) else: if s[i] == "m": key = 100 elif s[i] == "c": key = 100 elif s[i] == "x": key = 10 else: key = 1 ans += key * dig dig = 1 return ans def digit2mcxl(i): return_list = [] m = i // 1000 if m != 0 and m != 1: return_list.append(str(m)) if m != 0: return_list.append("m") i = i % 1000 c = i // 100 if c != 0 and c != 1: return_list.append(str(c)) if c != 0: return_list.append("c") i = i % 100 x = i // 10 if x != 0 and x != 1: return_list.append(str(x)) if x != 0: return_list.append("x") i = i % 10 l = i if l != 0 and l != 1: return_list.append(str(l)) if l != 0: return_list.append("l") return return_list for i in range(n): a, b = input().split() ans = (mcxl2digit(a) + mcxl2digit(b)) ans = digit2mcxl(ans) ans_list.append(ans) for i in ans_list: print("".join(i))
Traceback (most recent call last): File "/tmp/tmp7j8_9umv/tmpncfgbwy0.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s608000389
p00719
u352394527
1530788583
Python
Python3
py
Runtime Error
0
0
1061
from heapq import heappush, heappop from itertools import permutations INF = 10 ** 20 while True: n, m, p, a, b = map(int, input().split()) if n == 0: break a -= 1 b -= 1 tlst = list(map(int, input().split())) edges = [[] for _ in range(m)] for _ in range(p): x, y, z = map(int, input().split()) x -= 1 y -= 1 edges[x].append((z, y)) edges[y].append((z, x)) def search(lst): que = [] heappush(que, (0, 0, a)) costs = [[INF] * m for _ in range(n + 1)] costs[0][a] = 0 while que and lst: total, num, city = heappop(que) if num >= n: continue speed = lst[num] for dist, to in edges[city]: next_total = total + dist / speed if costs[num][to] > next_total: costs[num][to] = next_total heappush(que, (next_total, num + 1, to)) ret = min(costs[i][b] for i in range(n + 1)) return ret ans = INF for lst in permutations(tlst, n): ans = min(ans, search(lst)) if ans == INF: print("Impossible") else: print(ans)
Traceback (most recent call last): File "/tmp/tmppuvf81v0/tmp89rzha0b.py", line 6, in <module> n, m, p, a, b = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s732269518
p00721
u075842827
1499944379
Python
Python3
py
Runtime Error
40000
13104
2092
# -*- coding: utf-8 -*- import sys import subprocess import json import time import math import re import sqlite3 import random from queue import Queue dy = [0, 0, 1, -1] dx = [1, -1, 0, 0] INF = int(1e20) class Point: def __init__(self, y, x, distance = 0): self.y = y self.x = x self.distance = distance def ok(y, x): global w, h, visited_cnt return 0 <= y and y < h and 0 <= x and x < w def bfs(start, goal): global w, h, visited_cnt q = Queue() q.put(start) #print("start.distance =", start.distance) bfs_visited = [[False for _ in range(w)] for _ in range(h)] while not q.empty(): #print(bfs_visited) cur = q.get() #print("cur.y =", cur.y, "cur.x =", cur.x) if cur.y == goal.y and cur.x == goal.x: return cur.distance for i in range(4): next = Point(cur.y + dy[i], cur.x + dx[i], cur.distance + 1) if not ok(next.y, next.x): continue if bfs_visited[next.y][next.x]: continue if c[next.y][next.x] == 'x': continue bfs_visited[next.y][next.x] = True q.put(next) return INF def dfs(pre): global w, h, visited_cnt if visited_cnt == points.__len__(): return 0 res = int(1e80) for i in range(points.__len__()): if visited[i]: continue visited[i] = True visited_cnt += 1 res = min(res, dfs(points[i]) + bfs(pre, points[i])) visited[i] = False visited_cnt -= 1 return res while True: w, h = map(int, input().split()) if w == 0 and h == 0: exit(0) c = [list(input()) for _ in range(h)] points = [] visited = [False] * 15 visited_cnt = 0 for y in range(h): for x in range(w): if c[y][x] == 'o': start = Point(y, x) if c[y][x] == '*': points.append(Point(y, x)) #print(points.__len__()) ret = dfs(start) if ret < INF: print(ret) else: print(-1)
Traceback (most recent call last): File "/tmp/tmp77peefar/tmp79s6soe0.py", line 67, in <module> w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s743525753
p00721
u075842827
1499944587
Python
Python3
py
Runtime Error
40000
13096
2090
# -*- coding: utf-8 -*- import sys import subprocess import json import time import math import re import sqlite3 import random from queue import Queue dy = [0, 0, 1, -1] dx = [1, -1, 0, 0] INF = int(1e20) class Point: def __init__(self, y, x, distance = 0): self.y = y self.x = x self.distance = distance def ok(y, x): global w, h, visited_cnt return 0 <= y and y < h and 0 <= x and x < w def bfs(start, goal): global w, h, visited_cnt q = Queue() q.put(start) #print("start.distance =", start.distance) bfs_visited = [[False for _ in range(w)] for _ in range(h)] while not q.empty(): #print(bfs_visited) cur = q.get() #print("cur.y =", cur.y, "cur.x =", cur.x) if cur.y == goal.y and cur.x == goal.x: return cur.distance for i in range(4): next = Point(cur.y + dy[i], cur.x + dx[i], cur.distance + 1) if not ok(next.y, next.x): continue if bfs_visited[next.y][next.x]: continue if c[next.y][next.x] == 'x': continue bfs_visited[next.y][next.x] = True q.put(next) return INF def dfs(pre): global w, h, visited_cnt if visited_cnt == points.__len__(): return 0 res = int(1e80) for i in range(points.__len__()): if visited[i]: continue visited[i] = True visited_cnt += 1 res = min(res, dfs(points[i]) + bfs(pre, points[i])) visited[i] = False visited_cnt -= 1 return res while True: w, h = map(int, input().split()) if w == 0 and h == 0: break c = [list(input()) for _ in range(h)] points = [] visited = [False] * 15 visited_cnt = 0 for y in range(h): for x in range(w): if c[y][x] == 'o': start = Point(y, x) if c[y][x] == '*': points.append(Point(y, x)) #print(points.__len__()) ret = dfs(start) if ret < INF: print(ret) else: print(-1)
Traceback (most recent call last): File "/tmp/tmpuoivi12e/tmp55kaj88y.py", line 67, in <module> w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s482661657
p00721
u352394527
1529663735
Python
Python3
py
Runtime Error
0
0
1507
from heapq import heappush, heappop INF = 10 ** 20 direct = ((0, -1), (0, 1), (-1, 0), (1, 0)) def dist(fr, to, mp): que = [] heappush(que, (0, fr)) visited = [[False] * len(mp[0]) for _ in range(len(mp))] visited[fr[1]][fr[0]] = True while que: d, point = heappop(que) x, y = point for dx, dy in direct: nx, ny = x + dx, y + dy if (nx, ny) == to: return d + 1 if not visited[ny][nx] and mp[ny][nx] == ".": visited[ny][nx] = True heappush(que, (d + 1, (nx, ny))) else: return -1 def shortest(fr, rest, edges): if rest == []: return 0 ret = INF for d, to in edges[fr]: if to in rest: ret = min(ret, d + shortest(to, [i for i in rest if i != to], edges)) return ret while True: w, h = map(int, input().split()) if w == 0: break mp = ["x" + input() + "x" for _ in range(h)] mp.insert(0, "x" * (w + 2)) mp.append("x" * (w + 2)) stains = [] for y in range(1, h + 1): for x in range(1, w + 1): if mp[y][x] in ("*", "o"): stains.append((x, y)) stain_num = len(stains) edges = [[] for _ in range(stain_num)] miss_flag = False for i in range(stain_num): for j in range(i + 1, stain_num): fr = stains[i] to = stains[j] d = dist(fr, to, mp) if d == -1: miss_flag = True edges[i].append((d, j)) edges[j].append((d, i)) if miss_flag: print(-1) continue print(shortest(0, [i for i in range(1, stain_num)], edges))
Traceback (most recent call last): File "/tmp/tmpv4h0nbez/tmp5aj3cyqs.py", line 34, in <module> w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s259180139
p00721
u352394527
1529665299
Python
Python3
py
Runtime Error
0
0
1708
from heapq import heappush, heappop INF = 10 ** 10 direct = ((0, -1), (0, 1), (-1, 0), (1, 0)) def dist(fr, to, mp): que = [] heappush(que, (0, fr)) visited = [[False] * len(mp[0]) for _ in range(len(mp))] visited[fr[1]][fr[0]] = True while que: d, point = heappop(que) x, y = point for dx, dy in direct: nx, ny = x + dx, y + dy if (nx, ny) == to: return d + 1 if not visited[ny][nx] and mp[ny][nx] != "x": visited[ny][nx] = True heappush(que, (d + 1, (nx, ny))) else: return -1 def shortest(fr, rest, edges): if rest == set(): return 0 ret = INF for d, to in edges[fr]: if to in rest: score = d + shortest(to, rest - {to}, edges) if score < ret: ret = score return ret def main(): while True: w, h = map(int, input().split()) if w == 0: break mp = ["x" + input() + "x" for _ in range(h)] mp.insert(0, "x" * (w + 2)) mp.append("x" * (w + 2)) stains = [] for y in range(1, h + 1): for x in range(1, w + 1): if mp[y][x] == "*": stains.append((x, y)) elif mp[y][x] == "o": start = len(stains) stains.append((x, y)) stain_num = len(stains) edges = [[] for _ in range(stain_num)] miss_flag = False for i in range(stain_num): for j in range(i + 1, stain_num): fr = stains[i] to = stains[j] d = dist(fr, to, mp) if d == -1: miss_flag = True edges[i].append((d, j)) edges[j].append((d, i)) if miss_flag: print(-1) continue print(shortest(start, {i for i in range(stain_num) if i != start}, edges)) main()
Traceback (most recent call last): File "/tmp/tmpwn2reaxb/tmpn35aj1zv.py", line 70, in <module> main() File "/tmp/tmpwn2reaxb/tmpn35aj1zv.py", line 37, in main w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s728506655
p00721
u779627195
1354898045
Python
Python
py
Runtime Error
0
5068
1734
import sys from Queue import Queue R = lambda:map(int,raw_input().split()) MAX = 10000000 dirt = [] dx = [0,1,0,-1] dy = [1,0,-1,0] def CalcCost(start): global visited cost = [[MAX for j in xrange(w)] for i in xrange(h)] cost[start[1]][start[0]] = 0 q = Queue() q.put(start) while not q.empty(): p = q.get() for i in xrange(4): mx,my = p[0]+dx[i],p[1]+dy[i] if (0 <= mx < w) and (0 <= my < h) and (visited[my][mx] is False): #if (0 <= mx < w) and (0 <= my < h): if cost[p[1]][p[0]] + 1 < cost[my][mx]: cost[my][mx] = cost[p[1]][p[0]] + 1 q.put((mx,my)) return cost while 1: w,h = R() #cost = [[MAX for j in xrange(w)] for i in xrange(h)] visited = [[False for j in xrange(w)] for i in xrange(h)] if not(w or h): break for i in xrange(h): s = raw_input() for j in xrange(w): if s[j] == '.': pass elif s[j] == 'o': start = (j,i) elif s[j] == '*': dirt.append((j,i)) else: visited[i][j] = True distance = 0 isPossible = True while(dirt): c = CalcCost(start) tmp = MAX for i in xrange(len(dirt)): x,y = dirt[i][0],dirt[i][1] if c[y][x] == MAX: #print -1 distance = -1 isPossible = False break if tmp > c[y][x]: start = (x,y) tmp = c[y][x] if isPossible is False: break dirt.remove(start) distance += tmp print distance
File "/tmp/tmparesr0__/tmpfduc6435.py", line 63 print distance ^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s124692856
p00723
u338932851
1456382655
Python
Python
py
Runtime Error
0
0
530
=int(raw_input()) def comb(tr): l=len(tr) res=[] for i in range(l): head,tail=tr[i:],tr[:i] headrev=head[::-1] tailrev=tail[::-1] res.append(head+tail) res.append(headrev+tail) res.append(head+tailrev) res.append(headrev+tailrev) res.append(tail+head) res.append(tailrev+head) res.append(tail+headrev) res.append(tailrev+headrev) return len(set(res)) #return res for i in range(n): tr = raw_input() print comb(tr)
File "/tmp/tmp7fr7oa05/tmp703oh3pd.py", line 1 =int(raw_input()) ^ SyntaxError: invalid syntax
s439750820
p00724
u479246559
1381985764
Python
Python
py
Runtime Error
39870
4160
16
while(1): pass
s073973375
p00725
u488601719
1452678321
Python
Python
py
Runtime Error
0
0
1920
dx = [1, -1, 0, 0] dy = [0, 0, 1, -1] def dfs(x, y, cnt): global board, W, H, ans if ans <= cnt: return for i in range(4): mx, my = x, y mx += dx[i] my += dy[i] if 0 > mx or 0 > my or W <= mx or H <= my: continue if board[my][mx] == 1: continue while True: if board[my][mx] == 3: ans = cnt return mx += dx[i] mx += dy[i] if 0 > mx or 0 > my or W <= mx or H <= my: break if board[my][mx] == 1: board[my][mx] = 0 dfs(mx - dx[i], my - dy[i], cnt + 1) board[my][mx] = 1 break while True: W, H = map(int, raw_input().split()) if W == 0: break ans = 11 board = [map(int, raw_input().split()) for _ in range(H)] for y in range(H): for x in range(W): if board[y][x] == 2: sx, xy = x, y dfs(sx, sy, 1) print ans if ans < 11 else - 1 # dxy = zip([1,0,-1,0],[0,1,0,-1]) # def rec(x,y,t): # global ans # if t >= ans: return # for dx,dy in dxy: # nx,ny = x+dx,y+dy # while 0 <= nx < W and 0 <= ny < H: # if field[ny][nx] == 3: ans = t # elif field[ny][nx] == 1: # if abs(nx-x)+abs(ny-y) == 1: break # field[ny][nx] = 0 # rec(nx-dx,ny-dy,t+1) # field[ny][nx] = 1 # break # nx += dx; ny += dy # while True: # W, H = map(int, raw_input().split()) # if W == 0: # break # field = [map(int, raw_input().split()) for _ in range(H)] # for y in range(H): # for x in range(W): # if field[y][x] == 2: # sx, sy = x, y # ans = 11 # rec(sx, sy, 1) # print ans if ans < 11 else -1
File "/tmp/tmp5htqex1u/tmpc8igy7qw.py", line 49 print ans if ans < 11 else - 1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s861557926
p00725
u420446254
1520611286
Python
Python3
py
Runtime Error
0
0
1965
dx = [0, 1, 0, -1] dy = [1, 0, -1, 0] N_MOVE = 4 EMPTY = 0 ROCK = 1 START = 2 GOAL = 3 INF = 100000 def in_field(field, x, y): return y >=0 and y < len(field) and x >= 0 and x< len(field[0]) def move_to_rock(field, x, y, direction): while(True): x += dx[direction] y += dy[direction] if not in_field(field, x, y): return None elif field[y][x] == ROCK: x -= dx[direction] y -= dy[direction] break elif field[y][x] == GOAL: break return x, y def dfs(depth, field, x, y): if depth > 10: return None cost = INF for r in range(N_MOVE): nx, ny = x + dx[r], y + dy[r] if not in_field(field, nx, ny): continue if field[ny][nx] == ROCK: continue next_pos = move_to_rock(field, x, y, r) if next_pos is None: continue nx, ny = next_pos if field[ny][nx] == GOAL: return depth rock_pos_x, rock_pos_y = nx+dx[r], ny+dy[r] assert field[rock_pos_y][rock_pos_x] == ROCK field[rock_pos_y][rock_pos_x] = EMPTY result = dfs(depth+1, field, nx, ny) if result is not None: cost = min(cost, result) field[rock_pos_y][rock_pos_x] = ROCK return cost def find_start_pos(field): h = len(field) w = len(field[0]) for y in range(h): for x in range(w): if field[y][x] == START: return x, y return None # ? def solve(): w, h = map(int, input().split()) if w == 0 or h == 0: return None field = [] for y in range(h): field.append(list(map(int, input().split()))) x, y = find_start_pos(field) res = dfs(1, field, x, y) return res if __name__ == '__main__': while(True): answer = solve() if answer == INF: print(-1) else: print(answer)
Traceback (most recent call last): File "/tmp/tmpgjkpfsqk/tmpr2hm3cyz.py", line 82, in <module> answer = solve() ^^^^^^^ File "/tmp/tmpgjkpfsqk/tmpr2hm3cyz.py", line 69, in solve w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s508325891
p00725
u269391636
1529250637
Python
Python3
py
Runtime Error
0
0
3159
from queue import Queue as q from copy import deepcopy as cp def l_move(data): global flag field,n,i,j = data[0],data[1],data[2],data[3] if j == 0 or field[i][j-1] == 1 or n == 0: return(None) field[i] = cp(field[i]) while(j): if field[i][j-1] == 0: field[i][j] = 0 j -= 1 field[i][j] = 2 elif field[i][j-1] == 3: flag = True print(11-n) return(None) else: field[i][j-1] = 0 n -= 1 return([field,n,i,j]) return(None) def u_move(data): global x global flag field,n,i,j = data[0],data[1],data[2],data[3] if i == 0 or field[i-1][j] == 1 or n == 0: return(None) for _ in range(x): field[i][_] = cp(field[i][_]) while(i): if field[i-1][j] == 0: field[i][j] = 0 i -= 1 field[i][j] = 2 elif field[i-1][j] == 3: flag = True print(11-n) return(None) else: field[i-1][j] = 0 n -= 1 return([field,n,i,j]) return(None) def r_move(data): global flag field,n,i,j = data[0],data[1],data[2],data[3] global y if j == y-1 or field[i][j+1] == 1 or n == 0: return(None) field[i] = cp(field[i]) while(j < y-1): if field[i][j+1] == 0: field[i][j] = 0 j += 1 field[i][j] = 2 elif field[i][j+1] == 3: flag = True print(11-n) return(None) else: field[i][j+1] = 0 n -= 1 return([field,n,i,j]) return(None) def d_move(data): global flag field,n,i,j = data[0],data[1],data[2],data[3] global x if i == x-1 or field[i+1][j] == 1 or n == 0: return(None) for _ in range(x): field[i][_] = cp(field[i][_]) while(i < x-1): if field[i+1][j] == 0: field[i][j] = 0 i += 1 field[i][j] = 2 elif field[i+1][j] == 3: flag = True print(11-n) return(None) else: field[i+1][j] = 0 n -= 1 return([field,n,i,j]) return(None) while(True): flag = False y,x = map(int,input().split()) lis = q() if x == 0: break field = [] for i in range(x): field.append(list(map(int, input().split()))) for i in range(x): for j in range(y): if field[i][j] == 2: start_x, start_y = i,j data = [field,10,start_x,start_y] lis.put(data) while(lis.qsize()): d = lis.get() tmp = l_move(d) if flag: break if tmp != None: lis.put(tmp) tmp = u_move(d) if flag: break if tmp != None: lis.put(tmp) tmp = d_move(d) if flag: break if tmp != None: lis.put(tmp) tmp = r_move(d) if flag: break if tmp != None: lis.put(tmp) if not flag: print(-1)
Traceback (most recent call last): File "/tmp/tmpk1q_v0u7/tmp_nr1ys30.py", line 95, in <module> y,x = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s055716418
p00726
u467175809
1530260620
Python
Python
py
Runtime Error
0
0
1936
#!/usr/bin/env python from collections import deque import itertools as it import sys sys.setrecursionlimit(1000000) def check(c): return (ord(c) >= ord('0') and ord(c) <= ord('9')) while True: S1, S2 = raw_input().split() if S1 == '0': break N = int(S2) SS = '' flag = False for i in range(len(S1) - 1): SS += S1[i] if check(S1[i]) and not check(S1[i + 1]) and S1[i + 1] != '(': SS += '(' flag = True elif flag: SS += ')' flag = False SS += S1[len(S1) - 1] if flag: SS += ')' S1 = '(' + SS + ')' for i in range(26): S1 = S1.replace('(' + chr(ord('A') + i), '("' + chr(ord('A') + i)) S1 = S1.replace(chr(ord('A') + i) + ')', chr(ord('A') + i) + '")') S1 = S1[1:-1] S1 = S1.replace('(', ',') SS = '' for i in range(len(S1) - 1): SS += S1[i] if not check(S1[i]) and check(S1[i + 1]): SS += '(' flag = True SS += S1[len(S1) - 1] if check(S1[0]): SS = '(' + SS S1 = '(1, ' + SS + ')' S1 = S1.replace(')(', '),(') hoge = eval(S1) ans = 0 m = {} def func(obj): if type(obj) == type("hoge"): m[obj] = len(obj) return len(obj) num = obj[0] ret = 0 for i in range(1, len(obj)): ret += num * func(obj[i]) m[obj] = ret return ret def func2(obj, index): if type(obj) == type("hoge"): return obj[index] num = obj[0] S = m[obj] index %= S / num ret = 0 for i in range(1, len(obj)): ret += m[obj[i]] if ret > index: ret -= m[obj[i]] return func2(obj[i], index - ret) return '0' func(hoge) #print m if N >= m[hoge]: print '0' else: print func2(hoge, N)
File "/tmp/tmp5vyafibz/tmp1q50jxig.py", line 78 print '0' ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s844617717
p00726
u915761101
1369792428
Python
Python
py
Runtime Error
0
0
2624
#include <vector> #include <list> #include <map> #include <set> #include <stack> #include <queue> #include <deque> #include <algorithm> #include <utility> #include <functional> #include <sstream> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <climits> #include <cassert> using namespace std; inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) const double EPS = 1e-10; const double PI = acos(-1.0); struct node{ int number; string letters; vector<node> children; char get_char(int index,int &pos){ int remain=index-pos+1; if(letters!=""){ if(letters.size()>=remain){ return letters[remain-1]; }else{ pos+=letters.size(); return '\0'; } }else{ REP(i,number){ REP(j,children.size()){ char c=children[j].get_char(index,pos); if(c!='\0'){ return c; } } } return '\0'; } } }; int number(string &s,int &pos){ int ret=0; while(isdigit(s[pos])){ ret*=10; ret+=s[pos]-'0'; pos++; } return ret; } string letters(string &s,int &pos){ string ret; while(isalpha(s[pos])){ ret+=s[pos]; pos++; } return ret; } void lp(string &s,int &pos){ assert(s[pos]=='('); pos++; } void rp(string &s,int &pos){ assert(s[pos]==')'); pos++; } string letter(string &s,int &pos){ assert(isalpha(s[pos])); string ret; ret+=s[pos]; pos++; return ret; } vector<node> nodes(string &s,int &pos){ vector<node> ret; while(pos<s.size()){ if(isdigit(s[pos])){ node nod; nod.number=number(s,pos); if(s[pos]=='('){ lp(s,pos); nod.children=nodes(s,pos); rp(s,pos); }else{ node c; c.letters=letter(s,pos); nod.children.push_back(c); } ret.push_back(nod); }else if(isalpha(s[pos])){ node nod; nod.letters=letters(s,pos); ret.push_back(nod); }else{ break; } } return ret; } int main(){ string s; int index; while(cin>>s>>index,s!="0"||index){ int pos=0; vector<node> roots=nodes(s,pos); pos=0; REP(i,roots.size()){ char c=roots[i].get_char(index,pos); if(c!='\0'){ cout<<c<<endl; goto next; } } cout<<0<<endl; next:; } }
File "/tmp/tmp9drj3n_6/tmphxvdqzsj.py", line 22 using namespace std; ^^^^^^^^^ SyntaxError: invalid syntax
s107458242
p00728
u637657888
1555918536
Python
Python3
py
Runtime Error
0
0
462
def tax(p,x): return p*(100+x) // 100 # 整数除算 def solve(X,Y,S): for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: # 新税でのtax(a,Y)+tax(b,Y) について検討 if sum > S: break # b増加ならばsum増加のため1 return best while True: X,Y,S = map(int, input().strip().split('')) if X == 0: break print(solve(X,Y,S))
Traceback (most recent call last): File "/tmp/tmpsewtbuyx/tmpuz8bdcmq.py", line 14, in <module> X,Y,S = map(int, input().strip().split('')) ^^^^^^^ EOFError: EOF when reading a line
s867441398
p00728
u637657888
1555918601
Python
Python3
py
Runtime Error
0
0
458
def tax(p,x): return p*(100+x) // 100 # 整数除算 def solve(X,Y,S): for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: # 新税でのtax(a,Y)+tax(b,Y) について検討 if sum > S: break # b増加ならばsum増加のため1 return best while True: X,Y,S = map(int, input().strip().split('')) if X == 0: break print(solve(X,Y,S))
File "/tmp/tmp1lttt1h8/tmpy9h1mlju.py", line 9 if sum > S: ^ IndentationError: expected an indented block after 'if' statement on line 7
s951850917
p00728
u637657888
1555919011
Python
Python3
py
Runtime Error
0
0
454
def tax(p,x): return p*(100+x) // 100 # 整数除算 def solve(X,Y,S): for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: # 新税でのtax(a,Y)+tax(b,Y) について検討 if sum > S: break # b増加ならばsum増加のため1 return best while True: X,Y,S = map(int, input().strip().split('')) if X == 0: break print(solve(X,Y,S))
File "/tmp/tmp9rl9u3cf/tmpnq0xvgvb.py", line 9 if sum > S: ^ IndentationError: expected an indented block after 'if' statement on line 7
s940243098
p00728
u637657888
1555919112
Python
Python3
py
Runtime Error
0
0
348
def tax(p,x): return p*(100+x) // 100 def solve(X,Y,S): for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: if sum > S: break return best while True: X,Y,S = map(int, input().strip().split('')) if X == 0: break print(solve(X,Y,S))
File "/tmp/tmp9hr4z23n/tmp90pamke_.py", line 8 if sum > S: ^ IndentationError: expected an indented block after 'if' statement on line 7
s732253592
p00728
u637657888
1555919187
Python
Python3
py
Runtime Error
0
0
383
def tax(p,x): return p*(100+x) // 100 def solve(X,Y,S): for a in range(1,S): for b in range(1,S): sum = tax(a,X)+tax(b,X) if sum == S: tax(a,Y)+tax(b,Y) if sum > S: break return best while True: X,Y,S = map(int, input().strip().split('')) if X == 0: break print(solve(X,Y,S))
Traceback (most recent call last): File "/tmp/tmp6jm0jajk/tmppfdjrz23.py", line 13, in <module> X,Y,S = map(int, input().strip().split('')) ^^^^^^^ EOFError: EOF when reading a line
s948026000
p00728
u715278210
1556601781
Python
Python3
py
Runtime Error
0
0
499
while True: #審判の数 n = int(input()) if n == 0: break while n >= 3 and n <= 100: #審判の数は3〜100人 a = [0]*n #空いてる配列 for i in range(n): #空いてる配列に点数を入れる s = int(input()) a[i] = s tensu = (sum(a) - min(a) -max(a))/(len(a)-2) #一番でかい点数と一番小さい点数は一つずつ引いて平均 print(int(tensu)) #平均点!
Traceback (most recent call last): File "/tmp/tmp25euda7k/tmpr464l31g.py", line 3, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s798557269
p00728
u966364923
1419211759
Python
Python3
py
Runtime Error
0
0
175
while True: n = int(input()) if n == 0: exit() score = [] for i in range(n): score.append(int(input())) print((sorted(score)[1:-1])//(n-2))
Traceback (most recent call last): File "/tmp/tmp56_a4t0l/tmp5lsa3ice.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s764615521
p00728
u124909914
1423116236
Python
Python
py
Runtime Error
0
0
306
#!/usr/bin/python3 from math import floor while True: n = eval(input()) if n != 0: ls = [] for i in range(n): m = eval(input()) ls.append(m) ls.remove(max(ls)) ls.remove(min(ls)) print(floor(sum(ls)/len(ls))) else: break
Traceback (most recent call last): File "/tmp/tmplx79i5xc/tmpxgvm54ri.py", line 6, in <module> n = eval(input()) ^^^^^^^ EOFError: EOF when reading a line
s809153147
p00728
u124909914
1424151886
Python
Python
py
Runtime Error
0
0
306
#!/usr/bin/python3 from math import floor while True: n = eval(input()) if n != 0: ls = [] for i in range(n): m = eval(input()) ls.append(m) ls.remove(max(ls)) ls.remove(min(ls)) print(floor(sum(ls)/len(ls))) else: break
Traceback (most recent call last): File "/tmp/tmpou2vp9r5/tmpd95h_xzf.py", line 6, in <module> n = eval(input()) ^^^^^^^ EOFError: EOF when reading a line
s522543596
p00728
u531061483
1432717907
Python
Python
py
Runtime Error
0
0
341
# -*- coding:utf-8 -*- #ICPC得点集計ソフトウェア import sys def solve(n): nums = [] for i in xrange(n): temp = input() nums.append(temp) nums.sort() sum = 0 for i in xrange(1,n-1): sum += nums[i] return sum / (n-2) if __name__ == "__main__": while : N = input() if N == 0: sys.exit() else: print solve(N)
File "/tmp/tmp7kc8bakz/tmp9leo4kra.py", line 17 while : ^ SyntaxError: invalid syntax
s621319548
p00728
u110278902
1445843198
Python
Python
py
Runtime Error
0
0
1039
import sys import math def load_file(file_name): f = open(file_name) lines = f.readlines() f.close() return lines def change_type(lines): new_line = [] for line in lines: new_line.append(int(line)) return new_line def make_group(lines): group = [] number = lines[0] lines.remove(lines[0]) i = 0 while i < number: group.append(lines[0]) lines.remove(lines[0]) i += 1 return (lines, group) def get_average(group): max_score = max(group) min_score = min(group) group.remove(max_score) group.remove(min_score) average = int(math.floor(sum(group)/len(group))) return average def main(argv): lines = load_file('sample_score.txt') #for line in lines: #print line groups = [] lines = change_type(lines) while lines[0] != 0: lines, group = make_group(lines) groups.append(group) for group in groups: print get_average(group) if __name__ == '__main__': main(sys.argv[1:])
File "/tmp/tmpvusj92ry/tmph53gwbf6.py", line 48 print get_average(group) ^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s285787318
p00728
u110278902
1445869974
Python
Python3
py
Runtime Error
0
0
308
# -*- coding: utf-8 -*- import math def main(n): scores = [] for i in range(n): scores.append(int(raw_input)) scores.remove(max(scores)) scores.remove(min(scores)) print math.floor(sum(scores)/len(scores)) while 1: n = int(raw_input) if n == 0: break main(n)
File "/tmp/tmpqtxxd3js/tmp0_m1zgkz.py", line 10 print math.floor(sum(scores)/len(scores)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s963640734
p00728
u110278902
1445869984
Python
Python
py
Runtime Error
0
0
308
# -*- coding: utf-8 -*- import math def main(n): scores = [] for i in range(n): scores.append(int(raw_input)) scores.remove(max(scores)) scores.remove(min(scores)) print math.floor(sum(scores)/len(scores)) while 1: n = int(raw_input) if n == 0: break main(n)
File "/tmp/tmpbnrfubhp/tmpealhgxd2.py", line 10 print math.floor(sum(scores)/len(scores)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s967919736
p00728
u146816547
1471335782
Python
Python
py
Runtime Error
0
0
172
while True: n = int(raw_input()) if n == 0: break l = [] for i in range(n): l.append(int(raw_input()) print (sum(l) - max(l) - min(l)) / (len(l) - 2)
File "/tmp/tmplt53_53i/tmpd_50rjp4.py", line 11 l.append(int(raw_input()) ^ SyntaxError: '(' was never closed
s794636085
p00728
u166860661
1480775198
Python
Python
py
Runtime Error
0
0
469
#coding: utf-8 import sys import math l = [] for line in sys.stdin: l.append(int(line)) check = 0 point_list = [] for i in range(len(l)): if check == 0: last_row = i + l[n] check = 1 continue else: point_list.append(i) if i == last_row: point_list.sort() point_list = point_list[1:-1] ave = sum(point_list)/len(point_list) print math.floor(ave) check = 0
File "/tmp/tmp2c5q733r/tmpf3c4j71w.py", line 23 print math.floor(ave) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s526705253
p00728
u166860661
1480775241
Python
Python
py
Runtime Error
0
0
469
#coding: utf-8 import sys import math l = [] for line in sys.stdin: l.append(int(line)) check = 0 point_list = [] for i in range(len(l)): if check == 0: last_row = i + l[i] check = 1 continue else: point_list.append(i) if i == last_row: point_list.sort() point_list = point_list[1:-1] ave = sum(point_list)/len(point_list) print math.floor(ave) check = 0
File "/tmp/tmpzakag_jv/tmpzn_8rf0x.py", line 23 print math.floor(ave) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s059467529
p00728
u166860661
1480775589
Python
Python
py
Runtime Error
0
0
463
#coding: utf-8 import sys import math l = [] for line in sys.stdin: l.append(int(line)) check = 0 point_list = [] for i in range(len(l)): if check == 0: last_row = i + l[i] check = 1 else: point_list.append(i) if i == last_row: point_list.sort() point_list = point_list[1:-1] ave = sum(point_list)*1.0 / len(point_list) print int(math.floor(ave)) check = 0
File "/tmp/tmp1s26ukp9/tmpiix5uoxa.py", line 22 print int(math.floor(ave)) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s006766954
p00728
u166860661
1480775846
Python
Python
py
Runtime Error
0
0
465
#coding: utf-8 import sys import math l = [] for line in sys.stdin: l.append(int(line)) check = 0 point_list = [] for i in range(len(l)-1): if check == 0: last_row = i + l[i] check = 1 else: point_list.append(i) if i == last_row: point_list.sort() point_list = point_list[1:-1] ave = sum(point_list)*1.0 / len(point_list) print int(math.floor(ave)) check = 0
File "/tmp/tmp38e2l1h0/tmppqfv0k01.py", line 22 print int(math.floor(ave)) ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s658259798
p00728
u501510481
1500005692
Python
Python
py
Runtime Error
0
0
26
str=readlines() print(str)
Traceback (most recent call last): File "/tmp/tmp4uj7ywej/tmp7x4s4ivs.py", line 1, in <module> str=readlines() ^^^^^^^^^ NameError: name 'readlines' is not defined
s535565034
p00728
u501510481
1500005775
Python
Python
py
Runtime Error
0
0
39
str=readlines() print(str) print("aaa")
Traceback (most recent call last): File "/tmp/tmpkuhrgj6m/tmpt1g2jzwt.py", line 1, in <module> str=readlines() ^^^^^^^^^ NameError: name 'readlines' is not defined
s049866921
p00728
u501510481
1500005873
Python
Python
py
Runtime Error
0
0
34
str=read() print(str) print("aaa")
Traceback (most recent call last): File "/tmp/tmpnz1d85uj/tmpkve20ssm.py", line 1, in <module> str=read() ^^^^ NameError: name 'read' is not defined
s348884923
p00728
u166871988
1502700399
Python
Python3
py
Runtime Error
0
0
229
while True: n=int(input()) points=[] for i in range(n): points.append(int(input())) points.remove(max(points)) points.remove(min(points)) print(sum(points)/len(points)) if int(input())==0:break
Traceback (most recent call last): File "/tmp/tmpd4nvwtny/tmp__zd_3sj.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s975650445
p00728
u166871988
1502700570
Python
Python3
py
Runtime Error
0
0
234
while True: n=int(input()) points=[] for i in range(n): points.append(int(input())) points.remove(max(points)) points.remove(min(points)) print(int(sum(points)/len(points))) if int(input())==0:break
Traceback (most recent call last): File "/tmp/tmpd8rq90pn/tmp812vmpr9.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s798125115
p00728
u146816547
1523084859
Python
Python
py
Runtime Error
0
0
158
while True: n = int(raw_input()) if !n: break L = [int(raw_input()) for _ in range(n)] print (sum(L) - max(L) - min(L)) / (n - 2)
File "/tmp/tmp3nf3cnm4/tmpdexr20zw.py", line 4 if !n: ^ SyntaxError: invalid syntax
s540217851
p00728
u878596989
1523845791
Python
Python3
py
Runtime Error
0
0
183
while True: N = int(input()) if 3 N == 0: break S = [] for i in range(N): S.append(int(input())) print((sum(S) - max(S) - min(S))//(len(S)-2))
File "/tmp/tmphn8tfj8v/tmp00ee_lmd.py", line 3 if 3 ^ SyntaxError: expected ':'
s121351641
p00728
u925259339
1526552585
Python
Python3
py
Runtime Error
0
0
327
import math def main(): f = true r = [] while f: n = int(input()) if n == 0: break m = [] for i in range(n): m.append(int(input())) r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))) res = '' for j in r: res += str(j) print(j)
File "/tmp/tmpt5k94124/tmpl9blp_3o.py", line 13 r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))) ^ SyntaxError: '(' was never closed
s565583700
p00728
u925259339
1526552712
Python
Python3
py
Runtime Error
0
0
340
import math def main(): f = true r = [] while f: n = int(input()) if n == 0: break m = [] for i in range(n): m.append(int(input())) r.append(math.floor((sum(m) - max(m) - min(m)/(n-2)))) res = '' for j in r: res += str(j) print(j) main()
Traceback (most recent call last): File "/tmp/tmpxebkm_yp/tmpo8y8addd.py", line 19, in <module> main() File "/tmp/tmpxebkm_yp/tmpo8y8addd.py", line 4, in main f = true ^^^^ NameError: name 'true' is not defined. Did you mean: 'True'?
s760344975
p00728
u703446356
1400595802
Python
Python
py
Runtime Error
0
0
241
while(True): n = input() if n == 0: break; sl = 1001 sh = 0 ret = 0 for i in range(n): tmp = input() sum += tmp if tmp < sl: sl = tmp if tmp > sh: sh = tmp ret -= (sl + sh) print "%d" % (ret/n)
File "/tmp/tmp6fwfqthz/tmpgb_c2958.py", line 16 print "%d" % (ret/n) ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s492839760
p00729
u120360464
1424167843
Python
Python
py
Runtime Error
0
0
914
#! /usr/bin/python # -*- coding: utf-8 -*- from bisect import * while 1: (N, M) = map(int, raw_input().split()) if N == 0: break r = int(raw_input()) used = [0]*(N+1) imos = [[0]*1301 for i in range(1001)] for i in range(r): (t, n, m, s) = map(int, raw_input().split()) if s == 1 and used[n] == 0: used[n] = m imos[m][t] = 1 if s == 0 and used[n] == m: used[n] = 0 imos[m][t] = -1 q = int(raw_input()) for i in range(q): (qs, qe, user) = map(int, raw_input().split()) tmp = 0 ans = 0 for j in range(540, 1261): #if imos[user][j] == 1: # tmp += 1 if tmp > 0 and j > qs and j <= qe: ans += 1 tmp += imos[user][j] #if imos[user][j] == -1: # tmp -= 1 print ans
File "/tmp/tmpj2_hq_73/tmpu8i0o43f.py", line 34 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s397270658
p00729
u120360464
1424168993
Python
Python
py
Runtime Error
0
0
1047
#! /usr/bin/python # -*- coding: utf-8 -*- from bisect import * while 1: (N, M) = map(int, raw_input().split()) if N == 0: break r = int(raw_input()) used = [0]*(N+1) imos = [[0]*1301 for i in range(M+1)] for i in range(r): (t, n, m, s) = map(int, raw_input().split()) if s == 1 and used[n] == 0: used[n] = m imos[m][t] = 1 if s == 0 and used[n] == m: used[n] = 0 imos[m][t] -= 1 #if imos[m][t] > 0: # imos[m][t] -= 1 #else: # imos[m][t] = -1 q = int(raw_input()) for i in range(q): cnt += 1 (qs, qe, user) = map(int, raw_input().split()) tmp = 0 ans = 0 for j in range(540, 1261): #if imos[user][j] == 1: # tmp += 1 if tmp > 0 and j > qs and j <= qe: ans += 1 tmp += imos[user][j] #if imos[user][j] == -1: # tmp -= 1 print ans
File "/tmp/tmpg8jyv7za/tmptnb42r48.py", line 39 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s303919739
p00730
u328199937
1555834296
Python
Python3
py
Runtime Error
0
0
1254
ans_list = [] def make_pieces(w, d, s): s %= (2 * w + 2 * d) while True: if w > s: return [s, d], [w - s, d] s -= w if d > s: return [w, s], [w, d - s] s -= d if w > s: return [w - s, d], [s, d] s -= w if d > s: return [w, s], [w, d - s] s -= d while True: n, w, d = map(int, input().split()) P = [[w, d]] if n == 0 and w == 0 and d == 0: break for i in range(n): p, s = map(int, input().split()) new_pieces = make_pieces(P[p - 1][0], P[p - 1][1], s) #print(new_pieces) if new_pieces[0][0] * new_pieces[0][1] < new_pieces[1][0] * new_pieces[1][1]: P = P[:p - 1] + [new_pieces[0]] + [new_pieces[1]] + P[p:] else: P = P[:p - 1] + [new_pieces[1]] + [new_pieces[0]] + P[p:] #print(P) S_list = [] for i in P: S_list.append(i[0] * i[1]) S_list.sort() ans_list.append(S_list) for i in range(len(ans_list)): I = ans_list[i] for j in range(len(I)): J = I[j] if i == len(ans_list) - 1 and j == len(I) - 1: print(J, end = "") else: print(J, end = " ") print()
Traceback (most recent call last): File "/tmp/tmprcbw2hk2/tmpmks765_x.py", line 20, in <module> n, w, d = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s489118814
p00730
u802625365
1474775048
Python
Python3
py
Runtime Error
0
0
774
def cut(cake,s): ret_cake = [(0,0),(0,0)] w = cake[2] h = cake[1] s %= 2*(w+h) if w > s: ret_cake = [(h,s),(h,w-s)] elif w+h > s: ret_cake = [(s-w,w),(w+h-s,w)] elif 2*w+h > s: ret_cake = [(s-w-h,w),(2*w+h-s,w)] elif 2*w+2*h > s: ret_cake = [(s-2*w-h,w),(2*w+2*h-s,w)] return [ (c[0]*c[1],c[0],c[1]) for c in ret_cake] while True: n,w,d = map(int,input().split()) if n == 0 and w == 0 and d == 0: break p = [0] * n s = [0] * n for i in range(n): p[i],s[i] = map(int,input().split()) cake = [ (w*d,d,w) ] for i in range(n): cake = cake[:p[i]-1] + cake[p[i]:] + cut(cake[p[i]-1],s[i]) cake.sort() print( " ".join(map(str,[c[0] for c in cake])))
Traceback (most recent call last): File "/tmp/tmpsl3jz4c2/tmpcnc0a9h2.py", line 18, in <module> n,w,d = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s157074756
p00730
u408260374
1493918652
Python
Python3
py
Runtime Error
0
0
783
def cut(d, w, s): s %= 2 * (d + w) sq = [] if 0 < s < w: sq = [(d, s), (d, w - s)] elif w < s < w + d: s -= w sq = [(s, w), (d - s, w)] elif w + d < s < 2 * w + d: s -= w + d sq = [(d, s), (d, w - s)] elif 2 * w + d < s < 2 * (w + d): s -= 2 * w + d sq = [(s, w), (d - s, w)] else: assert(False) p1, p2 = sq if p1[0] * p1[1] > p2[0] * p2[1]: p1, p2 = p2, p1 return p1, p2 while True: N, W, D = map(int, input().split()) if not (N | W | D): break square = [(D, W)] for _ in range(N): p, s = map(int, input().split()) square[p - 1], p1 = cut(*square[p - 1], s) square.append(p1) print(*sorted(d * w for d, w in square))
Traceback (most recent call last): File "/tmp/tmpcl99__r8/tmp6ejmlaa1.py", line 24, in <module> N, W, D = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s501569513
p00730
u408260374
1493919445
Python
Python3
py
Runtime Error
0
0
758
def cut(d, w, s): s %= 2 * (d + w) sq = [] if 0 < s < w: sq = [(d, s), (d, w - s)] elif w < s < w + d: s -= w sq = [(s, w), (d - s, w)] elif w + d < s < 2 * w + d: s -= w + d sq = [(d, s), (d, w - s)] elif 2 * w + d < s < 2 * (w + d): s -= 2 * w + d sq = [(s, w), (d - s, w)] else: assert(False) p1, p2 = sq if p1[0] * p1[1] > p2[0] * p2[1]: p1, p2 = p2, p1 return [p1, p2] while True: N, W, D = map(int, input().split()) if not (N | W | D): break square = [(D, W)] for _ in range(N): p, s = map(int, input().split()) square.extend(cut(*square.pop(p - 1), s)) print(*sorted(d * w for d, w in square))
Traceback (most recent call last): File "/tmp/tmpfd9frc58/tmpdg4s2c8a.py", line 24, in <module> N, W, D = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s635854921
p00730
u509278866
1529633014
Python
Python3
py
Runtime Error
0
0
1269
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 998244353 dd = [(0,-1),(1,0),(0,1),(-1,0)] ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)] def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def pf(s): return print(s, flush=True) def main(): rr = [] while True: n,w,d = LI() if n == 0 and w == 0 and d == 0: break a = [LI() for _ in range(n)] r = [(w,d)] for p,s in a: ww,dd = r.pop(p-1) u = ww+dd s %= u if s < ww: r.append((s,dd)) r.append((ww-s,dd)) else: s -= ww r.append((ww,s)) r.append((ww,dd-s)) rr.append(' '.join(map(lambda x: str(x[0]*x[1]),sorted(r)))) return '\n'.join(map(str,rr)) print(main())
Traceback (most recent call last): File "/tmp/tmp0bxsu7ck/tmpivr_oogw.py", line 45, in <module> print(main()) ^^^^^^ File "/tmp/tmp0bxsu7ck/tmpivr_oogw.py", line 24, in main n,w,d = LI() ^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s601198926
p00730
u855199458
1529744548
Python
Python3
py
Runtime Error
0
0
2144
# -*- coding: utf-8 -*- import sys sys.path.append("C:\\Users\\nadare\\python_programs\\competitive_programming\\library") import lib import inspect import pyperclip from tqdm import tqdm def snippet(module): text = inspect.getsource(module) pyperclip.copy(text) print(text) def get_input(inp): li = inp.split("\n") def inner(): return li.pop(0) return inner from sys import setrecursionlimit setrecursionlimit(100000) INPUT = """3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0""" input = get_input(INPUT) # -*- coding: utf-8 -*- from sys import setrecursionlimit setrecursionlimit(100000) class Cake(): def __init__(self, N, W, D): self.P = [-1]*2*(N+1) self.L = [-1]*2*(N+1) self.R = [-1]*2*(N+1) self.W = [0]*2*(N+1) self.W[1] = W self.D = [0]*2*(N+1) self.D[1] = D def find(self, target): count = 0 for i in range(1, 2*N+2): count += (self.L[i] == -1) if count == target: return i def cut(self, target, s, l): w = self.W[target] d = self.D[target] L = w+d s %= L if s <= w: nw, nW = s, w-s if nw > nW: nw, nW = nW, nw nd, nD = d, d else: s -= w nd, nD = s, d-s if nd > nD: nd, nD = nD, nd nw, nW = w, w assert 0 < nw assert 0 < nd r = l + 1 self.L[target], self.R[target] = l, r self.P[l], self.P[r] = target, target self.W[l], self.W[r] = nw, nW self.D[l], self.D[r] = nd, nD def show(self): tmp = [] for i in range(1, len(self.L)): if self.L[i] == -1: tmp.append(self.W[i] * self.D[i] ) print(" ".join(map(str, sorted(tmp)))) N, W, D = map(int, input().split()) while W: cake = Cake(N, W, D) for i in range(N): p, s = map(int, input().split()) target = cake.find(p) cake.cut(target, s, 2*(i+1)) cake.show() N, W, D = map(int, input().split())
Traceback (most recent call last): File "/tmp/tmppb8bbggr/tmp8i9mtze4.py", line 5, in <module> import lib ModuleNotFoundError: No module named 'lib'
s036071924
p00734
u164311692
1558925070
Python
Python3
py
Runtime Error
0
0
476
def answer(n, m, taro, hanako): for t in sorted(taro): fot h in (hanako): if sum(taro) - t + h == sum(hanako) - h + t: return f'{t} {h}' return -1 while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for i in range(n): taro.append(int(input())) for i in range(m): hanako.append(int(input())) print(answer(n, m, taro, hanako))
File "/tmp/tmpl09cnik3/tmpe0uxas62.py", line 3 fot h in (hanako): ^ SyntaxError: invalid syntax
s550459149
p00734
u164311692
1558925534
Python
Python3
py
Runtime Error
0
0
453
def answer(n, m, taro, hanako): for t in sorted(taro): for h in sorted(hanako): if sum(taro) - y + h == sum(hanako) - h + t: return '{t} {h}' while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for I in range(n) taro.append(int(input())) for I in range(m) hanako.append(int(input())) print(answer(n, m, taro, hanako)
File "/tmp/tmpc8jlnbst/tmpms7_kihs.py", line 13 for I in range(n) ^ SyntaxError: expected ':'
s212514636
p00734
u164311692
1558925580
Python
Python3
py
Runtime Error
0
0
453
def answer(n, m, taro, hanako): for t in sorted(taro): for h in sorted(hanako): if sum(taro) - t + h == sum(hanako) - h + t: return '{t} {h}' while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for I in range(n) taro.append(int(input())) for I in range(m) hanako.append(int(input())) print(answer(n, m, taro, hanako)
File "/tmp/tmpm85rfg5j/tmpfshhxek5.py", line 13 for I in range(n) ^ SyntaxError: expected ':'
s156421274
p00734
u164311692
1558925602
Python
Python3
py
Runtime Error
0
0
467
def answer(n, m, taro, hanako): for t in sorted(taro): for h in sorted(hanako): if sum(taro) - t + h == sum(hanako) - h + t: return '{t} {h}' return -1 while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for I in range(n) taro.append(int(input())) for I in range(m) hanako.append(int(input())) print(answer(n, m, taro, hanako)
File "/tmp/tmpeaz1vz_3/tmpvkudyh6x.py", line 14 for I in range(n) ^ SyntaxError: expected ':'
s079722429
p00734
u164311692
1558925646
Python
Python3
py
Runtime Error
0
0
467
def answer(n, m, taro, hanako): for t in sorted(taro): for h in sorted(hanako): if sum(taro) - t + h == sum(hanako) - h + t: return '{t} {h}' return -1 while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for i in range(n) taro.append(int(input())) for i in range(m) hanako.append(int(input())) print(answer(n, m, taro, hanako)
File "/tmp/tmpxi69ar_2/tmpooov9db_.py", line 14 for i in range(n) ^ SyntaxError: expected ':'
s548353912
p00734
u164311692
1558925728
Python
Python3
py
Runtime Error
0
0
468
def answer(n, m, taro, hanako): for t in sorted(taro): for h in sorted(hanako): if sum(taro) - t + h == sum(hanako) - h + t: return '{t} {h}' return -1 while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for i in range(n) taro.append(int(input())) for i in range(m) hanako.append(int(input())) print(answer(n, m, taro, hanako))
File "/tmp/tmpdemf0hp3/tmphugvv2gc.py", line 14 for i in range(n) ^ SyntaxError: expected ':'
s822711414
p00734
u128811851
1434524910
Python
Python3
py
Runtime Error
0
0
1463
def impossible(taro_cards, hanako_cards, average): if (sum(taro_cards) + sum(hanako_cards)) % 2 == 1: return True elif sum(taro_cards) + max(taro_cards) - min(hanako_cards) < average: return True elif sum(hanako_cards) + max(hanako_cards) - min(taro_cards) < average: return True else: return False while True: n_taro, n_hanako = map(int, input().split()) if n_taro == 0 and n_hanako == 0: break taro_cards = [] hanako_cards = [] change_pairs = [] for i in range(n_taro): taro_cards.append(int(input())) for i in range(n_hanako): hanako_cards.append(int(input())) average = (sum(taro_cards) + sum(hanako_cards)) // 2 if impossible(taro_cards, hanako_cards, average): print(-1) else: # record pairs of cards to be changed for i in range(len(taro_cards)): for j in range(len(hanako_cards)): if sum(taro_cards[:i]) + sum(taro_cards[i+1:]) + hanako_cards[j] == average: change_pairs.append((taro_cards[i], hanako_cards[j])) # print("{0} {1}".format(taro_cards[i], hanako_cards[j])) # print the pair of cards to be changed pairs_leastsum = change_pairs[0] for i in range(1, len(change_pairs)): if sum(change_pairs[i]) <= sum(pairs_leastsum): pairs_leastsum = change_pairs[i] print(*pairs_leastsum)
Traceback (most recent call last): File "/tmp/tmpcx8iw0d0/tmpb9zoam0p.py", line 13, in <module> n_taro, n_hanako = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s741772281
p00734
u128811851
1434524943
Python
Python3
py
Runtime Error
0
0
1463
def impossible(taro_cards, hanako_cards, average): if (sum(taro_cards) + sum(hanako_cards)) % 2 == 1: return True elif sum(taro_cards) + max(taro_cards) - min(hanako_cards) < average: return True elif sum(hanako_cards) + max(hanako_cards) - min(taro_cards) < average: return True else: return False while True: n_taro, n_hanako = map(int, input().split()) if n_taro == 0 and n_hanako == 0: break taro_cards = [] hanako_cards = [] change_pairs = [] for i in range(n_taro): taro_cards.append(int(input())) for i in range(n_hanako): hanako_cards.append(int(input())) average = (sum(taro_cards) + sum(hanako_cards)) // 2 if impossible(taro_cards, hanako_cards, average): print(-1) else: # record pairs of cards to be changed for i in range(len(taro_cards)): for j in range(len(hanako_cards)): if sum(taro_cards[:i]) + sum(taro_cards[i+1:]) + hanako_cards[j] == average: change_pairs.append((taro_cards[i], hanako_cards[j])) # print("{0} {1}".format(taro_cards[i], hanako_cards[j])) # print the pair of cards to be changed pairs_leastsum = change_pairs[0] for i in range(1, len(change_pairs)): if sum(change_pairs[i]) <= sum(pairs_leastsum): pairs_leastsum = change_pairs[i] print(*pairs_leastsum)
Traceback (most recent call last): File "/tmp/tmpinatg813/tmp5h1i2kbd.py", line 13, in <module> n_taro, n_hanako = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s035592574
p00734
u128811851
1434525526
Python
Python3
py
Runtime Error
0
0
1496
def impossible(taro_cards, hanako_cards, average): if (sum(taro_cards) + sum(hanako_cards)) % 2 == 1: return True elif sum(taro_cards) + max(taro_cards) - min(hanako_cards) < average: return True elif sum(hanako_cards) + max(hanako_cards) - min(taro_cards) < average: return True else: return False while True: n_taro, n_hanako = map(int, input().split()) if n_taro == 0 and n_hanako == 0: break taro_cards = [] hanako_cards = [] change_pairs = [] for _ in range(n_taro): taro_cards.append(int(input())) for _ in range(n_hanako): hanako_cards.append(int(input())) average = (sum(taro_cards) + sum(hanako_cards)) // 2 if impossible(taro_cards, hanako_cards, average): print(-1) else: # record pairs of cards to be changed for i in range(len(taro_cards)): for j in range(len(hanako_cards)): if sum(taro_cards[:i]) + sum(taro_cards[i+1:]) + hanako_cards[j] == average: change_pairs.append((taro_cards[i], hanako_cards[j])) # print("{0} {1}".format(taro_cards[i], hanako_cards[j])) # print the pair of cards to be changed if pairs_leastsum == []: print(-1) else: pairs_leastsum = change_pairs[0] for i in range(1, len(change_pairs)): if sum(change_pairs[i]) <= sum(pairs_leastsum): pairs_leastsum = change_pairs[i] print(*pairs_leastsum)
File "/tmp/tmpgla8re2b/tmp68_1m6o_.py", line 32 for i in range(len(taro_cards)): ^ IndentationError: expected an indented block after 'else' statement on line 30
s724396147
p00734
u672443148
1514710334
Python
Python3
py
Runtime Error
0
0
750
import numpy as np while True: N,M=map(int,input().split()) if N==0 and M==0: break allCards=[] for i in range(N+M): allCards.append(int(input())) Taro=np.array(allCards[:N]) Hanako=np.array(allCards[N:]) Tsum=np.sum(Taro) Hsum=np.sum(Hanako) diff=Tsum-Hsum tempsum=1e8 Tchange=-1 Hchange=-1 for i in range(N): for j in range(M): tempdiff=(Taro[i]-Hanako[j])*2 if diff==tempdiff: if(tempsum>Taro[i]+Hanako[j]): tempsum=Taro[i]+Hanako[j] Tchange=Taro[i] Hchange=Hanako[j] if Tchange==-1: print(-1) else: print(Tchange,Hchange)
Traceback (most recent call last): File "/tmp/tmpj14m13ds/tmpznss5b0m.py", line 3, in <module> N,M=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s615115712
p00734
u273843182
1514740289
Python
Python3
py
Runtime Error
0
0
864
#include<iostream> #include<vector> using namespace std; int main(){ while(1){ int n,m,x,sum1=0,sum2=0,ans=100000,num,ax=0,ay=0; vector<int> N,M; cin >> n >> m; if(n==0&&m==0) break; for(int i=n;i--;){ cin >> x; sum1+=x; N.push_back(x); } for(int i=m;i--;){ cin >> x; sum2+=x; M.push_back(x); } num = sum1 - sum2; //cout << sum1 << " " <<sum2 << endl; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(num == 2*(N[i]-M[j])&&ans>N[i]+M[j]){ ans = N[i]+M[j]; ax=N[i]; ay=M[j]; } } } if(ax==0&&ay==0) cout << "-1\n"; else cout << ax << " " << ay << "\n"; } }
File "/tmp/tmp5f6x4h9v/tmp3e76be0g.py", line 3 using namespace std; ^^^^^^^^^ SyntaxError: invalid syntax
s403816207
p00735
u591052358
1528977118
Python
Python
py
Runtime Error
0
0
374
N = 300000 a = [((i % 7 ==1)or(i % 7 ==6)) for i in range(N)] #print(a[11]) a[1]=0 p =[] for i in range(6,N): if a[i]: p+=[i] for j in range(i * i ,N,i): a[j] = 0 while True: n = int(input()) if n == 1: break print(n,end = ":") for x in p: if n % x ==0: print(" "+str(x),end = " ") print()
Traceback (most recent call last): File "/tmp/tmp1x8j5mqu/tmpk_cy7pp8.py", line 13, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s138699852
p00736
u467175809
1529351236
Python
Python
py
Runtime Error
0
0
990
#!/usr/bin/env python from collections import deque import itertools as it import sys sys.setrecursionlimit(1000000) while True: S_ = raw_input() if S_ == '.': break ans = 0 for p, q, r in it.product([0, 1, 2], repeat = 3): S = S_ S = S.replace("P", p).replace("Q", q).replace("R", r) for loop in range(50): for loop2 in range(100): S_pre = S S = S.replace("-0", "2") S = S.replace("-1", "1") S = S.replace("-2", "0") if S == S_pre: break for loop2 in range(50): S_pre = S for a, b in it.product([0, 1, 2], repeat = 2): S = S.replace("(%d*%d)" % (x, y), str(min(x, y))) S = S.replace("(%d+%d)" % (x, y), str(max(x, y))) if S == S_pre: break if S == "2": ans += 1 print ans
File "/tmp/tmp1idmjkr7/tmp559u_6ek.py", line 36 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s520979599
p00737
u998232877
1434805397
Python
Python
py
Runtime Error
19930
28748
2209
# -*- coding: utf-8 -*- import heapq class Tuple: def __init__(self, cost, y, x, dir): self.cost = cost self.y = y self.x = x self.dir = dir def __str__(self): return "y=" + str(self.y) + " : " + "x=" + str(self.x) + " : " + "dir=" + str(self.dir) + ": cost=" + str( self.cost) def solve(): X, Y = map(int, raw_input().split()) if X == 0 and Y == 0: return -1 stage = [map(int, raw_input().split()) for _ in range(Y)] C = map(int, raw_input().split()) memo = [[[10 ** 10 for _ in xrange(4)] for _ in xrange(X)] for _ in xrange(Y)] queue = [] heapq.heappush(queue, Tuple(0, 0, 0, 0)) dir_x = [1, 0, -1, 0] dir_y = [0, 1, 0, -1] while len(queue) > 0: current = heapq.heappop(queue) if memo[current.y][current.x][current.dir] > current.cost: memo[current.y][current.x][current.dir] = current.cost for operation in range(4): if operation == 0: # ????????? ?????£??´????????? next_dir = current.dir elif operation == 1: # ????????? ?????? next_dir = (current.dir + 1) % 4 elif operation == 2: # ????????? ?????¢ next_dir = (current.dir + 2) % 4 else: # ????????? ?????? next_dir = (current.dir + 3) % 4 # ????????? ??´????????????????????¢?????????????????????????????????????????\???????????¢??????????????????????????§??????????????? next_x = current.x + dir_x[next_dir] next_y = current.y + dir_y[next_dir] next_cost = current.cost if stage[current.y][current.x] != operation: next_cost += C[operation] if 0 <= next_x < X and 0 <= next_y < Y: heapq.heappush(queue, Tuple(next_cost, next_y, next_x, next_dir)) return min(memo[Y - 1][X - 1]) if __name__ == '__main__': while True: result = solve() if result < 0: break print result
File "/tmp/tmptk5a2i42/tmpcyg7sank.py", line 77 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s144519233
p00737
u998232877
1434809685
Python
Python
py
Runtime Error
19930
9028
2252
# -*- coding: utf-8 -*- import heapq class Tuple: def __init__(self, cost, y, x, dir): self.cost = cost self.y = y self.x = x self.dir = dir def __str__(self): return "y=" + str(self.y) + " : " + "x=" + str(self.x) + " : " + "dir=" + str(self.dir) dir_x = [1, 0, -1, 0] dir_y = [0, 1, 0, -1] def solve(): X, Y = map(int, raw_input().split()) if X == 0 and Y == 0: return -1 stage = [map(int, raw_input().split()) for _ in range(Y)] C = map(int, raw_input().split()) costs = [[[float("inf") for _ in xrange(4)] for _ in xrange(X)] for _ in xrange(Y)] costs[0][0][0] = 0 queue = [] heapq.heappush(queue, Tuple(0, 0, 0, 0)) while len(queue) > 0: current = heapq.heappop(queue) if costs[current.y][current.x][current.dir] < current.cost: continue for operation in range(4): if operation == 0: # ????????? ?????£??´????????? next_dir = current.dir elif operation == 1: # ????????? ?????? next_dir = (current.dir + 1) % 4 elif operation == 2: # ????????? ?????¢ next_dir = (current.dir + 2) % 4 else: # ????????? ?????? next_dir = (current.dir + 3) % 4 # ????????? ??´????????????????????¢?????????????????????????????????????????\???????????¢??????????????????????????§??????????????? next_x = current.x + dir_x[next_dir] next_y = current.y + dir_y[next_dir] next_cost = costs[current.y][current.x][current.dir] if stage[current.y][current.x] != operation: next_cost += C[operation] if 0 <= next_x < X and 0 <= next_y < Y: if costs[next_y][next_x][next_dir] > next_cost: costs[next_y][next_x][next_dir] = next_cost data = Tuple(next_cost, next_y, next_x, next_dir) heapq.heappush(queue, data) return min(costs[Y - 1][X - 1]) if __name__ == '__main__': while True: result = solve() if result < 0: break print result
File "/tmp/tmpj4ppro57/tmpz_8m87is.py", line 81 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s804616765
p00740
u128811851
1434411494
Python
Python3
py
Runtime Error
0
0
999
#!/usr/bin/python # -*- coding: utf-8 -*- def is_winner(turn): if having_amount.count(0) == len(having_amount) - 1: return True else: return False # having_amount[i] represents the amount of pebbles the # candidate numbered i is having winner_number = [] # initialize turn = 0 while True: mayors, pebbles_in_bowl = map(int, input().split()) having_amount = [0 for i in range(mayors)] # action of a candidate if mayors == 0 and pebbles_in_bowl == 0: break elif pebbles_in_bowl == 0: pebbles_in_bowl += having_amount[turn] having_amount[turn] = 0 elif pebbles_in_bowl == 1: if is_winner(turn): print(turn) break else: having_amount[turn] += 1 pebbles_in_bowl -= 1 else: having_amount[turn] += 1 pebbles_in_bowl -= 1 # go to the next turn if turn == mayors: turn = 0 else: turn += 1 print(*having_amount)
Traceback (most recent call last): File "/tmp/tmptdwrpv_8/tmpcwt2tlg8.py", line 21, in <module> mayors, pebbles_in_bowl = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s372054174
p00740
u347385753
1498644010
Python
Python3
py
Runtime Error
0
0
305
while 1: n,p = map(int,input().split()) if n==0:break man = [0]*n ball,a = p,0 while 1: if ball >0:ball,man[a%n] =ball-1, man[a%n]+1 elif ball == 0:ball,man[a%n] = man[a%n],ball a+=1 if p in man:break print(man.index(max(man))) )
File "/tmp/tmpkcgicgnd/tmp_6s_jilw.py", line 11 print(man.index(max(man))) ) ^ SyntaxError: unmatched ')'
s715184784
p00740
u651355315
1529311854
Python
Python3
py
Runtime Error
0
0
597
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M while True: if N == M and i != 0: ans = i % S - 1 if ans < 0: ans = S + ans print(ans) break if N == 0: N = p[i % S] p[i % S] = 0 i += 1 else: N -= 1 p[i % S] += 1 i += 1 except: break;
s198194947
p00740
u651355315
1529311901
Python
Python3
py
Runtime Error
0
0
597
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M while True: if N == M and i != 0: ans = i % S - 1 if ans < 0: ans = S + ans print(ans) break if N == 0: N = p[i % S] p[i % S] = 0 i += 1 else: N -= 1 p[i % S] += 1 i += 1 except: break;
s512086680
p00740
u651355315
1529312123
Python
Python3
py
Runtime Error
0
0
597
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M while True: if N == M and i != 0: ans = i % S - 1 if ans < 0: ans = S + ans print(ans) break if N == 0: N = p[i % S] p[i % S] = 0 i += 1 else: N -= 1 p[i % S] += 1 i += 1 except: break;
s672358895
p00740
u651355315
1529312272
Python
Python3
py
Runtime Error
0
0
596
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M while True: if N == M and i != 0: ans = i % S - 1 if ans < 0: ans = S + ans print(ans) break if N == 0: N = p[i % S] p[i % S] = 0 i += 1 else: N -= 1 p[i % S] += 1 i += 1 except: break
s478997896
p00740
u651355315
1529312543
Python
Python3
py
Runtime Error
0
0
526
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M while True: if p[i] == M: print(i) break if N == 0: N = p[i] p[i] = 0 i += 1 i %= S else: N -= 1 p[i] += 1 i += 1 i %= S except: break
s562488051
p00740
u651355315
1529312656
Python
Python3
py
Runtime Error
0
0
582
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M if M == 0 and S == 0: break while True: if p[i] == M: print(i) break if N == 0: N = p[i] p[i] = 0 i += 1 i %= S else: N -= 1 p[i] += 1 i += 1 i %= S except: break
s216436674
p00740
u651355315
1529312729
Python
Python3
py
Runtime Error
0
0
582
import numpy as np while True: try: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M if M == 0 and S == 0: break while True: if p[i] == M: print(i) break if N == 0: N = p[i] p[i] = 0 i += 1 i %= S else: N -= 1 p[i] += 1 i += 1 i %= S except: break
s225445630
p00740
u651355315
1529313225
Python
Python3
py
Runtime Error
0
0
450
import numpy as np while True: l = list(map(int, input().split())) S = l[0] p = np.zeros(S) M = l[1] i = 0 N = M if M == 0 and S == 0: break while True: if p[i] == M: print(i) break if N == 0: N = p[i] p[i] = 0 i += 1 i %= S else: N -= 1 p[i] += 1 i += 1 i %= S
Traceback (most recent call last): File "/tmp/tmp1xd9r1qa/tmpiv515vjs.py", line 4, in <module> l = list(map(int, input().split())) ^^^^^^^ EOFError: EOF when reading a line
s732822205
p00741
u799595944
1551266507
Python
Python3
py
Runtime Error
0
0
1415
import queue def proceess(start_x,start_y): #insland = [] #insland.append([start_x,start_y]) new_island = queue.Queue() map[start_x][start_y] = 0 new_island.put([start_x,start_y]) while True: ob = new_island.get() x = ob[0] y = ob[1] print("x : " + str(x) + ", y : " + str(y)) for i in [-1,0,1]: for j in [-1,0,1]: nx = x + i ny = y + j if nx >= 0 and ny >= 0 and nx < w and ny < h: print(map[nx][ny]) if map[nx][ny] == 1: #insland.append([nx,ny]) print("nx : " + str(nx) + ", ny : " + str(ny)) new_island.put([nx,ny]) map[nx][ny] = 0 if new_island.empty(): break while True: map = [] tmp = input().split(" ") w = int(tmp[0]) h = int(tmp[1]) if w == 1 and h == 1: break for j in range(h): nova = [] arm = input() for k in arm.split(" "): #k.rstrip('\n') nova.append(int(k)) map.append(nova) print(map) count = 0 for i in range(w): for j in range(h): if map[i][j] == 1: print("i : " + str(i) + ", j : " + str(j)) proceess(i,j) count += 1 print(count)
Traceback (most recent call last): File "/tmp/tmpp_055rar/tmphblebdap.py", line 34, in <module> tmp = input().split(" ") ^^^^^^^ EOFError: EOF when reading a line
s872818284
p00741
u799595944
1551266633
Python
Python3
py
Runtime Error
0
0
1420
import queue def proceess(start_x,start_y): #insland = [] #insland.append([start_x,start_y]) new_island = queue.Queue() map[start_x][start_y] = 0 new_island.put([start_x,start_y]) while True: ob = new_island.get() x = ob[0] y = ob[1] #print("x : " + str(x) + ", y : " + str(y)) for i in [-1,0,1]: for j in [-1,0,1]: nx = x + i ny = y + j if nx >= 0 and ny >= 0 and nx < w and ny < h: #print(map[nx][ny]) if map[nx][ny] == 1: #insland.append([nx,ny]) #print("nx : " + str(nx) + ", ny : " + str(ny)) new_island.put([nx,ny]) map[nx][ny] = 0 if new_island.empty(): break while True: map = [] tmp = input().split(" ") w = int(tmp[0]) h = int(tmp[1]) if w == 1 and h == 1: break for j in range(h): nova = [] arm = input() for k in arm.split(" "): #k.rstrip('\n') nova.append(int(k)) map.append(nova) #print(map) count = 0 for i in range(w): for j in range(h): if map[i][j] == 1: #print("i : " + str(i) + ", j : " + str(j)) proceess(i,j) count += 1 print(count)
Traceback (most recent call last): File "/tmp/tmp1mnoisw1/tmp811vqkli.py", line 34, in <module> tmp = input().split(" ") ^^^^^^^ EOFError: EOF when reading a line
s278981855
p00741
u328199937
1555844377
Python
Python
py
Runtime Error
0
0
2246
anslist = [] def sarch(i, j, visited): if 0 < i: if visited[i - 1][j] == 0: visited[i - 1][j] = 1 sarch(i - 1, j, visited) if 0 < j: if visited[i - 1][j - 1] == 0: visited[i - 1][j - 1] = 1 sarch(i - 1, j - 1, visited) if j < len(visited[0]) - 1: if visited[i - 1][j + 1] == 0: visited[i - 1][j + 1] = 1 sarch(i - 1, j + 1, visited) if i < len(visited) - 1: if visited[i + 1][j] == 0: visited[i + 1][j] = 1 sarch(i + 1, j, visited) if 0 < j: if visited[i + 1][j - 1] == 0: visited[i + 1][j - 1] = 1 sarch(i + 1, j - 1, visited) if j < len(visited[0]) - 1: if visited[i + 1][j + 1] == 0: visited[i + 1][j + 1] = 1 sarch(i + 1, j + 1, visited) if 0 < j: if visited[i][j - 1] == 0: visited[i][j - 1] = 1 sarch(i, j - 1, visited) if j < len(visited[0]) - 1: if visited[i][j + 1] == 0: visited[i][j + 1] = 1 sarch(i, j + 1, visited) return visited while True: w, h = map(int, input().split()) if w == 0 and h == 0: break grid = [list(map(int, input().split())) for j in range(h)] visited = [[0 for i in range(w)] for j in range(h)] starti = 0 startj = 0 for i in range(h): for j in range(w): if grid[i][j] == 0: visited[i][j] = -1 else: visited[i][j] = 0 i = 0 j = 0 cnt = 0 ans = 0 #print(visited) while True: if i >= h: i = 0 j = 0 while True: cnt += 1 if j >= w: j = 0 break #print(visited[i][j], 100100) if visited[i][j] == 0: ans += 1 visited[i][j] = 1 visited = sarch(i, j, visited) cnt = 0 j += 1 i += 1 #print(cnt, visited) if cnt > w * h: #print(10) break anslist.append(ans) for i in anslist: print(i)
Traceback (most recent call last): File "/tmp/tmpccna3hsa/tmpgpq4gmws.py", line 42, in <module> w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s449373454
p00741
u328199937
1555844410
Python
Python3
py
Runtime Error
0
0
2246
anslist = [] def sarch(i, j, visited): if 0 < i: if visited[i - 1][j] == 0: visited[i - 1][j] = 1 sarch(i - 1, j, visited) if 0 < j: if visited[i - 1][j - 1] == 0: visited[i - 1][j - 1] = 1 sarch(i - 1, j - 1, visited) if j < len(visited[0]) - 1: if visited[i - 1][j + 1] == 0: visited[i - 1][j + 1] = 1 sarch(i - 1, j + 1, visited) if i < len(visited) - 1: if visited[i + 1][j] == 0: visited[i + 1][j] = 1 sarch(i + 1, j, visited) if 0 < j: if visited[i + 1][j - 1] == 0: visited[i + 1][j - 1] = 1 sarch(i + 1, j - 1, visited) if j < len(visited[0]) - 1: if visited[i + 1][j + 1] == 0: visited[i + 1][j + 1] = 1 sarch(i + 1, j + 1, visited) if 0 < j: if visited[i][j - 1] == 0: visited[i][j - 1] = 1 sarch(i, j - 1, visited) if j < len(visited[0]) - 1: if visited[i][j + 1] == 0: visited[i][j + 1] = 1 sarch(i, j + 1, visited) return visited while True: w, h = map(int, input().split()) if w == 0 and h == 0: break grid = [list(map(int, input().split())) for j in range(h)] visited = [[0 for i in range(w)] for j in range(h)] starti = 0 startj = 0 for i in range(h): for j in range(w): if grid[i][j] == 0: visited[i][j] = -1 else: visited[i][j] = 0 i = 0 j = 0 cnt = 0 ans = 0 #print(visited) while True: if i >= h: i = 0 j = 0 while True: cnt += 1 if j >= w: j = 0 break #print(visited[i][j], 100100) if visited[i][j] == 0: ans += 1 visited[i][j] = 1 visited = sarch(i, j, visited) cnt = 0 j += 1 i += 1 #print(cnt, visited) if cnt > w * h: #print(10) break anslist.append(ans) for i in anslist: print(i)
Traceback (most recent call last): File "/tmp/tmpsa1u6dkb/tmpma09pheq.py", line 42, in <module> w, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line