peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import numpy as np
p,q= input().split()
a,b =(int(p), int(q))
list_np = np.arange(-1000000, 1000000,1)
ans_list = []
for i in range(a):
    ans_list.append(b + i)
    ans_list.append(b - i)
ans_list.pop(0)
ans_list.sort()
ans=''

for i in range(a*2 -1):
    if i < a * 2 -1 :
        ans += str(ans_list[i])
        ans +=' '
    else:
        ans +=str(ans_list[i])
        break
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7
H =        list( map(int, input().split()) )	# 1 2 3 4 5 ...

AB=[]
for m in range(M):
	a,b = map(int, input().split())			# "5 7" -> ["5", "7"] -> 5, 7 => N=5,K=7
	AB.append([a-1,b-1])

X=[0]*N
for a,b in AB:
	
	X[a] = max(X[a], H[b])
	X[b] = max(X[b], H[a])

ans=0
for i in range(N):
	if H[i] > X[i]: ans += 1

print(ans)
# Judge status: Accepted
N,D=map(int,input().split())
a=N//(2*D+1)
if N%(2*D+1)==0:
    print(a)   
else:
    print(a+1)
# Judge status: Accepted
n=input()
if "7" in n :
    print("Yes")
else:
    print("No")
# Judge status: Accepted

import sys

n = int(input())

for i in range(1 ,10):
    if n % i == 0:
        tmp = n / i
        if tmp < 10:
            print('Yes')
            sys.exit()


print('No')
# Judge status: Wrong Answer
n = int(input())
c, d = [], []
for i in range(n):
    a, b = [int(i) for i in input().split()]
    c.append(a)
    d.append(b)

count = 1

for i in range(1, n):
    if c[i-1] == c[i] and d[i-1] == d[i]:
        count += 1
    else:
        count = 1
    if count == 3:
        break

if count == 3:
    print('Yes')

else:
    print('No')
# Judge status: Accepted
S = input()
flag1 = False
if S[0] == "A":
    S=S.replace("A","",1)
    if "C" in S[1:-1]:
        S = S.replace("C", "", 1)
        if S.islower():
            print("AC")
        else:
            print("WA")
    else:
            print("WA")
else:
            print("WA")
# Judge status: Accepted
k = input()
vowels = set("aeiou")
vowels.add(k)

if len(vowels) == 6:
    print("consonant")
else:
    print("vowel")
# Judge status: Accepted
import collections
n = int(input())
alist = list(map(int,input().split()))
adic = collections.Counter(alist)
A = [0,0]
for i in adic:
  if adic[i] > 1:
    A.append(i)
  if adic[i] > 3:
    A.append(i)
