peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import numpy as np
def resolve():
    N = int(input())
    A = np.zeros(N)
    B = np.zeros(N)
    for i in range(N):
        A[i],B[i] = map(int,input().split())
    Amed = np.median(A)
    Bmed = np.median(B)
    if N % 2 == 0:
        print(int((Bmed - Amed) * 2 + 1))
    else:
        print(int(Bmed - Amed +1))
resolve()
# Judge status: Wrong Answer
A,V = [int(i) for i in input().split() ]
B,W = [int(i) for i in input().split() ]
T = int(input()) 

print ( "YES" if A+(V*T) >= B+(W*T) else "NO" )
# Judge status: Accepted
n,m=map(int,input().split())
jobs=[]
for i in range(n):
    a,b=map(int,input().split())
    jobs.append((a,-b))
jobs.sort(reverse=True)

import heapq
hp=[]
ans=0
for i in range(1,m+1):
    while jobs and jobs[-1][0]<=i:
        heapq.heappush(hp,jobs.pop()[1])
    if hp:
        ans-=heapq.heappop(hp)
print(ans)
# Judge status: Wrong Answer
N = int(input())
flag = 0
ans = "No"
for i in range(N):
  A,B = input().split()
  if flag == 3:
    ans = "Yes"
  if A == B:    
    flag += 1
  else:
    flag = 0
    
print(ans)
# Judge status: Wrong Answer
import sys
s=list(input())
s=list(set(s))
s.sort()
#print(s)
for i in range(26):
    if i+1 >= len(s):
        print(chr(ord("a")+i))
        sys.exit()
    if chr(ord("a")+i)!=s[i]:
        print(chr(ord("a")+i))
        sys.exit()
print("None")
# Judge status: Accepted
s=input()
n=len(s)
dp=0,1
for i in range(n):
  si=int(s[i])
  a=min(dp[0]+si,dp[1]+10-si)
  b=min(dp[0]+si+1,dp[1]+10-(si+1))
  dp=a,b
print(dp[0])
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

# 1 ~ Mまでの数を用いたN項の重複数列を作成する
arrs = []
for arr in itertools.combinations_with_replacement(range(1, M + 1), N):
    arrs.append(list(arr))

answer = - float("inf")
for arr in arrs:
    tmp = 0
    for a, b, c, d in ABCD:
        if arr[b - 1] - arr[a - 1] == c:
            tmp += d
    answer = max(answer, tmp)

print(answer)
# Judge status: Accepted
N = int(input())
P = list(map(int,input().split()))

ans = 1
min = P[0]
for i in P[1:]:
    if min >= i:
        ans += 1
        min = i
print(ans)
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
print(l)
cnt=0
for i in range(n):
            if l[i]%2 !=0:
                        cnt+=1
if cnt==n:
            print('DENIED')
for i in range(n):
            if l[i]%2 ==0 and l[i]%3 !=0 and l[i]%5 !=0:
                        print('DENIED')
                        exit()
print('APPROVED')
# Judge status: Accepted
n=int(input())
a,b,c=list(map(int,input().split())),list(map(int,input().split())),list(map(int,input().split()))
count=b[a[0]-1]
for i in range(1,n):
  if a[i]-a[i-1]==1:
    count+=c[a[i-1]-1]
  count+=b[a[i]-1]
print(count)
# Judge status: Accepted
n_store, n_drink = [int(i) for i in input().split()]
stores = [[int(i) for i in input().split()] for _ in range(n_store)]  # price, n_stock
stores.sort(key=lambda x: x[0], reverse=True)  # priceでソート

ans = 0
while n_drink:
    store = stores.pop()
    price, n_stock = store

    n_buy = min(n_stock, n_drink)  # stockがなくなるかn_drinkに到達するまで買う
    ans += n_buy * price
    n_drink -= n_buy
print(ans)
# Judge status: Wrong Answer
import math
a = []
mini = 9
flag = False
for i in range(5):
    x = int(input())
    if x%10==0:
        a.append(x)
    else:
        flag = True
        if x%10<mini :
            mini = x%10
        a.append(math.ceil(x/10)*10)

if flag:
    print(sum(a)-mini)
else:
    print(sum(a))
