peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
s = input()
ans = 'NO'
pattern = 'keyence'
for i in range(len(pattern) - 1):
    x = pattern[:i]
    y = pattern[i:]
    if s.find(x) >= 0:
        if s.find(y, s.find(x) + len(x) - 1) >= 0:
            ans = 'YES'
            break

print(ans)
# Judge status: Wrong Answer
a,b = map(int,input().split())
s = input()

lst = s.split("-")
#print(lst)
if len(lst[0]) == a and len(lst[1]) == b and len(lst) == 2:
    print("Yes")
else:
    print("no")
# Judge status: Accepted
a, b, h = [int(input()) for x in range(3)]
ans = (a + b) * h // 2
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a + b + c <= 21:
    print("win")
else:
    print("burst")
# Judge status: Wrong Answer
*A, = list(input())
s = ['+', '-']
for i in range(2**3):
    formula = A[0]
    for j in range(3):
        if i >> j & 1:
            formula += s[0]
        else:
            formula += s[1]
        formula += A[j+1]
    if eval(formula) == 7:
        print(formula)
        exit()
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print("Yes" if a<=c<=b else "No")
# Judge status: Accepted
S = input()
max_ctr = 0
ctr = 0

for i in range(len(S)):
    if (S[i] == 'A' or S[i] == 'T' or S[i] == 'C' or S[i] == 'G'):
        ctr += 1
        max_ctr = max(ctr, max_ctr)
    else:
        ctr = 0

print(max_ctr)
# Judge status: Wrong Answer
N,P = map(int, input().split())
A = list(map(int, input().split()))
in_odd = False
for i in range(N):
    if A[i]%2:
        in_odd = True
        break
if not in_odd:
    if P == 0:
        print(0)
else:
    print(2**(N-1))
# Judge status: Accepted
a,b,c=map(int,input().split())
print("Yes"if a<=c<=b or b<=c<=a else "No")
# Judge status: Accepted
a,b=map(int,input().split())

astr=( str(a) * b )
bstr=( str(b) * a )

print(astr if astr < bstr else bstr)
# Judge status: Accepted
N = [int(c) for c in input()][::-1]
N.append(0)
ans = 0
for i in range(len(N)):
    c = N[i]
    if c <= 4:
        ans += c
    elif 6 <= c:
        ans += 10 - c
        N[i + 1] += 1
    else:
        if N[i + 1] < 5:
            ans += c
        else:
            ans += 10 - c
            N[i + 1] += 1
print(ans)
# Judge status: Wrong Answer
l,r=map(int,input().split())
x=[]
if (r-l)>=2019:
    print(0)
else:
    for i in range(l,r+1):
        x.append(i%2019)
    x.sort()
    print((x[0]*x[1])%2019)
# Judge status: Wrong Answer
n = int(input())
alphabet = [chr(i) for i in range(97, 123)]
ans = list()
for i in reversed(range(12)):
    if x := n // (26 ** i):
        ans.append(alphabet[x - 1])
        n %= 26 ** i
print("".join(ans))
# Judge status: Wrong Answer
s = [str(x) for x in input()]
s.sort()

s = "".join(s)

print(s)
# Judge status: Accepted
input()
a=c=t=0
for i in map(int,input().split()):
  if i>t: c=0
  else: c+=1; a=max(a,c)
  t=i
print(a)
# Judge status: Accepted
s = list(input())
s.reverse()
s.append('0')

dp = [[1000000000] * 2 for _ in range(1000005)]
dp[0][0] = 0
n = len(s)
for i in range(n):
    for j in range(2):
        x = int(s[i])
        x += j
        if x < 10:
            dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + x)
        if x > 0:
            dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + (10 - x))

