Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

# input
s = input()
t = input()


def main():
    sn, tn = len(s), len(t)
    dp = [[(0, "")] * (tn + 1) for _ in range(sn + 1)]
    for i in range(1, sn + 1):
        for j in range(1, tn + 1):
            if s[i - 1] == t[j - 1]:
                dp[i][j] = (dp[i - 1][j - 1][0] + 1, s[i - 1])
            else:
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
    ans = []
    i, j = sn, tn
    while i != 0 and j != 0:
        if s[i - 1] == t[j - 1]:
            ans.append(dp[i][j][1])
            i, j = i - 1, j - 1
        else:
            if dp[i][j - 1][0] < dp[i - 1][j][0]:
                i -= 1
            else:
                j -= 1
    print("".join(ans[::-1]))


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

# input
s = input()
t = input()


def main():
    sn, tn = len(s), len(t)
    dp = [[0] * (tn + 1) for _ in range(sn + 1)]
    w = [[None] * (tn + 1) for _ in range(sn + 1)]
    for i in range(1, sn + 1):
        for j in range(1, tn + 1):
            if s[i - 1] == t[j - 1]:
                dp[i][j] = dp[i - 1][j - 1] + 1
                w[i][j] = s[i - 1]
            else:
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
    ans = []
    i, j = sn, tn
    while i != 0 and j != 0:
        if s[i - 1] == t[j - 1]:
            ans.append(w[i][j])
            i, j = i - 1, j - 1
        else:
            if dp[i][j - 1] < dp[i - 1][j]:
                i -= 1
            else:
                j -= 1
    print("".join(ans[::-1]))


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!python3

# input
s = input()
t = input()


def main():
    sn, tn = len(s), len(t)
    dp = [[(0, "")] * (tn + 1) for _ in range(sn + 1)]
    for i in range(1, sn + 1):
        for j in range(1, tn + 1):
            if s[i - 1] == t[j - 1]:
                a, b = dp[i - 1][j - 1]
                dp[i][j] = (a + 1, b + s[i - 1])
            else:
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
    ans = dp[-1][-1][1]
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

# input
s = input()
t = input()


def main():
    sn, tn = len(s), len(t)
    dp = [[0] * (tn + 1) for _ in range(sn + 1)]
    w = [[None] * (tn + 1) for _ in range(sn + 1)]
    for i in range(1, sn + 1):
        for j in range(1, tn + 1):
            if s[i - 1] == t[j - 1]:
                dp[i][j] = dp[i - 1][j - 1] + 1
                w[i][j] = s[i - 1]
            else:
                dp[i][j] = max(dp[i][j - 1], dp[i - 1][j])
    ans = []
    i, j = sn, tn
    while i != 0 and j != 0:
        if s[i - 1] == t[j - 1]:
            ans.append(w[i][j])
            i, j = i - 1, j - 1
        else:
            if dp[i][j - 1] < dp[i - 1][j]:
                i -= 1
            else:
                j -= 1
    print("".join(ans[::-1]))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#!python3

LI = lambda: list(map(int, input().split()))

# input
N, M = LI()
XY = [LI() for _ in range(M)]

w = [None] * N
links = [[] for _ in range(N)]
visit = [False] * N


def create_links():
    for x, y in XY:
        links[x - 1].append(y - 1)


def dfs(u):
    visit[u] = True
    n = 0
    for v in links[u]:
        if not visit[v]:
            w[v] = dfs(v)
        n = max(n, w[v])
    return n + 1


def main():
    create_links()
    for i in range(N):
        if not visit[i]:
            w[i] = dfs(i)
    ans = max(w) - 1
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

import sys
sys.setrecursionlimit(10 ** 6)

LI = lambda: list(map(int, input().split()))

# input
N, M = LI()
XY = [LI() for _ in range(M)]

w = [None] * N
links = [[] for _ in range(N)]
visit = [False] * N


def create_links():
    for x, y in XY:
        links[x - 1].append(y - 1)


def dfs(u):
    visit[u] = True
    n = 0
    for v in links[u]:
        if not visit[v]:
            w[v] = dfs(v)
        n = max(n, w[v])
    return n + 1


def main():
    create_links()
    for i in range(N):
        if not visit[i]:
            w[i] = dfs(i)
    ans = max(w) - 1
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())

MAX = 55555 * 5


def create_prime_list(n):
    if n < 2:
        return []
    prime_list = [2]
    x = 3
    while x <= n:
        flag = False
        for p in prime_list:
            if x < p ** 2:
                flag = True
                break
            if x % p == 0:
                break
        if flag:
            prime_list.append(x)
        x += 2
    return prime_list


