Harryxun/stf_run huggingface dataset:
# 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))    

### FIXED CODE ###

# 2019/09/17

s=list(input())
n=len(s)
k=int(input())

cnta=0
min_l=10000

for i in range(n):
    cnt=123-ord(s[i])
    if cnt>k:continue
    if s[i]=='a':
        cnta+=1
        continue
    s[i]='a'
    k-=cnt
    if k==0:break
else:
    last=s[-1]
    while cnta>=0:
        tmp=ord(last)-97
        kk=(k-cnta*26)%26
        
        min_l=min(min_l,(tmp+kk)%26)
        cnta-=1
    else:
        s[-1]=chr(min_l+97)
        
print(''.join(s))
H, W, K = map(int,input().split())
dp = [[0]*W for _ in range(H+1)]
dp[0][0] = 1

ck = [0]*9
ck[0] = 1
for i in range(1,9):
  for j in range(2**i):
    for k in range(i-1):
      if k&(k+1)==True:
        break
    else:
      ck[i] += 1

mod = 10**9+7
for i in range(1,H+1):
  for j in range(W):
    if j == 0:
      dp[i][j] = dp[i-1][j]*ck[W-2]+dp[i-1][j+1]*ck[W-3]
    elif j == W-1:
      dp[i][j] = dp[i-1][j]*ck[W-2]+dp[i-1][j-1]*ck[W-3] 
    else:
      dp[i][j] = dp[i-1][j+1]*(ck[j-1]+ck[W-j-3])+dp[i-1][j]*(ck[j-1]+ck[W-2-j])+dp[i-1][j-1]*(ck[max(0,j-2)]-1+ck[W-j-2])

print(dp[H][K-1]%mod)


### FIXED CODE ###

H, W, K = map(int,input().split())
dp = [[0]*W for _ in range(H+1)]
dp[0][0] = 1

ck = [0]*9
ck[0] = 1
for i in range(1,9):
  for j in range(2**(i-1)):
    for k in range(i-1):
      if (j>>k)&(j>>(k+1))==True:
        break
    else:
      ck[i] += 1

mod = 10**9+7
for i in range(1,H+1):
  for j in range(W):
    if (j == 0)&(j == W-1):
      dp[i][j] = dp[i-1][j]*(ck[j]*ck[W-1-j])
    elif j == 0:
      dp[i][j] = dp[i-1][j+1]*(ck[j]*ck[W-j-2])+dp[i-1][j]*(ck[j]*ck[W-1-j])
    elif j == W-1:
      dp[i][j] = dp[i-1][j]*(ck[j]*ck[W-1-j])+dp[i-1][j-1]*(ck[j-1]*ck[W-j-1])
    else:
      dp[i][j] = dp[i-1][j+1]*(ck[j]*ck[W-j-2])+dp[i-1][j]*(ck[j]*ck[W-1-j])+dp[i-1][j-1]*(ck[j-1]*ck[W-j-1])

print(dp[H][K-1]%mod)
from collections import deque

N = int(input())
S = input()

ans = deque(S)

ind = 0
for _ in range(N-1):
    if S[ind] == "(" and S[ind+1] == ")":
        ind += 2
        continue
    elif S[ind] == ")":
        ans.appendleft("(")
    elif S[ind] == "(":
        ans.append(")")
    ind += 1

print("".join(ans))

### FIXED CODE ###

from collections import deque

N = int(input())
S = input()
ans = deque(S)


while S.find("()") != -1:
    S = S.replace("()","")

for i in range(len(S)):
    if S[i] == ")":
        ans.appendleft("(")
    elif S[i] == "(":
        ans.append(")")
print("".join(ans))
N = int(input())
ls = [0]*(N)
n = 1
while n <= N-1:
  k = 1
  tmp = 0
  while k**2 <= n:
    if n % k == 0:
      if k ** 2 = n:
        tmp += 1
      else:
        tmp += 2
  ls[n] = tmp
print(sum(ls))

### FIXED CODE ###

