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

from collections import deque
import sys
import bisect
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
n = int(input())
a = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n-1):
    u, v = map(int, input().split())
    edges[u-1].append(v-1)
    edges[v-1].append(u-1)

d = [0 for _ in range(n)]
memo = [[] for _ in range(n)]
seen = [False for _ in range(n)]
que = deque()
que.append(0)
memo[0] = [a[0]]
d[0] = 1
seen[0] = True

while len(que):
    cur = que.popleft()
    for to in edges[cur]:
        if not seen[to]:
            seen[to] = True
            memo[to] = memo[cur].copy()
            if memo[cur][-1] < a[to]:
                d[to] = d[cur] + 1
                memo[to].append(a[to])
            else:
                d[to] = d[cur]
                memo[to][bisect.bisect_left(memo[to], a[to])] = a[to]
            que.append(to)
    memo[cur] = []

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

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 8)

n = int(input())
a = list(map(int, input().split()))
edges = [[] for _ in range(n)]
for _ in range(n-1):
    u, v = map(int, input().split())
    edges[u-1].append(v-1)
    edges[v-1].append(u-1)

inf = 10 ** 10
d = [inf for _ in range(n)]
dp = [inf for _ in range(n)]

def dfs(cur, prev):
    memo = bisect.bisect_left(dp, a[cur])
    memo_v = dp[memo]
    dp[memo] = a[cur]
    d[cur] = bisect.bisect_left(dp, inf)

    for to in edges[cur]:
        if to != prev:
            dfs(to, cur)

    dp[memo] = memo_v

dfs(0, -1)
for i in range(n):
    print(d[i])
### BUGGY CODE ###

k,s=map(int,input().split())
ans=0
for i in range(k+1):
     for n in range(k+1):
         for t in range(k+1):
            if i+n+t==s:
                ans+=1
print(ans)
 

### FIXED CODE ###

k,s=map(int,input().split())
ans=0
for x in range(k+1):
     for y in range(k+1):
        z=s-x-y
        if 0<=z and z<=k:
            ans+=1
print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
now = 1
count = 0
past = []
while True:
    if now == 2:
        print(count)
        exit()
    if A[now - 1] in past:
        print(-1)
        exit()
    count += 1
    past.append(A[now - 1])
    now = A[now - 1]

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
if 2 not in A:
    print(-1)
    exit()
now = 1
count = 0
past = []
while True:
    if now == 2:
        print(count)
        exit()
    if count >= N:
        print(-1)
        exit()
    count += 1
    now = A[now - 1]
### BUGGY CODE ###

N = int(input())
Item  = []
Count = 0
for T in range(0,N):
    S = input()
    if S not in Item:
        Item.append(S)
        Count = Count+1
print(Count)

### FIXED CODE ###

N    = int(input())
Item = ['']*N
for T in range(0,N):
    Item[T] = input()
print(len(set(Item)))
### BUGGY CODE ###

l,r=map(int,input().split())
if l-r>=2019:print(0)
else:
  MIN=10000
  for i in range(l,r):
    for j in range(i+1,r+1):
      p = i*j%2019
      if p<MIN:MIN=p
  print(MIN)

### FIXED CODE ###

l,r=map(int,input().split())
if r-l>=2019:print(0)
else:
  MIN=10000
  for i in range(l,r):
    for j in range(i+1,r+1):
      p = i*j%2019
      if p<MIN:MIN=p
  print(MIN)
### BUGGY CODE ###

from fractions import gcd
from functools import reduce


MOD = 10 **9 + 7

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

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

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

tmp = lcm(*A)

ans = 0
for a in A:
    ans += tmp // a
    ans %= MOD

print (ans)

### FIXED CODE ###

def main():
    from fractions import gcd

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

    MOD = 10 ** 9 + 7

    tmp = 1
    for a in A:
        tmp *= a // gcd(tmp, a)

    ans = 0
    for a in A:
        ans += tmp // a
    ans %= MOD

    print (ans)

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

N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[0 for i in range(N)] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A][B]=H[B]
    ABmap[B][A]=H[A]
        
for i in range(N):
    #print(ABmap[i])
    #print(ABmap.count(H[i]))
    if max(ABmap[i])<H[i]:
        count+=1
print(count)
        
    

### FIXED CODE ###

N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A].append(H[B])
    ABmap[B].append(H[A])
        
for i in range(N):
    if len(ABmap[i])==0:
        count+=1
    elif max(ABmap[i])<H[i]:
        count+=1
   # print(ABmap[i])
print(count)
### BUGGY CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
pow2 = [1]
for i in range(31):
    pow2.append(pow2[-1] * 2)
