peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s = [input() for i in range(2)]

s_length = len(s[0])
s2_length = len(s[1])

if s2_length==s_length+1 and s[0]==s[1][:s_length]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
A = [int(x) for x in input().split()]

#print(N)
#print(A)

syozi = 1000
kabu = 0

for i in range(N-1):
  if A[i] < A[i+1]:
    kabu = int( syozi / A[i] )
    syozi = int( syozi % A[i] )
  elif A[i] > A[i+1]:
    syozi += A[i] * kabu
    kabu = 0
  else:
    pass

if kabu > 0:
  syozi += A[N-1] * kabu
  kabu = 0

print(syozi)
# Judge status: Wrong Answer
import collections
 
s = input()
lst = []
for i in s:
    lst.append(i)
c = collections.Counter(lst)
if sum(c.values()) % 2 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a,b = map(float, input().split())
b *= 1000
c = a*b
print(c//1000)
# Judge status: Accepted
a,b=input().split()
print('Yes' if int(int((int(a+b))**0.5)**2)==int(a+b) else 'No')
# Judge status: Accepted
import numpy as np
n=int(input())

dp=[float("inf")]*(n+1)
dp[0]=0

for i in range(1,n+1):
  dp[i]=min(dp[i],dp[i-1]+1)
  for j in range(1,n+1):
    if i-6**j<0: break
    dp[i]=min(dp[i],dp[i-6**j]+1)
    if i-9**j<0: continue
    dp[i]=min(dp[i],dp[i-9**j]+1)
  #print("debug:",i,",",dp[i])

print(dp[n])
# Judge status: Accepted
n, a, b = map(int, input().split())

MOD = 1000000007

ans = pow(2, n, MOD)
ans -= 1

x = 1
y = 1
for i in range(b):
    x = x * (n - i) % MOD
    y = y * (i + 1) % MOD
    if i == a - 1:
        ans -= x * pow(y, MOD - 2, MOD) % MOD

ans -= x * pow(y, MOD - 2, MOD) % MOD

while ans < 0:
    ans += MOD
print(ans)
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    k = int(input())
    if k%2 == 0:
        print((k//2)**2)
    else:
        print((k//2)*(k//2+1))

if __name__ == '__main__':
    main()
# Judge status: Accepted
l = int(input())
l /= 3
print(l * l * l)
# Judge status: Wrong Answer
s,t=open(0)
print(min(sum(a!=b for a,b in zip(s[i:]+t,t[:-1]))for i in range(len(s))))
# Judge status: Wrong Answer
from math import sqrt
a,b,c=map(int, input().split())
if sqrt(a)+sqrt(b)<sqrt(c):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=[x for x in input()]
print(max(n)*3)
# Judge status: Accepted
N = int(input())
S = input()

from collections import Counter

c = Counter(S)

ans = 1
for v in c.values():
    # print(v)
    ans *= v+1
    ans %= 10**9+7
print(ans-1)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

mini = 100000
cnt = 0
for i in range(n):
    mini = min(p[i], mini)
    if p[i] == mini:
        cnt+=1

print(cnt)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b>=c:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

A,B,C = MI()
print('Yes' if A+2*B >= C else 'No')
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print(c,b,a)
# Judge status: Wrong Answer
N = int(input())
W = [input() for i in range(N)]

l = []

for i in range(N):
  if i != 0:
    if W[i-1] == W[i]:
      print('No')
      break
  
  if W[i] in l:
    print('No')
    break
    
  l.append(W[i])
else:
  print('Yes')
# Judge status: Accepted
a, b, k = [int(x) for x in input().split()]
if a + k - 1 < b - k + 1:
    l = list(range(a, a + k)) + list(range(b - k + 1, b + 1))
else:
    l = list(range(a, b + 1))
for ans in l:
    print(ans)
# Judge status: Accepted
X = int(input())
for A in range(-1000, 1000):
    for B in range(-1000, 1000):
        if(A**5 - B**5 == X):
            print(A, B)
            exit(0)
# Judge status: Wrong Answer
from math import floor
a, b = map(int,input().split())
print(floor((a + b) / 2))
# Judge status: Wrong Answer
K=int(input())
eve=0
odd=0
for i in range(1,K+1,1):
	if i%2==0:
		eve+=1
	else:
		odd+=1
print(eve,odd)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

if 1 not in a:
    print(-1)
    exit()
d = 1
cnt = 0
for i in range(n):
    if a[i] == d:
        d += 1
    else:
        cnt += 1
print(cnt)
# Judge status: Accepted
a=int(input())
s=input()

if a>=3200:
  print(s)
else:
  print('red')
# Judge status: Wrong Answer
n = int(input())
a = input()
dic="abcdefghijklmnopqrstuvwxyz"
maxcount = 0
for i in range(n):
  for j in range(26):
    count = 0
    if str(dic[j]) in a[:i] and str(dic[j]) in a[i:]:
      count+=1
  maxcount = max(count,maxcount)
print(maxcount)
# Judge status: Accepted
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    print(int((a+b+2-1)/2))


resolve()
# Judge status: Accepted
n = int(input())
l = [2,1]
for i in range(n):
  l.append(l[i]+l[i+1])
  
print(l[-2])
# Judge status: Wrong Answer
c=str(input("please enter a string"))
i= len(c)
print ("x"*i)
# Judge status: Wrong Answer
a = int(input())
b = int(input())

l = [1,2,3]

l.remove(a)
l.remove(b)

print(str(l))
# Judge status: Wrong Answer
def solve():
    S = input()
    l = int(S[:2])
    r = int(S[2:])
    
    if l == 0 or r == 0:
        return 'NA'
    if l >= 20 or r >= 20:
        return 'NA'

    if 12 < l <= 19 and r <= 12:
        return 'YYMM'
    elif l <= 12 and r <= 19:
        return 'MMYY'
    elif l <= 12 and r <= 12:
        return 'AMBIGUOUS'
    else:
        return 'NA'

print(solve())
# Judge status: Wrong Answer
n = int(input())
s = [input() for i in range(n)]
a = [0]*n
for i in range(n):
    for j in range(10):
        a[i] += 10**(ord(s[i][j])-97)

a.sort()
print(a)
cnt = 1
ans = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        cnt += 1
        if i == n-2:
            ans += cnt*(cnt-1)//2
            cnt = 0            
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
print(ans)
# Judge status: Accepted
def q3():
    n = int(input())
    d = [int(i) for i in input().split()]
    d.sort()
    ans = d[int(n/2)] - d[int(n/2)-1]
    print(ans)


if __name__ == '__main__':
    q3()
# Judge status: Accepted
n,m,x,y = map(int,input().split())
xi = list(map(int,input().split()))
xi.append(x)
yi=  list(map(int,input().split()))
yi.append(y)
if  max(xi)<min(yi):
    print('No War')
else:
    print('War')
# Judge status: Accepted
from fractions import gcd
A,B=map(int,input().split())
C=gcd(A,B)

count=1
C_copy=C
n=2
while n**2<=C:  #C==1になるまでCを割る方針では、Cに大きい素因数が含まれている場合にTLEする
   if C_copy==1:
      break

   flag=False
   while C_copy%n==0:
      C_copy//=n
      flag=True
   if flag:
      count+=1
      n=n+1 if n==2 else n+2
   else:
      n=n+1 if n==2 else n+2

if C_copy!=1:
   count+=1

print(count)
# Judge status: Accepted
n,m = map(int,input().split())
h = list(map(int,input().split()))
p = [0 for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] >= h[b-1]:
        p[b-1] = -1
    if h[a-1] <= h[b-1]:
        p[a-1] = -1
print(p.count(0))
# Judge status: Accepted
n, k = list(map(int, input().split()))

p = 0

for i in range(1, n+1):
    j = i
    q = 1 / n
    while j < k:
        q *= 1 / 2
        j *= 2
    p += q

print(p)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)
n,k,q = map(int, input().split())
readline = sys.stdin.readline
A = [int(input()) for i in range(q)]

score = [k-q for i in range(n)]
for a in A:
    score[a-1] += 1
for s in score:
    if s > 0:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
from bisect import bisect_left

N = int(input())
L = [int(i) for i in input().split()]
L.sort()

cnt = 0
for i in range(0,N):
  for j in range(i+1,N):
    t = L[i]+L[j]
    idx = bisect_left(L,t,lo=j+1)
    print(L[i],L[j],idx)
    cnt += max(0,idx-j-1)
print(cnt)
# Judge status: Accepted
n = int(input())
X = list(map(int, input().split()))
s = sorted(X)

med_low = s[n//2 - 1]
med_high = s[n//2]

for x in X:
    if x <= med_low: print(med_high)
    else: print(med_low)
# Judge status: Wrong Answer
a,b=map(int, input().split())
print((a+b)/2 if (a+b)%2==0 else 'IMPOSSIBLE')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
count = 0
if a != b :
    count += 1
if a != c :
    count += 1
if b != c :
    count += 1
print(count)
# Judge status: Wrong Answer
cnt = 0
n = int(input())
for i in range(0,n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
        if cnt == 3 :
            print("Yes")
            break
    else:
        cnt == 0
        
    if cnt != 3 and i == n-1:
        print("No")
# Judge status: Accepted
S = input()

li = []
for i in range(0, len(S)-2):
    sli = int(S[i:i+3])
    li.append(sli)

ans = 1000
for j in li:
    ans = min(ans, abs(j-753))

print(ans)
# Judge status: Wrong Answer
n=int(input())
for i in range(n):
  if i*(i+1)//2>n:break
ans=[]
for j in range(i,0,-1):
  if j<=n:
    n-=j
    ans+=[j]
print(*ans,sep='\n')
# Judge status: Accepted
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
busCount = 0
pCount = 0
time = 0
firstTime = 0
for i in range(N):
    time = T[i]
    if firstTime == 0:
        firstTime = T[i]
        busCount += 1
    pCount += 1
    if time > firstTime + K:
        firstTime = T[i]
        busCount += 1
        pCount = 1
        continue
    if pCount == C:
        firstTime = 0
        pCount = 0
print(busCount)
# Judge status: Wrong Answer
import collections
n=int(input())
d={}
for i in range(n):
  A=int(input())
  if A in d:
    d[A]=0
  else:
    d[A]=1
print(sum(d.values()))
# Judge status: Accepted
a,b,c=map(int,input().split())
k=int(input())
ans=0
while(b<=a):
    b=b*2
    ans+=1
m=max(a,b)
while(c<=m):
    c=c*2
    ans += 1
if ans<=k:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
count=0
n=int(input())
while n%2==0:
  n=n/2
  count+=1
print(count)
# Judge status: Accepted
def main():
    N, D = (int(x) for x in input().split())
    ans = int((N + (2 * D)) / ((2 * D) + 1))
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,x=MI()
    a=LI()
    ans=0
    if a[0]>x:
        ans+=a[0]-x
        a[0]=x
    
    for i in range(N-1):
        b=a[i]+a[i+1]
        if b>x:
            ans+=b-x
            a[i+1]-=b-x
            
    print(ans)
    

main()
# Judge status: Accepted
c = []
for _ in range(3):
    c.append(list(map(int, input().split())))

for i in range(2):
    if c[i][0]-c[i][1]!=c[i+1][0]-c[i+1][1]:
        print('No')
        break
    if c[i][1]-c[i][2]!=c[i+1][1]-c[i+1][2]:
        print('No')
        break
    if c[i][2]-c[i][0]!=c[i+1][2]-c[i+1][0]:
        print('No')
        break
else:
    print('Yes')
# Judge status: Wrong Answer
S = input()
nums = [0] * (len(S)+1)
pos = 0
count = 0
pre_count = 0
now = '>'
for (i, s) in enumerate(S):
  if s != now:
    if s == '<':
      nums[pos] = max(pre_count, count)
      while pos != i:
        pos += 1
        count -= 1
        nums[pos] = count
    else:
      pos = i
      pre_count = count+1
      count = 1
    now = s
  else:
    count += 1
    if s == '<':
      nums[i] = count
if now == '<':
  nums[i+1] = count+1

print(sum(nums))
# Judge status: Wrong Answer
H1, M1, H2, M2, K = map(int, input().split())

hour = H2 - H1
if M1 > M2:
    hour -= 1

minute = abs(M2 - M1)

ans = hour * 60 + minute - K
if ans < 0:
    ans = 0

print(ans)
# Judge status: Wrong Answer
import numpy as np

N,M = list(map(int,input().split()))
a = list(np.array([input().split() for i in range(M)]).reshape(-1))
a = [int(i) for i in a]

for i in range(1,M+1):
	print(a.count(i))
# Judge status: Accepted
from heapq import heapify, heappop, heappush

N, M = map(int, input().split())
A = [-1*int(i) for i in input().split()]
heapify(A)

for i in range(M):
    n = -1 * heappop(A)
    heappush(A, -1*(n//2))

print(-1*sum(A))
# Judge status: Wrong Answer
from sys import stdin
import math

n = int(stdin.readline().rstrip())

if n < 100:
    poi = 0
    for i in range(1,n+1):
        for j in range(1,n+1):
            if str(i)[0] == str(j)[-1] and str(i)[-1] == str(j)[0]:
                poi += 1
    print(poi)
else:
    print((n//10)**2+8)
# Judge status: Wrong Answer
# C
N = int(input())
A = list(map(int,input().split()))
mi = min(A)
ma = max(A)
ans = 10 ** 12
for i in range(mi,ma):
    su = 0
    for j in A:
        su += (i-j)**2
    ans = min(ans,su)
print(ans)
# Judge status: Wrong Answer
import numpy as np
mod = 10**9+7
n = int(input())
a = np.array(list(map(int,input().split())))

result = 0
for i in range(60):
    count_one = sum(a&1)
    result += count_one*(n-count_one)*(2**i)%mod
    a = a >> 1
print(result%mod)
# Judge status: Accepted
n,m=map(int,input().split())
if n%2==1:
    for i in range(m):
        print(i+1,n-i)
else:
    for i in range(m):
        if i<m/2:
            print(i+1,n-i)
        else:
            print(i+1,n-i-1)
# Judge status: Wrong Answer
from numpy import log
def f(k):
  c=0
  while k % 2 == 0:
    k //= 2
    c+=1
    if c==2:
      break
  return c
def g(k):
  return f(int(k))
n=int(input())
a=list(map(g,input().split()))
a.sort()
ct0=a.count(0)
ct1=a.count(1)
ct2=a.count(2)
if ct0 > ct2 and ct1 != 0:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
n,m=map(int,input().split());[print(i+1,n-i-((i>=m/2)&~n)) for i in range(m)]
# Judge status: Wrong Answer
lst = input().split(' ')
m = lst[0]
n = lst[1]

if n==m:
    print('AC')
else:
    print('WA')
# Judge status: Accepted
N ,M = map(int,input().split())
array = []
if N % 2 == 1:
    for i in range(1,(N-1)//2 + 1):
        array.append([i,N-i])
    for i in range(M):
        print(*array[i])
else:
    for i in range(1,N//2):
        if i <= N//4:
            array.append([i,N+1-i])
        else:
            array.append([i,N-i])
    for i in range(M):
        print(*array[i])
# Judge status: Accepted
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
answer = abs((N-2) * (M-2))
print(answer)
# Judge status: Accepted
n,k,s=open(0).read().split()
n,k=int(n),int(k)
d=0
for i in range(1,n):
  if not s[i]==s[i-1]:
    d+=1
print(n-1-max(d-2*k,0))
# Judge status: Accepted
import sys
input = sys.stdin.readline

l, r = map(int, input().split())
if r - l > 2019:
    ans = 0
else:
    ans = float('inf')
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            ans = min(ans, (i * j) % 2019)
print(ans)
# Judge status: Wrong Answer
S, W = map(int, input().split())
if S <= 2 * W:
  print("unsafe")
else:
  print("safe")
# Judge status: Accepted
N = int(input())

l =[]
for i in range(1,10):
  for j in range(1,10):
    l.append(i*j)

if N in l:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a, b, x = map(int, input().split())
if a+b >= x:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
def f(x):
    global a,n,k
    if x==0:
        return 10**10
    ret=0
    for i in range(n):
        #print(-((-a[i])//x))
        ret+=(-((-a[i])//x)-1)
    return ret

l,r=0,10**10
while l+1<r:
    x=l+(r-l)//2
    if f(x)<=k:
        r=x
    else:
        l=x

print(r)
#print(f(r))
# Judge status: Wrong Answer
a=int(input())
b=int(input())
h=int(input())
print(((a+b)*h)/2)
# Judge status: Accepted
# -*- coding: utf-8 -*-
n = int(input())
a = [int(i) for i in input().split()]

count = [0 for _ in range(n)]
for i in reversed(range(1, n + 1)):
    tmp = 0
    for j in range(i, n+1, i):
        tmp += count[j-1]
    #print(tmp)
    if a[i-1] % 2 != tmp % 2:
        count[i-1] += 1
#print(count)
m = sum(count)
ans = []
for i in range(n):
    if count[i] == 1:
        ans.append(str(i+1))

print(m)
print(' '.join(ans))
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a>=13:
  print(b)
elif 6<=a<=12:
  print(b/2)
else:
  print(0)
# Judge status: Accepted
import sys
input = sys.stdin.readline

A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = min(a)+min(b)

for _ in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1]+b[y-1]-c)

print(ans)
# Judge status: Accepted
import math

a,b,h,m = map(int,input().split())

h_hand = (m+(h*60))*0.5
m_hand = m*6

degree = abs(h_hand - m_hand)

cos_x = math.cos(math.radians(degree))

sq = a**2 + b**2 -2*a*b*cos_x

print(math.sqrt(sq))
# Judge status: Accepted
s, t = input().split()

print(t + s)
# Judge status: Accepted
a, b, c = map(int, input().split())
print('Yes' if (a>c and b<c) or (a<c and b>c) else 'No' )
# Judge status: Accepted
lis = list(map(int, input().split(" ")))

tmp_dic = {}
for n in lis:
    if n not in tmp_dic:
        tmp_dic[n] = 1
    else:
        tmp_dic[n] += 1
        
if len(tmp_dic) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted

k, x =list(map(int, input().split()))
if 500*k >= x:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
ans = int(input())
if 400 <= ans < 599:
  ans = 8
elif 600 <= ans <= 799:
  ans = 7
elif 800 <= ans <= 999:
  ans = 6
elif 1000 <= ans <= 1199:
  ans = 5
elif 1200 <= ans <= 1399:
  ans = 4
elif 1400 <= ans <= 1599:
  ans = 3
elif 1600 <= ans <= 1799:
  ans = 2
elif 1800 <= ans <= 1999:
  ans = 1
# Judge status: Accepted
N, K = map(int, input().split())
print(1 if N % K != 0 else 0)
# Judge status: Accepted
# https://atcoder.jp/contests/abc077/tasks/arc084_a

from bisect import bisect_left, bisect_right

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)

total = 0
for b in B:
    c1 = bisect_right(A, b - 1)
    c2 = N - bisect_left(C, b + 1)
    # print(b, c1, c2, c1 * c2)
    total += c1 * c2

print(total)
# Judge status: Accepted
X = int(input())
rank = 1
base = 1800

for i in range(100):
    if X >= base:
        print(rank)
        break
    else:
        base -= 200
        rank += 1
# Judge status: Accepted
S = {}
S['a'] = input()
S['b'] = input()
S['c'] = input()


next = 'a'
lens = {'a':len(S['a']), 'b':len(S['b']), 'c':len(S['c'])}
counts = {'a':0, 'b':0, 'c':0}

while True:
  now = next
  counts[now]
  if counts[now] == lens[now]:
    print(now.upper())
    exit()
  next = S[now][counts[now]]
  counts[now] += 1
# Judge status: Accepted
from collections import Counter
N = int(input())

s = Counter(input())
for i in range(N-1):
    s &= Counter(input())
print(''.join(sorted(s.elements())))
# Judge status: Wrong Answer

N,K,Q = map(int,input().split(" "))


ans = [K - Q for i in range(N)]


for i in range(Q-1):
    A = int(input())
    ans[A-1] = ans[A-1] + 1

for a in ans:
    if a > 0:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
from collections import Counter
import numpy as np

n = int(input())
a = list(map(int, input().split()))
MAX = 10 ** 6

c = Counter(a)
arr = np.zeros(MAX + 1, np.int64)
st = set()
for k, v in c.items():
    if v != 1:
        st.add(k)
    arr[k] = 1

for i in range(MAX + 1):
    if arr[i]:
        arr[i*2::i] = 0

    if i in st:
        arr[i] = 0

print(arr.sum())
# Judge status: Accepted
def main():
    N = int(input())
    S = []
    for _ in range(N-1):
        c,s,f = map(int,input().split())
        S.append([c,s,f])

    for i in range(N-1):
        t = S[i][1] + S[i][0]
        for j in range(i+1,N-1):
            t = max(S[j][1],-(-t//S[j][2])*S[j][2]) + S[j][0]

        print(t)

    print(0)


main()
# Judge status: Accepted
def resolve():
    S = input()
    a = []
    z = []
    for i in range(len(S)):
        if S[i] == "A":
            a.append(i)
        elif S[i] == "Z":
            z.append(i)
    print(z[-1]-a[0]+1)
resolve()
# Judge status: Wrong Answer
from string import ascii_lowercase
alp = ascii_lowercase
num = {char: i for i, char in enumerate(alp)}

s = input()
k = int(input())
ns = [num[char] for char in s]

for i in range(len(ns)):
    v = ns[i]
    if 26 - v <= k:
        ns[i] = 0
        k -= 26 - v

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

print(''.join(alp[n] for n in ns))
# Judge status: Accepted
import math
n,m=map(int,input().split())
gcd=math.gcd(m,n)
i=1
ans=[]
max=int(math.sqrt(gcd))
for i in range(2,max+2):
    while gcd%i==0:
        ans.append(i)
        gcd//=i
if gcd>1:
  ans.append(n)

print(len(set(ans))+1)
# Judge status: Wrong Answer
a, b = input().split()
if a >= b:
  print(a)
else:
  print(b)
# Judge status: Wrong Answer
from itertools import accumulate

N = int(input())
A = list([int(x) for x in input().split()])

count = 0
ironbar = list(accumulate(A))

i = 0
j = len(A) - 1

while i + 1 < j:
    left = ironbar[i]
    right = ironbar[j] - ironbar[i]
    if left > right:
        j = (i+j) // 2
    elif left < right:
        i = (i+j) // 2
    else:
        print(0)
        exit()

print(abs(ironbar[i]-ironbar[j]))
# Judge status: Accepted
N = int(input().strip())
h = [[0] * (N+1) for i in range(3)]
for i in range(1, N+1):
    a, b, c = map(int, input().split(" "))
    h[0][i] = max(h[1][i-1], h[2][i-1]) + a
    h[1][i] = max(h[0][i-1], h[2][i-1]) + b
    h[2][i] = max(h[0][i-1], h[1][i-1]) + c

print(max(h[0][N], h[1][N], h[2][N]))
# Judge status: Accepted
# -*- coding: utf-8 -*-
from sys import exit
n, y  = map(int, input().split())
for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i+5000*j+1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
print(-1, -1, -1)
# Judge status: Wrong Answer
import sys
def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    answer=0

    table = [0] * (n + 1)
    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += i
        answer+=table[i]
    print(answer)

    return

resolve()
# Judge status: Wrong Answer
A,B,C = map(int, input().split())

ret = 0

if not (A%2 == B%2 and B%2 == C%2):
    # どれか一つにイレギュラーがある
    ret += 1

max_elem = max(A,B,C)
# print((A,B,C),max_elem, (max_elem-A)//2, (max_elem-B)//2, (max_elem-C)//2)
ret += (max_elem-A)//2 + (max_elem-B)//2 + (max_elem-C)//2

print(ret)
# Judge status: Accepted
import math
import sys
s = input()
def isACGT(n):
    for i in range(len(n)):
        if (n[i] != 'A' and n[i] != 'C' and n[i] != 'G' and n[i] != 'T'):
            return False
    return True
ans=0
for i in range(len(s)):
    for j in range(1, len(s)+1):
        if (isACGT(s[i:j]) and len(s[i:j]) > ans):
            ans = len(s[i:j])
print(ans)
# Judge status: Accepted
import numpy as np
IN = [list(map(int, input().split())) for _ in range(3)]
c = np.array(IN)
column = np.sum(c, axis=0)
row = np.sum(c, axis=1)
S = np.sum(c)
if S%3==0:
    S_ = S//3
    for i in range(S_+1):
        x = i
        y = S_ - x
        row_ = row - y
        column_ = column - x
        if all(col % 3 == 0 for col in column_) and all(ro % 3 == 0 for ro in row_):
            print("Yes")
            break
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
w, h, n = map(int, input().split())
x_reg = 0
y_reg = 0

for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1 and x_reg < x:
        x_reg = x
    if a == 2 and w > x:
        w = x
    if a == 3 and y_reg < y:
        y_reg = y
    if a == 4 and h > y:
        h = y

x_edge = max(0, w-x_reg)
y_edge = max(0, h-y_reg)

print(x_edge*y_edge)