qyliang/CodeNanoFix huggingface dataset:
Buggy code:
#!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()


Fixed code:
#!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.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.append(si)
            continue
        j = (ord("a")-ord(si))%26
        if j <= k:
            k -= j
            ans.append("a")
        else:
            ans.append(si)
    k %= 26
    ans[-1] = chr(ord(ans[-1])+k)
    print(*ans,sep="")
    return

#Solve
if __name__ == "__main__":
    solve()
Buggy code:
# 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 item=="a":
        continue
    if K>=cost:
        K-=cost
        ans.append("a")
    else:
        ans.append(item)

K%=26
last=ord(s[-1])
if last+K>122:
    ans.append(chr(last+K-26))
else:
    ans.append(chr(last+K))

print("".join(ans))
    

Fixed code:
# 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 item=="a":
        ans.append(item)
        continue
    if K>=cost:
        K-=cost
        ans.append("a")
    else:
        ans.append(item)

K%=26
last=ord(s[-1])
if last+K>122:
    ans.append(chr(last+K-26))
else:
    ans.append(chr(last+K))

print("".join(ans))
Buggy code:
s=input()
l=len(s)
k=int(input())
z=''
for i in range(l):
  t=123-ord(s[i])
  if t<=k:
    z+='a'
    k-=t
  else:
    z+=s[i]
k=k%26
z=z[:l-1]+chr((ord(z[l-1])+k)%26)
print(z)

Fixed code:
s=input()
l=len(s)
k=int(input())
z=''
for i in range(l):
  t=123-ord(s[i])
  if s[i]=='a':
    z+='a'
  elif t<=k:
    z+='a'
    k-=t
  else:
    z+=s[i]
v=ord(z[l-1])-97+k
z=z[:l-1]+chr(v%26+97)
print(z)
Buggy code:
s=list(input())
k=int(input())

for i in range(len(s)):
    if k==0:break

    num=ord(s[i])
    ch_num=123-num
    if i==len(s)-1:
        s[i]=chr(96+(num+k)%122) if num+k>=122 else chr(num+k)
        k=0
        break
    elif s[i]=='a':continue
    elif ch_num<=k:
        s[i]='a'
        k-=ch_num
print(''.join(s))

Fixed code:
s=list(input())
k=int(input())

for i in range(len(s)):
    if k==0:break

    num=ord(s[i])
    ch_num=123-num
    if i==len(s)-1:
        s[i]=chr(97+(num+k-97)%26) #if num+k>122 else chr(num+k)
        #print(97+(num+k-97)%26)
        k=0
        break
    elif s[i]=='a':continue
    elif ch_num<=k:
        s[i]='a'
        k-=ch_num
print(''.join(s))
Buggy code:
# -*- 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))

Fixed code:
# -*- coding: utf-8 -*-
S = list(input())
K = int(input())

for i in range(len(S)):
    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 % 26
    S[-1] = chr(j)

print(''.join(S))
Buggy code:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    s = input().strip()
    ans = list(s[:])
    k = int(input().strip())
    for i in range(len(s)):
        d = ord('z') - ord(s[i]) + 1
        if k - d >= 0:
            ans[i] = 'a'
            k -= d
        if i == len(s) - 1:
            # print((ord(ans[i]) + k%26) % 26)
            ans[i] = chr(ord('a') + (ord(ans[i]) + k%26) % 26)
    print(''.join(ans))

if __name__ == '__main__':
    main()


Fixed code:
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    s = input().strip()
    ans = list(s[:])
    k = int(input().strip())
    for i in range(len(s)):
        d = (ord('z') - ord(s[i]) + 1) % 26
        if k - d >= 0:
            ans[i] = 'a'
            k -= d
        if i == len(s) - 1:
            # print((ord(ans[i]) + k%26) % 26)
            ans[i] = chr(ord('a') + (ord(ans[i]) - ord('a') + k%26) % 26)
    print(''.join(ans))

if __name__ == '__main__':
    main()
Buggy code:
s = input()
ints = [ord(i) - ord('a') for i in s]
K = int(input())
n = len(s)
i = 0
while i < n:
    if ints[i] != 0 and 25 - ints[i] + 1 <= K:
        K -= 25 - ints[i] + 1
        ints[i] = 0
    i += 1