a = sorted(a, reverse=True)
d = defaultdict(int)
for i in a:
    d[i] += 1


num = 0
for i in range(N):
    if d[a[i]] == 0:
        continue
    for k in range(30, -1, -1):
        if pow2[k] - a[i] != a[i]:
            if d[pow2[k] - a[i]] > 0 and d[a[i]] > 0:
                p = min(d[pow2[k] - a[i]], d[a[i]])
                num += p
                d[pow2[k] - a[i]] -= p
                d[a[i]] -= p
                break
        else:
            if d[a[i]] >= 2:
                num += d[a[i]] // 2
                d[a[i]] %= 2
                break
print(num)

### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
pow2 = [1]
for i in range(31):
    pow2.append(pow2[-1] * 2)
a = sorted(a, reverse=True)
d = defaultdict(int)
for i in a:
    d[i] += 1


num = 0
for i in range(N):
    if d[a[i]] == 0:
        continue
    for k in range(30, -1, -1):
        inv = pow2[k] - a[i]
        if inv < 0 or inv > a[i]:
            continue
        if inv != a[i]:
            if d[inv] > 0 and d[a[i]] > 0:
                p = min(d[inv], d[a[i]])
                num += p
                d[inv] -= p
                d[a[i]] -= p
                break
        else:
            if d[a[i]] >= 2:
                num += d[a[i]] // 2
                d[a[i]] %= 2
                break
print(num)
### BUGGY CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
# 扱いやすいので1-indexedにする
A = [0] + A
# dp[2^k][i] はiから2^k回移動したときの移動先を表す
dp = {1: A}
for k in range(1, 100):
    dp[2 ** k] = [0]  # 先頭はダミー（1-indexedにするため）
    for i in range(1, N + 1):
        # jはiから2^{i - 1}回移動した先
        j = dp[2 ** (k - 1)][i]
        # iから2^k回移動した先 = jから2^{i - 1}回移動した先
        dp[2 ** k].append(dp[2 ** (k - 1)][j])
ans = 1
for k in range(100):
    if K & 2 ** k > 0:
        ans = dp[2 ** k][ans]
        K -= 2 ** k
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
# 扱いやすいので1-indexedにする
A = [0] + A
# dp[k][i] はiから2^k回移動したときの移動先を表す
dp = [A]
for k in range(1, 100):
    dp.append([0])  # 先頭はダミー（1-indexedにするため）
    for i in range(1, N + 1):
        # jはiから2^{i - 1}回移動した先
        j = dp[k - 1][i]
        # iから2^k回移動した先 = jから2^{i - 1}回移動した先
        dp[k].append(dp[k - 1][j])
ans = 1
for k in range(100):
    if K & 2 ** k > 0:
        ans = dp[k][ans]
        K -= 2 ** k
print(ans)
### BUGGY CODE ###

def get_answer(ki):
    n = ki[0][0]
    q = ki[0][1]
    #n_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[1:-q]]]
    #q_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[-q:]]]
    n_data = ki[1:-q]
    #q_data = ki[-q:]
    q_index = [0] * n
    for qq in ki[-q:]:
        q_index[qq[0] - 1] += qq[1]

    score = [0] * n

    """
        assert get_answer(["4 3",
                       "1 3", "1 4", "2 3",
                       "2 10", "1 100", "3 1"]) == "100 111 101 100"
    """
    t_index = []
    for i in range(0, n + 1):
        t_index.append([])
    for nn in n_data:
        t_index[nn[0]].append(nn[1])
        t_index[nn[1]].append(nn[0])

    k_stack = [[1, 0]]
    #t_stack = [1]
    #s_stack = [0]
    r_flag = [0] * n
    while len(k_stack) > 0:
        #i = t_stack.pop()
        #s = s_stack.pop()
        k = k_stack.pop()
        i = k[0]
        s = k[1]
        if r_flag[i - 1]:
            continue
        r_flag[i - 1] = 1
        s += q_index[i - 1]
        score[i - 1] += s
        k_stack += [[t, s] for t in t_index[i]]
        #t_stack += t_index[i]
        #s_stack += [s] * len(t_index[i])

    s_value = str(score[0])
    for i in range(1, n):
        s_value += " " + str(score[i])
    return s_value


if __name__ == "__main__":
    input_ki = []
    while True:
        try:
            input1 = input()
            if not input1:
                break;
            if len(input1) == 0:
                break;
            s = input1.split(" ")
            input_ki.append([int(s[0]), int(s[1])])
        except EOFError:
            break
    print(get_answer(input_ki))


### FIXED CODE ###