ans = dp[n][0]
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
step = max(A)-min(A)
print(step)
# Judge status: Accepted
N = int(input())
dmin = N+N
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        dmin = min(dmin,i+N//i-2)
print(dmin)
# Judge status: Accepted
# Keyence B

N = int(input())
robot_list = []
robot_count = 0

for _ in range(N):
    x, l = map(int, input().split())
    robot_list.append([x + l, x - l])

robot_list.sort()
r = - 10**9 - 1

for i in range(N):
    if r <= robot_list[i][1]:
        robot_count += 1
        r = robot_list[i][0]

print(robot_count)
# Judge status: Accepted
from itertools import accumulate

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

for j in range(k):
    a01 = [0] * (n + 1)
    for i, ai in enumerate(a):
        l, r = max(0, i - ai), min(i + ai + 1, n)
        a01[l] += 1
        a01[r] -= 1
    a = list(accumulate(a01))[:-1]
    if all(ai == n for ai in a):
        break
print(*a)
# Judge status: Accepted
import sys
N = int(input())
if(N==1):
  print(1)
  sys.exit()
L=[2,1]
for i in range(N - 1):
  t=L.pop(0) + L[0]
  L.append(t)
print(L[-1])
# Judge status: Wrong Answer
st=input()
for i in range(2,len(st),2):
    r=st[0:i]
    if r[0:i//2]==r[i//2:]:
        print(i)
# Judge status: Accepted
# import numpy as np
# from itertools import permutations
# from itertools import combinations
# from itertools import combinations_with_replacement
# import queue
# import heapq


def main():
    N, K = map(int, input().split())

    sunuke = [True for _ in range(N)]

    for i in range(K):
        d = input()
        ds = list(map(int, input().split()))

        for s in ds:
            sunuke[s-1] = False

    print(sum(sunuke))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))

    c0 = 0
    c4 = 0

    for ai in a:
        if ai % 2 != 0:
            c0 += 1
        if ai % 4 == 0:
            c4 += 1

    if c0 > c4 + 1:
        print('No')
    else:
        print('Yes')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Judge status: Wrong Answer
x=int(input())
b=[False for i in range(x)]
for i in range(1,x+1):
    for j in range(2,x+1):
        if i**j<=x:
            b[i**j-1]=True
        else:
            break
for i in range(len(b),0,-1):
    if b[i-1]==True:
        print(i)
        exit()
# Judge status: Wrong Answer
a,b,c=list(map(int,input().split()))
if (a**0.5+b**0.5)<(c**0.5):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n=int(input())

def sum0f(n):
    sum=0
    while n>0:
        sum+=n%10
        n//=10
    return sum

list=[]    
for a in range(1,n):
    list.append(sum0f(a)+sum0f(n-a))
    
print(min(list))
# Judge status: Accepted
A, B, C = map(int, input().split())
if A > B:
    A, B = B, A
print("Yes") if A < C < B else print("No")
# Judge status: Accepted
import numpy as np 
import math

S = str(input())
if S == "ABC":
    print("ARC")
else:
    print("ABC")
# Judge status: Accepted
n = list(map(int, list(str(input()))))
ans = sum(n)
ans = max(ans, n[0] - 1 + 9 * (len(n) - 1))
print(ans)
# Judge status: Accepted
import math
n = int(input())

for i in range(n,0, -1):
    if math.sqrt(i) - int(math.sqrt(i)) == 0:
        print(i)
        break
# Judge status: Accepted
N = int(input())
S = input()
ans = 0
for i in range(1, N):
    X, Y = S[:i], S[i:]
    temp = set(X) & set(Y)
    ans = max(ans, len(temp))
print(ans)
# Judge status: Wrong Answer
# N = int(input())
N=100

if N % 2  == 0:
    print("0.5000000000")
else:
    tmp = (N+1)/2
    print(tmp/N)
# Judge status: Wrong Answer
N = int(input())
A = int(input())

total = N

for i in range(1, 100):
    if total - 500*i == 0:
        print('Yes')
        break
    elif total - 500*i < 0:
        total = total - 500*(i - 1)
        break

        
if total - A > 0:
    print('No')
else:
    for j in range(A + 1):
        total = total - 1
        if total == 0:
            print('Yes')
            break
# Judge status: Accepted
N = int(input())
s = input()
max = 0

for i in range(1, len(s)):
    u = len(set(s[:i]).intersection(set(s[i:])))
    if u > max:
        max = u

print(max)
# Judge status: Wrong Answer
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
for i in range(n):
  temp = 12 - h[i]*0.006
  k = abs(a-temp)
  if i == 0:
    ans = i+1
  else:
    if k>temp:
      ans = i+1
print(ans)
# Judge status: Wrong Answer
H, W = [int(x) for x in input().split(" ")]

if H*W%2 == 0:
  print(int(H*W/2))
else:
  print(int(H*W/2)+1)
# 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())
N = I()
ans = 0
for i in range(31625):
    if i*i > N:
        break
    else:
        ans = i*i
print(ans)
# Judge status: Wrong Answer
S = input()
s = list()
for a in S:
    s.append(a)

even = s[1::2]
odd = s[0::2]

if 'L' in even and 'R' in odd:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S = {'a':[], 'b':[], 'c':[]}