# Judge status: Accepted
#!/usr/bin/env python3
X, Y = [int(str) for str in input().strip().split()]
print(X + Y // 2)
# Judge status: Accepted
s = input()
s = s.replace("hi", "")
if s:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
import math
n=int(input())
print(math.ceil(n/2)/n)
# Judge status: Wrong Answer
n = int(input())

if n%2 == 0:
  print((n//2)**2)
else:
  print(n//2*(n//2-1))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if c<=a+b*2:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n,m,x = map(int,input().split())
li = [list(map(int,input().split())) for i in range(n)]

ans   = 10**30
cost  = 0
score = [0]*m

for i in range(1<<(n+1)):
  for j in range(n):
    if (j>>i)&1:
      for k in range(m):
        score[k] += li[j][k+1]
      cost += li[j][0]
  if min(score)>=x:
    ans = min(ans,cost)
  score = [0]*m
  cost = 0

if ans==10**30:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

if x*y < 0:
    print(abs(abs(x)-abs(y))+1)
elif x*y == 0:
    if x < y:
        print(y-x)
    else:
        print(x-y+1)
else:
    if x < y:
        print(y-x)
    else:
        print(x-y+2)
# Judge status: Accepted
N,R=map(int,input().split())
if N<10:
	print(R+(10-N)*100)
else:
	print(R)
# Judge status: Accepted
import queue

n,m=list(map(int,input().split()))
graph = [[] for i in range(n)]
    
for i in range(m):
  x,y = list(map(int,input().split()))
  graph[x-1].append(y-1)
  graph[y-1].append(x-1)
    
v = [-1 for i in range(n)]
v[0] = [0]

q = queue.Queue()
q.put(0)
    
while not q.empty():
  x = q.get()
  
  for y in graph[x]:
    if v[y]!=(-1):
      continue
    q.put(y)
    v[y] = x
    
print("Yes")
for i in range(1,n):
  print(v[i]+1)
# Judge status: Wrong Answer
k = int(input())
s = input()
s_2 = int(len(s))

if s_2 > k:
    tmp = s[k:]
    s = s[:k]
    a = ["." for i in range(s_2-k)]
    s += "".join(a)
    ans = s
else:
    ans = s
print(s)
# Judge status: Accepted
import math
def main():
	A, B, H, M = map(float, input().split())
	R = H/12 + M*0.5/360
	r = M/60
	cos = math.cos((R-r)*2*math.pi)
	C = math.sqrt(A*A + B*B - 2*A*B*cos)
	print(C)

if __name__ == '__main__':
	main()
# Judge status: Accepted
x, y, z = map(str, input().split())
print(z, x, y)
# Judge status: Wrong Answer
A,B=map(int,input().split())

def larger(x,y):
  if x>y:
    return x
  else:
    return y

L=larger(A,B)
S=A+B-L

#rが最大公約数
r=100000
n=100000
if L%S==0:
  r=S
else:
  for i in range(0,L):
    if n!=0:
      r=L%S
      n=S%r
    elif n==0:
      break
      
#最小公倍数求める
p=(L*S)//r
print(p)
# Judge status: Accepted
def main():
    N, A, B = map(int, input().split())
    diff = abs(A-B)
    if diff%2 == 0:
        ans = diff//2
    else:
        # 端に行く
        # 一回端のままになる => 偶数のときと同じ
        ans = min(A-1, N-B)
        diff -= 1; ans += 1
        ans += diff//2
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int,input().split())
if n%2:
    for i in range(1,m+1):
        print(i,n-i+1)
else:
    for i in range(1,m+1):
        if n-2*i+1>n//2:
            print(i,n-i+1)
        else:
            print(i,n-i)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
dict={}
count=0
for i in a:
  if i not in dict:
    dict[i] = 1
    continue
  dict[i] += 1
for i,j in dict.items():
  if i > j:
    count += j
  elif i < j:
    count += j-i
print(count)
# Judge status: Wrong Answer
N=int(input())
ABC=[]
for i in range(N):
	ABC+=[[int(i) for i in input().split()]]
DP=[[0,0,0] for i in range(N)]
for i in range(N):
	for j in range(3):
		DP[i][j]=ABC[i][j]+max(DP[max(i-1,0)][(j+1)%3],DP[max(i-1,0)][(j+2)%3])
print(max(DP[N-1]))
# Judge status: Wrong Answer
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, S = map(int, read().split())

if S != 1:
    ans = [S] * K + [1] * (N - K)
else:
    ans = [S] * K + [S + 1] * (N - K)

print(*ans)
# Judge status: Accepted
import math

k = int(input())

ans = 0

IJ = [[0 for j in range(k+1)] for i in range(k+1)]

for i in range(1, k+1):
    for j in range(1, k+1):
        IJ[i][j] = math.gcd(i, j)

for i in range(1, k+1):
    for j in range(1, k+1):
        for h in range(1, k+1):
            ans += math.gcd(IJ[i][j], h)


print(ans)
# Judge status: Accepted
o, e = [list(input()) for _ in range(2)]
ans = ''
for i in range(len(o)):
  ans += o[i]
  if i == len(o)-1 and len(o) != len(e):
    break
  ans += e[i]
print(ans)
# Judge status: Accepted
N = int(input())

count = 0
if N%2==1:
    print(0)
    exit()
powNum = 1
while 2*pow(5,powNum) <= N:
    count += N//(2*pow(5,powNum))
    powNum+=1
print(count)
# Judge status: Accepted
n, k =list(map(int, input().split()))
l = []
while True:
    l.append(n % k)
    n = n // k
    if n == 0:
        break
ans = len(l)
print(ans)
# Judge status: Accepted
import math
from itertools import combinations
N,D = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]

combination = list(combinations(range(N),2))

cnt = 0
for i,j in combination:
  distance = 0
  for k in range(D):
    distance += abs(X[i][k] - X[j][k]) ** 2
  distance = math.sqrt(distance)
  if distance == math.floor(distance):
    cnt += 1
    
print(cnt)
# Judge status: Accepted
a = int(input())
b = a % 1000
if b != 0:
	ans = 1000 - b 
else:
	ans = b
print(ans)
# Judge status: Accepted
X = int(input())

S = 100
Y = 0

while X > S:
    S += S // 100
    Y += 1

print(Y)
# Judge status: Accepted
k = int(input())
m = 7
if(k%2==0):
  print("-1")
else:
  i = 1
  while True:
    m = m%k
    if(m==0):
      print(i)
      break  
    if(i>k):
      print("-1")
      break
    m *= 10
    m += 7
    i += 1
# Judge status: Accepted
s = input()

a = int(s[5])
b = int(s[6])

if a == 0 and b <= 4:
  print('Heisei')
else:
  print('TBD')
# Judge status: Accepted
N = int(input())
P = list(map(int, input().split()))
c = 0
prev = False
for i, p in enumerate(P):
    if p == i+1:
        c += 1
        if prev:
            c -= 1
        prev = not prev
    else:
        prev = False
print(c)
# Judge status: Wrong Answer
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))