K %= 26
ints[-1] = (ints[-1] + K) % 26
s_ = ''
for i in ints:
    s_ += chr(i + ord('a'))

print(s_, K)


Fixed code:
s = input()
ints = [ord(i) - ord('a') for i in s]
K = int(input())
n = len(s)
i = 0
while i < n:
    if ints[i] != 0 and 25 - ints[i] + 1 <= K:
        K -= 25 - ints[i] + 1
        ints[i] = 0
    i += 1

K %= 26
ints[-1] = (ints[-1] + K) % 26
s_ = ''
for i in ints:
    s_ += chr(i + ord('a'))

print(s_)
Buggy code:
s=input()
n=len(s)
a=[ord(i)-ord('a') for i in s]
k=int(input())
for i in range(n):
    if a[i]+k>=26 and a[i]>0:
        k-=26-a[i]
        a[i]=0
k%=26
print(a)
a[-1]+=k
a=[chr(i + ord('a')) for i in a]
print(*a,sep="")

Fixed code:
s=input()
n=len(s)
a=[ord(i)-ord('a') for i in s]
k=int(input())
for i in range(n):
    if a[i]+k>=26 and a[i]>0:
        k-=26-a[i]
        a[i]=0
k%=26
a[-1]+=k
a=[chr(i + ord('a')) for i in a]
print(*a,sep="")
Buggy code:
print(ord("z") - ord("a"))
s=list(input())
K=int(input())
for i in range(len(s)-1):
    a= ord("z")+1 - ord(s[i])
    if K>=a:
        s[i]="a"
        K-=a
print(K)
if K:
    s[-1]=chr((K+ord(s[-1])-ord("a"))%(ord("z") - ord("a")+1)+ord("a"))
print("".join(s))


Fixed code:
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))
Buggy code:
s = input()
K = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'

ans = ''
for i,w in enumerate(s):
    if (26-(ord(w)-ord('a')))%26 <= K:
        ans += 'a'
        K -= (26-(ord(w)-ord('a')))%26
    elif i != len(s)-1:
        ans += w
    elif i == len(s)-1:
        #ans = ans[:-1]
        lastlidx = (ord(w)-ord('a') + K%26)%26
        ans += alp[lastlidx]
print(ans)



Fixed code:
s = input()
K = int(input())
alp = 'abcdefghijklmnopqrstuvwxyz'

ans = ''
for i,w in enumerate(s):
    if i != len(s)-1 and (26-(ord(w)-ord('a')))%26 <= K:
        ans += 'a'
        K -= (26-(ord(w)-ord('a')))%26
    elif i != len(s)-1:
        ans += w
    if i == len(s)-1:
        #ans = ans[:-1]
        lastlidx = (ord(w)-ord('a') + K%26)%26
        ans += alp[lastlidx]
print(ans)
Buggy code:
s = input()
K = int(input())

a = [0] * len(s)
for i in range(len(s)):
  a[i] =  ((ord('z') - ord(s[i])) + 1)%26
  if a[i] == 0:
    pass
  elif K - a[i] >= 0:
    K -= a[i]
    a[i] = 0
for i in range(len(s)-1):
  print(chr((26-a[i])%26+ord('a')), end = '')

b = ord('a') + (ord(s[-1])-ord('a') + K)%26
print( chr( b ) ) 
  


Fixed code:
s = input()
K = int(input())

a = [0] * len(s)
for i in range(len(s) - 1):
  a[i] =  ((ord('z') - ord(s[i])) + 1)%26
  if a[i] == 0:
    pass
  elif K - a[i] >= 0:
    K -= a[i]
    a[i] = 0

for i in range(len(s)-1):
  print(chr((26-a[i])%26+ord('a')), end = '')

if K != 0:
  b = ord('a') + (ord(s[-1])-ord('a') + K)%26
  print( chr( b ) ) 
else:
  print(s[-1])
Buggy code:
    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))

Fixed code:
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:
    k%=26
    s[-1]=chr(ord(s[-1])+k)

print("".join(s))
Buggy code:
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)

		
	
	
	


Fixed code:
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)and (s_list[i] != 'a'):
		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()
Buggy code:
s = input()
k =int(input())
sn = []
sa = []
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1