for char in ['a', 'b', 'c']:
    S[char] = [c for c in input()]

# 今誰のターンか, 終了フラグ
now = 'a'
end = 0

while end == 0:
    # もしもうカードがなければ終了
    if len(S[now]) == 0 :
        print(now)
        end = 1
    else :
        # 先頭を取得しnow更新, 文字を詰める
        now = S[now].pop(0)
# Judge status: Wrong Answer
N,H=list(map(int,input().split()))
a=[0]*N
b=[0]*N

for i in range(N):
    ta,tb=list(map(int,input().split()))
    a[i]=ta
    b[i]=tb

amax=max(a)
b.sort(reverse=True)

res=10**10
csum=0
for i in range(N+1):
    cnt=i
    ch=H
    csum+=b[i-1] if i>0 else 0
    ch-=csum

    if H>0:
        cnt+=-(-ch//amax)

    res=min(res,cnt)

print(res)
# Judge status: Accepted
i, j = map(int, input().split())

if (i + j) % 3 != 0 or (max(i, j) / min(i, j) > 2):
  print(0)
else:
  TW = (i + j) // 3
  W = (TW - (i-j)) // 2

  def mod_cmb(n, r, mod=10**9+7):
      r = min(r, n-r)
      res = 1
      for i in range(r):
          res = res * (n - i) % mod * pow(i+1, mod-2, mod) % mod
      return res

  print(mod_cmb(TW, W))
# Judge status: Accepted
# C - When I hit my pocket...

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

if B - A <= 2:
    print(1 + K)
else:
    n_change = (K-(A-1)) // 2
    if n_change == 0:
        print(1 + K)
    else:
        print(n_change * B - (n_change-1) * A + (K - 2*n_change - (A-1)))
# Judge status: Accepted
A,B,C = map(int, input().split())
r = max(A,B,C)*9 + A+B+C
print(int(r))
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if(b<0 or d<0):
  if(b>=0 or d>=0):
    print(0)
  else:
    print(a*b)
else:
  print(b*d)
# Judge status: Wrong Answer
K = int(input())
AB = input()
l = AB.split()
A = int(l[0])
B = int(l[1])
li = []
for i in range(A, B+1) : 
  if i % K == 0 :
    li.append(i)
  else :
    continue
if len(li) >=1 :
  print("YES")
else : 
  print("NO")
# Judge status: Wrong Answer
N = int(input())
ans = 0
for i in range(N):
  ans += max(list(map(int,input().split())))
print(ans)
# Judge status: Wrong Answer
k,x=map(int,input().split())

if 500*k > x:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from fractions import gcd
from functools import reduce

def lcm(a,b):
    return (a*b)//gcd(a,b)

def lcm_list(l):
    return reduce(lcm, l)


def solve():
    N = int(input())
    T = [int(input()) for _ in range(N)]
    print(lcm_list(T))
# Judge status: Wrong Answer
x = input()
if x.endswith("s") == True:
  x = x + "es"
else:
  x = x + "s"
# Judge status: Accepted
s = input()
while (True):
    s = s[:len(s) - 2]
    ls = len(s)
    if s[ls // 2:] == s[:ls // 2]:
        break
print(len(s))
# Judge status: Wrong Answer
N, K = map(int, input().split())
R, S, P = list(map(int, input().split()))
T = list(input())

result = [0] * N
for i,t in enumerate(T):
    if t == "r":
        result[i] = P
    elif t == "s":
        result[i] = R
    else:
        result[i] = S

for i in range(K-1, N):
    if result[i] == result[i-K]:
        result[i] = 0
print(sum(result))
# Judge status: Wrong Answer
n=int(input())
abc=list("abcdefghijklmnopqrstuvwxyz")
D={}
for a in abc:
    D[a]=0

for i in range(n):
    s=input()
    for a in abc:
        now=D[a]
        num=s.count(a)
        if i==0:
            D[a]=num
        else:
            D[a]=min(now,num)
ans=""
for s,v in D.items():
    ans+=s*v
print(ans)
# Judge status: Wrong Answer
import sys,math
input = sys.stdin.readline

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
cnt = 0

for i in range(N):
  for j in range(N):
    num = 0
    if i < j:
      for k in range(D):
        num += pow(abs(X[i][k] - X[j][k]) ,2)
  if math.floor(math.sqrt(num)) ** 2 == num:
    cnt += 1

print(cnt)
# Judge status: Wrong Answer
n,x = map(int,input().split())
L = list(map(int,input().split()))

cnt = 0
L = [0]+L+[0]

for i in range(1,n+1):
    a = L[i-1] + L[i+1]
    if a >= x:
        cnt +=a-x
        if i !=1:
            L[i-1],L[i+1] = x, 0
        else:
            L[i-1],L[i+1] = 0, x
print(cnt)
# Judge status: Wrong Answer
K = int(input("enter a number: "))
S = input("enter a random string: ")
def f(K, S):
    if 0 < K < 101 and 0 < len(S)+1 < 101:
        if len(S) < K:
            return S
        else:
            M = len(S) - K
            return S[0:M] + "..."
    elif K > 100 or K < 1:
        return "Please choose an interger from 1 to 100"
    elif len(S) > 100 or len(S) < 1:
        return "Please enter at least at least 1 string and not more than 100"

print (f(K, S))
# Judge status: Accepted
a = int(input())

print((a - a//2) / a)
# Judge status: Wrong Answer
n=int(input())
if n%111==0:
  print(n)
else:
  print((n//111)+1)
# Judge status: Accepted
arr = input().split()
arr = list(map(int, arr))
a = arr[0]
b = arr[1]
x = arr[2]

if a <= x and x <= a+b:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a%b == 0:
    d = a / b
else:
    d = int(a / b) + 1
    
print("{}".format(d * c))
# Judge status: Accepted
N,*A =map(int,open(0).read().split())
B =sorted(A)
biggest = B[-1]
for i in A:
  if i==biggest:
    print(B[-2])
  else:
    print(biggest)
# Judge status: Accepted
n = int(input())
a = [int(s) for s in input().split()]

sum1 = 0
count = 0
total_length = sum(a)

for i in range(len(a)):
    sum1 += a[i]
    if sum1 >= total_length / 2:
        count1 = abs(sum1 - sum(a[i + 1:]))
        count2 = abs(sum1 - a[i] - sum(a[i:]))
        if count1 <= count2:
            count = count1
        else:
            count = count2
        break
print(count)
# Judge status: Accepted
import numpy as np

D = int(input())
c = np.array( list(map(int, input().split())) )
#
s = [[] for i in range(D)]
for i in range(D):
  s[i] = np.array( list(map(int, input().split())) )
#
v = 0
cc =  np.array( [0]*26 )
last = np.array( [-1]*26 )
for d in range(D):
  cc += c
  av = s[d] - sum( cc ) + cc
  av2 = av + cc*min((D-d-1),6)
  m = max(av2)
  for t in range(26):
    if av2[t] == m:
      cc[t] = 0
      v += av[t]
      print(t+1)
      break
#
#print( v )
# Judge status: Accepted
N = int(input())
A = input()
w = [A[0] == "W"]
for i in range(1, N):  w.append(w[-1] + (A[i] == "W"))
e = [A[0] == "E"]
for i in range(1, N):  e.append(e[-1] + (A[i] == "E"))
ans = min(e[-1] - e[0], w[-2])
for i in range(1, N - 1):  ans = min(ans, w[i - 1] + e[-1] - e[i])
print(ans)
# Judge status: Accepted
import random
import sys
import time

input = sys.stdin.readline

def main():
    # start_time = time.time()
    # while True:
    #     elapsed_time = time.time() - start_time
    #     if elapsed_time >= 2.0:
    #         print(elapsed_time)
    #         return 0
    d = int(input())
    c = list(map(int, input().split()))
    s = []
    for _ in range(d):
        s.append(list(map(int, input().split())))
    for _ in range(d):
        print(1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
A,B,K = map(int,input().split())
i = 1
S =[]
while i <= min(A,B):
  if A%i ==0 and B%i == 0:
    S.append(i)
  i += 1

print(S[-K])
# Judge status: Accepted
import numpy as np
n = int(input())
res = [0]*(n+1)
for i in range(1,101):
    for j in range(1,101):
        for k in range(1,101):
            x = i*i + j*j + k*k + i*j + j*k + k*i
            if x <= n:
                res[x] += 1
for i in range(1,n+1):
    print(res[i])
# Judge status: Accepted
n = int(input())
s = input()
mod = 1000000007
alphacnt = [0]*26
ans = 0
for c in s[::-1]:
    idx = ord(c)-ord("a")
    alphacnt[idx] += 1
    cnt = 1
    for i in range(26):
        if i == idx: continue
        cnt = (cnt*(alphacnt[i]+1))%mod
    ans = (ans+cnt)%mod
print(ans)
# Judge status: Accepted
n = int(input())
s = input()

r = 0
w = 0
for i in range(n):
    if(s[i] == "R"): r += 1
    else: w += 1

ngr = 0
ngw = 0
for i in range(n):
    if(i < r and s[i] == 'W'): ngw += 1
    if(i >= r and s[i] == 'R'): ngr += 1

print(min(ngw, ngr) + abs(ngw-ngr))
# Judge status: Accepted
import math

k = int(input())
kl = [i for i in range(1, k+1)]


total = 0
dp = {}
for i in kl:
    for j in kl:
        tmp = math.gcd(i, j)
        for k in kl:
            total += math.gcd(tmp, k)


print(total)
# Judge status: Wrong Answer
n, m = map(int, input().split())
arr_ = [tuple(map(int, input().split())) for _ in range(m)]
one = set([b for a, b in arr_ if a == 1])
last = set([a for a, b in arr_ if b == n])
connect = one & last
print("POSSIBLE" if len(connect) >= 1 else "POSSIBLE")
# Judge status: Wrong Answer
x,y=map(int,input().split())
if y%x==0:
    print(-1)
else:
    print(x)
# Judge status: Accepted
A,B,C,K = list(map(int,input().split()))
if abs(A-B) > 10**18:
    print('Unfair')
    exit()
if K % 2 == 0:
    print(A-B)
else:
    print(B-A)
# Judge status: Accepted
n = int(input())
count = 0
for i in range(1, n+1):
    if len(str(i)) % 2 == 1:
        count += 1
print(count)
# Judge status: Accepted
N = int(input())
 
count = 0
for a in range(1, N):
    ans, mod = divmod(N, a)
    if mod == 0:
        count += ans - 1
    else:
        count += ans
 
print(count)
# Judge status: Wrong Answer
# coding: utf-8
import heapq
n, m = map(int, input().split())
jobs = [[] for i in range(m)]
for i in range(n):
    a, b = map(int, input().split())
    if a > m:
        continue
    jobs[m-a].append(b)
ans = 0
l = []
for i in range(m-a, -1, -1):
    for j in jobs[i]:
        heapq.heappush(l, -j)
    if len(l):
        ans += -heapq.heappop(l)
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for i in a:
    ans *= i
    if ans > pow(10, 18):
        print(-1)
        exit()
print(ans)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = 0
if n > k:
    print((n - k) * y + k * x)
else:
    print(n * x)
# Judge status: Accepted
N = int(input())
ans = N // 11 * 2
N %= 11
if N == 0:
    print(ans)
elif N <= 6:
    print(ans+1)
else:
    print(ans+2)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse = True)
HW = []
PCN = [-1]*3
for i in range(1,N):
  PCN[:1]=PCN[1:]
  PCN[2]=A[i]
  if PCN[2]==PCN[1] and PCN[1]!=PCN[0]:
    n = A.count(A[i])
    HW += [A[i]]*(n//2)
  if len(HW)>=2:
    break
HW = HW + [0,0]
print(HW[0]*HW[1])
# Judge status: Accepted
print('Yes' if '7' in input() else 'No')
# Judge status: Accepted
s = input()
x = len(s)
a = s.count('a')
b = s.count('b')
c = s.count('c')

if x % 3 == 0:
  if a == b == c:
    print('YES')
  else:
    print('NO')
elif x % 3 == 1:
  if a == b + 1 == c + 1 or b == a + 1 == c + 1 or c == a + 1 == b + 1:
    print('YES')
  else:
    print('NO')
else:
  if a == b == c + 1 or b == c == a + 1 or c == a == b + 1:
    print('YES')
  else:
    print('NO')
# Judge status: Wrong Answer
a, b = map(int, input().split())
ans = max(a, b)

if a-1 > b:
    ans += a-1
elif a < b-1:
    ans += b-1
else: ans += a

print(ans)
# Judge status: Accepted
x = int(input())
if x <30:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
N, R = map(int, input().split())
 
if N >= 10: print(R)
else: print(R + 100*(10-N))
# Judge status: Accepted
# A - Dividing a String
S = input()

arr = [S[0]]
i = 1

while i < len(S):
	s = S[i]
	
	if s == arr[-1]:
		if i + 1 < len(S):
			i += 1
			s += S[i]
		else:
			arr[-1] += s
			break
	
	arr.append(s)
	i += 1

print(len(arr))
# Judge status: Accepted
a,b =(int(x) for x in input().split())

if (a*b)%2==0:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
ans = 0

for i in range(N):
    ans += int(a[2*i+1])

print(ans)
# Judge status: Accepted
N = int(input())
S = str(input())
ans = 0
tmp = 0
for i in range(N):
    if S[i] == 'I':
        tmp += 1
    else:tmp -= 1

    ans = max(ans,tmp)

print(ans)
# Judge status: Accepted
X = int(input())
if X >= 30:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort()
p.reverse()
q.sort()
q.reverse()
r.sort()
r.reverse()
total=[]
for i in range(X):
    total.append(p[i])
for i in range(Y):
    total.append(q[i])
for i in range(C):
    total.append(r[i])
total.sort()
total.reverse()
ans=0
for i in range(X+Y):
    ans+=total[i]
print(ans)
# Judge status: Accepted
bingo=[list(map(int,input().split())) for _ in range(3)]
N=int(input())
D=[[0]*3 for _ in range(3)]

for _ in range(N):
    b=int(input())
    for i in range(3):
        for j in range(3):
            if b==bingo[i][j]:
                D[i][j]=1
ans=set()
for d in D:
    ans.add(sum(d))
for d in zip(*D):
    ans.add(sum(d))
ans.add(D[0][0]+D[1][1]+D[2][2])
ans.add(D[0][2]+D[1][1]+D[2][0])
print('Yes' if 3 in ans else 'No')
# Judge status: Accepted
s = input()
print('A' if s.isupper() else 'a')
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

cnt = [float('inf')]*n
cnt[0], cnt[1] = 0, abs(h[0]-h[1])
for i in range(2,n):
    cnt[i]=min(abs(h[i-1]-h[i])+cnt[i-1],abs(h[i-2]-h[i])+cnt[i-2])

print(cnt[n-1])
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
sort_p = sorted(p)
ans = "YES"
c = 0
for n,m in zip(p,sort_p):
  if n != m:
    c += 1
if c > 2:
  ans = "NO"
print(ans)
# Judge status: Accepted
from collections import Counter
n=int(input())
a=[]
for i in range(n):
  a.append(input())
ac=Counter(a)
acs=sorted(ac.items(),key=lambda x:x[1],reverse=1)
z=len(acs)
i=0
temp=[]

while i<=z-1 and acs[i][1]==acs[0][1] :
  temp.append(acs[i][0])
  i+=1
temp.sort()
for i in temp:
  print(i)
# Judge status: Accepted
etime=[]
for i in range(5):
  etime.append(int(input()))
  
atime=[int(((i-1)//10+1)*10) for i in etime]
A=sum(atime)
c=[]
for k in range(5):
  c.append(A-atime[k]+etime[k])
  
print(min(c))
# Judge status: Accepted
import math

def reconclied(n , m):

    ans = 0
    mod = 10**9 + 7

    if n == m:
        ans = 2 * (math.factorial(n) * math.factorial(m))

    elif abs(n - m) == 1:
        ans = (math.factorial(n) * math.factorial(m))

    return ans % mod

def main():
    n , m = map(int , input().split())
    print(reconclied(n , m))

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
d = 10**9 + 7
print((10**N - 2 * (9**N) + 8**N) % d)
# Judge status: Accepted
n=int(input())
#n,p=map(int,input().split())
pl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

mn=pl[0]

mnl=[]
count=1
for i in range(n):
    mn=min(mn,pl[i])
    mnl.append(mn)

for i in range(1,n):
    if pl[i]<=mnl[i-1]:
        count+=1
print(count)
# Judge status: Accepted
A,B,C = map(int,input().split())

sum = A+B
if sum>=C:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())
B = list(map(int,input().split()))
a = [0] * N
ans = 0
x = 0
if N == 2:
    ans = B[0] * 2
elif N == 3:
    ans = sum(B) + min(B)
else:
    for i in range(N - 1):
        if i == 0:
            a[0] = B[0]
        elif i == N - 2:
            a[N - 1] = B[N - 2]
        else:
            x = min(B[i],B[i + 1])
            a[i] = x
        ans = sum(a)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
ans = 1
while m >= n*2**ans:
  ans +=1
print(ans)
# Judge status: Accepted
k, a, b = map(int, input().split())

total = 1
cost = b/(a + 1)

if cost > 1:
    if k >= a - 1:
        n = (k - (a - 1)) // 2
        total += n * (b - a)
        total += k - 2 * n
    else:
        total += k
else:
    total += k

print(total)