Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
N, M = tuple(li())
A = list(li())
heapq.heapify(A)
def update(pq, k, val):
    # update pq in place
    for _ in range(k):
        cur = heapq.heappop(pq)
        if cur < val:
            heapq.heappush(pq, val)
        else:
            heapq.heappush(pq, cur)
            break

ops = [tuple( li() ) for _ in range(M)]
ops.sort(key=lambda x:x[-1])
for k, val in ops:
    update(A, k, val)

print(sum(A))


Fixed submission:
import heapq
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
N, M = tuple(li())
A = list(li())
heapq.heapify(A)
def update(pq, k, val):
    # update pq in place
    for _ in range(k):
        cur = heapq.heappop(pq)
        if cur < val:
            heapq.heappush(pq, val)
        else:
            heapq.heappush(pq, cur)
            break

ops = []
# val, k_sum
keep = dict()
for i in range(M):
    k, val = tuple(li())
    k_sum = keep.get(val, 0)
    keep[val] = k_sum + k

for val, k in keep.items():
    update(A, k, val)

print(sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
N, M = tuple(li())
A = list(li())
heapq.heapify(A)
def update(pq, k, val):
    # update pq in place
    for _ in range(k):
        cur = heapq.heappop(pq)
        if cur < val:
            heapq.heappush(pq, val)
        else:
            heapq.heappush(pq, cur)
            break
for i in range(M):
    k, val = tuple(li())
    update(A, k, val)

print(sum(A))


Fixed submission:
import heapq
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def ii(): return int(stdin.readline())
def li(): return map(int, stdin.readline().split())
N, M = tuple(li())
A = list(li())
heapq.heapify(A)
def update(pq, k, val):
    # update pq in place
    for _ in range(k):
        cur = heapq.heappop(pq)
        if cur < val:
            heapq.heappush(pq, val)
        else:
            heapq.heappush(pq, cur)
            break

ops = []
# val, k_sum
keep = dict()
for i in range(M):
    k, val = tuple(li())
    k_sum = keep.get(val, 0)
    keep[val] = k_sum + k

for val, k in keep.items():
    update(A, k, val)

print(sum(A))
Buggy python submission (verdict: Runtime Error):
from collections import Counter
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()

N, Q = tuple(li())
S = ns()
ops = []
for i in range(Q):
    ops.append(tuple(ls()))

head, tail = 0, N-1
while(ops):
    cur = ops.pop()
    if cur[1] == 'L':
        if S[head] == cur[0]:
            head += 1
    elif cur[1] == 'R':
        if S[tail] == cur[0]:
            tail -= 1
alive = tail - head + 1

print(max(alive, 0))


Fixed submission:
from collections import Counter
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()

N, Q = tuple(li())
S = ns()
ops = []
for i in range(Q):
    ops.append(tuple(ls()))

head, tail = 0, N-1
while(ops):
    cur = ops.pop()
    if cur[1] == 'L' and head <N:
        if S[head] == cur[0]:
            head += 1
        if tail <= N-2 and S[tail + 1] == cur[0]:
            tail = min(tail + 1, N-1)
    elif cur[1] == 'R' and tail >= 0:
        if S[tail] == cur[0]:
            tail -= 1
        if head >= 1 and S[head - 1] == cur[0]:
            head = max(0, head-1)
alive = tail - head + 1
# print("tail:{}, head:{}".format(tail, head))
print(max(alive, 0))

Buggy python submission (verdict: Runtime Error):
from collections import Counter
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()

N, Q = tuple(li())
S = ns()
ops = []
for i in range(Q):
    ops.append(tuple(ls()))

head, tail = 0, N-1
while(ops):
    cur = ops.pop()
    if cur[1] == 'L':
        if S[head] == cur[0]:
            head += 1
    elif cur[1] == 'R':
        if S[tail] == cur[0]:
            tail -= 1
alive = tail - head + 1
print("tail:{}, head:{}".format(tail, head))
print(max(alive, 0))


Fixed submission:
from collections import Counter
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()

N, Q = tuple(li())
S = ns()
ops = []
for i in range(Q):
    ops.append(tuple(ls()))

head, tail = 0, N-1
while(ops):
    cur = ops.pop()
    if cur[1] == 'L' and head <N:
        if S[head] == cur[0]:
            head += 1
        if tail <= N-2 and S[tail + 1] == cur[0]:
            tail = min(tail + 1, N-1)
    elif cur[1] == 'R' and tail >= 0:
        if S[tail] == cur[0]:
            tail -= 1
        if head >= 1 and S[head - 1] == cur[0]:
            head = max(0, head-1)
alive = tail - head + 1
# print("tail:{}, head:{}".format(tail, head))
print(max(alive, 0))
Buggy python submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
 

 
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())