N = int(input())
ans = 10 ** 12
for i in range(1, math.ceil(N**0.5)+1):
    if N / i == N // i:
        print(i, N // i)
        ans = min(ans, i + N // i - 2)
print(ans)
# Judge status: Wrong Answer
print(['P','Imp'][eval(input().replace(' ','+'))%3>0]+'ossible')
# Judge status: Wrong Answer
N, M = map(int, input().split())

ans = []
neg = 0
for n in range(N):
  ans.append(-1)

for m in range(M):
  s, c = map(int, input().split())
  if ans[s-1] == -1:
    ans[s-1] = c
  elif ans[s-1] == c:
    pass
  else:
    neg = -1
    break

if ans[0] == 0:
  neg = -1

for j in range(len(ans)):
  if ans[j] == -1:
    ans[j] = 0

if neg == -1:
  print(neg)
else:
  print("".join([str(i) for i in ans]))
# Judge status: Accepted
H, A = list(map(int, input().split()))

ans = (H + A - 1 ) // A
print(int(ans))
# Judge status: Accepted
s = list(input())
s[3] = "8"
print("".join(s))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))


p = 0
res = 0

while p < N:
    while p + 1 < N and A[p] == A[p + 1]:
        p += 1
    if p + 1 < N and A[p] < A[p + 1]:
        while p + 1 < N and A[p] <= A[p + 1]:
            p += 1
    elif p + 1 < N and A[p] > A[p + 1]:
        while p + 1 < N and A[p] >= A[p + 1]:
            p += 1
    res += 1
    p += 1
print(res)
# Judge status: Accepted
n = str(input())
 
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

s = [0]*(N+1)
for i in range(N):
    s[i+1] = s[i] + A[i]

ans = float('inf')
for i in range(1,N):
    ans = min(abs(s[N]-s[i]-s[i]),ans)
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()
print(sum(P[:K]))
# Judge status: Accepted
n=input()
m=list(n)
l=[int(i) for i in m]
l.reverse()
l.append(0)
k=l
ans=0
for i in range(len(l)):
  if k[i]<5:
    ans+=k[i]
  elif k[i]==5:
    if k[i+1]>=5:
      k[i+1]+=1
    ans+=5
  else:
    ans+=10-k[i]
    k[i+1]+=1
