CodeEff/ECCO huggingface dataset:
# Original solution
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))

for i in range(n):
    if i + k >= n:
        exit()
    a = A[i:i+k]
    pre = a[0]
    aft = A[i+k]
    if pre >= aft:
        print('No')
    else:
        print('Yes')



# Optimized solution
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))

for i in range(n):
    if i + k >= n:
        exit()
    pre = A[i]
    aft = A[i+k]
    if pre >= aft:
        print('No')
    else:
        print('Yes')
# Original solution
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))

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


# Optimized solution
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))

for i in range(n-k):
    if A[i] >= A[i+k]:
        print("No")
    else:
        print("Yes")
# Original solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
s = 1
for i in range(k):
    s *= a[i]
# s = sum(a[:k])
pre = s
for i in range(1,n-k+1):
    s /= a[i-1]
    s *= a[i+k-1]
    if s > pre:
        print("Yes")
    else:
        print("No")
    pre = s




# Optimized solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
# s = 1
# for i in range(k):
#     s *= a[i]
# # s = sum(a[:k])
# pre = s
for i in range(1,n-k+1):
    if a[i+k-1]/a[i-1]>1:
        print("Yes")
    else:
        print("No")
# Original solution
from collections import deque
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

prev = 1
for i in range(k):
    prev *= a[i]

a_old = deque(a)
a = deque(a[k:])
for i in range(k, n):
    score = prev*a.popleft() / a_old.popleft()
    if score <= prev:
        print('No')
    else:
        print('Yes')
    prev = score


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

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


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

hyoten = [1]*(n-k+1)
for i in range(n-k+1):
    for j in range(i, i+k):
        hyoten[i] *= a[j]

for i in range(n-k):
    if hyoten[i+1] > hyoten[i]:
        print("Yes")
    else:
        print("No")


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

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

total = 1

for i in range(k - 1, -1, -1):
    total *= a[i]

after = total
for i in range(k + 1, n + 1):
    before = total
    after //= a[i - k - 1]
    after *= a[i - 1]

    if before < after:
        print("Yes")
    else:
        print("No")

    total = after



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

for i in range(k + 1, n + 1):
    if a[i - k - 1] < a[i - 1]:
        print("Yes")
    else:
        print("No")
# Original solution
n, k = list(map(int, input().split()))
aas = list(map(int, input().split()))
scores = []
cnt = 0
tmp = 1
for i in range(n):
    tmp *= aas[i]
    if i >= k-1:
        scores.append(tmp)
        tmp //= aas[i-(k-1)]
for i in range(1,len(scores)):
    if scores[i] > scores[i-1]:
        print('Yes')
    else:
        print('No')

# Optimized solution
n, k = list(map(int, input().split()))
aas = list(map(int, input().split()))
scores = []
for i in range(k,n):
    if aas[i] > aas[i-k]:
        print('Yes')
    else:
        print('No')
# Original solution
# 2020/07/25
# M-SOLUTIONS プロコンオープン 2020 - C

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

# Calc
pt = a[0]

for i in range(1, k):
    pt = pt * a[i]

for i in range(k, n):
    bef_pt = pt
    pt = pt * a[i] // a[i-k] 

    # Output
    if bef_pt < pt:
        print('Yes')
    else:
        print('No')


# Optimized solution
# 2020/07/25
# M-SOLUTIONS プロコンオープン 2020 - C

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

# Calc
for i in range(k, n):
    # Output
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')
# Original solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
now_sum_val = 1
for i in range(K):
    now_sum_val *= A[i]
for i in range(K, N):
    next_sum_val = now_sum_val // A[i - K] * A[i]
    if next_sum_val > now_sum_val:
        print('Yes')
    else:
        print('No')
    now_sum_val = next_sum_val

# Optimized solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(K, N):
    # next_sum_val = now_sum_val // A[i - K] * A[i]
    if A[i] > A[i - K]:
        print('Yes')
    else:
        print('No')
# Original solution
import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict as dd

def main():
    n,k=list(map(int,input().split()))
    ar=list(map(int,input().split()))
    prod=1
    for i in range(k):
        prod*=ar[i]
    for i in range(k,n):
        x=prod*ar[i]//ar[i-k]
        if x>prod:
            print('Yes')
        else:
            print('No')
        prod=x




BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


if __name__ == "__main__":
    main()



# Optimized solution
from math import log2
n,k=list(map(int,input().split()))
ar=list(map(int,input().split()))
for i in range(n):
    ar[i]=log2(ar[i])
prod=0
for i in range(k):
    prod+=ar[i]
for i in range(k,n):
    x=prod+ar[i]-ar[i-k]
    if x>prod:
        print('Yes')
    else:
        print('No')
    prod=x
# Original solution
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))

now = 1

for i in range(k):
    now *= a[i]