categories = [ tuple(li()) for _ in range(N) ]
categories.sort()

total = 0
def buy_M(cate, M, cost):
    if M <= 0:
        return cost
    if cate[0][1] >= M:
        cur_cost = cate[0][0] * M
        return cur_cost + cost
    else:
        rest = M - cate[0][1]
        cur_cost = cate[0][1] * cate[0][0]
        return buy_M(cate[1:], rest, cost + cur_cost)
print(buy_M(categories, M, 0))


Fixed submission:
import sys
import bisect
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())

categories = [ tuple(li()) for _ in range(N) ]
categories.sort()

total_cost = [(0, 0)]
for A, B in categories:
    total_cost.append((B + total_cost[-1][0], A * B + total_cost[-1][1]))
    idx = bisect.bisect_right( total_cost, (M, 0) )
total = total_cost[idx][1] + (M - total_cost[idx][0]) * categories[idx - 1][0]
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())

categories = [ tuple(li()) for _ in range(N) ]
categories.sort()

total = 0
def buy_M(cate, M, cost):
    if M <= 0:
        return cost
    if cate[0][1] >= M:
        cur_cost = cate[0][0] * M
        return cur_cost + cost
    else:
        rest = M - cate[0][1]
        cur_cost = cate[0][1] * cate[0][0]
        return buy_M(cate[1:], rest, cost + cur_cost)
print(buy_M(categories, M, 0))


Fixed submission:
import sys
import bisect
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())

categories = [ tuple(li()) for _ in range(N) ]
categories.sort()

total_cost = [(0, 0)]
for A, B in categories:
    total_cost.append((B + total_cost[-1][0], A * B + total_cost[-1][1]))
    idx = bisect.bisect_right( total_cost, (M, 0) )
total = total_cost[idx][1] + (M - total_cost[idx][0]) * categories[idx - 1][0]
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import bisect
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

A, B = tuple(li())

nums = range(A, B + 1)
L = len(format(B, 'b'))
res = [0] * L
for num in nums:
    # print(f"num:{num}")
    bit = 1
    for i in range(L):
        # print(f"i:{i}")
        cur_bit = num & bit
        if cur_bit == bit:
            res[i] ^= 1
        bit = bit << 1
        # print(f"res_bit:{res}")
    # print(f"res:{res}")
res = reversed(res)
res_num = int("".join(map(str, res)), 2)
print(res_num)


Fixed submission:
import sys
import bisect
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

A, B = tuple(li())

def F(num):
    if num == 0:
        return 0
    # there are a pair: (0,1), (2,3)... where xor in every pair is 1
    a = (num + 1) // 2
    ret = 0 if a % 2 == 0 else 1
    ret = ret ^ num if num % 2 == 0 else ret
    return ret
res = F(A - 1) ^ F(B)
print(res)

Buggy python submission (verdict: Runtime Error):
import sys
import bisect
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

A, B = tuple(li())


nums = list(range(A, B + 1))
res = 0
bit = 1
while B:
    cur = 0
    for num in nums:
        temp = num & bit
        cur ^= temp
    res += cur
    bit = bit << 1

    B = B >> 1
print(res)


Fixed submission:
import sys
import bisect
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

A, B = tuple(li())

def F(num):
    if num == 0:
        return 0
    # there are a pair: (0,1), (2,3)... where xor in every pair is 1
    a = (num + 1) // 2
    ret = 0 if a % 2 == 0 else 1
    ret = ret ^ num if num % 2 == 0 else ret
    return ret
res = F(A - 1) ^ F(B)
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())

def gcd(A, B):
    if B > A:
        return gcd(B, A)
    while B != 0:
        A, B = B, A - B
    return A

def test_gcd():
    assert gcd(8, 4) == 4


A, B, K = tuple(li())
count = 0
g = gcd(A, B)
can = set()
cnt = 0
for i in range(1, int(sqrt(g)) + 1):
    if g % i == 0:
        cnt += 1
        can.add(i)
        can.add(g // i)
        if cnt >= K:
            break

can = sorted(can, reverse=True)
print(can[K - 1])


Fixed submission:
import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())




A, B, K = tuple(li())
count = 0
g = min(A, B)
can = []
cnt = 0
for i in range(1, g + 1):
    if A % i == 0 and B % i == 0:
        
        
        can.append(i)



print(can[-K])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())

def gcd(A, B):
    if B > A:
        return gcd(B, A)
    while B != 0:
        A, B = B, A - B
    return A

def test_gcd():
    assert gcd(8, 4) == 4


A, B, K = tuple(li())
count = 0
g = gcd(A, B)
can = set()
for i in range(1, int(sqrt(g)) + 1):
    if g % i == 0:
        can.add(i)
        can.add(g // i)
can = sorted(can, reverse=True)
print(can[K - 1])




Fixed submission:
import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())