N = int(input())
ans = 0
for n in range(1,N):
  ans += int((N-1)/n)
print(ans)
n, x, m = map(int, input().split())
a = [x]
for i in range(n-1):
    ad = (a[-1]**2) % m
    if ad in a:
        roop_s = a.index(ad)
        roop_e = len(a)
        break
    else:
        a.append(ad)
    if i == n-2:
        print(sum(a))
        exit()
roop_t = (n-roop_s) // (roop_e - roop_s)
left = n - roop_t*(roop_e - roop_s) - roop_s
ans = sum(a[:roop_s]) + roop_t*sum(a[roop_s : roop_e]) + sum(a[roop_s:roop_s+left])
print(ans)

### FIXED CODE ###

n, x, m = map(int, input().split())
a = [x]
if n == 1:
    print(x)
    exit()
for i in range(n-1):
    ad = (a[-1]**2) % m
    if ad in a:
        roop_s = a.index(ad)
        roop_e = len(a)
        break
    else:
        a.append(ad)
    if i == n-2:
        print(sum(a))
        exit()
roop_t = (n-roop_s) // (roop_e - roop_s)
left = n - roop_t*(roop_e - roop_s) - roop_s
ans = sum(a[:roop_s]) + roop_t*sum(a[roop_s : roop_e]) + sum(a[roop_s:roop_s+left])
print(ans)
N_n_osatsu, Y_sum_money = map(int, input().split())

rest_money = Y_sum_money
rest_n_osatsu = N_n_osatsu
n_each_osatsu_list = [] # 万札、五千円札、千円札の枚数の2重リスト

def skip_search(rest_money, rest_n_osatsu):  # 明らかに無理な場合、処理をスキップ
    if rest_n_osatsu*1000 > rest_money or rest_n_osatsu*10000 < rest_money:
        return True

def is_answer(n_10000, n_5000, n_1000): # 正答ならばそれを出力して終了
    if n_10000 + n_5000 + n_1000 == N_n_osatsu and n_10000*10000 + n_5000*5000 + n_1000*1000 == Y_sum_money:
        print(n_10000, n_5000, n_1000)
        exit()