for c in s:
    sn.append(alpha2num(c))

for i in range(0,len(sn)-1):
    if 59 - sn[i] <= k:
        k -= 59 - sn[i]
        sn[i] = 33
    else:
        continue

sn[-1] = (sn[-1] + k-32) % 26 + 32

for c in sn:
    sa.append(num2alpha(c))

print("".join(sa))


Fixed code:
s = input()
k =int(input())
sn = []
sa = []
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1

for c in s:
    sn.append(alpha2num(c))

for i in range(0,len(sn)-1):
    if sn[i] != 33 and 59 - sn[i] <= k:
        k -= 59 - sn[i]
        sn[i] = 33
    else:
        continue

sn[-1] = (sn[-1] + k-33) % 26 + 33

for c in sn:
    sa.append(num2alpha(c))

print("".join(sa))
Buggy code:
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 % 26)

print(''.join(ans))


Fixed code:
s = input()
K = int(input())

ans = []
for i in range(len(s)):
    if K >= ord('z')-ord(s[i])+1 and s[i] != 'a':
        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 % 26)

print(''.join(ans))
Buggy code:
s = [ord(i) - 97 for i in input()]
k = int(input())
print(s)
for i in range(len(s)):
    diff = 26 - s[i]
    if (s[i] != 0) and (diff <= k):
        k -= diff
        s[i] = 0

s[-1] = (s[-1] + k) % 26

ans = "".join(chr(i+97) for i in s)
print(ans)

Fixed code:
s = [ord(i) - 97 for i in input()]
k = int(input())

for i in range(len(s)):
    diff = 26 - s[i]
    if (s[i] != 0) and (diff <= k):
        k -= diff
        s[i] = 0

s[-1] = (s[-1] + k) % 26

ans = "".join(chr(i+97) for i in s)
print(ans)
Buggy code:
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)

Fixed code:
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: ans = ans[:-1] + chr(ord('a') + (ord(ans[-1]) - ord('a') + K) % 26)
print(ans)
Buggy code:
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="")

Fixed code:
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(96+((ord(s[-1])+K-122)))

print(*s,sep="")
Buggy code:
s,k=open(0)
k=int(k)
*l,=map(ord,s)
for i,t in enumerate(l):
  j=(19-t)%26
  if j<=k:k-=j;l[i]=97
l[-1]+=k%26
print(*map(chr,l),sep='')

Fixed code:
s,k=open(0)
k=int(k)
*l,=map(ord,s[:-1])
for i,t in enumerate(l):
  j=(19-t)%26
  if j<=k:k-=j;l[i]=97
l[-1]+=k%26
print(*map(chr,l),sep='')
Buggy code:
s = input().strip()
k = int(input())

ans = ''
for _s in s[:-1]:
  if _s == 'a':
    continue
  if 26 - ord(_s) + ord('a') <= k:
    ans += 'a'
    k -= 26 - ord(_s) + ord('a')
  else:
    ans += _s

ans += chr(ord('a') + (ord(s[-1]) - ord('a') + k) % 26)

print(ans)


Fixed code:
s = input().strip()
k = int(input())

ans = ''
for _s in s[:-1]:
  if _s == 'a':
    ans += 'a'
  elif 26 - ord(_s) + ord('a') <= k:
    ans += 'a'
    k -= 26 - ord(_s) + ord('a')
  else:
    ans += _s

ans += chr(ord('a') + (ord(s[-1]) - ord('a') + k) % 26)

print(ans)
Buggy code:
s = input()
k = int(input())
ans = []
for i in range(len(s)):
  toa =(ord('z')-ord(s[i]))+1
  if toa <= k:
    k -= toa 
    ans += 'a'
  else: ans += s[i]

if k == 0:print(ans)
else: 
  rest = k%26
  tmp = ord(ans[-1])+rest
  if tmp >122:
    tmp -= 26
  ans[-1] = chr(tmp)
  print("".join(ans))

Fixed code:
s = input()
k = int(input())
ans = []
for i in range(len(s)):
  toa =(ord('z')-ord(s[i]))+1
  if s[i] =='a':ans += s[i]
  else:
   if toa <= k:
     k -= toa 
     ans += 'a'
   else: ans += s[i]

