Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

p.sort()
#print(p)
for i in range(n):
    if p[i] == x:
        index = i
        break

right = x + 1
for i in p[index + 1:]:
    #print(i)
    if i != right:
        #print('aaaa')
        #print(right)
        break
    right += 1

left = x - 1
for i in reversed(p[:index]):
    #print(i)
    if i != left:
        #print('bbbb')
        #print(left)
        break
    left -= 1

if x - left <= right - x:
    print(left)
else:
    print(right)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

p.sort()

if x not in p:
    print(x)
    exit()
    
for i in range(len(p)):
    #print(p[i])
    if p[i] == x:
        index = i
        break

right = x + 1
for i in p[index + 1:]:
    if i != right:
        break
    right += 1

left = x - 1
for i in reversed(p[:index]):
    if i != left:
        break
    left -= 1

if x - left <= right - x:
    print(left)
else:
    print(right)

Buggy python submission (verdict: Runtime Error):
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

p.sort()
print(p)
for i in range(n):
    if p[i] == x:
        index = i
        break

right = x + 1
for i in p[index + 1:]:
    print(i)
    if i != right:
        print('aaaa')
        print(right)
        break
    right += 1

left = x - 1
for i in reversed(p[:index]):
    print(i)
    if i != left:
        print('bbbb')
        print(left)
        break
    left -= 1

if x - left <= right - x:
    print(left)
else:
    print(right)

Fixed submission:
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

p.sort()

if x not in p:
    print(x)
    exit()
    
for i in range(len(p)):
    #print(p[i])
    if p[i] == x:
        index = i
        break

right = x + 1
for i in p[index + 1:]:
    if i != right:
        break
    right += 1

left = x - 1
for i in reversed(p[:index]):
    if i != left:
        break
    left -= 1

if x - left <= right - x:
    print(left)
else:
    print(right)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for ai in a:
    ans *= ai

if ans > 10 ** 18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
for ai in a:
    ans *= ai
    if ans == 0:
        print(0)
        break
    elif ans > 10 ** 18:
        print(-1)
        break
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

t = [1]
for i in range(n):
    t.append(a[t[-1] -  1])

for i in range(n):
    for j in range(i + 1, n):
        if t[i] == t[j]:
            s = j - i
            break
    else:
        continue

    break

if k < i:
    print(t[k])
else:
    print(t[(k - i) % s + i])

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

t = [1]
for i in range(n):
    t.append(a[t[-1] -  1])

t_sort = sorted(t)
for i in range(n):
    if t_sort[i] == t_sort[i + 1]:
        b = t_sort[i]
        break

count = 0
for i in range(n):
    if t[i] == b:
        if count == 0:
            count += 1
            s_first = i
        else:
            s_second = i
            break
s = s_second - s_first

for i in range(n - s + 1):
    if t[i] == t[i + s]:
        break

if k < i:
    print(t[k])
else:
    print(t[(k - i) % s + i])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        n.remove(ai)
print(len(n))

Fixed submission:
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        for ni in n:
            if ai == ni:
                n.remove(ai)
print(len(n))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    print(a)
    for ai in a:
        n.remove(ai)
print(len(n))



Fixed submission:
n, k = map(int, input().split())
n = list(map(str, range(1, n+1)))

for i in range(k):
    _ = input()
    a = input().split()
    for ai in a:
        for ni in n:
            if ai == ni:
                n.remove(ai)
print(len(n))
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