for i in range(k,n):
    ima = now * a[i]
    ima //= a[i-k]
    if ima > now:
        print("Yes")
    else:
        print("No")
    now = ima

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

for i in range(k,n):
    if a[i]/a[i-k] > 1:
        print("Yes")
    else:
        print("No")
# Original solution
N,K=list(map(int,input().split()))
A = list(map(int,input().split()))

s0=1
for i in range(1,K+1):
    s0=s0*A[K-i]


for i in range(N-K):
    s1=s0/A[K-K+i]*A[K+i]
    if s1>s0:
        print('Yes')
    else:
        print('No')
    s0=s1

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


s0=A[0]


for i in range(N-K):
    s1=A[K+i]
    if s1>s0:
        print('Yes')
    else:
        print('No')
    s0=A[i+1]
# Original solution
import sys
n, k = list(map(int,input().split()))
As = list(map(int, input().split()))
ans = 1
tmp = -1
for i in range(n-k+1):
    for j in range(k):
        ans= ans*As[k+i-j-1]
    if not tmp==-1:
        if tmp<ans:
            print('Yes')
        else:
            print('No')
    tmp = ans
    ans = 1

# Optimized solution
n, k = list(map(int,input().split()))
As = list(map(int, input().split()))
ans = 1
tmp = -1
for i in range(n-k):
    if As[k+i]>As[i]:
        print('Yes')
    else:
        print('No')
# Original solution
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
ref = 1

for i in range(k):
    ref *= a[i]

for i in range(n - k):
    ref2 = ref*a[i + k]/a[i]
    if ref2 > ref:
        print("Yes")
    else:
        print("No")
    ref = ref2

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

for i in range(n - k):
    if a[i + k] > a[i]:
        print("Yes")
    else:
        print("No")
