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

from itertools import combinations, permutations


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

ans = float("inf")
for colors in combinations(range(C), 3):
    for p_colors in permutations(colors):
        tmp = 0
        for i in range(N):
            for j in range(N):
                c_color = c[i][j] - 1
                n_color = p_colors[(i + j) % 3]
                if c_color == n_color:
                    continue
                tmp += D[c_color][n_color]
        ans = min(ans, tmp)
print(ans)


### FIXED CODE ###

from itertools import permutations


N, C = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(C)]
c = [list(map(int, input().split())) for _ in range(N)]
cost = [[0] * 3 for _ in range(C)]

for i in range(N):
    for j in range(N):
        for k in range(C):
            cost[k][(i + j) % 3] += D[c[i][j] - 1][k]

ans = min(
    sum(cost[c][i] for i, c in enumerate(colors))
    for colors in permutations(range(C), 3)
)
print(ans)
### BUGGY CODE ###

N,W=map(int,input().split())
Wlist=[]
Vlist=[]
for i in range(N):
  w,v=map(int,input().split())
  Wlist+=[w]
  Vlist+=[v]
dp=[[0 for p in range(W)] for i in range(N)]
for i in range(N):
  wi=Wlist[i]
  if i==0:
    dp[0][Wlist[0]-1]=Vlist[0]
  else:
    for j in range(W):
      if j+wi<W:
        if j==0:
          dp[i][wi-1]=max(Vlist[i],dp[i][wi-1])
        if dp[i-1][j]!=0:
          dp[i][j+wi]=max(dp[i-1][j]+Vlist[i],dp[i][j+wi])
      dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[N-1]))

### FIXED CODE ###

N,W=map(int,input().split())
Wlist=[]
Vlist=[]
for i in range(N):
  w,v=map(int,input().split())
  Wlist+=[w]
  Vlist+=[v]
dp=[[0 for p in range(W+1)] for i in range(N)]
for i in range(W+1):
  if i>=Wlist[0]:
    dp[0][i]=Vlist[0]
for i in range(1,N):
  wi=Wlist[i]
  for j in range(W+1):
    if j-wi>=0:
      dp[i][j]=max(dp[i-1][j-wi]+Vlist[i],dp[i-1][j])
    else:
      dp[i][j]=max(dp[i-1][j],dp[i][j])
print(max(dp[N-1]))
### BUGGY CODE ###

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

sum = 0

for i in range(0,N-1):
    for j in range(i+1,N):
        sum += A[i]*A[j]

print(sum%(10**9 +7))

### FIXED CODE ###

# (a+b+c) mod n = (((a mod n)+b mod n )+c) mod n
from itertools import accumulate

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

    acc = list(accumulate(A))
    mod = 10**9 + 7

    ans = 0

    for i in range(N-1):
        ans += A[i]*(acc[-1]-acc[i])
        ans %= mod

    print(ans)


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

n=int(input())
s=input()

ans=0
for i in range(n-1):
  cnt=0
  s1=s[0:n-i-1]
  s2=s[i+1:n]
  for j in range(n-i-1):
    if s1[j]==s2[j]:
      cnt+=1
      if cnt<i+2:ans=max(ans,cnt)
    else:
      cnt=0
print(ans) 

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
input=lambda :sys.stdin.readline().rstrip()
# inputs= sys.stdin.buffer.readlines
INF=float("inf")
MOD=10**9+7

#input = sys.stdin.buffer.readline
#sys.setrecursionlimit(2147483647)

#rstrip().decode('utf-8')

#import math
#import numpy as np
#import operator
#import bisect
#from heapq import heapify,heappop,heappush
#from math import gcd
#from fractions import gcd
#from collections import deque
#from collections import defaultdict
#from collections import Counter
#from itertools import accumulate
#from itertools import groupby
#from itertools import permutations
#from itertools import combinations
#from scipy.sparse import csr_matrix
#from scipy.sparse.csgraph import floyd_warshall
#from scipy.sparse.csgraph import csgraph_from_dense
#from scipy.sparse.csgraph import dijkstra

#map(int,input().split())

def main():
	n=int(input())
	s=input()
	
	ans=0
	cnt=0
	
	
	for d in range(1,n):
		cnt=0
		for i in range(n-d):
			if s[i]==s[i+d]:
				cnt+=1
				ans = max(ans, min(cnt, d))
			else:
				cnt=0
	print(ans)
	
	
	
	
	

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

import fractions
import functools