if k == 0:print("".join(ans))
else: 
  rest = k%26
  tmp = ord(ans[-1])+rest
  if tmp >122:
    tmp -= 26
  ans[-1] = chr(tmp)
  print("".join(ans))
Buggy code:
s=input()
K=int(input())
S=list(ord(s[i]) for i in range(len(s)))

for i in range(len(s)):
    if i!=len(s):
        if S[i]!=97 and 123-S[i]<=K:
            K-=123-S[i]
            S[i]=97
    if i==len(s):
        m=K%26
        S[i]+=m
        if S[i]>=123:
            S[i]=S[i]-123+97
T=""
for i in range(len(s)):
    T+=chr(S[i])
print(T)

Fixed code:
s=input()
K=int(input())
S=list(ord(s[i]) for i in range(len(s)))

for i in range(len(s)):
    if i!=len(s)-1:
        if S[i]!=97 and 123-S[i]<=K:
            K-=123-S[i]
            S[i]=97
    if i==len(s)-1:
        S[i]+=K%26
        if S[i]>=123:
            S[i]=S[i]-123+97
T=""
for i in range(len(s)):
    T+=chr(S[i])
print(T)
Buggy code:
def main():
    s = input()
    n = int(input())
    
    t = []
    a = []
    for i in s:
        ord_i = ord(i)
        t.append(((123 - ord_i)%26, ord_i))
    print(t)
    
    for i in t:
        if n >= i[0]:
            a.append('a')
            n -= i[0]
        else:
            a.append(chr(i[1]))
            
    a[-1] = chr(ord(a[-1]) + n%26)
    print(''.join(a))
    
if __name__ == '__main__':
    main()

Fixed code:
def main():
    s = input()
    n = int(input())
    
    t = []
    a = []
    for i in s:
        ord_i = ord(i)
        t.append(((123 - ord_i)%26, ord_i))
    
    for i in t:
        if n >= i[0]:
            a.append('a')
            n -= i[0]
        else:
            a.append(chr(i[1]))
            
    a[-1] = chr(ord(a[-1]) + n%26)
    print(''.join(a))
    
if __name__ == '__main__':
    main()
Buggy code:
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))


Fixed code:
S = input()
k = int(input())
goal = ord('z') + 1
ans = []
for c in S:
    if c == 'a':
        ans.append('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))
Buggy code:
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('a')+(ord(s[-1])+k)%26)

print(''.join(s))

Fixed code:
s=list(input())
k=int(input())
for i in range(len(s)):
    c = (ord('z') - ord(s[i]) + 1)%26
    if c <= k:
        k -= c
        s[i] = 'a'
s[-1] = chr(ord('a') + ((ord(s[-1]) - ord('a') + k) % 26))
print(''.join(s))
Buggy code:
import string
import sys
s = input()
k = int(input())
a = [ord(_) for _ in s]
for i in range(len(s)-1):
   df = ord('z') - a[i] + 1
   if k >= df:
       a[i] = 97
       k -= df
   if k == 0:
        break
if k != 0:
    k = k % 26
    a[len(a)-1] = 97+k
[print(chr(_), end="") for _ in a]



Fixed code:
import string
import sys
s = input()
k = int(input())
a = [ord(_) for _ in s]
for i in range(len(s)-1):
    if a[i] != ord('a'):
        df = ord('z') - a[i] + 1
        if k >= df:
            a[i] = ord('a')
            k -= df
    if k == 0: break
if k != 0:
    k = k % 26
    a[len(a)-1] += k - 26 if ord('z') < k + a[len(a)-1] else k
[print(chr(_), end="") for _ in a]
print("")
Buggy code:
#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)

Fixed code:
#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 and str[i] != "a"):
		result += "a"
		tempK -= changeNum
	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)
Buggy code:
import sys 

s = sys.stdin.readline().strip()
K = int(sys.stdin.readline())
c = []
for i in s:
        c.append(ord(i)-ord('a'))
                                                                                                                                                                                                                                      
i =0
while i< len(c):
        path2a = (26-c[i] ) % 26
        if path2a < K:
                K -= path2a
                c[i] = 0 
        i+=1
c[-1] = (c[-1]+ K) %26 

res = ""
for i in c:
        res += chr(i+ord('a'))

