peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N = int(input())
p = 1
m = int(1e+9 + 7)
for i in range(1, N + 1):
    p = p * i
    if p > m:
        p = p % m
print(p)
# Judge status: Wrong Answer
N=input()
ans=[]
for i in N:
    if i=='B' and not ans==[]:
        ans[-1]=''
    else:
        ans.append(i)
print(''.join(ans))
# Judge status: Wrong Answer
N = int(input())

S = input()
s = list(S)
l = len(s)



B = []

for i in range(l):
  c = ord(s[i])
  e = c+N
  if e>ord('Z'):
    e = (((e-ord('A')+1)%26)+64)
    if e == 64:
      e = 65
  d = chr(e)
  print(e)
  B.append(d)
    
b = ''.join(B)

print(b)
# Judge status: Wrong Answer
N, x = map(int, input().split())
A = list(map(int, input().split()))
print(sum(A)-(sum(min(x, a1+a2) for a1, a2 in zip(A, A[1:]))+min(A[0],x)+min(A[-1],x))//2)
# Judge status: Accepted
from sys import stdin
from sys import setrecursionlimit
from math import pi
setrecursionlimit(10 ** 7)

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

print(2*pi*n)
# Judge status: Accepted
inputnum = input().split(" ")
calc = int(inputnum[0]) * int(inputnum[1])
if calc%2 == 0 :
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
n=int(input())
ans=[]

for i in range(n):
    s=input()
    s=list(s)
    if i == 0:
        ans=s
    else:
        memo=[]
        for l in s:
            if l in ans:
                indexnumber = ans.index(l)
                p = ans.pop(indexnumber)
                memo.append(p)  
        ans=memo

ans.sort()
print(''.join(map(str,ans)))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
ans = str(B)+str(C)
print(int(ans) + A)
# Judge status: Accepted
n=int(input())
s='*'+input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
cnt=0
for i in range(1,n+1):
    for j in range(i,n+1):
        k=2*j-i
        if k>n:
            continue
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            cnt+=1
print(r*g*b-cnt)
# Judge status: Wrong Answer
x = int(input())
if x%11 > 6:
    ans = x//11 *2 +2
elif x %11==0:
    ans = x//11
else:
    ans = x//11 *2 +1
print(ans)
# Judge status: Accepted
inf = 10**9+7

n = int(input())
dp = [inf for i in range(n+1)]
dp[0] = 0
tmp = 1
use = [1]
while tmp*6 <= n:
    tmp *= 6
    use.append(tmp)
tmp = 1
while tmp*9 <= n:
    tmp *= 9
    use.append(tmp)
use.sort()

for i in range(n):
    for num in use:
        if i+1-num >= 0:
            dp[i+1] = min(dp[i+1], dp[i+1-num]+1)
        else:
            break
print(dp[n])
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
answer = 'Yes'
score = 0
for i in range(K):
    score += A[i]

for i in range(N - K):
    next_score = score + A[K + i] - A[i]
    print('Yes' if next_score > score else 'No')
    score = next_score
# Judge status: Accepted
N = int(input())
if N % 1000 == 0:
    print(0)
else:
    print(1000 - N % 1000)
# Judge status: Accepted
x = int(input())
if x==0:
    print("1")
else:
    print("0")
# Judge status: Accepted
def solve():
    N = int(input())
    for i in range(N, 0, -1):
        if (i ** 0.5).is_integer():
            print(i)
            exit()


if __name__ == "__main__":
    solve()
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

colors = [0 for _ in range(8)]
over = 0

for a in A:
    if 3200 <= a:
        over += 1
    else: 
        colors[a // 400] = 1

c = colors.count(1)

maxi = c + over

if c == 0:
    mini = 1
else:
    mini = c

print(mini, maxi)
# Judge status: Accepted
N,x=map(int,input().split())
A=list(map(int,input().split()))
A_1=sorted(A)
num=0
total=0
if A_1[0]>x:
    num=0
elif sum(A_1)>=x:
    for i in range(N):
        total+=A_1[i]
        if total==x:
            num+=1
            break
        elif total>x:
            break
        else:
            num+=1

else:
    num=N-1
print(num)
# Judge status: Accepted
import fractions
n=int(input())
t=[int(input()) for i in range(n)]
ans=t[0]
for i in range(1,n):
    ans=ans*t[i]//fractions.gcd(ans,t[i])
print(ans)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N = i_i()

l = len(str(N))

if l == 1 or l == 2:
    print(min(9, N))
elif l == 3 or l == 4:
    print(9 + N - 100 + 1)
else:
    print(9 + 900 + N - 10000)
# Judge status: Accepted
n, p = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] %= 2
cnt_zero = a.count(0)
cnt_one = n - cnt_zero
ans = 0
def nCk(n, k):
    if k > n - k:
        return nCk(n, n - k)
    ret = 1
    for i in range(k):
        ret *= n - i
    for i in range(k):
        ret //= i + 1
    return ret
ans = 0
c = 0
for i in range(p, cnt_one + 1, 2):
    c += nCk(cnt_one, i)
ans = (2 ** cnt_zero) * c
print(ans)
# Judge status: Wrong Answer
n = input().split();
print(n[0:3])
# Judge status: Wrong Answer
import fractions
N, M = map(int, input().split())
A = [ int(x) for x in input().split() ]

ans = A[0]
for i in range(1, N):
    ans = ans * A[i] // fractions.gcd(ans, A[i])
#print(ans)

#print( M // (ans // 2 ) )
b = M // (ans // 2 )
if b % 2 == 0:
  print( b//2 )
else:
  print( (b+1)//2 )
# Judge status: Accepted
import math

n = int(input())

price = n / 1.08

if int(math.ceil(price) * 1.08) == n:
	print(math.ceil(price))
elif int(math.floor(price) * 1.08) == n:
	print(math.floor(price))
else:
	print(":(")
# Judge status: Accepted
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
x = I()
if x < 600:
    print('8')
elif x < 800:
    print('7')
elif x < 1000:
    print('6')
elif x < 1200:
    print('5')
elif x < 1400:
    print('4')
elif x < 1600:
    print('3')
elif x < 1800:
    print('2')
else:
    print('1')
# Judge status: Wrong Answer
a,b=map(int, input().split())
print(a+b)
# Judge status: Wrong Answer
import itertools

l = list()
for a in range(0, 5):
    l.append(int(input()))

k = int(input())

com = list(itertools.combinations(l, 2))

for a in range(0, len(com)):
    com[a] = list(com[a])
    com[a] = abs(com[a][0] - com[a][1])

ans = 'Yay!'

for a in com:
    if a > k:
        ans = ': ('
        break

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

# print(n, a, b)

ans = 0
for i in range(1, n+1):
  s = str(i)
  t = 0
  for k in range(len(s)):
    t += int(s[k])
  #print(t, i)
  if a <= t and t <= b:
    ans += i
print(ans)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = input()

if s == t:
    print(n)
    exit()

cnt = 0
for i in range(n):
    if s[n-1-i] == t[i]:
        cnt += 1

print(n*2-cnt)
# Judge status: Accepted
import numpy as np
n = int(input())
A, B = [], []
for _ in range(n):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

x = np.median(A)
y = np.median(B)
if n%2==0:
    print(int((y-x)/0.5+1))
else:
    print(int(y-x+1))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
if a[0] >= 1 or n == 0:
    print(1 if a[0] == 1 and n == 0 else -1)
    exit()
b = [0] * (n + 1)
for i in range(1, n + 1):
    b[i] = a[i] + b[i - 1]
v = 1
ans = 1
for i in range(n):
    v = min(b[n] - b[i], 2 * (v - a[i]))
    if v < a[i + 1]:
        print(-1)
        exit()
    ans += v
print(ans)
# Judge status: Accepted
X, K, D = map(int, input().split())

aX = abs(X)
if aX >= K * D:
    ans = aX - K * D
else:
    x = aX % D
    k = K - aX // D
    ans = x if k % 2 == 0 else D - x
print(ans)
# Judge status: Wrong Answer
f=lambda:[*map(int,input().split())]
n,h=f()
A,B=[],[]
for _ in range(n):
  a,b=f()
  A+=[a]
  B+=[b]
m=max(A)
B.sort()
c=0
while h and B and B[-1]>m :
  h-=B.pop()
  c+=1
print(c--h//m)
# Judge status: Accepted

def solve():
    j = 1
    for i in s:
        if i != 1:
            print(i)
            exit()
        if j==K:
            print(i)
            exit()
        j += 1
    print(1)

if __name__=="__main__":
    S = input()
    K = int(input())
#    d = 5*10**15
    s = [int(c) for c in S]
#    print(s)
    solve()
# Judge status: Accepted
a,b,c = map(int, input().split())
k = int(input())
 
for i in range(k):
    if b<=a:
        b*=2
    elif c<=b:
        c*=2

if c>b and b>a:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
s=input()
if s[2]==s[3] and s[4]==s[5]:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B, X = map(int, input().split())
    print(B // X - (A - 1) // X)


if __name__ == "__main__":
    main()
# Judge status: Accepted
K, X = map(int, input().split())
if (X-K+1 > -1000000) and (X+K < 1000000):
  print(' '.join([str(i) for i in range(X-K+1, X+K)]))
elif (X-K+1 < -1000000) and (X+K < 1000000):
  print(' '.join([str(i) for i in range(-1000000, X+K)]))
elif (X-K+1 > -1000000) and (X+K > 1000000):
  print(' '.join([str(i) for i in range(X-K+1, 1000000)]))
elif (X-K+1 < -1000000) and (X+K > 1000000):
  print(' '.join([str(i) for i in range(1000000, 1000000)]))
# Judge status: Accepted
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())

    res = []
    while N != 0:
        r = N % 2
        if r < 0:
            r += 2
        N = (N - r) // (-2)
        res += [str(r)]
    res = res[::-1]
    if len(res) == 0:
        print(0)
    else:
        print(''.join(res))


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
candies = [a, b, c]
candies.sort()

if candies[0] + candies[1] == candies[2]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a,b = map(int, input().split())
if a < b:
    print(a)
else:
    print(a-1)
# Judge status: Wrong Answer
import math
n, a, b = map(int, input().split())

count = 2**n % 1000000007 - 1 # 全部
a = (math.factorial(n) / math.factorial(n - a)/math.factorial(a)) % 1000000007
b = (math.factorial(n) / math.factorial(n - b)/math.factorial(b)) % 1000000007

ans = (count - a - b)

print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
a = []
b = []
for _ in range(n):
  a.append(input())
for _ in range(m):
  b.append(input())
for i in range(n-m+1):
  if b[i] in a[i]:
    for x in range(m-1):
      if b[i+x] not in a[i+x]:
        print("No")
        exit()
    print("Yes")
    exit()
  else:
    print("No")
    exit()
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read

import math
n, *lst = map(int, read().split())
t = prep = math.ceil(n / lst[0])
for i in lst[1:]:
  tt = math.ceil(n / i)
  if tt <= prep:
    t += 1
  else:
    t += 1 + tt - prep
    prep = tt
print(t)
# Judge status: Wrong Answer
def main():
	n,m = map(int, input().split())
	if n==m:
		print('Yes')
	else:
		print('no')
main()
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = 0
b = ((n-1)//2)//2
for i in range(m):
    if i > b:
        a = 1
    print(i+1, n-i-a)
# Judge status: Wrong Answer
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    
    if N < 105: print(0)
    elif N < 165: print(1)
    else: print(2)


if __name__ == '__main__':
    main()
# Judge status: Accepted
p, q, r = map(int, input().split())
print(min(p+q, min(q+r, r+p)))
# Judge status: Accepted
N = int(input())
W = list(map(int, input().split()))
C = [ ]
for i in range(N):
  x = abs(sum(W[:i+1]) - sum(W[i+1:]))
  C.append(x)
print(min(C))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
scr = 0
ai_1 = float('Inf')
for ai in a:
    scr += b[ai-1]
    if ai_1 + 1 == ai:
        scr += c[ai_1-1]
    ai_1 = ai
print(scr)
# Judge status: Wrong Answer
# coding: utf-8
N=int(input())
S=list(input())

l=0
r=0
pl=0
pr=0


for i in range(N):
    if S[i]==")":
        r+=1
        if l<r:
            pl+=1
        else:
            pr-=1
    else:
        l+=1
        pr+=1

sl=["(" for i in range(pl)]
sr=[")" for i in range(pr)]

ans=sl + S + sr

print("".join(ans))
# Judge status: Accepted
a,b,c,k=map(int,input().split())

if a>=k:
  print(k)
elif a+b>=k:
  print(a)
else:
  d=k-a-b
  print(a-d)
# Judge status: Accepted
from itertools import *
n=int(input())
s=input()
w=[0]*(n+1)
b=[0]*(n+1)
for i,j in enumerate(s):
  if j=='.':w[i]=1
  else:b[i+1]=1
for i in range(n):
  w[n-i-1]+=w[n-i]
  b[i+1]+=b[i]
ans=10**18
for i,j in zip(w,b):
  ans=min(ans,i+j)
print(ans)
# Judge status: Wrong Answer
# # -*- coding: utf-8 -*-
import itertools

i = []
j = []
k = []

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

for s, d in enumerate(S):
  if d == 'R':
    i.append(s)
  elif d == 'G':
    j.append(s)
  elif d == 'B':
    k.append(s)
l_p = list(itertools.product(i, j, k))

counter = 0
for item in l_p:
    if not item[2] - item[1] == item[1] - item[0]:
        counter += 1
print(counter)
# Judge status: Accepted
N = [int(i) for i in input()]
a = sum(N)
b = 9 * (len(N) - 1) + N[0] - 1
print(max(a,b))
# Judge status: Wrong Answer
W,a,b = map(int, input().split())

if a <= b <= a+W:
    print(0)
else:
    if a+W < b:
        print(abs(b-(a+W)))
    elif b+W < a:
        print(abs(a-(b+W)))
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from itertools import accumulate as acc
def gcd(a,b):
    while b: a, b = b, a%b
    return a
def main():
    n = II()
    aa = MII()
    b = list(acc([0]+aa, gcd))
    c = list(acc([0]+aa[::-1], gcd))
    print(max(gcd(s,t) for s, t in zip(b, c[::-1][1:])))


if __name__ == '__main__':
    main()
# Judge status: Accepted
S = input()
T = input()

S_d = dict()
T_d = dict()
for i in range(len(S)):
    S_d.setdefault(S[i], T[i])
    if S_d[S[i]] != T[i]:
        print('No')
        exit(0)
    T_d.setdefault(T[i], S[i])
    if T_d[T[i]] != S[i]:
        print('No')
        exit(0)
print('Yes')
# Judge status: Wrong Answer
d=input()
abhm=d.split()

import math
A = int(abhm[0])
B = int(abhm[1])
H = int(abhm[2])
M = int(abhm[3])
c_2=A**2+B**2-2*A*B*math.cos(abs((M*0.5+H*30)-M*6))
C=math.sqrt(c_2)
print(C)
# Judge status: Accepted
a, b = map(int, input().split())
if a>12:
    print(b)
elif 5<a<13:
    print(b//2)
else:
    print(0)
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a.sort()
cnt=0
if a[1]!=a[2]:
    cnt=a[2]-a[1]
    a[0]+=cnt
    a[1]+=cnt
if a[1]==a[0]+1:
    a[1]+=1
    a[2]+=1
    cnt+=1
if a[0]!=a[1]:
    n=int((a[1]-a[0])/2)
    cnt+=n
    #a[0]+=(n*2)
print(cnt)
# Judge status: Accepted
N = int(input())

As = sorted(map(int, input().split()), reverse=True)

score = As[0]
counter = 0
index = 1

for i in range(2, N):
  score += As[index]
  if counter == 0:
    counter += 1
  else:
    counter -= 1
    index += 1
    
print(score)
# Judge status: Wrong Answer
s=input()

#print(s.count(">"), s.count("<"))
#print(len(s))

ans=0
for i in range(1, s.count(">")+1):
  ans+=i
print(ans)
# Judge status: Accepted
from collections import Counter
N = int(input())
a = [int(input()) for i in range(N)]
C = Counter(a)
ans = 0
for v in C.values():
    if v%2==1:
         ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
n = round((N // 2) ** 0.5)
for i in range(1, n+1):
    print(i)
print(N - n*(n+1)// 2)
# Judge status: Wrong Answer
A, B = map(float,input().split(' '))
print(int((A*B)//1))
# Judge status: Accepted
n = int(input())
s = []
for i in range(n):
    s.append(int(input()))
x = 0
t = []
for i in range(n):
    if s[i]%10 == 0:
        t.append(i)
        x += s[i]
cnt = 0
for i in t:
    del s[i-cnt]
    cnt += 1
s.sort()
while sum(s)%10 == 0 and len(s)>0:
    del s[0]
if sum(s) == 0:
    print(0)
else:
    print(sum(s)+x)
# Judge status: Wrong Answer
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N = i()
a = l()
a.sort()
print(sum(a[N+1:3*N-N+1]))
# Judge status: Wrong Answer
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
A, B = [], []
for i in range(N):
	a, b = rl()
	A.append(a)
	B.append(b)

A.sort()
B.sort(reverse=True)

i = (N-1)//2

print(B[i]-A[i]+1)
# Judge status: Wrong Answer
s=list(map(int,input().split()))
print(s.count("1"))
# Judge status: Wrong Answer
D, T, S = [int(i) for i in input().split()]
print(D, T, S)
if D/S <= T:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, M = map(int, input().split())

AB = [tuple(map(int,input().split())) for i in range(M)]

es = [[] for _ in range(N)]
for a, b in AB:
    es[a-1].append(b-1)
    es[b-1].append(a-1)

ans = [-1] * N
ans[0] = 0

import queue
que = queue.Queue()
que.put(0)

while que.qsize():
    s = que.get()
    for v in es[s]:
        if ans[v] == -1:
            ans[v] = s+1
            que.put(v)

print("Yes")
print(*ans[1:], sep="\n")
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
l=[1]*n
z=1
d={'r':0,'s':0,'p':0}
for i in range(n):
    if i-k>=0 and l[i]:
        if t[i]==t[i-k]:
            if i+k<n:
                l[i+k]=0
                continue
        else:
            d[t[i]]+=1
    else:
        d[t[i]]+=1   
score=d['r']*p+d['s']*r+d['p']*s
print(score)
# Judge status: Accepted
a,b = map(int, input().split())
print("unsafe" if a <= b else "safe")
# Judge status: Accepted
n = int(input())
A = sorted(list(map(int, input().split())))

while len(A) > 1:
    A = sorted([i%A[0] for i in A if i%A[0]!=0] + [A[0]])
print(A[0])
# Judge status: Accepted
#C
x = int(input())
ans = x//11

if x - 11*ans > 6:
    print(2*ans+2)
elif x - 11*ans == 0:
    print(2*ans)
else:
    print(2*ans+1)
# Judge status: Accepted
import sys
from collections import Counter
N, K, Q = map(int, input().split())

result = ["No"]*N
Npoint = [K-Q]*N

Alist = [int(input())-1 for _ in range(Q)]

if K > Q:
    for _ in range(N):
        print("Yes")
    sys.exit()

Alist = Counter(Alist)

for k, v in Alist.items():
    Npoint[k] += v
    if Npoint[k] >= 1:
        result[k] = "Yes"

for i in result:
    print(i)
# Judge status: Accepted
n,m = map(int,input().split())
X = sorted(map(int,input().split()))
D = []

for i in range(m-1):
  D.append(X[i+1]-X[i])

print(sum(sorted(D)[::-1][n-1:]))
# Judge status: Accepted
N = int(input())
s = str(input())
t = str(input())

if s==t:
    print(len(s))
    exit()

for i in range(1,N+1):
    ans = s + t[-i:]
    if ans[-N:] == t:
        break
print(len(ans))
# Judge status: Wrong Answer
a,b = map(int,input().split())
s = input()
sw = 0
for i in range(len(s)):
    if i == a and s[i] != '-':
        sw = 1
    elif i != a and s[i] == '-':
        sw = 1
    else:
        pass
if sw == 1:
    print('No')
else:
    print('Yse')
# Judge status: Accepted
X,Y,Z=map(int,input().split())
print(X*Y//2)
# Judge status: Accepted
# https://drken1215.hatenablog.com/entry/2020/04/05/150900
def abc161_d():
  k = int(input())
  lunlun = []

  def rec(d, val):
    # 答えリストに追加
    lunlun.append(val)
    # 10桁で打ち止め
    if d == 10: return
    # 次の桁を生成
    for j in range(-1, 2):
      add = val % 10 + j
      if 0 <= add and add <= 9:
        rec(d+1, val*10 + add)

  # メイン
  for i in range(1, 10):
    rec(1, i)
  lunlun.sort()
  ans = lunlun[k-1]
  print(ans)

abc161_d()
# Judge status: Accepted
N,M=map(int,input().split())
A=[input() for i in range(N)]
B=[input() for i in range(M)]
ans = "Yes"
for i in A:
  for j in B:
    if j not in i:
      ans = "No"
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
s=input()
if 1<=a<=5 and 1<=b<=5:
    if s[a]=="-":
        if s[0:a].isdecimal() and s[a+1:a+b+1].isdecimal():
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

low = 0
high = max(a)

while low + 1 < high:
    mid = (low + high) // 2
    m = 0
    for x in a:
        m += (x - 1) // mid
    
    if m <= k:
        high = mid
    else:
        low = mid

print(high)
# Judge status: Wrong Answer
n,a,b = list(map(int, input().split()))
if n == 1:
    print(0)
elif a>b:
    print(0)
else:
    MIN = a * (n-1) + b
    MAX = a * 1 + b * (n-1)
    print(MAX-MIN+1)
# Judge status: Wrong Answer
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**6)

def solve(a,b,c,counter=0):
    if a == b == c:
        return -1
    elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
        return counter
    else:
        return solve((b+c)//2,(c+a)//2,(a+b)//2,counter+1)


def main():
    A, B, C = map(int,input().split())
    print(solve(A,B,C))

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b,t=map(int,input().split())
t//=a
print(a*t)
# Judge status: Wrong Answer
S = input()
T = input()

for _ in range(len(S)):
    if S == T:
        print('Yes')
    else:
        S = S[-1] + S[:-1]

print('No')
# Judge status: Accepted
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())
b = [int(input()) for i in range(N)]
judge = 0

for i in range(3):
  for j in range(3):
    if A[i][j] in b:
      A[i][j] = 0
  
for i in range(3):
  if A[i][0] + A[i][1] + A[i][2] == 0 or A[0][i] + A[1][i] + A[2][i] == 0 or A[0][0]+A[1][1]+A[2][2] ==0 or A[2][0]+A[1][1]+A[0][2] ==0:
    judge += 1
  
  else:
    judge += 0
    
if judge >= 1:
  print('Yes')
  
else:
  print('No')
# Judge status: Accepted
x, k, d = map(int, input().split())

x_ = abs(x)

if x_ >= d * k:
    print(x_ - d*k)
    exit(0)

a = x_ % d
b = - (a - d)
k_ = x_ // d
l = k - k_

if l % 2 == 0:
    print(a)
else:
    print(b)
# Judge status: Wrong Answer
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

H,Y=map(int,input().split())
print(H*Y//2)
# Judge status: Wrong Answer
list=list(map(int,input().split()))
x=list[0]
k=list[1]
if list[0]>=list[1]:
  x=x%k
z=k-x
if z >=x:
  print(x)
else:
  print(z)
# Judge status: Accepted
#２つのリストを使う場合
rL=list(input())#右のリストに入力
lL=[]
Q=int(input())
for i in range(Q):
  N=list(input().split())
  if N[0]=="1":#反転させる場合は右と左を入れ替える
    lL,rL=rL,lL
  elif N[1]=="1":#先頭の場合は左のリストに
    lL.append(N[2])
  else:#末尾の場合は右のリストに
    rL.append(N[2])
lL.reverse()#左のリストの向きを入れ替える
print("".join(lL)+"".join(rL))
# Judge status: Accepted
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    S = input()
    if S[-1] == 's':
        print(S + 'es')
    else:
        print(S + 's')


main()
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
ans=0
for i in range(N):
    if B[i]>(A[i]+A[i+1]):
        ans+=(A[i]+A[i+1])
        A[i+1]=0
    elif B[i]>A[i]:
        ans+=B[i]
        A[i+1]-=(B[i]-A[i])
    elif B[i]<=A[i]:
        ans+=B[i]
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=a[0]
for i in range(n-1):
    ans+=(2**i)*a[i+1]
print(ans/(2**(n-1)))
# Judge status: Accepted
def main():
    n = input()[::-1]
    a = 0
    borrow = False
    for i in enumerate(n):
        if i[0] == len(n)-1:
            if borrow:
                a += int(i[1])-1
            else:
                a += int(i[1])
        else:
            if int(i[1]) < 9:
                borrow = True
            a += 9
    print(a)
        
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))

m = 10**18
for i in range(1, n):
    d = abs(sum(w[0:i]) - sum(w[i:n]))
    m = min(d, m)

print(m)