Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
s = []
g = []
for _ in range(m):
  a,b = map(int, input().split())
  if a == 1: s.append(b)
  elif b == n: g.append(a)
s.sort()
g.sort()
if min(len(s), len(g)) == len(g): x,y = g,s
else: x,y = s,g
  
ok = False
for v in x:
  if v in y: 
    ok = True
    break
print("POSSIBLE" if ok else "IMPOSSIBLE")

Fixed submission:
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
AB = sorted(ab, reverse=True, key=lambda x:x[1])
s = [0] * n
ans = "IMPOSSIBLE"
for a,b in ab:
    if a == 1: s[b-1] = 1
    else: break
for A, B in AB:
    if B == n:
        if s[A-1] == 1:
            ans = "POSSIBLE"
    else: break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
s = []
g = []
for _ in range(m):
  a,b = map(int, input().split())
  if a == 1: s.append(b)
  elif b == n: g.append(a)

ok = False
for v in s:
  if v in g: 
    ok = True
    break
print("POSSIBLE" if ok else "IMPOSSIBLE")

Fixed submission:
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
AB = sorted(ab, reverse=True, key=lambda x:x[1])
s = [0] * n
ans = "IMPOSSIBLE"
for a,b in ab:
    if a == 1: s[b-1] = 1
    else: break
for A, B in AB:
    if B == n:
        if s[A-1] == 1:
            ans = "POSSIBLE"
    else: break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
AB = sorted(ab, reverse=True, key=lambda x:x[1])
s = []
ans = "IMPOSSIBLE"
for a,b in ab:
    if a == 1: s.append(b)
    else: break
for A, B in AB:
    if B == n:
        if A in s:
            ans = "POSSIBLE"
    else: break
print(ans)

Fixed submission:
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
AB = sorted(ab, reverse=True, key=lambda x:x[1])
s = [0] * n
ans = "IMPOSSIBLE"
for a,b in ab:
    if a == 1: s[b-1] = 1
    else: break
for A, B in AB:
    if B == n:
        if s[A-1] == 1:
            ans = "POSSIBLE"
    else: break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
s = []
g = []
for a, b in ab:
    if a == 1: s.append(b)
    elif b == n: g.append(a)
ans = "IMPOSSIBLE"
if len(s) > 0 and len(g) > 0:
    if len(s) < len(g):
        for i in range(len(s)):
            if s[i] in g: ans = "POSSIBLE"
    else:
        for i in range(len(g)):
            if g[i] in s: ans = "POSSIBLE"
print(ans)

Fixed submission:
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab.sort()
AB = sorted(ab, reverse=True, key=lambda x:x[1])
s = [0] * n
ans = "IMPOSSIBLE"
for a,b in ab:
    if a == 1: s[b-1] = 1
    else: break
for A, B in AB:
    if B == n:
        if s[A-1] == 1:
            ans = "POSSIBLE"
    else: break
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]

n = 0
ans = 1
for _ in range(N):
  ans += 1
  if a[a[n] - 1] == n + 1:
    ans = -1
    break
  elif a[a[n] - 1] == 2:
    break
  n = a[a[n] - 1]

print(ans)

Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]

n = 0
count = 0
for i in range(N - 1):
  count += 1
  n = a[n] - 1
  if n == 1:
    break 

