s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s350060463
p03994
u145950990
1592163297
Python
Python (3.4.3)
py
Runtime Error
65
4156
186
s = list(input()) k = int(input()) n = len(s) for i in range(n): d = ord('z')-ord(s[i])+1 if d<=k: s[i] = 'a' k -= d s[-1] = chr(ord(s[-1])+k) print(''.join(s))
s865834391
p03994
u922487073
1592029999
Python
Python (3.4.3)
py
Runtime Error
68
3444
246
S = input() K = int(input()) z = ord('z') + 1 res = "" flg = False for i,c in enumerate(S): if z - ord(c) <= K: res += 'a' K -= z-ord(c) else: res += chr(ord(c)) res = res[:-1] + chr(ord(res[-1]) + K) print(res)
s525070828
p03994
u941047297
1592018287
Python
Python (3.4.3)
py
Runtime Error
47
4796
381
def main(): S = list(input()) k = int(input()) ans = [] for s in S: if k == 0: break if s != 'a' and ord(s) >= 123 - k: ans.append('a') k -= 123 - ord(s) else: ans.append(s) if k > 0: ans[-1] = chr(ord(ans[-1]) + k) print(''.join(ans)) if __name__ == '__main__': main()
s240442705
p03994
u941047297
1592018162
Python
Python (3.4.3)
py
Runtime Error
47
4792
368
def main(): S = list(input()) k = int(input()) ans = [] for s in S: if k == 0: break if ord(s) >= 123 - k: ans.append('a') k -= 123 - ord(s) else: ans.append(s) if k > 0: ans[-1] = chr(ord(ans[-1]) + k) print(''.join(ans)) if __name__ == '__main__': main()
s591380836
p03994
u974792613
1591999185
Python
Python (3.4.3)
py
Runtime Error
2658
318196
453
import sys def input(): return sys.stdin.readline()[:-1] alphabet = "abcdefghijklmnopqrstuvwxyz" a_len = len(alphabet) table = {c: idx for idx, c in enumerate(alphabet)} s = input() k = int(input()) ans = "" for i in range(len(s[:-1])): gap = a_len - table[s[i]] if gap <= k: ans += "a" k -= gap elif k == 0: ans += s[i:-1] else: ans += s[i] ans += alphabet[(table[s[-1]] + k) % a_len] print(ans)
s041009224
p03994
u974792613
1591998815
Python
Python (3.4.3)
py
Runtime Error
1961
318196
434
import sys alphabet = "abcdefghijklmnopqrstuvwxyz" a_len = len(alphabet) table = {c: idx for idx, c in enumerate(alphabet)} rl = sys.stdin.readline s = rl().rstrip("\n") k = int(rl()) ans = "" for i in range(len(s[:-1])): gap = a_len - table[s[i]] if gap <= k: ans += "a" k -= gap elif k == 0: ans += s[i:-1] else: ans += s[i] ans += alphabet[(table[s[-1]] + k) % a_len] print(ans)
s628202998
p03994
u974792613
1591998673
Python
Python (3.4.3)
py
Runtime Error
1974
318196
430
import sys alphabet = "abcdefghijklmnopqrstuvwxyz" a_len = len(alphabet) table = {c: idx for idx, c in enumerate(alphabet)} rl = sys.stdin.readline s = rl().rstrip() k = int(rl()) ans = "" for i in range(len(s[:-1])): gap = a_len - table[s[i]] if gap <= k: ans += "a" k -= gap elif k == 0: ans += s[i:-1] else: ans += s[i] ans += alphabet[(table[s[-1]] + k) % a_len] print(ans)
s732904298
p03994
u134019875
1591950437
Python
Python (3.4.3)
py
Runtime Error
114
4212
324
s = str(input()) k = int(input()) S = [] for i in range(len(s)): S.append(ord(s[i]) - 97) i = 0 while k > 0: if 26 - S[i] <= k: k -= 26 - S[i] S[i] = 0 i += 1 else: i += 1 if i >= len(s): S[-1] += k break ans = '' for x in S: ans += chr(x + 97) print(ans)
s416144929
p03994
u647999897
1591933700
Python
PyPy3 (2.4.0)
py
Runtime Error
186
49392
324
def solve(): s = list(input()) K = int(input()) for i in range(len(s)): distToA = (ord('z')+1 - ord(s[i])) % ord('a') if distToA <= K: s[i] = 'a' K -= distToA else: s[-1] = chr(ord(s[-1]) + K) print("".join(s)) if __name__ == '__main__': solve()
s195120912
p03994
u197868423
1591744935
Python
Python (3.4.3)
py
Runtime Error
66
4148
411
S = list(input()) N = int(input()) ''' ordの位置 #z = 122 #a = 97 左の文字からNで'a'に出来るかを確認 aに出来るならaにして使った分をNから引く 繰り返して行き一番最後にあまりをすべて使う''' for i, s in enumerate(S): if ord(s) - 97 > 0 and 122 - ord(s) < N: S[i] = "a" N -= 123 - ord(s) else: S[i] = chr((ord(S[i]) + N)) print("".join(S))
s213776458
p03994
u288430479
1591739191
Python
Python (3.4.3)
py
Runtime Error
91
5968
629
from collections import deque s = input() k = int(input()) a = ord("a") l = deque(list()) l1 = [] for i in range(len(s)): s1 = s[i] l.append(((a+26)-ord(s1))%26) #print(l) while k!=0: if len(l)!=0: t = l.popleft() if k>=t: l1.append("a") k -= t else: if t=="a": l1.append(t) else: l1.append(chr((ord('a')-t+26))) else: l1[-1] = chr(int(ord(l1[-1])+k)) k = 0 l2 = [] if len(l)>=1: for t in l: if t==0: l2.append("a") else: l2.append(chr((ord('a')-t+26))) l1 += l2 print("".join(l1))
s467525197
p03994
u288430479
1591739151
Python
Python (3.4.3)
py
Runtime Error
95
5840
630
from collections import deque s = input() k = int(input()) a = ord("a") l = deque(list()) l1 = [] for i in range(len(s)): s1 = s[i] l.append(((a+26)-ord(s1))%26) #print(l) while k!=0: if len(l)!=0: t = l.popleft() if k>=t: l1.append("a") k -= t else: if t=="a": l1.append(t) else: l1.append(chr((ord('a')-t+26))) else: l1[-1] = chr(int(ord(l1[-1])+k)) k = 0 l2 = [] if len(l)>=1: for t in l: if t==0: l2.append("a") else: l2.append(chr((ord('a')-t+26))) l1 += l2 print("".joiin(l1))
s253586734
p03994
u288430479
1591738483
Python
Python (3.4.3)
py
Runtime Error
106
5144
426
from collections import deque s = input() k = int(input()) a = ord("a") l = deque(list()) l1 = [] for i in range(len(s)): s1 = s[i] l.append(((a+26)-ord(s1))%26) while k!=0: if len(l)!=0: t = l.popleft() if k>=t: l1.append("a") k -= t else: l1.append(chr(ord('a')-t+26)) else: l1[-1] = chr(int(ord(l1[-1])+k)) k = 0 print(''.join(l1))
s491880287
p03994
u288430479
1591738442
Python
Python (3.4.3)
py
Runtime Error
17
2940
442
from collections import deque s = input() k = int(input()) a = ord("a")codefestival 100 l = deque(list()) l1 = [] for i in range(len(s)): s1 = s[i] l.append(((a+26)-ord(s1))%26) while k!=0: if len(l)!=0: t = l.popleft() if k>=t: l1.append("a") k -= t else: l1.append(chr(ord('a')-t+26)) else: l1[-1] = chr(int(ord(l1[-1])+k)) k = 0 print(''.join(l1))
s079106991
p03994
u091051505
1591667836
Python
Python (3.4.3)
py
Runtime Error
17
3064
309
alphabet = 'abcdefghijklmnopqrstuvwxyz' s = input() K = int(input()) ans = '' for i in range(len(s) - 1): s_i = alphabet.index(s[i]) elif (26 - s_i < K) & (s_i != 0): K -= 26 - s_i s_i = 0 ans += alphabet[s_i] s_i = (alphabet.index(s[-1]) + K) % 26 ans += alphabet[s_i] print(ans)
s449251879
p03994
u888337853
1591449585
Python
Python (3.4.3)
py
Runtime Error
168
14316
847
import sys # import re import math import collections # import decimal import bisect import itertools import fractions # import functools import copy import heapq import decimal # import statistics import queue import numpy as np sys.setrecursionlimit(10000001) INF = 10 ** 16 MOD = 10 ** 9 + 7 ni = lambda: int(sys.stdin.readline()) ns = lambda: map(int, sys.stdin.readline().split()) na = lambda: list(map(int, sys.stdin.readline().split())) # ===CODE=== def main(): s = list(input()) k = ni() for i in range(len(s)): if si == "a": continue si = ord(s[i]) - 97 if k >= 26 - si: s[i] = "a" k -= 97 + 26 - si if k == 0: break s[-1] = chr(97 + (ord(s[-1]) - 97 + k) % 26) print(*s, sep="") if __name__ == '__main__': main()
s524193980
p03994
u241159583
1591401446
Python
Python (3.4.3)
py
Runtime Error
71
4804
238
#"a" 97 "z" 122 s = list(ord(i) for i in input()) k = int(input()) for i in range(len(s)): if 123 - s[i] <= k: k -= 123-s[i] s[i] = 97 if k > 0: s[-1] += k if s[-1] >= 123: s[-1] = s[-1]-26 print("".join(list(map(chr, s))))
s310305219
p03994
u391589398
1590952242
Python
Python (3.4.3)
py
Runtime Error
60
4272
311
s = input() k = int(input()) ns = [] for c in s[:-1]: ofstoa = ord('z')+1-ord(c) if k >= ofstoa: ns.append('a') k -= ofstoa else: ns.append(c) last = ord(s[-1]) if last + k > ord('z'): ns.append(chr(last + k - 26)) else: ns.append(chr(last + k)) print(''.join(ns))
s399694290
p03994
u801049006
1590435168
Python
Python (3.4.3)
py
Runtime Error
105
4980
332
s = input() n = len(s) k = int(input()) d = [0] * n for i in range(n): if s[i] != 'a': d[i] = ord('z') - ord(s[i]) + 1 ans = list(s) for i in range(n): if d[i] != 0 and d[i] <= k: k -= d[i] ans[i] = 'a' if k == 0: break if i == n-1: ans[i] = chr(ord(s[i]) + k) print(''.join(ans))
s151164156
p03994
u801049006
1590434944
Python
Python (3.4.3)
py
Runtime Error
161
4980
418
s = input() n = len(s) k = int(input()) d = [0] * n for i in range(n): if s[i] != 'a': d[i] = ord('z') - ord(s[i]) + 1 ans = list(s) for i in range(n): if d[i] != 0 and d[i] <= k: k -= d[i] c = ord(s[i]) + d[i] ans[i] = chr(c - ord('z') + ord('a') - 1) if c > ord('z') else chr(c) if k == 0: break if i == n-1: ans[i] = chr(ord(s[i]) + k) print(''.join(ans))
s673503020
p03994
u426764965
1590031158
Python
Python (3.4.3)
py
Runtime Error
53
3444
378
def codefes16qa_c(): s = str(input()) k = int(input()) n = len(s) ans = '' for i in range(n): step2a = 1 + ord('z') - ord(s[i]) if step2a <= k: ans += 'a' k -= step2a else: ans += s[i] if k > 0: last = ord(ans[-1]) + k ans = ans[:n-1] + chr(last) print(ans) codefes16qa_c()
s498769325
p03994
u414458988
1589845959
Python
PyPy3 (2.4.0)
py
Runtime Error
190
49392
365
def main(): s = list(input()) k = int(input()) for i in range(len(s)): mod = 26-(ord(s[i])-97)%26 if k >= mod: k -= mod s[i] = 'a' if k == 0: break if k > 0: mod = (ord(s[-1])-97)%26+k s[-1] = chr(mod+97) print(''.join(s)) if __name__ == '__main__': main()
s802136981
p03994
u952467214
1589671448
Python
Python (3.4.3)
py
Runtime Error
99
6888
293
s = list(input()) #sys.stdin.readlineは最後が改行 k = int(input()) now = 0 while k>0 and now<len(s): tmp = ord('z')-ord(s[now])+1 if tmp<=k: s[now] = 'a' k -= tmp now+=1 else: now+=1 if k>0: s[-1] = chr(ord(s[-1])+k ) print(*s,sep='')
s141213935
p03994
u210827208
1589574865
Python
Python (3.4.3)
py
Runtime Error
93
4212
308
X='abcdefghijklmnopqrstuvwxyz'*2 S=input() k=int(input()) N=[] for s in S: if s=='a': N.append(0) else: N.append(26-X.index(s)) ans='' for i in range(len(S)): if N[i]<=k : k-=N[i] ans+='a' else: ans+=S[i] ans=ans[:-1]+X[X.index(ans[-1])+k] print(ans)
s970945156
p03994
u210827208
1589574813
Python
Python (3.4.3)
py
Runtime Error
96
4212
306
X='abcdefghijklmnopqrstuvwxyz'*2 S=input() k=int(input()) N=[] for s in S: if s=='a': N.append(0) else: N.append(26-X.index(s)) ans='' for i in range(len(S)): if N[i]<=k : k-=N[i] ans+='a' else: ans+=S[i] ans=ans[:-1]+X[X.index(ans[i])+k] print(ans)
s678280436
p03994
u210827208
1589574130
Python
Python (3.4.3)
py
Runtime Error
646
4340
484
from _collections import deque X='abcdefghijklmnopqrstuvwxyz'*2 S=input() k=int(input()) N=deque([]) for s in S: if s=='a': N.append(0) else: N.append(26-X.index(s)) important=0 for i in range(len(S)): if N[i]<=k : k-=N[i] else: important=i break ans2='' for i in range(important,len(S)-1): if N[i]<=k: ans2+='a' k-=N[i] else: ans2+=X[X.index(S[i])] print('a'*important+ans2+X[X.index(S[-1])+k])
s599806322
p03994
u940139461
1589554468
Python
PyPy3 (2.4.0)
py
Runtime Error
191
46192
336
# https://atcoder.jp/contests/code-festival-2016-quala/tasks/codefestival_2016_qualA_c s = input() k = int(input()) n = len(s) ans = [] for i in range(n): t = (ord('z') - ord(s[i]) + 1) % 26 if t <= k: ans.append('a') k -= t else: ans.append(s[i]) ans[-1] = chr(ord(ans[-1]) + k) print(''.join(ans))
s424349220
p03994
u896741788
1589401762
Python
Python (3.4.3)
py
Runtime Error
86
3572
195
s=input() n=int(input()) l="" for i in range(len(s)): f=(26+ord("a")-ord(s[i]))%26 if n>=f:n-=f;l+="a" else:l+=s[i] if n==0:print(l+s[i+1:]);exit() print(l[:-1]+chr(ord(l[-1])+n))
s485433103
p03994
u228223940
1588632223
Python
PyPy3 (2.4.0)
py
Runtime Error
232
53076
319
s = input() k = int(input()) len_s = len(s) moji = [0]*(len_s) for i in range(len_s): num = 26-(ord(s[i])-ord('a')) if num <= k: moji[i] = 'a' k -= num else: moji[i] = s[i] if k != 0: #print(k) moji[len_s-1] = chr(ord(moji[len_s-1])+k) print(*moji,sep='')
s827336820
p03994
u992910889
1588608962
Python
PyPy3 (2.4.0)
py
Runtime Error
182
49392
367
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): a=list(input()) K=int(input()) for i in range(len(a)): val=123-ord(a[i]) if val<=K: a[i]='a' K-=val if i==len(a)-1 and K>0: a[-1]=chr(ord(a[-1])+K) print(''.join(a)) resolve()
s596930817
p03994
u707124227
1588533990
Python
PyPy3 (2.4.0)
py
Runtime Error
199
49648
254
s=input() k=int(input()) a2n = lambda c: ord(c) - ord('a') + 1 n2a = lambda c: chr(c+64).lower() ls=list(s) i=0 while k>0 and i<len(ls): a=(1-a2n(ls[i]))%26 if k>=a: ls[i]='a' k-=a i+=1 if k>0: ls[-1]=n2a(a2n(ls[-1])+k) print(''.join(ls))
s868801981
p03994
u995004106
1588358843
Python
PyPy3 (2.4.0)
py
Runtime Error
204
49584
249
s=list(input()) N=len(s) K=int(input()) num=123 for i in range(N): diff=(num-ord(s[i]))%26 if K==0: break if diff<=K: s[i]="a" K=K-diff #print(s) if K>0: s[N-1]=chr(ord(s[N-1])+K) #print(s) print("".join(s))
s052199819
p03994
u683134447
1588136542
Python
PyPy3 (2.4.0)
py
Runtime Error
181
49520
231
sl = list(input()) k = int(input()) for i in range(len(sl)): ord_s = ord(sl[i]) use = 123 - ord_s if k - use >= 0: sl[i] = "a" k -= use if k > 0: sl[-1] = chr(ord(sl[-1]) + k) print("".join(sl))
s566043395
p03994
u614181788
1587870463
Python
Python (3.4.3)
py
Runtime Error
148
5488
347
s=input() k=int(input()) ss = [0]*len(s) for i in range(len(s)): if k >= 26: k = k + ord(s[i])-97-26 ss[i] = "a" elif 97+26 - ord(s[i]) <= k: k = k + ord(s[i])-97-26 ss[i] = "a" else: ss[i] = s[i] if k != 0: ss[-1] = chr(ord(s[-1])+k) for i in range(len(s)): print(ss[i],end='') print()
s407982043
p03994
u614181788
1587870331
Python
Python (3.4.3)
py
Runtime Error
150
5620
345
s=input() k=int(input()) ss = [0]*len(s) for i in range(len(s)): if k >= 26: k = k + ord(s[i])-97-26 ss[i] = 'a' elif 97+26 - ord(s[i]) <= k: k = k + ord(s[i])-97-26 ss[i] = 'a' else: ss[i] = s[i] ss[-1] = chr(ord(s[-1])+k) #print((ss)) for i in range(len(s)): print(ss[i],end='') print()
s428324442
p03994
u588794534
1587522010
Python
Python (3.4.3)
py
Runtime Error
65
3572
450
s=input() k=int(input()) result="" for ss in s: if ss=="a": result+="a" else: if k>= 123 - ord(ss): k-=123-ord(ss) result+="a" else: result+=ss if k>0: k=k%(123-97) temp=chr((((ord(result[-1])-97)+k)%(123-97))+97) print(result[:-1]+temp) #print(ord("a")):97 #print(ord("b")):98 #print(ord("z")):122 #97ならそのまま #aにするには123-ord()をすればいい
s145951379
p03994
u588794534
1587509090
Python
Python (3.4.3)
py
Runtime Error
60
3572
386
s=input() k=int(input()) result="" for ss in s: if ss=="a": result+="a" else: if k>= 123 - ord(ss): k-=123-ord(ss) result+="a" else: result+=ss print(result[:-1]+chr(ord(result[-1])+k)) #print(ord("a")):97 #print(ord("b")):98 #print(ord("z")):122 #97ならそのまま #aにするには123-ord()をすればいい
s207675361
p03994
u561231954
1587324661
Python
Python (3.4.3)
py
Runtime Error
72
4412
522
INF = 10 ** 9 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from collections import deque def main(): s = list(input()) k = int(input()) for i in range(len(s)): if s[i] == 'a': continue if k >= ord('z') - ord(s[i]) + 1: k -= ord('z') - ord(s[i]) + 1 s[i] = 'a' if k == 0: break if k > 0: s[-1] = chr(ord(s[-1]) + k) print(''.join(s)) if __name__ == '__main__': main()
s817736906
p03994
u561231954
1587324455
Python
Python (3.4.3)
py
Runtime Error
70
4412
554
INF = 10 ** 9 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from collections import deque def main(): s = list(input()) k = int(input()) for i in range(len(s)): if s[i] == 'a': continue if k >= ord('z') - ord(s[i]) + 1: k -= ord('z') - ord(s[i]) + 1 s[i] = 'a' if k == 0: break else: i += 1 if k > 0: s[-1] = chr(ord(s[-1]) + k) print(''.join(s)) if __name__ == '__main__': main()
s934845062
p03994
u561231954
1587324163
Python
Python (3.4.3)
py
Runtime Error
65
4412
465
INF = 10 ** 9 import sys sys.setrecursionlimit(100000000) dy = (-1,0,1,0) dx = (0,1,0,-1) from collections import deque def main(): s = list(input()) k = int(input()) for i in range(len(s)): if k >= ord('z') - ord(s[i]) + 1: k -= ord('z') - ord(s[i]) + 1 s[i] = 'a' else: i += 1 if k > 0: s[-1] = chr(ord(s[-1]) + k) print(''.join(s)) if __name__ == '__main__': main()
s629430832
p03994
u585482323
1587218581
Python
PyPy3 (2.4.0)
py
Runtime Error
171
39024
1106
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) def LS():return [list(x) for x in sys.stdin.readline().split()] def S(): res = list(sys.stdin.readline()) if res[-1] == "\n": return res[:-1] return res def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def LSR(n): return [LS() for i in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def solve(): s = input() ans = "" k = I() for i,si in enumerate(s): if si == "a": ans += si continue j = (ord("a")-ord(si))%26 if j <= k: k -= j ans += "a" else: ans += si k %= 26 print(ans[:-1]+chr(ord(ans[-1])+k)) return #Solve if __name__ == "__main__": solve()
s863724968
p03994
u434872492
1587094045
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
136924
548
s=input() K=int(input()) znum=ord("z") count=0 ans=[] for i in range(len(s)): num=ord(s[i]) if s[i]=="a": ans.append("a") continue sa=znum-num+1 if (count+sa)<=K: ans.append("a") count+=sa else: ans.append(s[i]) if count<K: num=ord(s[-1]) num+=(K-count) itr=chr(num) S="" for i in range(len(ans)): if i==(len(ans)-1): S=S+itr continue S=S+ans[i] else: S="" for i in range(len(ans)): S=S+ans[i] print(S)
s906364600
p03994
u691018832
1586924833
Python
Python (3.4.3)
py
Runtime Error
132
3444
531
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) s = input() k = int(input()) al = [chr(ord('a') + i) for i in range(26)] ans = '' for i in range(len(s)): num = al.index(s[i]) if 26 - num <= k: k -= 26 - num if i != len(s) - 1: ans += 'a' else: ans += al[k] else: if i != len(s) - 1: ans += s[i] else: ans += al[num + k] print(ans)
s960215618
p03994
u798818115
1586827494
Python
Python (3.4.3)
py
Runtime Error
48
4272
336
# coding: utf-8 # Your code here! s=input() K=int(input()) ans=[] #122 for item in s[:len(s)-1]: cost=(123-ord(item)) if K>=cost: K-=cost ans.append("a") else: ans.append(item) last=ord(s[-1]) if last+K>122: ans.append(chr(last+K-26)) else: ans.append(chr(last+K)) print("".join(ans))
s123937700
p03994
u022979415
1585504965
Python
Python (3.4.3)
py
Runtime Error
39
4156
566
def main(): word = list(input()) operation = int(input()) cost = {} for i in range(26): cost[chr(ord("a") + i)] = ord("z") - ord("a") - i + 1 for i in range(len(word)): if cost[word[i]] <= operation: operation -= cost[word[i]] word[i] = "a" else: continue if 0 < operation: for i in range(-1, -len(word)-1, -1): word[i] = chr(ord(word[i]) + operation) operation = 0 break print("".join(word)) if __name__ == '__main__': main()
s384465469
p03994
u814781830
1584711479
Python
PyPy3 (2.4.0)
py
Runtime Error
183
49520
610
S = list(input()) L = len(S) K = int(input()) idx = 0 while K > 0: # aまでの必要な回数 if S[idx] == "a" and idx < L-1: idx += 1 continue k = 123 - ord(S[idx]) if k > K: if idx < L-1: # aまで操作できないのに、操作すると辞書順でより後ろの文字列になってしまうので、次の文字へ idx += 1 else: # 一番後ろの場合 t = chr(ord(S[idx])+(K%26)) S[idx] = t K = 0 else: K -= k S[idx] = "a" idx += 1 print("".join(S))
s605642088
p03994
u814781830
1584710092
Python
Python (3.4.3)
py
Runtime Error
61
4152
359
S = list(input()) L = len(S) K = int(input()) idx = 0 while K > 0: # aまでの必要な回数 k = 123 - ord(S[idx]) if k > K: if idx < L-1: idx += 1 else: t = chr(ord(S[idx])+(K%26)) S[idx] = t K = 0 else: K -= k S[idx] = "a" idx += 1 print("".join(S))
s089243734
p03994
u218757284
1584640141
Python
Python (3.4.3)
py
Runtime Error
78
3444
256
s = input() k = int(input()) slen = len(s) new_s = "" for i in range(slen): val = ord("z") + 1 - ord(s[i]) if k >= val: k -= val new_s += "a" else: new_s += s[i] if k > 0: new_s = new_s[:-1] + chr(ord(s[slen-1]) + k) print(new_s)
s359829386
p03994
u227082700
1584138252
Python
Python (3.4.3)
py
Runtime Error
83
4212
228
t="abcdefghijklmnopqrstuvwxyz" s=input() k=int(input()) a=[t.index(i)for i in s] ans="" for i in a: if i==0: ans+="a" continue j=i if k>=26-i: k-=26-i j=0 ans+=t[j] j+=k j%=26 ans=ans[:-1]+t[j] print(ans)
s672507836
p03994
u576917603
1584113428
Python
Python (3.4.3)
py
Runtime Error
96
4916
562
a=list(input()) k=int(input()) al = "abcdefghijklmnopqrstuvwxyz" alpha2num=lambda x:ord(x)-ord('a')+1 ans=[""]*len(a) for i in range(len(a)): num=alpha2num(a[i]) need=27-num if need==26: need=0 if need<=k and i!=len(a)-1: ans[i]="a" k-=need elif need<=k and i==len(a)-1: remain=k%26 if need<=remain: go=remain-need ans[-1]=chr(ord("a")+go) elif need>k and i!=len(a)-1: ans[i]=a[i] elif need>k and i==len(a)-1: ans[-1]=chr(ord(a[-1])+k) print(''.join(ans))
s644186717
p03994
u867848444
1584103256
Python
Python (3.4.3)
py
Runtime Error
84
4152
360
s=list(input()) k=int(input()) for i in range(len(s)): num_al=ord(s[i]) a_=123-num_al if k==0:break if s[i]=='a' and i!=len(s)-1:continue if a_<=k and i!=len(s)-1: k-=a_ s[i]='a' elif a_>k and i<len(s)-1:continue else: s[i]=chr(num_al+k) if num_al+k<=122 else chr(num_al+k-26) k=0 print(''.join(s))
s608811872
p03994
u867848444
1584103177
Python
Python (3.4.3)
py
Runtime Error
86
4152
361
s=list(input()) k=int(input()) for i in range(len(s)): num_al=ord(s[i]) a_=123-num_al if k==0:break if s[i]=='a' and i!=len(s)-1:continue if a_<=k and i!=len(s)-1: k-=a_ s[i]='a' elif a_>k and i<len(s)-1:continue else: s[i]=chr(num_al+k) if num_al+k<=122 else chr(num_al+k-122) k=0 print(''.join(s))
s899202115
p03994
u355371431
1584102858
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
135944
445
s = input() K = int(input()) ans = "" for i,value in enumerate(s): ask = ord(value) if K + ord(value) - ord("a") > 26: ans = ans + "a" K -= ord("z") - ord(value) + 1 else: ans = ans + value if K > 0: if ord(ans[-1]) + K > ord("z"): last = chr(ord(ans[-1]) + K -26) ans = ans[:-1] +last else: last = chr(ord(ans[-1]) + K ) ans = ans[:-1] +last print(ans)
s000680474
p03994
u355371431
1584102586
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
135944
464
s = input() K = int(input()) ans = "" for i,value in enumerate(s): ask = ord(value) if K + ord(value) - ord("a") > 26: ans = ans + "a" K -= ord("z") - ord(value) + 1 else: ans = ans + s[i:] break if K > 0: if ord(ans[-1]) + K > ord("z"): last = chr(ord(ans[-1]) + K -26) ans = ans[:-1] +last else: last = chr(ord(ans[-1]) + K ) ans = ans[:-1] +last print(ans)
s220015195
p03994
u556799364
1583966929
Python
PyPy3 (2.4.0)
py
Runtime Error
196
49648
295
# -*- coding: utf-8 -*- S = list(input()) K = int(input()) for i in range(len(S)-1): if S[i] == 'a': continue d = ord('z') - ord(S[i]) + 1 if K >= d: S[i] = 'a' K -= d # print(K, d) if K > 0: j = ord(S[-1]) + K S[-1] = chr(j) print(''.join(S))
s237519922
p03994
u556799364
1583965075
Python
PyPy3 (2.4.0)
py
Runtime Error
192
49520
255
# -*- coding: utf-8 -*- S = list(input()) K = int(input()) for i in range(len(S)): d = ord('z') - ord(S[i]) + 1 if K >= d: S[i] = 'a' K -= d # print(K, d) if K > 0: j = ord(S[-1]) + K S[-1] = chr(j) print(''.join(S))
s416672790
p03994
u738898077
1583904911
Python
Python (3.4.3)
py
Runtime Error
18
3316
199
n,k = map(int,input().split()) dls = list(map(str,input().split())) while 1: s = str(n) for i in dls: if i in s: break else: print(n) exit() n += 1
s108322666
p03994
u672475305
1583258165
Python
Python (3.4.3)
py
Runtime Error
100
4980
482
s = input() x = int(input()) tank = [] for c in list(s): if c=='a': tank.append(0) else: tank.append(ord('z') + 1 - ord(c)) res = '' for i in range(len(tank)): if tank[i] == 0: res += s[i] elif tank[i] <= x: x -= tank[i] tank[i] = 0 res += 'a' else: res += s[i] c = res[-1] if ord(c)+x <= ord('z'): res = res[:-1] + chr(ord(c)+x) else: res = res[:-1] + chr(ord(c)+x-ord('z')+ord('a')-1) print(res)
s542874572
p03994
u672475305
1583257768
Python
Python (3.4.3)
py
Runtime Error
106
4980
426
s = input() x = int(input()) tank = [] for c in list(s): if c=='a': tank.append(0) else: tank.append(ord('z') + 1 - ord(c)) res = '' for i in range(len(tank)): if tank[i] == 0: res += s[i] elif tank[i] <= x: x -= tank[i] tank[i] = 0 res += 'a' else: res += s[i] else: if x != 0: n = ord(s[-1])+x res = res[:-1] + chr(n) print(res)
s275471669
p03994
u905203728
1581970049
Python
Python (3.4.3)
py
Runtime Error
69
3444
419
s=input() k=int(input()) m=len(s) word={j:26-i for i,j in enumerate([chr(_) for _ in range(97,97+26)])} number={i:j for i,j in enumerate(chr(_) for _ in range(97,97+26))} ans="" for i,j in enumerate(s): if i==m-1 and k>0: k %=26 if k>word[j]:ans +=number[k-word[j]] else:ans +=number[26-word[j]+k] elif word[j]<=k: k -=word[j] ans +="a" else:ans +=j print(ans)
s488013355
p03994
u334712262
1580961926
Python
Python (3.4.3)
py
Runtime Error
18
2940
269
S = list(input()) for i in range(len(S)): n = ord(S[i]) if ord('z') - n + 1 >= K: K -= ord('z') - n + 1 S[i] = 'a' if K != 0: n = ord(S[-1]) n -= ord('a') n += K n %= ord('z') - ord('a') n += ord('a') S[-1] = chr(n) print(''.join(S))
s098727853
p03994
u457901067
1580931741
Python
Python (3.4.3)
py
Runtime Error
2133
502516
323
S = input() K = int(input()) A = [" " for _ in range(K)] zan = K for i in range(len(S)): n = (ord('z') - ord(S[i]) + 1) % 26 # aに変換するのに必要な回数 if zan >= n: zan -= n A[i] = 'a' else: A[i] = S[i] if zan > 0: A[i] = chr((ord(A[i]) - ord('a') + zan)%26 + ord('a')) print("".join(A))
s706021479
p03994
u117348081
1579910401
Python
Python (3.4.3)
py
Runtime Error
121
4212
322
s = str(input()) n = int(input()) k = ord("z") a = [0]*len(s) for i in range(len(s)): a[i] = ord(s[i]) for i in range(len(s)): if n>=k+1-a[i]: n = n - (k+1-a[i]) a[i] = ord("a") if n<=0: break if n>0: a[-1] += n ans = "" for i in range(len(s)): ans += chr(a[i]) print(ans)
s722495282
p03994
u399721252
1579495138
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38384
667
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { #ifdef DEBUG cout << "DEBUG MODE" << endl; ifstream in("input.txt"); //for debug cin.rdbuf(in.rdbuf()); //for debug #endif string s; cin >> s; int k, a; cin >> k; rep(i, s.length()-1){ a = 'z' - s[i]; if (k > a){ k -= a + 1; s[i] = 'a'; } } k %= 26; s[s.length()-1] += k; if (s[s.length()-1] > 'z') s[s.length()-1] -= 26; cout << s << endl; return 0; }
s716424255
p03994
u905582793
1579317804
Python
Python (3.4.3)
py
Runtime Error
17
3316
184
s=input() n=int(input()) ans="" for i in range(n-1): x=ord(a[i])-97 if n>=123-x: ans += "a" n -= 123-x else: ans += a[i] ans += chr((ord(a[i])-97+n)%26+97) print(ans)
s477475800
p03994
u779455925
1578973213
Python
PyPy3 (2.4.0)
py
Runtime Error
167
38256
259
s=list(input()) K=int(input()) for i in range(len(s)-1): if s[i]!="a" a= ord("z")+1 - ord(s[i]) if K>=a: s[i]="a" K-=a if K: s[-1]=chr((K+ord(s[-1])-ord("a"))%(ord("z") - ord("a")+1)+ord("a")) print("".join(s))
s038273890
p03994
u673361376
1577415993
Python
PyPy3 (2.4.0)
py
Runtime Error
2116
135828
322
import bisect alp = {s:i for i, s in enumerate('abcdefghijklmnopqrstuvwxyz')} N = len(alp) S = input() K = int(input()) ans = '' for s in S: i = alp[s] if K>=N-i: ans += 'a' K -= N-i else: ans += s if K == 0: print(ans) else: K = K%N last_s = alp[(S.find(ans[-1])+K)%N] print(ans[:-1] + last_s)
s980138069
p03994
u169138653
1577396367
Python
Python (3.4.3)
py
Runtime Error
73
4212
305
s=input() k=int(input()) sl=[] n=len(s) for i in range(n): if s[i]!='a': if 26-(ord(s[i])-97)<=k: sl.append('a') k-=26-(ord(s[i])-97) else: sl.append(s[i]) else: sl.append(s[i]) if k>0: for i in range(n): sl[n-i-1]=chr(ord(sl[n-1-i])+k) break print(''.join(sl))
s784167619
p03994
u349091349
1575514449
Python
Python (3.4.3)
py
Runtime Error
77
5220
547
from collections import deque s=input() money=int(input()) ans=deque() d = dict(zip([chr(i) for i in range(97, 97+26)], range(0,26))) d_r = dict(zip(range(0,26),[chr(i) for i in range(97, 97+26)])) s_hash = deque([d[i] for i in s]) while len(s_hash)>0: #print(money,s_hash,ans) n = s_hash.popleft() if money >= 26 - n: ans.append(0) money -= 26 - n else: ans.append(n) #print(money,s_hash,ans) if money>0: n = ans.pop() ans.append(n+money) money = 0 print("".join([d_r[i] for i in ans]))
s312526320
p03994
u349091349
1575514263
Python
Python (3.4.3)
py
Runtime Error
76
5220
516
from collections import deque s=input() money=int(input()) ans=deque() d = dict(zip([chr(i) for i in range(97, 97+26)], range(0,26))) d_r = dict(zip(range(0,26),[chr(i) for i in range(97, 97+26)])) s_hash = deque([d[i] for i in s]) while len(s_hash)>0: #print(money,s_hash,ans) n = s_hash.popleft() if money > 26 - n: ans.append(0) money -= 26 - n else: ans.append(n) if money>0: n = ans.pop() ans.append(n+money) money = 0 print("".join([d_r[i] for i in ans]))
s461115312
p03994
u349091349
1575514247
Python
PyPy3 (2.4.0)
py
Runtime Error
215
51380
516
from collections import deque s=input() money=int(input()) ans=deque() d = dict(zip([chr(i) for i in range(97, 97+26)], range(0,26))) d_r = dict(zip(range(0,26),[chr(i) for i in range(97, 97+26)])) s_hash = deque([d[i] for i in s]) while len(s_hash)>0: #print(money,s_hash,ans) n = s_hash.popleft() if money > 26 - n: ans.append(0) money -= 26 - n else: ans.append(n) if money>0: n = ans.pop() ans.append(n+money) money = 0 print("".join([d_r[i] for i in ans]))
s307401430
p03994
u937642029
1575045327
Python
PyPy3 (2.4.0)
py
Runtime Error
203
55188
1043
from collections import Counter,defaultdict,deque import sys from itertools import permutations, combinations from heapq import heappop, heappush # input = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 def inp(): # n=1 return int(input()) def inpm(): # x=1,y=2 return map(int,input().split()) def inpl(): # a=[1,2,3,4,5,...,n] return list(map(int, input().split())) def inpls(): # a=['1','2','3',...,'n'] return list(input().split()) def inplm(n): # x=[] 複数行 return list(int(input()) for _ in range(n)) def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] return sorted([list(map(int, input().split())) for _ in range(n)]) def main(): s=list(input()) k=inp() for i in range(len(s)): s[i]=ord(s[i]) for i in range(len(s)): if i==len(s)-1: s[i]+=k if s[i]>=123: s[i]-=26 elif 123-s[i]<=k: k-=123-s[i] s[i]=97 s[i]=chr(s[i]) print(''.join(s)) if __name__ == "__main__": main()
s540279102
p03994
u254871849
1574809588
Python
Python (3.4.3)
py
Runtime Error
56
4692
558
# 2019-11-26 17:11:55(JST) import sys from string import ascii_lowercase as alph ind_alph = dict((char, ind) for ind, char in enumerate(alph)) def main(): s, k = sys.stdin.read().split() s = list(s) k = int(k) n = len(s) i = 0 while k: j = ind_alph[s[i]] diff = (26 - j) % 26 if diff <= k: s[i] = 'a' k -= diff if i == n - 1 and k: s[i] = alph[(s[i] + k) % 26] k = 0 i += 1 print(''.join(s)) if __name__ == '__main__': main()
s846536395
p03994
u042802884
1574447892
Python
PyPy3 (2.4.0)
py
Runtime Error
184
47924
201
a=[ord(c)-ord('a') for c in input()] K=int(input()) for i in range(len(a)): if a[i]>0 and 26-a[i]<=K: K-=26-a[i] a[i]=0 a[-1]+=K l=[chr(ord('a')+ai) for ai in a] print(''.join(l))
s328377620
p03994
u042802884
1574447043
Python
PyPy3 (2.4.0)
py
Runtime Error
2117
135600
184
s=input() K=int(input()) for i,c in enumerate(s): if c!='a' and ord('z')+1-ord(c)<=K: K-=ord('z')+1-ord(c) s=s[:i]+'a'+s[i+1:] s=s[:-1]+chr(ord(s[-1])+K) print(s)
s098630523
p03994
u296150111
1574395351
Python
Python (3.4.3)
py
Runtime Error
2105
18452
349
s=input() k=int(input()) ss=[] for i in range(len(s)): ss.append(ord(s[i])-ord("a")) i=0 while k>0: if i==len(s)-1: ss[i]=(k+ss[i])%26 break elif k>=26-ss[i]: k-=(26-ss[i]) ss[i]=0 i+=1 ans="" for i in range(len(s)): ans+=chr(ord("a")+ss[i]) print(ans) if len(ans)==1: print(2/0) elif len(ans)<=3: for i in range(10**12): ans+="a"
s592794930
p03994
u042802884
1574310589
Python
PyPy3 (2.4.0)
py
Runtime Error
210
47924
244
s=input() a=[ord(c)-ord('a') for c in s] K=int(input()) # print(a) #DB for i in range(len(s)): if 26-a[i]>K or a[i]==0: continue else: K-=26-a[i] a[i]=0 a[-1]+=K print(''.join([chr(ord('a')+ai) for ai in a]))
s909828422
p03994
u042802884
1574310513
Python
PyPy3 (2.4.0)
py
Runtime Error
186
47924
233
s=input() a=[ord(c)-ord('a') for c in s] K=int(input()) # print(a) #DB for i in range(len(s)): if 26-a[i]>K: continue else: K-=26-a[i] a[i]=0 a[-1]+=K print(''.join([chr(ord('a')+ai) for ai in a]))
s463823374
p03994
u945181840
1574232864
Python
Python (3.4.3)
py
Runtime Error
89
4156
391
s = list(input()) K = int(input()) character = 'zabcdefghijklmnopqrstuvwxyza' limit = len(s) - 1 here = 0 while K: tmp = character.find(s[here]) if tmp + K > 26 and here != limit: K -= 26 - tmp + 1 s[here] = 'a' here += 1 elif here == limit: K %= 26 s[here] = character[tmp + K] break else: here += 1 print(''.join(s))
s666690481
p03994
u945181840
1574231761
Python
Python (3.4.3)
py
Runtime Error
79
4148
325
s = list(input()) K = int(input()) character = 'zabcdefghijklmnopqrstuvwxyz' limit = len(s) - 1 here = 0 while K: tmp = character.find(s[here]) if tmp + K > 26: K -= 26 - tmp + 1 s[here] = 'a' elif here == limit: s[here] = character[tmp + K] break here += 1 print(''.join(s))
s986308842
p03994
u193182854
1573954714
Python
Python (3.4.3)
py
Runtime Error
84
4796
234
s = [ord(x) - ord("a") for x in input()] k = int(input()) for i in range(len(s)): if s[i] == 0: continue r = 26 - s[i] if r <= k: k -= r s[i] = 0 s[-1] += k print("".join([chr(x + ord("a")) for x in s]))
s062533370
p03994
u638057737
1573233856
Python
Python (3.4.3)
py
Runtime Error
66
3444
321
s = input() K = int(input()) new = "" for i in range(len(s) - 1): diff = 26 - (ord(s[i]) - 97) if diff <= K: K -= diff new += "a" else: new += s[i] if K > 0: new_char = ord(s[-1]) + K if new_char > 122: new_char = 96 + (new_char - 122) new += chr(new_char) else: new += s[-1] print(new)
s261763068
p03994
u638057737
1573233493
Python
Python (3.4.3)
py
Runtime Error
71
3444
314
s = input() K = int(input()) new = "" for i in range(len(s) - 1): diff = 123 - ord(s[i]) if diff < K: K -= diff new += "a" else: new += s[i] if K > 0: new_char = ord(s[-1]) + K if new_char > 122: new_char = 96 + (new_char - 122) new += chr(new_char) else: new += s[-1] print(new)
s448116505
p03994
u691896522
1572828972
Python
Python (3.4.3)
py
Runtime Error
71
4152
266
s = list(input()) k = int(input()) z_asc = ord('z') for i in range(len(s)): tmp = ord(s[i]) if 1 + z_asc - tmp <= k and s[i] != 'a': k -= 1 + z_asc - tmp s[i] = 'a' if k % 26 != 0: s[-1] = chr(ord(s[-1]) + k) ans = "".join(s) print(ans)
s443303415
p03994
u691896522
1572828701
Python
Python (3.4.3)
py
Runtime Error
77
4156
256
s = list(input()) k = int(input()) z_asc = ord('z') for i in range(len(s)): tmp = ord(s[i]) if 1 + z_asc - tmp <= k and s[i] != 'a': k -= 1 + z_asc - tmp s[i] = 'a' if k % 26 != 0: s[-1] = chr(ord(s[-1]) + k) print("".join(s))
s081971697
p03994
u366959492
1572563993
Python
Python (3.4.3)
py
Runtime Error
89
4152
192
s=list(input()) k=int(input()) for i in range(len(s)): if k>=ord("z")-ord(s[i])+1: k-=(ord("z")-ord(s[i])+1) s[i]="a" if k: s[-1]=chr(ord(s[-1])+k) print("".join(s))
s843510292
p03994
u518042385
1572405311
Python
Python (3.4.3)
py
Runtime Error
86
4212
428
w=input() nw=len(w) lw=list(w) n=int(input()) alpha="qwertyuiopasdfghjklzxcvbnm" l=sorted(list(alpha)) d={} for i in range(26): d[l[i]]=i+1 num=n count=0 while num>0 and count<nw: if lw[count]=="a": count+=1 else: letter=lw[count] if 27-d[letter]<num: num-=27-d[letter] lw[count]="a" count+=1 else: count+=1 if num>0: a=lw[-1] num1=d[a] lw[-1]=l[num1+num-1] print("".join(lw))
s342284024
p03994
u677523557
1571522326
Python
Python (3.4.3)
py
Runtime Error
107
3444
316
S = input() K = int(input()) alp = [chr(i) for i in range(97, 97+26)] ans = '' for s in S: loc = alp.index(s) if s == 'a': continue if loc + K >= 26: K -= 26 - loc ans += 'a' else: ans += s if K > 0: K %= 26 ans = ans[:-1] + alp[(alp.index(ans[-1])+K)%26] print(ans)
s406979394
p03994
u391630195
1569903648
Python
PyPy3 (2.4.0)
py
Runtime Error
173
38384
495
s=str(input()) k=int(input()) lista=[] for i in range(26): lista.append(chr(ord('a') + i)) #print(lista) s_list=list(s) len_s=len(list(s)) temp1=k temp2=0 for i in range(len_s): if (123-ord(s_list[i])<=temp1): temp1=temp1-(123-ord(s_list[i])) s_list[i]="a" if temp1!=0: # print(temp1) temp2=temp1%26+ord(s_list[-1]) if temp2>122: temp2=temp2-122+96 s_list[-1]=chr(temp2) #print(temp2) #print(str(s_list)) for i in range(len(s_list)): print(s_list[i],end="") print(\n)
s284850289
p03994
u291766461
1569718450
Python
Python (3.4.3)
py
Runtime Error
59
3444
255
s = input() K = int(input()) base_count = ord("z") + 1 ans = "" for c in s: if (base_count - ord(c)) <= K: ans += "a" K -= (base_count - ord(c)) else: ans += c if K > 0: ans = ans[:-1] + chr(ord(ans[-1]) + K) print(ans)
s651884707
p03994
u223904637
1569714961
Python
Python (3.4.3)
py
Runtime Error
112
4084
275
s=list(input()) k=int(input()) al=list('bcdefghijklmnopqrstuvwxyza') ans='' for i in range(len(s)): d=25-al.index(s[i]) if d<=k or s[i]=='a': ans+='a' k-=d else: ans+=s[i] k=k%26 f=al.index(ans[-1]) ans[-1]=al[min(f+k,f+k-26)] print(ans)
s326385815
p03994
u948524308
1569355357
Python
Python (3.4.3)
py
Runtime Error
70
4152
333
s=list(input()) K=int(input()) abc="bcdefghijklmnopqrstuvwxyza" cnt=K for i in range(len(s)): temp=25-abc.index(s[i]) if cnt>=temp: s[i]="a" cnt-=temp if cnt!=0: if abc.index(s[-1])+cnt>25: s[-1]=abc[abc.index(s[-1])+cnt-26] else: s[-1]=abc[abc.index(s[-1])+cnt] print("".join(s))
s322222597
p03994
u919633157
1568725810
Python
Python (3.4.3)
py
Runtime Error
58
4152
229
# 2019/09/17 s=list(input()) n=len(s) k=int(input()) for i in range(n): cnt=123-ord(s[i]) if cnt>k:continue s[i]='a' k-=cnt if k==0:break else: if k: s[-1]=chr(ord(s[i])+k) print(''.join(s))
s158186431
p03994
u133886644
1568673211
Python
Python (3.4.3)
py
Runtime Error
82
5084
364
import sys from collections import defaultdict sys.setrecursionlimit(200000) input = sys.stdin.readline # N, = map(int, input().split()) S = [ord("z") - ord(v) + 1 for v in input().strip()] N, = map(int, input().split()) for i in range(len(S)): if S[i] <= N: N -= S[i] S[i] = 26 S[-1] -= N print("".join([chr(ord("z") - v + 1) for v in S]))
s888565273
p03994
u223646582
1568349976
Python
PyPy3 (2.4.0)
py
Runtime Error
189
46064
340
s = input() K = int(input()) ans = [] for i in range(len(s)): if K >= ord('z')-ord(s[i])+1: K -= ord('z')-ord(s[i])+1 ans.append('a') else: ans.append(s[i]) if K >= 1: if len(ans) >= 1: ans[-1] = chr(ord(ans[-1])+K) else: print(chr(ord(s[0])+K)) exit() print(''.join(ans))
s000966879
p03994
u223646582
1568349916
Python
PyPy3 (2.4.0)
py
Runtime Error
208
46064
327
s = input() K = int(input()) ans = [] for i in range(len(s)): if K >= ord('z')-ord(s[i])+1: K -= ord('z')-ord(s[i])+1 ans.append('a') else: ans.append(s[i]) if K >= 1: if len(ans) >= 1: ans[-1] = chr(ord(ans[-1])+K) else: ans[0] = chr(ord(s[0])+K) print(''.join(ans))
s387142308
p03994
u223646582
1568349800
Python
PyPy3 (2.4.0)
py
Runtime Error
189
46064
311
s = input() K = int(input()) ans = [] for i in range(len(s)): if K >= ord('z')-ord(s[i])+1: K -= ord('z')-ord(s[i])+1 ans.append('a') else: ans.append(s[i]) if K >= 1 and len(ans) >= 1: ans[-1] = chr(ord(ans[-1])+K) else: ans[0] = chr(ord(s[0])+K) print(''.join(ans))
s873617097
p03994
u223646582
1568348780
Python
PyPy3 (2.4.0)
py
Runtime Error
178
46192
257
s = input() K = int(input()) ans = [] for i in range(len(s)): if K >= ord('z')-ord(s[i])+1: K -= ord('z')-ord(s[i])+1 ans.append('a') else: ans.append(s[i]) if K >= 1: ans[-1] = chr(ord(ans[-1])+K) print(''.join(ans))
s950656344
p03994
u223646582
1568348585
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
135944
249
s = input() K = int(input()) ans = '' for i in range(len(s)): if K >= ord('z')-ord(s[i])+1: K -= ord('z')-ord(s[i])+1 ans += 'a' else: ans += s[i] if K >= 1: ans = ans[:len(s)-1]+chr(ord(ans[-1])+K) print(ans)
s584189735
p03994
u223646582
1568348528
Python
PyPy3 (2.4.0)
py
Runtime Error
2112
136072
243
s = input() K = int(input()) ans = '' for i in range(len(s)): if K >= ord('z')-ord(s[i])+1: K -= ord('z')-ord(s[i])+1 ans += 'a' else: ans += s[i] if K >= 1: ans = ans[:-1]+chr(ord(ans[-1])+K) print(ans)