peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# 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))
# Judge status: Accepted
a=int(input())
b=int(input())
h=int(input())
print((a+b)*h//2)
# Judge status: Accepted
n, m = map(int, input().split())
list_AB = [ list(map(int,input().split(" "))) for i in range(n)]

list_AB.sort()
ans = 0
for i in range(n):
    l = list_AB[i]
    if l[1] > m:
       ans += l[0]*m
       break
    else:
        ans += l[0]*l[1]
        m -= l[1]

print(ans)
# Judge status: Accepted
import math
X=int(input())
Xjiku=float(1)
Yjiku=float(0)
ans=int(1)
thita=int(0)
for _ in range(1000000):
    thita += X
    Xjiku += math.cos(math.radians(thita))
    Yjiku += math.sin(math.radians(thita))
    ans += int(1)
    if abs(Xjiku) < float(10**-10) and abs(Yjiku) < float(10**-10):
        break
print(ans)
# Judge status: Accepted
li =list(map(int,input().split()))
n =li[0]
m =li[1]
k =li[2]
count =0
for i in range(n,m+1):
    if i%k ==0:
        count +=1

print(count)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

if 0 in a:
  print(0)
  exit()

ans = 1
for i in a:
  ans *= i
  if ans > 10**18:
    print(-1)
    exit()
print(ans)
# Judge status: Accepted
a,b,c=sorted(map(int,input().split()))
print('Yes' if a+b==c else 'No')
# Judge status: Accepted
n = int(input())
S = [sorted(list(input())) for _ in range(n)]
ans = []

for i in range(len(S[0])):
    count = 0
    for j in range(n):
        if S[0][i] in S[j]:
            count += 1
    if n == count:
        for k in range(n):
            if k != 0:
                S[k].remove(S[0][i])
        ans.append(S[0][i])

print(''.join(ans))
# Judge status: Accepted
*A, = map(int, input().split())

if sum(A) >= 22:
    print('bust')
else:
    print('win')
# Judge status: Accepted
Cards = {'a':list(input()),'b':list(input()),'c':list(input())}

def solve(p):
    global Cards
    if len(Cards[p]) == 0:
        return p.capitalize()
    np = Cards[p].pop(0)
    return solve(np)

print(solve('a'))
# Judge status: Accepted
import sys

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

if N%2!=0 :
  print("No")
  sys.exit(0)
else:
  for i in range(int(N/2)):
      if S[i]!=S[i+int(N/2)]:
        print("No")
        sys.exit(0)
print("Yes")
# Judge status: Accepted
from collections import  Counter
n = int(input())
lst = []
for _ in range(n):
    lst.append(input())

C = Counter(lst)
x = max(C.values())
anslst = []
for k,v in C.items():
    if v == x:
        anslst.append(k)
anslst.sort()
for v in anslst:
    print(v)
# Judge status: Accepted
import math
n,d=map(int,input().split())
x=[[int(x) for x in input().split()]for _ in range(n)]
cnt=0
for i in range(n):
    for j in range(i+1,n):
        sum=0
        for a,b in zip(x[i],x[j]):
            sum+=(a-b)*(a-b)
        if math.sqrt(sum).is_integer():
            cnt+=1
print(cnt)
# Judge status: Accepted
a, b = map(int, input().split())

if a > b:
    c = a
    a -= 1
else:
    c = b
    b -= 1

print(c+max(a, b))
# Judge status: Accepted
import math
n = int(input())
print((math.floor(n**0.5)**2))
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if (abs(a-b)<=d)and(abs(b-c)<=d):
    print('Yes')
elif abs(a-c)<=d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, M = map(int, input().split())
ps = [input().split() for i in range(M)]

ac = 0
wa = [0 for i in range(N)]
ansed = set()
for psn in ps:
    if psn[1] == 'AC':
        if psn[0] not in ansed:
            ac += 1
            ansed.add(psn[0])
    else:
        if psn[0] not in ansed:
            wa[int(psn[0])-1] += 1
for i in range(N):
    if str(i+1) not in ansed:
        wa[i] = 0

print(ac, sum(wa))
# Judge status: Accepted
x = 1 + 2 + 3 + 4 + 5
a = list(map(int, input().split()))
print(x - sum(a))
# Judge status: Accepted
a, b = map(int, input().split())
ans = 0
for i in range(a, b+1):
    c = str(i)
    if c==c[::-1]:
        ans += 1
print(ans)
# Judge status: Accepted
#ABC156 C - Rally

n = int(input())
x = [int(x) for x in input().split(' ')]
    
min_len =  100**2 * n

for i in range(100):
    all_len = 0
    for j in range(n):
        all_len += (x[j] - (i+1))**2

    min_len = min(min_len,all_len)

print(min_len)
# Judge status: Accepted
n = int(input())

a = list(map(int,input().split()))

a.sort()

p = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        p += 1


if p == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
import itertools
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
ls = list(itertools.permutations(range(1,N+1)))
print(abs(ls.index(P) - ls.index(Q)))
# Judge status: Accepted
a = input()
b = input()

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len and i==a_len-1:
        huku.append(a[i])
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")
# Judge status: Accepted
n,m,q=map(int,input().split())
li=[list(map(int,input().split()))for _ in range(q)]

ans = 0
def dfs(A):
    #print(A)
    global ans 
    if len(A) == n+1:
        tmp = 0
        for a,b,c,d in li:
            if A[b] - A[a] == c:
                tmp += d
            ans = max(ans,tmp)
        return
    for i in range(A[len(A)-1],m+1):
        dfs(A+[i])
dfs([1])
print(ans)
# Judge status: Accepted
s = input()
if 'a' in s and 'b' in s and 'c' in s:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
if (b-a)%2==0:
  print((b-a)//2)
else:
  c=n-b
  d=a-1
  print(max(c,d))
# Judge status: Accepted
n = int(input())
D = list(map(int,input().split()))

D.sort()
print(D[n//2] -D[n//2-1])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(sum(A[1:]))
# Judge status: Accepted
n = int(input())
count = 0
arr = [int(i) for i in input().split()]
for i in range(1,n+1):
    if i % 2 == 1 and arr[i-1] % 2 == 1:
        count += 1
print(count)
# Judge status: Accepted
a,b=map(int,input().split())
if a<0 or a>9:
  print(-1)
elif b<0 or b>9:
  print(-1)
else:
  print(a*b)
# Judge status: Accepted
N, K = map(int, input().split())
S = input()
 
if S[K-1] == 'A': rep = 'a'
elif S[K-1] == 'B': rep = 'b'
else: rep = 'c'

# (K-1)文字目まで + K文字目 + K+1文字目から
print(S[:K-1] + rep + S[K:])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    a[i] = a[i] - (i + 1)

a.sort()

b = a[n // 2]

ret = 0

for i in range(n):
    ret += abs(a[i] - b)

print(ret)
# Judge status: Wrong Answer
K,X=list(map(int,input().split()))
Min = max(X - (K -1),-1000000)
Max = min(X + (K-1),1000000)
ans = []
for i in range(Min,Max+1):
    ans.append(i)
x = ' '.join(str(ans))
print(x)
# Judge status: Accepted
N = int(input())

if N%2 == 1:
  print("0")
  exit(0)

N = N//2
ans = 0  
while N > 1:
  N = N//5
  ans += N
print(ans)
# Judge status: Accepted
N = int(input())

if int(N / 100) == 7 or int((N % 100) / 10) == 7 or N % 10 == 7:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
W = input()
for w in W:
  if W.count(w)&1:
    print("No")
    break
else:
  print("Yes")
# Judge status: Wrong Answer
N = int(input())
st = 0
sx = 0
sy = 0
flg = False
for _ in range(N):
    t,x,y = map(int,input().split())

    if (x+y)-(sx+sy) > (t-st) or (t-st) % 2 != ((x+y)-(sx+sy)) % 2:
        flg = True
        break
    else:
        st = t
        sx = x
        sy = y
print('No' if flg else 'Yes')
# Judge status: Accepted
from fractions import gcd
from collections import defaultdict

A, B = map(int, input().split())
x = gcd(A, B)
d = defaultdict(int)

d[1]=1
for i in range(2, int(x**0.5)+1):
    while x%i==0:
        x//=i
        d[i]+=1
if x!=1:
    d[x]+=1

ans = len(d.keys())
print(ans)
# Judge status: Accepted
w, h, n = map(int, input().split())
right, left, lower, upper = 0, w, 0, h
for _ in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        right = max(right, x)
    if a == 2:
        left = min(left, x)
    if a == 3:
        lower = max(lower, y)
    if a == 4:
        upper = min(upper, y)

a = left - right
b = upper - lower

if a <= 0 or b <= 0:
    print(0)
else:
    print(a*b)
# Judge status: Wrong Answer
n,c,k=map(int,input().split())
a=sorted([int(input()) for _ in range(n)],reverse=True)
cnt=0
while len(a) > 0:
    b=a.pop()
    cnt+=1
    if len(a)==0:
        break
    for i in range(c-1):
        if a[-1]<b+k:
            a.pop()
            if len(a)==0:
                break
        
print(cnt)
# Judge status: Accepted
import sys
h, w = list(map(int, input().split()))

if h == 1 or w == 1:
    print(1)
    exit()
tmp = h * w
if (tmp % 2) == 0:
    a = tmp // 2
    print(a)
else:
    a = tmp // 2
    b = a + 1
    print(b)
# Judge status: Wrong Answer
S = input()
N = (len(S))
for i in range(N):
 S = S[:i-1] + 'x' + S[i:]#i番目の文字をxに変える
 S = S[:N-1] + '' + S[N:]#i番目の文字をxに変える

S = S[:N] + 'x' + S[N+1:]#最後の文字用
S = S[:N] + '' + S[N+1:]#i番目の文字をxに変える
print(S)
# Judge status: Accepted
from bisect import bisect_right
n,m=map(int,input().split())
p,y=[],[]
l={}
for i in range(m):
 p_,y_=map(int,input().split())
 p.append(p_)
 y.append(y_)
 if not p_ in l:l[p_] = []
 l[p_].append(y_)
for i in l:
 l[i].sort()
for i in range(m):
 print(str(p[i]).zfill(6)+str(bisect_right(l[p[i]],y[i])).zfill(6))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

import datetime
chk = datetime.datetime.strptime("2019/5/1","%Y/%m/%d")
s   = datetime.datetime.strptime(input(),"%Y/%m/%d")
if s<chk:
    print("Heisei")
else:
    print("TBD")
# Judge status: Accepted
import sys
from functools import lru_cache

@lru_cache(maxsize=None)
def gcd(a, b):
    if b == 0:
        return a
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)


N, *A = map(int, sys.stdin.read().split())
L = [0] * (N + 2)
R = [0] * (N + 2)
for i in range(N):
    L[i + 2] = gcd(L[i + 1], A[i])
    R[-i - 2] = gcd(R[-i - 1], A[-i - 1])

print(max(gcd(L[i], R[i + 1]) for i in range(1, N + 1)))
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    if N % 2 == 1:
        print(N//2+1)
    else:
        print(int(N/2))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())

print((n//2)+1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split('/'))
if a>2019 or(a==2019 and b>5):print('TBD')
else:print('Heisei')
# Judge status: Accepted
n = int(input())
print('ABC' if n <= 999 else 'ABD')
# Judge status: Accepted
A,B=map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%3==0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
n=int(input())

import heapq
a=[]
a_heap=[]
for i in range(n):
    tmp=int(input())
    a.append(tmp)
    heapq.heappush(a_heap,(-1)*tmp)

for i in range(n):
    max_1=heapq.heappop(a_heap)
    if max_1==(-1)*a[i]:
        max_2=heapq.heappop(a_heap)
        print((-1)*max_2)
        heapq.heappush(a_heap,max_2)
    else:print((-1)*max_1)
    heapq.heappush(a_heap,max_1)
# Judge status: Accepted
n = int(input())
s = str(input())
A = [0]
cum = 0
ans = ''
for i in range(n):
    if s[i] == '(':
        cum += 1
    else:
        cum -= 1
    if cum == -1:
        ans = '('+ans
        ans += s[i]
        cum = 0
    else:
        ans += s[i]
else:
    if cum > 0:
        ans += ')'*cum
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
count = 0
 
for i in range(n):
  if (i + 1) % 2 != 0:
    if a[i] % 2 != 0: 
      count += 1
      
print(count)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
if A == B:
    if C == 0:
        print('YES')
    else:
        print('NO')
elif A > B:
    if C % (A % B) == 0 or (B - C) % (A % B) == 0:
        print('YES')
    else:
        print('NO')
else:
    if (B - C) % A == 0:
        print('YES')
    else:
        print('NO')
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
ans = float('inf')

for i in range(1,100):
    cost = 0
    
    for j in range(N):
        cost += (X[j] - i) ** 2
        
    ans = min(ans, cost)
    
print(ans)
# Judge status: Accepted
x,y = map(int,input().split())
if abs(x) == abs(y):
  print(0 if x == y else 1)
elif x < y:
  print(min(y - x,abs(y + x) + 1))
else:
  print(min(abs(y+x),abs(y-x))+ 1 if x * y <= 0 else min(abs(y+x),abs(y-x))+ 2)
# Judge status: Wrong Answer
n, k = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))
h.sort()
answer = min(h[k - 1] - h[0], h[-1] - h[-k])
print(answer)
# Judge status: Accepted
n = int(input())

c = 0
flag = False

for i in range(n):
    x, y = list(map(int, input().split()))
    if x == y:
        c += 1
        if c == 3:
            flag = True
            break
    else:
        c = 0

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
X = list(map(int,input().split()))
avg = sum(X)//N
sums_1 = 0
sums_2 = 0
for i in X:
    sums_1 += (avg - i)**2

for j in X:
    sums_2 += (avg+1 - j)**2


print(min(sums_1,sums_2))
# Judge status: Accepted
# coding: utf-8
# Your code here!
N,X=map(int, input().split())
List=list(map(int, input().split()))
bow=0
cnt=1
for i in range(0,N):
    bow+=List[i]
    if bow>X:
        break
    else:
        cnt+=1

print(cnt)
# Judge status: Wrong Answer
A = input()
B = input()
if A == B[::-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
for j in range(min(K,int(2*(math.log2(N)))+10)):
	B = [0]*N
	for i in range(N):
		l = max(0,i-A[i])
		r = min(N-1,i+A[i])
		B[l] += 1
		if r < N-1:
			B[r+1] -= 1
	for i in range(1,N):
		B[i] += B[i-1]
	A = B
print(' '.join(map(str,A)))
# Judge status: Wrong Answer
from itertools import permutations
N=int(input())
town=[]
for i in range(N):
    x,y=map(int,input().split())
    town.append((x,y))

ans=0
for i,j in permutations(town,2):
    ans+=(((i[0]-j[0])**2+(i[1]+j[1])**2)**0.5)
print(ans/N)
# Judge status: Accepted
A = []
for i in range(3):
  for x in input().split():
    A.append(int(x))
    
N = int(input())

for _ in range(N):
  y = int(input())
  A = [0 if x == y else x for x in A]

if any((sum(A[::3]) == 0,
       sum(A[1::3]) == 0,
       sum(A[2::3]) == 0,
       sum(A[:3]) == 0,
       sum(A[3:6]) == 0,
       sum(A[6:]) == 0,
       sum(A[::4]) == 0,
       sum(A[2:7:2]) == 0)):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
import bisect
def make_LIS(L):
    LIS=[L[0]]
    for i in range(1,len(L)):
        if L[i]>=LIS[-1]:#広義単調増加なら>=に
            LIS.append(L[i])
        else:
            LIS[bisect.bisect_right(LIS,L[i])]=L[i]
    return len(LIS)
def main():
    n=int(input())
    A=[int(input())for _ in range(n)]
    print(make_LIS(A[::-1]))

if __name__=='__main__':
    main()
# Judge status: Accepted
n = int(input())
D = list(map(int, input().split()))
MOD = 998244353

cnt = [0] * n
for d in D:
    cnt[d] += 1

if D[0] == 0 and cnt[0] == 1:
    res = 1
else:
    res = 0

for i in range(1, n):
    res *= pow(cnt[i - 1], cnt[i], MOD)
    res %= MOD

print(res)
# Judge status: Accepted
H,W = map(int, input().split())
h_ = (1 if H==1 else (0 if H == 2 else H-2))
w_ = (1 if W==1 else (0 if W == 2 else W-2))
ret = h_*w_
print(ret)
# Judge status: Accepted
a, b = map(int, input().split())
ab = ((a + b) / 2)
if ab.is_integer():
    print(int(ab))
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
def minDistPoint(Student,List):
    ans_dist = 500000000
    res = 0
    for k,pos in List.items():
        dist = abs(Student[0]-pos[0])+abs(Student[1]-pos[1])
        if dist<ans_dist:
            ans_dist = dist
            res=k
    return res+1

N,M=map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
CD = {i:list(map(int,input().split())) for i in range(M)}

cp = [0]*N

for i in range(len(AB)):
    cp[i] = minDistPoint(AB[i],CD)
    
for i in cp:
    print(i)
# Judge status: Accepted
q,h,s,d = map(int, input().split())
n = int(input())
q*=4
h*=2
one = min(q,h,s)
c1 = n//2*d + n%2*one
c2 = n*one
print(min(c1,c2))
# Judge status: Wrong Answer
N=int(input())
print(N*(N+1)/2)
# Judge status: Wrong Answer
import math
a, b, x = map(int, input().split())
theta = math.atan((-2) * x / (a ** 3) + 2 * b / a)
if a * math.tan(theta) > b:
    theta = math.atan2(a * b * b, x)
print(math.degrees(theta))
# Judge status: Wrong Answer
s=list(input())
s=list(map(int,s))

a=s[0]*10+s[1]
b=s[2]*10+s[3]

if (a==0 and b==0) or (a>=13 and b>=13):
  print("NA")
elif 0<a<=12 and 0<b<=12:
  print("AMBIGUOUS")
elif 0<a<12:
  print("MMYY")
else:
  print("YYMM")
# Judge status: Accepted
a, b, c = map(int,input().split())

if a%2!=0 or b%2!=0 or c%2!=0:
    print(0)
    exit()

if a==b==c:
    print(-1)
    exit()

times=0
while a%2==0 and b%2==0 and c%2==0:
    times+=1
    a_=a//2
    b_=b//2
    c_=c//2
    a=b_+c_
    b=a_+c_
    c=a_+b_

print(times)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
 
money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i+1]-a[i]) * (money//a[i])
print(money)
# Judge status: Accepted
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))
# Judge status: Accepted
a,b,c=sorted(map(int,input().split()))
if a+b==c:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
k, a, b = map(int, input().split())

if k > a+1 and a+2 <= b:
    print(max((k-a-1) // 2, 0 * (b-a) + b + (k-a-1) % 2, k+1))
else:
    print(k+1)
# Judge status: Accepted
d, n = map(int, input().split())
count = 0
i = 1

while True:
    c = 0
    num = i
    while num >= 100:
        if num%100==0:
            num = num//100
            c += 1
        else:
            break
    if c==d:
        count += 1
    if count == n:
        print(i)
        break
    i += 1
# Judge status: Accepted
a = input().split()
sums = 0
for i in a:
    sums += int(i)

if sums == 17:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

I=0
for a in A:
    if a==I+1:
        I+=1

if I==0:
    print(-1)
else:
    print(N-I)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
ans=0

if a <= c:
  if b <= c:
    pass
  elif b <= d:
    ans = b-c
  else:
    ans = d-c
else:
  if d <= a:
    pass
  elif d <= b:
    ans = d-a
  else:
    ans = b-a
print(ans)
# Judge status: Accepted
n, k = [int(i) for i in input().split()]
if n % k  == 0:
    print(0)
elif n < k:
    print(min(n, k-n))
else:
    n = n - int(n//k) * k
    n = min(abs(n-k), n)
    n = min(abs(n-k), n)
    print(n)
# Judge status: Wrong Answer
x=int(input())
al=list(map(lambda x:-x, list(range(1,100))))
ar=list(range(100))
a=al+ar
b=a.copy()

for ai in a:
    for bi in b:
        if ai**5 - bi**5 == x:
            print("{0} {1}".format(ai,bi))
            exit()
# Judge status: Wrong Answer
n = int(input())
a  = list(map(int,input().split()))
N = max(a)
res = 10**10
K = 0
for i in range(n):
    
    if abs(a[i]-N//2) < res:
        res = abs(a[i] -N//2)
        K = i
print(N,a[K])
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
print(sum(l)-min(l))
# Judge status: Accepted
from fractions import gcd
N, X = map(int, input().split())
xn = list(map(int, input().split()))
temp = abs(xn[0]-X)
for i in range(1, N):
    temp = gcd(xn[i]-X, temp)
print(temp)
# Judge status: Accepted
n = int(input())

a = [int(x)-1 for x in input().split()]

from collections import defaultdict

d = defaultdict(int)


for i in a:
  d[i] += 1

for i in range(n):
  print(d[i])
# Judge status: Accepted
n = int(input())

sList = sorted(list(map(int,input().split())),reverse=True)
res = []
acc = False
for i in range(n-1):
  if acc:
    acc = False
  else:
      if sList[i] == sList[i+1]:
        res.append(sList[i])
        acc = True
      if len(res) == 2:
        print(res[0]*res[1])
        exit(0)

print(0)
# Judge status: Accepted
n = int(input())
if (n//10**(len(str(n))-1)+1)*10**(len(str(n))-1)-1 > n:
  mx = (n//10**(len(str(n))-1))*10**(len(str(n))-1)-1
else:
  mx = (n//10**(len(str(n))-1)+1)*10**(len(str(n))-1)-1
print(sum(list(map(int,str(mx)))))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()

#強さを出力
def T(x,y,z):
    ma = max(x,y,z)
    mi = min(x,y,z)
    return (x+y+z) - (ma+mi)

ans = 0
for i in range(0,3*n,3):
    ans += T(*a[i:i+3])
print(ans)
# Judge status: Accepted
N = [i for i in input()]
if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
  print('hon')
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
  print('pon')
else:
  print('bon')
# Judge status: Accepted
n = input()
if (n[0] == n[1] and n[1] == n[2]) or (n[1] == n[2] and n[2] == n[3]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, A, B = [int(i) for i in input().split()]
if (B-A) % 2 == 0:
    print((B-A)//2)
else:
    x = min(A-1, N-B)
    print((B-A-1)//2+x+1)
# Judge status: Accepted
A, B, T = map(int, input().split())
print(T//A*B)
# Judge status: Accepted
from collections import Counter
n, k = map(int, input().split())
a = list(map(int, input().split()))
result = 0
cnt = Counter(a)
cnt_set = set(cnt.items())
cnt_sort = sorted(cnt.items(), key=lambda x:x[1])
for i in range(len(cnt_set) - k):
    result += cnt_sort[i][1]

print(result)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
ANS = []

for i in range(n):
    ANS.append([A[i],i+1])
    
ANS = sorted(ANS)

for i in range(n):
    print(ANS[i][1],end = " ")
# Judge status: Wrong Answer
a,b = map(int,input().split())

temp = 0
x,y = 999,999

for i in range(1,1000):
    temp += i
    if temp - a > 0:
        x = min(temp-a, x)

print(x)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
print("YES" if len(list(set(a))) == n else "NO")
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

import itertools

pi = 0
count = 1
for i in itertools.permutations(range(1, n+1), n):
    if list(i) == p:
        pi = count
        break
    else:
        count += 1

qi = 0
count = 1
for i in itertools.permutations(range(1, n+1), n):
    if list(i) == q:
        qi = count
        break
    else:
        count += 1


print(pi, qi)
ans = abs(pi - qi)
print(ans)
# Judge status: Wrong Answer
x = int(input())
if x < 599:
    print(8)
elif x < 799:
    print(7)
elif x < 999:
    print(6)
elif x < 1199:
    print(5)
elif x < 1399:
    print(4)
elif x < 1599:
    print(3)
elif x < 1799:
    print(2)
elif x < 1999:
    print(1)
# Judge status: Accepted
inp = [int(i) for i in input().split()]
N = inp[0]
K = inp[1]
n = N
c = 0
while n>=1:
  n /= K
  c += 1
print(c)
# Judge status: Accepted
import collections

mod=998244353
n=int(input())
arr=list(map(int,input().split()))
if arr[0]!=0:
  print(0)
else:
  count=collections.Counter(arr)
  if count[0]!=1:
    print(0)
  else:
    ans=1
    for i in range(1,n):
      ans*=pow(count[i-1],count[i],mod)
      ans%=mod
    print(ans)
# Judge status: Accepted
for i in range(365):
    print(i%26+1)
# Judge status: Wrong Answer
# AGC 04
#TRY 2

a, b, c = map(int, input().split())
if (a or b or c) % 2 == 0:
    print(0)
if (a and b and c) % 2 != 0 :
    print(min(a * b, b * c, c * a))
# Judge status: Wrong Answer
N = int(input())
print((N+2)//2)
# Judge status: Wrong Answer
x,a,b=map(int,input().split());print("AB"[abs(x-a)<abs(x-b)])