print(ans)
# Judge status: Accepted
def solve():
    _N = int(input())
    N = _N
    ans = 0
    if N % 2 == 0:
        div = 10
        while N // div > 0:
            ans += N//div
            div *= 5
    print(ans)


solve()
# Judge status: Accepted
N, P = map(int, input().split())
O = sum([int(a) % 2 for a in input().split()])
E = N - O
fa = [1]
for i in range(1, 51):
    fa.append(fa[-1] * i)
ans = 0
for i in range(P, O+1, 2):
    ans += fa[O] // (fa[i] * fa[O-i])

print(ans * 2**E)
# Judge status: Accepted
s=input()
print("Heisei" if s<="2019/04/30" else "TBD")
# Judge status: Accepted
def check(a,b):
    for i in range(3):
        diffc[i] = c[i][a]-c[i][b]
        diffr[i] = c[a][i]-c[b][i]
    if diffc[0] != diffc[1] or diffc[1] != diffc[2] or diffr[0] != diffr[1] or diffr[1] != diffr[2]:
        print("No")
        exit()
        

c = [[int(i) for i in input().split()] for i in range(3)]
diffr = [0]*3
diffc = [0]*3
check(0,1)
check(1,2)
print("Yes")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

print(sum(A[i] for i in range(1, 2 * N + 1, 2)))
# Judge status: Wrong Answer
def abc(x,y,z):
    A = z
    B = x
    C = y
    return A,B,C

print(abc(1,2,3))
# Judge status: Accepted
n,m=map(int,input().split())
li=[input().split() for i in range(m)]
 
ac=set()
wa=0
 
q=[[0,-1] for i in range(n+1)]
 
for x,y in li:
  if y=="AC" and q[int(x)][1]==-1: #AC出したらこれまでのwaを答えに足して、それ以降はカウントされないようにする
    wa+=q[int(x)][0]
    q[int(x)][1]=0
    ac.add(x)
  elif y=="WA" and q[int(x)][1]==-1:
    q[int(x)][0]+=1
 
print(len(ac),wa)
# Judge status: Wrong Answer
r, g, b = input().split()
a = int(r + g + b)
if a % 4 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s=input()
n=len(s)
k=int(input())
ans=[]
for i in range(n):
    if i==n-1:
        ans.append(chr(((ord(s[i])-97+k)%26)+97))
    else:

        if s[i]=="a":
            ans.append("a")
        else:
            if 26-(ord(s[i])-97)<=k:
                ans.append("a")
                k-=(26-(ord(s[i])-97))
            else:
                ans.append(s[i])
print("".join(ans))
# Judge status: Accepted
from bisect import bisect_left, bisect_right

n = int(input())
stick = list(map(int, input().split()))
stick.sort()

count = 0
for i in range(n - 1, -1, -1):
    for j in range(i - 1, -1, -1):
        l = bisect_right(stick, stick[i] - stick[j])
        r = bisect_left(stick, stick[i] + stick[j]) # [l, r) が範囲
        if j <= l:
            break
        count += min(r, j) - l
print(count)
# Judge status: Accepted
dic = {}
dic.setdefault('a',str(input())+'A')
dic.setdefault('b',str(input())+'B')
dic.setdefault('c',str(input())+'C')
dare = dic['a'][0]
dic['a'] = dic['a'][1:]
while len(dic['a'])>0 and len(dic['b'])>0 and len(dic['c'])>0:
    tmp = dic[dare][0]
    dic[dare] = dic[dare][1:]
    dare = tmp
print(dare)
# Judge status: Accepted
n=int(input())
alist=[]
blist=[]
for i in range(n):
  x,y=map(int, input().split())
  alist.append(x+y)
  blist.append(x-y)
print(max(max(alist)-min(alist),max(blist)-min(blist)))
# Judge status: Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()

    ans = (1 if N == 1 else N - 2) * (1 if M == 1 else M - 2)
    print(ans)

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
d = int(input())
print('Christmas' if d==25 else 'Christmas Eve' if d==24 else 'Christmas Eve Eve' if d == 23 else 'Christmas Eve Eve Eve')
# Judge status: Accepted
import copy
n=int(input())
s=[int(input())  for i in  range(n)]

Sum=[]
if sum(s)%10 != 0:
  print(sum(s))
  exit()
