Language: C++

import bisect
import sys
import math
import itertools
sys.setrecursionlimit(10000)

INF = float('inf')

# input macro
def i():
    return int(raw_input())
def ii():
    return map(int,raw_input().split(" "))
def s():
    return raw_input()
def ss():
    return raw_input().split(" ")
def slist():
    return list(raw_input())
#

def join(s):
    return ''.join(s)

#iterate macro
def piter(n,m):
    return itertools.permutations(n,m)
def citer(n,m):
    return itertools.combinations(n,m)

#modulo macro
def modc(a,b,m):
    c = 1
    for i in xrange(b):
        c = c * (a - i) % m
        c = c * modinv(i + 1,m) % m
    return c
 
def gcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
 
def modinv(a, m):
    (inv, q, gcd_val) = gcd(a, m)
    return inv % m

#bisect macro
def index(a, x):
    #Locate the leftmost value exactly equal to x
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

#memoize macro
def memoize(f):
    cache = {}
    def helper(*args):
        if args not in cache:
            cache[(args)] = f(*args)
        return cache[args]
    return helper

@memoize
def nck(a,b,m):
    b = min([a-b,b])
    if (b>a or b<0 or a<0):
        return 0
    elif a == 0:
        return 1
    return (nck(a-1,b-1,m)+nck(a-1,b,m)) % m

nh=zip([1,0,-1,0],[0,1,0,-1])

###########

st=slist()
k=i()

for j in range(len(st)):
    o=ord(st[j])
    if k >= 123-o and st[j]!='a':
        k -= (123-o)
        st[j]='a'
        
n=97+(ord(st[len(st)-1])-97+k)%26

st[len(st)-1] = chr(n)
print join(st)


Compiler output:
a.cc:7:13: warning: multi-character character constant [-Wmultichar]
    7 | INF = float('inf')
      |             ^~~~~
a.cc:9:3: error: invalid preprocessing directive #input
    9 | # input macro
      |   ^~~~~
a.cc:23:12: error: empty character constant
   23 |     return ''.join(s)
      |            ^~
a.cc:25:2: error: invalid preprocessing directive #iterate
   25 | #iterate macro
      |  ^~~~~~~
a.cc:31:2: error: invalid preprocessing directive #modulo
   31 | #modulo macro
      |  ^~~~~~
a.cc:53:2: error: invalid preprocessing directive #bisect
   53 | #bisect macro
      |  ^~~~~~
a.cc:55:6: error: invalid preprocessing directive #Locate
   55 |     #Locate the leftmost value exactly equal to x
      |      ^~~~~~
a.cc:61:2: error: invalid preprocessing directive #memoize
   61 | #memoize macro
      |  ^~~~~~~
a.cc:70:1: error: stray '@' in program
   70 | @memoize
      | ^
a.cc:81:1: error: stray '##' in program
   81 | ###########
      | ^~
a.cc:81:3: error: stray '##' in program
   81 | ###########
      |   ^~
a.cc:81:5: error: stray '##' in program
   81 | ###########
      |     ^~
a.cc:81:7: error: stray '##' in program
   81 | ###########
      |       ^~
a.cc:81:9: error: stray '##' in program
   81 | ###########
      |         ^~
a.cc:81:11: error: stray '#' in program
   81 | ###########
      |           ^
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:64:5: error: 'def' does not name a type
   64 |     def helper(*args):
      |     ^~~