A, B, K = tuple(li())
count = 0
g = min(A, B)
can = []
cnt = 0
for i in range(1, g + 1):
    if A % i == 0 and B % i == 0:
        
        
        can.append(i)



print(can[-K])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
stdin = sys.stdin

def li(): return map(int, stdin.readline().split())

def gcd(A, B):
    if B > A:
        return gcd(B, A)
    while B != 0:
        A, B = B, A - B
    return A

def test_gcd():
    assert gcd(8, 4) == 4


A, B, K = tuple(li())
count = 0
g = gcd(A, B)
for num in range(g, 0, -1):
    if A % num == 0 and B % num == 0:
        count += 1
        if count == K:
            print(num)
            break



Fixed submission:
import sys
stdin = sys.stdin
from math import sqrt

def li(): return map(int, stdin.readline().split())




A, B, K = tuple(li())
count = 0
g = min(A, B)
can = []
cnt = 0
for i in range(1, g + 1):
    if A % i == 0 and B % i == 0:
        
        
        can.append(i)



print(can[-K])
Buggy python submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
a, b = tuple(li())
div, mod = divmod(b, a)
if mod == 0:
    return a + b
else:
    return b - a


Fixed submission:
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
a, b = tuple(li())
div, mod = divmod(b, a)
if mod == 0:
    print(a + b)
else:
    print(b - a)

Buggy python submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
a, b = tuple(li())
div, mod = divmod(b, a)
if mod == 0:
	return a + b
else:
	return b - a


Fixed submission:
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
a, b = tuple(li())
div, mod = divmod(b, a)
if mod == 0:
    print(a + b)
else:
    print(b - a)

Buggy python submission (verdict: Runtime Error):
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
a, b = tuple(li())
div, mod = divmod(b, a)
if mod == 0:
	return a + b
else:
    return b - a

Fixed submission:
import sys
stdin = sys.stdin
def li(): return map(int, stdin.readline().split())
a, b = tuple(li())
div, mod = divmod(b, a)
if mod == 0:
    print(a + b)
else:
    print(b - a)
Buggy python submission (verdict: Runtime Error):
from math import pow






def compute_score(target_collection):
    keys = {neta_point[0] for neta_point in target_collection}
    points = [neta_point[1] for neta_point in target_collection]
    cardinality = len(keys)
    score = pow(cardinality, 2) + sum(points)
    return score

# exchange one record and compare
def optimize(full_collection, target_collection, target_collection_len, idx):
    while True:
        ex_record = full_collection[idx]
        # check on the idx-th record
        idx += 1
        # bump up for return value
        if ex_record in target_collection:
            continue # cardinality score will not increase
        else:
            for i in range(target_collection_len-1):
                if target_collection[i][0] == target_collection[i-1][0]:
                    target_collection[i] = ex_record
                    new_score = compute_score(target_collection)
                    return new_score, target_collection, idx
        # default
        return 0, target_collection, idx



def cal_score(N, K, records):
    sorted_recs = sorted(records, reverse=True, key=lambda x: x[1])
    target_collection = sorted_recs[0:K]
    score =  compute_score(target_collection)

    # optimzie at most K times
    idx = K
    for i in range(K):
        new_score, new_target_collection, idx = optimize(sorted_recs, target_collection, K, idx)
        if new_score <= score: # no optimization occured
            break
        else:
            score = new_score
    return score
  
N, K = map(int, input().split())
records = [tuple(map(int, input().split())) for i in range(N)] 
score =cal_score(N, K, records)
print(score)


