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
s759174244
p03994
u584174687
1568316957
Python
PyPy3 (2.4.0)
py
Runtime Error
200
50028
670
from collections import Counter, defaultdict import sys sys.setrecursionlimit(10 ** 5 + 10) # input = sys.stdin.readline from math import factorial import heapq, bisect import math import itertools import queue from collections import deque def main(): s = list(input()) num = int(input()) for i in range(len(s)): now_ind = ord(s[i]) if now_ind + num > 122: num -= 123 - now_ind s[i] = 'a' last_ind = ord(s[-1]) if last_ind + num <= 122: last_ind += num else: last_ind = last_ind + num - 27 s[-1] = chr(last_ind) print(''.join(s)) if __name__ == '__main__': main()
Traceback (most recent call last): File "/tmp/tmpat17rokn/tmptzallta_.py", line 39, in <module> main() File "/tmp/tmpat17rokn/tmptzallta_.py", line 18, in main s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s468904354
p03994
u167681750
1568168531
Python
Python (3.4.3)
py
Runtime Error
75
4796
200
s = [ord(i) - 97 for i in input()] k = int(input()) for i in range(len(s)): if 26 - s[i] <= k: k -= 26 - s[i] s[i] = 0 s[-1] += k ans = "".join(chr(i+97) for i in s) print(ans)
Traceback (most recent call last): File "/tmp/tmpetl7iceu/tmp4ftxebec.py", line 1, in <module> s = [ord(i) - 97 for i in input()] ^^^^^^^ EOFError: EOF when reading a line
s445983762
p03994
u497046426
1567744652
Python
Python (3.4.3)
py
Runtime Error
2266
109388
382
S = input() K = int(input()) length = len(S) alpha, n = 'abcdefghijklmnopqrstuvwxyz', 26 i = 0 ans = '' while i < length: diff = (n - (ord(S[i]) - ord('a'))) % 26 if 0 <= diff <= K: ans += 'a' K -= diff else: ans += S[i] i += 1 if K == 0: ans += S[i:] else: ans = ans[:-1] + chr(ord(ans[-1]) + K % 26) print(ans)
Traceback (most recent call last): File "/tmp/tmpejpjr6ue/tmpz9v2pwt1.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s956288975
p03994
u497046426
1567744642
Python
Python (3.4.3)
py
Runtime Error
2336
109516
395
S = input() K = int(input()) length = len(S) alpha, n = 'abcdefghijklmnopqrstuvwxyz', 26 i = 0 ans = '' while i < length: diff = (n - (ord(S[i]) - ord('a'))) % 26 if 0 <= diff <= K: ans += 'a' K -= diff else: ans += S[i] i += 1 if K == 0: ans += S[i:] else: print(K) ans = ans[:-1] + chr(ord(ans[-1]) + K % 26) print(ans)
Traceback (most recent call last): File "/tmp/tmp9jpu2q0j/tmpltqbv29l.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s046914576
p03994
u802772880
1562185211
Python
Python (3.4.3)
py
Runtime Error
1540
3468
271
s=input() k=int(input()) alpha=[chr(i) for i in range(97, 97+26)] for i in range(len(s)): if i==len(s)-1: k%=26 s=s[:i]+alpha[k+alpha.index(s[i])] elif k>=26-alpha.index(s[i]): k-=26-alpha.index(s[i]) s=s[:i]+'a'+s[i+1:] print(s)
Traceback (most recent call last): File "/tmp/tmpf1ices6w/tmpfi31zmad.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s240073313
p03994
u798129018
1560548045
Python
PyPy3 (2.4.0)
py
Runtime Error
222
52344
409
s = list(input()) K = int(input()) for i in range(len(s)-1): if K == 0: break else: if s[i] == "a": continue else: if 123-ord(s[i]) <= K: K -= 123-ord(s[i]) s[i] = "a" K = K %26 if K > 0: if ord(s[-1])+K <= 122: s[-1] = chr(ord(s[-1])+K) else: s[-1] = chr(97+(ord(s[-1]+K-122))) print(*s,sep="")
Traceback (most recent call last): File "/tmp/tmp_q52bgjg/tmpjcaq0zq4.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s007151259
p03994
u923712635
1560348585
Python
Python (3.4.3)
py
Runtime Error
54
3316
346
s = input() K = int(input()) ans = '' for ind,i in enumerate(s): if(i=='a' and ind!=len(s)-1): ans+='a' continue n = ord(i) d = 122-n if(ind==len(S)-1): K%=26 if(K>d): K-=d+1 ans+='a' elif(ind==len(s)-1): K%=26 ans+=chr(ord(i)+K) else: ans+=i print(ans)
Traceback (most recent call last): File "/tmp/tmpehsr0pd0/tmpmlo8e3z6.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s879178950
p03994
u623819879
1560203077
Python
PyPy3 (2.4.0)
py
Runtime Error
176
38384
423
#n,x=map(int,input().split()) #a=[int(i) for i in input().split()] import string alp=string.ascii_lowercase di={} for i in range(26): di[alp[i]]=i s=input() a=[] for i in s: a.append(i) l=a.pop() if a: a=a[::-1] k=int(input()) ans='' i=0 while a: t=a.pop() d=(26-di[t])%26 if d<=k: k-=d #ans+='a' else: #ans+=t i+=1 kk=k%26 #ans+=alp[(alp.index(l)+kk)%26] print(ans)
File "/tmp/tmp_wxqsxqv/tmplff78jc4.py", line 26 i+=1 ^ IndentationError: expected an indented block after 'else' statement on line 24
s319765556
p03994
u969190727
1559869754
Python
Python (3.4.3)
py
Runtime Error
87
4220
330
s=input() k=int(input()) A={} for i in range(26): A[chr(ord('a')+i)]=26-i C=[] for ss in s: C.append(A[ss]) ans="" for i in range(len(s)): if i==len(s)-1: if ord(s[-1])+k>122: ans+=chr(ord(s[-1])+k-26) else: ans+=chr(ord(s[-1])+k) elif k>=C[i]: ans+="a" k-=C[i] else: ans+=s[i] print(ans)
Traceback (most recent call last): File "/tmp/tmpqls8sn1a/tmpx57ywz_3.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s172182358
p03994
u969190727
1559869503
Python
Python (3.4.3)
py
Runtime Error
86
4212
263
s=input() k=int(input()) A={} for i in range(26): A[chr(ord('a') + i)]=26-i C=[] for ss in s: C.append(A[ss]) ans="" for i in range(len(s)): if i==len(s)-1: ans+=chr(ord(s[-1])+k) elif k>=C[i]: ans+="a" k-=C[i] else: ans+=s[i] print(ans)
Traceback (most recent call last): File "/tmp/tmphiry6tzq/tmp_a92xcgi.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s838939721
p03994
u885899351
1557948879
Python
Python (3.4.3)
py
Runtime Error
88
4980
218
s=input() l=[] for i in s:l.append((123-ord(i))%26) k=int(input()) for i,j in enumerate(l): if j<=k:l[i],k=26,k-j l[-1]=(l[-1]-k)+[0,26][l[-1]-k<1] for i,j in enumerate(l):l[i]=chr(123-j) print(''.join(map(str,l)))
Traceback (most recent call last): File "/tmp/tmpduup7chp/tmpt1hxhpom.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s550678278
p03994
u171366497
1555069688
Python
Python (3.4.3)
py
Runtime Error
80
3444
295
alpha='abcdefghijklmnopqrstuvwxyz' S=input() K=int(input()) ans='' for s in S: idx=alpha.index(s) if idx==0 or 26-idx>K: ans+=s continue else: K-=26-idx ans+='a' if K>0: tar=ans[-1] idx=alpha.index(tar) ans=ans[:-1]+alpha[idx+K] print(ans)
Traceback (most recent call last): File "/tmp/tmplpv4etfj/tmp8alsddmp.py", line 2, in <module> S=input() ^^^^^^^ EOFError: EOF when reading a line
s910045121
p03994
u572144347
1552476386
Python
Python (3.4.3)
py
Runtime Error
75
4212
257
s=input() K=int(input()) ans=[] for c in s: if c=="a": ans.append(c) continue if ord("z")+1- ord(c)<=K: K-=ord("z")+1-ord(c) ans.append("a") continue ans.append(c) if K: ans[-1]=chr( ord(ans[-1])+K) print("".join(ans))
Traceback (most recent call last): File "/tmp/tmpu3et7ow8/tmpvbgx89yv.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s429391365
p03994
u075012704
1550098292
Python
Python (3.4.3)
py
Runtime Error
72
3696
353
S = input() K = int(input()) Costs = {chr(98 + i): (25 - i) for i in range(25)} Costs['a'] = 0 ans = "" for i in range(len(S) - 1): s = S[i] if K >= Costs[s]: K -= Costs[s] ans += 'a' else: ans += s if K: tail = ans[-1] tail_ord = ord(tail) ans = ans[:-1] + chr((tail_ord + K) % 97 + 97) print(ans)
Traceback (most recent call last): File "/tmp/tmpkbn301yf/tmp35i3c9wk.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s876917657
p03994
u689562091
1549602683
Python
Python (3.4.3)
py
Runtime Error
60
4212
232
S = input() N = int(input()) newS = [] for s in S: dis = 26 - (ord(s) - ord('a')) if N >= dis: newS.append('a') N -= dis else: newS.append(s) newS[-1] = chr(ord(newS[-1]) + N) print(''.join(newS))
Traceback (most recent call last): File "/tmp/tmptfneyg34/tmpb00r4j3w.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s841253285
p03994
u689562091
1549602478
Python
Python (3.4.3)
py
Runtime Error
61
5616
219
S = input() N = int(input()) newS = [] for s in S: dis = 26-(ord(s)-ord('a')) if N >= dis: newS.append('a') N -= dis else: newS.append(s) newS[-1] = chr(ord(newS[-1]) + N) print(newS)
Traceback (most recent call last): File "/tmp/tmptay4uyhq/tmpw46d606w.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s513014274
p03994
u698479721
1539109636
Python
Python (3.4.3)
py
Runtime Error
51
3572
526
s = input() K = int(input()) ans = '' alphas = {'a':0,'b':25,'c':24,'d':23,'e':22,'f':21,'g':20,'h':19,'i':18,'j':17,'k':16,'l':15,'m':14,'n':13,'o':12,'p':11,'q':10,'r':9,'s':8,'t':7,'u':6,'v':5,'w':4,'x':3,'y':2,'z':1} a = 'abcdefghijklmnopqrstuvwxyz' dict1 = {} dict2 = {} i = 1 while i <= 26: dict1[i] = a[i-1] dict2[a[i-1]] = i i += 1 for chara in s: if alphas[chara] <= K: ans = ans + 'a' K = K - alphas[chara] else: ans = ans + chara K = K%26 ans = ans[:-1]+dict1[(dict2[ans[-1]]+K)%26] print(ans)
Traceback (most recent call last): File "/tmp/tmparyvjoul/tmp8geiwl45.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s272287775
p03994
u102126195
1536526942
Python
Python (3.4.3)
py
Runtime Error
162
5432
457
def change(s): if ord(s) != 122: return chr(ord(s) + 1) return "a" s = list(input()) K = int(input()) i = 0 if len(s) > 1: while True: if i >= len(s): break if 122 - ord(s[i]) + 1 <= K: K -= (122 - ord(s[i]) + 1) s[i] = 'a' i += 1 s[len(s) - 1] = chr(ord(s[len(s) - 1]) + K) elif len(s) == 1: s[0] = chr(ord(s[0]) + K) for i in s: print(i, end = "") print()
Traceback (most recent call last): File "/tmp/tmppqj0pj74/tmp87c3daky.py", line 5, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s278911711
p03994
u631277801
1535916905
Python
Python (3.4.3)
py
Runtime Error
76
4212
637
# 入力 import sys stdin = sys.stdin def li(): return [int(x) for x in stdin.readline().split()] def li_(): return [int(x)-1 for x in stdin.readline().split()] def lf(): return [float(x) for x in stdin.readline().split()] def ls(): return stdin.readline().split() def ns(): return stdin.readline().rstrip() def lc(): return list(ns()) def ni(): return int(ns()) def nf(): return float(ns()) # ここから処理 s = ns() k = ni() chl = list(s) res = k for i, c in enumerate(chl): if res >= ord("z") - ord(c) + 1: chl[i] = "a" res -= (ord("z") - ord(c) + 1) chl[-1] = chr(ord(chl[-1]) + res) print("".join(chl))
Traceback (most recent call last): File "/tmp/tmp_ayxgvx4/tmp0offjpt3.py", line 16, in <module> k = ni() ^^^^ File "/tmp/tmp_ayxgvx4/tmp0offjpt3.py", line 11, in ni def ni(): return int(ns()) ^^^^^^^^^ ValueError: invalid literal for int() with base 10: ''
s118908720
p03994
u075012704
1532893079
Python
Python (3.4.3)
py
Runtime Error
78
4212
254
S = input() K = int(input()) cost = [ord("z") - ord(s) + 1 for s in S] ans = "" for i in range(len(S)-1): if cost[i] <= K: K -= cost[i] ans += "a" else: ans += S[i] ans = ans[:-1] + chr(ord(ans[-1]) + K % 26) print(ans)
Traceback (most recent call last): File "/tmp/tmp973c9slw/tmpdgvrcdkb.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s121478658
p03994
u075012704
1532892846
Python
Python (3.4.3)
py
Runtime Error
75
4212
247
S = input() K = int(input()) cost = [ord("z") - ord(s) + 1 for s in S] ans = "" for i in range(len(S)): if cost[i] <= K: K -= cost[i] ans += "a" else: ans += S[i] ans = ans[:-1] + chr(ord(ans[-1]) + K) print(ans)
Traceback (most recent call last): File "/tmp/tmpvkbipnc_/tmppjj1bwx_.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s302317138
p03994
u828847847
1531889338
Python
Python (2.7.6)
py
Runtime Error
2104
3460
264
aord = ord("a") s = list(raw_input()) k = int(input()) i = 0 while k > 0 and i < len(s): if k >= ord('z') - ord(s[i]) + 1: if s[i] == "a": continue k -= ord('z') - ord(s[i]) + 1 s[i] = "a" i += 1 s[len(s)-1] = chr(ord(s[len(s)-1]) + k) print ''.join(s)
File "/tmp/tmpw1sge35s/tmpe789xihw.py", line 16 print ''.join(s) ^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s075292658
p03994
u828847847
1531888894
Python
Python (2.7.6)
py
Runtime Error
68
3588
235
aord = ord("a") s = list(raw_input()) k = int(input()) i = 0 while k > 0 and i < len(s): if k >= (aord + 26 - ord(s[i])): k -= (aord + 26 - ord(s[i])) s[i] = "a" i += 1 s[len(s)-1] = chr(ord(s[len(s)-1]) + k) print ''.join(s)
File "/tmp/tmpych19_r9/tmp5smz2yvu.py", line 15 print ''.join(s) ^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s596845250
p03994
u224983328
1531516988
Python
Python (3.4.3)
py
Runtime Error
188
4340
668
s = input() K = int(input()) sArr = list(s) endpoint = len(sArr) - 1 result = "" for i in range(len(sArr)): if ord("z") - ord(sArr[i]) + 1 <= K: K -= ord("z") - ord(sArr[i]) + 1 sArr[i] = "a" while K > 0: if ord("z") - ord(sArr[endpoint]) >= K: sArr[endpoint] = chr(ord(sArr[endpoint]) + K) K = 0 else: sArr[endpoint] = "z" K -= ord("z") - ord(sArr[endpoint]) endpoint -= 1 if endpoint == 0 and K != 0: while endpoint != len(s) - 1 or K != 0: sArr[endpoint] = "a" K -= 1 endpoint += 1 for j in range(len(sArr)): result += sArr[j] print(result)
Traceback (most recent call last): File "/tmp/tmpai0tycda/tmp8s9t4w1z.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s735459182
p03994
u224983328
1531516830
Python
Python (3.4.3)
py
Runtime Error
2104
4212
658
s = input() K = int(input()) sArr = list(s) endpoint = len(sArr) - 1 result = "" for i in range(len(sArr)): if ord("z") - ord(sArr[i]) + 1 <= K: K -= ord("z") - ord(sArr[i]) + 1 sArr[i] = "a" while K > 0: if ord("z") - ord(sArr[endpoint]) >= K: sArr[endpoint] = chr(ord(sArr[endpoint]) + K) K = 0 else: sArr[endpoint] = "z" K -= ord("z") - ord(sArr[endpoint]) endpoint -= 1 if endpoint == 0 and K != 0: while endpoint != len(s) - 1: sArr[endpoint] = "a" K -= 1 endpoint += 1 for j in range(len(sArr)): result += sArr[j] print(result)
Traceback (most recent call last): File "/tmp/tmpvho5b3sn/tmpmbkvvlli.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s742482293
p03994
u224983328
1531515358
Python
Python (3.4.3)
py
Runtime Error
2104
4340
632
s = input() K = int(input()) sArr = list(s) endpoint = len(sArr) - 1 result = "" for i in range(len(sArr)): if ord("z") - ord(sArr[i]) + 1 <= K: K -= ord("z") - ord(sArr[i]) + 1 sArr[i] = "a" while K > 0: if ord("z") - ord(sArr[endpoint]) >= K: sArr[endpoint] = chr(ord(sArr[endpoint]) + K) K = 0 else: sArr[endpoint] = "z" K -= ord("z") - ord(sArr[endpoint]) endpoint -= 1 if endpoint == 0 and K != 0: while endpoint != len(s) - 1: sArr[endpoint] = "a" K -= 1 for j in range(len(sArr)): result += sArr[j] print(result)
Traceback (most recent call last): File "/tmp/tmp0w51rcsi/tmp_s56xehl.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s917080874
p03994
u224983328
1531514744
Python
Python (3.4.3)
py
Runtime Error
215
4212
509
s = input() K = int(input()) sArr = list(s) endpoint = len(sArr) - 1 result = "" for i in range(len(sArr)): if ord("z") - ord(sArr[i]) + 1 <= K: K -= ord("z") - ord(sArr[i]) + 1 sArr[i] = "a" while K > 0: if ord("z") - ord(sArr[endpoint]) >= K: sArr[endpoint] = chr(ord(sArr[endpoint]) + K) K = 0 else: sArr[endpoint] = "z" K -= ord("z") - ord(sArr[endpoint]) endpoint -= 1 for j in range(len(sArr)): result += sArr[j] print(result)
Traceback (most recent call last): File "/tmp/tmpccan13nt/tmpngxp5yz5.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s414932737
p03994
u278479217
1530928532
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38384
4
jkl;
Traceback (most recent call last): File "/tmp/tmp0lnhm8n2/tmpydah69zz.py", line 1, in <module> jkl; ^^^ NameError: name 'jkl' is not defined
s166772622
p03994
u278479217
1530928399
Python
PyPy3 (2.4.0)
py
Runtime Error
172
38640
4
hoge
Traceback (most recent call last): File "/tmp/tmp59k2mzoa/tmp__u4ym39.py", line 1, in <module> hoge NameError: name 'hoge' is not defined
s757053300
p03994
u926678805
1520374270
Python
Python (3.4.3)
py
Runtime Error
196
5444
220
# coding : utf-8 s=list(map(lambda c:ord(c)-ord('a'),input())) k=int(input()) for i in range(len(s)): if 26-s[i]<=k: k-=(26-s[i]) s[i]=0 s[-1]+=k for n in s: print(chr(ord('a')+n),end='') print()
Traceback (most recent call last): File "/tmp/tmp5eknvklr/tmpuusl27b4.py", line 2, in <module> s=list(map(lambda c:ord(c)-ord('a'),input())) ^^^^^^^ EOFError: EOF when reading a line
s619804292
p03994
u785205215
1508733293
Python
Python (3.4.3)
py
Runtime Error
89
11252
285
s = input() n = int(input()) t = [] a = [] for i in s: ord_i = ord(i) t.append((123 - ord_i, ord_i)) for i in t: if n >= i[0]: a.append(chr(97)) n -= i[0] else: a.append(chr(i[1])) temp = ord(a[-1]) + n a[-1] = chr(temp) print(''.join(a))
Traceback (most recent call last): File "/tmp/tmpq4or6q0l/tmpp29mo239.py", line 1, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s895121838
p03994
u846552659
1507852454
Python
Python (3.4.3)
py
Runtime Error
67
4152
396
# -*- coding:utf-8 -*- s = list(input()) k = int(input()) for tmp in range(len(s)): if k == 0: break a = 26-(ord(s[tmp]) - ord('a')) if k >= a: k -= a s[tmp] = 'a' else: pass if k > 0: if ord('z') >= ord(s[len(s)-1])+k: s[len(s)-1] = chr(ord(s[len(s)-1])+k) else: s[len(s)-1] = chr((ord(s[len(s)-1])+k)-26) print(''.join(s))
Traceback (most recent call last): File "/tmp/tmp16fnp_kn/tmp2fhqsb4a.py", line 2, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s505689821
p03994
u846552659
1507851301
Python
Python (3.4.3)
py
Runtime Error
69
4156
409
# -*- coding:utf-8 -*- s = list(input()) k = int(input()) for tmp in range(len(s)): if k == 0: break a = 26-(ord(s[tmp]) - ord('a')) if k >= a: k -= a s[tmp] = 'a' else: pass if k > 0: if ord('z') >= ord(s[len(s)-1])+k: s[len(s)-1] = chr(ord(s[len(s)-1])+k) else: s[len(s)-1] = chr(ord('a')+(26-(ord(s[len(s)-1])+k)-1)) print(''.join(s))
Traceback (most recent call last): File "/tmp/tmpa6v5hz36/tmp2h5ob4s9.py", line 2, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s070302070
p03994
u761320129
1505778278
Python
Python (3.4.3)
py
Runtime Error
55
4212
297
S = input() k = int(input()) goal = ord('z') + 1 ans = [] for c in S: if c == 'a': continue d = goal - ord(c) if k >= d: k -= d ans.append('a') else: ans.append(c) last = (k + ord(ans[-1]) - ord('a')) % 26 ans[-1] = chr(ord('a') + last) print(''.join(ans))
Traceback (most recent call last): File "/tmp/tmph5ez6ro3/tmpfazfzujp.py", line 1, in <module> S = input() ^^^^^^^ EOFError: EOF when reading a line
s571806966
p03994
u024612773
1491590723
Python
Python (3.4.3)
py
Runtime Error
17
2940
301
s=list(input()) k=int(input()) for i in range(len(s)): c = ord('z') - ord(s[i]) + 1 if c > k: continue else: k -= c s[i] = 'a' if k > 0: s[-1] = chr(ord('a') + ((ord(s[-1]) - ord('a') + k) % 26)) print(''.join(s))
File "/tmp/tmpr4hvz02p/tmp5lb6idtg.py", line 1 s=list(input()) IndentationError: unexpected indent
s826634476
p03994
u282609839
1480260581
Python
Python (2.7.6)
py
Runtime Error
17
2820
1307
alphabet = "abcdefghijklmnopqrstuvwxyz" my_listChar = [] def moveChar(inputchar): index = alphabet.find(inputchar) return alphabet[(index + 1) % 26] def nextChar(inChar, maxNoOfConverted, inputString): maxNum = int(maxNoOfConverted) output = inChar my_listChar.append(output) for charInd in range(maxNum): output = moveChar(output) if (output <= inChar): my_listChar.pop() my_listChar.append(output) return (charInd + 1) #print output return 0 def convertStr(inputString, ith): remainNo = int(ith) if (len(inputString) == 1): movingSteps = remainNo output = inputString while(movingSteps > 0): output = moveChar(output) movingSteps = movingSteps - 1 return output for charInd in range(len(inputString)): usedNo = nextChar(inputString[charInd], remainNo, inputString) remainNo = remainNo - usedNo input1 = raw_input("K - number of converted times: ") input2 = raw_input("<string> - input string to be converted: ") output = convertStr(input2, input1) print "====================================" if my_listChar: print "Final output is ",''.join(my_listChar) else: print "Final output is " + output #print join(',',my_listChar)
File "/tmp/tmpko7vt7pn/tmpgkyqd76e.py", line 37 print "====================================" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s592138049
p03994
u282609839
1480260472
Python
Python (2.7.6)
py
Runtime Error
17
2820
1267
my_listChar = [] def moveChar(inputchar): index = alphabet.find(inputchar) return alphabet[(index + 1) % 26] def nextChar(inChar, maxNoOfConverted, inputString): maxNum = int(maxNoOfConverted) output = inChar my_listChar.append(output) for charInd in range(maxNum): output = moveChar(output) if (output <= inChar): my_listChar.pop() my_listChar.append(output) return (charInd + 1) #print output return 0 def convertStr(inputString, ith): remainNo = int(ith) if (len(inputString) == 1): movingSteps = remainNo output = inputString while(movingSteps > 0): output = moveChar(output) movingSteps = movingSteps - 1 return output for charInd in range(len(inputString)): usedNo = nextChar(inputString[charInd], remainNo, inputString) remainNo = remainNo - usedNo input1 = raw_input("K - number of converted times: ") input2 = raw_input("<string> - input string to be converted: ") output = convertStr(input2, input1) print "====================================" if my_listChar: print "Final output is ",''.join(my_listChar) else: print "Final output is " + output #print join(',',my_listChar)
File "/tmp/tmpru28ybdj/tmpfp6srvdl.py", line 36 print "====================================" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s149283408
p03994
u619631862
1476148701
Python
Python (3.4.3)
py
Runtime Error
25
3064
243
a=[ord(i) for i in input()] s = int(input()) for i in range(len(a)): if 26+97-a[i]<=s && a[i]!=97: aa=a[i] a[i]=97 s-=26+97-aa if s>0: a[-1]+=s if a[-1]>97+25: a[-1]=(a[-1]-97)%26+97 b="" for i in a: b+=chr(i) print(b)
File "/tmp/tmpeieiq4vj/tmpu4wf6ktm.py", line 4 if 26+97-a[i]<=s && a[i]!=97: ^ SyntaxError: invalid syntax
s877383120
p03994
u399243564
1475374676
Python
Python (2.7.6)
py
Runtime Error
32
4420
242
s = raw_input() N = int(raw_input()) dis = [ord('z')-ord(c) for c in s] for idx, d in enumerate(dis[:-1]): if d <= N: s[idx] = 'a' N -= d if N > 0: N %= 27 t = (dis[-1]-N) % 27 s[-1] = chr(ord('z') - t) print s
File "/tmp/tmpigakef0d/tmpema6ctvu.py", line 12 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s858663180
p03994
u399243564
1475374490
Python
Python (2.7.6)
py
Runtime Error
33
4332
234
s = raw_input() N = int(raw_input()) dis = [ord('z')-ord(c) for c in s] for idx, d in enumerate(dis[:-1]): if d <= N: s[idx] = 'a' N -= d if N > 0: N %= 27 t = (dis[-1]-N) % 27 s[-1] = chr(ord('z') - t)
Traceback (most recent call last): File "/tmp/tmpfyb__dc2/tmpfpgjbfmb.py", line 1, in <module> s = raw_input() ^^^^^^^^^ NameError: name 'raw_input' is not defined
s998602184
p03994
u664481257
1475113327
Python
Python (3.4.3)
py
Runtime Error
92
9304
1751
# -*- coding: utf-8 -*- # !/usr/bin/env python # vim: set fileencoding=utf-8 : """ # # Author: Noname # URL: https://github.com/pettan0818 # License: MIT License # Created: 2016-09-28 # # Usage # """ import sys def input_single_line(): """Receive Inputs.""" return input() def input_two_line(): """Receive Two Lined Inputs. Like this. N 1 2 3 4 5 """ n = sys.stdin.readline() n = n.rstrip("\n") target = sys.stdin.readline() target = target.rstrip("\n") # target = target.split(" ") return n, target def check_a_becombility(one_str: str) -> int: """Check how can this str become "a" >>> check_a_becombility("a") 0 >>> check_a_becombility("z") 1 >>> check_a_becombility("b") 25 """ if ord(one_str) == 97: return 0 # Because this is "a" return 123 - ord(one_str) def make_suzuki_process(target_str :str, chance: int) -> str: """Suzuki Process. >>> make_suzuki_process("xyz", 4) 'aya' >>> make_suzuki_process("a", 25) 'z' >>> make_suzuki_process("codefestival", 100) 'aaaafeaaivap' """ target_str = list(target_str) costs = [check_a_becombility(i) for i in target_str] for pos, each_cost in enumerate(costs): if chance - each_cost >= 0: chance = chance - each_cost target_str[pos] = "a" if chance > 0: temp = ord(target_str[-1]) + chance if temp > 122: target_str[-1] = chr(temp % 97) else: target_str[-1] = chr(temp) return "".join(target_str) if __name__ == "__main__": import doctest doctest.testmod() inputted = input_two_line() make_suzuki_process(inputted[0], inputted[1])
Traceback (most recent call last): File "/tmp/tmpk717ygox/tmpvti9wvn_.py", line 85, in <module> make_suzuki_process(inputted[0], inputted[1]) File "/tmp/tmpk717ygox/tmpvti9wvn_.py", line 70, in make_suzuki_process if chance > 0: ^^^^^^^^^^ TypeError: '>' not supported between instances of 'str' and 'int'
s270304000
p03994
u155667931
1474864825
Python
Python (2.7.6)
py
Runtime Error
17
2696
706
def decoder(str_int): s_='' for a in str_int: s_ = s_+(alpbet[a]) return s_ s = raw_input() K = input() alpbet = 'abcdefghijklmnopqrstuvwxyz' encoder = lambda s: [alpbet.index(a) for a in s] inc_count = K str_int = encoder(s) for i in range(len(str_int)): #末尾文字でない if i != len(str_int)-1: #b~zの間でかつデクリメントできる if str_int[i] > 0: #aになるまで必要なインクリメント回数 cost = 26 - str_int[i] if inc_count > cost: inc_count -= cost str_int[i] = 0 else: str_int[i] = (str_int[i] + inc_count) % 26 print decoder(str_int)
File "/tmp/tmpq6cugvfj/tmpc2r7nafp.py", line 27 print decoder(str_int) ^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s789746214
p03994
u921249617
1474774576
Python
Python (3.4.3)
py
Runtime Error
67
4152
269
s = list(input()) K = int(input()) alphabet = "abcdefghijklmnopqrstuvwxyz" for i in range(len(s)): if K > 26 or s[i] >= alphabet[-K]: K -= ord("z") - ord(s[i]) + 1 s[i] = "a" if K > 0: K %= 26 s[-1] = chr(ord(s[-1]) + K) print("".join(s))
Traceback (most recent call last): File "/tmp/tmpj4f2e24w/tmpgkmooeda.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s040490950
p03994
u989496399
1474773296
Python
Python (2.7.6)
py
Runtime Error
1555
3100
565
s = raw_input() k = int(raw_input()) s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] def s_i(st): return ord(st) - 96 j = 0 while k > 0: a = s_i(s[j]) if s[j] == 'a' and j < len(s)-1: pass elif 27 - a <= k: k = k - (27 - a) s = s[:j] + 'a' + s[j+1:] elif j == len(s) - 1: t = (a+k)%26 - 1 if t >= 0: s = s[:j] + s_l[t] else: s = s[:j] + s_l[t + 26] break else: pass j += 1 print s
File "/tmp/tmp_rmalt5c/tmpmagc4lq_.py", line 29 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s539989907
p03994
u153147777
1474773179
Python
Python (2.7.6)
py
Runtime Error
16
2696
501
s = raw_input() K = input() base = ord('a') result = '' if len(s) == 1: K = K % 26 print chr( base + (((ord(s[0]) - base) + K) % 26)) return def willA(c, i): a = 26 - (ord(c) - base) if ord(c) - base + i >= 27: return True, a else: return False,0 for i in xrange(len(s) - 1): f, n = willA(s[i], K) K = K - n if f: result += 'a' else: result += s[i] K = K % 26 result += chr( base + (((ord(s[-1:]) - base) + K) % 26))
File "/tmp/tmppc682tca/tmp0e3cb4u2.py", line 8 print chr( base + (((ord(s[0]) - base) + K) % 26)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s831722617
p03994
u989496399
1474772284
Python
Python (2.7.6)
py
Runtime Error
1764
3100
628
s = raw_input() k = float(raw_input()) s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] def s_i(st): for i in range(26): if st == s_l[i]: break return i + 1 j = 0 while k > 0: a = s_i(s[j]) if s[j] == 'a' and j < len(s)-1: pass elif 27 - a <= k: k = k - (27 - a) s = s[:j] + 'a' + s[j+1:] elif j == len(s) - 1: t = (a+k)%26 - 1 if t >= 0: s = s[:j] + s_l[t] else: s = s[:j] + s_l[t + 26] break else: pass j += 1 print s
File "/tmp/tmptp7jisto/tmpjiwm92jm.py", line 32 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s347793063
p03994
u989496399
1474772187
Python
Python (2.7.6)
py
Runtime Error
1663
3116
626
s = raw_input() k = int(raw_input()) s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] def s_i(st): for i in range(26): if st == s_l[i]: break return i + 1 j = 0 while k > 0: a = s_i(s[j]) if s[j] == 'a' and j < len(s)-1: pass elif 27 - a <= k: k = k - (27 - a) s = s[:j] + 'a' + s[j+1:] elif j == len(s) - 1: t = (a+k)%26 - 1 if t >= 0: s = s[:j] + s_l[t] else: s = s[:j] + s_l[t + 26] break else: pass j += 1 print s
File "/tmp/tmpof7wtdw5/tmp9r03p83w.py", line 32 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s704988444
p03994
u178407096
1474772119
Python
Python (2.7.6)
py
Runtime Error
16
2696
280
#read in input s = map((lambda x: ord(x) - 96), raw_input()) k = int(raw_input()) for i in range(len(s)): sv = s[i] if sv == 1 || (27 - sv) > k: continue s[i] = 1 k = k - (27 - sv) s[-1] = (((s[-1] + k) - 1) % 26) + 1 print "".join(map((lambda x: chr(x + 96)), s))
File "/tmp/tmpca7vm7et/tmpe9r8cddi.py", line 8 if sv == 1 || (27 - sv) > k: ^ SyntaxError: invalid syntax
s993149896
p03994
u921249617
1474772071
Python
Python (3.4.3)
py
Runtime Error
67
4156
355
s = list(input()) K = int(input()) alphabet = "abcdefghijklmnopqrstuvwxyz" for i in range(len(s)): if K >= 26 or s[i] >= alphabet[-K]: K -= ord("z") - ord(s[i]) + 1 s[i] = "a" if K > 0: K %= 26 if (chr(ord(s[-1]) + K) <= "z"): s[-1] = chr(ord(s[-1]) + K) else: s[-1] = chr(ord("a") + K) print("".join(s))
Traceback (most recent call last): File "/tmp/tmp_qu358kl/tmp7bwo3vqc.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s046968365
p03994
u989496399
1474771970
Python
Python (2.7.6)
py
Runtime Error
1689
3100
634
s = raw_input() k = int(raw_input()) s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] def s_i(st): for i in range(26): if st == s_l[i]: return i + 1 break j = 0 while k > 0: a = s_i(s[j]) if s[j] == 'a' and j < len(s)-1: pass elif 27 - a <= k: k = k - (27 - a) s = s[:j] + 'a' + s[j+1:] elif j == len(s) - 1: t = (a+k)%26 - 1 if t >= 0: s = s[:j] + s_l[t] else: s = s[:j] + s_l[t + 26] break else: pass j += 1 print s
File "/tmp/tmp8dbbeduw/tmpy69exazk.py", line 32 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s374411211
p03994
u989496399
1474771732
Python
Python (2.7.6)
py
Runtime Error
1762
3204
640
s = raw_input() k = int(raw_input()) s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] def s_i(st): for i in range(26): if st == s_l[i]: return i + 1 break j = 0 while k > 0: if s[j] == 'a' and j < len(s)-1: pass elif 27 - s_i(s[j]) <= k: k = k - (27 - s_i(s[j])) s = s[:j] + 'a' + s[j+1:] elif j == len(s) - 1: t = (s_i(s[j])+k)%26 - 1 if t >= 0: s = s[:j] + s_l[t] else: s = s[:j] + s_l[t + 26] break else: pass j += 1 print s
File "/tmp/tmp5fadtt8u/tmpu9x2mso6.py", line 31 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s354977898
p03994
u230180492
1474771589
Python
Python (3.4.3)
py
Runtime Error
23
3316
450
s=input() k=int(input()) d = dict() for i in range(len(alphabet)): d[alphabet[i]]=i def f(s,k): s = [s[i] for i in range(len(s))] res = s L = 0 for i in range(len(s)): l = max(26 - d[s[i]],0) if L + l < k: res[i] = "a" L += l else: if i==len(s)-1: res[i] = alphabet[(d[s[i]] + (k-L)) % 26] continue return(''.join(res)) print(f(s,k))
Traceback (most recent call last): File "/tmp/tmpt281r8hq/tmpdc7kz4m9.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s740754812
p03994
u989496399
1474771515
Python
Python (2.7.6)
py
Runtime Error
1744
3100
640
s = raw_input() k = int(raw_input()) s_l = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] def s_i(st): for i in range(26): if st == s_l[i]: return i + 1 break j = 0 while k > 0: if s[j] == 'a' and j < len(s)-1: pass elif 27 - s_i(s[j]) <= k: k = k - (27 - s_i(s[j])) s = s[:j] + 'a' + s[j+1:] elif j == len(s) - 1: t = (s_i(s[j])+k)%26 - 1 if t >= 0: s = s[:j] + s_l[t] else: s = s[:j] + s_l[t + 26] break else: pass j += 1 print s
File "/tmp/tmp4y3vcuq7/tmpco4mt2lh.py", line 31 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s967222648
p03994
u230180492
1474771514
Python
Python (3.4.3)
py
Runtime Error
23
3316
443
s=input() k=int(input()) d = dict() for i in range(len(alphabet)): d[alphabet[i]]=i def f(s,k): s = [s[i] for i in range(len(s))] res = s L = 0 for i in range(len(s)): l = max(26 - d[s[i]],0) if L + l < k: res[i] = "a" L += l else: if i==len(s)-1: res[i] = alphabet[(d[s[i]] + (k-L)) % 26] continue return(''.join(res)) f(s,k)
Traceback (most recent call last): File "/tmp/tmpb43wegtg/tmpbe2gz3od.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s870227256
p03994
u436484848
1474771023
Python
Python (3.4.3)
py
Runtime Error
22
3064
500
#C-Next Letter str = input() K = int(input()) tempK = K result = "" for i in range(len(str)-1): changeNum = 122-ord(str[i])+1 if (changeNum <= tempK): result += "a" tempK -= changeNum if (tempK == 0): result += str[i+:] print(result) break else: result += str[i] tempK %= 26 if (tempK > 0): changeNum = ord(str[-1]) + tempK if (changeNum > 122): changeNum = changeNum -122 + 97 -1 else: changeNum = changeNum result += chr(changeNum) else: result += str[-1] print(result)
File "/tmp/tmpdjsb4a1l/tmpz9n7t3bn.py", line 12 result += str[i+:] ^ SyntaxError: invalid syntax
s692607215
p03994
u483182857
1474771006
Python
Python (3.4.3)
py
Runtime Error
24
3316
499
s=input() list=[] flag=false k=int(input()) for i in range(len(s)): if (ord(s[i])+k)>122: list.append('a') k=k-(123-ord(s[i])) else: list.append(s[i]) flag=true if flag==true: for i in reversed(len(s)): if list[i]!='a': x=122-ord(s[i]) if x<=k: list[i]=chr(ord(s[len(s)])+k) else: list[i]='z' k=k-x else: for i in range(len(s)): print(list[i], end='')
Traceback (most recent call last): File "/tmp/tmpza__3cyb/tmp07lkx90j.py", line 1, in <module> s=input() ^^^^^^^ EOFError: EOF when reading a line
s109924195
p03994
u921249617
1474770928
Python
Python (3.4.3)
py
Runtime Error
65
4152
347
s = list(input()) K = int(input()) alphabet = "abcdefghijklmnopqrstuvwxyz" # need = 0 # for i in range(len(s)): # need += ord("z") - ord(s[i]) + 1 for i in range(len(s)): if K >= 26 or s[i] >= alphabet[-K]: K -= ord("z") - ord(s[i]) + 1 s[i] = "a" if K > 0: K %= 26 s[-1] = chr(ord(s[-1]) + K) print("".join(s))
Traceback (most recent call last): File "/tmp/tmpn9eg7ggn/tmp0bqqwd2o.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s601704779
p03994
u921249617
1474770576
Python
Python (3.4.3)
py
Runtime Error
97
4152
341
s = list(input()) K = int(input()) alphabet = "abcdefghijklmnopqrstuvwxyz" need = 0 for i in range(len(s)): need += ord("z") - ord(s[i]) + 1 for i in range(len(s)): if K >= 26 or s[i] >= alphabet[-K]: K -= ord("z") - ord(s[i]) + 1 s[i] = "a" if K > 0: K %= 26 s[-1] = chr(ord(s[-1]) + K) print("".join(s))
Traceback (most recent call last): File "/tmp/tmpfx828dbb/tmpaptmp9nm.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s006183212
p03994
u725662235
1474770154
Python
Python (2.7.6)
py
Runtime Error
179
101308
528
s = raw_input() k = input() def solve(s, k, i): if i == len(s)-1: # print "equal" t = ord(s[i])+k if t > ord("z"): t -= ord("a") t %= (ord("z")-ord("a") + 1) t += ord("a") s = s[:i] + chr(t) return s # print s, k elif s[i] != "a" and ord(s[i]) + k > ord("z"): # print "carry" k = k - ord("z") + ord(s[i]) -1 s = s[:i] + "a" + s[i+1:] # print s,k return solve(s,k,i+1) print solve(s,k,0)
File "/tmp/tmptwsldw8c/tmpmvhuqykz.py", line 22 print solve(s,k,0) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s105937496
p03994
u327848404
1474769968
Python
Python (3.4.3)
py
Runtime Error
23
3064
342
s = raw_input() K = input() alpha = [chr(i) for i in range(97,97+26)] for moji in range(1, len(s)+1): if alpha.index(s[moji-1]) != 0: if K >= 26-alpha.index(s[moji-1]): K = K - (26-alpha.index(s[moji-1])) s = s[:moji-1] + 'a' + s[moji:] if K>0: last_char = alpha[ alpha.index(s[-1]) + (K % 26) ] s = s[:-1] + last_char print s
File "/tmp/tmpf6qoxurx/tmp07idsibq.py", line 16 print s ^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s548581842
p03994
u422104747
1474769848
Python
Python (3.4.3)
py
Runtime Error
67
3520
498
def f(s,K): res=0 str="" for i in range(len(s)): if s[i]=="a": str+="a" res+=1 continue if K>=123-ord(s[i]): str+="a" res+=1 K-=123-ord(s[i]) else: break if res==0: skip=0 for skip in range(len(s)): if K>=123-ord(s[skip]): break return s[:skip],s[skip:],K return str,s[res:],K ss=input() KK=int(input()) sol="" while len(ss)>1: x,ss,KK=f(ss,KK) sol+=x KK%=26 if ord(ss[0])+KK<123: sol+=chr(ord(ss[0])+KK) else: sol+=chr(ord(ss[0])+KK-26) print(sol)
Traceback (most recent call last): File "/tmp/tmphqmxs02h/tmpa4vlkg9w.py", line 23, in <module> ss=input() ^^^^^^^ EOFError: EOF when reading a line
s005151936
p03994
u921249617
1474769548
Python
Python (3.4.3)
py
Runtime Error
63
4084
257
s = list(input()) K = int(input()) alphabet = "abcdefghijklmnopqrstuvwxyz" for i in range(len(s)): if K > 26 or s[i] >= alphabet[-K]: K -= ord("z") - ord(s[i]) + 1 s[i] = "a" if K > 0: s[-1] = chr(ord(s[-1]) + K) print("".join(s))
Traceback (most recent call last): File "/tmp/tmpxyctngp5/tmp6793q86s.py", line 1, in <module> s = list(input()) ^^^^^^^ EOFError: EOF when reading a line
s045744469
p03994
u164898518
1474769391
Python
Python (2.7.6)
py
Runtime Error
1548
11716
456
s = raw_input() K = int(raw_input()) _s, _K = s[:], K a = "abcdefghijklmnopqrstuvwxyz" ai = a.index("a") zi = a.index("z") si = [zi - a.index(c) + 1 if c != "a" else 0 for c in s] def rotation_alphabet(s,i): return for i, (c, ci) in enumerate(zip(s, si)): if K == 0: break if c == "a": continue if ci <= K: s = s[0:i] + "a" + s[i+1:] K = K - ci if K > 0: s = s[:-1] + a[a.index(s[-1]) + K] print(s)
Traceback (most recent call last): File "/tmp/tmpwkre7k6g/tmp1gtlvj5v.py", line 1, in <module> s = raw_input() ^^^^^^^^^ NameError: name 'raw_input' is not defined
s474316929
p03994
u422104747
1474769143
Python
Python (3.4.3)
py
Runtime Error
68
4084
468
def f(s,K): if len(s)==1: K%=26 if ord(s[0])+K<123: return chr(ord(s[0])+K) else: return chr(ord(s[0])+K-26) res=0 for i in range(len(s)): if s[i]=="a": res+=1 continue if K>=123-ord(s[i]): res+=1 K-=123-ord(s[i]) else: break str="" for i in range(res): str+="a" if res==0: for i in range(len(s)): if K>=123-ord(s[i]): break return s[:i]+f(s[i:],K) return str+f(s[res:],K) ss=input() KK=int(input()) print(f(ss,KK))
Traceback (most recent call last): File "/tmp/tmp2h0abmdn/tmppn7kkubs.py", line 27, in <module> ss=input() ^^^^^^^ EOFError: EOF when reading a line
s487593693
p03994
u531436689
1474768888
Python
Python (2.7.6)
py
Runtime Error
16
2568
1562
def num_to_char(s_num): ch = [] for num in s_num: ch.append(alphabet[(num%26)-1]) return ch s = raw_input() K = input() alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ans = [] s_num = [] for char in s: s_num.append(alphabet.index(char) + 1)thon WS) ----------------------------- for i in xrange(len(s_num)):ive/01_Atcoder/codefesA/A.py if 27 - s_num[i] < K and (s_num[i] != 1) and (i != len(s_num) - 1): K = K - (27 - s_num[i])1_GoogleDrive/01_Atcoder/ s_num[i] = 271_Atcoder tong$ ls #kouji.py# 20151121 B.py Sort kouji.py~ elif 27 - s_num[i] < K and (s_num[i] != 1) and (i == len(s_num) - 1):wo.od s_num[i] = s_num[i] + K 002 20160502 ColorTracking contest elif 27 - s_num[i] < K and (s_num[i] == 1) and (i != len(s_num) - 1): passook-Pro:01_Atcoder tong$ mkdir codefesA tonkous-MacBook-Pro:01_Atcoder tong$ cd codefesA/ elif 27 - s_num[i] < K and (s_num[i] == 1) and (i == len(s_num) - 1): s_num[i] = s_num[i] + K elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i != len(s_num)-1): pass elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i == len(s_num)-1): s_num[i] = s_num[i] + K elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i != len(s_num) - 1): pass elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i == len(s_num) - 1): s_num[i] = s_num[i] + K #elif i == len(s_num) - 1: # s_num[i] = s_num[i] + K print "".join(num_to_char(s_num))
File "/tmp/tmpmwnfac0i/tmpvtswyv41.py", line 15 s_num.append(alphabet.index(char) + 1)thon WS) ----------------------------- ^ SyntaxError: unmatched ')'
s741632715
p03994
u531436689
1474768888
Python
Python (2.7.6)
py
Runtime Error
17
2568
1562
def num_to_char(s_num): ch = [] for num in s_num: ch.append(alphabet[(num%26)-1]) return ch s = raw_input() K = input() alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] ans = [] s_num = [] for char in s: s_num.append(alphabet.index(char) + 1)thon WS) ----------------------------- for i in xrange(len(s_num)):ive/01_Atcoder/codefesA/A.py if 27 - s_num[i] < K and (s_num[i] != 1) and (i != len(s_num) - 1): K = K - (27 - s_num[i])1_GoogleDrive/01_Atcoder/ s_num[i] = 271_Atcoder tong$ ls #kouji.py# 20151121 B.py Sort kouji.py~ elif 27 - s_num[i] < K and (s_num[i] != 1) and (i == len(s_num) - 1):wo.od s_num[i] = s_num[i] + K 002 20160502 ColorTracking contest elif 27 - s_num[i] < K and (s_num[i] == 1) and (i != len(s_num) - 1): passook-Pro:01_Atcoder tong$ mkdir codefesA tonkous-MacBook-Pro:01_Atcoder tong$ cd codefesA/ elif 27 - s_num[i] < K and (s_num[i] == 1) and (i == len(s_num) - 1): s_num[i] = s_num[i] + K elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i != len(s_num)-1): pass elif 27 - s_num[i] >= K and (s_num[i] != 1) and (i == len(s_num)-1): s_num[i] = s_num[i] + K elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i != len(s_num) - 1): pass elif 27 - s_num[i] >= K and (s_num[i] == 1) and (i == len(s_num) - 1): s_num[i] = s_num[i] + K #elif i == len(s_num) - 1: # s_num[i] = s_num[i] + K print "".join(num_to_char(s_num))
File "/tmp/tmpd1wkkux2/tmpglm2cfyw.py", line 15 s_num.append(alphabet.index(char) + 1)thon WS) ----------------------------- ^ SyntaxError: unmatched ')'
s807804529
p03994
u725662235
1474768642
Python
Python (2.7.6)
py
Runtime Error
175
101404
555
s = raw_input() k = input() def solve(s, k, i): if i >= len(s): # print "over" return s if i == len(s)-1: # print "equal" t = ord(s[i])+k if t > ord("z"): t -= ord("a") t %= (ord("z")-ord("a") + 1) t += ord("a") s = s[:i] + chr(t) # print s, k elif ord(s[i]) + k > ord("z"): # print "carry" k = k - ord("z") + ord(s[i]) -1 s = s[:i] + "a" + s[i+1:] # print s,k return solve(s,k,i+1) print solve(s,k,0)
File "/tmp/tmpl8rsxwoi/tmp_b1zm2dr.py", line 24 print solve(s,k,0) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s919000875
p03994
u657357805
1474768348
Python
Python (3.4.3)
py
Runtime Error
117
4156
413
s=list(input()) k=int(input()) def toA(char): return (ord('z')-ord(char)+1)%26 def toC(char,k): if(ord('z')-ord(char)>=k): return chr(ord(char)+k) else: return chr(ord('a')+k-ord('z')-ord(char)) for i in range(len(s)): if(k==0): break if(k>=toA(s[i])): k-=toA(s[i]) s[i]='a' if(i==len(s)-1) and k>0: s[i]= toC(s[i],k) print("".join(s))
Traceback (most recent call last): File "/tmp/tmpftq5bi6y/tmpqbgxyc3w.py", line 1, in <module> s=list(input()) ^^^^^^^ EOFError: EOF when reading a line
s366091916
p03994
u725662235
1474767688
Python
Python (2.7.6)
py
Runtime Error
175
101404
503
s = raw_input() k = input() def solve(s, k, i): if i >= len(s): # print "over" return s if i == len(s)-1: # print "equal" t = ord(s[i])+k if t > ord("z"): t -= (ord("z") - ord("a")+1) s = s[:i] + chr(t) # print s, k elif ord(s[i]) + k > ord("z"): # print "carry" k = k - ord("z") + ord(s[i]) -1 s = s[:i] + "a" + s[i+1:] # print s,k return solve(s,k,i+1) print solve(s,k,0)
File "/tmp/tmpis0zglu4/tmpkdxfi23m.py", line 22 print solve(s,k,0) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s127337037
p03994
u414809621
1474766891
Python
Python (3.4.3)
py
Runtime Error
226
101084
271
def move(s, k): if len(s) == 1: return chr(97+(ord(s) + k - 97)%26) if s[0] == 'a' or 123-ord(s[0]) > k: return s[0] + move(s[1:], k) else: return 'a' + move(s[1:], k-(123-ord(s[0]))) s = input() K = int(input()) print(move(s,K))
Traceback (most recent call last): File "/tmp/tmp_i19haiq/tmpgwgh18k8.py", line 14, in <module> s = input() ^^^^^^^ EOFError: EOF when reading a line
s253305062
p03994
u471797506
1474765927
Python
Python (2.7.6)
py
Runtime Error
207
5156
458
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll alpha = "abcdefghijklmnopqrstuvwxyz" s = raw_input() K = int(raw_input()) dic = dict([alpha[i], i] for i in xrange(len(alpha))) ans = [] for si in s: d = 26 - dic[si] if si != "a" else 0 if d <= K: ans.append("a") K -= d else: ans.append(si) if K > 0: ans[-1] = alpha[dic[ans[-1]] + K] print "".join(ans)
File "/tmp/tmp4xyjt1vp/tmpao61tii0.py", line 22 print "".join(ans) ^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s089604663
p03995
u535803878
1598595724
Python
PyPy3 (7.3.0)
py
Runtime Error
348
107804
1540
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") h,w = list(map(int, input().split())) n = int(input()) from collections import defaultdict mind = [10**15] * h dw = defaultdict(list) for i in range(n): r,c,a = map(int, input().split()) r -= 1 c -= 1 mind[r] = min(mind[r], a) dw[c].append((a,r)) # 0未満になる要素があるか判定 es = [[] for _ in range(h)] def main(): ans = True for c in range(w): if len(dw[c])<=1: continue dw[c].sort() tmp = 0 for i in range(len(dw[c])-1): u = dw[c][i][1] v = dw[c][i+1][1] val = dw[c][i+1][0] - dw[c][i][0] es[u].append((val, v)) es[v].append((-val, u)) tmp += val if mind[v]<tmp: return False # print(es) # print(dw) vals = [None]*h for start in range(h): if vals[start] is not None: continue q = [start] vals[start] = 0 while q: u = q.pop() for d,v in es[u]: if vals[v] is None: vals[v] = vals[u] + d q.append(v) elif vals[v]!=vals[u]+d: return False for u in range(h): for d,v in es[u]: if vals[u]+d!=vals[v]: return False hoge return True ans = main() if ans: print("Yes") else: print("No")
Traceback (most recent call last): File "/tmp/tmphxgisobh/tmp5dsmza3_.py", line 7, in <module> h,w = list(map(int, input().split())) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s958549061
p03995
u535803878
1598595577
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
106680
1547
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") h,w = list(map(int, input().split())) n = int(input()) from collections import defaultdict mind = [10**15] * h dw = defaultdict(list) for i in range(n): r,c,a = map(int, input().split()) r -= 1 c -= 1 mind[r] = min(mind[r], a) dw[c].append((a,r)) # 0未満になる要素があるか判定 es = [[] for _ in range(h)] def main(): ans = True for c in range(w): if len(dw[c])<=1: continue dw[c].sort() tmp = 0 for i in range(len(dw[c])-1): u = dw[c][i][1] v = dw[c][i+1][1] val = dw[c][i+1][0] - dw[c][i][0] es[u].append((val, v)) es[v].append((-val, u)) tmp += val if mind[v]<tmp: return False # print(es) # print(dw) vals = [None]*h for start in range(h): if vals[start] is not None: continue q = [start] vals[start] = 0 while q: u = q.pop() for d,v in es[u]: if vals[v] is None: vals[v] = vals[u] + d q.append(v) elif vals[v]!=vals[u]+d: return False for u in range(h): for d,v in es[u]: if vals[u]+d!=vals[v]: return False return True ans = main() if ans: print("Yes") else: print("No")
Traceback (most recent call last): File "/tmp/tmpf7wo9ln_/tmp66k0to2f.py", line 7, in <module> h,w = list(map(int, input().split())) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s644313190
p03995
u535803878
1598595014
Python
PyPy3 (7.3.0)
py
Runtime Error
301
106308
1404
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") h,w = list(map(int, input().split())) n = int(input()) from collections import defaultdict mind = [10**18] * h dw = defaultdict(list) for i in range(n): r,c,a = map(int, input().split()) r -= 1 c -= 1 mind[r] = min(mind[r], a) dw[c].append((a,r)) # 0未満になる要素があるか判定 es = [[] for _ in range(h)] def main(): ans = True for c in range(w): if len(dw[c])<=1: continue dw[c].sort() tmp = 0 for i in range(len(dw[c])-1): u = dw[c][i][1] v = dw[c][i+1][1] val = dw[c][i+1][0] - dw[c][i][0] es[u].append((val, v)) es[v].append((-val, u)) tmp += val if mind[v]<tmp: return False # print(es) # print(dw) vals = [None]*h assert False for start in range(h): if vals[start] is not None: continue q = [start] vals[start] = 0 while q: u = q.pop() for d,v in es[u]: if vals[v] is None: vals[v] = vals[u] + d elif vals[v]!=vals[u]+d: return False return True ans = main() if ans: print("Yes") else: print("No")
Traceback (most recent call last): File "/tmp/tmppsftotvy/tmp9zstggnl.py", line 8, in <module> h,w = list(map(int, input().split())) ^^^ ValueError: not enough values to unpack (expected 2, got 0)
s699922337
p03995
u535803878
1598594778
Python
PyPy3 (7.3.0)
py
Runtime Error
88
74776
1543
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(max(1000, 10**9)) write = lambda x: sys.stdout.write(x+"\n") # ファイル読み込み def _input(): lines = open("../tmp_in").readlines() for ss in lines: yield ss.rstrip() input = _input().__next__ h,w = list(map(int, input().split())) n = int(input()) from collections import defaultdict mind = [10**18] * h dw = defaultdict(list) for i in range(n): r,c,a = map(int, input().split()) r -= 1 c -= 1 mind[r] = min(mind[r], a) dw[c].append((a,r)) # 0未満になる要素があるか判定 es = [[] for _ in range(h)] def main(): ans = True for c in range(w): if len(dw[c])<=1: continue dw[c].sort() tmp = 0 for i in range(len(dw[c])-1): u = dw[c][i][1] v = dw[c][i+1][1] val = dw[c][i+1][0] - dw[c][i][0] es[u].append((val, v)) es[v].append((-val, u)) tmp += val if mind[v]<tmp: return False # print(es) # print(dw) vals = [None]*h for start in range(h): if vals[start] is not None: continue q = [start] vals[start] = 0 while q: u = q.pop() for d,v in es[u]: if vals[v] is None: vals[v] = vals[u] + d elif vals[v]!=vals[u]+d: return False return True ans = main() if ans: print("Yes") else: print("No")
Traceback (most recent call last): File "/tmp/tmpzs33cts7/tmpiumlk61a.py", line 14, in <module> h,w = list(map(int, input().split())) ^^^^^^^ File "/tmp/tmpzs33cts7/tmpiumlk61a.py", line 9, in _input lines = open("../tmp_in").readlines() ^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '../tmp_in'
s382354799
p03995
u002023395
1583281784
Python
Python (3.4.3)
py
Runtime Error
17
2940
1335
#include <iostream> #include <vector> #include <queue> using namespace std; bool solve(int R, int C){ vector<vector<pair<int, int>>> gr(R), gc(C); int N; cin >> N; for(int i=0;i<N;i++){ int r, c, a; cin >> r >> c >> a; gr[r-1].emplace_back(c-1, a); gc[c-1].emplace_back(r-1, a); } vector<int> dif(R), check(R, 0); for(int i=0;i<R;i++){ if(check[i]) continue; dif[i] = 0; check[i] = 1; int m = 1000000000; int md = dif[i]; queue<int> qu; qu.push(i); while(!qu.empty()){ int p = qu.front(); qu.pop(); for(auto c : gr[p]){ int val = c.second; for(auto r : gc[c.first]){ int d = r.second - c.second + dif[p]; if(!check[r.first]){ check[r.first] = 1; dif[r.first] = d; qu.push(r.first); } if(dif[r.first] != d) return false; md = min(d, md); m = min(m, r.second - d); } } } if(m + md < 0) return false; } return true; } int main(){ int R, C; while(cin >> R >> C){ cout << (solve(R, C) ? "Yes" : "No") << endl; } }
File "/tmp/tmpmypr094r/tmpg_4ye7m3.py", line 5 using namespace std; ^^^^^^^^^ SyntaxError: invalid syntax
s791816398
p03995
u467736898
1573265914
Python
Python (3.4.3)
py
Runtime Error
766
40552
3080
class WeightedUnionFind: # https://qiita.com/drken/items/cce6fc5c579051e64fab def __init__(self, n, SUM_UNITY=0): self.par = list(range(n)) self.rank = [0] * n self.diff_weight = [SUM_UNITY] * n def root(self, x): p = self.par[x] if p == x: return x else: r = self.root(p) self.diff_weight[x] += self.diff_weight[p] self.par[x] = r return r def weight(self, x): self.root(x) return self.diff_weight[x] def same(self, x, y): return self.root(x) == self.root(y) def unite(self, x, y, w): if self.same(x, y): return self.diff(x, y) == w w += self.weight(x); w -= self.weight(y) x, y = self.root(x), self.root(y) # if x == y: # return False if self.rank[x] < self.rank[y]: x, y = y, x w = -w if self.rank[x] == self.rank[y]: self.rank[x] += 1 self.par[y] = x self.diff_weight[y] = w return True def diff(self, x, y): return self.weight(y) - self.weight(x) def get_roots_weights(self): roots = [] weights = [] for x in range(len(self.par)): roots.append(self.root(x)) weights.append(self.weight(x)) return roots, weights import sys from operator import itemgetter from itertools import groupby from collections import defaultdict def main(): R, C = map(int, input().split()) N = int(input()) RCA = list(zip(*[iter(map(int, sys.stdin.read().split()))]*3)) uf_r = WeightedUnionFind(R+1) uf_c = WeightedUnionFind(C+1) RCA.sort(key=itemgetter(0)) for _, g in groupby(RCA, key=itemgetter(0)): _, c0, a0 = next(g) for _, c, a in g: if not uf_c.unite(c0, c, a-a0): print("No") exit() RCA.sort(key=itemgetter(1)) for _, g in groupby(RCA, key=itemgetter(1)): r0, _, a0 = next(g) for r, _, a in g: if not uf_r.unite(r0, r, a-a0): print("No") exit() assert False r_roots, r_weights = uf_r.get_roots_weights() c_roots, c_weights = uf_c.get_roots_weights() r_roots_inv = defaultdict(list) for i, r in enumerate(r_roots): r_roots_inv[r].append(i) c_roots_inv = defaultdict(list) for i, r in enumerate(c_roots): c_roots_inv[r].append(i) Closed_r = set() Closed_c = set() for r, c, a in RCA: root_r, root_c = r_roots[r], c_roots[c] if root_r in Closed_r: assert root_c in Closed_c continue Closed_r.add(root_r) Closed_c.add(root_c) mi = float("inf") for v in r_roots_inv[root_r]: mi = min(mi, r_weights[v]) a += mi - r_weights[root_r] for v in c_roots_inv[root_c]: a_ = a + c_weights[v] - c_weights[root_c] if a_ < 0: print("No") exit() print("Yes") main()
Traceback (most recent call last): File "/tmp/tmp7vlsyo7i/tmps2u77adt.py", line 108, in <module> main() File "/tmp/tmp7vlsyo7i/tmps2u77adt.py", line 58, in main R, C = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s085859168
p03995
u467736898
1573265723
Python
Python (3.4.3)
py
Runtime Error
1157
96868
3081
class WeightedUnionFind: # https://qiita.com/drken/items/cce6fc5c579051e64fab def __init__(self, n, SUM_UNITY=0): self.par = list(range(n)) self.rank = [0] * n self.diff_weight = [SUM_UNITY] * n def root(self, x): p = self.par[x] if p == x: return x else: r = self.root(p) self.diff_weight[x] += self.diff_weight[p] self.par[x] = r return r def weight(self, x): self.root(x) return self.diff_weight[x] def same(self, x, y): return self.root(x) == self.root(y) def unite(self, x, y, w): if self.same(x, y): return self.diff(x, y) == w w += self.weight(x); w -= self.weight(y) x, y = self.root(x), self.root(y) # if x == y: # return False if self.rank[x] < self.rank[y]: x, y = y, x w = -w if self.rank[x] == self.rank[y]: self.rank[x] += 1 self.par[y] = x self.diff_weight[y] = w return True def diff(self, x, y): return self.weight(y) - self.weight(x) def get_roots_weights(self): roots = [] weights = [] for x in range(len(self.par)): roots.append(self.root(x)) weights.append(self.weight(x)) return roots, weights import sys from operator import itemgetter from itertools import groupby from collections import defaultdict def main(): R, C = map(int, input().split()) N = int(input()) RCA = list(zip(*[iter(map(int, sys.stdin.read().split()))]*3)) uf_r = WeightedUnionFind(R+1) uf_c = WeightedUnionFind(C+1) RCA.sort(key=itemgetter(0)) for _, g in groupby(RCA, key=itemgetter(0)): _, c0, a0 = next(g) for _, c, a in g: if not uf_c.unite(c0, c, a-a0): print("No") exit() RCA.sort(key=itemgetter(1)) for _, g in groupby(RCA, key=itemgetter(1)): r0, _, a0 = next(g) for r, _, a in g: if not uf_r.unite(r0, r, a-a0): print("No") exit() r_roots, r_weights = uf_r.get_roots_weights() c_roots, c_weights = uf_c.get_roots_weights() r_roots_inv = defaultdict(list) for i, r in enumerate(r_roots): r_roots_inv[r].append(i) c_roots_inv = defaultdict(list) for i, r in enumerate(c_roots): c_roots_inv[r].append(i) Closed_r = set() Closed_c = set() for r, c, a in RCA: root_r, root_c = r_roots[r], c_roots[c] if root_r in Closed_r: assert root_c in Closed_c continue Closed_r.add(root_r) Closed_c.add(root_c) mi = float("inf") for v in r_roots_inv[root_r]: mi = min(mi, r_weights[v]) a += mi - r_weights[root_r] for v in c_roots_inv[root_c]: a_ = a + c_weights[v] - c_weights[root_c] if a_ < 0: print("No") exit() assert False print("Yes") main()
Traceback (most recent call last): File "/tmp/tmpkaek0j2r/tmpigcgvlv_.py", line 109, in <module> main() File "/tmp/tmpkaek0j2r/tmpigcgvlv_.py", line 58, in main R, C = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s485483337
p03995
u436484848
1475627280
Python
Python (3.4.3)
py
Runtime Error
1808
106272
906
from collections import defaultdict def ReadInput(): return [int(i) for i in input().split(" ")] (R, C) = ReadInput() N = int(input()) VectorSet = set() Grid = defaultdict(list) for i in range(N): (r, c, a) = ReadInput() Grid[("R", r)].append((("C", c), a)) Grid[("C", c)].append((("R", r), a)) VectorSet.add(("R", r)) VectorSet.add(("C", c)) def iteration(vector): VectorSet.discard(vector) for (v, a) in Grid[vector]: temp = a - VectorCover[vector] if (v in VectorCover): if(temp != VectorCover[v]): print("No") exit() else: VectorCover[v] = temp iteration(v) while(len(VectorSet) != 0): vector = VectorSet.pop() VectorCover = dict() VectorCover[vector] = 0 iteration(vector) minR = min(a for (p, a) in VectorCover.items() if (p[0] == "R")) minC = min(a for (p, a) in VectorCover.items() if (p[0] == "C")) if (minR + minC < 0): print("No") exit() print("Yes")
Traceback (most recent call last): File "/tmp/tmp0z72j1h_/tmpogmnyezj.py", line 4, in <module> (R, C) = ReadInput() ^^^^^^^^^^^ File "/tmp/tmp0z72j1h_/tmpogmnyezj.py", line 3, in ReadInput return [int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s477830885
p03995
u107077660
1475596652
Python
Python (3.4.3)
py
Runtime Error
24
3064
621
import sys sys.setrecursionlimit(10**6) R, C = map(int, input().split()) N = int(input()) r = [] c = [] a = [] for i in range(N): ri, ci, ai = map(int, input().split()) r.append(ri) c.append(ci) a.append(ai) x = {} y = {} for i in range(N): if r[i] in x: if c[i] in y: if x[r[i]] + y[c[i]] != a[i]: print("No") break else: y[c[i]] = a[i] - x[r[i]] else: if c[i] in y: x[r[i]] = a[i] - y[c[i]] else: x[r[i]] = a[i] y[c[i]] = 0 else: if min(y.values()) + min(x.values()) >= 0: print("Yes") else: print("No")
File "/tmp/tmpsng0uttr/tmphcbird_v.py", line 11 r.append(ri) TabError: inconsistent use of tabs and spaces in indentation
s385971670
p03995
u436484848
1475297643
Python
PyPy3 (2.4.0)
py
Runtime Error
1258
141016
1001
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # D-Grid and Integers from collections import defaultdict def ReadInput(): return [int(i) for i in input().split(" ")] (R, C) = ReadInput() N = int(input()) VectorSet = set() Grid = defaultdict(list) for i in range(N): (r, c, a) = ReadInput() Grid[("R", r)].append((("C", c), a)) Grid[("C", c)].append((("R", r), a)) VectorSet.add(('R', r)) VectorSet.add(('C', c)) def iteration(vector): VectorSet.discard(vector) for (v, a) in Grid[vector]: temp = a - VectorCover[vector] if (v in VectorCover): if(temp is not VectorCover[v]): print("No") exit() else: VectorCover[v] = temp iteration(v) while(len(VectorSet) is not 0): vector = VectorSet.pop() VectorCover = defaultdict(int) VectorCover[vector] = 0 iteration(vector) minR = min(a for (p, a) in VectorCover.items() if (p[0] is "R")) minC = min(a for (p, a) in VectorCover.items() if (p[0] is "C")) if (minR + minC < 0): print("No") exit() print("Yes")
/tmp/tmpu73v6wtr/tmp81213zdr.py:33: SyntaxWarning: "is not" with a literal. Did you mean "!="? while(len(VectorSet) is not 0): /tmp/tmpu73v6wtr/tmp81213zdr.py:38: SyntaxWarning: "is" with a literal. Did you mean "=="? minR = min(a for (p, a) in VectorCover.items() if (p[0] is "R")) /tmp/tmpu73v6wtr/tmp81213zdr.py:39: SyntaxWarning: "is" with a literal. Did you mean "=="? minC = min(a for (p, a) in VectorCover.items() if (p[0] is "C")) /tmp/tmpu73v6wtr/tmp81213zdr.py:33: SyntaxWarning: "is not" with a literal. Did you mean "!="? while(len(VectorSet) is not 0): Traceback (most recent call last): File "/tmp/tmpu73v6wtr/tmp81213zdr.py", line 10, in <module> (R, C) = ReadInput() ^^^^^^^^^^^ File "/tmp/tmpu73v6wtr/tmp81213zdr.py", line 8, in ReadInput return [int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s065960158
p03995
u436484848
1475137667
Python
Python (3.4.3)
py
Runtime Error
23
3064
1143
from collections import defaultdict import copy def readInput(): return [int(i) for i in input().split(" ")] (R, C) = readInput() N = int(input()) rowIdx = set() cover = set() grid = defaultdict(lambda:None) rowGrid = defaultdict(set) for i in range(N): (r, c, a) = readInput() r -= 1 c -= 1 rowGrid[r].add(c) grid[(r, c)] = a rowIdx.add(r) pairIdx = copy.copy(rowIdx) for i in rowIdx: tempRow = rowGrid[i] tempRow.difference_update(cover) if (len(tempRow) is 0): continue pairIdx.remove(i) for j in pairIdx: tempPair = rowGrid[j] mark = 1 for k in tempRow: if (grid[(j, k)] is now None): diff = grid[(i, k)] - grid[(j, k)] mark = 0 break if (mark is 1): continue for m in tempRow: anchor = grid[(i, m)] anchorP = grid[(j, m)] if (anchorP is None and anchor < diff): print('No') exit() elif (anchorP is not None and anchor - anchorP != diff): print('No') exit() for n in tempPair: anchor = grid[(j, n)] anchorP = grid[(i, n)] if (anchorP is None and anchor < -diff): print('No') exit() cover &= tempRow if (len(cover) is C): break print('Yes')
File "/tmp/tmp9xn9ihiw/tmp3jitjpqy.py", line 32 if (grid[(j, k)] is now None): ^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
s926518204
p03995
u436484848
1475134690
Python
Python (3.4.3)
py
Runtime Error
784
58116
979
from collections import defaultdict def readInput(): return [int(i) for i in input().split(" ")] (R, C) = readInput() N = int(input()) rowIdx = set() grid = defaultdict(lambda:None) rowGrid = defaultdict(set) for i in range(N): (r, c, a) = readInput() r -= 1 c -= 1 rowGrid[r].add(c) grid[(r, c)] = a rowIdx.add(r) pairIdx = rowIdx.copy for i in rowIdx: pairIdx.remove(i) for j in pairIdx: tempRow = rowGrid[i] tempPair = rowGrid[j] mark = 1 for k in tempRow: if (grid[(j, k)] != None): diff = grid[(i, k)] - grid[(j, k)] mark = 0 if (mark is 1): continue for m in tempRow: anchor = grid[(i, m)] anchorP = grid[(j, m)] if (anchorP is None and anchor < diff): print('No') exit() elif (anchorP is not None and anchor - anchorP != diff): print('No') exit() for n in tempPair: anchor = grid[(j, n)] anchorP = grid[(i, n)] if (anchorP is None and anchor < -diff): print('No') exit() print('Yes')
/tmp/tmph3ojecnj/tmp04kydftu.py:30: SyntaxWarning: "is" with a literal. Did you mean "=="? if (mark is 1): Traceback (most recent call last): File "/tmp/tmph3ojecnj/tmp04kydftu.py", line 6, in <module> (R, C) = readInput() ^^^^^^^^^^^ File "/tmp/tmph3ojecnj/tmp04kydftu.py", line 4, in readInput return [int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s664977666
p03995
u436484848
1475132166
Python
PyPy3 (2.4.0)
py
Runtime Error
926
86360
1071
#/usr/bin/env python3 # -*- coding: utf-8 -*- # D-Grid and Integers from collections import defaultdict def readInput(): return [int(i) for i in input().split(" ")] (R, C) = readInput() N = int(input()) rowIdx = list() colIdx = list() grid = defaultdict(lambda:None) rowGrid = defaultdict(list) for i in range(N): (r, c, a) = readInput() r -= 1 c -= 1 rowGrid[r].append(c) grid[(r, c)] = a rowIdx.append(r) pairIdx = rowIdx.copy() for i in rowIdx: pairIdx.remove(i) for j in pairIdx: tempRow = rowGrid[i] tempPair = rowGrid[j] mark = 1 for k in tempRow: if (grid[(j, k)] != None): diff = grid[(i, k)] - grid[(j, k)] mark = 0 if (mark == 1): continue for m in tempRow: anchor = grid[(i, m)] anchorP = grid[(j, m)] if (anchorP == None and anchor < diff): print('No') exit() elif (anchorP != None and anchor - anchorP != diff): print('No') exit() for n in tempPair: anchor = grid[(j, n)] anchorP = grid[(i, n)] if (anchorP == None and anchor < -diff): print('No') exit() print('Yes')
Traceback (most recent call last): File "/tmp/tmp71mg5gjg/tmphefq_x1r.py", line 10, in <module> (R, C) = readInput() ^^^^^^^^^^^ File "/tmp/tmp71mg5gjg/tmphefq_x1r.py", line 8, in readInput return [int(i) for i in input().split(" ")] ^^^^^^^ EOFError: EOF when reading a line
s184308316
p03995
u104282757
1474946828
Python
Python (2.7.6)
py
Runtime Error
17
2696
1438
import numpy as np R, C = map(int, raw_input().split()) N = int(raw_input()) rca_list = [] for i in range(N): rca_list.append(map(int, raw_input().split())) # ret ret = "YES" while len(rca_list) > 0 and ret == "YES": # r_vec = np.zeros(R) r_vec_2 = np.zeros(R) c_vec = np.zeros(C) c_vec_2 = np.zeros(C) # first square r, c, a = rca_list.pop() r_vec[r-1] = a c_vec[c-1] = 0 r_vec_2[r-1] = 1 c_vec_2[c-1] = 1 go_flg = "YES" while go_flg == "YES" and ret == "YES": go_flg = "NO" for i in range(len(rca_list)-1, , -1): r, c, a = rca_list[i] # filled if r_vec_2[r-1] + c_vec_2[c-1] == 2: rca_list.pop(i) go_flg = "YES" if c != r_vec[r-1] + c_vec[c-1]: ret = "NO" elif r_vec_2[r-1] + c_vec_2[c-1] == 1: if r_vec_2[r-1] == 1: c_vec_2[c-1] = 1 c_vec[c-1] = a - r_vec[r-1] rca_list.pop(i) go_flg = "YES" elif c_vec_2[c-1] == 1: r_vec_2[r-1] = 1 r_vec[r-1] = a - c_vec[c-1] rca_list.pop(i) go_flg = "YES" else: pass if min(r_vec[r_vec==1]) + min(c_vec[c_vec==1]) < 0: ret = "NO" print ret
File "/tmp/tmpakg_g0gl/tmps7c783us.py", line 36 for i in range(len(rca_list)-1, , -1): ^ SyntaxError: invalid syntax
s538985694
p03995
u104282757
1474936127
Python
Python (2.7.6)
py
Runtime Error
18
2696
1453
r_vec = np.zeros(R) r_vec_2 = np.zeros(R) c_vec = np.zeros(C) c_vec_2 = np.zeros(C) # ret ret = "YES" while len(rca_list) > 0 and ret == "YES": # first square r, c, a = rca_list.pop() r_vec[r-1] = a c_vec[c-1] = 0 r_vec_2[r-1] = 1 c_vec_2[c-1] = 1 go_flg = "YES" print r_vec, r_vec_2, c_vec, c_vec_2, go_flg, ret while go_flg == "YES" and ret == "YES": go_flg = "NO" for i in range(len(rca_list)-1, -1, -1): r, c, a = rca_list[i] # filled if r_vec_2[r-1] + c_vec_2[c-1] == 2: rca_list.pop(i) go_flg = "YES" print "filled" + str([r, c, a]) if c != r_vec[r-1] + c_vec[c-1]: ret = "NO" elif r_vec_2[r-1] + c_vec_2[c-1] == 1: if r_vec_2[r-1] == 1: c_vec_2[c-1] = 1 c_vec[c-1] = a - r_vec[r-1] print "one filled" + str([r, c, a]) rca_list.pop(i) go_flg = "YES" elif c_vec_2[c-1] == 1: r_vec_2[r-1] = 1 r_vec[r-1] = a - c_vec[c-1] print "one filled" + str([r, c, a]) rca_list.pop(i) go_flg = "YES" else: pass if ret == "YES" and min(r_vec) + min(c_vec) >= 0: print "YES" else: print "NO"
File "/tmp/tmpg0dp96w0/tmpcqk1htel.py", line 20 print r_vec, r_vec_2, c_vec, c_vec_2, go_flg, ret ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s097747193
p03995
u226155577
1474936073
Python
Python (2.7.6)
py
Runtime Error
1843
126896
1873
from collections import deque r, c = map(int, raw_input().split()) n = input() P = [map(int, raw_input().split()) for i in xrange(n)] d = {} P.sort() for i in xrange(1, n): r1, c1, a1 = P[i-1] r2, c2, a2 = P[i] if r1 == r2: d.setdefault((r1, c1), []).append(((r2, c2), a2-a1)) d.setdefault((r2, c2), []).append(((r1, c1), a1-a2)) P.sort(key=lambda (r,c,a): (c,r)) for i in xrange(1, n): r1, c1, a1 = P[i-1] r2, c2, a2 = P[i] if c1 == c2: d.setdefault((r1, c1), []).append(((r2, c2), a2-a1)) d.setdefault((r2, c2), []).append(((r1, c1), a1-a2)) m = {} for i, (r0, c0, a0) in enumerate(P): m[r0, c0] = (a0, i) used = [0]*n for i in xrange(n): if not used[i]: r0, c0, base = P[i] used[i] = 1 deq = deque() deq.append((r0, c0, base)) rs = {r0: 0} cs = {c0: 0} while deq: r0, c0, now = deq.popleft() for (r1, c1), diff in d[r0, c0]: a1, j = m[r1, c1] if r0 == r1: if not used[j]: cs[c1] = cs[c0] + diff used[j] = 1 deq.append((r1, c1, now + diff)) else: if cs[c0] + diff != cs[c1]: print "No" exit(0) else: if not used[j]: rs[r1] = rs[r0] + diff used[j] = 1 deq.append((r1, c1, now + diff)) else: if rs[r0] + diff != rs[r1]: print "No" exit(0) rmin = min(rs.values()) cmin = min(cs.values()) if rmin + cmin + base < 0: print "No" exit(0) print "Yes"
File "/tmp/tmpy063wgtz/tmp76qj4kip.py", line 14 P.sort(key=lambda (r,c,a): (c,r)) ^^^^^^^ SyntaxError: Lambda expression parameters cannot be parenthesized
s395001953
p03995
u165551604
1474875650
Python
Python (2.7.6)
py
Runtime Error
16
2568
23
import z3 print "Yes\n"
File "/tmp/tmpdlg9rzpr/tmpy67dg3n0.py", line 2 print "Yes\n" ^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s242905752
p03995
u478870821
1474774084
Python
Python (3.4.3)
py
Runtime Error
1847
119180
902
from sys import exit, setrecursionlimit from functools import reduce from itertools import * from collections import defaultdict def read(): return int(input()) def reads(): return [int(x) for x in input().split()] setrecursionlimit(10000) (R, C) = reads() N = read() d = defaultdict(list) V = set() for _ in range(N): (r, c, a) = reads() d["R", r-1].append((("C", c-1), a)) d["C", c-1].append((("R", r-1), a)) V.add(("R", r-1)) V.add(("C", c-1)) def walk(v): for (w, a) in d[v]: wcol = a - col[v] if w in col: if col[w] != wcol: print("No"); exit() else: col[w] = wcol V.remove(w) walk(w) while len(V) > 0: col = dict() v = V.pop() col[v] = 0 walk(v) rcol = min(a for (v, a) in col.items() if v[0] == "R") ccol = min(a for (v, a) in col.items() if v[0] == "C") if rcol + ccol < 0: print("No"); exit() print("Yes")
Traceback (most recent call last): File "/tmp/tmpmwabonr3/tmpd_3hkfl9.py", line 14, in <module> (R, C) = reads() ^^^^^^^ File "/tmp/tmpmwabonr3/tmpd_3hkfl9.py", line 10, in reads return [int(x) for x in input().split()] ^^^^^^^ EOFError: EOF when reading a line
s135281896
p03995
u112686013
1474772002
Python
Python (2.7.6)
py
Runtime Error
16
2568
2631
def check_squares(grid, coord, isFilled): rows, cols = len(grid), len(grid[0]) r, c = coord[0], coord[1] sums = [] if r - 1 >= 0 and c - 1 >= 0: # check upper left square if isFilled and (grid[r][c - 1] + grid[r - 1][c] != grid[r][c] + grid[r - 1][c - 1]): raise ValueError('not filled correctly') elif not isFilled and if grid[r][c - 1] is not None and grid[r - 1][c] is not None and grid[r - 1][c - 1] is not None: sums.append((grid[r][c - 1] + grid[r - 1][c]) - grid[r - 1][c - 1]) if r - 1 >= 0 and c + 1 < cols: # check upper right square if isFilled and (grid[r - 1][c] + grid[r][c + 1] != grid[r][c] + grid[r - 1][c + 1]): raise ValueError('not filled correctly') elif not isFilled and grid[r - 1][c] is not None and grid[r - 1][c + 1] is not None and grid[r][c + 1] is not None: sums.append((grid[r - 1][c] + grid[r][c + 1]) - grid[r - 1][c + 1]) if r + 1 < rows and c - 1 >= 0: # check lower left if isFilled and (grid[r][c] + grid[r + 1][c - 1] != grid[r][c - 1] + grid[r + 1][c]): raise ValueError('not filled correctly') elif not isFilled and grid[r][c - 1] is not None and grid[r + 1][c] is not None and grid[r + 1][c - 1] is not None: sums.append((grid[r][c - 1] + grid[r + 1][c]) - grid[r + 1][c - 1]) if r + 1 < rows and c + 1 < cols: # check lower right if isFilled and (grid[r + 1][c + 1] + grid[r][c] != grid[r][c + 1] + grid[r + 1][c]): raise ValueError('not filled correctly') elif not isFilled and grid[r][c + 1] is not None and grid[r + 1][c] is not None and grid[r + 1][c + 1] is not None: sums.append((grid[r + 1][c] + grid[r][c + 1]) - grid[r + 1][c + 1]) if len(sums) > 1 and len(set(sums)) > 1: raise ValueError('Square cannot be filled in') elif len(sums) == 1: if sums[0] < 0: raise ValueError('Value would have to be negative') return sums[0] else: return None r, c = map(int, raw_input().split()) n = int(raw_input()) grid = [ [None for i in range(c)] for j in range(r) ] for i in range(n): line = map(int, raw_input().split()) grid[line[0] - 1][line[1] - 1] = line[2] possible = True filled = (n == r * c) for i in range(r): for j in range(c): if grid[i][j] is None or filled: try: result = check_squares(grid, (i, j), filled) if not filled: grid[i][j] = result except ValueError: print 'No' exit() print 'Yes'
File "/tmp/tmpu1bliqx8/tmprkqxdlgv.py", line 10 elif not isFilled and if grid[r][c - 1] is not None and grid[r - 1][c] is not None and grid[r - 1][c - 1] is not None: ^^ SyntaxError: invalid syntax
s877341454
p03995
u112686013
1474771789
Python
Python (2.7.6)
py
Runtime Error
16
2568
2578
def check_squares(grid, coord, isFilled): rows, cols = len(grid), len(grid[0]) r, c = coord[0], coord[1] sums = [] if r - 1 >= 0 and c - 1 >= 0: # check upper left square if isFilled and (grid[r][c - 1] + grid[r - 1][c] != grid[r][c] + grid[r - 1][c - 1]): raise ValueError('not filled correctly') elif not isFilled and if grid[r][c - 1] is not None and grid[r - 1][c] is not None and grid[r - 1][c - 1] is not None: sums.append((grid[r][c - 1] + grid[r - 1][c]) - grid[r - 1][c - 1]) if r - 1 >= 0 and c + 1 < cols: # check upper right square if isFilled and (grid[r - 1][c] + grid[r][c + 1] != grid[r][c] + grid[r - 1][c + 1]): raise ValueError('not filled correctly') elif not isFilled and grid[r - 1][c] is not None and grid[r - 1][c + 1] is not None and grid[r][c + 1] is not None: sums.append((grid[r - 1][c] + grid[r][c + 1]) - grid[r - 1][c + 1]) if r + 1 < rows and c - 1 >= 0: # check lower left if isFilled and (grid[r][c] + grid[r + 1][c - 1] != grid[r][c - 1] + grid[r + 1][c]): raise ValueError('not filled correctly') elif not isFilled and grid[r][c - 1] is not None and grid[r + 1][c] is not None and grid[r + 1][c - 1] is not None: sums.append((grid[r][c - 1] + grid[r + 1][c]) - grid[r + 1][c - 1]) if r + 1 < rows and c + 1 < cols: # check lower right if isFilled and (grid[r + 1][c + 1] + grid[r][c] != grid[r][c + 1] + grid[r + 1][c]): raise ValueError('not filled correctly') elif not isFilled and grid[r][c + 1] is not None and grid[r + 1][c] is not None and grid[r + 1][c + 1] is not None: sums.append((grid[r + 1][c] + grid[r][c + 1]) - grid[r + 1][c + 1]) if len(sums) > 1 and len(set(sums)) > 1: raise ValueError('Square cannot be filled in') elif len(sums) == 1: if sums[0] < 0: raise ValueError('Value would have to be negative') return sums[0] else: return None r, c = map(int, raw_input().split()) n = int(raw_input()) grid = [ [None for i in range(c)] for j in range(r) ] for i in range(n): line = map(int, raw_input().split()) grid[line[0] - 1][line[1] - 1] = line[2] filled = (n == r * c) for i in range(r): for j in range(c): if grid[i][j] is None or filled: try: result = check_squares(grid, (i, j), filled) grid[i][j] = result except ValueError: print 'No' exit() print 'Yes'
File "/tmp/tmp_z1_cs3m/tmp8f1vteks.py", line 10 elif not isFilled and if grid[r][c - 1] is not None and grid[r - 1][c] is not None and grid[r - 1][c - 1] is not None: ^^ SyntaxError: invalid syntax
s001853994
p03995
u483182857
1474771620
Python
Python (3.4.3)
py
Runtime Error
23
3064
170
c,r = map(int, input().split()) N=int(input()) list=[[-1] * r for i in range(c)] for i in range(N): i1,i1,x=map(int, input().split())) list[i1][i2]=x print('Yes')
File "/tmp/tmp0de3ntbh/tmp6y4cziu2.py", line 5 i1,i1,x=map(int, input().split())) ^ SyntaxError: unmatched ')'
s761578580
p03995
u531436689
1474771214
Python
Python (2.7.6)
py
Runtime Error
16
2696
743
def checker(board): #for (upper,under) in zip(board[0],board[1]) upper = board[0] under = board[1] numlist = [] for i in range(len(upper)-2): try: tmp = upper[i] + under[i+1] numlist.append(tmp) tmp2 = upper[i+1] + under[i] numlist.append(tmp2) except: pass if len(list(set(numlist))) == 1: return 'Yes' elif: return 'No' R,C = map(int,raw_input().split()) N = input() a = [] for i in xrange(N): a.append(map(int,raw_input().split())) #matrix ans_board = [['None' for i in xrange(C)], ['None' for i in xrange(C)]] for a_sub in a: ans_board[a_sub[0]-1][a_sub[1]-1] = a_sub[2] print checker(ans_board)
File "/tmp/tmpfpomzg0h/tmprqhk88hp.py", line 17 elif: ^ SyntaxError: invalid syntax
s367562602
p03995
u531436689
1474771136
Python
Python (2.7.6)
py
Runtime Error
16
2568
718
def checker(board): #for (upper,under) in zip(board[0],board[1]) upper = board[0] under = board[1] numlist = [] for i in range(len(upper)-2): try: tmp = upper[i] + under[i+1] numlist.append(tmp) tmp2 = upper[i+1] + under[i] numlist.append(tmp2) except: pass if len(list(set(numlist))) == 1: return 'yes' elif: return 'no' R,C = map(int,raw_input().split()) N = input() a = [] for i in xrange(N): a.append(map(int,raw_input().split())) #matrix ans_board = [['None' for i in xrange(C)], ['None' for i in xrange(C)]] for a_sub in a: ans_board[a_sub[0]-1][a_sub[1]-1] = a_sub[2]
File "/tmp/tmpa7ppl9qr/tmpxy1xp0u5.py", line 17 elif: ^ SyntaxError: invalid syntax
s663912549
p03996
u368780724
1590107787
Python
PyPy3 (2.4.0)
py
Runtime Error
267
79316
1107
import sys from itertools import product readline = sys.stdin.readline def check1(A): K = max(A) table = [-1]*(K+1) for i in range(Q): table[A[i]] = i if -1 in table: return False if any(t1-t2 < 0 for t1, t2 in zip(table, table[1:])): return False return True INF = 10**9+7 def check2(A): stack = [] used = set() for a in A[::-1] + list(range(M)): if a not in used: used.add(a) stack.append(a) C = dict() for i in range(M): C[stack[i]] = i table = [0]*N + [INF] for a in A[::-1]: if table[C[a]] < table[C[a]-1]: table[C[a]] += 1 zero = stack.index(0) if all(t2 > t1 for t1, t2 in zip(stack[zero:], stack[zero+1:])): for a in stack[zero:]: table[C[a]] = N return all(t >= N or t == 0 for t in table) N, M = map(int, readline().split()) Q = int(readline()) A = list(map(lambda x: int(x)-1, readline().split())) ans = 'Yes' if not check1(A): A = [0]*N + A if not check2(A): ans = 'No' print(ans)
Traceback (most recent call last): File "/tmp/tmprxwqvimc/tmp71v5oqgk.py", line 43, in <module> N, M = map(int, readline().split()) ^^^^ ValueError: not enough values to unpack (expected 2, got 0)
s297598441
p03996
u436484848
1475626331
Python
Python (3.4.3)
py
Runtime Error
71
14468
668
def reads(offset = 0): return [int(i) - offset for i in input().split(' ')] def Judge(vector): length = len(vector)-1 for i in range(length): if(vector[i] > vector[i+1]): return 0 return 1 (N, M) = reads() Q = int(input()) A = reads(1) pos = [-1] * M pat = [] freq = [0] * (M+1) freq[0] = N found = set() for i in A[::-1]: if (i not in found): pat.append(i) found.add(i) pos[i] = counter for i in range(M): if (pos[i] == -1): pat.append(i) for i in A[::-1]: temp = pos[i] if (freq[temp] > 0): freq[temp] -= 1 freq[temp+1] += 1 for i in range(M+1): if (freq[i] != 0): start = i break print("Yes") if Judge(pat[start:]) else print("No")
Traceback (most recent call last): File "/tmp/tmp1u235zvi/tmpyf2q5oqi.py", line 9, in <module> (N, M) = reads() ^^^^^^^ File "/tmp/tmp1u235zvi/tmpyf2q5oqi.py", line 2, in reads return [int(i) - offset for i in input().split(' ')] ^^^^^^^ EOFError: EOF when reading a line
s689787891
p03996
u436484848
1475389306
Python
Python (3.4.3)
py
Runtime Error
22
3064
862
from collections import defaultdict def ReadInput(): return [int(a) for a in input().split(' ')] (N, M) = ReadInput() Q = int(input()) Array = ReadInput() def ifEqual(x): temp = None for i in x: if (temp == None): temp = x[i] continue elif (x[i] != temp): print('ifEqual is 0') return 0 return temp def check(Array, N, M, *args): Count = defaultdict(int) Array.reverse() if ("reverse") not in args: for i in Array: if (i == 1 or Count[i] < Count[i-1]): Count[i] += 1 else: return 0 Count.pop(N) if(ifEqual(Count)): return 1 else: return 0 else: for i in Array: if (i == N or Count[i] < Count[i+1]): Count[i] += 1 else: return 0 Count.pop(1) if(ifEqual(Count) >= M): return 1 else return 0 if (check(Array, N, M) or check(Array, N, M, "reverse")): print("Yes") else: print("No")
File "/tmp/tmp0xjx91xn/tmpa0nuk0c5.py", line 40 else ^ SyntaxError: expected ':'
s658975282
p03996
u945080461
1474769707
Python
Python (2.7.6)
py
Runtime Error
158
23220
877
from sys import stdin from itertools import repeat def main(): n, m = map(int, stdin.readline().split()) q = int(stdin.readline()) a = map(int, stdin.readline().split(), repeat(10, q)) a = [x - 1 for x in a] l = [[] for i in xrange(q)] la = [] for i in xrange(q - 1, -1, -1): x = a[i] if not l[x]: la.append(x) l[x].append(i) ok = 1 b = [q] * n f = [0] * m xt = 0 for i, x in enumerate(la): j = 0 for y in l[x]: if j < n and y < b[j]: b[j] = y j += 1 if j < n: ok = 0 b[j] = -1 if not ok: while f[xt]: xt += 1 if x != xt: print "No" return f[xt] = 1 else: f[x] = 1 print "Yes" main()
File "/tmp/tmp1_0ynnce/tmp56kr0uw2.py", line 32 print "No" ^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
s572427272
p03997
u185948224
1601346848
Python
Python (3.8.2)
py
Runtime Error
25
9000
59
a, b, h = map(int, input().split()) print((a + b) * h // 2)
Traceback (most recent call last): File "/tmp/tmpog2coway/tmp5ktryba8.py", line 1, in <module> a, b, h = map(int, input().split()) ^^^^^^^ EOFError: EOF when reading a line
s280021849
p03997
u318661636
1601295566
Python
Python (3.8.2)
py
Runtime Error
23
9036
53
a,b,h = map(int,input().split()) print(((a+b)*h)//2)
Traceback (most recent call last): File "/tmp/tmp51hdg6p6/tmpmlp3nu3t.py", line 1, in <module> a,b,h = map(int,input().split()) ^^^^^^^ EOFError: EOF when reading a line