print(count if n == 1 else -1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
s = input()
if len(set(s)) ==1:
    print(0)
    exit()
if len(set(s)) != len(s):
    cs = Counter(s)
    I = 0
    n = cs.most_common()[0][1]
    ans = 100
    while cs.most_common()[I][1] == n:
        id = [x for x, v in enumerate(s) if v == cs.most_common()[I][0]]
        x = 0
        for i in range(len(id)-1):
            if i == 0 and id[i] > 0 and x < id[i]:
                x = id[i]
            if id[i+1] - id[i] > x:
                x = id[i+1] - id[i] -1
        if ans > x: ans = x
        I += 1
else: ans = len(s) - len(s)//2
print(ans)

Fixed submission:
s = input()
n = len(s)
ans = 1000
for t in set(s):
    ans = min(ans, max([len(l) for l in s.split(t)]))
print(ans)

Buggy python submission (verdict: Runtime Error):
from collections import Counter
s = input()
if len(set(s)) ==1:
    print(0)
    exit()
if len(set(s)) != len(s):
    cs = Counter(s)
    I = 0
    n = cs.most_common()[0][1]
    ans = 100
    while cs.most_common()[I][1] == n:
        id = [x for x, v in enumerate(s) if v == cs.most_common()[I][0]]
        x = 0
        for i in range(len(id)-1):
            if id[i+1] - id[i] > x:
                x = id[i+1] - id[i] -1
        if ans > x: ans = x
        I += 1
else: ans = len(s) - len(s)//2
print(ans)

Fixed submission:
s = input()
n = len(s)
ans = 1000
for t in set(s):
    ans = min(ans, max([len(l) for l in s.split(t)]))
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools
n, a, b = map(int, input().split())
if n < b-a:
    print(0)
    exit()
N = list(range(a, b+1))
su = []
if n > 2:
    for v in itertools.combinations_with_replacement(N, n-2):
        if not sum(v) in su: su.append(sum(v))
    ans = len(su)
else:
    A = b-a+1
    if n == 1: ans = A
    else: ans = A * (A-1) * (A-2) // 6
print(ans)

Fixed submission:
n, a, b = map(int, input().split())
if a > b or (n == 1 and a != b):
    print(0)
else:
    print((b-a) * (n-2) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ans = []
for a,b in ab:
    ans += [a] * b
ans.sort()
print(ans[k-1])

Fixed submission:
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
ab.sort()

n = 0
for i in range(N):
  if n + ab[i][1] < K:
    n += ab[i][1]
  else:
    print(ab[i][0])
    break

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
ans = []

for i in range(N):
  ans += [ab[i][0]] * ab[i][1]

ans.sort()
print(ans[K-1])

Fixed submission:
N, K = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
ab.sort()

n = 0
for i in range(N):
  if n + ab[i][1] < K:
    n += ab[i][1]
  else:
    print(ab[i][0])
    break
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = list(input() for _ in range(n))

def intersect_list(l1, l2):
  arr = []
  lst = l1.copy()
  for element in l2:
    try:
      lst.remove(element)
    except ValueError:
      pass
    else:
      arr.append(element)
  return arr

l = intersect_list(list(S[0]), list(S[1]))
for i in range(2, n):
  l = intersect_list(l, list(S[i]))

l.sort()
print("".join(l))

Fixed submission:
from collections import Counter

N = int(input())
counter = [Counter(input()) for _ in range(N)]

c = counter[0]
for i in range(1, N):
  for k, v in c.items():
    c[k] = min(counter[i][k], c[k])

c = sorted(c.items())
ans = ""
for k, v in c:
  ans += k * v
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
n,m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
cd = [list(map(int, input().split())) for _ in range(m)]
AB = sorted(ab)
for x,y in cd:
    a = bisect.bisect_left(AB, [x,y])
    print(ab.index(AB[a])+1)

Fixed submission:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for i in range(N):
  d = []
  for j in range(M):
    d.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
  print(d.index(min(d)) + 1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for i in range(N):
    d = []
    for j in range(M):
        d.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - ab[j][1]))
    print(d.index(min(d)) + 1)

Fixed submission:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for i in range(N):
  d = []
  for j in range(M):
    d.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
  print(d.index(min(d)) + 1)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
c = []
d = []
for _ in range(M):
    C, D = map(int, input().split())
    c.append(C)
    d.append(D)


I = []
for a, b in ab:
    n = 10 ** 8
    I_n = ""
    for i in range(M):
        if abs(a-c[i]) + abs(b-d[i]) < n:
            if not i in I:
                n = abs(a-c[i]) + abs(b-d[i])
                I_n = i
    print(I_n + 1)
    I.append(I_n)

Fixed submission:
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]