ans = 0
for x in range(1, n + 1):
    ax = a * x
    ans = max(ans, ax // b - a * (x // b))
print(ans)

Fixed submission:
a, b, n = map(int, input().split())

if n < b - 1:
    ans = (a * (n % b)) // b
else:
    ans = (a * ((b - 1) % b)) // b
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

def gcd(a, b, c):
    x = min(a, b, c)
    result = 1
    for i in range(1, x + 1):
        if a % i == 0 and b % i == 0 and c % i == 0:
            result = i
    return result

ans = 0
d = dict()
for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
            x = [str(i) for i in sorted([a, b, c])]
            key = ''.join(x)
            if key not in d.keys():
                d[key] = gcd(a, b, c)
            ans += d[key]
print(ans)

Fixed submission:
import math

k = int(input())

ans = 0
for a in range(1, k + 1):
    for b in range(1, k + 1):
        x = math.gcd(a, b)
        for c in range(1, k + 1):
            ans += math.gcd(x, c)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

ans = r * g * b

for i in range(n):
    for d in range(1, n):
        j = i + d
        k = j + d
        if k > n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1

print(ans)

Fixed submission:
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

ans = r * g * b

for i in range(n):
    for d in range(1, n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

a = []

for j in range(1, n-1):
    sj = s[j]
    i = j - 1
    while i > -1:
        if sj != s[i]:
           a.append((i, j)) 
        i -= 1

ans = 0
for (i, j) in a:
    si = s[i]
    sj = s[j]
    for k in range(j + 1, n):
        if j - i == k - j:
            continue
        if si == s[k] or sj == s[k]:
            continue
        ans += 1

print(ans)

Fixed submission:
n = int(input())
s = input()

r = s.count('R')
g = s.count('G')
b = s.count('B')

ans = r * g * b

for i in range(n):
    for d in range(1, n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n == 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m == 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)

Fixed submission:
n, m = map(int, input().split())

def solve(n):
    if n == 0:
        return 1
    return n * solve(n - 1)

if n <= 1:
    n_ans = 0
else:
    n_ans = solve(n) // (solve(n - 2) * 2)
if m <= 1:
    m_ans = 0
else:
    m_ans = solve(m) // (solve(m - 2) * 2)
ans = n_ans + m_ans
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
P = list(map(int, input().split()))

m = prev = sum(P[:k])
s = 0
for i in range(1, n - k + 1):
    tmp = prev - P[i - 1]+ P[i + k - 1]
    prev = tmp
    if tmp > m:
        s = i
    m = max(tmp, m)

ans = 0
for i in range(s, s + k):
    p = P[i]
    ans += sum(range(p + 1)) / p
print(ans)

Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))

m = prev = sum(P[:k])
s = 0
for i in range(1, n - k + 1):
    tmp = prev - P[i - 1]+ P[i + k - 1]
    prev = tmp
    if tmp > m:
        s = i
    m = max(tmp, m)

ans = 0
d = dict()
for i in range(s, s + k):
    p = P[i]
    if p not in d.keys():
        tmp = sum(range(p + 1)) / p
        ans += tmp
        d[p] = tmp
    else:
        ans += d[p]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
P = list(map(int, input().split()))

e = []
for p in P:
    e.append(sum(range(p + 1)) / p)

ans = prev = sum(e[:k])
for i in range(1, n - k + 1):
    tmp = prev - e[i - 1]+ e[i + k - 1]
    prev = tmp
    ans = max(tmp, ans)
print(ans)

Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))

m = prev = sum(P[:k])
s = 0
for i in range(1, n - k + 1):
    tmp = prev - P[i - 1]+ P[i + k - 1]
    prev = tmp
    if tmp > m:
        s = i
    m = max(tmp, m)

ans = 0
d = dict()
for i in range(s, s + k):
    p = P[i]
    if p not in d.keys():
        tmp = sum(range(p + 1)) / p
        ans += tmp
        d[p] = tmp
    else:
        ans += d[p]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
P = list(map(int, input().split()))

e = []
for p in P:
    e.append(sum(range(p + 1)) / p)

ans = 0
for i in range(n - k + 1):
    a = 0
    for j in range(i, i + k):
        a += e[j]
    ans = max(ans, a)
print(ans)


Fixed submission:
n, k = map(int, input().split())
P = list(map(int, input().split()))

m = prev = sum(P[:k])
s = 0
for i in range(1, n - k + 1):
    tmp = prev - P[i - 1]+ P[i + k - 1]
    prev = tmp
    if tmp > m:
        s = i
    m = max(tmp, m)

ans = 0
d = dict()
for i in range(s, s + k):
    p = P[i]
    if p not in d.keys():
        tmp = sum(range(p + 1)) / p
        ans += tmp
        d[p] = tmp
    else:
        ans += d[p]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

