Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import numpy as np
N,K=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())), reverse=True))

l=-1
r=10**12+2
mid=(l+r)//2
while r-l>1:
    m=0
    for i in range(N):
        a=mid//F[i]
        m+=max(0,A[i]-a)
    if m>K:
        l=mid
    else:
        r=mid
    mid=(l+r)//2
print(l+1)  

### FIXED CODE ###

import numpy as np
N,K=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())), reverse=True))
s=A.sum()
l=-1
r=10**12+2
while l+1<r:
    m=(l+r)//2
    if s-np.minimum(A,m//F).sum()<=K:
        r=m
    else:
        l=m
print(r)
### BUGGY CODE ###

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

for k in range(K):
  B = [0] * N
  for i in range(N):
    l = max(0, i - A[i])
    r = i + A[i] + 1
    B[l] += 1
    if r < N:
      B[r] -= 1

  for j in range(N - 1):
    B[j + 1] += B[j]
  
  if A == B:
    break
  A = B
  
for b in B:
  print(b, end=" ")

### FIXED CODE ###

from numba import jit

@jit
def solve(N, K, A):
  for k in range(K):
    B = [0] * N
    for i in range(N):
      l = max(0, i - A[i])
      r = i + A[i] + 1
      B[l] += 1
      if r < N:
        B[r] -= 1

    for j in range(N - 1):
      B[j + 1] += B[j]
  
    if A == B:
      return B
    A = B
  return B
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = solve(N, K, A)
for b in B:
  print(b, end=" ")
### BUGGY CODE ###

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

def main():
    X, Y, Z, K = map(int, input().split())
    A, B, C = [sorted(map(int, input().split())) for _ in range(3)]

    AB = []
    for i, a in enumerate(A):
        for j, b in enumerate(B):
            AB.append(a + b)
    AB = sorted(AB, reverse=True)[:K]

    ans = []
    for i, ab in enumerate(AB):
        for j, c in enumerate(C):
            ans.append(ab + c)
    ans = sorted(ans, reverse=True)[:K]
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()


### FIXED CODE ###

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

def main():
    X, Y, Z, K = map(int, input().split())
    A, B, C = [sorted(map(int, input().split())) for _ in range(3)]

    AB = [a + b for a in A for b in B]
    AB = sorted(AB, reverse=True)[:K]

    ABC = [ab + c for ab in AB for c in C]
    ABC = sorted(ABC, reverse=True)[:K]
    for i in ABC:
        print(i)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
arr = input().split()
x = 0
y = 0
for i in range(n):
    arr[i] = int(arr[i])
min_xy = abs(arr[0] - sum(arr[1:]))
for i in range(1,n):
    x = sum(arr[:i])
    y = sum(arr[i:])
    if min_xy > abs(x - y):
        min_xy = abs(x - y)
print(min_xy)



### FIXED CODE ###

n = int(input())
arr = list(map(int,input().split()))
sum_arr = sum(arr)
ans=[]
x = 0
for i in range(n-1):
    x += arr[i]
    y = sum_arr - x
    ans.append(abs(x - y))
print(min(ans))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
a_ = []
flag = 0

for aa in a:
    if aa not in a_:
        a_.append(aa)
    else:
        flag = 1
        break

if flag == 1:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

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

a = set(a)

if n == len(a):
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

N = int(input())
S = []
ci = 0
for i in range(N):
    count = 0
    Item = input()
    for n in range(len(S)):
        if S[n] == Item:
             break
        else:
             count += 1
    if count == len(S):
        S.append(Item)
        ci += 1
print(ci)
    

### FIXED CODE ###

N = int(input())
S = []
ci = 1
for i in range(N):
    S.append(input())
S.sort()
for i in range(N-1):
    if S[i] !=  S[i +1]:
        ci +=1


print(ci)
### BUGGY CODE ###

import copy

def culc(k):
    cnt_0=0
    cnt_1=0
    for i in xrange(r):
        if osenbei1[i][k]==1:
            cnt_1+=1
        else:
            cnt_0+=1
    return max(cnt_0,cnt_1)

def rev(j):
    for i in xrange(c):
        if osenbei1[j][i]==1:
            osenbei1[j][i]=0
        else:
            osenbei1[j][i]=1
while 1:
    r,c=map(int,raw_input().split())
    if r==c==0:break
    osenbei=[map(int,raw_input().split()) for _ in xrange(r)]
    r_cnt=[[0]*2 for _  in xrange(r)]
    c_cnt=[[0]*2 for _  in xrange(c)]
    dp=[[0]*(c+1) for _ in xrange(1<<r)]
    for i in xrange(1<<r):
        osenbei1=copy.deepcopy(osenbei)
        for j in xrange(r):
            if i&(1<<j):
                rev(j)
        for k in xrange(c):
            dp[i][k+1]=dp[i][k]+culc(k)
    ans=-1
    for i in xrange(1<<r):
        ans=max(ans,max(dp[i]))
    print(ans)

### FIXED CODE ###

while 1:
    r,c=map(int,raw_input().split())
    if r==c==0:break
    osenbei=[map(int,raw_input().split()) for _ in xrange(r)]
    r_osenbei=[None]*c
    for i in xrange(c):
        st=""
        for j in xrange(r):
            st+=str(osenbei[j][i])
        r_osenbei[i]=int(st,2)
    ans=-1
    for i in xrange(1<<r):
        cnt=0
        for j in xrange(c):
            n=bin(i^r_osenbei[j]).count('1')
            cnt+=max(n,r-n)
        ans=max(ans,cnt)
    print(ans)
### BUGGY CODE ###

from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n,k=In()
        l=list(In())   
        ans=[]
        t=1
        last=1
        for x in range(n):
            if x<k:
                last*=l[x]
            else:
                temp=last//l[x-k]
                temp*=l[x]
                if temp>last:
                    ans.append('Yes')
                else:
                    ans.append('No')
                last=temp
        for x in ans:
            stdout.write(x+'\n')

    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()




### FIXED CODE ###

from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')): 
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))