import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
 v,val=map(int,input().split())
 cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
 v=q.pop()
 checked[v]=1 #頂点を見たかどうかのフラグを更新する
 for u in g[v]:
   if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
     continue
   cnt[u]+=cnt[v]
   q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる
### BUGGY CODE ###

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

fst = []
scnd = []

for i in ab:
  if i[0]==1:
    fst.append(i[1])
  if N in i:
    scnd.append(i)

for i in scnd:
  for j in fst:
    if set(i) == set([j, N]):
      print("POSSIBLE")
      exit()
print("IMPOSSIBLE")
  

### FIXED CODE ###

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

fst = []
scnd = {}

for i in ab:
  if i[0]==1:
    fst.append(i[1])
  if N in i:
    idx = i.index(N)
    scnd[i[1-idx]] = 0

#print(scnd,fst)
    
for j in fst:
  if j in scnd:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")
### BUGGY CODE ###

import sys

input = sys.stdin.readline

def main():
    MOD = 10**9+7
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    k = 1
    
    for i in range(60):
        c = 0
        for j in range(N):
            if A[j] & 1: c += 1
            A[j] = A[j] >> 1
        ans += c * (N-c) * k
        ans %= MOD
        k *= 2
            
    print(ans)

if __name__ == '__main__':
    main()  

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np

def main():
    N = int(input())
    A = np.array(list(map(int, input().split())))
    ans = 0
    MOD = 10**9+7
    k = 1
    x = np.max(A)
    n = 1 if x == 0 else int(np.log2(x))+1

    for i in range(n):
        c = np.count_nonzero(A%2)
        A >>= 1
        ans = (ans + c * (N-c) * k) % MOD
        k = (2*k) % MOD

    print(ans)

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

N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for _ in range(len(p)):
  p[_] = (p[_]+1)/2
for i in range(N-K+1):
  total = sum(p[i:i+K])
  if total >= max_total:
    max_total = total
print(max_total)

### FIXED CODE ###

N,K = map(int,input().split())
max_total = 0
res = 0
p = list(map(int,input().split()))
for _ in range(len(p)):
  p[_] = (p[_]+1)/2
  
total = sum(p[0:K])
max_total = total
for i in range(K,N):
  if p[i] > p[i-K]:
    total = total + p[i] - p[i-K]
    max_total = max(max_total,total)
  else:
    total = total + p[i] - p[i-K]

print(max_total)
### BUGGY CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
l = [1,a[0]]
tp = a[0]-1
while True:  
  if a[tp] not in l: 
    l.append(a[tp])
    tp = a[tp] -1
  else:
    l.append(a[tp])
    break
    
last = l.index(l[-1])

loop = len(l[last:-1])
first = len(l[:last])
if len(l)>k:
  print(l[k])
  exit()
k -=first
k %=loop
if k==0:
  k+=loop
print(l[k+first])


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
l = [1]

for i in range(n):
  l.append(a[l[i]-1])
p = l.index(l[n])
#print(p,l[n])
if k<=n:
  print(l[k])
else:
  x = (k-n+1)%(n-p)
  if x ==0:
    x += (n-p)
    print(l[x-1])
  else:
    print(l[x+p-1])
### BUGGY CODE ###

import sys
from collections import deque
h, w = map(int, input().split())
graph = []
for i in range(h):
    a = list(map(int, sys.stdin.readline().split()))
    graph.append(a)
for i in range(h):
    b = list(map(int, sys.stdin.readline().split()))
    for j in range(w):
        graph[i][j] = abs(graph[i][j] - b[j])
result = [[set()]*w for _ in range(h)]
result[0][0].add(graph[0][0])
for i in range(1, h+w-1):
    for j in range(max(0, i-(w-1)), min(i+1, h)):
        ps = set()
        if j > 0:
            for k in result[j-1][i-j]:
                em = abs(k - graph[j][i-j])
                ps.add(em)
                eu = k + graph[j][i-j]
                if k <= 80 * (h + w) // 2 +1:
                    ps.add(eu)
        if i-j > 0:
            for k in result[j][i-j-1]:
                em = abs(k - graph[j][i-j])
                ps.add(em)
                eu = k + graph[j][i-j]
                if k <= 80 * (h + w) // 2 +1:
                    ps.add(eu)
        result[j][i-j] = ps
print(min(result[h-1][w-1]))

### FIXED CODE ###

import sys
from collections import deque
h, w = map(int, input().split())
graph = []
for i in range(h):
    a = list(map(int, sys.stdin.readline().split()))
    graph.append(a)
for i in range(h):
    b = list(map(int, sys.stdin.readline().split()))
    for j in range(w):
        graph[i][j] = abs(graph[i][j] - b[j])