for n_10000 in range(min(Y_sum_money//10000, N_n_osatsu)+1): # 万札枚数。0枚からスタート
    is_answer(n_10000, 0, 0)
    rest_money = Y_sum_money - 10000*n_10000
    rest_n_osatsu = N_n_osatsu - n_10000
    if skip_search(rest_money, rest_n_osatsu):
        break

    for n_5000 in range(min(rest_money//5000 + 1, rest_n_osatsu)+1): # 万札枚数決定後に5000円の枚数を探索。5000円0枚からスタート
        is_answer(n_10000, n_5000, 0)
        rest_money = Y_sum_money - 10000*n_10000 - 5000*n_5000
        rest_n_osatsu = N_n_osatsu - n_10000 - n_5000
        if skip_search(rest_money, rest_n_osatsu):
            break
        n_1000 = rest_money//1000
        is_answer(n_10000, n_5000, n_1000)

print("-1 -1 -1")

### FIXED CODE ###

# A - Already 2018

S = input()
print("2018" + S[4:])
'''
　 ∧_,,∧    究極奥義「WAがACになーれ！！」
　（`・ω・)つ━☆・*。
　⊂　　 ノ 　　　・゜+.
　 し’´Ｊ　　*・ 
'''
import sys
input = sys.stdin.readline
x=int(input())
dp=[0]*(x+1)
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
for i in range(200,x+1):
    if dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
        dp[i]=1
print(dp[x])

### FIXED CODE ###

'''
　 ∧_,,∧    究極奥義「WAがACになーれ！！」
　（`・ω・)つ━☆・*。
　⊂　　 ノ 　　　・゜+.
　 し’´Ｊ　　*・ 
'''
import sys
input = sys.stdin.readline
x=int(input())
dp=[0]*(max(x+1,200))
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
if x<=199:
    print(dp[x])
    exit()
for i in range(200,x+1):
    if dp[i-100]==1 or dp[i-101]==1 or dp[i-102]==1 or dp[i-103]==1 or dp[i-104]==1 or dp[i-105]==1:
        dp[i]=1
print(dp[x])
#in1 = '10 10 20'
#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']
h, w, n = lambda:map(int, input().split())
h, w, n = map(int, in1.split())

idx1 = 0
ab = [[0 for i in range(2)] for j in range(n)]
while idx1 < n:
    x = input().split()
    #x = in2[idx1].split()
    ab[idx1][0] = int(x[0])
    ab[idx1][1] = int(x[1])
    idx1 += 1

black_cnt = [0] * 10
black_cnt[0] = (h - 2) * (w - 2)

for idx1 in range(len(in2)):
    if ab[idx1][0] < 3:
        s = 0
    else:
        s = ab[idx1][0] - 3
    if ab[idx1][0] > h - 2:
        l = h - 2
    else:
        l = ab[idx1][0]
    Rrange = range(s, l)
    if ab[idx1][1] < 3:
        s = 0
    else:
        s = ab[idx1][1] - 3
    if ab[idx1][1] > w - 2:
        l = h - 2
    else:
        l = ab[idx1][1]
    Crange = range(s, l)

    for nowRow in Rrange:
        for nowCol in Crange:
            w_black = 0
            for idx2 in range(idx1):
                if nowRow < ab[idx2][0] <= nowRow + 3 and nowCol < ab[idx2][1] <= nowCol + 3:
                    w_black += 1
            black_cnt[w_black]     -= 1
            black_cnt[w_black + 1] += 1

for idx1 in range(len(black_cnt)):
    print(black_cnt[idx1])


### FIXED CODE ###

#in1 = '4 5 8'
#in2 = ['1 1', '1 4', '1 5', '2 3', '3 1', '3 2', '3 4', '4 4']
#in1 = '10 10 20'
#in2 = ['1 1', '1 4', '1 9', '2 5', '3 10', '4 2', '4 7', '5 9', '6 4', '6 6', '6 7', '7 1', '7 3', '7 7', '8 1', '8 5', '8 10', '9 2', '10 4', '10 9']
#in1 = '1000000000 1000000000 0'
#h, w, n = map(int, in1.split())
h, w, n = map(int, input().split())

idx1 = 0
ab = [[0 for i in range(2)] for j in range(n)]

black_cnt = [0] * 10
black_cnt[0] = (h - 2) * (w - 2)

if n != 0:
    while idx1 < n:
        x = input().split()
        #x = in2[idx1].split()
        ab[idx1] = [int(x[0]), int(x[1])]
        idx1 += 1

    myDict = {}
    for abitem in ab:
        if abitem[0] < 3:
            sr = 0
        else:
            sr = abitem[0] - 3
        if abitem[0] > h - 3:
            lr = h - 2
        else:
            lr = abitem[0]
        if abitem[1] < 3:
            sc = 0
        else:
            sc = abitem[1] - 3
        if abitem[1] > w - 3:
            lc = w - 2
        else:
            lc = abitem[1]

        for nowRow in range(sr, lr):
            for nowCol in range(sc, lc):
                key = str(nowRow) + ',' + str(nowCol)
                if key in myDict:
                    myDict[key] += 1
                else:
                    myDict[key] = 1

    for bcnt in myDict.values():
        black_cnt[bcnt] += 1
        black_cnt[0]    -= 1

for item in black_cnt:
    print(item)
n, W = map(int, input().split())
MAX_V = 1000
dp = [0] + [float('INF')]*MAX_V
for _ in range(n):
    w, v = map(int, input().split())
    tmp_dp = [min(dp[sum_v], dp[sum_v - v] + w) if sum_v >= v else min(dp[sum_v], w) for sum_v in range(MAX_V) ]
    dp = tmp_dp

ans = 0
while dp[ans+1] <= W:
    ans +=1
print(ans)

### FIXED CODE ###

N, W = map(int, input().split())
MAX_V = 10**5+1
dp = [float('inf')] * MAX_V
dp[0] = 0
for _ in range(N):
    w, v = map(int, input().split())
    for sum_v in range(MAX_V)[::-1]:
        if sum_v >= v:
            dp[sum_v] = min(dp[sum_v - v] + w, dp[sum_v])
        else:
            dp[sum_v] = min(dp[sum_v], w)
ans = 0
for v in range(MAX_V)[:: -1]:
    if dp[v] <= W:
        ans = v
        break
print(ans)
n,y = map(int,input().split())
ans_a = -1
ans_b = -1
ans_c = -1

for i in range(n+1):
  for j in range(n+1-i):
    x = y - 10000*i - 5000*j
    if x % 10000 == 0:
      k = x / 10000
      ans_a = i
      ans_b = j
      ans_c = k
print(ans_a,ans_b,ans_c)

### FIXED CODE ###

S = input().split('/')
S[0] = "2018"
ans = '/'.join(S)
print(ans)
#!/usr/bin/env python3

S = input()
K = int(input())

A = []
cnt = 1
C = []
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        cnt += 1
    else:
        C.append([S[i-1], cnt])
        cnt = 1
C.append([S[i], cnt])

ans = 0
S2 = []
for c in C:
    ans += (c[1])//2
    if c[1] == 1:
        S2.append(False)
    else:
        for _ in range(c[1]):
            S2.append(True)

ans *= K

ans2 = 0
if S[0] == S[-1]:
    if S2[-1] == False:
        ans2 += 1

print(ans + ans2*(K-1))


### FIXED CODE ###

#!/usr/bin/env python3

S = input()
K = int(input())

if len(S) == 1:
    print(K//2)
    exit()

A = []
cnt = 1
C = []
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        cnt += 1
    else:
        C.append([S[i-1], cnt])
        cnt = 1
C.append([S[i], cnt])

ans = 0
if len(C) == 1:
    print((C[0][1]*K) // 2)
    exit()
else:
    for c in C:
        ans += c[1] // 2

ans *= K

ans2 = 0
if S[-1] == S[0]:
    ans2 = ((C[0][1]+C[-1][1])//2 - C[0][1]//2 - C[-1][1]//2) * (K-1)
print(ans + ans2)
import collections
def main():
    n = int(input())
    a = list(map(int,input().split()))
    cnt = collections.Counter(a)
    num = len(set(a))
    if n % 3 != 0:
        print('No')
        return
    if num != 3 and cnt[0][1] !=3 and cnt[-1][1] != 3:
        print('No')
        return
    print('Yes')

if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections
def main():
    n = int(input())
    a = list(map(int,input().split()))
    cnt = collections.Counter(a)
    num = len(set(a))
    aset=set(a)

    if sum(a) == 0:
        print('Yes')
        return
    # if n % 3 != 0:
        # print('No')
        # return
    if len(cnt.most_common()) == 3:
        a1, a2, a3 = aset
        if cnt.most_common()[0][1] == cnt.most_common()[1][1] == cnt.most_common()[2][1]  and a1 ^ a2 == a3:
            # print(cnt.most_common())
            print('Yes')
            return

    if len(cnt.most_common()) == 2:

        tmp_min = cnt.most_common()[1][1]
        tmp_max = cnt.most_common()[0][1]
        if 3 * tmp_min == n and int(cnt.most_common()[1][0]) == 0:
            print('Yes')
            return
    print('No')

if __name__ == '__main__':
    main()
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
time=0
count=0
l=len(a)+len(b)
for i in range(l)
    if len(b)>0:
        if len(a)>0:
            if a[0]<b[0]:
                if time+a[0]<=k:
                    time+=a[0]
                    a.pop(0)
                else:
                    break
            else:
                if time+b[0]<=k:
                    time+=b[0]
                    b.pop(0)
                else:
                    break
        else:
            if time+b[0]<=k:
                time+=b[0]
                b.pop(0)
            else:
                break
    elif len(a)>0:
        if time+a[0]<=k:
            time+=a[0]
            a.pop(0)
        else:
            break
    else:
        break
    count+=1
print(count)

### FIXED CODE ###

N, M, K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a, b=[0], [0]
for i in range(N):
    a.append(a[i]+A[i])
for i in range(M):
    b.append(b[i]+B[i])
ans, j=0, M
for i in range(N+1):
    if a[i]>K:
        break
    while b[j]>K-a[i]:
        j-=1
    ans=max(ans, i+j)
print(ans)
def main():
        n = int(input())
        a = list(map(int,input().split()))
        b = list(map(int,input().split()))
     
     
        Flag = False
        biga = 0
        lessa = 0
        for i in range(3):
            if a[i] > b[i]:
                biga += a[i] - b[i]
            else:
     
                lessa += b[i] - a[i]
     
        tmp = lessa -(biga*2)
     
        if tmp >=0:
            print("Yes")
        else:
            print("No")
     
    if __name__ == "__main__":
        main()

### FIXED CODE ###


def main():
    n = int(input())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))


    Flag = False
    biga = 0
    lessa = 0
    for i in range(n):
        if a[i] > b[i]:
            biga += a[i] - b[i]
        else:
            lessa += (b[i] - a[i]) //2

    tmp = lessa - biga

    if tmp >= 0:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
import numpy as np

s = input()
l = len(s)
mod = (10**9)+7

dp = np.zeros((l,13), dtype=np.int64)

if s[0] == '?':
    dp[0][0:10] = 1
else:
    dp[0][int(s[0])] = 1

dp_memo = dp[0]

for i in range(l-1):
    a = i+1
    x = s[a]
    if x == '?':
        for j in range(10):
            for k in range(13):
                dp[a][(k*10+j)%13] += dp_memo[k]%mod
    else:
        for k in range(13):
            dp[a][(k*10+int(x))%13] += dp_memo[k]%mod
    dp_memo = dp[a]

print(dp[-1][5]%mod)

### FIXED CODE ###

s = input()
l = len(s)
mod = (10**9)+7

dp = [[0 for j in range(13)] for i in range(l)]

if s[0] == '?':
    dp[0][0:9] = [1 for x in range(10)]
else:
    dp[0][int(s[0])] = 1

for i in range(l-1):
    a = i+1
    x = s[a]
    if x == '?':
        for j in range(10):
            for k in range(13):
                dp[a][(k*10+j)%13] += dp[a-1][k]%mod
    else:
        for k in range(13):
            dp[a][(k*10+int(x))%13] += dp[a-1][k]%mod

print(dp[-1][5]%mod)
# ABC 054: B – Template Matching
n, m = [int(s) for s in input().split()]
a = []
b = []

for i in range(n):
    a.append(input())

for i in range(m):
    b.append(input())

is_contained = 'No'

for i in range(n - m + 1):
    if b[0] in a[i]:
        for j in range(m - i):
            if a[j].index(b[j]) != a[i].index(b[i]):
                break
        else:
            is_contained = 'Yes'
            break

print(is_contained)

### FIXED CODE ###

# ABC 054: B – Template Matching
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

isIncluding = False

for a_row in range(n):
    for a_column in range(n):

        if a[a_row][a_column] == b[0][0]:

            isExact = True
            for b_row in range(m):
                for b_column in range(1, m):
                    if a_row + b_row > n - 1 or a_column + b_column > n - 1:
                        isExact = False
                        break

                    if b[b_row][b_column] != a[a_row + b_row][a_column + b_column]:
                        isExact = False
                        break

                if not isExact:
                    isExact = True
                    break
            else:
                isIncluding = True
                break

        if isIncluding:
            break
            
    if isIncluding:
        break

print('Yes' if isIncluding else 'No')
import math
s = input().split(" ")
n = list(map(int,s))
d = math.sqrt((n[0]-n[2])**2 + (n[1]-n[3])**2)
print(d)

### FIXED CODE ###

import math
s = input().split(" ")
n = list(map(float,s))
d = math.sqrt((n[0]-n[2])**2 + (n[1]-n[3])**2)
print(d)
import numpy as np

A, B, K = map(int,input().split())

C = np.arange(A,B+1)

if len(C)<2*K:
    for x in range(len(C)):
        print(C[x])
        
        
else:
    for y in range(K):
        print(C[y])
    for z in range(B-K-2,B-2):
        print(C[z])


### FIXED CODE ###

A, B, K = map(int,input().split())

L = B - A + 1

if L >= 2*K:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1,B+1):
        print(i)
        
else:
    for i in range(A,B+1):
        print(i)
import math
N = int(input())
ans = [0]*N
l = int(math.sqrt(N-3))

for i in range(1,l):
    for j in range(1,l):
        for k in range(1,l):
            if (i+j+k)**2-(i*j+j*k+k*i) <= N:
                ans[(i+j+k)**2-(i*j+j*k+k*i)-1] += 1

s = '\n'.join([str(n) for n in ans])
print(s)

# print(ans, sep='\n')


### FIXED CODE ###

import math
N = int(input())
ans = [0]*N
l = int(math.sqrt(N))

for i in range(1,l):
    for j in range(1,l):
        for k in range(1,l):
            a = (i+j+k)**2-(i*j+j*k+k*i)
            if a <= N:
                ans[a-1] += 1

print(*ans, sep='\n')
n,m = map(int,raw_input().split())

def f(n,m):

	for d in range(2, m)[::-1]:
		if m % d == 0:
			if m / d >= n:
				return d		
				break

	return 1

print f(n,m)

### FIXED CODE ###

n,m = map(int,raw_input().split())

def f(n,m):
	if n == 1:
		return m
	divisors = []
	for d in range(2, int(m ** 0.5)+1)[::-1]:
		if m % d == 0:
			divisors.append(d)
			if d != m/d: divisors.append(m/d)
	divisors.sort(key = lambda x:-x)
	for d in divisors:
		if m/d >= n:
			return d

	return 1

print f(n,m)
a = input()
if len a[0]=A and len a[1]=C:
 print("Yes")
elif len a[1]=A and len a[2]=C:
 print("Yes")
elif len a[2]=A and len a[3]=C:
 print("Yes")
elif len a[3]=A and len a[4]=C:
 print("Yes")
elif:
 print("No")

### FIXED CODE ###

a = input()
if "AC" in a:
 print("Yes")
else:
 print("No")
S = input()

f = int(S[0]+S[1])
s = int(S[2]+S[3])

if f >= 1 and f <= 12 and s >= 1 and s <= 12:
  print('AMBIGUOUS')
elif f >= 1 and f <=12 and s => 13:
  print('MMYY')
elif f => 13 and s >= 1 and s <= 12:
  print('YYMM')
else:
  print('NA')

### FIXED CODE ###

S = input()

f = int(S[0]+S[1])
s = int(S[2]+S[3])

if f >= 1 and f <= 12 and s >= 1 and s <= 12:
  print('AMBIGUOUS')
elif f >= 1 and f <=12 and (s >= 13 or s == 0):
  print('MMYY')
elif (f >= 13 or f == 0) and s >= 1 and s <= 12:
  print('YYMM')
else:
  print('NA')
N = int(input())
s = [input() for _ in range(N)]

import collections
sortedList = [''.join(sorted(x)) for x in s]
countNum = list(collections.Counter(sortedList).values())

import sys
sys.setrecursionlimit(100000)

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

count = 0
memo = [0]*10**4
for n in countNum:
    if n!=1:
        if memo[n] == 0:
            memo[n] = cmb(n, 2)
        count += memo[n]
        
print(count)

### FIXED CODE ###

N = int(input())
s = [input() for _ in range(N)]
 
import collections
sortedList = [''.join(sorted(x)) for x in s]
countNum = list(collections.Counter(sortedList).values())
 
import sys
sys.setrecursionlimit(100000000)
 
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
  
count = 0
memo = [0]*10**6
for n in countNum:
    if n!=1:
        if memo[n] == 0:
            memo[n] = cmb(n, 2)
        count += memo[n]
        
print(count)
m = int(input())
print("0 0 1000000000 1 " + str(10**9-(m%(10**9)))+ " " + str(m//(10**9) + 1)))

### FIXED CODE ###

s = int(input())
x = s % 10**9
y = s // 10**9
if x > 0:
    x -= 10**9
    y += 1
print(0,0,10**9,1,-x,y)
N, M = map(int, input().split())
ac = 0
is_AC = [False] * M
WA_cnt = [0] * M
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

print(ac, sum(WA_cnt))



### FIXED CODE ###

N, M = map(int, input().split())
ac = 0
is_AC = [False] * (N + 1)
WA_cnt = [0] * (N + 1)
for i in range(M):
    p, s = input().split()
    p = int(p)
    if s == 'WA':
        if is_AC[p]:
            continue
        else:
            WA_cnt[p] += 1
    else:
        if is_AC[p]:
            continue
        else:
            is_AC[p] = True
            ac += 1

wa = 0
for i in range(N + 1):
    if is_AC[i]:
        wa += WA_cnt[i]
print(ac, wa)
'''
うまくいかなかったパターン
1 4
1 WA
1 WA
1 WA
1 WA
'''
import numpy as np
def solve():
    N = int(input())
    S2 = [0]*(2*N)
    for i in range(N):
        S2[i] = input()*2
        S2[i+N] = S2[i]
    check = [[[0]*(2*N) for _ in range(2*N)] for _ in range(2*N-1)]
    cum = [[[0]*(2*N) for _ in range(2*N)] for _ in range(2*N-1)]
    for i in range(2*N-1):
        for j in range(2*N-1):
            for k in range(-N+1,N):
                if j+k>=0 and j+k<=2*N-1 and i-k>=0 and i-k<=2*N-1:
                    check[k][i+1][j+1] = S2[i][j]==S2[j+k][i-k]
    for i in range(1,2*N):
        for j in range(1,2*N):
            for k in range(-N+1,N):
                cum[k][i][j] = cum[k][i-1][j]+cum[k][i][j-1]-cum[k][i-1][j-1]+check[k][i][j]
                if i>=N+1:
                    cum[k][i][j] -= check[k][i-N][j]
                if j>=N+1:
                    cum[k][i][j] -= check[k][i][j-N]
                if i>=N+1 and j>= N+1:
                    cum[k][i][j] += check[k][i-N][j-N]
    ans = 0
    for k in range(-N+1,0):
        A,B = -k+N,N
        while A<2*N:
            if cum[A-B][A][B]==N*N:
                ans += 1
            A += 1
            B += 1
    for k in range(N):
        A,B = N,k+N
        while B<2*N:
            if cum[A-B][A][B]==N*N:
                ans += 1
            A += 1
            B += 1
    return ans
print(solve())

### FIXED CODE ###

def solve():
    N = int(input())
    S2 = [0]*N
    for i in range(N):
        S2[i] = input()
    ans = 0
    for k in range(N):
        cum = [[0]*(N+1) for _ in range(N+1)]
        for i in range(1,N+1):
            for j in range(1,N+1):
                cum[i][j] = cum[i-1][j]+cum[i][j-1]-cum[i-1][j-1]+(S2[i-1][j-1]==S2[(j-1+k)%N][(i-1-k)%N])
                if i==N and j==N:
                    ans += (cum[i][j]==N*N)*N
    return ans
print(solve())
in_list = (int)input().split()
A, B, K = in_list[0], in_list[1], in_list[2]

for k in range(K):
  if A > 0:
    A -= 1
  elif B > 0:
    B -= 1
  elif:
	pass

print(A, B)

### FIXED CODE ###

import sys

def stdin_parse_int():
    a = list(map(int,input().split()))
    return a

list = stdin_parse_int()
A = list[0]
B = list[1]
K = list[2]

if A > K:
    print(str(A-K) + " " + str(B))
elif A+B > K:
    print(str(0) + " " + str(A+B-K))
else:
    print("0 0")