def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_right(a, x)
    if i != len(a):
        return i
    else:            
        return -1

def main():
    try:
        n,k=In()
        l=list(In())   
        ans=[]
        t=1
        last=1
        for x in range(k,n):
            if l[x-k]>=l[x]:
                print('No')
            else:
                print('Yes')


    except:
        pass
        
M = 998244353
P = 1000000007
 
if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()
### BUGGY CODE ###

import numpy as np

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

for i in range(N):
    a = A_l[i:i+K]
    b = A_l[i+1:i+K+1]
    if len(a) == K and len(b) == K:
        if np.prod(a) < np.prod(b):
            print('Yes')
        else:
            print('No')
 

### FIXED CODE ###

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

for i in range(N):
    try:
        if A_l[i] < A_l[i+K]:
            print('Yes')
        else:
            print('No')
    except:
        pass
### BUGGY CODE ###

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

num = [0] * (len(a)+1)
for i in range(0,n):
    for j in range(len(a)):
        if a[j] == i+1:
            num[i] += 1
    print(num[i]) 

### FIXED CODE ###

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

num = [0] * n

for i in a:
    num[i-1] += 1

print(*num)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import itertools

def solve(N: int, x: "List[int]", y: "List[int]"):
    if N == 1:
        print(1)
        return

    PL = list(zip(x,y))

    mincost = float('inf')
    for seq in itertools.permutations(PL):
        cost = 1
        p = seq[1][0] - seq[0][0]
        q = seq[1][1] - seq[0][1]
        #print(seq)
        for i in range(1,len(seq)):
            p2 = seq[i][0] - seq[i-1][0] 
            q2 = seq[i][1] - seq[i-1][1] 
            #print(p,p2,q,q2)
            if p != p2 or  q != q2:
                cost += 1
            if cost >= mincost:
                break
        mincost = min(mincost,cost)

    print(mincost)
            


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]" 
    y = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, x, y)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import itertools
import operator
import collections

