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

from heapq import heapify, heappush, heappop

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

day = [[] for _ in range(10 ** 5)]
for a, b in ab:
    day[a - 1].append(-b)

work, ans = [], 0
for i in range(m):
    if day[i]:
        work+=day[i]
        heapify(work)
    if len(work) > 0:
        ans -= heappop(work)
print(ans)


### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
import heapq
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(reverse=True)
h=[]
# print(ab)
ans=0
for i in range(m):
    while(ab and ab[-1][0]<=i+1):
        heapq.heappush(h,-ab[-1][1])
        ab.pop()
    if h:
        ans-=heapq.heappop(h)
    # print(ab)
    # print(ans)


print(ans)
### BUGGY CODE ###

import numpy

N = int(input())
p = [int(x) for x in input().split()]
p = [0] + p + [0]

for i in range(1, N + 1):
    q = p[:i] + p[i+1:]
    print(numpy.sum(numpy.abs(numpy.diff(q))))

### FIXED CODE ###

import numpy

N = int(input())
p = [int(x) for x in input().split()]
p = [0] + p + [0]

S = numpy.sum(numpy.abs(numpy.diff(p)))

for i in range(1, N + 1):
    print(S - numpy.abs(p[i] - p[i - 1]) - numpy.abs(p[i + 1] - p[i]) + numpy.abs(p[i + 1] - p[i - 1]))
### BUGGY CODE ###

H,W,N = map(int,input().split())
ans = [0 for i in range(10)]
ab = []
for i in range(N):
    a,b =map(int,input().split())
    a -= 1
    b -=1
    ab.append([a,b])
ab.sort()
start = set()
h1 = [-2,-2,-2,-1,-1,-1,0,0,0]
w1 = [-2,-1,0,-2,-1,0,-2,-1,0]
for a,b in ab:
    for i in range(9):
        if 0<= a+h1[i]<= H-3 and 0<= b+w1[i]<=W-3:
            start.add((a+h1[i],b+w1[i]))
h2 = [2,2,2,1,1,1,0,0,0]
w2 = [2,1,0,2,1,0,2,1,0]
for a,b in start:
    count = 0
    for i in range(9):
        if [a+h2[i],b+w2[i]] in ab:
            count += 1
    if count:
        ans[count] += 1
ans[0] = (H-2)*(W-2) - sum(ans)
for i in ans:
    print(i)

### FIXED CODE ###

from collections import Counter
H,W,N = map(int,input().split())
ab = []
corner = []
countlist = [0 for i in range(10)]
for i in range(N):
    a,b = map(int,input().split())
    for h in range(-2,1):
        for w in range(-2,1):
            if 1 <= a+h <= H-2 and 1 <= b+w <= W-2:
                corner.append((a+h,b+w))
cc = Counter(corner)
clist = list(cc.values())
clistc = Counter(clist)
for k,v in clistc.items():
    countlist[k] += v
countlist[0] = (H-2)*(W-2) - sum(countlist)
for i in countlist:
    print(i)
### BUGGY CODE ###

from bisect import bisect_left
N = int(input())
upper = sorted(list(map(int, input().split())))
middle = sorted(list(map(int, input().split())))
lower = list(map(int, input().split()))

ans = 0
for l in lower:
    idx = bisect_left(middle, l)
    if idx>=1:
        for m in middle[:idx]:
            idx2 = bisect_left(upper, m)
            ans += idx2
print(ans)

### FIXED CODE ###

from bisect import bisect_left, bisect_right
N = int(input())
upper = sorted(list(map(int, input().split())))
middle = list(map(int, input().split()))
lower = sorted(list(map(int, input().split())))

ans = 0
for m in middle:
    idx_u = bisect_left(upper, m)
    idx_l = N-bisect_right(lower, m)
    ans += idx_u*idx_l
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))

