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

from collections import deque
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    a = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)]

    def calc_idx(x, y):
        if x > y:
            x, y = y, x
        return x + y*(y-1)//2

    # create graphs & calc indegree
    n_game = n * (n-1) // 2
    edge = [[] for i in range(n_game)]
    indegree = [0] * n_game
    for i in range(n):
        for j in range(1, n-1):
            g1 = calc_idx(i, a[i][j-1])
            g2 = calc_idx(i, a[i][j])
            edge[g1].append(g2)
            indegree[g2] += 1


    ans = 0
    cand = [[i for i in range(n_game) if indegree[i] == 0], []]
    cand = deque([(i, 1) for i in range(n_game) if indegree[i] == 0])
    n_ts = 0
    while cand:
        u, day = cand.popleft()
        ans = max(ans, day)
        n_ts += 1
        for v in edge[u]:
            indegree[v] -= 1
            if indegree[v] == 0:
                cand.append((v, day+1))

    if n_ts != n_game:
        ans = -1

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)]

def calc_idx(x, y):
    if x > y:
        x, y = y, x
    return x + y*(y-1)//2

n_game = n * (n-1) // 2
edge = [[] for i in range(n_game)]
for i in range(n):
    for j in range(1, n-1):
        g1 = calc_idx(i, a[i][j-1])
        g2 = calc_idx(i, a[i][j])
        edge[g1].append(g2)

indegree = [0] * n_game
for i in range(n_game):
    for v in edge[i]:
        indegree[v] += 1

ans = 0
cand = [i for i in range(n_game) if indegree[i] == 0]
ts = []
while cand:
    ts.extend(cand)
    cand2 = []
    for ci in cand:
        for v in edge[ci]:
            indegree[v] -= 1
            if indegree[v] == 0:
                cand2.append(v)
    cand = cand2
    ans += 1

if len(ts) != n_game:
    ans = -1

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

def main(input_str):
    nums = list(map(int, input_str.split()))

    result_list = []
    for num_1 in range(nums[0]+1):
        for num_2 in range(nums[0]+1):
            for num_3 in range(nums[0]+1):
                result = num_1 + num_2 + num_3
                if result == nums[1]:
                    result_list.append(result)

    return len(result_list)


if __name__ == "__main__":
    input_str = input()
    print(main(input_str))


### FIXED CODE ###

def main(input_str):
    nums = list(map(int, input_str.split()))

    count = 0
    for num_1 in range(nums[0]+1):
        for num_2 in range(nums[0]+1):
            if 0 <= nums[1]-(num_1+num_2) <= nums[0]:
                count += 1

    return count


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

n = int(input())
a = [int(input()) for i in range(n)]
max_a = max(a)
for i in range(n):
    if max_a == a[i]:
        a[i] = 0
        print(max(a))
        a[i]=max_a
    else: print(max_a)

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
a_1 = max(a)
a_2 = sorted(a)[-2]
for i in a:
    if i != a_1: print(a_1)
    else: print(a_2)
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
for i in range(q):
    a=list(map(int,input().split()))
    print(s.count('AC',a[0]-1,a[1]))

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
b=[0]*(n+1)
y=0
for x,i in enumerate(s):
    if i=="A" and x!=n-1 and s[x+1]=="C":
        y+=1
    b[x+1]=y
for i in range(q):
    a0,a1=map(int,input().split())
    print(b[a1-1]-b[a0-1])
### BUGGY CODE ###

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

DIV=10**9+7

def gcd(a,b):
  if a<b:
    a,b=b,a
  while a%b!=0:
    a,b=b,a%b
  return b

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