def solve(N: int, x: "List[int]", y: "List[int]"):
    if N == 1:
        print(1)
        return

    PL = list(zip(x,y))
    PL.sort(key = operator.itemgetter(0,1))

    pqdic = collections.defaultdict(list)
    for i in range(N-1):
        for j in range(i+1,N):
            p = PL[j][0] - PL[i][0]
            q = PL[j][1] - PL[i][1]
            pqdic[p,q].append((i,j))

    max_pqlen = 0
    for k,v in pqdic.items():
        max_pqlen = max(max_pqlen,len(v))

    print(N - max_pqlen)




# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]" 
    y = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, x, y)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


def sol(n, q, s, ll, lr):
    aas = []
    a_append = aas.append
    for i in range(1,n):
        if s[i-1]=="A" and s[i]=="C":
            a_append(i)
    
    rsw = [0]
    a = 0
    rs_append = rsw.append
    for i in range(1,n+1):
        if i in aas:
            a += 1
        rs_append(a)

    ans = 0
    for i in range(q):
        ans = rsw[lr[i]-1]-rsw[ll[i]-1]
        print(ans)

def main():
    
    import sys
    input = sys.stdin.readline 
    l = list(map(int, input().split()))
    n = l[0]
    q = l[1]
    s = input()
    ll = []
    lr = []
    l_append = ll.append
    r_append = lr.append
    for i in range(q):
        l, r = list(map(int, input().split()))
        l_append(l)
        r_append(r)

    sol(n,q,s,ll,lr)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n, q = map(int, input().split())
s=input().rstrip("\n")

cnt=[0]
c=0
for i in range(n-1):
    if s[i:i+2]=="AC":
        c+=1
    cnt.append(c)
#print(cnt)
for i in range(q):
    l, r = map(int, input().split())
    print(cnt[r-1]-cnt[l-1])
### BUGGY CODE ###

from collections import* #defaultdict Counter deque appendleft
import sys
input=sys.stdin.readline

def main():
    n=int(input())
    d=[[]]+[deque(map(int,input().split()))for i in n*[0]]
    immortalskip=set()
    
    c=0
    while any(d):
        c+=1
        f=0
        skip=set()
        for i in range(1,n+1):
            if i in immortalskip:
                continue
            if i not in skip:
                if d[i]:
                    if d[i][0] in skip:
                        continue
                    elif i==d[d[i][0]][0]:
                        oppo=d[i].popleft()
                        d[oppo].popleft()
                        skip.add(oppo)
                        skip.add(i)
                        f=1
                else:
                    immortalskip.add(i)
                            
        if not f:
            print(-1)
            exit()

    print(c)

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import* #defaultdict Counter deque appendleft
import sys
input=sys.stdin.readline
import time
t=time.time()