def main():
    prime_list = create_prime_list(MAX)
    prime_set = set(prime_list)
    w = [[] for _ in range(6)]
    w[0].append(0)
    l = []
    i = 0
    while i < 5:
        p = prime_list[i]
        i += 1
        l.append(p)
        for j in range(3, -1, -1):
            for x in w[j]:
                w[j + 1].append(x + p)
    
    while len(l) < N:
        p = prime_list[i]
        i += 1
        flag = True
        for x in w[4]:
            if x + p in prime_set:
                flag = False
                break
        if flag:
            l.append(p)
            for j in range(3, -1, -1):
                for x in w[j]:
                    w[j + 1].append(x + p)
    
    print(*l)
    

if __name__ == "__main__":
    main()


Fixed submission:
N = int(input())

MAX = 55555


def create_prime_list(n):
    if n < 2:
        return []
    prime_list = [2]
    x = 3
    while x <= n:
        flag = False
        for p in prime_list:
            if x < p ** 2:
                flag = True
                break
            if x % p == 0:
                break
        if flag:
            prime_list.append(x)
        x += 2
    return prime_list


def main():
    prime_list = create_prime_list(MAX)
    w = [x for x in prime_list if x % 5 == 1]
    print(*w[:N])
    

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#!python3

# input
N, M = list(map(int, input().split()))
LRD = [tuple(map(int, input().split())) for _ in range(M)]


def judge(W, D, visit, i):
    visit[i] = True
    for j, d in W[i]:
        if D[j] is None:
            D[j] = D[i] + d
        else:
            if D[i] + d != D[j]:
                return True
        if visit[j]:
            continue
        if judge(W, D, visit, j):
            return True
    
    return False


def main():
    W = [[] for _ in range(N)]
    for l, r, d in LRD:
        W[l - 1].append((r - 1, d))
        W[r - 1].append((l - 1, -d))
    
    D = [None] * N
    visit = [False] * N
    for i in range(N):
        if visit[i]:
            continue
        D[i] = 0
        if judge(W, D, visit, i):
            print("No")
            return
    
    print("Yes")


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

import sys
sys.setrecursionlimit(200000)


# input
N, M = list(map(int, input().split()))
LRD = [tuple(map(int, input().split())) for _ in range(M)]


def judge(W, D, visit, i):
    visit[i] = True
    for j, d in W[i]:
        if D[j] is None:
            D[j] = D[i] + d
        else:
            if D[i] + d != D[j]:
                return True
        if visit[j]:
            continue
        if judge(W, D, visit, j):
            return True
    
    return False


def main():
    W = [[] for _ in range(N)]
    for l, r, d in LRD:
        W[l - 1].append((r - 1, d))
        W[r - 1].append((l - 1, -d))
    
    D = [None] * N
    visit = [False] * N
    for i in range(N):
        if visit[i]:
            continue
        D[i] = 0
        if judge(W, D, visit, i):
            print("No")
            return
    
    print("Yes")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

LI = lambda: list(map(int, input().split()))

# input
N = int(input())
A = [LI() for _ in range(N)]


def main():
    ans = 0
    for i in range(N):
        for j in range(N):
            flag = True
            for k in range(N):
                if i == k or j == k:
                    continue
                d = A[i][k] + A[k][j]
                if A[i][j] > d:
                    print(-1)
                    return
                if A[i][j] == d:
                    flag = False
            if flag:
                ans += A[i][j]
    ans //= 2
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

LI = lambda: list(map(int, input().split()))

# input
N = int(input())
A = [LI() for _ in range(N)]


def main():
    ans = 0
    for i in range(N):
        for j in range(N):
            flag = True
            for k in range(N):
                if i == k or j == k:
                    continue
                d = A[i][k] + A[k][j]
                if A[i][j] > d:
                    print(-1)
                    return
                if A[i][j] == d:
                    flag = False
            if flag:
                ans += A[i][j]
    ans //= 2
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#!python3

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

# input
N = int(input())
A = LI()

MOD = 10 ** 9 + 7
MAX = 10 ** 5 + 1
fac, finv, inv = [None] * MAX, [None] * MAX, [None] * MAX