for i in s:
  c=copy.copy(s)
  c.remove(i)
  baisu=sum(c)
  #print(c)
  if baisu % 10 != 0:
    Sum.append(baisu)

if len(Sum) == 0:
  print(0)
else:
  print(max(Sum))
# Judge status: Accepted
import math
k=int(input())
s=0
for i in range(1,k+1):
    for j in range(1, k+1):
        tmp=math.gcd(i,j)
        for h in range(1, k+1):
            s+=math.gcd(tmp,h)
print(s)
# Judge status: Accepted
x = int(input())
flag = False
for i in range(26):
  left = x-4*i
  if left>=0 and left%7==0:
    flag=True
    break
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)
A = sorted(list(set(A)))[::-1]
flag = False
x = 0
for a in A:
	if flag == False:
		if C[a] >= 4:
			print(a ** 2)
			exit()
		elif C[a] >= 2:
			flag = True
			x = a
	elif flag == True and C[a] >= 2:
		print(a * x)
		exit()
else:
	print(0)
# Judge status: Accepted
n = int(input())
i = 1
while ( i * 2 <= n):
    i *= 2
print(i*2-1)
# Judge status: Wrong Answer
from functools import lru_cache
import sys

sys.setrecursionlimit(2000)

s = int(input())
mod = 10 ** 9 + 7


@lru_cache(maxsize=1000)
def dfs(n):
    if n <= 2:
        return 0
    elif 3 <= n <= 6:
        return 1
    else:
        count = 1
        for i in range(3, n + 1):
            count += dfs(n - i)
            count %= mod

        return count % mod


ans = dfs(s)
print(ans)
# Judge status: Wrong Answer
from math import floor
a, b = map(float, input().split())
ans = floor(a * b)
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
count=0
while(1):
  for i in range(n):
    if a[i]%2==1:
      break
    else:
      a[i]=a[i]//2
      count+=1
  else:
    break
print(count)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
 
ans = 0
for i in range(1, n-1):
  if p[i] > p[i-1] and p[i] < p[i+1]: ans += 1
 