def main():
    n=int(input())
    d=[[]]+[deque(map(int,input().split()))for i in n*[0]]

    c=0
    while any(d):
        c+=1
        f=0
        skip=set()
        for i in range(1,n+1):
            if i not in skip:
                if d[i]:
                    if d[i][0] in skip:
                        continue
                    elif i==d[d[i][0]][0]:
                        oppo=d[i].popleft()
                        d[oppo].popleft()
                        skip.add(oppo)
                        skip.add(i)
                        f=1

        if not f:
            print(-1)
            exit()
        if abs(time.time()-t)>1:
            print(n*(n-1)//2)
            exit()

    print(c)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

# O(n) solution (Accepted)
# Author : code_marshal

n, k = map(int, input().split())
a = list(map(int, input().split()))
l, m = [], 1
for i in range(n):
    l.append(a[i])
    m*=a[i]
    if i>=k:
        n = m//a[i]
        m//=l.pop(0)
        if n<m: print('Yes')
        else: print('No')

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    if i>=k:
      if a[i]>a[i-k]: print('Yes')
      else: print('No')
### BUGGY CODE ###

import sys
input=sys.stdin.readline
n = int(input())
orga = list(map(int, input().split()))

if n==1:
    print(1)
    exit()
if len(set(orga)) == 1:
    print(0)
    exit()

import collections
c = collections.Counter(orga)
a=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        a.append(num)

aset=set(orga)

def m_div(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            if i != n // i:
                divisors.add(n//i)
    divisors.remove(n)
    return divisors

ans=0
for num in a:
    divset=m_div(num)
    if len(divset & aset)==0:
        ans+=1

print(ans)

### FIXED CODE ###

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

if n==1:
    print(1)
    exit()

maxa=max(a)
dp=[0]*(maxa+100)
for num in a:
    for i in range(2,10**10):
        if num*i > (maxa+50):
            break
        dp[num*i]=1

import collections
c = collections.Counter(a)

aa=[]
for itm in c.items():
    num,cnt=itm
    if cnt==1:
        aa.append(num)

ans=0
for num in aa:
    if dp[num]==0:
        ans+=1
print(ans)
### BUGGY CODE ###

from itertools import accumulate

def solve():
	n, X, *x = map(int, open(0).read().split())
	acc = [0] + list(accumulate(x))
	ans = 1 << 60
	for div in range(1, n + 1):
		cost = 0
		phase = 1
		i = n
		while i > 0 and cost < ans:
			cost += (acc[i] - acc[max(i - div, 0)]) * max(5, 2 * phase + 1)
			i -= div
			phase += 1
		cost += (div + n) * X
		if cost < ans:
			ans = cost
	print(ans)

if __name__ == "__main__":
	solve()

### FIXED CODE ###

from itertools import accumulate

def solve():
	n, X, *x = map(int, open(0).read().split())
	acc = [0] + list(accumulate(x))
	ans = 1 << 60
	for div in range(1, n + 1):
		cost = 0
		phase = 1
		i = n
		while i > 0 and cost < ans:
			cost += (acc[i] - acc[max(i - div, 0)]) * max(5, 2 * phase + 1)
			i -= div
			phase += 1
		cost += (div + n) * X
		if cost < ans:
			ans = cost
	print(ans)

if __name__ == "__main__":
	solve()
### BUGGY CODE ###

# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N, K, Q = invr()
S = [K] * (N+1)

for i in range(1, Q+1):
    a = inp()
    for j in range(1, N+1):
        if j != a:
            S[j] -= 1
for i in range(1, N+1):
    if S[i] > 0:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N, K, Q = invr()
S = [K] * (N+1)
t = 0
for i in range(1, Q+1):
    a = inp()
    S[a] += 1
    t += 1

for i in range(1, N+1):
    if S[i] - t > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

from bisect import bisect_left
def binary_search(A,p):
  if A[0]<=p and p<=A[-1]:
    if p == A[bisect_left(A,p)]:
      return True
    return False
  return False
def solve():
  ans = 0
  N = int(input())
  stacks = [list(map(lambda x:int(x)-1, input().split()))[::-1] for _ in range(N)]
  cnt = 0
  while cnt<N*(N-1)//2:
    lis = [[] for _ in range(N)]
    flag = False
    for i in range(N):
      if not stacks[i]:
        continue
      if lis[i] and binary_search(lis[i],stacks[i][-1]):
        stacks[stacks[i][-1]].pop(-1)
        stacks[i].pop(-1)
        cnt += 1
        flag=True
      else:
        lis[stacks[i][-1]].append(i)
    if flag==False:
      return -1
    ans += 1
  return ans
print(solve())

### FIXED CODE ###

def solve():
  ans = 0
  N = int(input())
  stacks = [list(map(lambda x:int(x)-1, input().split()))[::-1] for _ in range(N)]
  lis = [0]*N
  cnt = 0
  now = 0
  flag = 0
  while cnt<N*(N-1)//2:
    while not stacks[now]:
      now = (now+1)%N
    a = stacks[now][-1]
    while not stacks[a]:
      now = (now+1)%N
      a = stacks[now][-1]
    if stacks[a][-1] == now:
      lis[now] = max(lis[now],lis[a])+1
      lis[a] = lis[now]
      stacks[a].pop(-1)
      stacks[now].pop(-1)
      cnt += 1
      flag = 0
    else:
      now = a
      flag += 1
    if flag==N:
      return -1
  ans = max(lis)
  return ans
print(solve())
### BUGGY CODE ###

import copy
def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    m = 3500
    dp = [[False]*(m+1) for _ in range(w)]
    dp[0][abs(a[0][0] - b[0][0])] = True
    for i in range(1, w):
        x = abs(a[0][i] - b[0][i])
        for j in range(m+1):
            if dp[i-1][j]:
                if j+x <= m:
                    dp[i][j+x] = True
                dp[i][abs(j-x)] = True
    for i in range(1, h):
        for j in range(w):
            buf = [False]*(m+1)
            x = abs(a[i][j] - b[i][j])
            for k in range(m+1):
                f = False
                if j == 0:
                    if dp[0][k]:
                        f = True
                else:
                    if dp[j-1][k] or dp[j][k]:
                        f = True
                if f:
                    if k+x <= m:
                        buf[k+x] = True
                    buf[abs(k-x)] = True
            dp[j] = copy.deepcopy(buf)
    for i in range(m+1):
        if dp[w-1][i]:
            print(i)
            break

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
def main():
    h, w = map(int, input().split())
    a = [list(map(int, input().split())) for _ in range(h)]
    b = [list(map(int, input().split())) for _ in range(h)]
    n = 80*(80+80) + 10
    m = n//2
    dp = [[None]*w for i in range(h)]
    for i in range(h):
        for j in range(w):
            dp[i][j] = np.zeros(n, np.bool)
    dp[0][0][m+abs(a[0][0] - b[0][0])] = True
    dp[0][0][m-abs(a[0][0] - b[0][0])] = True
    for i in range(h):
        for j in range(w):
            x = abs(a[i][j] - b[i][j])
            if 0 < i and 0 < h:
                dp[i][j][x:] |= dp[i-1][j][:n-x]
                dp[i][j][:n-x] |= dp[i-1][j][x:]
                dp[i][j][x:] |= dp[i][j-1][:n-x]
                dp[i][j][:n-x] |= dp[i][j-1][x:]
            elif 0 < i:
                dp[i][j][x:] |= dp[i-1][j][:n-x]
                dp[i][j][:n-x] |= dp[i-1][j][x:]
            elif 0 < j:
                dp[i][j][x:] |= dp[i][j-1][:n-x]
                dp[i][j][:n-x] |= dp[i][j-1][x:]
    ans = float("inf")
    for i in range(m-80-1, m+80+2):
        if dp[h-1][w-1][i]:
            ans = min(ans, abs(m-i))
    print(ans)

if __name__ == "__main__":
    main()
### BUGGY CODE ###

n, q = [int(i) for i in input().split()]
s = input()
l =[]
r =[]
for i in range(q):
    l1, r1 = [int(i) for i in input().split()]
    l.append(l1)
    r.append(r1)

for i in range(q):
    str = s[l[i]-1:r[i]]
    #print(str)
    print(str.count("AC"))


### FIXED CODE ###

n, q = [int(i) for i in input().split()]
s = input()
l =[]
r =[]
for i in range(q):
    l1, r1 = [int(i) for i in input().split()]
    l.append(l1)
    r.append(r1)

Sum = [0]
for i in range(len(s)):
    if s[i-1]=="A" and s[i]=="C":
        Sum.append(Sum[i]+1)
    else:
        Sum.append(Sum[i])

#print(Sum)
for i in range(q):
    print(Sum[r[i]]-Sum[l[i]])
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
count=0
ans=None

for i in range(n-k+1):
  s=a[count:k+count]
  gakki=1
  count+=1
  for w in s:
    gakki*=w
  
  
  if ans is None:
    ans=gakki
  else:
    if ans<gakki:
      print('Yes')
      ans=gakki
    else:
      print("No")
      ans=gakki

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n-k):
  if a[i]<a[k+i]:
    print('Yes')
  else:
    print("No")