result = set()
for i in range(1000):
    v = str(i).zfill(3)
    key = []
    p = -1
    for j in range(3):
        for k in range(n):
            if v[j] == s[k] and k > p:
                key.append(s[k])
                p = k
                break
    if len(key) == 3:
        result.add(''.join(key))

print(len(result))

Fixed submission:
n = int(input())
s = list(map(int, input()))

ans = 0
for i in range(10):
    if i in s[: n - 2]:
        x = s.index(i)
        for j in range(10):
            if j in s[x + 1: n - 1]:
                y = x + 1 + s[x + 1: n - 1].index(j)
                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

result = set()
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            key = ''.join(s[i] + s[j] + s[k])
            result.add(key)

#print(result)
print(len(result))


Fixed submission:
n = int(input())
s = list(map(int, input()))

ans = 0
for i in range(10):
    if i in s[: n - 2]:
        x = s.index(i)
        for j in range(10):
            if j in s[x + 1: n - 1]:
                y = x + 1 + s[x + 1: n - 1].index(j)
                for k in range(10):
                    if k in s[y + 1:]:
                        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(n - 2):
    a = L[i]
    for j in range(i + 1, n - 1):
        b = L[j]
        c_min = b - a
        c_max = a + b
        if c_max > c_min + 1:
            l = L[j+1:]
            i_min = bisect.bisect_right(l, c_min)
            i_max = bisect.bisect_left(l, c_max)
            ans += i_max-i_min
print(ans)


Fixed submission:
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(n):
    for j in range(i+1, n):
        k = bisect.bisect_left(L, L[i]+L[j])
        ans += k-1 - j
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))
l.sort()

d = dict()
ans_set = dict()
for a in range(n-1):
    for b in range(a+1, n):
        d[(a, b)] = l[a] + l[b]

for k, v in d.items():
    c = 0
    a, b = k
    while True:
        if c >= n or l[c] >= v:
            break
        if c != a and c != b:
            if l[a] < l[b]+l[c] and l[b] < l[c]+l[a]:
                ans_set[tuple(sorted((a, b, c)))] = 1
        c+= 1
print(len(ans_set))


Fixed submission:
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(n):
    for j in range(i+1, n):
        k = bisect.bisect_left(L, L[i]+L[j])
        ans += k-1 - j
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

s = []
for i in range(n - 2):
    a = L[i]
    for j in range(i + 1, n - 1):
        b = L[j]
        c_min = b - a
        c_max = a + b
        if c_max > c_min + 1:
            s.append((c_min, c_max, j + 1))

ans = 0
for x, y, j in s:
    i_min = bisect.bisect_right(L[j:], x)
    i_max = bisect.bisect_left(L[j:], y)
    ans += i_max - i_min
print(ans)

Fixed submission:
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(n):
    for j in range(i+1, n):
        k = bisect.bisect_left(L, L[i]+L[j])
        ans += k-1 - j
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

s = []
for i in range(n - 2):
    a = L[i]
    for j in range(i + 1, n - 1):
        b = L[j]
        c_min = b - a
        c_max = a + b
        if c_max > c_min + 1:
            s.append((c_min, c_max, j + 1))

ans = 0
for x, y, j in s:
    i_min = bisect.bisect_right(L[j:], x)
    i_max = bisect.bisect_left(L[j:], y)
    ans += i_max - i_min
print(ans)

Fixed submission:
import bisect
n = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(n):
    for j in range(i+1, n):
        k = bisect.bisect_left(L, L[i]+L[j])
        ans += k-1 - j
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n//2+1):
    ans += n+1
ans -= n
if n%2 == 1:
    ans += n//2 + 1
print(ans)