sums=0
L=1
for i in range(N):
  newL=lcd(L,A[i])
  if newL!=L:
    sums=(sums*(newL//L)+newL//A[i])%DIV
    L=newL
  else:
    sums=(sums+newL//A[i])%DIV

print(sums)

### FIXED CODE ###

import math
from fractions import gcd
from functools import reduce

DIV=10**9+7

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

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

ans=sum(list(map(lambda x:g//x,A)))
print(ans%DIV)
### BUGGY CODE ###

def sol():
    n,m=map(int,input().split())
    a=[int(i) for i in input().split()]
    d={}
    w=[]
    for i in a:
        if i in d:
            d[i]+=1
        else:
            d[i]=1
            w.append(i)
    w.sort(reverse=True)
    for i in range(m):
        b,c=map(int,input().split())
        while b:
            if c>w[-1]:
                x=min(b,d[w[-1]])
                if c in d:
                    d[c]+=x
                    b-=x
                    d[w[-1]]-=x
                    if d[w[-1]]==0:
                        w.pop()
                else:
                    d[c]=x
                    b-=x
                    d[w[-1]]-=x
                    w.append(c)
                    w.sort(reverse=True)
                    if d[w[-1]]==0:
                        w.pop()
            else:
                break
    ans=chk=0
    for i in d:
        ans+=i*d[i]
    print(ans)

if __name__=="__main__":
    sol()

### FIXED CODE ###

import heapq
def sol():
    n,m=map(int,input().split())
    a=[int(i) for i in input().split()]
    d={}
    w=[]
    q=[]
    for i in a:
        if i in d:
            d[i]+=1
        else:
            d[i]=1
            w.append(i)
    for i in w: heapq.heappush(q, i)
    for i in range(m):
        b,c=map(int,input().split())
        while b:
            if c>q[0]:
                x=min(b,d[q[0]])
                if c in d:
                    d[c]+=x
                    b-=x
                    d[q[0]]-=x
                    if d[q[0]]==0:
                        heapq.heappop(q)
                else:
                    d[c]=x
                    b-=x
                    d[q[0]]-=x
                    heapq.heappush(q,c)
                    if d[q[0]]==0:
                        heapq.heappop(q)
            else:
                break
    ans=chk=0
    for i in d:
        ans+=i*d[i]
    print(ans)

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

K=int(input())
ANS=[]
for i in range(1,10**5):
  LEN=len(str(i))
  STR=str(i)
  if LEN==1:
    ANS+=[i]
  for k in range(LEN-1):
    if abs(int(STR[k])-int(STR[k+1]))>1:
      break
    if k==LEN-2:
      ANS+=[i]
i=10**5
while i<10**7:
  LEN=len(str(i))
  STR=str(i)
  if LEN==1:
    ANS+=[i]
  for k in range(LEN-1):
    if abs(int(STR[k])-int(STR[k+1]))>1:
      i+=10*(LEN-(k+2))
      break
    if k==LEN-2:
      ANS+=[i]
ans=ANS[K-1] 
print(ans)

### FIXED CODE ###

K=int(input())
ANS=[i for i in range(1,10)]
i=0
while len(ANS)<=10**5:
  last=str(ANS[i])[-1]
  if last=="0":
    ANS+=[ANS[i]*10,ANS[i]*10+1]
  elif last=="9":
    ANS+=[ANS[i]*10+8,ANS[i]*10+9]
  else:
    ANS+=[ANS[i]*10+int(last)-1,ANS[i]*10+int(last),ANS[i]*10+int(last)+1]
  i+=1  
ans=ANS[K-1]
print(ans)
### BUGGY CODE ###

from bisect import bisect_left, bisect_right

def readinput():
    n,m=list(map(int,input().split()))
    a=list(map(int,input().split()))
    b=[]
    c=[]
    for _ in range(m):
        bb,cc=list(map(int,input().split()))
        b.append(bb)
        c.append(cc)
    return n,m,a,b,c

def main(n,m,a,b,c):
    a.sort()
    for i in range(m):
        #print(a)
        bi=b[i]
        ci=c[i]
        r=min(bisect_left(a,ci)-1,bi-1)
        if r<0:
            continue
        l=0
        #print(a,bi,ci,l,r)
        a[l:r+1]=[ci]*(r-l+1)
        a.sort()
    sum=0
    for i in range(n):
        sum+=a[i]
    
    return sum

if __name__=='__main__':
    n,m,a,b,c=readinput()
    ans=main(n,m,a,b,c)
    print(ans)


### FIXED CODE ###

from bisect import bisect_left, bisect_right

def readinput():
    n,m=list(map(int,input().split()))
    a=list(map(int,input().split()))
    b=[]
    c=[]
    for _ in range(m):
        bb,cc=list(map(int,input().split()))
        b.append(bb)
        c.append(cc)
    return n,m,a,b,c

def main(n,m,a,b,c):
    a.sort()
    for i in range(m):
        #print(a)
        bi=b[i]
        ci=c[i]
        j=bisect_left(a,ci)-1
        if j<0:
            continue
        if j>bi-1:
            save=a[bi:j+1]
            l=j-bi+1
            r=j
            a[l:r+1]=[ci]*(r-l+1)
            a[0:l]=save
        else:
            l=0
            r=j
            a[l:r+1]=[ci]*(r-l+1)

    sum=0
    for i in range(n):
        sum+=a[i]
    
    return sum

def main2(n,m,a,b,c):
    all=[]
    for i in range(n):
        all.append((a[i],1))
    for i in range(m):
        all.append((c[i],b[i]))
    all.sort(reverse=True, key=lambda x:x[0])
    #print(all)
    count=n
    sum=0
    i=0
    while(count>0):
        ni=all[i][1]
        if ni<=count:
            sum+=all[i][0]*ni
            count-=ni
        else:
            sum+=all[i][0]*count
            count=0
        i+=1
        #print(sum,count)
    return sum

if __name__=='__main__':
    n,m,a,b,c=readinput()
    ans=main2(n,m,a,b,c)
    print(ans)
### BUGGY CODE ###

# 190928 D
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table

A,B = list(map(int,input().split()))
koyaku = gcd(A,B)
kotable = sorted(divisor(koyaku))
isprim, solist = sieve(koyaku)
output = []
for i in range(len(kotable)):
    if kotable[i] in solist:
        output.append(kotable[i])

print(len(output)+1)


### FIXED CODE ###

# 190928 D

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A,B = list(map(int,input().split()))
soA = prime_factorize(A)
soB = prime_factorize(B)
output = []
for i in range(len(soA)):
    if soA[i] in soB:
        output.append(soA[i])

print(len(list(set(output))) + 1)
### BUGGY CODE ###


S = str(input())

count = 0
for i in range(len(S)+1):
    for j in range(i+1, len(S)+1):
        s_p = int(S[i:j])
        amari = s_p % 2019
        
        if amari == 0:
            count = count +1

print(count)


### FIXED CODE ###

s=list(input())[::-1] # 10進数で位を上げていくために反転させる
n=len(s)
amari_lis=[0]*2019 # 
amari_lis[0]=1 # 2019で割り切れる場合、組合せ総数は (n+1)C2 となるため（その他はnC2でOK）

num=0
kurai=1
for keta in s:
    num+=int(keta)*kurai
    num%=2019
    amari_lis[num]+=1
    kurai*=10
    kurai%=2019 # amari_lisが 0~2019 のため、位の数も 2019 で割った余りで考える

ans=0
for i in amari_lis:
    ans+=i*(i-1)/2 # nC2の計算, 余りが同じものを引けば 0⇒2019で割れると言える（組合せ数を逐次追加することで総数算出）

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

#!/usr/bin/env python3
import sys


def solve(S: str):

    l = [0] * 2019
    ps = ""
    for i in range(1, len(S) + 1):
        ps = S[-i:]
        l[ int(ps) % 2019 ] += 1

    ans = 0
    for i in l:
        ans += i * (i - 1) // 2
    
    ans += l[0]
    
    print(ans)

    return


# Generated by 1.1.6 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()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(S: str):

    l = [0] * 2019
    ps = 0
    d = 1
    for i in range(1, len(S) + 1):
        ps += int(S[-i]) * d
        l[ ps % 2019 ] += 1
        d = d * 10 % 2019

    ans = 0
    for i in l:
        ans += i * (i - 1) // 2
    
    ans += l[0]
    
    print(ans)

    return


# Generated by 1.1.6 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()
    S = next(tokens)  # type: str
    solve(S)

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

from collections import deque

N, X, Y = [int(x) for x in input().split()]
X -= 1
Y -= 1

result = {x: 0 for x in range(N)}


def push(v, d, queue, dist):
    if v in dist:
        return
    dist[v] = d
    queue.appendleft(v)


def check(i):
    queue = deque()
    dist = {}
    push(i, 0, queue, dist)

    while queue:
        pos = queue.pop()
        d = dist[pos]

        if pos - 1 >= 0:
            push(pos - 1, d + 1, queue, dist)
        if pos + 1 < N:
            push(pos + 1, d + 1, queue, dist)
        if pos == X:
            push(Y, d + 1, queue, dist)
        if pos == Y:
            push(X, d + 1, queue, dist)

    for i in range(N):
        result[dist[i]] += 1


for i in range(N):
    check(i)

for i in range(1, N):
    print(result[i] // 2)


### FIXED CODE ###

from collections import deque

N, X, Y = [int(x) for x in input().split()]
X -= 1
Y -= 1

result = {x: 0 for x in range(N)}


def push(v, d, queue, dist):
    if v in dist:
        return
    dist[v] = d
    queue.appendleft(v)


def check(i):
    queue = deque()
    dist = {}
    push(i, 0, queue, dist)

    while queue:
        pos = queue.pop()
        d = dist[pos]

        if pos - 1 >= 0:
            push(pos - 1, d + 1, queue, dist)
        if pos + 1 < N:
            push(pos + 1, d + 1, queue, dist)
        if pos == X:
            push(Y, d + 1, queue, dist)
        if pos == Y:
            push(X, d + 1, queue, dist)

    for i in range(N):
        result[dist[i]] += 1


for i in range(N):
    check(i)

for i in range(1, N):
    print(result[i] // 2)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n, m, s, t = map(int,input().split())
C = [list(map(int,input().split())) for i in range(m)]
 
s -= 1
t -= 1
 
# O((V + E)log(V))
# Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト
 
M = [[] for i in range(n)]
for i in range(len(C)):
    M[C[i][0]-1].append([C[i][1]-1, C[i][2]])  # 無向グラフなら両方追加
    M[C[i][1]-1].append([C[i][0]-1, C[i][2]])  # 無向グラフなら両方追加
 
N = [[] for i in range(n)]
for i in range(len(C)):
    N[C[i][0]-1].append([C[i][1]-1, C[i][3]])  # 無向グラフなら両方追加
    N[C[i][1]-1].append([C[i][0]-1, C[i][3]])  # 無向グラフなら両方追加
 
import heapq
 
def dijkstra(s, M):
    D = [10**16] * n  # 頂点0からの距離
    P = [-1] * n  # 頂点0からの最短距離において、そこの直前の頂点(経路復元に利用)
    D[s] = 0
    V = [0] * n  # その頂点のD[i]が最短距離と確定したら1
    Q = []  # 優先度付きキュー
    for v in range(n):
        heapq.heappush(Q, [D[v], v])
 
    le = len(Q)
    while le > 0:
        q = heapq.heappop(Q)
        u = q[1]
        du = q[0]
        if V[u] == 0:
            V[u] = 1
            le -= 1
            for i in range(len(M[u])):
                v = M[u][i][0]
                luv = M[u][i][1]
                if V[v] == 0:
                    alt = du + luv
                    if D[v] > alt:
                        D[v] = alt
                        P[v] = u
                        heapq.heappush(Q, [alt, v])
    return D, P
 
Ds, _ = dijkstra(s, M)
Dt, _ = dijkstra(t, N)
 
ANS = [0] * n
 
# print(Ds,Dt)
 
ans = 10**16
for i in range(n-1, -1, -1):
    ans = min(ans, Ds[i] + Dt[i])
    ANS[i] = ans
 
for i in range(n):
    print(10**15 - ANS[i])

### FIXED CODE ###

import sys
input = sys.stdin.readline
n, m, s, t = map(int,input().split())
C = [list(map(int,input().split())) for i in range(m)]

s -= 1
t -= 1

# O((V + E)log(V))
# Cは [[スタート頂点, ゴール頂点, 重み], ...] のリスト

M = [[] for i in range(n)]
for i in range(len(C)):
    M[C[i][0]-1].append([C[i][1]-1, C[i][2]])  # 無向グラフなら両方追加
    M[C[i][1]-1].append([C[i][0]-1, C[i][2]])  # 無向グラフなら両方追加

N = [[] for i in range(n)]
for i in range(len(C)):
    N[C[i][0]-1].append([C[i][1]-1, C[i][3]])  # 無向グラフなら両方追加
    N[C[i][1]-1].append([C[i][0]-1, C[i][3]])  # 無向グラフなら両方追加

import heapq

def dijkstra(s, M):
    D = [10**16] * n  # 頂点0からの距離
    P = [-1] * n  # 頂点0からの最短距離において、そこの直前の頂点(経路復元に利用)
    D[s] = 0
    V = [0] * n  # その頂点のD[i]が最短距離と確定したら1
    Q = []  # 優先度付きキュー
    for v in range(n):
        heapq.heappush(Q, [D[v], v])

    le = len(Q)
    while le > 0:
        q = heapq.heappop(Q)
        u = q[1]
        du = q[0]
        if V[u] == 0:
            V[u] = 1
            le -= 1
            for i in range(len(M[u])):
                v = M[u][i][0]
                luv = M[u][i][1]
                if V[v] == 0:
                    alt = du + luv
                    if D[v] > alt:
                        D[v] = alt
                        P[v] = u
                        heapq.heappush(Q, [alt, v])
    return D, P

Ds, _ = dijkstra(s, M)
Dt, _ = dijkstra(t, N)

ANS = [0] * n

# print(Ds,Dt)

ans = 10**16
for i in range(n-1, -1, -1):
    ans = min(ans, Ds[i] + Dt[i])
    ANS[i] = ans

for i in range(n):
    print(10**15 - ANS[i])
### BUGGY CODE ###

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

for i in range(1,N+1):
    count=0
    for a in A:
        if str(i) in a:
            count += 1
    print(count)


### FIXED CODE ###

ans=[0]*int(input())
N=list(map(int,input().split()))

for i in N:
    ans[i-1]+=1
print(*ans)
### BUGGY CODE ###

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

ans = []  
 
def check(bs, pre):
  tmp = pre[:]
  if len(bs) == 0:
    ans.append(tmp)
    return
  cand = []
  for i, b in enumerate(bs):
    if i + 1 == b:
      cand.append(i)
  if len(cand) == 0:
    return
  for i in cand:
    check(bs[:i] + bs[i+1:], [i + 1] + tmp)

check(bs, [])

if len(ans):
  for ai in ans[0]:
    print(ai)
else:
  print(-1)


### FIXED CODE ###

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

ans = []  
 
def check(bs, pre):
  tmp = pre[:]
  if len(bs) == 0:
    ans.append(tmp)
    return
  cand = []
  for i, b in enumerate(bs):
    if i + 1 == b:
      cand.append(i)
  if len(cand) == 0:
    return
  i = cand[-1]
  check(bs[:i] + bs[i+1:], [i + 1] + tmp)

check(bs, [])

if len(ans):
  for ai in ans[0]:
    print(ai)
else:
  print(-1)
### BUGGY CODE ###

N, K = map(int,input().split())
while True:
    n =  abs(N - K)
    if n > N:
        print(N)
        break
    N = n


### FIXED CODE ###

N, K = map(int,input().split())
x = N % K
y = (N//K + 1) * K - N 
print(min(x,y))
### BUGGY CODE ###

n,k=(int(i) for i in input().split())
a=[int(i) for i in input().split()]
seta=set(a)

mylist=[a.count(i) for i in seta]
mylist.sort(reverse=True)

#print(mylist)
val=sum(mylist[:k])
  
print(n-val)


### FIXED CODE ###

import collections

n,k=(int(i) for i in input().split())
a=[int(i) for i in input().split()]

mydata=collections.Counter(a)
mylist=list(mydata.values())
mylist.sort(reverse=True)
#print(mylist)

if len(mylist)<k:
  print(0)
else:
  val=sum(mylist[:k])
  print(n-val)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def main():
    s = SI()
    t = SI()

    d = {}
    for i, c in enumerate(s):
        if c not in d.keys():
            d[c] = [i]
        else:
            d[c].append(i)

    org_didx = {}
    for k in d.keys():
        org_didx[k] = 0

    didx = org_didx.copy()

    for c in set(t):
        if c not in d.keys():
            print(-1)
            return

    dprint(d)
    dprint(didx)

    import bisect

    i_loop = 0
    currentidx = -1
    for c in t:
        # 次の文字を読む
        poslist = d[c]

        if len(poslist) <= didx[c]:
            # 文字を取り切っている場合は次のループに
            i_loop += 1
            didx = org_didx.copy()
            currentidx = poslist[0]
            didx[c] += 1
        else:
            # とり切っていない場合
            poslist_afteridx = poslist[didx[c]:]
            posidx = bisect.bisect_right(poslist_afteridx, currentidx)

            if posidx >= len(poslist_afteridx):
                # とれないなら次のループでとったことにする
                i_loop += 1
                didx = org_didx.copy()
                currentidx = poslist[0]
                didx[c] += 1
            else:
                # 同じループでとれるなら取って、現在位置を更新
                pos = poslist_afteridx[posidx]
                currentidx = pos
                didx[c] = posidx + 1

        dprint(c, i_loop, pos, currentidx)
        dprint(didx)

    print(len(s)*i_loop + currentidx + 1)

main()

### FIXED CODE ###

import sys
def SI(): return sys.stdin.readline().strip()

def main():
    s = SI()
    t = SI()

    import collections
    d = collections.defaultdict(list)
    for i, c in enumerate(s):
        d[c].append(i)

    keys = d.keys()
    for c in set(t):
        if c not in keys:
            print(-1)
            return

    import bisect

    i_loop = 0
    currentidx = -1
    for c in t:
        # 次の文字を読む
        poslist = d[c]

        # とり切っていない場合
        posidx = bisect.bisect_right(poslist, currentidx)

        if posidx >= len(poslist):
            # とれないなら次のループでとったことにする
            i_loop += 1
            currentidx = poslist[0]
        else:
            # 同じループでとれるなら取って、現在位置を更新
            pos = poslist[posidx]
            currentidx = pos

    print(len(s)*i_loop + currentidx + 1)

main()
### BUGGY CODE ###

import numpy as np
#from numba import njit

#@njit
def solve(n, k, l):
    if k >= 50:
        k = 50
    
    dp= [[0,0]]
    for i in range(n-1):
        dp += [[0]*2]
    
    ans = l[:]
    
    for i in range(k):
        for j in range(n):
            tmp = ans[j]
            dp[j][0] = (j+1 - tmp)
            dp[j][1] = (j+1 + tmp)
    
        ans = [0] * n
    
        for x in range(n):
            for y in range(n):
                if dp[y][0] <= x+1 <= dp[y][1]:
                    ans[x] += 1
    
    else:
        return ans

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

print(*solve(n,k,l))



### FIXED CODE ###

import numpy as np
from numba import njit

@njit #処理の並列化

def imos(n, a):
    
    l=np.zeros((n+1), dtype = np.int64)

    for i in range(n):
        ai = a[i] # 光の強さ_これにより照らせる範囲が決まる
        start = max(0, i - ai) #StartIndex_照らせる範囲
        end = min(n, i + ai + 1) #EndIndex + 1_照らせる範囲
        l[start] += 1 # 各々を'+1'と'-1'で表し...
        l[end] -= 1
    return np.cumsum(l)[:n] # 累積和をとる_cumulative sum

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

for _ in range(k):
    a = imos(n, a)
    if a.min() == n: # すべての要素が最大値'n'になるとbreak
        break

print(*a)
### BUGGY CODE ###

x=int(input())
factor=1
for i in range(2,int(pow(x,0.5))+1):
    if x%i==0:
        factor=i
        break
e=0
for b in range(-x,x+1):
    for a in range(b,x+1,factor):
        if a**5-b**5==x:
            print(a,b)
            e=1
            break
    if e==1:
        break

### FIXED CODE ###

x=int(input())
e=0
for a in range(-1000,1000):
    for b in range(a-140,a+140):
        if (a**5)-(b**5)==x:
            print(a,b)
            e=1
            break
    if e==1:
        break
### BUGGY CODE ###

N, K = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a2 = [1]

for i in a:a2.append(a2[-1]*i)


score_dict = {K:a2[K]}

for i in range(K+1, N+1):
    score_dict[i] = a2[i]//a2[i-K]
    if score_dict[i] > score_dict[i-1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N, K = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]

for i in range(K, N):
    if a[i-K] < a[i]:
        print('Yes')
    else :
        print('No')