ans=0
cnt=0
for j in range(n*n//2+1):
    f=0
    q=[]
    for i in range(n):        
        if len(a[i])>0 and len(a[a[i][0]-1])>0 and i+1==a[a[i][0]-1][0] and i<a[i][0]-1:
            #a[a[i][0]-1].pop(0)
            #a[i].pop(0)
            q.append(i)
            q.append(a[i][0]-1)
            f+=1    
            cnt+=1
    if len(q)>0:
        for k in q:
            a[k].pop(0)
            
            
    if f==0 and cnt<n*(n-1)//2:
        print(-1)
        exit()
    elif f>0:
        ans+=1
    else:
        print(ans)
        exit()


### FIXED CODE ###

from sys import setrecursionlimit as SRL, stdin

SRL(10 ** 7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

q = [[]]
l = [0] * 1005
d = [0] * 1005
hv = [0] * 1005

def dfs(x,y):
    hv[x] = 1
    for i in range(l[x],n-1):

        if q[x][i] == y:
            l[x] = i+1
            hv[x] = 0

            d[q[x][i]] += 1
            d[x] += 1
            d[x] = max(d[x],d[q[x][i]])
            d[q[x][i]] = max(d[x], d[q[x][i]])

            return
        if hv[q[x][i]]:
            print(-1)
            exit(0)
        dfs(q[x][i],x)
        d[x] = max(d[q[x][i]],d[x])


    hv[x] = 0
    l[x] = n

n = int(input())
for i in range(n):
    a = list(rrd())
    q.append(a)

for i in range(1,n+1):
    dfs(i,0)

print(max(d))
### BUGGY CODE ###

import sys


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


MOD = 998244353



def power(a, n):
    x = 1
    while n:
        if n & 1:
            x = x * a % MOD
        n >>= 1
        a = a * a % MOD
    return x


def main():
    N, M, K = map(int, input().split())
    answer = M * power(M - 1, N - 1)
    nowu = N - 1
    nowd = 1
    now = 1
    for i in range(K):
        now = now * (nowu) // (nowd)
        ans = M * power(M - 1, N - 1 - i - 1) * now
        nowu -= 1
        nowd += 1
        answer += ans
        answer %= MOD
    print(answer % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


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


MOD = 998244353


class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """

    def __init__(self, n_max, mod=10 ** 9 + 7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        if n < r:
            return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n + 1):
            fac.append(fac[i - 1] * i % self.mod)
            facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n + 1)
        modinv[1] = 1
        for i in range(2, n + 1):
            modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
        return modinv


def power(a, n):
    x = 1
    while n:
        if n & 1:
            x = x * a % MOD
        n >>= 1
        a = a * a % MOD
    return x


def main():
    N, M, K = map(int, input().split())
    answer = 0
    combination = Combination(2 * 10 ** 5 + 1, MOD)
    for i in range(K + 1):
        answer += M * power(M - 1, N - i - 1) * combination(N - 1, i) % MOD
    print(answer % MOD)


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

# -*- coding: utf-8 -*-
import sys
s = input()
count = 0
count += s.count('ABC')
while count != 0:
    s = s.replace("ABC", "BCA")
    count += s.count('ABC')
print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = input()
s = s.replace("BC", "X")
count = 0
a_stack = 0
for idx, char in enumerate(s):
    if char == "A":
        a_stack += 1
    elif char == "X":
        count += a_stack
    else:
        a_stack = 0
print(count)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
INF = 10 ** 20
MOD = 10**9 + 7
def combmod(n, k, mod=MOD):
    if k == 0:
        return 1
    if k == 1:
        return n
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod

    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod

    return ret

def main():
    n, k = getList()
    if k >= n-1:
        ans = combmod(n+n-1, n)
    else:
        ans = 0
        for i in range(k+1):
            tmp = combmod(n-1, i)
            tmp *= combmod(n, i)
            tmp %= MOD
            ans += tmp
            ans %= MOD
        # ans = combmod(n, k+1)
        # print(ans)
        # ans *= combmod(k+k+1, k+1)
        # # ans %= MOD
    print(ans)


if __name__ == "__main__":
    main()



### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math
INF = 10 ** 20
MOD = 10**9 + 7
def combmod(n, k, mod=MOD):
    if k == 0:
        return 1
    if k == 1:
        return n
    ret = 1
    for i in range(n - k + 1, n + 1):
        ret *= i
        ret %= mod

    for i in range(1, k + 1):
        ret *= pow(i, mod - 2, mod)
        ret %= mod

    return ret

def main():
    n, k = getList()
    if k >= n-1:
        ans = combmod(n+n-1, n)
    else:
        # ans = 0
        ans = 1
        tmp = 1
        for i in range(1, k+1):
            tmp *= n-i
            tmp *= n + 1 - i
            tmp *= pow(i, MOD-2, MOD)
            tmp *= pow(i, MOD - 2, MOD)
            ans += tmp
            tmp %= MOD
            # tmp = combmod(n-1, i)
            # tmp *= combmod(n, i)
            # tmp %= MOD
            # ans += tmp
            ans %= MOD
        # ans = combmod(n, k+1)
        # print(ans)
        # ans *= combmod(k+k+1, k+1)
        # # ans %= MOD
    print(ans)


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

from collections import deque
S = input()
Q = int(input())
not_reversed = True
for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        not_reversed = not not_reversed 
        continue
    
    else:
        if not_reversed == 1 and query[1] == "1":
            S = query[2] + S

        elif not not_reversed == -1 and query[1] == "1":
            S = S + query[2]

        if not_reversed == 1 and query[1] == "2":
            S = S + query[2]
            
        elif not not_reversed == -1 and query[1] == "2":
            S = query[2] + S

if not_reversed == False:
    S = list(S)
    S.reverse()
    print("".join(map(str, S)))
else:
    print(S)

### FIXED CODE ###

from collections import deque
S = deque(input())
Q = int(input())
is_reversed = 1
for _ in range(Q):
    query = list(input().split())
    if query[0] == "1":
        is_reversed *= -1
    
    else:
        if is_reversed == 1:
            if query[1] == "1":
                S.appendleft(query[2])
            else:
                S.append(query[2])
        else:
            if query[1] == "2":
                S.appendleft(query[2])
            else:
                S.append(query[2])

S = "".join(S)
print(S[::is_reversed])
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    class BIT:
        def __init__(self,n):
            self.tree = [0]*(n+1)
            self.size = n
        
        def add(self,i,x):
            while i <= self.size:
                self.tree[i] += x
                i += i&-i
        
        def sum(self,i):
            s = 0
            while i > 0:
                s += self.tree[i]
                i -= i&-i
            return s

    N,Q = map(int,input().split())
    bit = BIT(N)
    C = list(map(int,input().split()))
    query = [list(map(int,input().split()))+[i] for i in range(Q)]
    query.sort(key=lambda x: x[1])
    ans = []
    #良い玉のindexを1-indexで管理する
    colorMemo = [0]*(N+1)
    i = 1
    for j in range(Q):
        l,r = query[j][:2]
        #良い玉の情報を更新する
        while i <= r:
            c = C[i-1]
            if colorMemo[c]:
                bit.add(colorMemo[c],-1)
            bit.add(i,1)
            colorMemo[c] = i
            i += 1
        query[j].append(bit.sum(r)-bit.sum(l-1))

    query.sort(key=lambda x: x[2])
    for l,r,i,a in query:
        print(a)
main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    class BIT:
        def __init__(self,n):
            self.tree = [0]*(n+1)
            self.size = n
        
        def add(self,i,x):
            while i <= self.size:
                self.tree[i] += x
                i += i&-i
        
        def sum(self,i):
            s = 0
            while i > 0:
                s += self.tree[i]
                i -= i&-i
            return s

    N,Q = map(int,input().split())
    bit = BIT(N)
    C = list(map(int,input().split()))
    query = []
    for i in range(Q):
        l,r = map(int,input().split())
        query.append([l,r,i])
    query.sort(key=lambda x: x[1])
    ans = [0]*Q
    #良い玉のindexを1-indexで管理する
    colorMemo = [0]*(N+1)
    cur = 1
    for q in query:
        l,r,j = q
        #良い玉の情報を更新する
        for i in range(cur,r+1):
            c = C[i-1]
            if colorMemo[c]:
                bit.add(colorMemo[c],-1)
            bit.add(i,1)
            colorMemo[c] = i
        cur = r + 1
        ans[j]=bit.sum(r)-bit.sum(l-1)

    print(*ans, sep="\n")
main()
### BUGGY CODE ###

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

li_kitai = list()
for l in li_p:
    li_kitai.append(sum(range(1, l + 1)) / l)

answer = 0
memo = 0
for idx, v in enumerate(li_kitai[:len(li_kitai) - k + 1]):
    if idx == 0:
        memo = sum(li_kitai[idx:idx + k])
    else:
        memo = memo - li_kitai[idx - 1] + li_kitai[idx + (k - 1)]
    answer = max(answer, memo)

print(answer)




### FIXED CODE ###

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

li_kitai = list()
d_kitai_memo = dict()
for l in li_p:
    if l not in d_kitai_memo:
        val = sum(range(1, l + 1)) / l
        d_kitai_memo[l] = val
        li_kitai.append(val)
    else:
        li_kitai.append(d_kitai_memo[l])

answer = 0
memo = 0
for idx, v in enumerate(li_kitai[:len(li_kitai) - k + 1]):
    if idx == 0:
        memo = sum(li_kitai[idx:idx + k])
    else:
        memo = memo - li_kitai[idx - 1] + li_kitai[idx + (k - 1)]
    answer = max(answer, memo)

print(answer)
### BUGGY CODE ###

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

l_max = len(A)
#print(l_max)
r = 0
count = l_max

for l in range(0, l_max):
    bitSums = A[l]
    Sums = A[l]
    for r in range(l+1, l_max):
        bitSums = bitSums ^ A[r]
        Sums = Sums + A[r]
        #print(Sums)
        if bitSums == Sums:
            count += 1

print(count)

### FIXED CODE ###

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

count = 0
Sum = 0
r = 0

for l in range(0, N):
    #Sum = A[l]
    while r < N and Sum + A[r] == Sum ^ A[r]:
            Sum += A[r]
            r += 1
    count += r-l
    if(l==r):
        r+=1
    else:
        Sum -= A[l]
    
    
print(count)
### BUGGY CODE ###

if __name__ == '__main__':
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(n)]
    ab = sorted(ab, key=lambda x: x[1], reverse=True)

    free_day = set(list(range(m + 1)))
    answer = 0
    for i in range(n):
        max_free_day = max(free_day)
        a = ab[i][0]
        b = ab[i][1]
        work_days = [day for day in free_day if m-day >= a]
        if len(work_days) != 0:
            free_day.remove(max(work_days))
            answer += b
    print(answer)

### FIXED CODE ###

from heapq import heappush, heappop


#  https://atcoder.jp/contests/abc137/submissions/6840855 を参考にした。
q = []
if __name__ == '__main__':
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(n)]
    ab = sorted(ab, reverse=True)

    q = []
    answer = 0
    for i in range(m-1, -1, -1):
        while ab and i + ab[-1][0] <= m:
            (a, b) = ab.pop()
            heappush(q, -b)

        if q:
            answer -= heappop(q)

    print(answer)
### BUGGY CODE ###

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


ans=0
for i in range(n-1):
    a2=0
    ans = ( ans + (a[i]*sum(a[i+1:n])) )%(10**9+7)
print(ans)


### FIXED CODE ###

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

a2=[a[n-1]]
for i in range(n-1,0,-1):
    a2.append(a2[-1]+a[i-1])
ans=0
for i in range(n-1):
    ans = ( ans + (a[i]*a2[-i-2]) )%(10**9+7)
print(ans)
### BUGGY CODE ###

def main():
    N = int(input())
    S = input()
    ans = 0
    for i in range(N - 2):
        for j in range(i, N - 1):
            for k in range(j, N):
                if j - i != k - j:
                    if S[j] != S[i] and S[i] != S[k] and S[k]!=S[j]:
                        ans += 1                                        
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    cnt = 0
    for i in range(N):
        for j in range(i + 1, N):
            k = 2 * j - i
            if k >= N:
                continue
            if S[j] != S[i] and S[i] != S[k] and S[k] != S[j]:
                cnt += 1
    print(S.count("R") * S.count("B") * S.count("G") - cnt)

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

import copy


def center(lst):
    lst.sort()
    value = lst[(len(lst) - 1) // 2]
    return value


def main():
    n = int(input())
    x_lst = list(map(int, input().split()))

    ans_lst = []
    for i in range(n):
        lst = copy.deepcopy(x_lst)
        del lst[i]
        ans_lst.append(center(lst))

    for i in range(n):
        print(ans_lst[i])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    x_lst = list(map(int, input().split()))
    x_sorted_lst = sorted(x_lst)

    median1 = x_sorted_lst[n // 2 - 1]
    median2 = x_sorted_lst[n // 2]

    if median1 == median2:
        lst = [median1] * n

    else:
        lst = []
        for i in range(n):
            x = x_lst[i]

            if x <= median1:
                lst.append(median2)
            elif median2 <= x:
                lst.append(median1)

    for i in range(n):
        print(lst[i])


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

from bisect import bisect_left, bisect_right
from operator import itemgetter
import sys
input = sys.stdin.readline
INF = float("inf")


def main():
    N, Q = map(int, input().split())
    constructions = [None] * N
    for i in range(N):
        S, T, X = map(int, input().split())
        constructions[i] = (S, T, X)
    D = [int(input()) for _ in range(Q)]
    ans = [INF] * Q
    for S, T, X in constructions:
        l = bisect_left(D, S-X)
        r = bisect_right(D, T-X-1)
        for idx in range(l, r):
            ans[idx] = min(X, ans[idx])
    for a in ans:
        if a == INF:
            print(-1)
        else:
            print(a)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from bisect import bisect_left, bisect_right
from operator import itemgetter
import sys
input = sys.stdin.readline


def main():
    N, Q = map(int, input().split())
    constructions = [None] * N
    for i in range(N):
        S, T, X = map(int, input().split())
        constructions[i] = (S, T, X)
    constructions.sort(key=itemgetter(2))
    D = [int(input()) for _ in range(Q)]
    ans = [-1] * Q
    nxt = list(range(1, Q+1))
    for S, T, X in constructions:
        l = bisect_left(D, S-X)
        r = bisect_right(D, T-X-1)
        idx = l
        while idx < r:
            if ans[idx] == -1:
                ans[idx] = X
            nidx = nxt[idx]
            nxt[idx] = max(nxt[idx], r)
            idx = nidx
    for a in ans:
        print(a)


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

from collections import Counter


def resolve():
    n = int(input())
    s = input()
    for i in range(n // 2, 0, -1):
        c = Counter([s[x:x + i] for x in range(n - i + 1)])
        for j in [x for x in c if c.get(x) > 1]:
            if j in s[s.find(j) + i:]:
                print(i)
                return
    print(0)


if __name__ == '__main__':
    resolve()

### FIXED CODE ###

def z_algo(S):
    N = len(S)
    A = [0] * N
    i = 1
    j = 0
    A[0] = l = len(S)
    while i < l:
        while i + j < l and S[j] == S[i + j]:
            j += 1
        if not j:
            i += 1
            continue
        A[i] = j
        k = 1
        while l-i > k < j - A[k]:
            A[i + k] = A[k]
            k += 1
        i += k
        j -= k
    return A


def resolve():
    n = int(input())
    s = input()
    ans = 0
    for i in range(n):
        a = z_algo(s[i:])
        for index, j in enumerate(a):
            if j <= index:
                ans = max(ans, j)
    print(ans)


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

# -*- coding: utf-8 -*-
from itertools import product, combinations
from operator import itemgetter
def inpl(): return tuple(map(int, input().split()))

# B以下の数-A未満の数→bisect(L, B) - bisect_left(L, A)
N, K = inpl()
X = []
Y = []
Px = []
Py = []

for i in range(N):
    x, y = inpl()
    X.append(x)
    Y.append(y)
    Px.append((x, i))
    Py.append((y, i))

X = sorted(X)
Y = sorted(Y)

dX = {x:i for i, x in enumerate(X)}
dY = {y:i for i, y in enumerate(Y)}
Px = sorted(Px)
Py = sorted(Py)

get = itemgetter(1)
res = 5 * 10**18

for (l, r), (d, u) in product(combinations(X, 2), combinations(Y, 2)):
    if (dX[r] - dX[l] < K-1) or (dY[u] - dY[d] < K-1):
        continue
    sx = sum([1 << i for i in map(get, Px[dX[l]:dX[r]+1])])
    sy = sum([1 << i for i in map(get, Py[dY[d]:dY[u]+1])])
    if bin(sx&sy).count("1") >= K:
        res = min(res, (r-l)*(u-d))

print(res)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from itertools import product, combinations
from operator import itemgetter
def inpl(): return tuple(map(int, input().split()))

N, K = inpl()
X = []
Y = []
Px = []
Py = []

for i in range(N):
    x, y = inpl()
    X.append(x)
    Y.append(y)
    Px.append((x, i))
    Py.append((y, i))

X = sorted(X)
Y = sorted(Y)

dX = {x:i for i, x in enumerate(X)}
dY = {y:i for i, y in enumerate(Y)}
Px = sorted(Px)
Py = sorted(Py)

get = itemgetter(1)
res = 5 * 10**18

for (l, r), (d, u) in product(combinations(X, 2), combinations(Y, 2)):
    if (dX[r] - dX[l] < K-1) or (dY[u] - dY[d] < K-1):
        continue
    if res < (r-l)*(u-d):
        continue

    sx = set(map(get, Px[dX[l]:dX[r]+1]))
    sy = set(map(get, Py[dY[d]:dY[u]+1]))
    if len(sx.intersection(sy)) >= K:
        res = min(res, (r-l)*(u-d))

print(res)
### BUGGY CODE ###

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

st = 1 #k楽器
for i in range(k):
    st *= a[i]

j=1
ten = 1
for i in range(k+1,n+1):
    for l in range(j,i):
        ten *= a[l]
    if st < ten:
        print('Yes')
    else:
        print('No')
    j +=1
    st = ten
    ten = 1

### FIXED CODE ###

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

for i in range(n-k):
    if a[i] < a[i+k]:
        print('Yes')
    else:
        print('No')