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
s336877881
p00467
u889593139
1521683910
Python
Python3
py
Runtime Error
0
0
402
while True: N, M = map(int, input().split()) if N == 0: break mapp = [int(input()) for _ in range(N)] mas = 0 ans = 0 for dice in range(M): mas += int(input()) if mas >= n - 1 and ans == 0: ans = dice + 1 if mas < n - 1: lmas += mapp[ans] if mas >= n - 1 and ans == 0: ans = dice + 1 print(ans)
Traceback (most recent call last): File "/tmp/tmp85r83csa/tmpisumvhhn.py", line 2, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s295044733
p00467
u889593139
1521683953
Python
Python3
py
Runtime Error
0
0
401
while True: N, M = map(int, input().split()) if N == 0: break maps = [int(input()) for _ in range(N)] mas = 0 ans = 0 for dice in range(M): mas += int(input()) if mas >= n - 1 and ans == 0: ans = dice + 1 if mas < n - 1: mas += maps[ans] if mas >= n - 1 and ans == 0: ans = dice + 1 print(ans)
Traceback (most recent call last): File "/tmp/tmp9vlwnwf2/tmpgmt2v85t.py", line 2, in <module> N, M = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s011631144
p00467
u150984829
1526187315
Python
Python3
py
Runtime Error
0
0
202
for e in iter(input,'0 0'): N,M=map(int,e.split()) S=[int(input())for _ in[0]*N] print(S) p=b=1 for i in range(M): d=int(input()) p+=d p+=S[~-p] print('pos', p) if(N<=p)*b:print(-~i);b=0
Traceback (most recent call last): File "/tmp/tmpfnuufq58/tmp9prt16e8.py", line 1, in <module> for e in iter(input,'0 0'): EOFError: EOF when reading a line
s944684798
p00467
u150984829
1526187326
Python
Python3
py
Runtime Error
0
0
184
for e in iter(input,'0 0'): N,M=map(int,e.split()) S=[int(input())for _ in[0]*N] print(S) p=b=1 for i in range(M): d=int(input()) p+=d p+=S[~-p] if(N<=p)*b:print(-~i);b=0
Traceback (most recent call last): File "/tmp/tmpu9q8eken/tmpr5s0onkz.py", line 1, in <module> for e in iter(input,'0 0'): EOFError: EOF when reading a line
s985961919
p00467
u150984829
1526187369
Python
Python3
py
Runtime Error
0
0
174
for e in iter(input,'0 0'): N,M=map(int,e.split()) S=[int(input())for _ in[0]*N] p=b=1 for i in range(M): d=int(input()) p+=d p+=S[~-p] if(N<=p)*b:print(-~i);b=0
Traceback (most recent call last): File "/tmp/tmpwjpgg5x1/tmpc3zxa38r.py", line 1, in <module> for e in iter(input,'0 0'): EOFError: EOF when reading a line
s068721091
p00467
u150984829
1526187885
Python
Python3
py
Runtime Error
0
0
195
for e in iter(input,'0 0'): N,M=map(int,e.split()) k=p=1 S=[int(input()) for _ in[0]*N] for d in[int(input())for _ in[0]*M]: p+=n if n-1<=p+i else i+S[p+i] if n<=p:break k+=1 print(k)
Traceback (most recent call last): File "/tmp/tmpy5rh16t8/tmpfh4d39tq.py", line 1, in <module> for e in iter(input,'0 0'): EOFError: EOF when reading a line
s978964313
p00467
u150984829
1526188276
Python
Python3
py
Runtime Error
0
0
196
for e in iter(input,'0 0'): N,M=map(int,e.split()) k,p=1,0 S=[int(input()) for _ in[0]*N] for d in[int(input())for _ in[0]*M]: p+=d if N<p+d else d+S[p+d] if N<=p+1:break k+=1 print(k)
Traceback (most recent call last): File "/tmp/tmphnmx006l/tmpcokx830l.py", line 1, in <module> for e in iter(input,'0 0'): EOFError: EOF when reading a line
s361236576
p00467
u150984829
1526188687
Python
Python3
py
Runtime Error
0
0
266
import sys r=sys.stdin.readline def s(): for e in iter(r,'0 0'): N,M=map(int,e.split()) k,p=1,0 S=[int(r()) for _ in[0]*N] for d in[int(r())for _ in[0]*M]: p+=d if N<=p+d else d+S[p+d] if N<=p+1:break k+=1 print(k) if'__main__'==__name__:solve()
Traceback (most recent call last): File "/tmp/tmpgm_cvl3j/tmpe6piip3q.py", line 13, in <module> if'__main__'==__name__:solve() ^^^^^ NameError: name 'solve' is not defined
s845199903
p00467
u150984829
1526188701
Python
Python3
py
Runtime Error
0
0
262
import sys r=sys.stdin.readline def s(): for e in iter(r,'0 0'): N,M=map(int,e.split()) k,p=1,0 S=[int(r()) for _ in[0]*N] for d in[int(r())for _ in[0]*M]: p+=d if N<=p+d else d+S[p+d] if N<=p+1:break k+=1 print(k) if'__main__'==__name__:s()
Traceback (most recent call last): File "/tmp/tmp1qujtvg7/tmpk2ffhjbx.py", line 13, in <module> if'__main__'==__name__:s() ^^^ File "/tmp/tmp1qujtvg7/tmpk2ffhjbx.py", line 5, in s N,M=map(int,e.split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s488027919
p00467
u150984829
1526188779
Python
Python3
py
Runtime Error
0
0
264
def s(): import sys r=sys.stdin.readline for e in iter(r,'0 0'): N,M=map(int,e.split()) k,p=1,0 S=[int(r()) for _ in[0]*N] for d in[int(r())for _ in[0]*M]: p+=d if N<=p+d else d+S[p+d] if N<=p+1:break k+=1 print(k) if'__main__'==__name__:s()
Traceback (most recent call last): File "/tmp/tmps4comgvd/tmp6lzkcu7p.py", line 13, in <module> if'__main__'==__name__:s() ^^^ File "/tmp/tmps4comgvd/tmp6lzkcu7p.py", line 5, in s N,M=map(int,e.split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s022114148
p00467
u150984829
1526189157
Python
Python3
py
Runtime Error
0
0
214
import sys r=sys.stdin.readline for e in iter(r,'0 0\n'): N,M=map(int,e.split()) k,p=1,0 S=[int(r()) for _ in[0]*N] for d in[int(r())for _ in[0]*M]: p+=d; if N<=p:p+=S[p] if N<=p+1:break k+=1 print(k)
Traceback (most recent call last): File "/tmp/tmpa1l_7dla/tmp9pcuqutg.py", line 4, in <module> N,M=map(int,e.split()) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s506539798
p00467
u621997536
1384424492
Python
Python
py
Runtime Error
0
0
317
mass = [0] * 1000 num = [0] * 1000 while True: N, M = map(int, raw_input().split()) if N == 0 and M == 0: break p = 0 for i in range(N): mass[i] = input() for i in range(M): num[i] = input() for i in range(M): p += num[i]; p += mass[p] if p >= N - 1: print i + 1 break
File "/tmp/tmp356n5rq4/tmpnriy4cbl.py", line 17 print i + 1 ^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s491459033
p00467
u260980560
1397474879
Python
Python
py
Runtime Error
0
0
310
while True: n, m = map(int, raw_input().split()) if n==0 and m==0: break b = [input() for i in xrange(n)] p = 0; ans = 0; for i in xrange(m): d = input() p += d if p>=n-1 or p+b[p]>=n-1: ans = i+1 break p += b[p] print ans
File "/tmp/tmpgb797nx5/tmpbu79e2ez.py", line 14 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s869343561
p00468
u724963150
1507199114
Python
Python3
py
Runtime Error
0
0
403
while True: n=int(input()) if n==0:break m=int(input()) rel=sorted([[int(s)for s in input().split(" ")]for i in range(m)],key=lambda x:x[0]) isf=[False for i in range(n)] inv=[False for i in range(n)] isf[0]=True for r in rel: if r[0]==1: isf[r[1]]=True inv[r[1]]=True elif isf[r[0]]==True:inv[r[1]]=True print(inv.count(True))
Traceback (most recent call last): File "/tmp/tmpra9pdmi9/tmpuom8_lol.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s742444896
p00468
u150984829
1526191342
Python
Python3
py
Runtime Error
0
0
208
import sys r=sys.stdin.readline for e in iter(r,'0'): R=[[]for _ in[0]*-~int(e)] for _ in[0]*int(r()): a,b=map(int,r().split()) R[a]+=[b];R[b]+=[a] for m in R[1][:]:R[1]+=R[m] print(len({*R[1]}-{1}))
Traceback (most recent call last): File "/tmp/tmpki4wdiw2/tmpa46br2a_.py", line 4, in <module> R=[[]for _ in[0]*-~int(e)] ^^^^^^ ValueError: invalid literal for int() with base 10: ''
s090396055
p00468
u460331583
1347008862
Python
Python
py
Runtime Error
0
1544
402
while True: fri = int(input()) count = int(input()) if fri == 0 and count ==0: break a,b,c,d = [],[],[],[] for i in range(count): t = map(int,raw_input().split()) if t[0] == 1: if not(t[1] in b): b.append(t[1]) continue if t[0] in b: if not(t[1] in b): c.append(t[1]) continue else: continue g = int(len(b))+int(len(c)) print g
File "/tmp/tmp2qcw9j5m/tmporn8ndrx.py", line 18 print g ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s417929578
p00468
u104911888
1368797798
Python
Python
py
Runtime Error
0
0
362
while True: n,m=input(),input() if n==m==0:break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmp_0j894w_/tmpiqwi_fb0.py", line 17 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s982235680
p00468
u104911888
1368797850
Python
Python
py
Runtime Error
0
0
366
while True: n=input() m=input() if n==m==0:break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmpiht1qnmm/tmpimv0bnzn.py", line 18 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s433924265
p00468
u104911888
1368797916
Python
Python
py
Runtime Error
0
0
420
while True: try: n=input() m=input() except SyntaxError: pass if n==m==0:break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmp1zyyqjai/tmpjl4uvjyf.py", line 21 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s516596459
p00468
u104911888
1368797985
Python
Python
py
Runtime Error
0
0
375
while True: n,m=map(int,raw_input().split()) if n==m==0:break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmpaao9xa91/tmpymp6lugz.py", line 17 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s467536185
p00468
u104911888
1368798030
Python
Python
py
Runtime Error
0
0
384
while True: n=int(raw_input()) m=int(raw_input()) if n==m==0:break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmpxiobqzxd/tmpl67zg__o.py", line 18 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s021741665
p00468
u104911888
1368798817
Python
Python
py
Runtime Error
0
0
363
while True: n=input() m=input() if n==0:break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmpyg6m37_0/tmp6vkg5wk1.py", line 18 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s850038616
p00468
u104911888
1368798908
Python
Python
py
Runtime Error
0
0
371
while True: n=raw_input() m=input() if n in "0":break S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmps46xl4s0/tmpbi2ef5s3.py", line 18 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s112907486
p00468
u104911888
1368798940
Python
Python
py
Runtime Error
0
0
371
while True: n=raw_input() if n in "0":break m=input() S,L=set(),[] for i in range(m): a,b=map(int,raw_input().split()) if a==1: S.add(b) elif b==1: S.add(a) else: L.append((a,b)) for i in S: for s in L: if i in s: S=S.union(s) print len(S)
File "/tmp/tmpy8idl06u/tmp84vuy0lg.py", line 18 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s697823074
p00468
u621997536
1384425839
Python
Python
py
Runtime Error
0
0
574
l = [] t = [] ans = [False] * 500 while True: l = [] t = [] ans = [False] * 500 N = input() M = input() if N == 0 and M == 0: break for i in range(M): a, b = map(int, raw_input().split()) l.append([a, b]) if a == 1: t.append(b) if b == 1: t.append(a) for i in t: ans[i] = True for j in range(M): if l[j][0] == i: ans[l[j][1]] = True if l[j][1] == i: ans[l[j][0]] = True res = 0 for i in range(len(ans)): if ans[i] and i != 1: print "tes: %d" % (i) res += 1 print res
File "/tmp/tmpjbpb_wkr/tmp4dzrwlh7.py", line 29 print "tes: %d" % (i) ^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s841077819
p00469
u150984829
1526193473
Python
Python3
py
Runtime Error
0
0
181
from itertools import permutations as P import sys r=sys.stdin.readline for e in iter(r,'0'): n,k=int(e),int(r()) C=[r()for _ in[0]*n] print(len(set(''.join(s)for s in P(C,k))))
Traceback (most recent call last): File "/tmp/tmpp2k0jujo/tmp5yu8050u.py", line 5, in <module> n,k=int(e),int(r()) ^^^^^^ ValueError: invalid literal for int() with base 10: ''
s642827987
p00469
u759949288
1361356162
Python
Python
py
Runtime Error
0
0
208
from itertools import permutations while True: n = input() if n == 0: break k = input() nums = [raw_input() for i in xrange(n)] result = set("".join(p) for p in permutations(nums, k)) print len(result)
File "/tmp/tmpabxdej6e/tmpokwsd34b.py", line 9 print len(result) ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s501333884
p00469
u759949288
1361356223
Python
Python
py
Runtime Error
0
0
213
from itertools import permutations while True: n = input() k = input() if n == k == 0: break nums = [raw_input() for i in xrange(n)] result = set("".join(p) for p in permutations(nums, k)) print len(result)
File "/tmp/tmpaqrmau_3/tmpfpaaqj2p.py", line 9 print len(result) ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s317281631
p00469
u759949288
1361356925
Python
Python
py
Runtime Error
0
0
255
from itertools import permutations while True: n = int(raw_input().strip()) k = int(raw_input().strip()) if n == k == 0: break nums = [raw_input().strip() for i in xrange(n)] result = set("".join(p) for p in permutations(nums, k)) print len(result)
File "/tmp/tmp90c1fjm0/tmpp9h8m03o.py", line 9 print len(result) ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s386329876
p00469
u759949288
1361357001
Python
Python
py
Runtime Error
0
0
259
from itertools import permutations while True: n = int(raw_input().strip()) k = int(raw_input().strip()) if n == k == 0: break nums = [raw_input().strip() for i in xrange(n)] result = set(["".join(p) for p in permutations(nums, k)]) print len(result)
File "/tmp/tmp7c60ko_h/tmpgnztg8g8.py", line 10 print len(result) ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s435834863
p00469
u759949288
1361357090
Python
Python
py
Runtime Error
0
0
154
while True: n = int(raw_input().strip()) k = int(raw_input().strip()) if n == k == 0: break nums = [raw_input().strip() for i in xrange(n)] print 0
File "/tmp/tmpujtgekr1/tmp0xt79jsk.py", line 7 print 0 ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s796362694
p00469
u759949288
1361357301
Python
Python
py
Runtime Error
0
0
226
from itertools import permutations while True: n = input() k = input() if n == k == 0: break nums = [raw_input().strip() for i in xrange(n)] result = set(["".join(p) for p in permutations(nums, k)]) print(len(result))
Traceback (most recent call last): File "/tmp/tmpx1srxboh/tmpfhsbxdns.py", line 4, in <module> n = input() ^^^^^^^ EOFError: EOF when reading a line
s978886653
p00469
u759949288
1361357363
Python
Python
py
Runtime Error
0
0
243
import sys from itertools import permutations while True: n = input() k = input() if n == k == 0: sys.exit(0) nums = [raw_input().strip() for i in xrange(n)] result = set(["".join(p) for p in permutations(nums, k)]) print(len(result))
Traceback (most recent call last): File "/tmp/tmp9mqjc66h/tmpo3te3c_u.py", line 5, in <module> n = input() ^^^^^^^ EOFError: EOF when reading a line
s087184729
p00469
u759949288
1361357450
Python
Python
py
Runtime Error
0
0
307
import sys from itertools import permutations def main(): while True: n = input() k = input() if n == k == 0: return 0 nums = [raw_input().strip() for i in xrange(n)] result = set(["".join(p) for p in permutations(nums, k)]) print (len(result)) if __name__ == '__main__': sys.exit(main())
Traceback (most recent call last): File "/tmp/tmpzhzkob7x/tmp0xkgzjp4.py", line 15, in <module> sys.exit(main()) ^^^^^^ File "/tmp/tmpzhzkob7x/tmp0xkgzjp4.py", line 6, in main n = input() ^^^^^^^ EOFError: EOF when reading a line
s218009346
p00469
u759949288
1361357894
Python
Python
py
Runtime Error
0
0
321
import sys from itertools import permutations def main(): while True: n, k = map(int, raw_input().split()) if n == k == 0: sys.exit(0) nums = [raw_input().strip() for i in xrange(n)] result = set(["".join(p) for p in permutations(nums, k)]) print (len(result)) if __name__ == '__main__': sys.exit(main())
Traceback (most recent call last): File "/tmp/tmp5hdeha0q/tmprr2kvt_5.py", line 14, in <module> sys.exit(main()) ^^^^^^ File "/tmp/tmp5hdeha0q/tmprr2kvt_5.py", line 6, in main n, k = map(int, raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s611252533
p00469
u759949288
1361359865
Python
Python
py
Runtime Error
0
0
346
import sys from itertools import permutations def main(): while True: n = input() k = input() if n == k == 0: sys.exit(0) for i in xrange(n): input() # nums = [raw_input().strip() for i in xrange(n)] # result = set(["".join(p) for p in permutations(nums, k)]) # print (len(result)) if __name__ == '__main__': sys.exit(main())
Traceback (most recent call last): File "/tmp/tmp4rml8p4_/tmptfj71s5j.py", line 17, in <module> sys.exit(main()) ^^^^^^ File "/tmp/tmp4rml8p4_/tmptfj71s5j.py", line 6, in main n = input() ^^^^^^^ EOFError: EOF when reading a line
s987634106
p00469
u104911888
1368799453
Python
Python
py
Runtime Error
0
0
212
import itertools while True: n=input() k=input() if n==k==0:break L=[raw_input() for i in range(n)] S=set() for t in itertools.permutations(L,k): S.add("".join(t)) print len(S)
File "/tmp/tmpd8d55ik2/tmp380s0uo5.py", line 10 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s496589464
p00469
u104911888
1368799596
Python
Python
py
Runtime Error
0
0
273
import itertools while True: n=raw_input() if n in "0":break try: k=input() except SyntaxError: break L=[raw_input() for i in range(int(n))] S=set() for t in itertools.permutations(L,k): S.add("".join(t)) print len(S)
File "/tmp/tmpkmqe_rjn/tmp1un5dwtl.py", line 13 print len(S) ^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s331159036
p00470
u150984829
1526200076
Python
Python3
py
Runtime Error
0
0
262
for e in iter(input,'0 0'): w,h=map(int,e.split()) M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w] for i in range(1,w): for j in range(1,h): a=M[i-1][j][:2] b=M[i][j-1][2:] M[i][j]=[b[1],a,a[1],b] print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
Traceback (most recent call last): File "/tmp/tmp6ybe2wpr/tmpgf20u6wv.py", line 1, in <module> for e in iter(input,'0 0'): EOFError: EOF when reading a line
s643025090
p00470
u759949288
1361357766
Python
Python
py
Runtime Error
0
0
355
import sys from itertools import permutations def main(): while True: n = input() k = input() if n == k == 0: return 0 for i in xrange(n): input() print "a" # nums = [raw_input().strip() for i in xrange(n)] # result = set(["".join(p) for p in permutations(nums, k)]) # print (len(result)) if __name__ == '__main__': sys.exit(main())
File "/tmp/tmpph1ji1su/tmpjx02f4mm.py", line 12 print "a" ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s816986110
p00471
u797673668
1457700748
Python
Python3
py
Runtime Error
40000
7868
1865
def search(town, remains, i, j): if not remains: if i == church[0]: direction = 1 if j < church[1] else -1 for cj in range(j + direction, church[1], direction): if town[i][cj] == 3: return 0 return 1 elif j == church[1]: direction = 1 if i < church[0] else -1 for ci in range(i + direction, church[0], direction): if town[ci][j] == 3: return 0 return 1 return 0 counter = 0 for ci in range(i - 1, -1, -1): if town[ci][j] == 1: town[ci][j] = 3 counter += search(town, remains - 1, ci, j) town[ci][j] = 1 elif town[ci][j] == 3: break for ci in range(i + 1, n): if town[ci][j] == 1: town[ci][j] = 3 counter += search(town, remains - 1, ci, j) town[ci][j] = 1 elif town[ci][j] == 3: break for cj in range(j - 1, -1, -1): if town[i][cj] == 1: town[i][cj] = 3 counter += search(town, remains - 1, i, cj) town[i][cj] = 1 elif town[i][cj] == 3: break for cj in range(j + 1, m): if town[i][cj] == 1: town[i][cj] = 3 counter += search(town, remains - 1, i, cj) town[i][cj] = 1 elif town[i][cj] == 3: break return counter while True: m, n = map(int, input().split()) if not n: break town = [list(map(int, input().split())) for _ in range(n)] remains = 0 for i in range(n): for j in range(m): house = town[i][j] if house == 2: church = (i, j) elif house == 1: remains += 1 print(search(town, remains, *church))
Traceback (most recent call last): File "/tmp/tmph_6li140/tmpn_n942_2.py", line 54, in <module> m, n = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s435323488
p00471
u150984829
1526211381
Python
Python3
py
Runtime Error
0
0
3380
''' 今年も JOI 町にサンタクロースが空からやってきた.JOI 町にある全ての家には子供がいるので,この サンタクロースは JOI 町の全ての家にプレゼントを配ってまわらなければならない.しかし,今年は連れ ているトナカイが少々方向音痴であり,また建物の上以外に降りることができないため,全ての家にプレゼ ントを配るためには少々道順を工夫しなければならないようだ. JOI 町は東西南北に区画整理されており,各区画は家,教会,空き地のいずれかである.JOI 町には 1 つだけ教会がある.次のルールに従い,サンタクロースとトナカイは教会から出発し,全ての家に 1 回ず つプレゼントを配った後,教会に戻る. - 今年のトナカイは少々方向音痴であるため,東西南北いずれかの方向にまっすぐ飛ぶことしかできず,空 中では方向転換できない. - まだプレゼントを配っていない家の上は自由に通過できる.まだプレゼントを配っていない家には降りる ことができる.家に降りた時は必ずプレゼントを配り,その後は東西南北いずれかの方向に飛び立つ. - JOI 町の家では,クリスマスの夜はサンタクロースが来るまでは暖炉をつけずに過ごしているが,サン タクロースが飛び立った後は暖炉をつける.暖炉をつけると煙突から煙が出るので,プレゼントを配り終 えた家の上を通過することはできない. - 教会の上は自由に通過することができる.しかし,教会では礼拝が行われているので,全てのプレゼント を配り終えるまで教会に降りることはできない. - 空き地の上は自由に通過することができるが,空き地に降りることはできない. 入力として町の構造が与えられたとき,サンタクロースとトナカイがプレゼントを配る道順が何通りあるか を求めるプログラムを作成せよ. ''' import copy dc = copy.deepcopy ans = 0 M = N = 0 def walk(field, pos_x, pos_y, direction): now_state = field[pos_y][pos_x] if now_state == 2: if sum(sum(field, [])) == 2: global ans ans += 1 return field[pos_y][pos_x] = 0 if (now_state or direction == 'r') and pos_x < M - 1: walk(dc(field), pos_x + 1, pos_y, 'r') if (now_state or direction == 'l') and 0 < pos_x: walk(dc(field), pos_x - 1, pos_y, 'l') if (now_state or direction == 'u') and 0 < pos_y: walk(dc(field), pos_x, pos_y - 1, 'u') if (now_state or direction == 'd') and pos_y < N - 1: walk(dc(field), pos_x, pos_y + 1, 'd') for e in iter(input, '0 0'): M, N = map(int, e.split()) field = [] for i in range(N): row = list(map(int, input().split())) field.append(row) if 2 in row: ch_x = row.index(2) ch_y = i if ch_x < M - 1: walk(dc(field), ch_x + 1, ch_y, 'r') if 0 < ch_x: walk(dc(field), ch_x - 1, ch_y, 'l') if 0 < ch_y: walk(dc(field), ch_x, ch_y - 1, 'u') if ch_y < N - 1: walk(dc(field), ch_x, ch_y + 1, 'd') print(ans)
Traceback (most recent call last): File "/tmp/tmpa_3axum8/tmp_u2vv5ox.py", line 49, in <module> for e in iter(input, '0 0'): EOFError: EOF when reading a line
s093633991
p00472
u811434779
1443166057
Python
Python
py
Runtime Error
40000
16632
353
DIV = 100000 n, m = map(int, raw_input().split()) l = [input() for _ in range(n-1)] ans = [0]*(n-1) pos = 0 for _ in range(m): k = input() if k > 0: for i in range(k): ans[pos+i] += 1 else: for i in range(-1, k-1, -1): ans[pos+i] += 1 pos += k print sum((ans[i] * l[i]) % DIV for i in range(n-1)) % DIV
File "/tmp/tmpsxxi34fv/tmpijwz8o1u.py", line 14 print sum((ans[i] * l[i]) % DIV for i in range(n-1)) % DIV ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s242030032
p00472
u811434779
1443166493
Python
Python
py
Runtime Error
40000
10332
357
DIV = 100000 n, m = map(int, raw_input().split()) l = [input() for _ in range(n-1)] ans = [0]*(n-1) pos = 0 for _ in xrange(m): k = input() if k > 0: for i in xrange(k): ans[pos+i] += 1 else: for i in xrange(-1, k-1, -1): ans[pos+i] += 1 pos += k print sum((ans[i] * l[i]) % DIV for i in xrange(n-1)) % DIV
File "/tmp/tmpht56ns8_/tmpm1jdy7ao.py", line 14 print sum((ans[i] * l[i]) % DIV for i in xrange(n-1)) % DIV ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s710768916
p00472
u901080241
1496288042
Python
Python3
py
Runtime Error
40000
9064
235
n,m = map(int,input().split()) lng = [] for _ in range(n-1): lng.append(int(input())) i = 0 sm = 0 for _ in range(m): j = i+int(input()) mv = sum(lng[i:j]) if j > i else sum(lng[j:i]) sm += mv i = j print(sm%100000)
Traceback (most recent call last): File "/tmp/tmp__cyi1zl/tmpwiq67sbf.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s754859966
p00472
u901080241
1496288224
Python
Python3
py
Runtime Error
40000
9004
262
n,m = map(int,input().split()) lng = [] for _ in range(n-1): lng.append(int(input())) i = 0 sm = 0 for _ in range(m): j = i+int(input()) mv = sum(lng[i:j]) if j > i else sum(lng[j:i]) sm += mv if sm >= 100000: sm -= 100000 i = j print(sm)
Traceback (most recent call last): File "/tmp/tmpyphn8m1e/tmppihg31xk.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s347679962
p00472
u901080241
1496288598
Python
Python3
py
Runtime Error
40000
9116
245
n,m = map(int,input().split()) lng = [] for _ in range(n-1): lng.append(int(input())) i = 0 sm = 0 for _ in range(m): j = i+int(input()) mv = sum(lng[i:j]) if j > i else sum(lng[j:i]) sm += mv sm %= 100000 i = j print(sm)
Traceback (most recent call last): File "/tmp/tmpyvyohwk0/tmp3ffi0o_g.py", line 1, in <module> n,m = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s049881904
p00472
u011621222
1510225809
Python
Python3
py
Runtime Error
0
0
1441
# -*- coding: utf-8 -*- # !/usr/bin/env python # vim: set fileencoding=utf-8 : """ # # Author: Noname # URL: https://github.com/pettan0818 # License: MIT License # Created: 木 11/ 9 19:01:14 2017 # Usage # """ from itertools import accumulate def data_req(): n_yado, m_ryotei = [int(i) for i in input().split(" ")] yado_distance = [] ryotei = [] for _ in range(n_yado): yado_distance.append(int(input())) for _ in range(m_ryotei): ryotei.append(int(input())) return yado_distance, ryotei def search(distance, ryotei): """search. >>> search([2, 1, 1, 3, 2, 1], [2, -1, 3, 2, -3]) 18 """ acc = [0] + list(accumulate(distance, lambda x, y: x+y)) ryotei_index = [0] + list(accumulate(ryotei, lambda x, y: x+y)) # print(ryotei_index) res = [] for index in enumerate(ryotei_index): if index[0] == 0: continue index = index[0] # print(index) # print(ryotei_index[index]) # print(ryotei_index[index - 1]) dist = abs(acc[ryotei_index[index]] - acc[ryotei_index[index - 1]]) res.append(dist) # print(sum(res)) # his = [] # # for index in range(len(ryotei_index)): # his.append(acc[ryotei_index[index + 1]] - acc[ryotei_index[index]]) # # return sum(his) return sum(res) if __name__ == '__main__': dis, ryotei = data_req() search(dis, ryotei)
Traceback (most recent call last): File "/tmp/tmpl_yamj5l/tmphzfm3s3p.py", line 59, in <module> dis, ryotei = data_req() ^^^^^^^^^^ File "/tmp/tmpl_yamj5l/tmphzfm3s3p.py", line 18, in data_req n_yado, m_ryotei = [int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s539627994
p00472
u794549850
1391777407
Python
Python
py
Runtime Error
0
0
641
#include <stdio.h> int main() { int i; int n, m, now_pos, sum; int s[100000]; int imos[100000]; scanf("%d %d", &n, &m); for (i=0;i<n-1;i++) { scanf("%d", &s[i]); } now_pos = 0; for (i=0;i<m;i++) { int a; scanf("%d", &a); if (a < 0) { imos[now_pos] -= 1; imos[now_pos+a] += 1; } else { imos[now_pos] += 1; imos[now_pos+a] -= 1; } now_pos += a; } sum = imos[0] * s[0]; for (i=1;i<n;i++) { imos[i] += imos[i-1]; sum += imos[i] * s[i]; } printf("%d\n", sum); }
File "/tmp/tmp4e78fe_j/tmpvqdw6aks.py", line 3 int main() { ^^^^ SyntaxError: invalid syntax
s690409910
p00473
u621997536
1425296611
Python
Python3
py
Runtime Error
19920
6708
18
while True: pass
s048464451
p00473
u811434779
1444998291
Python
Python
py
Runtime Error
40000
8480
267
n = input() l = [input() for i in range(n-1)] dp = [[n*n]*2 for i in range(n+1)] dp[1][0] = 0 for i in range(1,n): for j in range(i+1,0,-1): dp[j][1] = min(dp[j][1], dp[j][0]+l[i-1]) dp[j][0] = min(dp[j-1][0], dp[j-1][1]+l[i-1]) print min(dp[n/2])
File "/tmp/tmprnskm4bm/tmp0cltf1lt.py", line 9 print min(dp[n/2]) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s786028238
p00473
u811434779
1444998655
Python
Python
py
Runtime Error
40000
8508
279
INF = 1<<31 n = input() l = [input() for i in range(n-1)] dp = [[INF]*2 for i in range(n+1)] dp[1][0] = 0 for i in range(1,n): for j in range(i+1,0,-1): dp[j][1] = min(dp[j][1], dp[j][0]+l[i-1]) dp[j][0] = min(dp[j-1][0], dp[j-1][1]+l[i-1]) print min(dp[n/2])
File "/tmp/tmp7bcw4h3b/tmprrzpoagw.py", line 10 print min(dp[n/2]) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s268814968
p00473
u811434779
1445004338
Python
Python
py
Runtime Error
40000
7844
283
INF = 1<<31 n = input() l = [input() for i in xrange(n-1)] dp = [[INF]*2 for i in xrange(n+1)] dp[1][0] = 0 for i in xrange(1,n): for j in xrange(i+1,0,-1): dp[j][1] = min(dp[j][1], dp[j][0]+l[i-1]) dp[j][0] = min(dp[j-1][0], dp[j-1][1]+l[i-1]) print min(dp[n/2])
File "/tmp/tmpspx44nyk/tmphf6a4u13.py", line 10 print min(dp[n/2]) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s379004160
p00473
u811434779
1445004695
Python
Python
py
Runtime Error
40000
7884
299
INF = 1<<31 n = input() l = [0]*(n+1) for i in xrange(1,n): l[i] = input() dp = [[INF]*2 for i in xrange(n+1)] dp[1][0] = 0 for i in xrange(1,n): for j in xrange(i+1,0,-1): dp[j][1] = min(dp[j][1], dp[j][0]+l[i]) dp[j][0] = min(dp[j-1][0], dp[j-1][1]+l[i]) print min(dp[n/2])
File "/tmp/tmpoyeidrs7/tmpetfieeew.py", line 12 print min(dp[n/2]) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s751708361
p00473
u078042885
1485161261
Python
Python3
py
Runtime Error
40000
7972
188
dp=[0]+[1<<20]*10000 n=int(input()) for i in range(1,n): a=int(input()) for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmpizarxtaw/tmpxejseait.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s383823053
p00473
u078042885
1485162354
Python
Python3
py
Runtime Error
0
0
190
dp=[0]+[1<<20]*10000 n=int(input()) for i in range(1,n+1): a=int(input()) for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmpvg1ppd5a/tmpvkow12xt.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s525745808
p00473
u078042885
1485163079
Python
Python3
py
Runtime Error
40000
8008
209
dp=[0]+[1<<20]*10000 n=int(input()) for i in range(1,n): try:a=int(input()) except:break for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmp0r0b8p7u/tmpyd8nb2tt.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s901927841
p00473
u078042885
1485163922
Python
Python3
py
Runtime Error
40000
8048
211
dp=[0]+[1<<20]*10000 n=int(input()) for i in range(1,n+1): try:a=int(input()) except:break for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmp4rkvfdlt/tmpz7ra_nvu.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s876130401
p00473
u078042885
1485165587
Python
Python3
py
Runtime Error
40000
8688
234
import sys dp=[0]+[1<<20]*10000 n=int(input()) a=list(map(int,sys.stdin.readlines())) for i in range(1,len(a)): for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a[i-1]),(dp[i-j],dp[j]+a[i-1])]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmpjgii_hoz/tmp7509_prb.py", line 3, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s377828182
p00473
u078042885
1485166106
Python
Python3
py
Runtime Error
40000
8712
229
import sys dp=[0]+[1<<20]*10000 n=int(input()) a=list(map(int,sys.stdin.readlines())) for i in range(1,n): for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a[i-1]),(dp[i-j],dp[j]+a[i-1])]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmprovm_yhw/tmprgmr9yv_.py", line 3, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s762863200
p00473
u078042885
1485168631
Python
Python3
py
Runtime Error
40000
8632
337
#???????????±???????????\????????°????????£????????????? import sys dp = [0] + [1 << 20] * 10000 n = int(input()) a = list(map(int, sys.stdin.readlines())) if len(a)==n:a.pop() for i in range(1, n) : for j in range(i//2+1): dp[j], dp[i - j] = map(min, [(dp[j], dp[i - j] + a[i - 1]), (dp[i - j], dp[j] + a[i - 1])]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmpjt27in8e/tmpzxg4pwk8.py", line 4, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s342568110
p00473
u078042885
1485171099
Python
Python3
py
Runtime Error
40000
8064
225
dp=[0]+[1<<20]*10000 n=int(input()) for i in range(1,n): a=int(input()) for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2]) try:raise RuntimeError except:exit()
Traceback (most recent call last): File "/tmp/tmp00lua0ki/tmp6kfwxvsl.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s885014037
p00473
u078042885
1485172496
Python
Python3
py
Runtime Error
40000
8048
195
dp=[0]+[1<<20]*10000 n=int(input()) for i in range(1,n): a=int(input()) for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2]) exit()
Traceback (most recent call last): File "/tmp/tmporxaymqm/tmpy3uyfznh.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s742683095
p00473
u078042885
1485199651
Python
Python3
py
Runtime Error
40000
7944
221
dp=[0]+[1<<20]*10000 n=int(input()) c=0 for i in range(1,n): if c==n-1:break a=int(input()) c+=1 for j in range(i//2+1): dp[j],dp[i-j]=map(min,[(dp[j],dp[i-j]+a),(dp[i-j],dp[j]+a)]) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmpg_74dfxv/tmp87p9_c94.py", line 2, in <module> n=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s601057742
p00473
u901080241
1496295240
Python
Python3
py
Runtime Error
40000
7760
233
n = int(input()) dp = [float('inf')]*(n+1) dp[0] = 0 for i in range(1,n): cost = int(input()) for j in range(i): dp[j] = min(dp[j],dp[i-j]+cost) dp[i-j] = min(dp[j]+cost,dp[i-j]) #print(dp) print(dp[n//2])
Traceback (most recent call last): File "/tmp/tmp1lhm2ghf/tmp94gvqlzg.py", line 1, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s601773147
p00473
u352394527
1525788288
Python
Python3
py
Runtime Error
17490
5976
733
INF = 100 n = int(input()) l = [0 if i == 0 else int(input()) for i in range(n)] #dp = [[[INF] * 2 for i in range(n // 2 + 1)] for j in range(n + 1)] # #dp[1][1][0] = 0 #dp[1][0][1] = 0 # #for i in range(2,n + 1): # for j in range(1,n // 2 + 1): # dp[i][j][0] = min(dp[i - 1][j - 1][0], dp[i - 1][j - 1][1] + l[i - 1]) # dp[i][j][1] = min(dp[i - 1][j][1], dp[i - 1][j][0] + l[i - 1]) #print(min(dp[n][n//2][0], dp[n][n//2][1])) # dp = [[INF] * 2 for i in range(n // 2 + 1)] dp[1][0] = 0 dp[0][1] = 0 for i in range(2, n + 1): for j in range(n // 2, -1, -1): a = min(dp[j - 1][0], dp[j - 1][1] + l[i - 1]) b = min(dp[j][1], dp[j][0] + l[i - 1]) dp[j][0] = a dp[j][1] = b print(max(dp[n//2][0], dp[n//2][1]))
Traceback (most recent call last): File "/tmp/tmpmz09884t/tmprq1_p6zp.py", line 2, in <module> n = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s446184621
p00474
u266872031
1448045150
Python
Python
py
Runtime Error
40000
12936
861
[N,L]=[int(x) for x in raw_input().split()] icelist=[0] for i in range(N): icelist.append(int(raw_input())) icelist.append(0) incindex=[] for i in range(1,N+1): if icelist[i]>icelist[i-1] and icelist[i]>icelist[i+1]: incindex.append(i) ans=0 popped=0 while popped<N: addindex=[] delindex=[] t=L-max([icelist[i] for i in incindex]) ans+=t for ii in incindex: icelist[ii]+=t if icelist[ii]==L: popped+=1 delindex.append(ii) icelist[ii]=0 if ii-1>0: if icelist[ii-1]>icelist[ii-2]: addindex.append(ii-1) if ii+1<N+1: if icelist[ii+1]>icelist[ii+2]: addindex.append(ii+1) for k in delindex: incindex.remove(k) for j in addindex: incindex.append(j) print ans
File "/tmp/tmpkapvq9at/tmpcyr9rh77.py", line 33 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s761719295
p00474
u894114233
1470732389
Python
Python
py
Runtime Error
40000
11216
369
n,l=map(int,raw_input().split()) a=[0]+[int(raw_input()) for _ in xrange(n)]+[0] cnt=0 while a!=[0]*(n+2): t_id=[] max_t=-1 for i in xrange(1,n+1): if a[i-1]<a[i] and a[i]>a[i+1]: t_id.append(i) if max_t<a[i]: max_t=a[i] cnt+=l-max_t for i in t_id: a[i]+=l-max_t a[i]=a[i]%l print(cnt)
Traceback (most recent call last): File "/tmp/tmpnwxzqq7m/tmp3lgxdv2t.py", line 1, in <module> n,l=map(int,raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s325073194
p00474
u894114233
1474977331
Python
Python
py
Runtime Error
40000
12912
609
n,l=map(int,raw_input().split()) a=[0]+[int(raw_input()) for _ in xrange(n)]+[0] r=[0]*(n+2) for i in xrange(1,n+1): if a[i-1]<a[i] and a[i]>a[i+1]: r[i]=0 elif a[i-1]<a[i] and a[i]<a[i+1]: r[i]=1 elif a[i-1]>a[i] and a[i]>a[i+1]: r[i]=1 else: r[i]=2 time=[0]*(n+2) while r!=[-1]*(n+2): for i in xrange(1,n+1): if r[i]==0: r[i]=-1 time[i]+=l-a[i] time[i-1]=max(time[i-1],time[i]) time[i+1]=max(time[i+1],time[i]) if r[i-1]!=-1:r[i-1]-=1 if r[i+1]!=-1:r[i+1]-=1 print(max(time))
Traceback (most recent call last): File "/tmp/tmpuqmpwsjv/tmp46k_hmtk.py", line 1, in <module> n,l=map(int,raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s244480462
p00474
u894114233
1474978906
Python
Python
py
Runtime Error
40000
11064
379
n,l=map(int,raw_input().split()) a=[0]+[int(raw_input()) for _ in xrange(n)]+[0] ti=[0]*(n+2) while a!=[0]*(n+2): for i in xrange(1,n+1): if a[i-1]<a[i] and a[i]>a[i+1]: ti[i]+=l-a[i] a[i]=0 if a[i-1]!=0: ti[i-1]=max(ti[i-1],ti[i]) if a[i+1]!=0: ti[i+1]=max(ti[i+1],ti[i]) print(max(ti))
Traceback (most recent call last): File "/tmp/tmpa5l5o18s/tmptiaew95b.py", line 1, in <module> n,l=map(int,raw_input().split()) ^^^^^^^^^ NameError: name 'raw_input' is not defined
s339179497
p00474
u198881450
1497439268
Python
Python3
py
Runtime Error
0
0
865
def greedy(N,L,ices): counts = 0 while True: for i in range(len(ices)): if 0 < i < N-1: if ices[i] > ices[i-1] and ices[i] > ices[i+1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == 0: if ices[i] > ices[1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == N-1: if ices[i] > ices[N-2]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 if ices.count(0) == N: print(counts) return counts += 1 N,L = input().rstrip().split() ices = [] while True: ice = input().rstrip() ices.append(ice) if len(ices) == N: break greedy(N,L,ices)
Traceback (most recent call last): File "/tmp/tmp8f6qdf3g/tmpunxt1kqz.py", line 26, in <module> N,L = input().rstrip().split() ^^^^^^^ EOFError: EOF when reading a line
s921684860
p00474
u945345165
1497439437
Python
Python3
py
Runtime Error
40000
19460
766
def update(arr, diff): neoArr = [] for i in range(len(arr)): tmp = 0 if i==0: if arr[i]>arr[i+1]: tmp = diff elif i==len(arr)-1: if arr[i]>arr[i-1]: tmp = diff else: if arr[i]>arr[i-1] and arr[i]>arr[i+1]: tmp = diff neoArr.append(arr[i] + tmp) if neoArr[i] == L: neoArr[i] = 0 return neoArr def solve(arr): count = 0 while True: maxInt = max(arr) if maxInt == 0: break diff = L-maxInt arr = update(arr,diff) count += diff return count N,L = map(int,input().split(' ')) arr = [] for i in range(N): arr.append(int(input())) print(solve(arr))
Traceback (most recent call last): File "/tmp/tmpsi9zw01w/tmpgcmem43d.py", line 30, in <module> N,L = map(int,input().split(' ')) ^^^^^^^ EOFError: EOF when reading a line
s123801403
p00474
u198881450
1497439740
Python
Python3
py
Runtime Error
0
0
940
def greedy(N,L,ices): counts = 1 while True: # print(ices) for i in range(len(ices)): if 0 < i < N-1: if ices[i] > ices[i-1] and ices[i] > ices[i+1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == 0: if ices[i] > ices[1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == N-1: if ices[i] > ices[N-2]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 if ices.count(0) == N: print(counts) return counts += 1 N,L = input().rstrip().split() ices = [] while True: ice = input().rstrip() ices.append(ice) if len(ices) == N: break # N = 4 # L = 6 # ices = [4,2,3,5] greedy(N,L,ices)
Traceback (most recent call last): File "/tmp/tmpk52gqr7e/tmpd3n345e2.py", line 28, in <module> N,L = input().rstrip().split() ^^^^^^^ EOFError: EOF when reading a line
s217259789
p00474
u198881450
1497443016
Python
Python3
py
Runtime Error
0
0
1723
import copy def greedy(N,L,ices): counts = 1 while True: # print(ices) copied = copy.deepcopy(ices) for i in range(len(ices)): if copied[i] != 0: if 0 < i < N-1: if copied[i] >= L: ices[i] = 0 break if copied[i] > copied[i-1] and copied[i] > copied[i+1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == 0: if copied[i] >= L: ices[i] = 0 break if copied[i] > copied[1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == N-1: if ices[i] >= L: ices[i] = 0 break if copied[i] > copied[N-2]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 copied = ices if ices.count(0) == N: print(counts) return counts += 1 # N,L = map(int,input().strip().split()) # ices = [] # while True: # ice = int(input().strip()) # ices.append(ice) # if len(ices) == N: # break # N = 4 # L = 6 # ices = [4,2,3,5] # N = 6 # L = 10 # ices = [3,4,1,9,5,1] with open("aoj.txt") as infile: N,L = map(int,infile.readline().strip().split()) ices = [] while True: ice = int(infile.readline()) ices.append(ice) if len(ices) == N: break greedy(N,L,ices)
Traceback (most recent call last): File "/tmp/tmpe58cu11e/tmphdbgzbz6.py", line 59, in <module> with open("aoj.txt") as infile: ^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'aoj.txt'
s074419093
p00474
u198881450
1497443040
Python
Python3
py
Runtime Error
40000
14000
1725
import copy def greedy(N,L,ices): counts = 1 while True: # print(ices) copied = copy.deepcopy(ices) for i in range(len(ices)): if copied[i] != 0: if 0 < i < N-1: if copied[i] >= L: ices[i] = 0 break if copied[i] > copied[i-1] and copied[i] > copied[i+1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == 0: if copied[i] >= L: ices[i] = 0 break if copied[i] > copied[1]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 elif i == N-1: if ices[i] >= L: ices[i] = 0 break if copied[i] > copied[N-2]: ices[i] += 1 if ices[i] >= L: ices[i] = 0 copied = ices if ices.count(0) == N: print(counts) return counts += 1 N,L = map(int,input().strip().split()) ices = [] while True: ice = int(input().strip()) ices.append(ice) if len(ices) == N: break # N = 4 # L = 6 # ices = [4,2,3,5] # N = 6 # L = 10 # ices = [3,4,1,9,5,1] # with open("aoj.txt") as infile: # N,L = map(int,infile.readline().strip().split()) # ices = [] # while True: # ice = int(infile.readline()) # ices.append(ice) # if len(ices) == N: # break greedy(N,L,ices)
Traceback (most recent call last): File "/tmp/tmpay0gtotq/tmpeku2cpkc.py", line 43, in <module> N,L = map(int,input().strip().split()) ^^^^^^^ EOFError: EOF when reading a line
s427739111
p00474
u940389926
1497445626
Python
Python3
py
Runtime Error
0
0
1455
N, L = 0, 0 def loadIcicle(): N, L = 0, 0 i = 0 icicles = [] line = sys.stdin.readline().strip() while True: if i == 0: N, L = int(line.split(" ")[0]), int(line.split(" ")[1]) i += 1 continue line = sys.stdin.readline().strip() if line == "": break icicles.append(int(line)) i += 1 if i == N+1: break return icicles, N, L icicles, N, L = loadIcicle() def calcDiff(icicles, N): diff_2times = [] for _ in range(len(icicles)): diff_2times.append(0) for idx in range(len(icicles)): dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx] dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx] peak = dif_left * dif_right < 0 if peak and dif_left > 0: diff_2times[idx] = -1 elif peak and dif_right > 0: diff_2times[idx] = 1 else: diff_2times[idx] = 0 return diff_2times diff_2times = calcDiff(icicles, N) time = [] for _ in range(len(icicles)): time.append(-1) for i in range(len(icicles)): if diff_2times[i] == -1: time[i] = L - icicles[i] for i in range(len(icicles)): if time[i] == -1: pass else: continue if diff_2times[i] == 0: pass else: continue if time[i-1] != -1: time[i] = (L-icicles[i]) + time[i-1] elif time[i+1] != -1: time[i] = (L-icicles[i]) + time[i+1] for i in range(len(icicles)): if time[i] == -1: pass else: continue if diff_2times[i] == 1: pass else: continue time[i] = (L-icicles[i]) + max(time[i-1], time[i+1]) print(max(time))
Traceback (most recent call last): File "/tmp/tmpbllob_z_/tmpzf_9ch_4.py", line 19, in <module> icicles, N, L = loadIcicle() ^^^^^^^^^^^^ File "/tmp/tmpbllob_z_/tmpzf_9ch_4.py", line 7, in loadIcicle line = sys.stdin.readline().strip() ^^^ NameError: name 'sys' is not defined
s888920137
p00474
u028939600
1497454626
Python
Python
py
Runtime Error
0
0
711
def orderN(N,L,ices): upPeak = L - ices[0] downPeak = L - ices[0] peaks = [] for i in xrange(len(ices)): if i < N-1: if ices[i] < ices[i+1]: peaks.append(downPeak) downPeak = L - ices[i+1] upPeak += L - ices[i+1] else: peaks.append(upPeak) upPeak = L - ices[i+1] downPeak += L - ices[i+1] else: peaks.append(upPeak) peaks.append(downPeak) print(max(peaks)) N,L = map(int,rawinput().strip().split()) ices = [] while True: ice = int(rawinput().strip()) ices.append(ice) if len(ices) == N: break orderN(N,L,ices)
Traceback (most recent call last): File "/tmp/tmpgsxu9z_r/tmpfqv5nt3w.py", line 20, in <module> N,L = map(int,rawinput().strip().split()) ^^^^^^^^ NameError: name 'rawinput' is not defined
s782493657
p00474
u028939600
1497494305
Python
Python
py
Runtime Error
0
0
675
def orderN(N,L,ices): upPeak = L - ices[0] downPeak = L - ices[0] peaks = [] for i in range(len(ices)): if i < N-1: if ices[i] < ices[i+1]: peaks.append(downPeak) downPeak = L - ices[i+1] upPeak += L - ices[i+1] elif ices[i] > ices[i+1]: peaks.append(upPeak) upPeak = L - ices[i+1] downPeak += L - ices[i+1] elif i == N-1: peaks.append(upPeak) peaks.append(downPeak) print(max(peaks)) N,L = map(int,input().strip().split()) ices = [int(raw_input().strip()) for _ in xrange(N)] orderN(N,L,ices)
Traceback (most recent call last): File "/tmp/tmpkqqkupra/tmpfuql75gb.py", line 20, in <module> N,L = map(int,input().strip().split()) ^^^^^^^ EOFError: EOF when reading a line
s918860694
p00474
u940389926
1497534907
Python
Python3
py
Runtime Error
0
0
1635
## ????????? def loadIcicle(): icicles = [] line = input().strip().split(" ") N, L = int(line[0]), int(line[1]) while True: icicles.append(int(input().strip())) if len(icicles) == N: break return icicles, N, L icicles, N, L = loadIcicle() def calcDiff(icicles, N): diff_2times = [0]*len(icicles) for idx in range(len(icicles)): dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx] dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx] dif_right = 1 if dif_right > 0 else -1 dif_left = 1 if dif_left > 0 else -1 if dif_right - dif_left < 0: diff_2times[idx] = -1 elif dif_right - dif_left > 0: diff_2times[idx] = 1 else: diff_2times[idx] = 0 return diff_2times diff_2times = calcDiff(icicles, N) time = [-1]*len(icicles) peakX = [i for i in range(len(diff_2times)) if diff_2times[i]==-1] # ?????????(?????????)???index????????? for i in peakX: time[i] = L - icicles[i] isLocalMinL, isLocalMinR = False, False posL = i posR = i while not (isLocalMinL and isLocalMinR): posL -= 1 # ?£????????????£?????????????¨???? if not isLocalMinL: if time[posL] == -1: time[posL] = (L-icicles[posL]) + time[posL+1] else: time[posL] = (L-icicles[posL]) + max(time[posL-1], time[posL+1]) # ???????????????????????? if diff_2times[posL] == 1 or posL == 0: isLocalMinL = True posR += 1 if not isLocalMinR: if time[posR] == -1: time[posR] = (L-icicles[posR]) + time[posR-1] else: time[posR] = (L-icicles[posR]) + max(time[posR-1], time[posR+1]) if diff_2times[posR] == 1 or posR == N-1: isLocalMinR = True print(max(time))
Traceback (most recent call last): File "/tmp/tmpawkg92sz/tmpb5onbo7i.py", line 10, in <module> icicles, N, L = loadIcicle() ^^^^^^^^^^^^ File "/tmp/tmpawkg92sz/tmpb5onbo7i.py", line 4, in loadIcicle line = input().strip().split(" ") ^^^^^^^ EOFError: EOF when reading a line
s300274723
p00474
u940389926
1497545180
Python
Python3
py
Runtime Error
0
0
1279
def loadIcicle(): icicles = [] line = input().strip().split(" ") N, L = int(line[0]), int(line[1]) for _ in range(N): icicles.append(int(input().strip())) return icicles, N, L def calcDiff(icicles, N): diff_2times = [0]*N for idx in range(N): dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx] dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx] dif_right = 1 if dif_right > 0 else -1 dif_left = 1 if dif_left > 0 else -1 if dif_right - dif_left < 0: diff_2times[idx] = -1 elif dif_right - dif_left > 0: diff_2times[idx] = 1 else: diff_2times[idx] = 0 return diff_2times icicles, N, L = loadIcicle() diff_2times = calcDiff(icicles, N) time = [-1]*N peakX = [i for i in range(N) if diff_2times[i] == -1] for i in peakX: time[i] = L - icicles[i] posL, posR = i, i while True: posL -= 1 if posL < 0: break if not isLocalMinL: left = 0 if posL-1 < 0 else time[posL-1] time[posL] = (L-icicles[posL]) + max(left, time[posL+1]) if diff_2times[posL] == 1: break while True: posR += 1 if posR > N-1: break if not isLocalMinR: right = 0 if posR+1 > N-1 else time[posR+1] time[posR] = (L-icicles[posR]) + max(time[posR-1], right) if diff_2times[posR] == 1: break print(max(time))
Traceback (most recent call last): File "/tmp/tmp5honmpow/tmpt6mqil6y.py", line 25, in <module> icicles, N, L = loadIcicle() ^^^^^^^^^^^^ File "/tmp/tmp5honmpow/tmpt6mqil6y.py", line 3, in loadIcicle line = input().strip().split(" ") ^^^^^^^ EOFError: EOF when reading a line
s075776604
p00474
u940389926
1497545624
Python
Python3
py
Runtime Error
40000
7832
1367
def loadIcicle(): icicles = [] line = input().strip().split(" ") N, L = int(line[0]), int(line[1]) while True: icicles.append(int(input().strip())) if len(icicles) == N: break return icicles, N, L def calcDiff(icicles, N): diff_2times = [0]*N for idx in range(N): dif_right = icicles[idx+1] - icicles[idx] if idx != N-1 else -icicles[idx] dif_left = icicles[idx] - icicles[idx-1] if idx != 0 else icicles[idx] dif_right = 1 if dif_right > 0 else -1 dif_left = 1 if dif_left > 0 else -1 if dif_right - dif_left < 0: diff_2times[idx] = -1 elif dif_right - dif_left > 0: diff_2times[idx] = 1 else: diff_2times[idx] = 0 return diff_2times icicles, N, L = loadIcicle() diff_2times = calcDiff(icicles, N) time = [-1]*N peakX = [i for i in range(N) if diff_2times[i]==-1] for i in peakX: time[i] = L - icicles[i] isLocalMinL, isLocalMinR = False, False posL, posR = i, i while not (isLocalMinL and isLocalMinR): posL -= 1 if posL < 0: isLocalMinL = True if not isLocalMinL: left = 0 if posL-1 < 0 else time[posL-1] time[posL] = (L-icicles[posL]) + max(left, time[posL+1]) if diff_2times[posL] == 1: isLocalMinL = True if not isLocalMinR: right = 0 if posR+1 > N-1 else time[posR+1] time[posR] = (L-icicles[posR]) + max(time[posR-1], right) if diff_2times[posR] == 1: isLocalMinR = True print(max(time))
Traceback (most recent call last): File "/tmp/tmphw7m3hvo/tmp_6flogay.py", line 26, in <module> icicles, N, L = loadIcicle() ^^^^^^^^^^^^ File "/tmp/tmphw7m3hvo/tmp_6flogay.py", line 3, in loadIcicle line = input().strip().split(" ") ^^^^^^^ EOFError: EOF when reading a line
s059080085
p00474
u352394527
1525847571
Python
Python3
py
Runtime Error
0
0
364
def solve(): n,l = map(int,input().split()) length = [int(input()) for i in range(n)] pare = [(length[i], i) for i in range(n)] pare.sort(reverse=True) dp = [0] * (n + 1) for p in pare: i = p[0] if i == 0: dp[i] = dp[i + 1] + (l - length[i]) else: dp[i] = max(dp[i - 1], dp[i + 1]) + (l - length[i]) print(max(dp)) solve()
Traceback (most recent call last): File "/tmp/tmp85e9mzuv/tmpm9ppj5nl.py", line 15, in <module> solve() File "/tmp/tmp85e9mzuv/tmpm9ppj5nl.py", line 2, in solve n,l = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line
s647594167
p00476
u811733736
1506311035
Python
Python3
py
Runtime Error
40000
15616
1549
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0553 """ import sys from sys import stdin from heapq import heappop, heappush input = stdin.readline def solve(): pass def main(args): N, H = map(int, input().split()) MAX_H = H costs = [] wells = [] for _ in range(N - 1): di, hi = map(int, input().split()) costs.append(di) wells.append(hi) costs.append(0) wells.append(0) ans = 0 floor = 1 repeat = True while floor < N: # ?£????????????§N????????§??°?????§??????????????§???????????? pq = [] while H > 0: heappush(pq, [-1 * min(MAX_H - H, wells[floor - 1]), floor, H]) c = costs[floor - 1] H -= c if floor >= N or H < 1: break floor += 1 if H > 0: break # ??°?????§??????????????°??????????????§??????????????§??????????????????????????°?????§???????????????????????? # ????????§???????????? min(MAX_H - H, ???????????????) ???????????? # ?????????????????¨??????????¬???????????????? MAX_H - (H + ???????????????) ??¨????????? replenish, f, orig_H = heappop(pq) H = min(orig_H - replenish, MAX_H) ans += 1 # ???????????¨???????????¨????????????H?????????????????§????????????????????¢????????£????????¨???????????¢?´¢???????????´?????? floor = f print(ans) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmpw6pdcplu/tmp1mr38qiv.py", line 63, in <module> main(sys.argv[1:]) File "/tmp/tmpw6pdcplu/tmp1mr38qiv.py", line 17, in main N, H = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s150254412
p00476
u811733736
1506338728
Python
Python3
py
Runtime Error
40000
15652
1830
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0553 """ import sys from sys import stdin from heapq import heappop, heappush input = stdin.readline def main(args): N, H = map(int, input().split()) MAX_H = H costs = [] wells = [] for _ in range(N - 1): di, hi = map(int, input().split()) costs.append(di) wells.append(hi) costs.append(1e7) wells.append(0) ans = 0 floor = 1 while floor < N: # ?£????????????§N????????§??°?????§??????????????§???????????? pq = [] while H > 0: if H != MAX_H: heappush(pq, [-1 * min(MAX_H-H, wells[floor - 1]), -floor, wells[floor - 1], H]) c = costs[floor - 1] H -= c floor += 1 if floor > N: break # ??°?????§??????????????°??????????????§??????????????§??????????????????????????°?????§???????????????????????? # ????????§???????????? min(MAX_H - H, ???????????????) ???????????? # ?????????????????¨??????????¬???????????????? MAX_H - (H + ???????????????) ??¨????????? replenish, f, replenish_orig, orig_H = heappop(pq) # if replenish == -replenish_orig: # if H == 0: # rep = 1 # else: # rep = -H // replenish_orig # if H % replenish_orig != 0: # rep += 1 # # H = orig_H + (replenish_orig * rep) # ans += rep # else: H = orig_H - replenish ans += 1 # ???????????¨???????????¨????????????H?????????????????§????????????????????¢????????£????????¨???????????¢?´¢???????????´?????? floor = -f print(ans) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmp17ohf1da/tmprc_z0hhp.py", line 70, in <module> main(sys.argv[1:]) File "/tmp/tmp17ohf1da/tmprc_z0hhp.py", line 13, in main N, H = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s582936170
p00476
u811733736
1507118353
Python
Python3
py
Runtime Error
40000
15688
3587
# -*- coding: utf-8 -*- """ http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0553 """ import sys from sys import stdin from heapq import heappop, heappush import time input = stdin.readline class RMQ(object): INT_MAX = 2**31 - 1 def __init__(self, nn): self.n = 1 while self.n < nn: self.n *= 2 self.dat = [RMQ.INT_MAX] * ((2 * self.n)-1) def update(self, k, a): # A[k]???a?????´??°?????????????????°???????????¨?????´??° k += (self.n - 1) self.dat[k] = a while k > 0: k = (k - 1) // 2 # ??????index?????? self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) # ???????????¨??????????????????????°?????????????????????´??° def add(self, k, a): # A[k]???a??????????????????????????°???????????¨?????´??° k += (self.n - 1) self.dat[k] += a while k > 0: k = (k - 1) // 2 # ??????index?????? self.dat[k] = min(self.dat[k * 2 + 1], self.dat[k * 2 + 2]) # ???????????¨??????????????????????°?????????????????????´??° def query(self, a, b, k, l, r): # [a, b)???????°????????±??????? (0????????§b???????????????) # ??????????????¨?????????query(a, b, 0, 0, n)?????¢??§??????????????????k, l, r???????????????????????´??°????????? if r <= a or b <= l: # ?????????????????§??¨?????????????????? return RMQ.INT_MAX if a <=l and r <= b: return self.dat[k] # ???????????°???????????????????????§????????°????????¨??????????????????????°????????????????????????? else: 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 find(self, s, t): return self.query(s, t+1, 0, 0, self.n) def solve_hq(N, H, costs, wells): MAX_H = H ans = 0 floor = 1 repeat = True while floor < N: # ?£????????????§N????????§??°?????§??????????????§???????????? pq = [] while H > 0: deficit = MAX_H - H if deficit != 0: heappush(pq, [-1 * min(MAX_H - H, wells[floor - 1]), wells[floor - 1], floor, H]) c = costs[floor - 1] H -= c if floor >= N or H < 1: break floor += 1 if H > 0: return ans # ??°?????§??????????????°??????????????§??????????????§??????????????????????????°?????§???????????????????????? # ????????§???????????? min(MAX_H - H, ???????????????) ???????????? # ?????????????????¨??????????¬???????????????? MAX_H - (H + ???????????????) ??¨????????? replenish, replenish_orig, f, orig_H = heappop(pq) H = min(orig_H - replenish, MAX_H) ans += 1 # ???????????¨???????????¨????????????H?????????????????§????????????????????¢????????£????????¨???????????¢?´¢???????????´?????? floor = f def main(args): # start = time.clock() N, H = map(int, input().split()) costs = [] wells = [] for _ in range(N - 1): di, hi = map(int, input().split()) costs.append(di) wells.append(hi) costs.append(0) wells.append(0) ans = solve_hq(N, H, costs, wells) print(ans) # end = time.clock() # print('elapsed: {}'.format(end - start)) if __name__ == '__main__': main(sys.argv[1:])
Traceback (most recent call last): File "/tmp/tmp2s39khf0/tmppioz2vyi.py", line 113, in <module> main(sys.argv[1:]) File "/tmp/tmp2s39khf0/tmppioz2vyi.py", line 93, in main N, H = map(int, input().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s897465492
p00478
u235282710
1443690841
Python
Python3
py
Runtime Error
0
0
145
keyword = raw_input() N = int(raw_input()) count = 0 for _ in xrange(N): s = raw_input() if keyword in (s+s): count += 1 print count
File "/tmp/tmpg8f75i6f/tmpwezqpuqa.py", line 13 print count ^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s377655084
p00479
u145563629
1430825774
Python
Python
py
Runtime Error
19930
4252
611
N = int(raw_input()) k = int(raw_input()) while k: k -= 1 x, y = map(int, raw_input().split()) two = 0 while 1: a_y = two + 1 a_x = two + 1 f = 0 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_y += 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_x += 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_y -= 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_x -= 1 if f == 1: print two % 3 + 1 break two += 1
File "/tmp/tmpjgs5u1nb/tmphsixho1t.py", line 40 print two % 3 + 1 ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s403129742
p00479
u145563629
1430826408
Python
Python
py
Runtime Error
19930
4264
650
N = int(raw_input()) k = int(raw_input()) lis = [] while k: k -= 1 x, y = map(int, raw_input().split()) two = 0 while 1: a_y = two + 1 a_x = two + 1 f = 0 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_y += 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_x += 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_y -= 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_x -= 1 if f == 1: lis.append(two % 3 + 1) break two += 1 for i in lis: print i
File "/tmp/tmpdydimf3a/tmpd5cla5le.py", line 47 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s242477027
p00479
u145563629
1430827764
Python
Python
py
Runtime Error
19930
4268
688
N = int(raw_input()) k = int(raw_input()) lis = [] while k: k -= 1 x, y = map(int, raw_input().split()) two = 0 f = 0 while f != 1: a_y = two + 1 a_x = two + 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_y += 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_x += 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_y -= 1 for i in range(N - two * 2 - 1): if x == a_x and y == a_y: f = 1 break a_x -= 1 if N % 2 == 1 and two >= N / 2 + 1: break two += 1 lis.append((two - 1) % 3 + 1) for i in lis: print i
File "/tmp/tmpfsf8zhkk/tmpyls1wnho.py", line 48 print i ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s381579662
p00479
u560838141
1364457064
Python
Python
py
Runtime Error
0
0
128
s = input() n = input() for i in range(n): x, y = input()-1, input()-1 p = min(x, y, s - x - 1, s - y - 1) print p % 3 + 1
File "/tmp/tmpxe_xleke/tmp1c6yc__o.py", line 6 print p % 3 + 1 ^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s024923712
p00479
u104911888
1375353316
Python
Python
py
Runtime Error
170
12144
346
N=input() L=[[0]*N for i in range(N)] R,B,Y=1,2,3 C=R for y in range(N/2+1): for x in range(y,N-y): L[y][x]=C L[N-y-1][x]=C C=C%3+1 C=R for x in range(N/2+1): for y in range(x,N-x): L[y][x]=C L[y][N-x-1]=C C=C%3+1 for i in range(input()): a,b=map(int,raw_input().split()) print L[b-1][a-1]
File "/tmp/tmpyv_q4v2c/tmpztdahw7w.py", line 19 print L[b-1][a-1] ^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s840984216
p00480
u227162786
1490179975
Python
Python3
py
Runtime Error
0
0
510
while True: N = int(input()) if N == 0: break a = list(map(int, input().split())) ## dp[i][j]: i???????????°????????§??§j????????????????????° dp = [[0 for j in range(21)] for i in range(N-1)] dp[0][a[0]] = 1 for i in range(1, N-1): for j in range(21): if (j - a[i]) in range(21): dp[i][j] += dp[i-1][j-a[i]] if (j + a[i]) in range(21): dp[i][j] += dp[i-1][j+a[i]] print(dp[N-2][a[N-1]])
Traceback (most recent call last): File "/tmp/tmp88un9bqw/tmpt0akwxe6.py", line 2, in <module> N = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s232391770
p00480
u227162786
1490180034
Python
Python3
py
Runtime Error
0
0
441
while True: N = int(input()) if N == 0: break a = list(map(int, input().split())) dp = [[0 for j in range(21)] for i in range(N-1)] dp[0][a[0]] = 1 for i in range(1, N-1): for j in range(21): if (j - a[i]) in range(21): dp[i][j] += dp[i-1][j-a[i]] if (j + a[i]) in range(21): dp[i][j] += dp[i-1][j+a[i]] print(dp[N-2][a[N-1]])
Traceback (most recent call last): File "/tmp/tmpfll9dq59/tmppz9nanka.py", line 2, in <module> N = int(input()) ^^^^^^^ EOFError: EOF when reading a line
s721629079
p00480
u469154576
1495612248
Python
Python3
py
Runtime Error
0
0
357
n = int(input()) a = list(map(int, input().split())) dp = [[0] * 21 for i in range(n)] dp[0][0] = 1 for i in range(n - 1): for j in range(21): if dp[i][j] == 0: continue if 0 <= j + a[i] <= 20: dp[i + 1][j + a[i]] += dp[i][j] if 0 <= j - a[i] <= 20: dp[i + 1][j - a[i]] += dp[i][j] print(dp[n - 1][a[n - 1]])
File "/tmp/tmpagsycard/tmp5b3fzu2l.py", line 7 if dp[i][j] == 0: TabError: inconsistent use of tabs and spaces in indentation
s254877058
p00480
u371539389
1496037461
Python
Python3
py
Runtime Error
40000
7636
498
def calc(num,ans): if len(num)==1: if num[0]==ans: return 1 else: return 0 else: a=num.copy() x=a.pop(-1) if ans-x>=0 and ans+x<=20: return calc(a,ans-x)+calc(a,ans+x) elif ans-x>=0: return calc(a,ans-x) elif ans+x<=20: return calc(a,ans+x) else: return 0 N=int(input()) number=[int(i) for i in input().split(" ")] a=number.pop(-1) print(calc(number,a))
Traceback (most recent call last): File "/tmp/tmp8agon75o/tmph6tim3h1.py", line 19, in <module> N=int(input()) ^^^^^^^ EOFError: EOF when reading a line
s245454376
p00480
u228488524
1512970956
Python
Python3
py
Runtime Error
0
0
424
n = int(input) inp = input() nums = [int(i) for i in inp.split()] ans = nums[-1] dp = [[0 for j in range(21)] for i in range(n)] dp[0][nums[0]] = 1 for i in range(1,n-1): for j in range(21): if dp[i-1][j] == 0: continue p = j + nums[i] if p <= 20: dp[i][p] += dp[i-1][j] m = j - nums[i] if m >= 0: dp[i][m] += dp[i-1][j] print(dp[n-2][ans])
Traceback (most recent call last): File "/tmp/tmpysckh135/tmp5thz35gk.py", line 1, in <module> n = int(input) ^^^^^^^^^^ TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
s501255635
p00480
u228488524
1512971240
Python
Python3
py
Runtime Error
0
0
413
n = int(input) nums = [int(i) for i in input().split()] ans = nums[-1] dp = [[0 for j in range(21)] for i in range(n)] dp[0][nums[0]] = 1 for i in range(1,n-1): for j in range(21): if dp[i-1][j] == 0: continue p = j + nums[i] if p <= 20: dp[i][p] += dp[i-1][j] m = j - nums[i] if m >= 0: dp[i][m] += dp[i-1][j] print(dp[-1][ans])
Traceback (most recent call last): File "/tmp/tmp9nh9sg5e/tmp_1i0lu1_.py", line 1, in <module> n = int(input) ^^^^^^^^^^ TypeError: int() argument must be a string, a bytes-like object or a real number, not 'builtin_function_or_method'
s653125441
p00480
u104911888
1386318788
Python
Python
py
Runtime Error
0
0
367
n = input() s = map(int, raw_input().split()) ans = s[-1] dp = [[0] * 21 for i in range(n)] dp[0][s[0]] = 1 for i in range(1, n-1): for j in range(21): if dp[i-1][j] == 0: continue vp = j + s[i] vm = j - s[i] if vp <= 20: dp[i][vp] += dp[i-1][j] if 0 <= vm: dp[i][vm] += dp[i-1][j] print dp[n-2][ans
File "/tmp/tmpj0z6ycru/tmpxeuwkaz4.py", line 15 print dp[n-2][ans ^ SyntaxError: '[' was never closed
s236704328
p00481
u617183767
1421114799
Python
Python
py
Runtime Error
19930
57436
1577
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import itertools import math from collections import Counter, defaultdict class Main(object): def __init__(self): pass def solve(self): ''' insert your code ''' h, w, n = map(int, raw_input().split()) board = [[None for j in range(w+1)] for i in range(h+1)] s = (None, None) nxt = 1 ans = 0 for i in range(1, h+1): row = raw_input() for j in range(1, w+1): board[i][j] = row[j-1] if board[i][j] == 'S': s = (i, j, ans) # print board # print s # print board[3][3] d = [(0, 1), (1, 0), (0, -1), (-1, 0)] # print nxt q = [s] while nxt <= n: while q != []: y, x, ans = q.pop(0) # print y, x, ans, nxt # if (y, x) == (3, 3): # print nxt # print board[y][x] # print nxt == board[y][x] if board[y][x] == str(nxt): nxt += 1 q = [(y, x, ans)] # print 'nxt: ' + str(nxt) break ans += 1 for dy, dx in d: if 0 < y + dy <= h and 0 < x + dx <= w and board[y+dy][x+dx] != 'X': q.append((y + dy, x + dx, ans)) print ans return None if __name__ == '__main__': m = Main() m.solve()
File "/tmp/tmp14xzwrqp/tmpnnxu7lda.py", line 54 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s187970296
p00481
u617183767
1421117313
Python
Python
py
Runtime Error
19930
141836
2015
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import itertools import math from collections import Counter, defaultdict class Main(object): def __init__(self): pass def solve(self): ''' insert your code ''' h, w, n = map(int, raw_input().split()) board = [[None for j in range(w+1)] for i in range(h+1)] s = (None, None) ans = 0 for i in range(1, h+1): row = raw_input() for j in range(1, w+1): board[i][j] = row[j-1] if board[i][j] == 'S': s = (i, j, ans, []) elif board[i][j] == '1': g = (i, j) # print board # print s # print board[3][3] d = [(0, 1), (1, 0), (0, -1), (-1, 0)] # print nxt q = [s] for nxt in range(1, n+1): # print q while q != []: y, x, ans, used = q.pop(0) # print y, x, ans, used # if (y, x) == (3, 3): # print nxt # print board[y][x] # print nxt == board[y][x] # if board[y][x] == str(nxt): # q = [(y, x, ans)] # # print 'nxt: ' + str(nxt) # break if y == g[0] and x == g[1]: break ans += 1 for dy, dx in d: if 0 < y + dy <= h and 0 < x + dx <= w and board[y+dy][x+dx] != 'X' and (not (y + dy, x + dx) in used): q.append((y + dy, x + dx, ans, used + [(y, x)])) q = [(y, x, ans, [])] for i in range(1, h+1): for j in range(1, w+1): if board[i][j] == str(nxt+1): g = (i, j) # print q print ans return None if __name__ == '__main__': m = Main() m.solve()
File "/tmp/tmpvn097ifu/tmp3rg1ew6o.py", line 64 print ans ^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?