Fixed submission:
a, b, c = map(int, input().split())
print(a*b//2)

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
C = input()
print(A*B/2)

Fixed submission:
a, b, c = map(int, input().split())
print(a*b//2)
Buggy python submission (verdict: Time Limit Exceeded):

s = int(input())
temp = []
temp.append(s)
former = s
idx = 1

while True:
    idx += 1
    if former % 2 == 0:
        later = former / 2
    else:
        later = former * 3 + 1

    if later in temp:
        print(idx)
        break


Fixed submission:

s = int(input())
temp = []
temp.append(s)
former = s
idx = 1

while True:
    idx += 1
    later = former / 2 if former % 2 == 0 else former * 3 + 1

    if later in temp:
        print(idx)
        break
    temp.append(later)
    former = later
Buggy python submission (verdict: Runtime Error):
num = int(input())
targets = map(int, input().split())
targets = list(targets)


water_cnt = 0
def exe_water(init_state):
    # break condition
    if sum(init_state) == 0:
        return
    temp_water_cnt = min(init_state)
    water_cnt += temp_water_cnt

    lowest = temp_water_cnt
    # init sub_state
    sub_state = []
    for h in init_state:
        substracted_h = h - lowest
        if substracted_h != 0:
            sub_state.append(substracted_h)
        else:
            exe_water(sub_state)
            # reinit for next sequence
            sub_state = []

exe_water(targets)
print(water_cnt)


Fixed submission:
num = int(input())
targets = map(int, input().split())
targets = list(targets)


global water_cnt
water_cnt = 0
def exe_water(init_state):
    global water_cnt
    # break condition
    if sum(init_state) == 0:
        return
    temp_water_cnt = min(init_state)
    water_cnt += temp_water_cnt

    lowest = temp_water_cnt
    # init sub_state
    sub_state = []
    for h in init_state:
        substracted_h = h - lowest
        if substracted_h != 0:
            sub_state.append(substracted_h)
        else:
            exe_water(sub_state)
            # reinit for next sequence
            sub_state = []
    # end case where no trailing 0
    exe_water(sub_state)

exe_water(targets)
print(water_cnt)
Buggy python submission (verdict: Runtime Error):
from operator import mul
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())
Cs = []
for i in range(N):
    n = tuple(li())
    Cs.append([-sum(map(abs, n)), n])
# state:  x, y, z, point
state = [0, 0, 0, 0]
maximum = 0
trans = []
for per in range(8):
    ops = [(per&4)>>2, (per&2)>>1, per&1]
    trans.clear()
    for i in range(N):
        trans.append(list(map(mul, Cs[i], ops)))
    tans.sort(key=lambda x: -sum(x))
    maximum = max(maximum, sum(trans[:M]))
        

print(maximum) 


Fixed submission:
from operator import mul
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())

N, M = tuple(li())
Cs = []
for i in range(N):
    n = tuple(li())
    Cs.append(n)
# state:  x, y, z, point
state = [0, 0, 0, 0]
maximum = 0
trans = []
for per in range(8):
    ops = [1 if (per&4)>>2 else -1, 1 if (per&2)>>1 else -1, 1 if per&1 else -1]
    trans.clear()
    for i in range(N):
        trans.append(list(map(mul, Cs[i], ops)))
    trans.sort(key=lambda x: -sum(x))
    maximum = max(maximum, sum(sum(t) for t in trans[:M]))
        

print(maximum)
Buggy python submission (verdict: Runtime Error):
n = int(input())

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

sigma = sum(a)
count = 0
for i in range(len(a)-1):
  start = a[i]
  sigma = sigma-a[i]
  count = count + start * 
  if count >= 10**9+7:
    count = count % (10**9+7)

print(count)

Fixed submission:
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - a[i]
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)

Buggy python submission (verdict: Runtime Error):
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - [i]
  if after >= (10**9 + 7):
    after = after % (10**9+7)
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)


Fixed submission:
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - a[i]
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)

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

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

sigma = 0
for i in range(len(a)-1):
  start = a[i]
  after = sum(a[i+1:])
  if after >= (10**9 + 7):
    after = after % (10**9+7)
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)


Fixed submission:
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - a[i]
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)

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

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

sigma = 0
for i in range(len(a)-1):
  start = a[i]
  after = sum(a[i+1:])
  if after >= (10**9 + 7):
    after = after % (10**9+7)
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)


Fixed submission:
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - a[i]
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)

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

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

sigma = 0
for i in range(len(a)-1):
  start = a[i]
  after = sum(a[i+1:])
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)


Fixed submission:
n = int(input())

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

sigma = 0
after = sum(a[0:])
for i in range(len(a)-1):
  start = a[i]
  after = after - a[i]
  sigma = sigma + start * after
  if sigma >= (10**9 + 7):
    sigma = sigma % (10**9+7)

print(sigma)
Buggy python submission (verdict: Runtime Error):
    n, k = 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')

Fixed submission:
n, k = 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")

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

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

t = 0
s = 1
u = 0
k_k = k
temp = []
while k != n+1:
  for i in range(t, k):
    alpha = a[i]
    s = s * alpha
  temp.append(s)
  k = k + 1
  s = 1
  t = t+1
  if u != 0:
    t_s = temp[u-1]
    t_t = temp[u]
    if t_s < t_t:
      print("Yes")
      u = u + 1
    else:
      print("No")
      u = u + 1
  else:    
    u = u + 1    





Fixed submission:
n, k = 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")

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

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

t = 0
s = 1
u = 0
k_k = k
temp = []
while k != n+1:
  for i in range(t, k):
    alpha = a[i]
    s = s * alpha
  temp.append(s)
  k = k + 1
  s = 1
  t = t+1
  if u != 0:
    t_s = temp[u-1]
    t_t = temp[u]
    if t_s < t_t:
      print("Yes")
      u = u + 1
    else:
      print("No")
      u = u + 1
  else:    
    u = u + 1    





Fixed submission:
n, k = 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")