sortedA = sorted(A)
print(sortedA[-1]*sortedA[-2])
# Judge status: Accepted
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
n = int(input())
a = list(map(int,input().split()))
color = [0]*8
over_3200 = 0
for i in range(n):
    if a[i] < 3200:
        color[a[i] // 400] = 1
    else: over_3200 += 1
if sum(color) == 0:
    print(1,over_3200)
else:
    print(sum(color),sum(color)+over_3200)
# Judge status: Accepted
S=input()

ans="No"
n=0
w=0
e=0
s=0
tate=0
yoko=0

for str in S:
  if str=="N":
    n +=1
  elif str=="E":
    e +=1
  elif str=="S":
    s +=1
  else:
    w +=1

if (n>0 and s>0) or (n==0 and s==0):
  tate=True
if (e>0 and w>0) or (e==0 and w==0):
  yoko=True
  
if tate and yoko:
  ans="Yes"
  
print(ans)
# Judge status: Accepted
s=input();print(min(s.count("1"),s.count("0"))*2)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
n,k = map(int,readline().split())

lst1 = list(readline().rstrip().decode('utf-8').split())
i = n
while True:
    flag = 0
    for j in lst1:
        if j in str(i):
            i += 1
            flag = 1
            break
    if not flag:
        print(i)
        break
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(8)]
over = 0
for i in range(n):
  if a[i] >= 3200:
    over += 1
  else:
    ans[a[i]//400] = 1

    

print(str(max(1, sum(ans))) + " " + str(sum(ans)+over))
# Judge status: Accepted
n = int(input())
x = list(map(int,input().split()))

y = sorted(x)

m = (y[len(y)//2]+y[len(y)//2-1])/2



for i in range(len(x)):
    if x[i] > m:
        print(y[len(y)//2-1])
    else:
        print(y[len(y)//2])
# Judge status: Accepted
print('Yes' if int(input())>=30 else 'No')
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
keta=[0]*61
for i in range(n):
  for j in range(61):
    if (a[i]>>j)&1==1:
      keta[j]+=1
ans=0
for i in range(61):
  ans+=((2**i)*(n-keta[i])*keta[i])%(10**9+7)
print(ans%(10**9+7))
# Judge status: Accepted
import numpy as np 
from numba import jit
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=np.array(a,np.int64)

@jit
def imo(a):
    imos=np.zeros(n+1,np.int64)
    for i in range(n):
        imos[max(0,i-a[i])]+=1
        imos[min(n,i+a[i]+1)]-=1
    
    immo=np.zeros(n+1,np.int64)
    immo=np.cumsum(imos)
    return immo[:n]


for _ in range(min(k,41)):
    a=imo(a)
    
print(*a)
# Judge status: Wrong Answer
A = int(input())
B = int(input())
print(5 - A - B)
# Judge status: Accepted
s = input()
sum=0
for i in s:
    sum+=int(i)

if sum%9==0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N=int(input())
ans=0
for i in range(1,N+1):
    tmp=0
    if i%2!=0:
        for j in range(1,i+1):
            if i%j==0:
                tmp+=1
        if tmp==8:
            ans+=1
print(ans)
# Judge status: Accepted
import math
a, b, x = map(int, input().split())
s = x / a
if s >= (a * b) / 2:
    y, x = 2*(a*b - s) / a, a
else:
    y, x = b, 2*s / b
print(math.degrees(math.atan2(y, x)))
# Judge status: Wrong Answer
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = readline().decode('utf8')
print('Yes' if set('abc') == set(S) else 'No')
# Judge status: Wrong Answer
N = int(input())
from math import log

max6 = int(log(N, 6))
max9 = int(log(N, 9))
dp = [10**18]*(N+1)
dp[0] = 0
for i in range(1, N+1):
    dp[i] = min(dp[i-1]+1, dp[i])
    for j in range(max6+1):
        if 6**j>i:
            break
        dp[i] = min(dp[i-6**j]+1, dp[i])
    for k in range(max9+1):
        if 9**k>i:
            break
        dp[i] = min(dp[i-9**k]+1, dp[i])

print(dp[-1])
# Judge status: Accepted
n,a,b=map(int,input().split())
if a>b:
    print(0)
elif n==1 and a!=b:
    print(0)
elif n<=2:
    print(1)
else:
    print((b-a)*(n-2)+1)
# Judge status: Accepted
# ABC 049 C
S = str(input())

ans = 'YES'
while len(S)>0:
  if S[-5:] == 'dream':
    S = S[:-5]
  elif S[-5:] == 'erase':
    S = S[:-5]
  elif S[-6:] == 'eraser':
    S = S[:-6]
  elif S[-7:] == 'dreamer':
    S = S[:-7]
  else:
    ans = 'NO'
    break
print(ans)
# Judge status: Accepted
import queue

K = int(input())

q = queue.Queue()

q.put(1)
q.put(2)
q.put(3)
q.put(4)
q.put(5)
q.put(6)
q.put(7)
q.put(8)
q.put(9)
x=0
while K>0:
    x = q.get()
    if x%10 != 0:
        q.put(10*x+x%10-1)
    q.put(10*x+x%10)
    if x%10 !=9:
        q.put(10*x+x%10+1)
    K-=1

print(x)
# Judge status: Accepted
s = input()
for i in s:
  if s.count(i) != 2:
    print("No")
    exit()
print("Yes")
# Judge status: Accepted
a, b, c = map(int, input().split())

tmp = a
a = b
b = tmp
tmp = a
a = c
c = tmp
print(str(a)+" "+str(b)+" "+str(c))
# Judge status: Accepted
N, A, B = [int(i) for i in input().split()]

result = 0

for i in range(N+1):
    digitsum = sum(list(map(int, str(i))))
    if A <= digitsum <= B:
        result = result + i

print(result)
# Judge status: Accepted
S = list(input())
l=[]
for i in S:
    if i == "B":
        if len(l)==0:
            continue
        else:
            l.pop()
    else:
        l.append(i)
print(*l, sep="")
# Judge status: Accepted
n,a,b=map(int,input().split())
s=input()
passed=0
rank_b=1
for i in range(n):
    if s[i]=="a":
        if passed<a+b:
            print("Yes")
            passed+=1
        else:
            print("No")
    elif s[i]=="b":
        if passed<a+b and rank_b<=b:
            print("Yes")
            rank_b+=1
            passed+=1
        else:
            print("No")
    else:
        print("No")
# Judge status: Wrong Answer
N, K = map(int, input().split())
monsterList = [int(x) for x in input().split()]

atackTimes = 0

monsterList.sort()
for hp in monsterList[:-K]:
    atackTimes += hp

print(atackTimes)
# Judge status: Accepted
a,b,x = map(int,input().split())
if a <= x <= a+b:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
N,K = map(int,input().split())
A = list(map(int,input().split()))

l = set(A)
d = list(set(A))[-(len(l)-K):]
res = 0
for i in d:
    res += A.count(i)
print(res)
# Judge status: Accepted
n = int(input())
s = input()

ans = 0
for i in range(1, n):
  x = set(s[:i])
  y = set(s[i:])
  cnt = 0
  for j in x:
    if j in y: cnt += 1
    if ans < cnt: ans = cnt
print(ans)
# Judge status: Accepted
A, B = map(int, input().split())

ans = int((B - 1) / (A - 1)) + 1

if (B - 1) % (A - 1) == 0:
    ans -= 1

print(ans)
# Judge status: Accepted
from collections import deque

S = input()
Q = int(input())
head = 1
d = deque([S])

for _ in range(Q):
    q = input().split()
    if q[0]=='1':
        head = head*-1
    else:
        if q[1]=='1':
            h = head*1
        else:
            h = head*-1
        
        if h==1:
            d.appendleft(q[2])
        else:
            d.append(q[2])
ans = "".join(list(d))
if head == -1:
    ans = ans[::-1]

print(ans)
# Judge status: Accepted
X, A, B = map(int, input().split())
print("delicious" if B <= A else "safe" if B <= (A + X) else "dangerous")
# Judge status: Accepted
x, y, z = map(int, input().split())

print(z, x, y)
# Judge status: Accepted
h, n = map(int, input().split())
a = list(map(int, input().split()))
print('Yes' if sum(a)>=h else 'No')
# Judge status: Accepted
n,d = map(int,input().split())
a=[]
b=[]
cnt = 0
for i in range(n):
    c, e = map(int,input().split())
    if c**2+e**2<=d**2:
        cnt += 1
print("{}".format(cnt))
# Judge status: Accepted
from collections import Counter

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

sum = 0
c = Counter(a).most_common()
if K > len(c):
    print(0)
    exit()
for i in range(K):
    sum += c[i][1]
print(len(a) - sum)
# Judge status: Accepted
n = int(input())
grid = [[0 for i in range(10)] for j in range(10)]
for i in range(1,n+1):
    s = str(i)
    a,b = int(s[0]), i % 10
    grid[a][b] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += grid[i][j] * grid[j][i]
print(ans)
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))
H = H[::-1]
ans = 'Yes'
for i in range(N-1):
  if H[i+1] - H[i]> 1:
    ans = 'No'
    break
  elif H[i+1] - H[i]> 0:
    H[i+1] = H[i]
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if (a+b)%2!=0:
    print((a+b)//2+1)
else:
    print((a+b)//2)
# Judge status: Wrong Answer
n = int(input())

wk =[]
for i in range(n):
    wk.append(list(map(int,input().split())))
xl = sorted(wk, key=lambda x:x[0])

xx = []
ll = []
cnt = 0

for i in range(n):
    x,l = xl[i][0],xl[i][1]

    if i == 0 or xx[cnt-1] + ll[cnt-1] -1 <  x - l +1:
        xx.append(x)
        ll.append(l)
        cnt +=1

print(len(xx))
# Judge status: Accepted
N = int(input())

d = [[0]*10 for i in range(10)]
for n in range(1,N+1):
    s = str(n)
    d[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(10):
    for j in range(10):
        ans += d[i][j] * d[j][i]
print(ans)
# Judge status: Accepted
a = input()
if a.isupper():
    print('A')
else:
    print('a')
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if i * 50 + j * 100 + k * 500 == x:
        ans += 1
print(ans)
# Judge status: Accepted
def kyuu(N):
  for i in range(8):
    if N >= 1800 - 200 * i:
      return (i + 1)
      break

X = int(input())
print(kyuu(X))
# Judge status: Accepted
A = int(input())
B = int(input())
print(6 - A - B)
# Judge status: Accepted
print(sum(sorted(map(int,input().split()))[:2]))
# Judge status: Wrong Answer
N = int(input())
a = sorted(map(int,input().split()))
print(sum(a[N:2*N]))
# Judge status: Accepted
n = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(1, n - 1):
    if P[i - 1] < P[i] < P[i + 1] or P[i - 1] > P[i] > P[i + 1]:
        count += 1

print(count)
# Judge status: Wrong Answer
n = int(input())
S = input()

if n%2 == 0:
    p = n//2
    print(S[:p],S[p:])
    if S[:p] == S[p:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
n=input()
if n[1:]=='9'*(len(n)-1): print(9*(len(n)-1)+int(n[0]))
else: print(9*(len(n)-1)+int(n[0])-1)
# Judge status: Accepted
a, b, c, d = map(int, input().split())
m = 0
for i in range(200):
    c -= b
    if c <= 0:
        m = 1
        break
    a -= d
    if a <= 0:
        m = 2
        break
print("Yes" if m == 1 else "No")
# Judge status: Accepted
k, a, b = map(int, input().split())
n = 1
m = 0
n += a - 1
k -= a - 1
if a + 1 < b:
  n += (b - a) * (k // 2) + k % 2
else:
  n += k
print(n)
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split(' '))
A_list = list(map(int, input().split(' ')))
B_list = list(map(int, input().split(' ')))
C_list = list(map(int, input().split(' ')))

A_list.sort(reverse=True)
B_list.sort(reverse=True)
C_list.sort(reverse=True)

A_list = A_list[:X]
B_list = B_list[:Y]

all_list = []
all_list.extend(A_list)
all_list.extend(B_list)
all_list.extend(C_list)

all_list.sort(reverse=True)

res = 0
for i in range(X+Y):
    res += all_list[i]

print(res)
# Judge status: Wrong Answer
import sys
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
box = []
acnt =dict(Counter(a))
acnt = sorted(acnt.items(), key=lambda x:x[0],reverse=True)
#print(acnt)
a_val =[acnt[x][1] for x in range(len(acnt))]
a_key = [acnt[y][0] for y in range(len(acnt))]
#print(a_key,a_val)
for i in range(len(a_val)):
	if a_val[i] >= 4:
		print(a_key[i]**2)
		sys.exit()
	elif 2 <= a_val[i]:
		box.append(a_key[i])
		#print(box)
		if len(box) == 2:
			print(box[0]*box[1])
			sys.exit()
print(0)
# Judge status: Accepted
#!/usr/bin/env python3
s = input()
k = int(input())
n = len(s)
ans = []
# kを減らしていく。もし、aまで戻せるならaまで進めてk をその分減らす。
for i in range(n):
    if s[i] == "a":
        ans.append("a")
    elif 123 - ord(s[i]) <= k:
        ans.append("a")
        k -= 123 - ord(s[i])
    else:
        ans.append(s[i])
# print(k)
k %= 26  # 26で割ったあまりに落とす
ans[-1] = chr((ord(ans[-1]) + k - 97) % 26 + 97)
print("".join(ans))
# Judge status: Wrong Answer
A,B,K = map(int,input().split())
C = [i for i in range(A,B+1)]
N = len(C)
L = set(C[N-K:]+C[:K])
for l in L:
    print(l)
# Judge status: Accepted
n, p = map(int, input().split())
A = list(map(int, input().split()))
o = 0
for a in A:
	if a % 2:
		o += 1
e = n - o
if o == 0 and p == 1:
	print(0)
else:
	print(2**e * 2**max(0, o - 1))
# Judge status: Accepted
N = int(input())

def divisors(n):
    re = 0
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            if n == i**2:
                re += 1
            else:
                re += 2
    return re
ans = 0
for i in range(1,N+1,2):
    if divisors(i) == 8:
        ans += 1
print(ans)
# Judge status: Accepted
from decimal import Decimal

n = int(input())
print(int(Decimal((n-1)/2)*Decimal(n)))
# Judge status: Accepted
import sys
input = sys.stdin.readline
a,b=map(int,input().split())
print(-(-(a+b)//2))
# Judge status: Accepted
n, m  = map(int, input().split())
if n >= m:
    ans = m//2
else:
    ans = n + (m-2*n)//4
print(ans)
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n+1):
    cnt=0
    if i%2 == 1:
        for j in range(1,i+1):
            if i%j == 0:
                cnt += 1
    if cnt == 8:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
ans = 0

for i in range(1,n-1):
    
    mae = set(s[:i])
    ato = set(s[i:])
    cnt = mae & ato

    ans = max(ans,len(cnt))
    
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
 
r_cnt = s.count('R')
g_cnt = s.count('G')
b_cnt = s.count('B')
 
ans = r_cnt * g_cnt * b_cnt
 
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
 
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=int(input())
if n*500<=a:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
a1=[int(i) for i in input().split()]
a2=[int(i) for i in input().split()]
a3=[int(i) for i in input().split()]
n=int(input())
for i in range(n):
    b=int(input())
    for j in range(3):
        if a1[j]==b: a1[j]=-1
        if a2[j]==b: a2[j]=-1
        if a3[j]==b: a3[j]=-1
print("Yes" if sum(a1)==-3 or sum(a2)==-3 or sum(a3)==-3 or a1[0]+a2[1]+a3[2]==-3 or a1[2]+a2[1]+a3[0]==-3 else "No" )
# Judge status: Wrong Answer
aaa = [int(input()) for i in range(6)]
 
ans = "Yay!"
 
a = aaa[0]
for i in range(1,5):
    if aaa[5] <= a - aaa[i]:
        ans = ":("
        break
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
a = n
for i in range(n + 1):
    j = n - i
    c = 0
    while i > 0:
        c += i % 6
        i //= 6
    while j > 0:
        c += j % 9
        j //= 9
    a = min(a, c)
print(a)
# Judge status: Accepted
S = input()
nums = len(list(S))
anslist = ['x']*nums
ans = ''
for a in anslist:
    ans += a
print(ans)
# Judge status: Accepted
N,C,K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
ans=s=0
while s<N:
    t=T[s]+K
    sm=1
    for i in range(s+1,min(s+C,N)):
        if T[i]<=t:
            sm+=1
        else:
            break
    s+=sm
    ans+=1
print(ans)
# Judge status: Wrong Answer
import fractions
n,m=map(int,input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i]//=2
    
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])


cans=m//ans
if cans%2==0:
    print(cans//2)
else:
    cans=(cans+1)//2
    print(cans)
# Judge status: Accepted
#ABC127_C
N,M=map(int,input().split())

L=[]
R=[]

for i in range(M):
    l,m=map(int,input().split())
    L.append(l)
    R.append(m)

if min(R)<max(L):
    print(0)
else:
    print(min(R)-max(L)+1)
# Judge status: Wrong Answer
_N, _M = map(int, input().split())
N = max(_N, _M)
M = min(_N, _M)
tate = max(0, N - 2)
yoko = max(0, M - 2)
if M == 1 and N > 2:
    print(N - 2)
    exit()
print(tate * yoko)
# Judge status: Accepted
N,K =map(int,input().split())
S=str(input())
h=S[K-1]
h=str.swapcase(h)
S=S[:K-1]+h+S[K:]
print(S)
# Judge status: Accepted
N = int(input())

# dp[i] i円引き出すのに必要な手数
dp = [101010] * 201010
money = [1]
t = 6
q = 9
while t <= N:
    money.append(t)
    t*=6
while q <= N:
    money.append(q)
    q*=9

for m in money:
    dp[m] = 1

for i in range(1,N):
    for m in money:
        dp[i+m] = min(dp[i+m], dp[i]+1)

print(dp[N])
# Judge status: Wrong Answer
sum=0
for i in range(5):
  A=int(input())
  s=((A//10)+1)*10
  #print(s)
  sum+=s
print(sum)
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
print(A*N//(A+B) + N%(A+B))
# Judge status: Wrong Answer
n = int(input())
result = "Yes"
w = list(input())
for i in range(n - 1):
  s = input()
  if s in w:
    result = "No"
  elif s[0] != w[-1][-1]:
    result = "No"
print(result)
# Judge status: Accepted
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N = int(input())
N_List = []
for i in range(N):
    N_List.append(int(input()))

print(lcm_list(N_List))
# Judge status: Accepted
N, W = map(int, input().split())
wv = []
for _ in range(N):
    wv.append(tuple(map(int, input().split())))

dp = [0]*(W+1)

for w, v in wv:
    newdp = dp[:]
    for ww in range(W+1):
        if w+ww > W:
            continue
        newdp[w+ww] = max(dp[ww+w], dp[ww]+v)
    dp = newdp

print(dp[-1])
# Judge status: Accepted
#ABC060 B:Choose Integers

a,b,c = map(int, input().split())
ans = 'NO'

for i in range(b):
    num = i * a
    mod = num % b
    if mod == c:
        ans = 'YES'
        break
print(ans)
# Judge status: Accepted
a = [str(input()) for i in range(2)]
s = a[0]
t = a[1]
s_l = len(s)
S = s + t[s_l]
if S == t:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
[N, K] = list(map(int, input().split()))
A = list(map(int, input().split()))

gakki = [[i-j for j in range(K)] for i in range(K - 1, N)]
hyoka = []
for G in gakki:
  Hyo = 1
  for i in range(K):
    Hyo *= A[G[i]]
  hyoka.append(Hyo)
for i in range(K - 1):
  if hyoka[i + 1] > hyoka[i]:
    print('Yes')
  else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
S = [input() for i in range(n)]
m = int(input())
T = [input() for j in range(m)]

ANS = []
for i in range(len(S)):
  p = 0
  q = 0
  for j in range(len(S)):
    if S[i]== S[j]:
      p += 1
  for k in range(len(T)):
    if S[i] == T[k]:
      q += -1
  ANS.append(p+q)

print(ANS)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
K = 0
p = 0
bricks = [[] for i in range(N)] #iと書かれたレンガがどこにあるか

for i in range(N):
  bricks[a[i] - 1].append(i)
print(bricks)

for i in range(N):
  if len(bricks[i]) == 0:
    break
  elif bricks[i][-1] < p:
    break
  else:
    for j in bricks[i]:
      if j >= p:
        p = j
        K += 1
        break
if K == 0:
  print(-1)
else:
  print(N - K)
# Judge status: Accepted
a,b=map(int,input().split())
x=[2,3,4,5,6,7,8,9,10,11,12,13,1]
i=x.index(a)
j=x.index(b)
print('Draw' if i==j else ('Alice' if i>j else 'Bob'))
# Judge status: Accepted
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = list(input())
d = {'r':P, 's':R, 'p':S}

ans = 0

for i in range(N):
    if i < K:
        ans += d[T[i]]
    else:
        if T[i] != T[i - K]:
            ans += d[T[i]]
        else:
            T[i] = 'z'

print(ans)
# Judge status: Accepted
N = int(input())
S = input()

r = S.count('R')
g = S.count('G')
b = S.count('B')

ans = r * g * b

for i in range(1, (N - 1) // 2 + 1):
    for j in range(N - i * 2):
        if S[j] != S[j+i] and S[j] != S[j+2*i] and S[j+i] != S[j+2*i]:
            ans -= 1

print(ans)
# Judge status: Accepted
from sys import stdin
from math import ceil
def main():
	readline=stdin.readline
	N=int(readline())
	a=list(map(int,readline().split()))
	b=list(map(int,readline().split()))
	a_count=0
	s=sum(b)-sum(a)

	for i in range(N):
		if a[i]<b[i]:
			a_count+=ceil((b[i]-a[i])/2)

	if a_count<=s:
		print("Yes")
	else:
		print("No")

if __name__=="__main__":
	main()
# Judge status: Accepted
def chmax(a, b):
    if a < b:
        return b
    return a

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

dp = [[-float('inf') for i in range(3)] for j in range(N)]

dp[0] = H[0]

for i in range(1, N):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = chmax(dp[i][j], dp[i-1][k]+H[i][j])

print(max(dp[-1]))
# Judge status: Wrong Answer
n,l = list(map(int,input().split()))
n_l = []
for i in range(n):
    n_l.append(i+l)

print(n_l)
min_i = n_l[0]
for i in n_l:
    print(i)
    if abs(i) < abs(min_i):
        min_i = i

print(sum(n_l) - min_i)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
res = 10**9
left = 0
right = sum(A)
for i in range(N):
    left += A[i] 
    right -= A[i]
    res = min(res,abs(left-right))
print(res)
# Judge status: Accepted
import io

nim = int(input())
 
mike = list(map(int,input().split()))
 
counter = 0

for i in range(nim):
    t = mike[i:i+3]
    if len(t) == 3:
        if max(t) > t[1] and min(t) < t[1]:
            counter += 1
            
            
print(counter)
# Judge status: Accepted
n=input()
if n[-1]=="3":
    print('bon')
elif n[-1]=="0" or n[-1]=="1" or n[-1]=="6" or n[-1]=="8":
    print('pon')
else:
    print("hon")
# Judge status: Wrong Answer
N, A, B = map(int, input().split())

def keta_sum(x):
    sum = 0
    while x%10 !=0:
        sum += x%10
        x = x//10
    return(sum)

#cnt=0
total=0
for x in range(N+1):
    y = keta_sum(x)
    if A<=y<=B:
        #cnt +=1
        total +=x 
            
print(total)
# Judge status: Accepted
X = int(input())
cnt = 1
for b in range(1,X):
    for p in range(2,X):
        if b**p <= X:
          cnt = max(cnt, b**p)
        else: break
print(cnt)