# Original solution
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

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

    before = 1
    for i in range(k):
        before *= A[k-1-i]
    for i in range(k,n):
        after = (before//A[i-k])*A[i]
        if before < after:
            print('Yes')
        else:
            print('No')
        before = after


if __name__ == '__main__':
    main()


# Optimized solution
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

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

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


if __name__ == '__main__':
    main()
# Original solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

num = A[0]
for i in range(1, K):
    num *= A[i]
check = num

for i in range(K, N):
    num //= A[i-K]
    num *= A[i]
    if check < num:
        print('Yes')
    else:
        print('No')
    check = num

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

for i in range(K, N):
    if A[i-K] < A[i]:
        print('Yes')
    else:
        print('No')
# Original solution
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

tmp = 1
for i in range(K):
    tmp *= A[i]
tmp1 = tmp
idx = 0
for i in range(K, N):
    tmp1 *= A[i]
    tmp1 = tmp1//A[idx]
    if(tmp1 > tmp):
        print("Yes")
        tmp = tmp1
        idx += 1
    else:
        print("No")
        tmp = tmp1
        idx += 1

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

idx = 0
for i in range(K, N):
    if(A[idx] < A[i]):
        print("Yes")
    else:
        print("No")
    idx += 1
# Original solution
#!/usr/bin/env python

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

inip = 1 
for i in range(k):
    inip *= a[i]

# p = [inip]

p = [-1 for _ in range(n-k+1)]
p[0] = inip

tmp = inip
#print('inip =', inip)

for i in range(k, n): 
    s = tmp//a[i-k]*a[i]
    # p.append(s)
    p[i-k+1] = s 
    tmp = s 

# print('p =', p)

for i in range(len(p)-1):
    if p[i+1] > p[i]:
        print('Yes')
    else:
        print('No')


# Optimized solution
#!/usr/bin/env python

n, k = list(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')
# Original solution
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return {i for i in range(self.n) if self.find(i) == root}

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M = list(map(int,input().split()))
uf = UnionFind(N)
p = list(map(int,input().split()))
L = []
for i in range(M):
    x,y = list(map(int,input().split()))
    uf.union(x - 1,y - 1)
cnt = 0
for i in range(N):
    if i in uf.members( p[i] - 1 ):
        cnt+=1
print(cnt)


# Optimized solution
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return {i for i in range(self.n) if self.find(i) == root}

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M = list(map(int,input().split()))
uf = UnionFind(N)
p = list(map(int,input().split()))
L = []
for i in range(M):
    x,y = list(map(int,input().split()))
    uf.union(x - 1,y - 1)
cnt = 0
for i in range(N):
    if uf.same(i,p[i]-1):
        cnt+=1
print(cnt)
# Original solution
N, M = list(map(int, input().split()))
P = list(map(int, input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def same(self, x, y):
        return self.find(x) == self.find(y)

unionfind = UnionFind(N + 1)

for _ in range(M):
    x, y = list(map(int, input().split()))
    unionfind.union(P[x - 1], P[y - 1])

ans = 0
idx = []
for i in range(N):
    if P[i] == (i + 1):
        ans += 1
    else:
        idx.append(i)
for i in idx:
    if unionfind.same(P[i], i + 1):
        ans += 1
print(ans)

# Optimized solution
N, M = list(map(int, input().split()))
p = list(map(int, input().split()))

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

unionfind = UnionFind(N + 1)
for _ in range(M):
    x, y = list(map(int, input().split()))
    unionfind.union(x, y)
ans = 0
for i in range(N):
    if i + 1 != p[i]:
        if unionfind.same(p[i], i + 1):
            ans += 1
    else:
        ans += 1
print(ans)
# Original solution
import sys

input = sys.stdin.readline


def read_values():
    return list(map(int, input().split()))


def read_list():
    return list(read_values())


def func(N, mod):
    F = [1]
    for i in range(1, N + 1):
        F.append(F[-1] * i % mod)
    return F


INV = {}


def inv(a, mod):
    if a in INV:
        return INV[a]
    r = pow(a, mod - 2, mod)
    INV[a] = r
    return r


def C(F, a, b, mod):
    return F[a] * inv(F[b], mod) * inv(F[a - b], mod) % mod


class UF:
    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def get_parent(self, a):
        p = self.parent[a]
        if a == p:
            return a

        q = self.get_parent(p)
        self.parent[a] = q
        return q

    def make_pare(self, a, b):
        pa = self.get_parent(a)
        pb = self.get_parent(b)
        if pa != pb:
            self.parent[pa] = pb
            self.parent[a] = pb

    def is_pare(self, a, b):
        return self.get_parent(a) == self.get_parent(b)


def main():
    N, M = read_values()
    P = read_list()
    F = [0] * N
    for i, p in enumerate(P):
        F[p - 1] = i

    W = [tuple(read_values()) for _ in range(M)]
    U = UF(N)
    for a, b in W:
        a -= 1
        b -= 1
        U.make_pare(a, b)

    res = 0
    already = [False] * N
    for i in range(N):
        if already[i]:
            continue

        if i == F[i]:
            res += 1
            continue

        S_num = {i}
        S_index = {F[i]}

        for j in range(i + 1, N):
            if already[j]:
                continue

            if U.is_pare(i, j):
                S_num.add(j)
                S_index.add(F[j])
                already[j] = True
        res += len(S_num & S_index)
    print(res)


if __name__ == "__main__":
    main()



# Optimized solution
import sys

input = sys.stdin.readline


def read_values():
    return list(map(int, input().split()))


def read_list():
    return list(read_values())


def func(N, mod):
    F = [1]
    for i in range(1, N + 1):
        F.append(F[-1] * i % mod)
    return F


INV = {}


def inv(a, mod):
    if a in INV:
        return INV[a]
    r = pow(a, mod - 2, mod)
    INV[a] = r
    return r


def C(F, a, b, mod):
    return F[a] * inv(F[b], mod) * inv(F[a - b], mod) % mod


class UF:
    def __init__(self, N):
        self.parent = [i for i in range(N)]

    def get_parent(self, a):
        p = self.parent[a]
        if a == p:
            return a

        q = self.get_parent(p)
        self.parent[a] = q
        return q

    def make_pare(self, a, b):
        pa = self.get_parent(a)
        pb = self.get_parent(b)
        if pa != pb:
            self.parent[pa] = pb
            self.parent[a] = pb

    def is_pare(self, a, b):
        return self.get_parent(a) == self.get_parent(b)


def main():
    N, M = read_values()
    P = read_list()
    F = [0] * N

    W = [tuple(read_values()) for _ in range(M)]
    U = UF(N)
    for a, b in W:
        a -= 1
        b -= 1
        U.make_pare(a, b)

    res = 0
    for p in P:
        p -= 1
        if U.is_pare(p, P[p] - 1):
            res += 1
    print(res)


if __name__ == "__main__":
    main()
# Original solution
N, M = list(map(int, input().split()))
P = list(map(int, input().split()))
P = list(enumerate(P, start=1))


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = 0
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)


uf = UnionFind(N)
for m in range(M):
    x, y = list(map(int, input().split()))
    uf.union(x, y)

ans = 0
for now, value in P:
    if uf.same_check(now, value):
        ans += 1
print(ans)

# Optimized solution
N, M = list(map(int, input().split()))
P = list(enumerate(map(int, input().split())))


class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0] * n
        self.size = [1] * n

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.size[y] += self.size[x]
            self.size[x] = 0
        else:
            self.par[y] = x
            self.size[x] += self.size[y]
            self.size[y] = 0
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # すべての頂点に対して親を検索する
    def all_find(self):
        for n in range(len(self.par)):
            self.find(n)


UF = UnionFind(N)
for i in range(M):
    x, y = list(map(int, input().split()))
    x, y = x-1, y-1
    UF.union(x, y)


UF.all_find()

ans = 0
for index, number in P:
    ans += UF.same(index, number - 1)

print(ans)