for i in range(N):
  d = []
  for j in range(M):
    d.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
  print(d.index(min(d)) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = int(n**0.5)

while n%x!=0:
    x += 1
y = n//x
print(len(str(max(x,y))))

Fixed submission:
n = int(input())
a = round(n**0.5)
while n % a != 0:
  a -= 1
b = n//a
print(len(str(max(a,b))))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = round(n**0.5)

while n%x!=0:
    x += 1
y = n//x
print(len(str(max(x,y))))

Fixed submission:
n = int(input())
a = round(n**0.5)
while n % a != 0:
  a -= 1
b = n//a
print(len(str(max(a,b))))

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

def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n%i == 0:
            return False
    return True

if is_prime(n):
    ans = len(str(n))
else:
    x = int(n**0.5)
    while n%x!=0:
        x += 1
    y = n//x
    ans = max(len(str(x)), len(str(y)))
print(ans)

Fixed submission:
n = int(input())
a = round(n**0.5)
while n % a != 0:
  a -= 1
b = n//a
print(len(str(max(a,b))))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1
for i in range(1, N + 1):
  power *= i
print(power % (10 **9 + 7))

Fixed submission:
N = int(input())

power = 1
MOD = 10 ** 9 + 7
for i in range(1, N + 1):
  power *= i
  power %= MOD
print(power)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

ans = 0
while n >= 1 and m >= 2:
  ans += 1
  n -= 1
  m -= 2
if m >= 4:
  ans += m//4
print(ans)

Fixed submission:
n,m = map(int, input().split())
ans = 0
if m >= 2 * n: 
    ans += n
    m -= 2 * n
    ans += m // 4
else: ans += m // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
cnt = 0
for i in range(n):
  if m < 2: break
  cnt += 1
  n -= 1
  m -= 2
print(cnt+m//4)

Fixed submission:
n,m = map(int, input().split())
ans = 0
if m >= 2 * n: 
    ans += n
    m -= 2 * n
    ans += m // 4
else: ans += m // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

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

ans = 0
for i in range(k + 1):
  for j in range(k + 1):
    if i + j == s:
      ans += 1
    elif 0 <= s - (i + j) <= k:
      ans += 1

print(ans)

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ans = 0
for x in range(K+1):
  for y in range(K+1):
    for z in range(K+1):
      if x + y + z == S:
        ans += 1
print(ans)

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ans = 0
for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      if x + y + z == S:
        ans += 1

print(ans)

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
n = []
for i in range(K + 1):
  n.append(i)

ans = 0
for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      if n[x] + n[y] + n[z] == S:
        ans += 1

print(ans)

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

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

n = []
for i in range(K + 1):
  n.append(i)

import itertools
XYZ = list(itertools.product(n, repeat = 3))

count = 0
for j in range(len(XYZ)):
  if sum(XYZ[j]) == S:
    count += 1

print(count)

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
XYZ = []

for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      if x + y + z == S:
        n = [x, y, z]
        XYZ.append(n)

print(len(XYZ))

Fixed submission:
K, S = map(int, input().split())

ans = 0
for i in range(K + 1):
  for j in range(K + 1):
    if i + j == S:
      ans += 1
    elif 0 <= S - (i + j) <= K:
      ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
s = s.replace("dream", "D")
s = s.replace("erase", "E")
ok = True
i = 0
while i <= len(s)-1:
    if s[i] in ["D","E"]: 
        i += 1
        continue
    if i == 0:
        ok = False
        break
    if s[i] == "e":
        if i+1>len(s) or  s[i+1]!="r" or s[i-1] != "D":
            ok = False
            break
        i += 2
    elif s[i] == "r":
        if s[i-1] != "E":
            ok = False
            break
        i += 1
print("YES" if ok else "NO")

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

ans = ""
i = 0
for _ in range(n):
    if i > n or ans == s: break
    if s[i:i+5] == "erase":
        i += 5
        ans += "erase"
        if s[i:i+1] == "r":
            i += 1
            ans += "r"
    elif s[i:i+5] == "dream":
        i += 5
        ans += "dream"
        if s[i:i+3] == "era": continue
        elif s[i:i+2] == "er":
            i += 2
            ans += "er"
print("YES" if ans == s else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
x = input()
while "ST" in x:
    x = x.replace("ST", "")
print(len(x))

Fixed submission:
X = input()
box = []

for i in range(len(X)):
  if X[i] == "S": box.append(X[i])
  elif X[i] == "T":
    if len(box) == 0 or box[-1] != "S":
      box.append(X[i])
    else: box.pop(-1)
print(len(box))
Buggy python submission (verdict: Runtime Error):
#"a" 97 "z" 122
s = list(ord(i) for i in input())
k = int(input())
for i in range(len(s)):
  if 123 - s[i] <= k:
    k -= 123-s[i]
    s[i] = 97

if k > 0:
  s[-1] += k
  if s[-1] >= 123: s[-1] = s[-1]-26
print("".join(list(map(chr, s))))

Fixed submission:
#"a" 97 "z" 122
s = list(ord(i) for i in input())
k = int(input())

for i in range(len(s)-1):
  if s[i] == ord("a"): continue
  t = ord("z")+1-s[i]
  if k >= t:
    s[i] = 97
    k -= t
if k > 0:
  k %= 26
  s[-1] += k
  if s[-1] > ord("z"):
    s[-1] -= 26
print("".join(list(map(chr, s))))
Buggy python submission (verdict: Runtime Error):
s = input()
ans = []

for i in range(len(s)):
  if s[i] != "B":
    ans.append(s[i])
  else:
    if len(s) == 0:
      continue
    elif len(s) > 0:
      ans.pop(-1)
      
print("".join(ans))

Fixed submission:
s = input()
ans = []
for i in range(len(s)):
  if s[i] == "0":
    ans.append("0")
  elif s[i] == "1":
    ans.append("1")
  elif s[i] == "B":
    if len(ans) > 0:
      ans.pop(-1)

print("".join(ans))

Buggy python submission (verdict: Runtime Error):
s = input()
ans = []

for i in range(len(s)):
  if s[i] != "B":
    ans.append(s[i])
  else:
    if len(s) > 0:
      ans.pop(-1)
      
print("".join(ans))

Fixed submission:
s = input()
ans = []
for i in range(len(s)):
  if s[i] == "0":
    ans.append("0")
  elif s[i] == "1":
    ans.append("1")
  elif s[i] == "B":
    if len(ans) > 0:
      ans.pop(-1)

print("".join(ans))
Buggy python submission (verdict: Runtime Error):
d = int(input())
t = int(input())
s = int(input())

if d <= t * s:
	print("Yes")
else:
	print("No")

Fixed submission:
s = input()
l = s.split(' ')

if(int(l[0]) <= int(l[1]) * int(l[2])):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

BLUE = "b"
RED = "r"


balls = ""
while True:
    if len(balls) >= N:
        break
    balls += BLUE*A
    balls += RED*B

print(len([ball for ball in list(balls)[0:N] if ball == BLUE]))


Fixed submission:
N, A, B = map(int, input().split())

if A == 0:
    print(0)
    exit()

x = int(N / (A+B))
y = N % (A+B)
z = 0
if y < A:
    z = y
else:
    z = A

blue = 0
if x < 10**100:
    blue = (x * A) + z
else:
    blue = 10*100*A + z
print(blue)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

def distinct(arry):
  while True:
    if len(arry) == 1:
      return True
    x = arry.pop(0)
    if x in arry:
      return False

if distinct(A):
  print("YES")
else:
  print("NO")


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

def distinct(arry):
  x = set(arry)
  if len(A) != len(x):
    return False
  return True

if distinct(A):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

def unique(arry):
  for item in arry:
    if arry.count(item) > 1:
      return False
  return True

if unique(A):
  print("YES")
else:
  print("NO")


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

def distinct(arry):
  x = set(arry)
  if len(A) != len(x):
    return False
  return True

if distinct(A):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))


Fixed submission:
num = input().split(" ")
a = int(num[0])
b = int(num[1])

x = (a + b) // 2
y = (a + b) % 2
if y != 0 :
    print(str(x + 1))
else      :
    print(str(x))
Buggy python submission (verdict: Runtime Error):
import sys
a = []
b = []
a = input()
b = input()

for num in range(0,len(a)):
   sys.stdout.write(a[num])
   sys.stdout.write(b[num])

Fixed submission:
import sys
a = []
b = []
a = input()
b = input()

for num in range(0,len(a)):
   sys.stdout.write(a[num])
   if len(b) > num:
       sys.stdout.write(b[num])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
val = 1
for num in range(0,n):
    val *= num+1
print (val % (10**9 + 7))

Fixed submission:
import math
n = int(input())
val = math.factorial(n)
print (val % (10**9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
val = 1
for num in range(0,n):
    val *= num+1
else:
    print (val % (10**9 + 7))

Fixed submission:
import math
n = int(input())
val = math.factorial(n)
print (val % (10**9 + 7))

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
val = 1
for num in range(1,(int(n,10) + 1)):
    val = num * val
else:
    print (val % (10**9 + 7))

Fixed submission:
import math
n = int(input())
val = math.factorial(n)
print (val % (10**9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n,k=map(int,input().split())
a=list(map(int,input().split()))

d=list(map(lambda i:reduce(lambda x,y:x*y,a[i:i+k]),range(n-k+1)))
dd=list(map(lambda x,y:'Yes' if y>x else 'No',d[:-1],d[1:]))
for i in range(len(dd)):print(dd[i])

Fixed submission:
from functools import reduce
n,k=map(int,input().split())
a=list(map(int,input().split()))
d1,d2=a[:n-k],a[k:n]
dd=list(map(lambda x,y:'Yes' if y>x else 'No',d1,d2))
for i in range(len(dd)):print(dd[i])

Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n,k=map(int,input().split())
a=list(map(int,input().split()))

d=list(map(lambda i:reduce(lambda x,y:x*y,a[i:i+k]),range(n-k+1)))
dd=list(map(lambda x,y:'Yes' if y>x else 'No',d[:-1],d[1:]))
list(map(print,dd))

Fixed submission:
from functools import reduce
n,k=map(int,input().split())
a=list(map(int,input().split()))
d1,d2=a[:n-k],a[k:n]
dd=list(map(lambda x,y:'Yes' if y>x else 'No',d1,d2))
for i in range(len(dd)):print(dd[i])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = list(map(int,input().split()))
mod = 10**9 +7
ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        ans += a[i]*a[j]
print(ans%mod)

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
mod = 10**9 +7
s = 0
ss =0
for i in range(n):
    s += a[i]
    ss += a[i] * a[i]

ans = (s*s - ss)//2
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = list(map(int,input().split()))
mod = 10**9 +7
ans = 0

for i in range(n-1):
    for j in range(i+1,n):
        ans += (a[i] *a[j]) %mod
print(ans%mod)

Fixed submission:
n=int(input())
a = list(map(int,input().split()))
mod = 10**9 +7
s = 0
ss =0
for i in range(n):
    s += a[i]
    ss += a[i] * a[i]

ans = (s*s - ss)//2
print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
if k % 2 ==0:
    print(-1)
else:
    n=7
    ans = 0
    while(True):
        ans += 1
        n %= k
        if n  == 0:
            print(ans)
            exit()
        n = 10 * n + 7


Fixed submission:
k=int(input())
if k % 2 ==0:
    print(-1)
else:
    n=7
    ans = 0
    while(True):
        ans += 1
        if ans >= 10**6:
            print(-1)
            exit()
        n %= k
        if n  == 0:
            print(ans)
            exit()
        n = 10 * n + 7

Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
if k % 2 ==0:
    print(-1)
else:
    n=7
    ans = 0
    while(True):
        ans += 1
        n %= k
        if n  == 0:
            print(ans)
            exit()
        n = 10 * n + 7


Fixed submission:
k=int(input())
if k % 2 ==0:
    print(-1)
else:
    n=7
    ans = 0
    while(True):
        ans += 1
        if ans >= 10**6:
            print(-1)
            exit()
        n %= k
        if n  == 0:
            print(ans)
            exit()
        n = 10 * n + 7
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=[1] + list(map(int,input().split()))

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


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

for i in range(k+1,n+1):
    if a[i]>a[i-k]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

LIM= 10**18
ans=1
for e in a:
    ans*=e
    if ans > LIM:
        ans = -1

if ans <0:
    ans = -1

print(ans)

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

LIM= 10**18
ans=1
for e in a:
    ans*=e
    if ans > LIM or ans<-1:
        ans = -1

if ans <0:
    ans = -1

print(ans)