print(ans)
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
l.sort()
a=l[n//2-1]
b=l[n//2]
for i in range(n//2):
  print(b)
for j in range(n//2,n):
  print(a)
# Judge status: Accepted
x, a, b = map(int, input().split())

if abs(a - x) > abs(b - x):
  print('B')
else:
  print('A')
# Judge status: Wrong Answer
s = list(set(input()))
l = [["N","S"], ["W","E"], ["N", "S", "W", "E"]]
if len(s) != 2 and len(s) != 4:
    print("No")
    exit()
for i in l:
    x = 0
    for j in s:
        if j in i:
            x += 1
    if x == len(s):
        print("Yes")
        exit()
print("No")
# Judge status: Accepted
n = int(input())
C = input()
len_r, len_w = 0, 0
for c in C:
    if c == 'R':
        len_r += 1
    else:
        len_w += 1
c2 = 'R'*len_r + 'W'*len_w
cnt = 0
for a, b in zip(C, c2):
    if a != b:
        cnt += 1
print(cnt//2)
# Judge status: Accepted
n,k,q=map(int,input().split())
lis=[0]*n
for i in range(q):
  a=int(input())
  lis[a-1]+=1
for j in range(0,n):
  if k-q+lis[j]>0:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
x = (int)(input())
temp = 0
if x % 11 != 0:
    if x % 11 < 7:
        temp = 1
    else:
        temp = 2
print((int)(x/11) * 2 + temp)
# Judge status: Accepted
_ = input()
a = [int(x) for x in input().split()]

odd = []
m4 = []
m2 = 0
for i in a:
    if i % 2 != 0:
        odd.append(i)
    elif i % 4 == 0:
        m4.append(i)
    else:
        m2 = 1
else:
    if len(odd) + m2 - 1 <= len(m4):
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n,k = list(map(int, input().split()))
nums = list(map(int, input().split()))
best = [99999999]*n
best[0] = 0
for i in range(1,n):
    for j in range(1,min(i+1,k+1)):
        #print(i,i-j, "CHECKING", best[i-j],abs(nums[i-j]-nums[i]))
        best[i] = min(best[i], best[i-j]+abs(nums[i-j]-nums[i]))

print(best[-1])
# Judge status: Accepted
def restore():
    for i in range(N - M, -1, -1):
        if all(s == '?' or s == t for s, t in zip(S[i:i + M], T)):
            ans = S[:i] + T + S[i + M:]
            return ''.join('a' if c == '?' else c for c in ans)
    return 'UNRESTORABLE'


S = input()
T = input()
N = len(S)
M = len(T)
print(restore())
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = ''
for i in range(1, n):
  if h[i - 1] >= h[i]:
    next
  elif h[i] - h[i - 1] == 1:
    h[i] = h[i] - 1
  else:
    ans = 'No'
    break
if ans == '':
  ans = 'Yes'
print(ans)
# Judge status: Accepted
n,y=map(int,input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i+5000*j+1000*(n-i-j)==y:
            print(i,j,n-i-j)
            exit()
print(-1,-1,-1)
# Judge status: Accepted
n=int(input())
ans={"b":0}
ma=0
pr=[]
for i in range(n):
    name=input()
    if name in ans.keys():
        ans[name]=ans[name]+1
    else:
        ans[name]=1
for j,k in ans.items():
    if k>ma:
        ma=k 
        pr=[j]
    elif k==ma:
        pr.append(j)
pr.sort()
for l in pr:
    print(l)
# Judge status: Wrong Answer
N = int(input())
Carry = []
for i in range(5):
    Carry.append(int(input()))
min_num = min(Carry)
if N < min_num:
    print(5)
elif N % min_num == 0:
    print((N//min_num))
elif min_num == 1:
    print((N//min_num)+(5-Carry.index(min_num)))
else:
    print((N//min_num)+5)
# Judge status: Wrong Answer
s = list(input())
l = []

for i in range(len(s)):
    if s[i] == "B":
        try:
            l[i-1] = ""
        except:
            pass
    else:
        l.append(s[i])

print("".join(l))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if(a<b and b<c):
		print('Yes')
else:
		print('No')
# Judge status: Accepted
a = sorted(list(map(int, input().split())))
k = int(input())
a[-1] = 2**k*a[-1]
print(sum(a))
# Judge status: Accepted
import sys
x,y=map(int,input().split())

if (x+y)%3 != 0:
    print(0)
    sys.exit()

tmp=(x+y)//3
x=x-tmp
y=y-tmp
sosu=10**9+7
if x<0 or y<0:
    print(0)
    sys.exit()

def combination(x,y):
    n=x+y
    r=min(x,y)
    upper=1
    lower=1
    for i in range(r):
        upper=(upper*(n-i))%sosu
        lower=(lower*(i+1))%sosu
    return (upper * pow(lower,sosu-2,sosu))%sosu
print(combination(x,y))
# Judge status: Wrong Answer
N=int(input())
for i in range(1,10):
  if 111*i<=N:
    print(111*i)
    break
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

one = 0
two = 0
four = 0
for x in a:
    if x % 4 == 0:
        four += 1
    elif x % 2 == 0:
        two += 1
    else:
        one += 1

if (two != 1 and four >= one - 1) or four >= one+two-1 or one == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()
for i in range(len(s)):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        break
# Judge status: Accepted
N, X = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
cnt=0
for i in range(N):
    if A[i]<=X:
        X-=A[i]
        cnt+=1
    else:
        break
if X>0 and cnt==N:
    cnt-=1
print(cnt)
# Judge status: Accepted
h1,m1,h2,m2,K=map(int, input().split())

x1=h1*60+m1
x2=h2*60+m2

print(x2-x1-K)
# Judge status: Accepted
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n-1):
    t[i+1]=t[i]+(1 if s[i:i+2]=="AC" else 0)
for i in range(q):
    l,r=map(int,input().split())
    print(t[r-1]-t[l-1])
# Judge status: Accepted
K,X=map(int,input().split())
a=X-K+1
b=X+K
while a<b:
  print(a,end=" ")
  a+=1
# Judge status: Wrong Answer
s=str(input())
if s=='AAA' or 'BBB':
  print('No')
else:
  print('Yes')
# Judge status: Wrong Answer
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

a,b,X,Y,Z = inpl()
x = sorted(inpl(), reverse = True)
y = sorted(inpl(), reverse = True)
z = sorted(inpl(), reverse = True)
apples = x + y + z
apples.sort(reverse = True)
print(sum(apples[:a+b]))
# Judge status: Wrong Answer
Big=["A","B","c"]
Small=["a","b","c"]

N,K=map(int,input().split())
S=list(input())

for i in range(3):
  if S[K-1]==Big[i]:
    S[K-1]=Small[i]

print("".join(S))
# Judge status: Accepted
K=int(input())
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
  if i%K==0:
    ans+=1
if ans>=1:
  print("OK")
else:
  print("NG")