def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    a_gcd = functools.reduce(fractions.gcd,a)
    a = [x//a_gcd for x in a]
    gcdlist = []

    m = 1
    for i in range(n):
        t = [x for x in a]
        del t[i]
        t_gcd = functools.reduce(fractions.gcd,t)
        m = t_gcd if t_gcd>m else m

    print(a_gcd*m)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import fractions
import functools

def main():
    n = int(input())
    a = [int(t)for t in input().split()]

    a_gcd = functools.reduce(fractions.gcd,a)
    a = [x//a_gcd for x in a]
    
    a_rev = a[::-1]

    lgcd = [0]
    rgcd = [0]
    for i in range(n):
        l = fractions.gcd(a[i],lgcd[i])
        r = fractions.gcd(a_rev[i],rgcd[i])
        lgcd.append(l)
        rgcd.append(r)

    rgcd = rgcd[::-1]
    g = [fractions.gcd(lgcd[i],rgcd[i+1]) for i in range(n)]
    
    print(max(g)*a_gcd)
    
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N = int(input())
s = list(input())
# N: 処理する区間の長さ
N0 = 2**(N-1).bit_length()
id_ele = set()
data = [id_ele]*(2*N0)
# a_k の値を x に更新
def segfunc(x,y):
    return x|y

def update(k, x):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = segfunc(data[2*k+1], data[2*k+2])
# 区間[l, r)の最小値
def query(l, r):
    L = l + N0; R = r + N0
    s = id_ele
    while L < R:
        if R & 1:
            R -= 1
            s = segfunc(s, data[R-1])

        if L & 1:
            s = segfunc(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

for i in range(N):
  update(i,set(s[i]))
q = int(input())
for _ in range(q):
  p,a,b = input().split()
  if p == "1":
    update(int(a)-1,set(b))
  if p == "2":
    print(len(query(int(a)-1,int(b))))
    

### FIXED CODE ###

def main():
  import sys
  input = sys.stdin.readline
  n = int(input())
  s = list(input())

  def segfunc(x,y):
      return x|y

  def init(init_val):
      #set_val
      for i in range(n):
          seg[i+num-1]=init_val[i]    
      #built
      for i in range(num-2,-1,-1) :
          seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
      
  def update(k,x):
      k += num-1
      seg[k] = x
      while k:
          k = (k-1)//2
          seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
      
  def query(p,q):
      if q<=p:
          return ide_ele
      p += num-1
      q += num-2
      res=ide_ele
      while q-p>1:
          if p&1 == 0:
              res = segfunc(res,seg[p])
          if q&1 == 1:
              res = segfunc(res,seg[q])
              q -= 1
          p = p//2
          q = (q-1)//2
      if p == q:
          res = segfunc(res,seg[p])
      else:
          res = segfunc(segfunc(res,seg[p]),seg[q])
      return res

  #####単位元######
  ide_ele = 0

  #num:n以上の最小の2のべき乗
  num =2**(n-1).bit_length()
  seg=[ide_ele]*2*num

  A = []
  for i in range(n):
    A.append(1<<(ord(s[i])-96))
  init(A)
  q = int(input())
  for _ in range(q):
    p,a,b = input().split()
    if p == "1":
      update(int(a)-1,1<<(ord(b)-96))
    if p == "2":
      print(bin(query(int(a)-1,int(b))).count("1"))
main()
### BUGGY CODE ###

N, P = map(int, input().split())

d = 1
i = 2
while i <= pow(P, 1/N)+1:
  if P % i**N == 0:
    P //= i**N
    d *= i
  else:
    i += 1
print(d)

### FIXED CODE ###

N, P = map(int, input().split())

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= round(pow(P, 1/N)):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)
### BUGGY CODE ###

import sys
from collections import Counter
def input():
    return sys.stdin.readline()[:-1]
def main():
    N = int(input())
    A = sorted(list(map(int,input().split())))
#    C = Counter(A)
    U = [0] * (10**6+1)
    ans = 0
    for e in A:
        U[e] += 1
    for e in A:
        t = e*2
        while t <= 10**6:
            U[t] = 0
            t += e
        if U[e] > 1:
            U[e] = 0
    print(U.count(1))
if __name__ == '__main__':
    main()


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
U = [0]*(10**6+1)
for e in A:
    U[e] += 1
ans = 0
for k in range(1,10**6+1):
    if U[k] == 1:
        ans += 1
    if U[k] > 0:
        for l in range(2*k,10**6+1,k):
            if U[l] > 0:
                U[l] += 1
print(ans)
### BUGGY CODE ###

import sys
from collections import defaultdict, deque
input = sys.stdin.readline
N, M = map(int, input().split())
guidepost = [None] * N
distance = [0] + [10**9] * (N - 1)
dd = defaultdict(list)
for _ in range(M):
    a, b = map(int, input().split())
    dd[a].append(b)
    dd[b].append(a)
stack = deque([1])
checked = [False] * N
while len(stack) >= 1:
    i = stack.popleft()
    checked[i - 1] = True
    for j in dd[i]:
        distance[j - 1] = min(distance[j - 1], distance[i - 1] + 1)
        if guidepost[j - 1] is None:
            guidepost[j - 1] = i
        elif distance[guidepost[j - 1] - 1] > distance[i - 1]:
            guidepost[j - 1] = i
        if not checked[j - 1]:
            stack.append(j)
print('Yes')
for i in range(1, N):
    print(guidepost[i])


### FIXED CODE ###

import sys
from collections import defaultdict, deque
input = sys.stdin.readline
N, M = map(int, input().split())
guidepost = [None] * N
distance = [0] + [10**9] * (N - 1)
dd = defaultdict(list)
for _ in range(M):
    a, b = map(int, input().split())
    dd[a].append(b)
    dd[b].append(a)
stack = deque([1])
checked = [False] * N
while len(stack) >= 1:
    i = stack.popleft()
    if checked[i - 1]:
        continue
    checked[i - 1] = True
    for j in dd[i]:
        distance[j - 1] = min(distance[j - 1], distance[i - 1] + 1)
        if guidepost[j - 1] is None:
            guidepost[j - 1] = i
        elif distance[guidepost[j - 1] - 1] > distance[i - 1]:
            guidepost[j - 1] = i
        if not checked[j - 1]:
            stack.append(j)
print('Yes')
# join?
# for i in range(1, N):
#     print(guidepost[i])
print('\n'.join([str(guidepost[i]) for i in range(1, N)]))
### BUGGY CODE ###

N = int(input())
A = []
for i in range(N):
  a = int(input())
  A.append(a)
  
A2 = sorted(A)
mx1 = A2[-1]
mx2 = A2[-2]

for i in range(N):
  if i == A.index(mx1):
    print(mx2)
  else:
    print(mx1)


### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
  a = int(input())
  A.append(a)
  
A2 = sorted(A)
mx1 = A2[-1]
mx2 = A2[-2]
ind = A.index(mx1)

for i in range(N):
  if i != ind:
    print(mx1)
  else:
    print(mx2)
### BUGGY CODE ###

N = int(input())
l = list(map(int,input().split()))
m = []

for i in range(1,N+1):
  m.append(l.index(i)+1)
  
print(*m)


### FIXED CODE ###

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

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

S = input()
Q = int(input())

def add_car(S,s,is_left,is_rev):
    if is_rev:
        is_left = not(is_left)
    if is_left:
        S = ''.join([s,S])
    else:
        S = ''.join([S,s])
    return S

is_rev = False
for q in range(Q):
    x = input().split(' ')
    if len(x) == 1:
        is_rev = not is_rev
    else:
        S = add_car(S,x[2],x[1]=='1',is_rev)

if is_rev:
    S = ''.join(list(reversed(S)))
print(S)

### FIXED CODE ###

S = input()
S_h = ''
S_t = ''
Q = int(input())

def add_car(S_h,S_t,s,is_left,is_rev):
    if is_rev:
        is_left = not(is_left)
    if is_left:
        S_h = ''.join([S_h,s])
    else:
        S_t = ''.join([S_t,s])
    return S_h,S_t

is_rev = False
for q in range(Q):
    x = input().split(' ')
    if len(x) == 1:
        is_rev = not is_rev
    else:
        S_h,S_t = add_car(S_h,S_t,x[2],x[1]=='1',is_rev)

if is_rev:
    S_t = ''.join(list(reversed(S_t)))
    S = ''.join(list(reversed(S)))
    print(''.join([S_t,S,S_h]))
else:
    S_h = ''.join(list(reversed(S_h)))
    print(''.join([S_h,S,S_t]))
### BUGGY CODE ###

import numpy as np

N=int(input())
a_l=np.array([int(i) for i in input().split()])

def xor(i,j):
    l=max(len(str(format(i,'b'))),len(str(format(j,'b'))))
    i2=str(format(i,'b').zfill(l))
    j2=str(format(j,'b').zfill(l))
    ans=0
    for k in range(l):
        if i2[k]!=j2[k]:
            ans+=2**(l-k-1)
    return ans

sum1=0
for i in range(N-1):
    for j in a_l[i+1:]:
        sum1+=xor(a_l[i],j)
print(sum1%(7+10**9))

### FIXED CODE ###

n=int(input())
lis=list(map(lambda x:format(int(x),'b'),input().split()))
l=0
for i in range(n):
    l=max(l,len(lis[i]))

d0=[0]*60
d1=[0]*60

for i in range(n):
    lis[i]=lis[i].zfill(l)
    for j in range(l):
        if lis[i][-j-1]=='0':
            d0[j]+=1
        else:
            d1[j]+=1

ans=0
for i in range(60):
    ans+=(d0[i]*d1[i]*2**i)%(10**9+7)
print(ans%(10**9+7))
### BUGGY CODE ###

n = int(input())
s = list(input())
print(min(s[:i].count('#')+s[i:].count('.') for i in range(n+1)))

### FIXED CODE ###

n = int(input())
s = list(input())
bi = [0]
wi = [0]
b = 0
w = 0
for i in range(n):
    if s[i] == '#':
        b += 1
    if s[-i-1] == '.':
        w += 1
    bi.append(b)
    wi.append(w)
print(min(bi[i]+wi[-i-1] for i in range(n+1)))
### BUGGY CODE ###

def main():
    n = int(input())
    s = input()
    x = set()

    for i in range(n)[:-2]:
        for j in range(n)[i + 1:]:
            for k in range(n)[j + 1:]:
                item = s[i] + s[j] + s[k]
                if item not in x:
                    x.add(item)

    print(len(x))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = input()

    c = 0
    l1 = set()
    for i in range(n)[:-2]:
        if s[i] in l1:
            continue
        l1.add(s[i])
        l2 = set()
        for j in range(n)[i + 1:-1]:
            if s[j] in l2:
                continue
            l2.add(s[j])
            c += len(set(list(s[j + 1:])))

    print(c)


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

n=int(input())
a=list(map(int,input().split()))
sum=1
for i in a:
    sum*=i
if sum>1000000000000000000:
    print(-1)
else:
    print(sum)

### FIXED CODE ###

import sys
n=int(input())
a=list(map(int,input().split()))
sum=1
for i in range(n):
    if a[i]==0:
        print(0)
        sys.exit()
for i in a:
    sum*=i
    if sum>1000000000000000000:
        print(-1)
        sys.exit()
else:
    print(sum)
### BUGGY CODE ###

N=int(input())
ps=[]
for i in range(N):
  tmp=input()
  ps.append([int(tmp.split()[0]),int(tmp.split()[1])])
    

tg=[]
tp=[]

ag=[]
ap=[]
for p in ps:
  tg.append((p[1]+p[0]))
  tp.append(p[0])
  ag.append((p[0]+p[1]))
  ap.append(p[1])
    
    
    
import numpy as np
def is_even(num):
  if num % 2 == 0:
    return True
  else:
    return False
    
import operator
T=0
A=0

for i in range(N):
  if is_even(i):
    if tg[np.argmax(tg)]!=0:
      tmpIndex=np.argmax(tg)
      T+=tp.pop(tmpIndex)
      tg.pop(tmpIndex)
      ag.pop(tmpIndex)
      ap.pop(tmpIndex)
    else:
      tmpIndex=np.argmax(tp)
      T+=tp.pop(tmpIndex)
      tg.pop(tmpIndex)
      ag.pop(tmpIndex)
      ap.pop(tmpIndex)
  else:
    if ag[np.argmax(ag)]!=0:
      tmpIndex=np.argmax(ag)
      A+=ap.pop(tmpIndex)
      ag.pop(tmpIndex)
      tg.pop(tmpIndex)
      tp.pop(tmpIndex)
    else:
      tmpIndex=np.argmax(ap)
      A+=ap.pop(tmpIndex)
      ag.pop(tmpIndex)
      tg.pop(tmpIndex)
      tp.pop(tmpIndex)
print(T-A)


### FIXED CODE ###

N=int(input())
ps=[]
tp=[]
ap=[]
for i in range(N):
  p=input().split()
  ps.append([int(p[0])+int(p[1]),i])
  tp.append(int(p[0]))
  ap.append(int(p[1]))
    
def is_even(num):
  if num % 2 == 0:
    return True
  else:
    return False

T=0
A=0
calc=sorted(ps,reverse=True)
#print(calc)
i=0
for p,j in calc:
  if is_even(i):
    T+=tp[j]
  else:
    A+=ap[j]
  i+=1
print(T-A)
### BUGGY CODE ###

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

A = [int(i) for i in input().split()]


from_ = 1
way = []
way.append(1)
for i in range(K):
    if(A[from_ - 1] in way):
        way.append(A[from_ - 1])
        break
    else:
        way.append(A[from_ - 1])
        from_ = A[from_ - 1]

key_from = way.index(way[len(way) - 1])
key_to = len(way) - 1



if(K > key_from):
    ans_loop = (K - key_from) % (key_to - key_from)
    ans_num = key_from + ans_loop
   
    print(way[ans_num])
else:
    print(way[K])

### FIXED CODE ###

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

A = [int(i) for i in input().split()]


from_ = 1
way = []
way.append(1)
way_set = set([1])

for i in range(K):
    s = A[from_ - 1]
    if(s in way_set):
        way.append(s)
        break
    else:
        way.append(s)
        way_set.add(s)
        from_ = s

key_from = way.index(way[len(way) - 1])
key_to = len(way) - 1



if(K > key_from):
    ans_loop = (K - key_from) % (key_to - key_from)
    ans_num = key_from + ans_loop

    print(way[ans_num])
else:
    print(way[K])
### BUGGY CODE ###

N, M = map(int, input().split())

money = 0

kakaku = []
honsuu = []
nokori_honsuu = M

for i in range(N):
	A, B = map(int, input().split())
	kakaku.append(A)
	honsuu.append(B)

while nokori_honsuu > 0:
	min_kakaku_pos = kakaku.index(min(kakaku))
	if honsuu[min_kakaku_pos] <= nokori_honsuu:
		money += honsuu[min_kakaku_pos] * kakaku[min_kakaku_pos]
		nokori_honsuu -= honsuu[min_kakaku_pos]
	else:
		money += nokori_honsuu * kakaku[min_kakaku_pos]
		nokori_honsuu -= nokori_honsuu
	kakaku.pop(min_kakaku_pos)
	honsuu.pop(min_kakaku_pos)
print(money)

### FIXED CODE ###

N, M = map(int, input().split())
S = []

money = 0

for i in range(N):
	A, B = map(int, input().split())
	S.append([A, B])
	
S.sort()

while M > 0:
	for i in range(N):
		if S[i][1] <= M:
			money += S[i][0] * S[i][1]
			M -= S[i][1]
		else:
			money += S[i][0] * M
			M -= M
			break
print(money)
### BUGGY CODE ###

import sys
import math
MAX_INT = int(10e9)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def judge(x):
  l = []
  for i in range(N):
    l.append(a[i]%x)
  l.sort()

  aa = 0
  bb = 0
  for i in l:
    tmp = i
    if aa + tmp > K:
      bb += x-tmp
      if bb > K:
        return False
    else:
      aa += tmp
  else:
    return True

N,K = IL()
a = IL()
num = sum(a)
ans = []

for i in range(num,int(math.sqrt(num)-1),-1):
  if num%i == 0:
    if judge(i):
      print(i)
      exit()
    if judge(num//i):
      ans.append(num//i)

print(max(ans))

### FIXED CODE ###

import sys
import math
MAX_INT = int(10e9)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def judge(x):
  l = []
  for i in range(N):
    l.append(a[i]%x)
  l.sort()

  aa = 0
  bb = 0
  for i in l:
    tmp = i
    if aa + tmp > K:
      bb += x-tmp
      if bb > K:
        return False
    else:
      aa += tmp
  else:
    return True

N,K = IL()
a = IL()
num = sum(a)
ans = []

for i in range(1,int(math.sqrt(num)+1)):
  if num%i == 0:
    if judge(i):
      ans.append(i)
    if judge(num//i):
      ans.append(num//i)

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

h,w,m = map(int,input().split())
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*(h+1)
wlist = [0]*(w+1)
for x,y in hw:
    hlist[x]+=1
    wlist[y]+=1

hmax=max(hlist) 
h_index = [n for n, v in enumerate(hlist) if v == hmax]
wmax=max(wlist)
w_index = [n for n, v in enumerate(wlist) if v == wmax]

count = sum(x in h_index and y in w_index for x,y in hw)
print(hmax+wmax-(len(h_index)*len(w_index)==count))

### FIXED CODE ###

#実験 貼り付けコード
h,w,m = map(int,input().split())
s = [list(map(int,input().split())) for _ in range(m)]

r = [0] * (h + 1)
c = [0] * (w + 1)
for x, y in s:
    r[x] += 1
    c[y] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum(x in nr and y in nc for x, y in s)
print(R + C - (len(nr) * len(nc) == count))
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]

if len(A) > 1:
    result = sorted(A)[1]
else:
    result = min(A)

while True:
    counter = 0
    should_continue = False
    for e in A:
        if e % result != 0:
            counter += 1
            if counter > 1:
                should_continue = True
                break
    if should_continue:
        continue
    if counter <= 1:  # 1つは書き換えられる
        break
    else:
        result -= 1

print(result)


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]

if len(A) > 1:
    result = sorted(A)[1]
else:
    result = min(A)

while True:
    counter = 0
    should_continue = False
    for e in A:
        if e % result != 0:
            counter += 1
            if counter > 1:
                should_continue = True
                break
    if should_continue:
        result -= 1
        continue
    if counter <= 1:  # 1つは書き換えられる
        break
    else:
        result -= 1

print(result)
### BUGGY CODE ###

from collections import deque, Counter
N, M, K = list(map(int, input().split()))
F = [[0 for _ in range(N)] for _ in range(N)]
B = [[0 for _ in range(N)] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    F[a][b] = 1
    F[b][a] = 1

for _ in range(K):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    B[a][b] = 1
    B[b][a] = 1

# まだ探索済みでない頂点からdfs
# どの頂点がどの連結成分に属するかを管理
connect_group = {}

for i in range(N):
    if connect_group.get(i) is not None:
        continue
    stack = deque()
    stack.append(i)
    connect_group[i] = i
    p = -1    
    while len(stack):
        j = stack.pop()
        connect_group[j] = i
        for k, v in enumerate(F[j]):
            if v == 1 and connect_group.get(k) is None:
                stack.append(k)
                connect_group[k] = i
                
ans = []
connect_len = Counter(connect_group.values())
for i in range(N):
    g = connect_group[i]
    l = connect_len[g]
    x = 0
    for j in range(N):
        if i != j:
            if g == connect_group[j]:
                if F[i][j] or B[i][j]:
                    x += 1
    ans.append(str(l - x - 1))

print(' '.join(ans))

### FIXED CODE ###

from collections import deque, Counter
N, M, K = list(map(int, input().split()))
F = [[] for _ in range(N)]
B = [[] for _ in range(N)]

for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    F[a].append(b)
    F[b].append(a)

for _ in range(K):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    B[a].append(b)
    B[b].append(a)

# まだ探索済みでない頂点からdfs
# どの頂点がどの連結成分に属するかを管理
connect_group = {}

for i in range(N):
    if connect_group.get(i) is not None:
        continue
    stack = deque()
    stack.append(i)
    connect_group[i] = i
    p = -1    
    while len(stack):
        j = stack.pop()
        connect_group[j] = i
        for k in F[j]:
            if connect_group.get(k) is None:
                stack.append(k)
                connect_group[k] = i


ans = []
connect_len = Counter(connect_group.values())
for i in range(N):
    g = connect_group[i]
    l = connect_len[g]
    x = 0
    for j in set(F[i]).union(set(B[i])):
        if g == connect_group[j]:
            x += 1
    ans.append(str(l - x - 1))

print(' '.join(ans))
### BUGGY CODE ###

import numpy as np
n = int(input())
#l = [ i+1 for i in range(n) ]
p = [i+1 for i in range(n)]
p.append(1)
p.pop(0)
p_array = np.array(p)
#print(sum(l % p_array))
print(sum(p_array - 1))

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
### BUGGY CODE ###

global na, n, sum, k
lsp = {}
lsn = {}
num = {}

if __name__ == '__main__':
    na = input()
    lsn = na.split(' ')
    n = int(lsn[0])
    k = int(lsn[1])
    na = input()
    lsp = na.split(' ')
    for i in range (0, n):
        num[i] = int(lsp[i])
    sum = 1
    for i in range (0, k):
        sum = sum * num[i]
    for i in range (k, n):
        ls = sum
        ls = ls * num[i]
        ls /= num[i-k]
        if sum >= ls:
            print("No")
        else:
            print("Yes")
        sum = ls

### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
 
for i in range(K+1, N+1) :
  if A[i-1] > A[i-K-1] :
    print("Yes")
  else :
    print("No")