result = [[0]*w for _ in range(h)]
result[0][0] = 1 << graph[0][0]
def ts(a, b):
    result = 0
    for i in range(b+1):
        if (a >> i) & 1 > 0:
            result |= (1 << b) >> i
    return result

for i in range(1, h+w-1):
    for j in range(max(0, i-(w-1)), min(i+1, h)):
        ps = 0
        nt = graph[j][i-j]
        if j > 0:
            k= result[j-1][i-j]
            result[j][i-j] |= k << nt | k >> nt | ts(k, nt)
        if i-j > 0:
            k= result[j][i-j-1]
            result[j][i-j] |= k << nt | k >> nt | ts(k, nt)
ans = result[h-1][w-1]
ans = (-ans&ans).bit_length() - 1
print(ans)
### BUGGY CODE ###

import sys
import heapq
input = sys.stdin.readline


# ダイクストラ法. O(|E|log|V|)
# 頂点数 n, *負の辺が無い* グラフで、頂点 s から各頂点への最短距離を求める (存在しないときはinf)
# 隣接リスト edge[i]: 頂点 i から [cost, dst] のリスト (heapq のため cost が先)
# 辺 i,j w が与えられたとき edge[i], edge[j] とも必要な点に注意
def dijkstra(s, n, edge):
    d = [float("inf")] * n
    d[s] = 0
    q = []
    for e in edge[s]:
        heapq.heappush(q, e)
    while q:
        minedge = heapq.heappop(q)
        v = minedge[1]
        if d[v] < minedge[0]:
            continue
        d[v] = minedge[0]
        for e in edge[v]:
            heapq.heappush(q, [e[0]+d[v], e[1]])
    return d


def main():
    N, M = map(int, input().split())
    E = [[] for _ in range(N)]
    for _ in range(M):
        s, t, c = map(int, input().split())
        E[s-1].append([c, t-1])
    for i in range(N-1):
        E[i+1].append([0, i])

    A = dijkstra(0, N, E)

    ans = A[N-1]
    if ans == float("inf"):
        print(-1)
    else:
        print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import heapq
input = sys.stdin.readline


def dijkstra(s, E):
    inf = float('inf')
    d = [inf for i in range(len(E))]
    d[s] = 0
    q = [(0, s)]
    heapq.heapify(q)
    while q:
        c, p = heapq.heappop(q)
        if d[p] < c:
            continue
        for cost, to in E[p]:
            if d[to] > d[p] + cost:
                d[to] = d[p] + cost
                heapq.heappush(q, (d[to], to))
    return d


def main():
    N, M = map(int, input().split())
    E = [[] for _ in range(N)]
    for _ in range(M):
        s, t, c = map(int, input().split())
        E[s-1].append([c, t-1])
    for i in range(N-1):
        E[i+1].append([0, i])

    A = dijkstra(0, E)

    ans = A[N-1]
    if ans == float("inf"):
        print(-1)
    else:
        print(ans)


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

from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    # keys = [k for k, v in s_c.items() if v == max(s_c.values())]
    # keys_s = sorted(keys)
    keys =[k for k, v in s_c.items() if v == s_c.most_common()[0][1]]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import Counter
def main():
    n = int(input())
    s = [input() for _ in range(n)]
    s_c = Counter(s)
    s_c_max = s_c.most_common()[0][1]
    keys =[k for k, v in s_c.items() if v == s_c_max]
    keys_s = sorted(keys)
    print(*keys_s, sep='\n')

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

import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, K = il()
    ret = []
    for n in range(A, B + 1):
        ret.append(n)
    a = sorted(set(ret[:K] + ret[::-1][:K]))

    print(*a, sep="\n")


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B, K = il()
    ret = set()
    for n in range(A, min(A+K, B)):
        ret.add(n)
    for n in range(max(B-K+1, A), B+1):
        ret.add(n)
    print(*sorted(ret), sep="\n")


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

N,K=map(int,input().split())
A=list(map(int,input().split()))
s=1
for x in range(K):
  s*=A[x]