Fixed submission:
n = int(input())
ans = (n+1) * (n//2) - n
if n%2 == 1:
    ans += n//2 + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n):
    ans += i
print(ans)


Fixed submission:
n = int(input())
ans = (n+1) * (n//2) - n
if n%2 == 1:
    ans += n//2 + 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(1, n+1):
    ans += i % (i+1)%n
print(ans)


Fixed submission:
n = int(input())
ans = (n+1) * (n//2) - n
if n%2 == 1:
    ans += n//2 + 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v = list(map(int, input().split()))
c1 = Counter(v[::2])
c2 = Counter(v[1::2])
s1 = sorted(c1.items(), key=lambda x: x[1], reverse=True)
s2 = sorted(c2.items(), key=lambda x: x[1], reverse=True)

if len(s1) == 1 and len(s2) == 1:
    if s1[0][0] == s2[0][0]:
        ans = int(n / 2)
    else:
        ans = 0
else:
    if s1[0][0] != s2[0][0]:
        ans = n - s1[0][1] - s2[0][1]
    else:
        if s[0][1] > s2[0][1]:
            ans = n - s[0][1] - s[1][1]
        elif s[0][1] < s2[0][1]:
            ans = n - s[1][1] - s[0][1]
        else:
            ans = min(n - s[0][1] - s[1][1], n - s[1][1] - s[0][1])
print(ans)

Fixed submission:
n = int(input())
v = list(map(int, input().split()))
odd = {}
even = {}
change = 0
for i in range(n):
    if i % 2 == 0:
        if v[i] in even:
            even[v[i]] += 1
        else:
            even[v[i]] = 1
    else:
        if v[i] in odd:
            odd[v[i]] += 1
        else:
            odd[v[i]] = 1

if len(odd) == 1 and len(even) == 1:
    if odd == even:
        change = int(n / 2)
else:
    max_e = max(even, key=even.get)
    max_o = max(odd, key=odd.get)
    if max_e != max_o:
        change = n - even[max_e] - odd[max_o]
    else:
        if even[max_e] > even[max_o]:
            max_o2 = min(odd, key=odd.get)
            for o in odd:
                if o != max_o and odd[o] > odd[max_o2]:
                    max_o2 = o
            change = n - even[max_e] - odd[max_o2]
        elif even[max_e] == even[max_o]:
            max_o2 = min(odd, key=odd.get)
            for o in odd:
                if o != max_o and odd[o] > odd[max_o2]:
                    max_o2 = o
            max_e2 = min(even, key=even.get)
            for e in even:
                if e != max_e and even[e] > even[max_e2]:
                    max_e2 = e
            change = min(n - even[max_e] - odd[max_o2], n - odd[max_o] - even[max_e2])
        else:
            max_e2 = min(even, key=even.get)
            for e in even:
                if e != max_e and even[e] > even[max_e2]:
                    max_e2 = e
            change = n - odd[max_o] - even[max_e2]
print(change)
Buggy python submission (verdict: Time Limit Exceeded):
N, X, M = [int(x) for x in input().split()]

seen = set()
front = []
cycle = []
for i in range(N):
    x = pow(X, 2 ** i, M)
    if x in seen:
        index = front.index(x)
        front, cycle = front[:index], front[index:]
        break
    front.append(x)
    seen.add(x)


if N <= len(front):
    print(sum(front[:N]))
    exit()

if N <= len(front) + len(cycle):
    print(sum(front) + sum(cycle[: N - len(front)]))
    exit()

q, r = divmod(N - len(front), len(cycle))

if False:
    A = [pow(X, 2 ** i, M) for i in range(N)]
    B = front + cycle * q + cycle[:r]
    print(A, B)
    assert A == B
print(sum(front) + sum(cycle) * q + sum(cycle[:r]))


Fixed submission:
def solve(N, X, M):
    seen = set()
    front = [X]
    cycle = []
    for i in range(N - 1):
        x = (front[-1] * front[-1]) % M
        if x in seen:  # seen can't be more than M since x is < M
            index = front.index(x)
            front, cycle = front[:index], front[index:]
            break
        front.append(x)
        seen.add(x)
    if N <= len(front):
        return sum(front[:N])

    if N <= len(front) + len(cycle):
        return sum(front) + sum(cycle[: N - len(front)])

    q, r = divmod(N - len(front), len(cycle))

    if False:
        A = [pow(X, 2 ** i, M) for i in range(N)]
        B = front + cycle * q + cycle[:r]
        print(A, B)
        assert A == B
    return sum(front) + sum(cycle) * q + sum(cycle[:r])


N, X, M = [int(x) for x in input().split()]
print(solve(N, X, M))
Buggy python submission (verdict: Runtime Error):
from collections import Counter, deque

(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

freqA = Counter(A)
freqB = Counter(B)
for k in freqA.keys() & freqB.keys():
    if freqA[k] + freqB[k] > N:
        print("No")
        exit()

rotate = 0
for i in range(N):
    while A[(i + rotate) % N] == B[i]:
        rotate += 1
for i in range(N):
    while A[(i + rotate) % N] == B[i]:
        rotate += 1
for i in range(N):
    while A[(i + rotate) % N] == B[i]:
        rotate += 1
B = deque(B)
B.rotate(rotate)

for a, b in zip(A, B):
    if a == b:
        assert False
print("Yes")
print(" ".join(map(str, B)))



Fixed submission:
from collections import Counter, deque

(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

freqA = Counter(A)
freqB = Counter(B)
for k in freqA.keys() & freqB.keys():
    if freqA[k] + freqB[k] > N:
        print("No")
        exit()

B = deque(B)
while True:
    rotate = 0
    for i in range(N):
        while A[(i + rotate) % N] == B[i]:
            rotate += 1
    bad = False
    B.rotate(rotate)
    for a, b in zip(A, B):
        if a == b:
            bad = True
    if not bad:
        break

print("Yes")
print(" ".join(map(str, B)))
Buggy python submission (verdict: Time Limit Exceeded):
(N, K) = [int(x) for x in input().split()]
P = [int(x) - 1 for x in input().split()]  # 0 indexed
C = [int(x) for x in input().split()]


inf = float("inf")


ans = max(C)  # at least one move
for pos in range(N):
    i = pos
    score = 0
    cycleLen = None
    cycleGain = None
    bestInc = 0
    for k in range(K):
        i = P[i]
        score += C[i]
        ans = max(ans, score)
        bestInc = max(bestInc, score)

        if cycleLen is not None and k == K % cycleLen:
            numCycles = (K - k) // cycleLen

            ans = max(ans, cycleGain * numCycles + bestInc)
            break

        if i == pos:
            cycleLen = k
            cycleGain = score

print(ans)


Fixed submission:
(N, K) = [int(x) for x in input().split()]
P = [int(x) - 1 for x in input().split()]  # 0 indexed
C = [int(x) for x in input().split()]


inf = float("inf")


ans = max(C)  # at least one move
for pos in range(N):
    i = pos
    score = 0
    cycleLen = None
    cycleGain = None
    bestInc = 0
    k = 0
    while k < K:
        i = P[i]
        score += C[i]
        ans = max(ans, score)

        if i == pos:
            cycleLen = k + 1
            numCycles = max(0, (K - k - cycleLen) // cycleLen)
            if k + numCycles * cycleLen < K:
                k += numCycles * cycleLen
                score += numCycles * score
        k += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import io
import os

from collections import Counter, defaultdict, deque


def solve(N, K, A):
    window = deque()
    val = 1
    grades = []
    for x in A:
        window.append(x)
        val *= x

        if len(window) > K:
            val //= window.popleft()
        if len(window) == K:
            grades.append(val)
    ans = []
    for x, y in zip(grades, grades[1:]):
        if x < y:
            ans.append("Yes")
        else:
            ans.append("No")

    return "\n".join(ans)


if __name__ == "__main__":
    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
    N, K = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    ans = solve(N, K, A)
    print(ans)



Fixed submission:
import io
import os

from collections import Counter, defaultdict, deque


def solve(N, K, A):
    window = deque()
    ans = []
    for x in A:
        window.append(x)

        if len(window) > K:
            if window.popleft() < x:
                ans.append("Yes")
            else:
                ans.append("No")
    return "\n".join(ans)


if __name__ == "__main__":
    input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
    N, K = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    ans = solve(N, K, A)
    print(ans)