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
s186732572
p00591
u662126750
1497282883
Python
Python3
py
Runtime Error
0
0
624
# coding: utf-8 import numpy as np while True: n = int(input()) flag=0 if n==0: break map = [[0 for i in range(100)] for j in range(100)] a = [[int(i) for i in input().split()] for i in range(n)] np.array(a) maxar = (np.argmax(a, axis = 0))#(X, 0.1.2)????????§ minar = (np.argmin(a, axis = 1))#(0.1.2, X)???????°? for i in range(n): map[i][minar[i]]+=1 map[maxar[i]][i]+=1 for i in range(n): for j in range(n): if map[i][j]==2: print(a[i][j]) flag=1 break if flag==0: print(0)
Traceback (most recent call last): File "/tmp/tmpjt1cxbqr/tmpdhjonyv8.py", line 4, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s957691113
p00591
u590037228
1393939933
Python
Python
py
Runtime Error
0
0
527
#-*- coding:utf-8 -*- while 1: n = int(raw_input()) if not n: break length = n*n columns = [] for i in range(n): columns.append([]) rows = [0]*(length) #列の最小値となっている数 for i in range(n): row = [int(r) for r in raw_input().split(" ")] rows[min(row)] = 1 for i in range(n): columns[i].append(row[i]) result = 0 for c in columns: if rows[max(c)]: result = max(c) break print result
File "/tmp/tmpv3g35nor/tmp6pfz8r34.py", line 24 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s454582930
p00591
u590037228
1393940086
Python
Python
py
Runtime Error
0
0
529
#-*- coding:utf-8 -*- while 1: n = int(raw_input()) if not n: break length = n*n+1 columns = [] for i in range(n): columns.append([]) rows = [0]*(length) #列の最小値となっている数 for i in range(n): row = [int(r) for r in raw_input().split(" ")] rows[min(row)] = 1 for i in range(n): columns[i].append(row[i]) result = 0 for c in columns: if rows[max(c)]: result = max(c) break print result
File "/tmp/tmpbw7hw3pz/tmpppv6emh_.py", line 24 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s034037482
p00591
u590037228
1393983220
Python
Python
py
Runtime Error
0
0
529
#-*- coding:utf-8 -*- while 1: n = int(raw_input()) if not n: break length = n*n+1 columns = [] for i in range(n): columns.append([]) rows = [0]*(length) #列の最小値となっている数 for i in range(n): row = [int(r) for r in raw_input().split(" ")] rows[min(row)] = 1 for i in range(n): columns[i].append(row[i]) result = 0 for c in columns: if rows[max(c)]: result = max(c) break print result
File "/tmp/tmpz5l215eo/tmp54khkony.py", line 24 print result ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s559331828
p00591
u633068244
1397011250
Python
Python
py
Runtime Error
0
0
211
while 1: n=input() if n==0:break s=[map(int,raw_input().split()) for i in range(n)] sh=set([min(s[i]) for i in range(n)]) tl=set([max([s[j][i] for j in range(n)]) for i in range(n)]) print list(sh&tl)[0]
File "/tmp/tmphlf9v0vi/tmpe4c3t4cv.py", line 7 print list(sh&tl)[0] ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s103172098
p00591
u633068244
1397011305
Python
Python
py
Runtime Error
0
0
209
while 1: n=input() if n==0:break s=[map(int,raw_input().split()) for i in range(n)] sh=set([min(s[i]) for i in range(n)]) tl=set([max([s[j][i] for j in range(n)]) for i in range(n)]) print list(sh&tl)[0]
File "/tmp/tmpbwf3lugl/tmp57u27i8d.py", line 7 print list(sh&tl)[0] ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s813561906
p00592
u703196441
1418468914
Python
Python
py
Runtime Error
0
0
310
def cv(t): return t/100*60+t%100 while 1: n=input(); p=input(); q=input() if n==0: break v=[0]*1440 for i in range(n): k=input() for j in range(k): a=input(); b=input(); for l in range(cv(a),cv(b)): v[l]+=1 m=c=0 for i in range(cv(p),cv(q)): c=c+1 if v[i]<n else 0 m=max(m,c) print m
File "/tmp/tmpnrg0s8jq/tmpxj9bkoc7.py", line 18 print m ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s011848005
p00592
u221679506
1467938953
Python
Python3
py
Runtime Error
0
0
706
while True: n,s,e = input().split() n = int(n) s = int(s) e = int (e) if not n+s+e: break s = s//100*60+s%100 e = e//100*60+e%100 t = [0]*60*24 for i in range(n): m = int(input()) for j in range(m): ss,ee = input().split() ss = int(ss) ee = int(ee) t[ss//100*60+ss%100] += 1 t[ee//100*60+ee%100] -= 1 cnt = 0 ans = 0 ma = -1 for i in range(e): cnt += t[i] if i < s: continue if not cnt: ans += 1 else: if ma < ans: ma = ans ans = 0 print(ma if ma > ans else ans)
Traceback (most recent call last): File "/tmp/tmp5a7jx_q8/tmprdtrwdj_.py", line 2, in <module> n,s,e = input().split() ^^^^^^^ EOFError: EOF when reading a line
s394619834
p00592
u221679506
1467939278
Python
Python3
py
Runtime Error
0
0
702
while True: a,b,c = input().split() n = int(a) s = int(b) e = int (c) if not n+s+e: break s = s//100*60+s%100 e = e//100*60+e%100 t = [0]*60*24 for i in range(n): m = int(input()) for j in range(m): a,b = input().split() ss = int(a) ee = int(b) t[ss//100*60+ss%100] += 1 t[ee//100*60+ee%100] -= 1 cnt = 0 ans = 0 ma = -1 for i in range(e): cnt += t[i] if i < s: continue if not cnt: ans += 1 else: if ma < ans: ma = ans ans = 0 print(ma if ma > ans else ans)
Traceback (most recent call last): File "/tmp/tmpnfe5l918/tmpph3t5y36.py", line 2, in <module> a,b,c = input().split() ^^^^^^^ EOFError: EOF when reading a line
s081585307
p00592
u221679506
1467939491
Python
Python3
py
Runtime Error
0
0
701
while True: a,b,c = input().split() n = int(a) s = int(b) e = int (c) if not n+s+e: break s = s//100*60+s%100 e = e//100*60+e%100 t = [0]*60*24 for i in range(n): m = int(input()) for j in range(m): a,b = input().split() ss = int(a) ee = int(b) t[ss//100*60+ss%100] += 1 t[ee//100*60+ee%100] -= 1 cnt = 0 ans = 0 ma = -1 for i in range(e): cnt += t[i] if i < s: continue if cnt==0: ans += 1 else: if ma < ans: ma = ans ans = 0 print(ma if ma > ans else ans)
Traceback (most recent call last): File "/tmp/tmpj7biciyb/tmpoz9gbqkh.py", line 2, in <module> a,b,c = input().split() ^^^^^^^ EOFError: EOF when reading a line
s163785913
p00592
u221679506
1467939831
Python
Python3
py
Runtime Error
0
0
732
while True: n,s,e = input().split() n = int(n) s = int(s) e = int (e) if not n+s+e: break s = s//100*60+s%100 e = e//100*60+e%100 t = [0]*60*24 for i in range(n): m = int(input()) for j in range(m): ss,ee = input().split() ss = int(ss) ee = int(ee) t[ss//100*60+ss%100] += 1 t[ee//100*60+ee%100] -= 1 cnt = 0 ans = 0 ma = -1 for i in range(e): cnt += t[i] if i < s: continue if not cnt: ans += 1 else: if ma < ans: ma = ans ans = 0 if ma < ans: ma = ans print(ma)
Traceback (most recent call last): File "/tmp/tmp8cw5ixic/tmpzi2cxdln.py", line 2, in <module> n,s,e = input().split() ^^^^^^^ EOFError: EOF when reading a line
s747701083
p00592
u221679506
1467939844
Python
Python3
py
Runtime Error
0
0
727
while True: n,s,e = input().split() n = int(n) s = int(s) e = int (e) if not n+s+e: break s = s//100*60+s%100 e = e//100*60+e%100 t = [0]*60*24 for i in range(n): m = int(input()) for j in range(m): ss,ee = input().split() ss = int(ss) ee = int(ee) t[ss//100*60+ss%100] += 1 t[ee//100*60+ee%100] -= 1 cnt = 0 ans = 0 ma = -1 for i in range(e): cnt += t[i] if i < s: continue if not cnt: ans += 1 else: if ma < ans: ma = ans ans = 0 if ma < ans: ma = ans print(ma)
Traceback (most recent call last): File "/tmp/tmpcve7404p/tmp6otsdns3.py", line 2, in <module> n,s,e = input().split() ^^^^^^^ EOFError: EOF when reading a line
s114378346
p00592
u221679506
1467939957
Python
Python3
py
Runtime Error
0
0
735
while True: n,s,e = input().split() n = int(n) s = int(s) e = int (e) if not n+s+e: break s = (s//100)*60+s%100 e = (e//100)*60+e%100 t = [0]*60*24 for i in range(n): m = int(input()) for j in range(m): ss,ee = input().split() ss = int(ss) ee = int(ee) t[(ss//100)*60+ss%100] += 1 t[(ee//100)*60+ee%100] -= 1 cnt = 0 ans = 0 ma = -1 for i in range(e): cnt += t[i] if i < s: continue if not cnt: ans += 1 else: if ma < ans: ma = ans ans = 0 if ma < ans: ma = ans print(ma)
Traceback (most recent call last): File "/tmp/tmpqxlllmfv/tmpawqubaed.py", line 2, in <module> n,s,e = input().split() ^^^^^^^ EOFError: EOF when reading a line
s999395515
p00592
u797673668
1492411414
Python
Python3
py
Runtime Error
0
0
2040
from queue import deque def to_tv_times(cm_times): if cm_times[0] <= p: cm_times.popleft() else: cm_times.appendleft(p) if cm_times[-1] >= q: cm_times.pop() else: cm_times.append(q) return cm_times def to_minute(hhmm): return hhmm // 100 * 60 + hhmm % 100 while True: n, p, q = map(int, input().split()) if n == 0: break cm_times = deque([p, q]) for _ in range(n): if not cm_times: input() input() continue k = int(input()) tv_times = to_tv_times(deque(map(int, input().split()))) for tvs, tvt in zip(*[iter(tv_times)] * 2): new_cm_times = deque() while cm_times: cms = cm_times.popleft() if tvt < cms: cm_times.appendleft(cms) break cmt = cm_times.popleft() if cmt < tvs: new_cm_times.append(cms) new_cm_times.append(cmt) continue if cms < tvs: new_cm_times.append(cms) new_cm_times.append(tvs) if tvt < cmt: cm_times.appendleft(cmt) cm_times.appendleft(tvt) break elif tvt == cmt: break else: continue else: if cmt < tvt: continue elif cmt == tvt: break else: cm_times.appendleft(cmt) cm_times.appendleft(tvt) break cm_times = new_cm_times + cm_times if not cm_times: print(to_minute(q) - to_minute(p)) else: final_tv_times = to_tv_times(cm_times) print(max(t - s for s, t in zip(*[map(to_minute, final_tv_times)] * 2)))
Traceback (most recent call last): File "/tmp/tmp1eo053q6/tmp87r0k__d.py", line 21, in <module> n, p, q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s762266937
p00592
u590037228
1393988460
Python
Python
py
Runtime Error
0
0
1612
#-*- coding:utf-8 -*- #入力数値を分単位に変更 def convert_time(n): return (n/100)*60 + n%100 #コマーシャルの共通部分を返す def kyotsu(cm1,cm2): result = [] for i in range(len(cm2)/2): #cm2の各CMとかぶっている部分を取得 for j in range(len(cm1)/2): st = max(cm2[i*2],cm1[j*2]) ed = min(cm2[i*2+1],cm1[j*2+1]) if ed - st > 0: result.append(st) result.append(ed) return result #コマーシャルを見ずにテレビを見られる最長時間を求める while 1: cond = [int(r) for r in raw_input().split(" ")] if cond[0]==cond[1]==cond[2]==0: #入力がすべて0なら終了 break #開始時間、終了時間を算出 start = convert_time(cond[1]) end = convert_time(cond[2]) cms = [] #各チャンネルのコマーシャル時間を求める for i in range(cond[0]): n = int(raw_input()) #コマーシャル数 input = [convert_time(int(r)) for r in raw_input().split(" ")] j=0 cmstmp = [] while j < n: st = input[2*j] ed = input[2*j+1] if i==0: cms.append(st) cms.append(ed) else: cmstmp.append(st) cmstmp.append(ed) j += 1 if i>0: cms = kyotsu(cms,cmstmp) #cmsを利用してコマーシャルを見なくてすむ最大時間を出力 cms = [start] + cms + [end] print max([cms[i*2+1]-cms[i*2] for i in range(len(cms)/2)])
File "/tmp/tmphwxy4at4/tmp3me4crtp.py", line 54 print max([cms[i*2+1]-cms[i*2] for i in range(len(cms)/2)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s819489705
p00592
u590037228
1393990765
Python
Python
py
Runtime Error
0
0
1612
#-*- coding:utf-8 -*- #入力数値を分単位に変更 def convert_time(n): return (n/100)*60 + n%100 #コマーシャルの共通部分を返す def kyotsu(cm1,cm2): result = [] for i in range(len(cm2)/2): #cm2の各CMとかぶっている部分を取得 for j in range(len(cm1)/2): st = max(cm2[i*2],cm1[j*2]) ed = min(cm2[i*2+1],cm1[j*2+1]) if ed - st > 0: result.append(st) result.append(ed) return result #コマーシャルを見ずにテレビを見られる最長時間を求める while 1: cond = [int(r) for r in raw_input().split(" ")] if cond[0]==cond[1]==cond[2]==0: #入力がすべて0なら終了 break #開始時間、終了時間を算出 start = convert_time(cond[1]) end = convert_time(cond[2]) cms = [] #各チャンネルのコマーシャル時間を求める for i in range(cond[0]): n = int(raw_input()) #コマーシャル数 input = [convert_time(int(r)) for r in raw_input().split(" ")] j=0 cmstmp = [] while j < n: st = input[2*j] ed = input[2*j+1] if i==0: cms.append(st) cms.append(ed) else: cmstmp.append(st) cmstmp.append(ed) j += 1 if i>0: cms = kyotsu(cms,cmstmp) #cmsを利用してコマーシャルを見なくてすむ最大時間を出力 cms = [start] + cms + [end] print max([cms[i*2+1]-cms[i*2] for i in range(len(cms)/2)])
File "/tmp/tmpr9dswsh6/tmpk_ugn0jq.py", line 54 print max([cms[i*2+1]-cms[i*2] for i in range(len(cms)/2)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s483036261
p00592
u590037228
1393991437
Python
Python
py
Runtime Error
0
0
1615
#-*- coding:utf-8 -*- #入力数値を分単位に変更 def convert_time(n): return (n/100)*60 + n%100 #コマーシャルの共通部分を返す def kyotsu(cm1,cm2): result = [] for i in range(len(cm2)/2): #cm2の各CMとかぶっている部分を取得 for j in range(len(cm1)/2): st = max(cm2[i*2],cm1[j*2]) ed = min(cm2[i*2+1],cm1[j*2+1]) if ed - st > 0: result.append(st) result.append(ed) return result #コマーシャルを見ずにテレビを見られる最長時間を求める while 1: cond = [int(r) for r in raw_input().split(" ")] if cond[0]==cond[1]==cond[2]==0: #入力がすべて0なら終了 break #開始時間、終了時間を算出 start = convert_time(cond[1]) end = convert_time(cond[2]) cms = [] #各チャンネルのコマーシャル時間を求める for i in range(cond[0]): n = int(raw_input()) #コマーシャル数 input = [convert_time(int(r)) for r in raw_input().split(" ")] j=0 cmstmp = [] while j < n: st = input[2*j] ed = input[2*j+1] if not i: cms.append(st) cms.append(ed) else: cmstmp.append(st) cmstmp.append(ed) j += 1 if i > 0: cms = kyotsu(cms,cmstmp) #cmsを利用してコマーシャルを見なくてすむ最大時間を出力 cms = [start] + cms + [end] print max([cms[i*2+1]-cms[i*2] for i in range(len(cms)/2)])
File "/tmp/tmpe5znfa0s/tmpu2zuxq1v.py", line 54 print max([cms[i*2+1]-cms[i*2] for i in range(len(cms)/2)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s168107122
p00594
u972901560
1499240580
Python
Python3
py
Runtime Error
0
0
345
while 1: nums = int(input()) if nums != 0: stars = list(map(int,input().split())) cnt = [0 for i in range((2*31)-1)] for x in stars: cnt[x] += 1 m = max(cnt) if m > nums/2: res = cnt.index(m) print(res) else: print("NO COLOR") else:break
Traceback (most recent call last): File "/tmp/tmpj08fystb/tmp7pyig264.py", line 2, in <module> nums = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s202766969
p00594
u742505495
1513244875
Python
Python3
py
Runtime Error
0
0
292
while 1: size_a=int(input()) if size_a==0: break a = list(int(input().split())) check = [] cond=0 for i in range(size_a): if a[i] in check: pass elif a.count(a[i]) > int(size_a/2): print(a[i]) cond=1 break else: check.append(a[i]) if cond==0: print('NO COLOR')
Traceback (most recent call last): File "/tmp/tmpbhkrd5rr/tmpmpdiml4b.py", line 2, in <module> size_a=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s601044163
p00594
u742505495
1513244975
Python
Python3
py
Runtime Error
0
0
296
while 1: size_a=int(input()) if size_a==0: break a = list(map(int,input().split())) check = [] cond=0 for i in range(size_a): if a[i] in check: pass elif a.count(a[i]) > int(size_a/2): print(a[i]) cond=1 break else: check.append(a[i]) if cond==0: print('NO COLOR')
Traceback (most recent call last): File "/tmp/tmpraq0fldy/tmpfao0ow0n.py", line 2, in <module> size_a=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s835013680
p00594
u009288816
1520082234
Python
Python3
py
Runtime Error
0
0
604
import sys def count(i,data): res = 0 for x in data: if(x == i): res += 1 return res def print_color(size,data): data = sorted(data) for i in data: if(count(i,data) > int(size / 2)): print(i) return print("NO COLOR") l = [] for i in sys.stdin: l.append(i) for i in range(0,len(l),2): l[i] = int(l[i]) if(i < len(l) - 1): l[i+1] = l[i+1].split() for j in range(0,len(l[i+1])): l[i+1][j] = int(l[i+1][j]) for i in range(0,len(l),2): if(l[i] != 0): print_color(l[i],l[i+1])
s361942866
p00594
u009288816
1520082393
Python
Python3
py
Runtime Error
0
0
604
import sys def count(i,data): res = 0 for x in data: if(x == i): res += 1 return res def print_color(size,data): data = sorted(data) for i in data: if(count(i,data) > int(size / 2)): print(i) return print("NO COLOR") l = [] for i in sys.stdin: l.append(i) for i in range(0,len(l),2): l[i] = int(l[i]) if(i < len(l) - 1): l[i+1] = l[i+1].split() for j in range(0,len(l[i+1])): l[i+1][j] = int(l[i+1][j]) for i in range(0,len(l),2): if(l[i] != 0): print_color(l[i],l[i+1])
s222647014
p00594
u009288816
1521975183
Python
Python3
py
Runtime Error
0
0
659
import sys def count(i,data): res = 0 for x in data: if(x == i): res += 1 return res def print_color(size,data): data = sorted(data) for i in data: if(count(i,data) > int(size / 2)): print(i) return print("NO COLOR") l = [] for i in sys.stdin: l.append(i) for i in range(0,len(l),2): if(isinstance(l[i],str) == True): continue l[i] = int(l[i]) if(i < len(l) - 1): l[i+1] = l[i+1].split() for j in range(0,len(l[i+1])): l[i+1][j] = int(l[i+1][j]) for i in range(0,len(l),2): if(l[i] != 0): print_color(l[i],l[i+1])
s734638488
p00594
u575065019
1345574607
Python
Python
py
Runtime Error
0
1008
377
ans = [] while True: n = input() n2 = n / 2 if n == 0: break lst = [0] * n col = map(int,raw_input().split()) for i in col: lst[i] += 1 flag = 0 for i in lst: if i > n2: flag = 1 ans.append(lst.index(i)) break if flag == 0: ans.append("NO COLOR") for i in ans: print i
File "/tmp/tmp3elwo3w5/tmpekrimwxg.py", line 21 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s212879718
p00594
u104911888
1371009010
Python
Python
py
Runtime Error
20000
104172
207
while True: n=input() if n==0:break A=map(int,raw_input().split()) S=set(A) for c in S: if A.count(c)>n/2: print c break else: print "NO COLOR"
File "/tmp/tmpo2bknxiw/tmpfe5egjwc.py", line 8 print c ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s620224625
p00594
u633068244
1394198244
Python
Python
py
Runtime Error
0
0
268
while True: n = int(raw_input()) a = [] for i in range(n): a.append(int(raw_input()) b = list(set(a)) flag = 0 for i in b: if a.count(i) > n/2.0: ans = i flag = 1 print ans if flag = 1 else "NO COLOR"
File "/tmp/tmpo2ipm_8u/tmpatghtmem.py", line 5 a.append(int(raw_input()) ^ SyntaxError: '(' was never closed
s929520845
p00594
u633068244
1394198317
Python
Python
py
Runtime Error
0
0
285
while True: n = int(raw_input()) if n == 0: break a = map(int, raw_input().split()) b = list(set(a)) flag = 0 for i in b: if a.count(i) > n/2.0: ans = i flag = 1 break print ans if flag = 1 else "NO COLOR"
File "/tmp/tmpt1nyfy8c/tmpc0sb2p3r.py", line 13 print ans if flag = 1 else "NO COLOR" ^^^^^^^^^^^ SyntaxError: expected 'else' after 'if' expression
s716719312
p00595
u546285759
1484024495
Python
Python3
py
Runtime Error
0
0
132
from math import gcd while True: try: a, b= map(int, input().split()) print(gcd(a, b)) except: break
s455215084
p00596
u943441430
1545208650
Python
Python
py
Runtime Error
0
0
745
import sys import numpy as np def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) #print(xy) dominos = [[1 if [x, y] in xy or [y, x] in xy else 0 for x in range(0, 7)] for y in range(0, 7)] #print(dominos) return (dominos) lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) dominos = np.zeros((7, 7)) else: dominos = subset(line) order = np.sum(dominos, axis = 0) #print(order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s393533563
p00596
u943441430
1545208708
Python
Python
py
Runtime Error
0
0
745
import sys import numpy as np def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) #print(xy) dominos = [[1 if [x, y] in xy or [y, x] in xy else 0 for x in range(0, 7)] for y in range(0, 7)] #print(dominos) return (dominos) lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) dominos = np.zeros((7, 7)) else: dominos = subset(line) order = np.sum(dominos, axis = 0) #print(order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s551318911
p00596
u943441430
1545268446
Python
Python
py
Runtime Error
0
0
1124
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] return len(zz[zz == 0]) == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s785025797
p00596
u943441430
1545268581
Python
Python
py
Runtime Error
0
0
1124
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] return len(zz[zz == 0]) == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s801142526
p00596
u943441430
1545268591
Python
Python
py
Runtime Error
0
0
1124
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] return len(zz[zz == 0]) == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s726722989
p00596
u943441430
1545268680
Python
Python
py
Runtime Error
0
0
1322
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) #print(xy) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) print("digits=", digits) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] print("zz=", zz) return len(zz[zz == 0]) == 0 #return True #(len(z[0][z == 0]) == 0) f = open("python\input_1010.txt") lno = 0 for line in f: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
Traceback (most recent call last): File "/tmp/tmpsqtk3ho9/tmpxcjbtl2s.py", line 29, in <module> f = open("python\input_1010.txt") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'python\\input_1010.txt'
s606874424
p00596
u943441430
1545268740
Python
Python3
py
Runtime Error
0
0
1322
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) #print(xy) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) print("digits=", digits) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] print("zz=", zz) return len(zz[zz == 0]) == 0 #return True #(len(z[0][z == 0]) == 0) f = open("python\input_1010.txt") lno = 0 for line in f: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
Traceback (most recent call last): File "/tmp/tmpzw1heisw/tmp4agih2bo.py", line 29, in <module> f = open("python\input_1010.txt") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'python\\input_1010.txt'
s543029351
p00596
u943441430
1545268815
Python
Python3
py
Runtime Error
0
0
1239
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) #print(xy) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) print("digits=", digits) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] print("zz=", zz) return len(zz[zz == 0]) == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s687494091
p00596
u943441430
1545268980
Python
Python3
py
Runtime Error
0
0
1110
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] return len(zz[zz == 0]) == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s132880654
p00596
u943441430
1545269102
Python
Python3
py
Runtime Error
0
0
1110
import sys import numpy as np from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = np.unique(np.sort(reduce(lambda x, y: x + y, xy))) return digits, dominos def is_connected(d, g): a = np.array(g) z = np.zeros_like(a) b = a for i in range(1, z.shape[0]): z += b b = b.dot(a) zz = z[d[0]][d] return len(zz[zz == 0]) == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s487286880
p00596
u943441430
1545270929
Python
Python3
py
Runtime Error
0
0
1649
import sys from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) #print(xy) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = list(set(reduce(lambda x, y: x + y, xy))) digits.sort() return digits, dominos def add_matrix(a, b): c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)] return c def mul_matrix(a, b): c = [[0 for i in range(0, 7)] for j in range(0, 7)] for j in range(0, 7): for i in range(0, 7): for k in range(0, 7): c[j][i] += a[j][k] + b[k][i] return c def is_connected(d, g): a = g[:] z = [[0 for i in range(0, 7)] for j in range(0, 7)] b = a for i in range(0, 7): z = add_matrix(z, b) b = mul_matrix(b, a) zeros = 0 for i in d: if z[d[0]][i] == 0: zeros += 1 #print("zz=", zz) return zeros == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) #print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) #print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s043522108
p00596
u943441430
1545271000
Python
Python3
py
Runtime Error
0
0
1612
import sys from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = list(set(reduce(lambda x, y: x + y, xy))) digits.sort() return digits, dominos def add_matrix(a, b): c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)] return c def mul_matrix(a, b): c = [[0 for i in range(0, 7)] for j in range(0, 7)] for j in range(0, 7): for i in range(0, 7): for k in range(0, 7): c[j][i] += a[j][k] + b[k][i] return c def is_connected(d, g): a = g[:] z = [[0 for i in range(0, 7)] for j in range(0, 7)] b = a for i in range(0, 7): z = add_matrix(z, b) b = mul_matrix(b, a) zeros = 0 for i in d: if z[d[0]][i] == 0: zeros += 1 return zeros == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) #print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) #print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s487709855
p00596
u943441430
1545271050
Python
Python3
py
Runtime Error
0
0
1612
import sys from functools import reduce def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = list(set(reduce(lambda x, y: x + y, xy))) digits.sort() return digits, dominos def add_matrix(a, b): c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)] return c def mul_matrix(a, b): c = [[0 for i in range(0, 7)] for j in range(0, 7)] for j in range(0, 7): for i in range(0, 7): for k in range(0, 7): c[j][i] += a[j][k] + b[k][i] return c def is_connected(d, g): a = g[:] z = [[0 for i in range(0, 7)] for j in range(0, 7)] b = a for i in range(1, 7): z = add_matrix(z, b) b = mul_matrix(b, a) zeros = 0 for i in d: if z[d[0]][i] == 0: zeros += 1 return zeros == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) #print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) #print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s628362447
p00596
u943441430
1545271519
Python
Python3
py
Runtime Error
0
0
1615
import sys def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = [] for i in xy: digits.extend(i) digits = list(set(digits)) digits.sort() return digits, dominos def add_matrix(a, b): c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)] return c def mul_matrix(a, b): c = [[0 for i in range(0, 7)] for j in range(0, 7)] for j in range(0, 7): for i in range(0, 7): for k in range(0, 7): c[j][i] += a[j][k] * b[k][i] return c def is_connected(d, g): a = g[:] z = [[0 for i in range(0, 7)] for j in range(0, 7)] b = a for i in range(0, 7): z = add_matrix(z, b) b = mul_matrix(b, a) zeros = 0 for i in d: if z[d[0]][i] == 0: zeros += 1 return zeros == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) #print("line=", line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) #print("order=", order) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s359806190
p00596
u943441430
1545271576
Python
Python3
py
Runtime Error
0
0
1549
import sys def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = [] for i in xy: digits.extend(i) digits = list(set(digits)) digits.sort() return digits, dominos def add_matrix(a, b): c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)] return c def mul_matrix(a, b): c = [[0 for i in range(0, 7)] for j in range(0, 7)] for j in range(0, 7): for i in range(0, 7): for k in range(0, 7): c[j][i] += a[j][k] * b[k][i] return c def is_connected(d, g): a = g[:] z = [[0 for i in range(0, 7)] for j in range(0, 7)] b = a for i in range(0, 7): z = add_matrix(z, b) b = mul_matrix(b, a) zeros = 0 for i in d: if z[d[0]][i] == 0: zeros += 1 return zeros == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s107731743
p00596
u943441430
1545271794
Python
Python
py
Runtime Error
0
0
1549
import sys def subset(line): l = line.strip().split(" ") a = list(map(int, l)) xy = list(map(lambda x: [x // 10, x % 10], a)) dominos = [[1 if x != y and ([x, y] in xy or [y, x] in xy) else 0 \ for x in range(0, 7)] for y in range(0, 7)] digits = [] for i in xy: digits.extend(i) digits = list(set(digits)) digits.sort() return digits, dominos def add_matrix(a, b): c = [[a[j][i] + b[j][i] for i in range(0, 7)] for j in range(0, 7)] return c def mul_matrix(a, b): c = [[0 for i in range(0, 7)] for j in range(0, 7)] for j in range(0, 7): for i in range(0, 7): for k in range(0, 7): c[j][i] += a[j][k] * b[k][i] return c def is_connected(d, g): a = g[:] z = [[0 for i in range(0, 7)] for j in range(0, 7)] b = a for i in range(0, 7): z = add_matrix(z, b) b = mul_matrix(b, a) zeros = 0 for i in d: if z[d[0]][i] == 0: zeros += 1 return zeros == 0 lno = 0 for line in sys.stdin: lno += 1 if lno == 1: n = int(line) else: digits, dominos = subset(line) if not is_connected(digits, dominos): print("No") else: order = np.sum(dominos, axis = 0) order = order % 2 if np.all(order == 0): print("Yes") elif len(order[order == 1]) <= 2: print("Yes") else: print("No") lno = 0
s097512465
p00598
u943441430
1545295433
Python
Python3
py
Runtime Error
0
0
2403
import sys def rpn(str): r = [] stack = [] for i in range(0, len(str)): c = str[i] if c in "idsu": while len(stack) > 0: if stack[-1] in "idsuc": a = stack.pop() r.extend(a) else: break stack.extend(c) elif c == "c": stack.extend(c) elif c == "(": stack.extend(c) elif c == ")": while len(stack) > 0: a = stack.pop() if a == "(": break r.extend(a) else: r.extend(c) while len(stack) > 0: a = stack.pop() r.extend(a) return r def intersect(a, b): r = [] for e in a: if e in b: r.extend([e]) return r def union(a, b): r = list(set(a + b)) return r def diff(a, b): r = [] for e in a: if e not in b: r.extend([e]) return r def universal(sets): r = [] for v in sets.values(): r.extend(v) r = list(set(r)) return r def calc(rpn, sets): stack = [] U = universal(sets) for c in rpn: if c in "iuds": op2 = stack.pop() op1 = stack.pop() if c == "i": x = intersect(op1, op2) stack.append(x) elif c == "u": x = union(op1, op2) stack.append(x) elif c == "d": x = diff(op1, op2) stack.append(x) elif c == "s": x = diff(op1, op2) y = diff(op2, op1) z = union(x, y) stack.append(z) elif c == "c": op1 = stack.pop() x = diff(U, op1) stack.append(x) else: stack.append(sets[c]) return stack.pop() lno = 0 sets = {} name = "" for line in sys.stdin: lno += 1 if lno % 2 == 1: name = line.strip().split()[0] elif name != "R": elem = list(map(int, line.strip().split())) sets[name] = elem else: e = rpn(line.strip()) result = calc(e, sets) result.sort() if length(result) > 0: for n in result: print(n, end = " ") print() else: print("NULL")
s848190602
p00598
u104911888
1369183921
Python
Python
py
Runtime Error
0
0
1308
def convertC(r): s="" i=0 stack=[] while i<len(r): if r[i]=="c": if "A"<=r[i+1]<="E": s+="(U-"+r[i+1]+")" i+=2 elif r[i+1]=="(": s+="(U-"+r[i+1] stack.append(r[i+1]) j=2 while stack<>[]: if r[i+j]=="(": stack.append(r[i+j]) elif r[i+j]==")": stack.pop() s+=r[i+j] j+=1 else: s+=")" i=j else: s+=r[i] i+=1 return s while True: try: name,elsize=raw_input().split() except EOFError: break p={} U=set() while True: p[name]=set(map(int,raw_input().split())) U=U.union(p[name]) name,elsize=raw_input().split() if name=="R" and elsize=="0":break exp=raw_input() exp=convertC(exp) rule={"d":"-","i":"&","u":"|","s":"^"} print exp for i in ["A","B","C","D","E"]: exp=exp.replace(i,'p["'+i+'"]') for i in rule: exp=exp.replace(i,rule[i]) t=sorted(eval(exp)) if len(t)==0: print "NULL" else: print " ".join(map(str,t))
File "/tmp/tmpnj4d4vmf/tmpsmw85cqi.py", line 14 while stack<>[]: ^^ SyntaxError: invalid syntax
s863436994
p00603
u262566745
1509329745
Python
Python3
py
Runtime Error
0
0
666
from collections import deque import sys def suffle(deck, c): l = len(deck) if l % 2 == 0: mid = l//2 else: mid = (l-1)//2 deckA = deck[mid:] deckB = deck[:mid] deckC = [] while(len(deckA) != 0 or len(deckB) != 0): deckC.extend(deckA[:c]) deckA = deckA[c:] deckC.extend(deckB[:c]) deckB = deckB[c:] return deckC while(True): deck = [] n, r = map(int, sys.stdin.readline()[:-1].split()) deck = [i for i in range(n)] c_list = map(int, sys.stdin.readline()[:-1].split()) for c in c_list: deck = suffle(deck, c) print(deck[-1]) #print(" ".join(map(str, deck)))
Traceback (most recent call last): File "/tmp/tmpyjqh790u/tmp2fih50os.py", line 23, in <module> n, r = map(int, sys.stdin.readline()[:-1].split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s122002754
p00604
u454358619
1378255079
Python
Python
py
Runtime Error
0
0
348
import sys def solve(): while True: try: n = input() except EOFError: break d = sorted(map(int,raw_input().split())) for i in range(1,n): d[i] += d[i-1] print sum(d) if __name__ == "__main__": solve() n = raw_input()
File "/tmp/tmpxo0ir3es/tmpr78nd_wp.py", line 14 print sum(d) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s507418627
p00605
u073437081
1468998578
Python
Python3
py
Runtime Error
0
0
403
import numpy as np while True: N, K = [int(n) for n in input().split()] if (N == 0 and K == 0): quit() fridge = np.array([int(n) for n in input().split()]) vampires = [] for x in range(N): blood = np.array([int(n) for n in input().split()]) fridge -= blood if len([n for n in fridge if n < 0]) >= 1: print("NO") else: print("YES")
Traceback (most recent call last): File "/tmp/tmph92t4hei/tmpjyadzo7v.py", line 4, in <module> N, K = [int(n) for n in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s345153840
p00605
u575065019
1345567168
Python
Python
py
Runtime Error
0
1008
578
ans = [] while True: tmp = raw_input() if tmp =='0 0': break tmp = tmp.split() n = int(tmp[0]) m = int(tmp[1]) p = 0 blood = raw_input().split() for i in range(m): blood[i] = int(blood[i]) flag = 0 while p != n: if flag == 1: break tmp = raw_input().split() for i in range(m): blood[i] -= int(tmp[i]) if blood[i] < 0: flag = 1 p += 1 if flag == 0: ans.append("Yes") else: ans.append("No") for i in ans: print i
File "/tmp/tmph4ub4rg0/tmpd_zfdjmp.py", line 28 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s306349446
p00605
u575065019
1345567785
Python
Python
py
Runtime Error
0
1008
579
ans = [] while True: tmp = raw_input() if tmp =='0 0': break tmp = tmp.split() n = int(tmp[0]) m = int(tmp[1]) p = 0 blood = raw_input().split() for i in range(m): blood[i] = int(blood[i]) flag = 0 while p != n: if flag == 1: break tmp = raw_input().split() for i in range(m): blood[i] -= int(tmp[i]) if blood[i] < 0: flag = 1 p += 1 if flag == 0: ans.append("Yes") else: ans.append("No") for i in ans: print i
File "/tmp/tmph3yqckah/tmpo4xzqkuf.py", line 29 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s383491993
p00605
u633068244
1398062959
Python
Python
py
Runtime Error
0
0
249
while 1: N,K = map(int,raw_input().split()) if N == 0: break S = map(int,raw_input().split()) for j in range(N): B = map(int,raw_input().split()) for i in range(K): S[i] -= B[i] if min(S) < 0: break print "Yes" if min(S) >= 0 else "No"
File "/tmp/tmpwisyme9a/tmpysvr3pxe.py", line 10 print "Yes" if min(S) >= 0 else "No" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s136968048
p00605
u633068244
1398062999
Python
Python
py
Runtime Error
0
0
249
while 1: N,K = map(int,raw_input().split()) if N == 0: break S = map(int,raw_input().split()) for j in range(N): B = map(int,raw_input().split()) for i in range(K): S[i] -= B[i] if min(S) < 0: break print "Yes" if min(S) >= 0 else "No"
File "/tmp/tmp7paporu0/tmpiaqx04v8.py", line 10 print "Yes" if min(S) >= 0 else "No" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s383940779
p00609
u847467233
1530788025
Python
Python3
py
Runtime Error
0
0
528
# AOJ 1023: Amazing Graze # Python3 2018.7.5 bal4u import sys from sys import stdin input = stdin.readline from bisect import bisect_left while True: AN, BN, R = map(int, input().split()) if AN == 0: break e = [0]*AN a = sorted([list(map(int, input().split())) for i in range(AN)]) aa = a[0:-1][0] r = R << 2 r2 = r*r; for i in range(BN): x, y = map(int, input().split()) j = bisect_left(aa, x-r-1) while j < AN and a[j][0] <= x+r: if (a[j][0]-x)**2 + (a[j][1]-y)**2 <= r2: e[j] += 1 j += 1 print(sum(e))
Traceback (most recent call last): File "/tmp/tmptw87vrou/tmpj1l9_gi1.py", line 10, in <module> AN, BN, R = map(int, input().split()) ^^^^^^^^^ ValueError: not enough values to unpack (expected 3, got 0)
s197119931
p00611
u827448139
1419260743
Python
Python3
py
Runtime Error
0
0
3110
code="""\ #include <bits/stdc++.h> using namespace std; #define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define peri(i,a,b) for(int i=int(b);i-->int(a);) #define rep(i,n) repi(i,0,n) #define per(i,n) peri(i,0,n) #define all(c) begin(c),end(c) #define mp make_pair #define mt make_tuple typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<string> vs; template<typename T1,typename T2> ostream& operator<<(ostream& os,const pair<T1,T2>& p){ return os<<'('<<p.first<<','<<p.second<<')'; } template<typename Tuple> void print_tuple(ostream&,const Tuple&){} template<typename Car,typename... Cdr,typename Tuple> void print_tuple(ostream& os,const Tuple& t){ print_tuple<Cdr...>(os,t); os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t); } template<typename... Args> ostream& operator<<(ostream& os,const tuple<Args...>& t){ print_tuple<Args...>(os<<'(',t); return os<<')'; } template<typename Ch,typename Tr,typename C> basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){ os<<'['; for(auto i=begin(c);i!=end(c);++i) os<<(i==begin(c)?"":" ")<<*i; return os<<']'; } constexpr int INF=1e9; constexpr int MOD=1e9+7; constexpr double EPS=1e-9; constexpr int di[]={-1,1,0,0},dj[]={0,0,-1,1}; int count(const vs& grid,int i,int j) { int cnt=0; rep(k,4){ int ni=i+di[k],nj=j+dj[k]; cnt+=grid[ni][nj]=='P' || grid[ni][nj]=='W' || grid[ni][nj]=='C'; } return cnt; } void print(const vs& grid) { cout<<"# grid:"<<endl; for(const auto& line:grid) cout<<line<<endl; } int solve(vs& grid,int i,int j,const vector<pii>& ps,int pi,int rest) { int h=grid.size(),w=grid[0].size(); if(grid[i][j]=='#' || (grid[i][j]=='P')+count(grid,i,j)>=2) return INF; if(grid[i][j]=='*'){ rest--; grid[i][j]='C'; int res=INF; if(rest==0){ res=0; rep(i,h) rep(j,w) res+=grid[i][j]=='W' || grid[i][j]=='C'; } else{ rep(k,4){ int ni=i+di[k],nj=j+dj[k]; res=min(res,solve(grid,ni,nj,ps,pi,rest)); } if(pi+1<ps.size()){ int ni,nj; tie(ni,nj)=ps[pi+1]; res=min(res,solve(grid,ni,nj,ps,pi+1,rest)); } } grid[i][j]='*'; return res; } else{ if(grid[i][j]!='P') grid[i][j]='W'; int res=INF; rep(k,4){ int ni=i+di[k],nj=j+dj[k]; res=min(res,solve(grid,ni,nj,ps,pi,rest)); } if(grid[i][j]!='P') grid[i][j]='.'; return res; } return 0; } int main() { for(int h,w;cin>>h>>w && h|w;){ vs grid(h); rep(i,h) cin>>grid[i]; vector<pii> ps; rep(i,h) rep(j,w) if(grid[i][j]=='P') ps.emplace_back(i,j); int i0,j0; tie(i0,j0)=ps[0]; int rest=0; rep(i,h) rep(j,w) rest+=grid[i][j]=='*'; cout<<solve(grid,i0,j0,ps,0,rest)<<endl; } } """ import os,tempfile (_,filename)=tempfile.mkstemp(".cpp") f=open(filename,"w") f.write(code) f.close() os.system("g++ -std=c++0x -O2 {}".format(filename)) #os.system("./a.out") os.system("a.exe")
sh: 1: a.exe: not found
s362437351
p00613
u633068244
1395162920
Python
Python
py
Runtime Error
0
0
85
while 1: k=input() if not k:stop print sum(map(int, raw_input().split()))/(k-1)
File "/tmp/tmprafrkr67/tmprkl__qix.py", line 4 print sum(map(int, raw_input().split()))/(k-1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s874161291
p00613
u633068244
1395163904
Python
Python
py
Runtime Error
0
0
83
while 1: k=input()-1 if k==0:break print sum(map(int, raw_input().split()))/k
File "/tmp/tmpovlbhutz/tmprfy2jhbf.py", line 4 print sum(map(int, raw_input().split()))/k ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s874023440
p00627
u778333573
1440453120
Python
Python
py
Runtime Error
0
0
88
while true: n=input() if n==0: break print sum(input() for i in xrange(n/4))
File "/tmp/tmpiz8m4t_9/tmpqd5o7h4x.py", line 4 print sum(input() for i in xrange(n/4)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s183248442
p00627
u778333573
1440453128
Python
Python
py
Runtime Error
0
0
91
while true: n =input() if n == 0: break print sum(input() for i in xrange(n/4))
File "/tmp/tmpvu7iv7l2/tmpked2jbez.py", line 4 print sum(input() for i in xrange(n/4)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s203557219
p00627
u778333573
1440453201
Python
Python
py
Runtime Error
0
0
87
while True: n=input() if n==0: break print ans(input() for i in range(n/4))
File "/tmp/tmpu1ukydoh/tmpwhkop45l.py", line 4 print ans(input() for i in range(n/4)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s710159257
p00627
u778333573
1440453208
Python
Python
py
Runtime Error
0
0
91
while True: n = input() if n == 0: break print ans(input() for i in range(n/4))
File "/tmp/tmp3pw26tze/tmpa9ybh_jc.py", line 4 print ans(input() for i in range(n/4)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s663477059
p00627
u546285759
1489471454
Python
Python3
py
Runtime Error
0
0
102
while True: n = int(input()) if n == 0: break print(sum([int(input()) for _ in range(n)]))
Traceback (most recent call last): File "/tmp/tmpk7dnszer/tmpga0urzga.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s279302484
p00627
u633068244
1395239181
Python
Python
py
Runtime Error
0
0
144
while True: n = int(raw_input()) if n == 0: break a = [] for i in range(n/4): a.append(int(raw_input()) print sum(a)
File "/tmp/tmphsauz298/tmp1_2at6on.py", line 6 a.append(int(raw_input()) ^ SyntaxError: '(' was never closed
s717580260
p00628
u633068244
1396526333
Python
Python
py
Runtime Error
0
0
141
while 1: a=map(str,raw_input().replace(" "," A ").split()) if a==["END"]:break print "".join(map(str,[len(a[i]) for i in range(len(a))]))
File "/tmp/tmp59ewud6p/tmpuvy9cajq.py", line 4 print "".join(map(str,[len(a[i]) for i in range(len(a))])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s717240798
p00629
u819979588
1513584461
Python
Python
py
Runtime Error
0
0
714
def sort_cmp(x, y): if x[2] == y[2]: return x[3] < y[3] else: return x[2] > x[2] def solve(n): teams = [] for i in range(n): teams.append(list(map(int, input().split()))) teams = sorted(teams, key=lambda x: -1e12 * x[2] + x[3] * 1e6 + x[0]) A = [] B = [] threshold = 3 for team in teams: if len(A) == 10: threshold = 2 elif len(A) == 20: threshold = 1e8 if B.count(team[1]) < threshold: A.append(team[0]) B.append(team[1]) if len(A) == 26: break for a in A: print(a) while True: n = int(input()) if n == 0: break solve(n)
Traceback (most recent call last): File "/tmp/tmptatqkuir/tmpz6k4zone.py", line 36, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s318225176
p00630
u104911888
1371010798
Python
Python
py
Runtime Error
0
0
836
while True: name,typ=raw_input().split() if name=="EndOfInput" and typ=="X":break L=[] if "_" in name: L=name.split("_") elif name[0].islower(): temp="" for ch in name: if ch.islower(): temp+=ch else: L.append(temp) temp="" temp+=ch L.append(temp) else: temp=name[0] for ch in name[1:]: if ch.islower(): temp+=ch else: L.append(temp) temp="" temp+=ch L.append(temp) if typ=="D": print "_".join(map(lambda s:s.lower(),L)) elif typ=="U": print "".join(map(lambda s:s.capitalize(),L)) else: print L[1]+"".join(map(lambda s:s.capitalize(),L[1:]))
File "/tmp/tmplbuik0__/tmp4y93hs0w.py", line 29 print "_".join(map(lambda s:s.lower(),L)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s823093620
p00630
u633068244
1398830614
Python
Python
py
Runtime Error
0
0
694
upp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" low = "abcdefghijklmnopqrstuvwxyz" while 1: a,type = raw_input().split() if type == "X": break ans = "" if type == "U": if "_" in a: words = a.split("_") for word in words: ans += upp[low.index(word[0])] + word[1:] else: ans = upp[low.index(a[0])] + a[1:] elif type == "L": if "_" in a: words = a.split("_") ans += words[0] for word in words[1:]: ans += upp[low.index(word[0])] + word[1:] else: ans = low[upp.index(a[0])] + a[1:] else: words = [] sp = 0 for i in range(1,len(a)): if a[i] in upp: words.append(a[sp:i].lower()) sp = i words.append(a[sp:].lower()) ans = "_".join(words) print ans
File "/tmp/tmpnq9toozf/tmpglyaj_uh.py", line 32 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s280862914
p00631
u633068244
1398152261
Python
Python
py
Runtime Error
0
0
250
import itertools while 1: n = input() if n == 0: break s = sorted(map(int,raw_input().split())) sm = sum(s) for i in range(1,n-1): ans = sorted(abs(sm - 2*sum(party)) for party in itertools.combinations(s,i))[0] if ans == 0: break print ans
File "/tmp/tmpxp37nu0t/tmp3acsc83n.py", line 10 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s871411676
p00631
u633068244
1398152289
Python
Python
py
Runtime Error
0
0
250
import itertools while 1: n = input() if n == 0: break s = sorted(map(int,raw_input().split())) sm = sum(s) for i in range(1,n-1): ans = sorted(abs(sm - 2*sum(party)) for party in itertools.combinations(s,i))[0] if ans == 0: break print ans
File "/tmp/tmp1rhswuyk/tmpjfihtg4x.py", line 10 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s947452582
p00631
u633068244
1399043880
Python
Python
py
Runtime Error
0
0
308
import itertools while 1: n = input() if n == 0: break a = sorted(map(int,raw_input().split())) all = sum(a) ans = all for i in range((n+1)/2+1): c = 0 for party in itertools.combinations(a,i): d = all-2*sum(party) if c == 0 and d < -ans break ans = min(ans,abs(d)) c = 1 print ans
File "/tmp/tmp9g0cn9vl/tmpt5ye8npd.py", line 12 if c == 0 and d < -ans ^ SyntaxError: expected ':'
s828435184
p00631
u633068244
1399059567
Python
Python
py
Runtime Error
0
0
179
while 1: n = input() if n == 0: break a = map(int,raw_input().split()) ref = [0] for i in a: ref += [i+j for j in ref if j < ans/2] print min(abs(sum(a)-2*i) for i in ref)
File "/tmp/tmpxqy_s54q/tmpu11hva44.py", line 8 print min(abs(sum(a)-2*i) for i in ref) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s062490110
p00631
u633068244
1399060520
Python
Python
py
Runtime Error
0
0
221
def S(i,x,y): for w in [x,y] if 2*w >= A: return 2*w-A return min(S(i+1,x+a[i],y),S(i+1,x,y+a[i])) while 1: n = input() if n == 0: break a = sorted(map(int,raw_input().split()))[::-1] A = sum(a) print S(1,a[0],0)
File "/tmp/tmp7iaudojk/tmprzsyzfdi.py", line 2 for w in [x,y] ^ SyntaxError: expected ':'
s143405147
p00637
u633068244
1397010339
Python
Python
py
Runtime Error
0
0
188
while 1: n=input() if n==0:break p=raw_input().split()+["end"] sp=p[0] for i in range(n): if str(int(p[i])+1)!=p[i+1]: print sp+"-"+p[i], if sp!=p[i] else sp, sp=p[i+1] print
File "/tmp/tmp2l8oxsci/tmp2uq67g6w.py", line 8 print sp+"-"+p[i], if sp!=p[i] else sp, ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s932134072
p00638
u316268279
1432202022
Python
Python
py
Runtime Error
0
0
440
#!/usr/bin/env python # -*- coding: utf-8 -*- while True: n = int(raw_input()) island = [] if n == 0: break for i in range(n): g,b = map(int,input().split()) island.append((g,b,b-g)) sorted(island,key = lambda x:(x[2],[0],[1])) gem = 0 for g,b,c in island: gem += g if b < gem: break else: print 'Yes' continue print 'No'
File "/tmp/tmpq29he9ok/tmpmlnhuyzi.py", line 20 print 'Yes' ^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s662441489
p00638
u552684347
1432204751
Python
Python3
py
Runtime Error
0
0
369
__author__ = 'admin' while True: count_shima=input() if count_shima==0: break A = [list(map(int,raw_input().split())) for i in xrange(count_shima)] A.sort() weight=0 frg=0 for takara,turi in A: weight +=takara if turi < weight: print "NO" frg=1 break if frg==0: print "YES"
File "/tmp/tmpsftr_tcr/tmpsq_js_22.py", line 16 print "NO" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s091946507
p00638
u552684347
1432205144
Python
Python3
py
Runtime Error
0
0
347
while True: count_shima=input() if count_shima==0: break A = [list(map(int,raw_input().split())) for i in xrange(count_shima)] A.sort() weight=0 frg=0 for takara,turi in A: weight +=takara if turi < weight: print "NO" frg=1 break if frg==0: print "YES"
File "/tmp/tmpye7ywltc/tmpzvov016h.py", line 14 print "NO" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s793704686
p00638
u970703099
1530007229
Python
Python3
py
Runtime Error
0
0
326
import sys n = 1 a = [] while(True): n = (int)(input()) if n == 0: break for i in range(n): a.append(int(input().split())) a.sort(key=lambda x:x[1]) nimo = 0 for i in range(n): if(a[i][1] >= nimo+a[i][0]): nimo += a[i][0] else: print("No") sys.exit() print("Yes")
Traceback (most recent call last): File "/tmp/tmpta3_3tv3/tmp26llrv2y.py", line 5, in <module> n = (int)(input()) ^^^^^^^ EOFError: EOF when reading a line
s096358513
p00642
u827448139
1418379462
Python
Python3
py
Runtime Error
0
0
2103
code=""" #include <bits/stdc++.h> using namespace std; #define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl #define repi(i,a,b) for(int i=int(a);i<int(b);i++) #define peri(i,a,b) for(int i=int(b);i-->int(a);) #define rep(i,n) repi(i,0,n) #define per(i,n) peri(i,0,n) #define all(c) begin(c),end(c) #define mp make_pair #define mt make_tuple typedef unsigned int uint; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<string> vs; template<typename T1,typename T2> ostream& operator<<(ostream& os,const pair<T1,T2>& p){ return os<<'('<<p.first<<','<<p.second<<')'; } template<typename Tuple> void print_tuple(ostream&,const Tuple&){} template<typename Car,typename... Cdr,typename Tuple> void print_tuple(ostream& os,const Tuple& t){ print_tuple<Cdr...>(os,t); os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t); } template<typename... Args> ostream& operator<<(ostream& os,const tuple<Args...>& t){ print_tuple<Args...>(os<<'(',t); return os<<')'; } template<typename Ch,typename Tr,typename C,typename=decltype(begin(C()))> basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){ os<<'['; for(auto i=begin(c);i!=end(c);++i) os<<(i==begin(c)?"":" ")<<*i; return os<<']'; } constexpr int INF=1e9; constexpr int MOD=1e9+7; constexpr double EPS=1e-9; int main() { for(int n;cin>>n && n;){ map<pii,double> dp; dp[mp(0,0)]=1; rep(_,n){ map<pii,double> dp2; for(auto p:dp){ if(p.second<1e-6) continue; int cnt,cur; tie(cnt,cur)=p.first; dp2[mp(cnt+1,cur+1)]+=p.second*1./(1<<cur); dp2[mp(cnt,0)]+=p.second*(1-1./(1<<cur)); } swap(dp,dp2); } double res=0; for(auto p:dp) res+=p.first.first*p.second; printf("%.8f",res); puts(""); } } """ import os,tempfile (_,filename)=tempfile.mkstemp(".cpp") f=open(filename,"w") f.write(code) f.close() os.system("g++ -std=c++11 {} -o ./a.out".format(filename)) os.system("./a.out")
s354697952
p00642
u631023380
1449934688
Python
Python
py
Runtime Error
0
0
471
# -*- coding:utf-8 -*- if __name__ == "__main__": import sys dp = [0.0] * 100001 dp[1] = 1.0 for i in xrange(2, 100001): p = 1.0 w = 0.5 for j in xrange(1,i): if p < 1e-13: break dp[i] += (p*(1-w))*(j+dp[max(0,i-j-1)]) p *= w w *= 0.5 dp[i] += i*p while True: N = int(raw_input()) if N == 0: sys.exit() print "%.8f" % dp[N]
File "/tmp/tmpfd65haif/tmpj2ub53su.py", line 3 import sys ^ IndentationError: expected an indented block after 'if' statement on line 2
s767505449
p00642
u894114233
1473684069
Python
Python
py
Runtime Error
0
0
460
while 1: n=int(raw_input()) if n==0:break dp=[[0]*12 for _ in xrange(2)] dp[0][0]=1 ans=[0]*(n+1) for i in xrange(n): ans[i+1]+=ans[i] for j in xrange(12): if dp[i&1][j]==0:continue ans[i+1]+=dp[i&1][j]*pow(0.5,j) dp[(i+1)&1][j+1]=dp[i&1][j]*pow(0.5,j) dp[(i+1)&1][0]+=dp[i&1][j]*(1-pow(0.5,j)) if i==0 and j==0: dp[i][j]-=1 print(ans[n])
Traceback (most recent call last): File "/tmp/tmpqotvk_0t/tmpdqma3yjc.py", line 2, in <module> n=int(raw_input()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s267841020
p00642
u078042885
1485031161
Python
Python3
py
Runtime Error
0
0
232
dp=[.0]*100001 dp[1]=1. for i in range(2,100001): a,b,j=.5,1,1 while j<i and b> 1e-5: dp[i]+=b*(1-a)*(j+dp[i-j-1]) b*=al;a/=2;j+=1 dp[i]+=i*b while 1: n=int(input()) if n==0:break print(dp[n])
Traceback (most recent call last): File "/tmp/tmp4ld6syjj/tmp0r1p0dbx.py", line 7, in <module> b*=al;a/=2;j+=1 ^^ NameError: name 'al' is not defined. Did you mean: 'a'?
s917083600
p00643
u650035614
1530806890
Python
Python3
py
Runtime Error
0
0
2657
T, S, E, W, N, B = range(6) class Dice: def __init__(self): self.state = list(range(1,7)) def copy(self): dice = Dice() dice.state = [x for x in self.state] return dice def _turn(self, turn): k = self.state[turn[-1]] for i in range(4): self.state[turn[i]], k = k, self.state[turn[i]] def go_south(self): turn = [T, S, B, N] self._turn(turn) def go_north(self): turn = [N, B, S, T] self._turn(turn) def go_east(self): turn = [T, E, B, W] self._turn(turn) def go_west(self): turn = [T, W, B, E] self._turn(turn) def north(self): return self.state[N] def south(self): return self.state[S] def east(self): return self.state[E] def west(self): return self.state[W] def bottom(self): return self.state[B] def top(self): return self.state[T] def goto(self, n): func = [self.go_west, self.go_north, self.go_east, self.go_south] func[n]() def show(self): d = list("TSEWNB") for x, s in zip(d, self.state): print(x + " : {}".format(s)) import heapq INF = 10**9 if __name__ == "__main__": dx = [-1, 0, 1, 0] dy = [0, -1, 0, 1] while True: dp = [[[[INF for _ in range(7)] for i in range(7)] for j in range(10)] for k in range(10)] h, w = map(int, input().split()) if h == 0: break cost = [list(map(int, input().split())) for _ in range(h)] sy, sx = map(int, input().split()) gy, gx = map(int, input().split()) q = [] dice = Dice() heapq.heappush(q, [0, sx, sy, dice]) dp[sy][sx][dice.bottom()][dice.east()] ans = INF+1 while q: c, x, y, dice = heapq.heappop(q) if x == gx and y == gy: ans = min(ans, c) continue if c >= ans: continue else: for i in range(4): ddx, ddy = dx[i], dy[i] if x + ddx >= w or x + ddx < 0 or y + ddy >= h or y + ddy < 0: continue else: d = dice.copy() d.goto(i) new_cost = c + d.bottom()*cost[y+ddy][x+ddx] if dp[y+ddy][x+ddx][d.bottom()][d.east()] > new_cost: dp[y+ddy][x+ddx][d.bottom()][d.east()] = new_cost heapq.heappush(q, [new_cost, x+ddx, y+ddy, d]) print(ans)
Traceback (most recent call last): File "/tmp/tmp487ist_v/tmp864d84sw.py", line 70, in <module> h, w = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s375305240
p00644
u798803522
1470370456
Python
Python3
py
Runtime Error
0
0
8
print(a)
Traceback (most recent call last): File "/tmp/tmpuw44svat/tmpks_l0250.py", line 1, in <module> print(a) ^ NameError: name 'a' is not defined
s385570963
p00644
u798803522
1470382057
Python
Python3
py
Runtime Error
0
0
2327
vertex,edge,children = (int(n) for n in input().split(' ')) while True: graph = [] child = [] for e in range(edge): graph.append([int(n) for n in input().split(' ')]) for c in range(children): child.append(int(input())) stack = [[0,0,[]]] root = [] destination = [] mindist = {} destnum = 0 childnum = {} while len(stack) > 0: #print(stack,destination,root) stack = sorted(stack,key = lambda x:x[1]) start,weight,dream = stack[0][0],stack[0][1],stack[0][2] #????????????????????? if stack[0][0] in root and weight > mindist[stack[0][0]]: stack.pop(0) continue elif mindist.get(vertex-1) != None and stack[0][1] > mindist[vertex - 1]: break for gr in graph: if gr[0] == start and gr[0] not in root: if gr[1] not in child: stack.append([gr[1],weight + gr[2],dream]) elif gr[1] in child and gr[1] not in dream: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) elif gr[0] == start and mindist.get(gr[0]) != None and weight == mindist[gr[0]]: if gr[1] in child: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) else: stack.append([gr[1],weight + gr[2],dream]) if stack[0][0] not in root: root.append(stack[0][0]) mindist[stack[0][0]] = stack[0][1] if stack[0][0] == vertex - 1 : destination.append(stack[0]) destnum += 1 for c in range(len(stack[0][2])): if childnum.get(stack[0][2][c]) == None: childnum[stack[0][2][c]] = 1 else: childnum[stack[0][2][c]] += 1 stack.pop(0) for c in child: if c == 0: print(1) else: if childnum[c] == 0: print(0) else: print(childnum[c] / destnum) vertex,edge,children = (int(n) for n in input().split(' ')) if vertex == 0 and edge == 0 and children == 0: break
Traceback (most recent call last): File "/tmp/tmpm6roykdy/tmpkq5_bvxn.py", line 1, in <module> vertex,edge,children = (int(n) for n in input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s616325781
p00644
u798803522
1470382145
Python
Python3
py
Runtime Error
0
0
2327
vertex,edge,children = (int(n) for n in input().split(' ')) while True: graph = [] child = [] for e in range(edge): graph.append([int(n) for n in input().split(' ')]) for c in range(children): child.append(int(input())) stack = [[0,0,[]]] root = [] destination = [] mindist = {} destnum = 0 childnum = {} while len(stack) > 0: #print(stack,destination,root) stack = sorted(stack,key = lambda x:x[1]) start,weight,dream = stack[0][0],stack[0][1],stack[0][2] #????????????????????? if stack[0][0] in root and weight > mindist[stack[0][0]]: stack.pop(0) continue elif mindist.get(vertex-1) != None and stack[0][1] > mindist[vertex - 1]: break for gr in graph: if gr[0] == start and gr[0] not in root: if gr[1] not in child: stack.append([gr[1],weight + gr[2],dream]) elif gr[1] in child and gr[1] not in dream: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) elif gr[0] == start and mindist.get(gr[0]) != None and weight == mindist[gr[0]]: if gr[1] in child: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) else: stack.append([gr[1],weight + gr[2],dream]) if stack[0][0] not in root: root.append(stack[0][0]) mindist[stack[0][0]] = stack[0][1] if stack[0][0] == vertex - 1 : destination.append(stack[0]) destnum += 1 for c in range(len(stack[0][2])): if childnum.get(stack[0][2][c]) == None: childnum[stack[0][2][c]] = 1 else: childnum[stack[0][2][c]] += 1 stack.pop(0) for c in child: if c == 0: print(1) else: if childnum[c] == 0: print(0) else: print(childnum[c] / destnum) vertex,edge,children = (int(n) for n in input().split(' ')) if vertex == 0 and edge == 0 and children == 0: break
Traceback (most recent call last): File "/tmp/tmp_xsp4e49/tmpt89vf0j6.py", line 1, in <module> vertex,edge,children = (int(n) for n in input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s245913442
p00644
u798803522
1470382463
Python
Python3
py
Runtime Error
0
0
2543
vertex,edge,children = (int(n) for n in input().split(' ')) while True: if children == 0: print(0) vertex,edge,children = (int(n) for n in input().split(' ')) if vertex == 0 and edge == 0 and children == 0: break else: continue graph = [] child = [] for e in range(edge): graph.append([int(n) for n in input().split(' ')]) for c in range(children): child.append(int(input())) stack = [[0,0,[]]] root = [] destination = [] mindist = {} destnum = 0 childnum = {} while len(stack) > 0: #print(stack,destination,root) stack = sorted(stack,key = lambda x:x[1]) start,weight,dream = stack[0][0],stack[0][1],stack[0][2] #????????????????????? if stack[0][0] in root and weight > mindist[stack[0][0]]: stack.pop(0) continue elif mindist.get(vertex-1) != None and stack[0][1] > mindist[vertex - 1]: break for gr in graph: if gr[0] == start and gr[0] not in root: if gr[1] not in child: stack.append([gr[1],weight + gr[2],dream]) elif gr[1] in child and gr[1] not in dream: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) elif gr[0] == start and mindist.get(gr[0]) != None and weight == mindist[gr[0]]: if gr[1] in child: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) else: stack.append([gr[1],weight + gr[2],dream]) if stack[0][0] not in root: root.append(stack[0][0]) mindist[stack[0][0]] = stack[0][1] if stack[0][0] == vertex - 1 : destination.append(stack[0]) destnum += 1 for c in range(len(stack[0][2])): if childnum.get(stack[0][2][c]) == None: childnum[stack[0][2][c]] = 1 else: childnum[stack[0][2][c]] += 1 stack.pop(0) for c in child: if c == 0: print(1) else: if childnum[c] == 0: print(0) else: print(childnum[c] / destnum) vertex,edge,children = (int(n) for n in input().split(' ')) if vertex == 0 and edge == 0 and children == 0: break
Traceback (most recent call last): File "/tmp/tmpk1keq5b8/tmpk3_8jow9.py", line 1, in <module> vertex,edge,children = (int(n) for n in input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s465417508
p00644
u798803522
1470382794
Python
Python3
py
Runtime Error
0
0
2420
vertex,edge,children = (int(n) for n in input().split(' ')) while True: if children == 0: print(0) vertex,edge,children = (int(n) for n in input().split(' ')) if vertex == 0 and edge == 0 and children == 0: break else: continue graph = [] child = [] for e in range(edge): graph.append([int(n) for n in input().split(' ')]) for c in range(children): child.append(int(input())) stack = [[0,0,[]]] root = [] destination = [] mindist = {} destnum = 0 childnum = {} while len(stack) > 0: #print(stack,destination,root) stack = sorted(stack,key = lambda x:x[1]) start,weight,dream = stack[0][0],stack[0][1],stack[0][2] #????????????????????? if stack[0][0] in root and weight > mindist[stack[0][0]]: stack.pop(0) continue elif mindist.get(vertex-1) != None and stack[0][1] > mindist[vertex - 1]: break for gr in graph: if gr[0] == start and gr[0] not in root: if gr[1] not in child: stack.append([gr[1],weight + gr[2],dream]) elif gr[1] in child and gr[1] not in dream: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) elif gr[0] == start and mindist.get(gr[0]) != None and weight == mindist[gr[0]]: if gr[1] in child: disp = dream.copy() disp.append(gr[1]) stack.append([gr[1],weight + gr[2],disp]) else: stack.append([gr[1],weight + gr[2],dream]) if stack[0][0] not in root: root.append(stack[0][0]) mindist[stack[0][0]] = stack[0][1] if stack[0][0] == vertex - 1 : destination.append(stack[0]) destnum += 1 for c in range(len(stack[0][2])): if childnum.get(stack[0][2][c]) == None: childnum[stack[0][2][c]] = 1 else: childnum[stack[0][2][c]] += 1 stack.pop(0) for c in child: if c == 0: print(1) else: if childnum.get(c) == None: print(0) else: print(childnum[c] / destnum)
Traceback (most recent call last): File "/tmp/tmpb80lu_4k/tmpkgm0720x.py", line 1, in <module> vertex,edge,children = (int(n) for n in input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s820163029
p00650
u827448139
1417617489
Python
Python3
py
Runtime Error
0
0
201
while True: n,m=map(int,input().split()) if (n|m)==0: break d={} for i in range(m): u,v,w=map(int,input().split()) if u>v: u,v=v,u d[(u,v)]=d.get((u,v),0)+w print(min(d.values()))
Traceback (most recent call last): File "/tmp/tmptw7dliyl/tmp468y3ybo.py", line 2, in <module> n,m=map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s931697817
p00653
u829501316
1496091879
Python
Python3
py
Runtime Error
0
0
3309
from math import inf class segt2d: def __init__(self, m, n): self.m = 1 while self.m < m: self.m *= 2 self.n = 1 while self.n < n: self.n *= 2 self.dat = [segt(n) for _ in range(2 * self.m - 1)] # update (mk, nk) value to a def update(self, mk, nk, a): mk += self.m - 1 self.dat[mk].update(nk, a) while mk > 0: mk = (mk - 1) // 2 # update only if a is smaller here! otherwise this overwrites. if a >= self.dat[mk].get(nk): break self.dat[mk].update(nk, a) def query(self, ma, mb, na, nb): return self.__query(ma, mb, na, nb, 0, 0, self.m) def __query(self, ma, mb, na, nb, mk, ml, mr): if mr <= ma or mb <= ml: return inf if ma <= ml and mr <= mb: return self.dat[mk].query(na, nb) vl = self.__query(ma, mb, na, nb, mk * 2 + 1, ml, (ml + mr) // 2) vr = self.__query(ma, mb, na, nb, mk * 2 + 2, (ml + mr) // 2, mr) return min(vl, vr) def show(self): for d in self.dat: print(d.dat) class segt: def __init__(self, n): # ?°????????????????????´???°???2??????????????? self.n = 1 while self.n < n: self.n *= 2 # ??????????????????INT_MAX??? self.dat = [inf for _ in range(2 * self.n - 1)] # k????????????(0-indexed)???a????????´ def update(self, k, a): # ???????????? k += self.n - 1 self.dat[k] = a # ?????????????????´??° while k > 0: k = (k - 1) // 2 self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) def query(self, a, b): return self.__query(a, b, 0, 0, self.n) # [a, b)???????°????????±??????? # ???????????????????????°???????¨????????°?????????????????????°??? # k?????????????????????l, r??????????????????[l, r)???????????\?????????????????¨?????¨?????? # ???????????£??????????????????query(a, b, 0, 0, n)??¨???????????¶??? def __query(self, a, b, k, l, r): # [a, b)??¨[l, r)???????????????????????°???INT_MAX if r <= a or b <= l: return inf # [a, b)???[l, r)????????¨???????????§????????°????????????????????? if a <= l and r <= b: return self.dat[k] # ????????§???????????°???2????????????????°???? vl = self.__query(a, b, k * 2 + 1, l, (l + r) // 2) vr = self.__query(a, b, k * 2 + 2, (l + r) // 2, r) return min(vl, vr) def get(self, k): k += self.n - 1 return self.dat[k] def solve(): while True: r, c, q = map(int, input().split()) if (r, c, q) == (0, 0, 0): break rc = [[0 for _ in range(c + 1)]] + [None for _ in range(r)] for i in range(1, r + 1): rc[i] = [0] + [int(cj) for cj in input().split()] st2 = segt2d(r, c) for i in range(1, r + 1): for j in range(1, c + 1): st2.update(i - 1, j - 1, rc[i][j]) for qi in range(q): r1, c1, r2, c2 = map(int, input().split()) ans = st2.query(r1, r2 + 1, c1, c2 + 1) print(ans) if __name__ == '__main__': solve()
Traceback (most recent call last): File "/tmp/tmpyxt9kk2t/tmpmyblc0tt.py", line 106, in <module> solve() File "/tmp/tmpyxt9kk2t/tmpmyblc0tt.py", line 87, in solve r, c, q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s757597804
p00653
u829501316
1496092001
Python
Python3
py
Runtime Error
0
0
3195
from math import inf class segt2d: def __init__(self, m, n): self.m = 1 while self.m < m: self.m *= 2 self.n = 1 while self.n < n: self.n *= 2 self.dat = [segt(n) for _ in range(2 * self.m - 1)] # update (mk, nk) value to a def update(self, mk, nk, a): mk += self.m - 1 self.dat[mk].update(nk, a) while mk > 0: mk = (mk - 1) // 2 # update only if a is smaller here! otherwise this overwrites. if a >= self.dat[mk].get(nk): break self.dat[mk].update(nk, a) def query(self, ma, mb, na, nb): return self.__query(ma, mb, na, nb, 0, 0, self.m) def __query(self, ma, mb, na, nb, mk, ml, mr): if mr <= ma or mb <= ml: return inf if ma <= ml and mr <= mb: return self.dat[mk].query(na, nb) vl = self.__query(ma, mb, na, nb, mk * 2 + 1, ml, (ml + mr) // 2) vr = self.__query(ma, mb, na, nb, mk * 2 + 2, (ml + mr) // 2, mr) return min(vl, vr) def show(self): for d in self.dat: print(d.dat) class segt: def __init__(self, n): # ?°????????????????????´???°???2??????????????? self.n = 1 while self.n < n: self.n *= 2 # ??????????????????INT_MAX??? self.dat = [inf for _ in range(2 * self.n - 1)] # k????????????(0-indexed)???a????????´ def update(self, k, a): # ???????????? k += self.n - 1 self.dat[k] = a # ?????????????????´??° while k > 0: k = (k - 1) // 2 self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) def query(self, a, b): return self.__query(a, b, 0, 0, self.n) # [a, b)???????°????????±??????? # ???????????????????????°???????¨????????°?????????????????????°??? # k?????????????????????l, r??????????????????[l, r)???????????\?????????????????¨?????¨?????? # ???????????£??????????????????query(a, b, 0, 0, n)??¨???????????¶??? def __query(self, a, b, k, l, r): # [a, b)??¨[l, r)???????????????????????°???INT_MAX if r <= a or b <= l: return inf # [a, b)???[l, r)????????¨???????????§????????°????????????????????? if a <= l and r <= b: return self.dat[k] # ????????§???????????°???2????????????????°???? vl = self.__query(a, b, k * 2 + 1, l, (l + r) // 2) vr = self.__query(a, b, k * 2 + 2, (l + r) // 2, r) return min(vl, vr) def get(self, k): k += self.n - 1 return self.dat[k] while True: r, c, q = map(int, input().split()) if (r, c, q) == (0, 0, 0): break rc = [[0 for _ in range(c + 1)]] + [None for _ in range(r)] for i in range(1, r + 1): rc[i] = [0] + [int(cj) for cj in input().split()] st2 = segt2d(r, c) for i in range(1, r + 1): for j in range(1, c + 1): st2.update(i - 1, j - 1, rc[i][j]) for qi in range(q): r1, c1, r2, c2 = map(int, input().split()) ans = st2.query(r1, r2 + 1, c1, c2 + 1) print(ans)
Traceback (most recent call last): File "/tmp/tmpyqajdui_/tmpev9tvsff.py", line 86, in <module> r, c, q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s538361206
p00653
u829501316
1496092251
Python
Python3
py
Runtime Error
0
0
2389
from math import inf class segt2d: def __init__(self, m, n): self.m = 1 while self.m < m: self.m *= 2 self.n = 1 while self.n < n: self.n *= 2 self.dat = [segt(n) for _ in range(2 * self.m - 1)] def update(self, mk, nk, a): mk += self.m - 1 self.dat[mk].update(nk, a) while mk > 0: mk = (mk - 1) // 2 if a >= self.dat[mk].get(nk): break self.dat[mk].update(nk, a) def query(self, ma, mb, na, nb): return self.__query(ma, mb, na, nb, 0, 0, self.m) def __query(self, ma, mb, na, nb, mk, ml, mr): if mr <= ma or mb <= ml: return inf if ma <= ml and mr <= mb: return self.dat[mk].query(na, nb) vl = self.__query(ma, mb, na, nb, mk * 2 + 1, ml, (ml + mr) // 2) vr = self.__query(ma, mb, na, nb, mk * 2 + 2, (ml + mr) // 2, mr) return min(vl, vr) def show(self): for d in self.dat: print(d.dat) class segt: def __init__(self, n): self.n = 1 while self.n < n: self.n *= 2 self.dat = [inf for _ in range(2 * self.n - 1)] def update(self, k, a): k += self.n - 1 self.dat[k] = a while k > 0: k = (k - 1) // 2 self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) def query(self, a, b): return self.__query(a, b, 0, 0, self.n) def __query(self, a, b, k, l, r): if r <= a or b <= l: return inf if a <= l and r <= b: return self.dat[k] vl = self.__query(a, b, k * 2 + 1, l, (l + r) // 2) vr = self.__query(a, b, k * 2 + 2, (l + r) // 2, r) return min(vl, vr) def get(self, k): k += self.n - 1 return self.dat[k] while True: r, c, q = map(int, input().split()) if (r, c, q) == (0, 0, 0): break rc = [[0 for _ in range(c + 1)]] + [None for _ in range(r)] for i in range(1, r + 1): rc[i] = [0] + [int(cj) for cj in input().split()] st2 = segt2d(r, c) for i in range(1, r + 1): for j in range(1, c + 1): st2.update(i - 1, j - 1, rc[i][j]) for qi in range(q): r1, c1, r2, c2 = map(int, input().split()) ans = st2.query(r1, r2 + 1, c1, c2 + 1) print(ans)
Traceback (most recent call last): File "/tmp/tmp5qoyy_t3/tmp4s0hiqaf.py", line 72, in <module> r, c, q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s687659227
p00653
u829501316
1496093364
Python
Python3
py
Runtime Error
0
0
2389
from math import inf class segt2d: def __init__(self, m, n): self.m = 1 while self.m < m: self.m *= 2 self.n = 1 while self.n < n: self.n *= 2 self.dat = [segt(n) for _ in range(2 * self.m - 1)] def update(self, mk, nk, a): mk += self.m - 1 self.dat[mk].update(nk, a) while mk > 0: mk = (mk - 1) // 2 if a >= self.dat[mk].get(nk): break self.dat[mk].update(nk, a) def query(self, ma, mb, na, nb): return self.__query(ma, mb, na, nb, 0, 0, self.m) def __query(self, ma, mb, na, nb, mk, ml, mr): if mr <= ma or mb <= ml: return inf if ma <= ml and mr <= mb: return self.dat[mk].query(na, nb) vl = self.__query(ma, mb, na, nb, mk * 2 + 1, ml, (ml + mr) // 2) vr = self.__query(ma, mb, na, nb, mk * 2 + 2, (ml + mr) // 2, mr) return min(vl, vr) def show(self): for d in self.dat: print(d.dat) class segt: def __init__(self, n): self.n = 1 while self.n < n: self.n *= 2 self.dat = [inf for _ in range(2 * self.n - 1)] def update(self, k, a): k += self.n - 1 self.dat[k] = a while k > 0: k = (k - 1) // 2 self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) def query(self, a, b): return self.__query(a, b, 0, 0, self.n) def __query(self, a, b, k, l, r): if r <= a or b <= l: return inf if a <= l and r <= b: return self.dat[k] vl = self.__query(a, b, k * 2 + 1, l, (l + r) // 2) vr = self.__query(a, b, k * 2 + 2, (l + r) // 2, r) return min(vl, vr) def get(self, k): k += self.n - 1 return self.dat[k] while True: r, c, q = map(int, input().split()) if (r, c, q) == (0, 0, 0): break rc = [[0 for _ in range(c + 1)]] + [None for _ in range(r)] for i in range(1, r + 1): rc[i] = [0] + [int(cj) for cj in input().split()] st2 = segt2d(r, c) for i in range(1, r + 1): for j in range(1, c + 1): st2.update(i - 1, j - 1, rc[i][j]) for qi in range(q): r1, c1, r2, c2 = map(int, input().split()) ans = st2.query(r1, r2 + 1, c1, c2 + 1) print(ans)
Traceback (most recent call last): File "/tmp/tmpbebk1c95/tmpmafi3zjv.py", line 72, in <module> r, c, q = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s238880694
p00655
u546285759
1492588886
Python
Python3
py
Runtime Error
0
0
3092
from collections import deque def mid(qs): m = len(qs)//2 if len(qs)%2 else len(qs)//2-1 return m while True: q = int(input()) if not q: break d = deque() for _ in range(q): query = input() q1 = int(query[0]) # 0 if not q1: d.append(int(query[2])) # 1 elif q1 == 1: i = mid(d) d.remove(d[i]) # 2 elif q1 == 2: i = mid(d) print(min(d[i] for i in range(0, i+1))) # 3 elif q1 == 3: i = mid(d) print(min(d[i] for i in range(i+1, len(d)))) # 4 elif q1 == 4: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] minv = [] while tmp: i = mid(tmp) l = min([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 5 elif q1 == 5: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] minv = [] while tmp: i = mid(tmp) print(tmp, i) if len(tmp) == 1: l = tmp[0] else: l = min([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 6 elif q1 == 6: i = mid(d) print(max(d[i] for i in range(0, i+1))) # 7 elif q2 == 7: i = mid(d) print(max(d[i] for i in range(i+1, len(d)))) # 8 elif q1 == 8: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] maxv = [] while tmp: i = mid(tmp) l = max([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) # 9 else: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] maxv = [] while tmp: i = mid(tmp) if len(tmp) == 1: l = tmp[0] else: l = max([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) print("end")
Traceback (most recent call last): File "/tmp/tmpaukitack/tmpmdup_bnq.py", line 7, in <module> q = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s181278049
p00655
u546285759
1492589060
Python
Python3
py
Runtime Error
0
0
3122
from collections import deque def mid(qs): m = len(qs)//2 if len(qs)%2 else len(qs)//2-1 return m while True: q = int(input()) if not q: break d = deque() for _ in range(q): query = input() q1 = int(query[0]) # 0 if not q1: d.append(int(query[2])) # 1 elif q1 == 1: i = mid(d) print(d[i]) d.remove(d[i]) # 2 elif q1 == 2: i = mid(d) print(min(d[i] for i in range(0, i+1))) # 3 elif q1 == 3: i = mid(d) print(min(d[i] for i in range(i+1, len(d)))) # 4 elif q1 == 4: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] minv = [] while tmp: i = mid(tmp) l = min([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 5 elif q1 == 5: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] minv = [] while tmp: i = mid(tmp) print(tmp, i) if len(tmp) == 1: l = tmp[0] else: l = min([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 6 elif q1 == 6: i = mid(d) print(max(d[i] for i in range(0, i+1))) # 7 elif q2 == 7: i = mid(d) print(max(d[i] for i in range(i+1, len(d)))) # 8 elif q1 == 8: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] maxv = [] while tmp: i = mid(tmp) l = max([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) # 9 else: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] maxv = [] while tmp: i = mid(tmp) if len(tmp) == 1: l = tmp[0] else: l = max([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) print("end")
Traceback (most recent call last): File "/tmp/tmpt4t0xhjq/tmp3hd8rmce.py", line 7, in <module> q = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s961213014
p00655
u546285759
1492589169
Python
Python3
py
Runtime Error
0
0
3122
from collections import deque def mid(qs): m = len(qs)//2 if len(qs)%2 else len(qs)//2-1 return m while True: q = int(input()) if not q: break d = deque() for _ in range(q): query = input() q1 = int(query[0]) # 0 if not q1: d.append(int(query[2])) # 1 elif q1 == 1: i = mid(d) print(d[i]) d.remove(d[i]) # 2 elif q1 == 2: i = mid(d) print(min(d[i] for i in range(0, i+1))) # 3 elif q1 == 3: i = mid(d) print(min(d[i] for i in range(i+1, len(d)))) # 4 elif q1 == 4: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] minv = [] while tmp: i = mid(tmp) l = min([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 5 elif q1 == 5: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] minv = [] while tmp: i = mid(tmp) print(tmp, i) if len(tmp) == 1: l = tmp[0] else: l = min([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 6 elif q1 == 6: i = mid(d) print(max(d[i] for i in range(0, i+1))) # 7 elif q1 == 7: i = mid(d) print(max(d[i] for i in range(i+1, len(d)))) # 8 elif q1 == 8: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] maxv = [] while tmp: i = mid(tmp) l = max([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) # 9 else: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] maxv = [] while tmp: i = mid(tmp) if len(tmp) == 1: l = tmp[0] else: l = max([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) print("end")
Traceback (most recent call last): File "/tmp/tmph4j1q7u0/tmpgv2h3cxf.py", line 7, in <module> q = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s574846031
p00655
u546285759
1492589256
Python
Python3
py
Runtime Error
0
0
3091
from collections import deque def mid(qs): m = len(qs)//2 if len(qs)%2 else len(qs)//2-1 return m while True: q = int(input()) if not q: break d = deque() for _ in range(q): query = input() q1 = int(query[0]) # 0 if not q1: d.append(int(query[2])) # 1 elif q1 == 1: i = mid(d) print(d[i]) d.remove(d[i]) # 2 elif q1 == 2: i = mid(d) print(min(d[i] for i in range(0, i+1))) # 3 elif q1 == 3: i = mid(d) print(min(d[i] for i in range(i+1, len(d)))) # 4 elif q1 == 4: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] minv = [] while tmp: i = mid(tmp) l = min([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 5 elif q1 == 5: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] minv = [] while tmp: i = mid(tmp) if len(tmp) == 1: l = tmp[0] else: l = min([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in minv: minv.append(l) tmp.remove(tmp[i]) print(sorted(minv)[q2-1]) # 6 elif q1 == 6: i = mid(d) print(max(d[i] for i in range(0, i+1))) # 7 elif q1 == 7: i = mid(d) print(max(d[i] for i in range(i+1, len(d)))) # 8 elif q1 == 8: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(0, i+1)] maxv = [] while tmp: i = mid(tmp) l = max([tmp[i] for i in range(0, i+1)]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) # 9 else: q2 = int(query[2]) tmp = d.copy() i = mid(tmp) candidatates = [d[i] for i in range(i+1, len(d))] maxv = [] while tmp: i = mid(tmp) if len(tmp) == 1: l = tmp[0] else: l = max([tmp[i] for i in range(i+1, len(tmp))]) if l in candidatates and l not in maxv: maxv.append(l) tmp.remove(tmp[i]) print(sorted(maxv, reverse=True)[q2-1]) print("end")
Traceback (most recent call last): File "/tmp/tmptpyaj35f/tmpll6v6g66.py", line 7, in <module> q = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s701257849
p00657
u633068244
1395163556
Python
Python
py
Runtime Error
0
0
97
while True: r, c = input(),input() if not r: break print "yes" if not r*c%2 else "no"
File "/tmp/tmpzg2qrg5a/tmprnsnxmpl.py", line 4 print "yes" if not r*c%2 else "no" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s430698420
p00657
u633068244
1395163564
Python
Python
py
Runtime Error
0
0
89
while True: r, c = input() if not r: break print "yes" if not r*c%2 else "no"
File "/tmp/tmpune06n0u/tmpkcth0tdu.py", line 4 print "yes" if not r*c%2 else "no" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s643205008
p00659
u957028788
1502067976
Python
Python3
py
Runtime Error
0
0
810
while True: player_nun = int(input()) if player_nun == 0: break whole_data = [] xel = {} for i in (0, player_nun): dat = input().split() p_data = [] p_data.append(dat[0]) for x in dat[1:]: p_data.append(int(x)) whole_data.append(p_data) for x in p_data[2:p_data[1]]: if xel.has_key(x) == False: 0 = xel[x] xel[x] += 1 else: xe;[x] += 1 score = {} for y in xel.keys(): 5 - xel[y] = score[y] result = [] for i in whoe_data: player_score = [] player_score.append(i[0]) player_score.append(0) for x in i[2:]: player_score[1] += score[x] result.append(player_score) min_score = min(x[1] for x in result) winnners = [] for x in result: if x[1] == min_score: winners.append(x[0]) print(str(min_score) + " " + winners.sorted[0])
File "/tmp/tmpsc4bf298/tmpj9j_gkuz.py", line 17 0 = xel[x] ^ SyntaxError: cannot assign to literal here. Maybe you meant '==' instead of '='?
s556263130
p00659
u957028788
1502073370
Python
Python3
py
Runtime Error
0
0
1014
while True: #player_nun = int(input()) player_nun = 4 if player_nun == 0: break #????????????????????? whole_data = [] for i in (0, player_nun): #dat = input().split() #p_data = [] #p_data.append(dat[0]) for x in dat[1:]: p_data.append(int(x)) whole_data.append(p_data) #??????????????????????????????????????? xel = {} for i in whole_data: for x in i[2:]: if x in xel: xel[x] += 1 else: xel[x] = 1 #??????????????????????????¢????????? score = {} for y in xel.keys(): score[y] = 5 - xel[y] #????????¢??¨???????????????????????????????????? result = [] for i in whole_data: player_score = [] player_score.append(i[0]) player_score.append(0) for x in i[2:]: player_score[1] += score[x] result.append(player_score) #?????????????????????????¬?????????????????±??????? min_score = min(x[1] for x in result) winners = [] for x in result: if x[1] == min_score: winners.append(x[0]) print(str(min_score) + " " + sorted(winners)[0])
Traceback (most recent call last): File "/tmp/tmprucipf8c/tmp4d1mx54d.py", line 13, in <module> for x in dat[1:]: ^^^ NameError: name 'dat' is not defined