B=[]
for y in range(N-K):
  B.append(s)
  s=(s//A[y])*A[K+y]
B.append(s)
for z in range(N-K):
  if B[z]<B[z+1]:
    print("Yes")
  else:
    print("No")
    

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
for x in range(N-K):
  if A[x]<A[K+x]:
    print("Yes")
  else:
    print("No")
### BUGGY CODE ###

import math
n = int(input())
ai = [int(i) for i in input().split()]

num_li = [0]*(10**6+1)


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors



for i in range(n):
    num_li[ai[i]] += 1

ans = 0
    
for i in range(n):
    if num_li[ai[i]] > 1:
        continue
    #print(ai[i])
    flag = True
    div = make_divisors(ai[i])
    #print(div)
    for j in range(len(div)):
        if div[j] == ai[i]:
            continue
        #print(div[j],div)
        if num_li[div[j]] > 0:
            flag = False
            break
    if flag == True:
        ans += 1
    #exit()
print(ans)


### FIXED CODE ###

import math
n = int(input())
ai = [int(i) for i in input().split()]

ai.sort()

sqr_max_val = int(ai[n-1]**0.5)
max_val = ai[n-1]
#print(ai)
ai_ex = [0]*(2*10**6)
#ai_ex = [0]*(30)

for i in range(n):
    ai_ex[ai[i]-1] += 1

for i in range(n):
    if ai_ex[ai[i]-1] > 1:
        ai_ex[ai[i]-1] = 0
    """
    if ai[i] > sqr_max_val:
        break
    """
    tmp = ai[i]
    baisu = 2
    #print(ai[i])
    while tmp * baisu <=  max_val:
        ai_ex[tmp*baisu-1] = 0
        #print(tmp*baisu)
        baisu += 1
"""
for i in range(100):
    if ai_ex[i] == 1:
        a = 1
        #print(i)
"""
print(sum(ai_ex))
#print(ai_ex)
### BUGGY CODE ###

def d_wizard_in_maze():
    from collections import deque
    H, W = [int(i) for i in input().split()]
    Start_row, Start_col = [int(i) - 1 for i in input().split()]
    Goal_row, Goal_col = [int(i) - 1 for i in input().split()]
    Grid = [input() for _ in range(H)]

    neighbor = ((-1, 0), (1, 0), (0, -1), (0, 1))  # 上下左右
    warp = tuple((i, j) for i in range(-2, 3) for j in range(-2, 3)
                 if (i, j) not in neighbor)
    # dist[r][c]: スタートから (r, c) に到達するために必要なワープ回数の最小値
    dist = [[float('inf')] * W for _ in range(H)]

    def is_inside(row, col):
        return 0 <= row < H and 0 <= col < W

    def next_query(row, col, time, _next, cost):
        for dr, dc in _next:
            nr, nc = row + dr, col + dc
            if is_inside(nr, nc) and Grid[nr][nc] == '.' and time < dist[nr][nc]:
                if cost == 0:
                    queue.append((nr, nc, time))
                else:
                    queue.appendleft((nr, nc, time + 1))

    queue = deque([(Start_row, Start_col, 0)])
    while queue:
        row, col, time = queue.pop()
        if time > dist[row][col]:
            continue  # キューに入れた時点では候補だったが、後に歩いて行けるとわかった

        dist[row][col] = time
        if row == Goal_row and col == Goal_col:
            break

        next_query(row, col, time, neighbor, 0)
        next_query(row, col, time, warp, 1)
    return -1 if dist[Goal_row][Goal_col] == float('inf') else dist[Goal_row][Goal_col]

print(d_wizard_in_maze())

### FIXED CODE ###

def d_wizard_in_maze():
    from collections import deque
    H, W = [int(i) for i in input().split()]
    Start_row, Start_col = [int(i) - 1 for i in input().split()]
    Goal_row, Goal_col = [int(i) - 1 for i in input().split()]
    Grid = [input() for _ in range(H)]

    warp_count = [[-1] * W for i in range(H)]
    neighbor_4 = [(-1, 0), (1, 0), (0, -1), (0, 1)]
    neighbor_25 = [(i, j) for i in range(-2, 3) for j in range(-2, 3)]
    queue = deque([(Start_row, Start_col, 0)])  # コスト 0 の移動は左詰めする

    while(queue):
        row, col, count = queue.popleft()
        if warp_count[row][col] != -1:
            continue
        warp_count[row][col] = count

        for dr, dc in neighbor_4:
            nr, nc = row + dr, col + dc
            if 0 <= nr < H and 0 <= nc < W and Grid[nr][nc] == '.':
                if warp_count[nr][nc] == -1:
                    queue.appendleft((nr, nc, count))

        for dr, dc in neighbor_25:
            nr, nc = row + dr, col + dc
            if 0 <= nr < H and 0 <= nc < W and Grid[nr][nc] == '.':
                queue.append((nr, nc, count + 1))

    return warp_count[Goal_row][Goal_col]

print(d_wizard_in_maze())
### BUGGY CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
for i in range(1,n):
    a[i] = a[i] * a[i-1]

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


### FIXED CODE ###

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