print res 

Fixed code:
import sys 

s = sys.stdin.readline().strip()
K = int(sys.stdin.readline())
c = []
for i in s:
        c.append(ord(i)-ord('a'))

i =0
while i< len(c):
        path2a = (26-c[i] ) % 26
        if path2a <= K:                                                                                                                                                                                                               
                K -= path2a
                c[i] = 0 
        i+=1
c[-1] = (c[-1]+ K) %26 

res = ""
for i in c:
        res += chr(i+ord('a'))

sys.stdout.write( res)
Buggy code:
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()


s = input()
K = int(input())
l = len(s)
ans = ['a']*l

ORDa = 97

for i in range(l):
	now = ord(s[i]) - ORDa
	tmp = 26 - now
	
	if K == 0:
		ans[i] = s[i]
	elif tmp <= K:
		ans[i] = 'a'
		K -= tmp
	else:
		ans[i] = s[i]

if K > 0:
	tmp = ord(ans[-1]) + K	
	ans[-1] = chr(tmp % 26)
		
print("".join(ans))
# last shori


Fixed code:
# def makelist(n, m):
# 	return [[0 for i in range(m)] for j in range(n)]

# n = int(input())
# a, b = map(int, input().split())
# s = input()


s = input()
K = int(input())
l = len(s)
ans = ['a']*l

ORDa = 97

for i in range(l):
	now = ord(s[i]) - ORDa
	tmp = 26 - now
	
	if K == 0:
		ans[i] = s[i]
	elif tmp == 26:
		ans[i] = s[i]
	elif tmp <= K:
		ans[i] = 'a'
		K -= tmp
	else:
		ans[i] = s[i]

if K > 0:
	K = K % 26
	tmp = ord(ans[-1])
	if tmp + K > ord('z'):
		aa = tmp + K - (ord('z') + 1)
		ans[-1] = chr(aa + ORDa)
	else:
		ans[-1] = chr(tmp + K)
		
print("".join(ans))
# last shori
Buggy code:
s = input()
K = int(input())

def cord(c):
    return ord(c)-97

def cchr(n):
    return chr(n+97)

def smcheck(c, k):
    return 26-cord(c) <= k

def smcnt(c, k):
    return 26-cord(c)

ans = ''
for c in s:
    sc = smcnt(c, K)
    if sc <= K and sc < 26:
        K -= sc
        ans += cchr((cord(c) + sc)%26)
        print(K,ans)
    else:
        ans += c
if K>26:
    K = K%26
if K>0:
    lc = ans[-1]
    ans = ans[:-1]
    ans += cchr((cord(lc)+K)%26)

print(ans)


Fixed code:
s = input()
K = int(input())

def cord(c):
    return ord(c)-97

def cchr(n):
    return chr(n+97)

def smcheck(c, k):
    return 26-cord(c) <= k

def smcnt(c, k):
    return 26-cord(c)

ans = ''
for c in s:
    sc = smcnt(c, K)
    if sc <= K and sc < 26:
        K -= sc
        ans += cchr((cord(c) + sc)%26)
        # print(K,ans)
    else:
        ans += c
if K>26:
    K = K%26
if K>0:
    lc = ans[-1]
    ans = ans[:-1]
    ans += cchr((cord(lc)+K)%26)

print(ans)
Buggy code:
a = int( input() )
b = int( input() )
h = int( input() )

print( ( a + b ) * h / 2 )


Fixed code:
a=input()
b=input()
h=input()
a=int(a)
b=int(b)
h=int(h)
x=(a+b)*h
print(x//2)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
print(a*b*c/2)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
print(c*(a+b)//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
s = (a+b)*h/2
print(s)


Fixed code:
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h //2)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
d = 0
d = (a + b) * c / 2
print(d)

Fixed code:
a = int(input())
b = int(input())
c = int(input())
d = 0
e = 0
d = a + b
e = d * c // 2
print(e)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h / 2) 

Fixed code:
a = int(input())
b = int(input())
h = int(input())

res = (a + b) * h // 2

print(res)
Buggy code:
#!/usr/bin/env python3

print((int(input())+int(input()))*int(input())/2)

Fixed code:
#!/usr/bin/env python3

print((int(input())+int(input()))*int(input())//2)