def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = -inv[MOD%i] * int(MOD / i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


def main():
    comb_init()
    d = {i: [] for i in range(1, N + 1)}
    x, y = [None] * 2
    for i in range(N + 1):
        d[A[i]].append(i)
        if len(d[A[i]]) == 2:
            x, y = d[A[i]]
            break
    
    for i in range(1, N + 2):
        ans = comb(N + 1, i)
        ans -= comb(N + x - y, i - 1)
        ans %= MOD
        print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

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

# input
N = int(input())
A = LI()

MOD = 10 ** 9 + 7
MAX = 10 ** 5 + 5
fac, finv, inv = [None] * MAX, [None] * MAX, [None] * MAX


def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = -inv[MOD%i] * int(MOD / i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD


def comb(n, k):
    if n < k or n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


def main():
    comb_init()
    d = {i: [] for i in range(1, N + 1)}
    x, y = [None] * 2
    for i in range(N + 1):
        d[A[i]].append(i)
        if len(d[A[i]]) == 2:
            x, y = d[A[i]]
            break
    
    for i in range(1, N + 2):
        ans = comb(N + 1, i)
        ans -= comb(N + x - y, i - 1)
        ans %= MOD
        print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
#!python3

LI = lambda: list(map(int, input().split()))

# input
N, Ma, Mb = LI()
ABC = [LI() for _ in range(N)]

INF = 10 ** 5


def main():
    w = [[INF] * 401 for _ in range(401)]
    w[0][0] = 0
    for a, b, c in ABC:
        l = w.copy()
        for j in range(a, 401):
            for k in range(b, 401):
                l[j][k] = min(l[j][k], w[j - a][k - b] + c)
        w = l

    ans = INF
    n = 400 // max(Ma, Mb) + 1
    for i in range(1, n):
        ans = min(ans, w[Ma * i][Mb * i])
    ans = -1 if ans == INF else ans
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!python3

import copy

LI = lambda: list(map(int, input().split()))

# input
N, Ma, Mb = LI()
ABC = [LI() for _ in range(N)]

INF = 10 ** 5


def main():
    w = [[INF] * 401 for _ in range(401)]
    w[0][0] = 0
    for a, b, c in ABC:
        l = copy.deepcopy(w)
        for j in range(a, 401):
            for k in range(b, 401):
                l[j][k] = min(w[j][k], w[j - a][k - b] + c)
        w = l

    ans = INF
    n = 400 // max(Ma, Mb) + 1
    for i in range(1, n):
        ans = min(ans, w[Ma * i][Mb * i])
    ans = -1 if ans == INF else ans
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

latest_score = 0
before_score = 0

for cnt_k in range(k):
    if latest_score == 0:
        latest_score = a[cnt_k]
    else:
        latest_score *= a[cnt_k]

for cnt in range(1, n - k + 1):
    before_score = latest_score
    latest_score /= a[cnt-1]
    # latest_score = int(latest_score)
    latest_score *= a[cnt + k - 1]

    if before_score < latest_score:
        print('Yes')
    else:
        print('No')


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

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

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

latest_score = 0
before_score = 0

for cnt_k in range(k):
    if latest_score == 0:
        latest_score = a[cnt_k]
    else:
        latest_score *= a[cnt_k]

for cnt in range(1, n - k + 1):
    before_score = latest_score
    latest_score /= a[cnt-1]
    latest_score = int(latest_score)
    latest_score *= a[cnt + k - 1]

    if before_score < latest_score:
        print('Yes')
    else:
        print('No')


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

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

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

latest_score = 0
before_score = 0

for cnt_k in range(k):
    if latest_score == 0:
        latest_score = a[cnt_k]
    else:
        latest_score *= a[cnt_k]

for cnt in range(1, n - k + 1):
    before_score = latest_score
    latest_score = 0
    for cnt_score in range(cnt, cnt + k):
        if latest_score == 0:
            latest_score = a[cnt_score]
        else:
            latest_score *= a[cnt_score]

    if before_score < latest_score:
        print('Yes')
    else:
        print('No')


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

for cnt in range(1, n - k + 1):
    if a[cnt-1] < a[cnt + k - 1]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
INF = 1000000000000000000
ans = 1
flag = 0

for cnt in range(n):
    ans *= a[cnt]

if ans > INF:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
INF = 1000000000000000000
ans = 1
flag = 0

for cnt in range(n):
    if a[cnt] == 0:
        print(0)
        flag = 1
        break

if flag == 0:
    for cnt in range(n):
        ans *= a[cnt]
        if ans > INF:
            print(-1)
            flag = 1
            break

if flag == 0:
    print(ans)
Buggy python submission (verdict: Runtime Error):
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 = map(int, input().split())
uf = UnionFind(N)

#H = list(map(int, input().split()))

#AB = [tuple(map(int, input().split())) for i in range(M)]

#丸暗記。隣接リストの初期化
graph = [[] for _ in range(N)]

for _ in range(M):
  a, b = map(int, input().split())
  uf.union(a, b)

print(uf.group_count()-1)



Fixed submission:
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 = map(int, input().split())
uf = UnionFind(N)

#H = list(map(int, input().split()))

#AB = [tuple(map(int, input().split())) for i in range(M)]

#丸暗記。隣接リストの初期化
graph = [[] for _ in range(N)]

for _ in range(M):
  a, b = map(int, input().split())
  uf.union(a-1, b-1)

print(uf.group_count()-1)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

#AB = [tuple(map(int, input().split())) for i in range(M)]
#丸暗記。隣接リストの初期化
graph = [[i+1] for i in range(M)]

for _ in range(M):
  a, b = map(int, input().split())
  graph[a-1].append(b)
  graph[b-1].append(a)

ans = -1
for g in graph:
  ans = max(ans, len(set(g)))
print(ans)


Fixed submission:
N, M = map(int, input().split())
AB = [tuple(map(int,input().split())) for i in range(M)]

class UnionFind:
    def __init__(self,N):
        self.parent = [i for i in range(N)]
        self._size = [1] * N
        self.count = 0

    def root(self,a):
        if self.parent[a] == a:
            return a
        else:
            self.parent[a] = self.root(self.parent[a])
            return self.parent[a]
    def is_same(self,a,b):
        return self.root(a) == self.root(b)

    def unite(self,a,b):
        ra = self.root(a)
        rb = self.root(b)
        if ra == rb: return
        if self._size[ra] < self._size[rb]: ra,rb = rb,ra
        self._size[ra] += self._size[rb]
        self.parent[rb] = ra
        self.count += 1

    def size(self,a):
        return self._size[self.root(a)]

uf = UnionFind(N)
for a,b in AB:
    a,b = a-1,b-1
    if uf.is_same(a,b): continue
    uf.unite(a,b)

ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()

ans = 0
N = int(N)
while N > 0:
  ans += N % 10
  N //= 10

if ans % 9 == 0:
  print("Yes")
else:
  print("No")



Fixed submission:
N = input()

ans = 0
for i in range(len(N)):
  ans += int(N[i])

if ans % 9 == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
X, K, D = map(int, input().split())

ans = 1000000000000007
prev = 1000000000000007
if K % 2 == 0:
  i = K // 2
  for k in range(0, i+1):
    mn = abs(X + k * D * 2)
    if prev < mn:
      break
    prev = mn
    ans = abs(min(mn, ans))

  prev = 1000000000000007
  for k in range(0, i+1):
    mn = abs(X - k * D * 2)
    if prev < mn:
      break
    prev = mn
    ans = abs(min(mn, ans))

else:
  for k in range(1, K+1, 2):
    mn = abs(X + k * D)
    if prev < mn:
      break
    prev = mn
    ans = abs(min(mn, ans))

  prev = 1000000000000007
  for k in range(1, K+1, 2):
    mn = abs(X - k * D)
    if prev < mn:
      break
    prev = mn
    ans = abs(min(mn, ans))

print(ans)


Fixed submission:
X,K,D = map(int,input().split())
 
if X<0:
    X *= -1
n = X//D
m = min(K,n)
 
X -= m*D
K -= m
if K%2:
    print(abs(X-D))
else:
    print(X)
Buggy python submission (verdict: Time Limit Exceeded):
r, g, b = map(int, input().split())

K = int(input())

while K > 0:
  if g < r:
    g *= 2
    K -= 1
    continue

  if b < g:
    b *= 2
    K -= 1
    continue

  if g > r and b > g:
    break




if g > r and b > g:
  print("Yes")
else:
  print("No")



Fixed submission:
r, g, b = map(int, input().split())

K = int(input())

while K > 0:
  if g <= r:
    g *= 2
    K -= 1
  elif b <= g:
    b *= 2
    K -= 1
  else:
    break
    




if g > r and b > g:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

count = 0
prev = 1
ans = 1
for i in range(0, K):
  prev *= A[i]

for i in range(K, N):
  ans = prev
  ans //= A[count]
  ans *= A[i]
  if ans > prev:
    print("Yes")
  else:
    print("No")
  prev = ans
  count += 1



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

for i in range(N-K):
    print('Yes' if A[i] < A[i+K] else 'No')

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

S = [1]
for i in range(0, N):
 S.append(S[i] * A[i])

count = 0
prev = -1
for i in range(K, N+1):
  current = S[i]//S[count]
  if prev != -1:
    if current > prev:
      print("Yes")
    else:
      print("No")
  prev = current
  count += 1 



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

for i in range(N-K):
    print('Yes' if A[i] < A[i+K] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))
N = len(A)

S = [1]
for i in range(0, N):
 S.append(S[i] * A[i])

count = 0
prev = -1
for i in range(K, len(S)):
  current = S[i]//S[count]
  if prev != -1:
    if current > prev:
      print("Yes")
    else:
      print("No")
  prev = current
  count += 1 



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

for i in range(N-K):
    print('Yes' if A[i] < A[i+K] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))
N = len(A)

S = [1]
for i in range(0, N):
 S.append(S[i] * A[i])

count = 0
prev = -1
for i in range(K, len(S)):
  current = S[i]//S[count]
  if prev != -1:
    if current > prev:
      print("Yes")
    else:
      print("No")
  prev = S[i]//S[count]
  count += 1 



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

for i in range(N-K):
    print('Yes' if A[i] < A[i+K] else 'No')