Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[i + 1] % n) for i in range(n)]
    print(max(ans))
    
p_c()

Fixed submission:
from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()

Buggy python submission (verdict: Runtime Error):

from fractions import gcd


def p_c():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(1, n):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[i + 1] % n) for i in range(n)]
    print(max(ans))

p_c()

Fixed submission:
from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def p_c():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    *a, = map(int, input().split())
    ans = 0
    for i in range(n):
        tmp = a[i]
        a[i] = 0
        g = a[0]
        for j in range(1, n):
            g = gcd(g, a[j])
        a[i] = tmp
        if ans < g:
            ans = g
    print(ans)
    
if __name__ == '__main__':
    p_c()

Fixed submission:
from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    ans = []
    for i in range(n):
        tmp = a[i]
        a[i] = 0
        g = a[0]
        for j in range(1, n):
            g = gcd(g, a[j])
        ans.append(g)
        a[i] = tmp
    print(max(ans))
    
p_c()

Fixed submission:
from fractions import gcd


def p_c():
    n = int(input())
    *a, = map(int, input().split())
    L = [0] * n
    R = [0] * n
    for i in range(n - 1):
        L[i] = gcd(L[i - 1], a[i])
        R[n - 1 - i] = gcd(R[(n - i) % n], a[n - 1 - i])
    ans = [gcd(L[i - 1], R[(i + 1) % n]) for i in range(n)]
    print(max(ans))

p_c()
Buggy python submission (verdict: Runtime Error):
def p_d():
    from bisect import bisect_right
    A, B, Q = map(int, input().split())
    INF = 10 ** 9
    s = [-INF] + [int(input()) for _ in range(A)] + [INF]
    t = [-INF] + [int(input()) for _ in range(B)] + [INF]
    ans = []
    for _ in range(Q):
        x = int(input())
        b, d = bisect_right(s, x), bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min((d1, d2, res))
        ans.append(str(res))
    print("\n".join(ans))


if __name__ == '__main__':
    p_d()


Fixed submission:
def p_d():
    from bisect import bisect_right
    A, B, Q = map(int, input().split())
    INF = 10 ** 18
    s = [-INF] + [int(input()) for _ in range(A)] + [INF]
    t = [-INF] + [int(input()) for _ in range(B)] + [INF]
    ans = []
    for _ in range(Q):
        x = int(input())
        b, d = bisect_right(s, x), bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min((d1, d2, res))
        ans.append(str(res))
    print("\n".join(ans))


if __name__ == '__main__':
    p_d()

Buggy python submission (verdict: Runtime Error):
def p_d():
    from bisect import bisect_right
    A, B, Q = map(int, input().split())
    INF = 10 ** 9
    s = [-INF] + [int(input()) for _ in range(A)] + [INF]
    t = [-INF] + [int(input()) for _ in range(B)] + [INF]
    for _ in range(Q):
        x = int(input())
        b, d = bisect_right(s, x), bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min((d1, d2, res))
    print(res)


if __name__ == '__main__':
    p_d()

Fixed submission:
def p_d():
    from bisect import bisect_right
    A, B, Q = map(int, input().split())
    INF = 10 ** 18
    s = [-INF] + [int(input()) for _ in range(A)] + [INF]
    t = [-INF] + [int(input()) for _ in range(B)] + [INF]
    ans = []
    for _ in range(Q):
        x = int(input())
        b, d = bisect_right(s, x), bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min((d1, d2, res))
        ans.append(str(res))
    print("\n".join(ans))


if __name__ == '__main__':
    p_d()
Buggy python submission (verdict: Time Limit Exceeded):
def p_d():
    from collections import defaultdict
    from heapq import heappush, heappop
    N, K = map(int, input().split())
    li = []
    for _ in range(N):
        t, d = map(int, input().split())
        li.append((t, d))
    li.sort(key=lambda x: x[1], reverse=True)
    sushi = defaultdict(list)
    ans = 0
    for i in range(K):
        heappush(sushi[li[i][0]], li[i][1])
        ans += li[i][1]
    ans += len(sushi.keys()) ** 2

    ans_list = [ans]
    while True:
        k, v = -1, 10 ** 9 + 1
        for key in sushi.keys():
            if len(sushi[key]) > 1:
                tmp = heappop(sushi[key])
                if v > tmp:
                    if k != -1:
                        heappush(sushi[k], v)
                    k, v = key, tmp
                else:
                    heappush(sushi[key], tmp)
        if k == -1:
            break
        while K < N and li[K][0] in sushi.keys():
            K += 1
        if K == N:
            break
        ans -= v
        ans -= len(sushi.keys()) ** 2
        heappush(sushi[li[K][0]], li[K][1])
        ans += li[K][1]
        ans += len(sushi.keys()) ** 2
        ans_list.append(ans)
    print(max(ans_list))


if __name__ == '__main__':
    p_d()


Fixed submission:
def p_d():
    N, K = map(int, input().split())
    inf = 10 ** 18
    sushi = [[-inf] for _ in range(N)]
    max_kind = -1
    for _ in range(N):
        t, d = map(int, input().split())
        sushi[t - 1].append(d)
        if max_kind < t:
            max_kind = t
    for i in range(max_kind):
        sushi[i].sort(reverse=True)
    sushi.sort(key=lambda x: x[0], reverse=True)

    que = []
    res = 0
    for i in range(K):
        res += sushi[i][0]
        for j in sushi[i][1:]:
            que.append(j)
    que.sort()
    cur = res
    res += K ** 2
    for var in range(1, K)[::-1]:
        a = que.pop()
        b = sushi[var][0]
        cur += a - b
        res = max(res, cur + var ** 2)
    print(res)


if __name__ == '__main__':
    p_d()
Buggy python submission (verdict: Runtime Error):
def p_e():
    """
    ナップサック問題（制約厳しい版） 
    """
    N, W = map(int, input().split())
    dp = [0] * (W + 1)
    for i in range(1, N + 1):
        w, v = map(int, input().split())
        NEXT = [0] * (W + 1)
        for j in range(1, W + 1):
            if j - w >= 0:
                NEXT[j] = max(v + dp[j - w], dp[j])
            else:
                NEXT[j] = dp[j]
        dp = NEXT

    print(max(NEXT))


if __name__ == '__main__':
    p_e()


Fixed submission:
def p_e():
    N, W = map(int, input().split())
    max_value = 10 ** 3 * N + 1
    dp = [W + 1] * max_value
    dp[0] = 0
    for _ in range(1, N + 1):
        w, v = map(int, input().split())
        NEXT = [W + 1] * max_value
        NEXT[0] = 0
        for i in range(1, max_value):
            if i - v >= 0:
                NEXT[i] = min(dp[i - v] + w, dp[i])
            else:
                NEXT[i] = dp[i]
        dp = NEXT

    ans = 0
    for i, w in enumerate(dp):
        if w <= W:
            ans = i
    print(ans)


if __name__ == '__main__':
    p_e()

Buggy python submission (verdict: Runtime Error):
def p_d():
    N, W = map(int, input().split())
    dp = [[0] * (W + 1) for _ in range(N + 1)]

    for i in range(1, N + 1):
        w, v = map(int, input().split())
        for j in range(1, W + 1):
            if j - w >= 0:
                dp[i][j] = max(v + dp[i - 1][j - w], dp[i - 1][j])
            else:
                dp[i][j] = max(dp[i - 1][j], dp[i][j])

    print(max(dp[N]))


if __name__ == '__main__':
    p_d()


Fixed submission:
def p_e():
    N, W = map(int, input().split())
    max_value = 10 ** 3 * N + 1
    dp = [W + 1] * max_value
    dp[0] = 0
    for _ in range(1, N + 1):
        w, v = map(int, input().split())
        NEXT = [W + 1] * max_value
        NEXT[0] = 0
        for i in range(1, max_value):
            if i - v >= 0:
                NEXT[i] = min(dp[i - v] + w, dp[i])
            else:
                NEXT[i] = dp[i]
        dp = NEXT

    ans = 0
    for i, w in enumerate(dp):
        if w <= W:
            ans = i
    print(ans)


if __name__ == '__main__':
    p_e()
Buggy python submission (verdict: Time Limit Exceeded):
def p_i():
    n = int(input())
    *p, = map(float, input().split())
    dp = [[0] * (n + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        for j in range(n):
            dp[i + 1][j + 1] += dp[i][j] * p[i]
            dp[i + 1][j] += dp[i][j] * (1 - p[i])

    print(sum(dp[-1][(n + 1) // 2:]))


if __name__ == '__main__':
    p_i()


Fixed submission:
def p_i():
    n = int(input())
    *p, = map(float, input().split())
    dp = [[0] * (n + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    for i in range(n):
        for j in range(n):
            dp[i + 1][j + 1] += dp[i][j] * p[i]
            dp[i + 1][j] += dp[i][j] * (1 - p[i])

    print(sum(dp[-1][(n + 1) // 2:]))


if __name__ == '__main__':
    p_i()
Buggy python submission (verdict: Time Limit Exceeded):
def p_l():
    import sys
    sys.setrecursionlimit(10 ** 6)
    n = int(input())
    *a, = map(int, input().split())
    # dp[i][j]は区間[i,j]が残っているときの最大化
    dp = [[-1] * n for _ in range(n)]

    def dfs(l, r):
        if dp[l][r] != -1:
            return dp[l][r]
        if l == r:
            dp[l][r] = a[l]
            return a[l]
        dp[l][r] = max(a[l] - dfs(l + 1, r), a[r] - dfs(l, r - 1))
        return dp[l][r]

    dfs(0, n - 1)
    print(dp[0][n - 1])
    
p_l()

Fixed submission:
def p_l_2():
    n = int(input())
    *a, = map(int, input().split())
    # dp[i][j]は区間[i,j]が残っているときの最大化
    dp = [[-1] * n for _ in range(n)]

    for i in range(n):
        for l in range(n - i):
            r = l + i
            if l == r:
                dp[l][r] = a[l]
            else:
                dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1])
    print(dp[0][n - 1])


if __name__ == '__main__':
    p_l_2()

Buggy python submission (verdict: Time Limit Exceeded):
def p_l_2():
    n = int(input())
    *a, = map(int, input().split())
    # dp[i][j]は区間[i,j]が残っているときの最大化
    dp = [[-1] * n for _ in range(n)]

    for i in range(n):
        for l in range(n - i):
            r = l + i
            if l == r:
                dp[l][r] = a[l]
            else:
                dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1])
    print(dp[0][n - 1])


if __name__ == '__main__':
    p_l_2()


Fixed submission:
def p_l_2():
    n = int(input())
    *a, = map(int, input().split())
    # dp[i][j]は区間[i,j]が残っているときの最大化
    dp = [[-1] * n for _ in range(n)]

    for i in range(n):
        for l in range(n - i):
            r = l + i
            if l == r:
                dp[l][r] = a[l]
            else:
                dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1])
    print(dp[0][n - 1])


if __name__ == '__main__':
    p_l_2()

Buggy python submission (verdict: Time Limit Exceeded):
def p_l():
    import sys
    sys.setrecursionlimit(10 ** 6)
    n = int(input())
    *a, = map(int, input().split())
    # dp[i][j]は区間[i,j]が残っているときの最大化
    dp = [[-1] * n for _ in range(n)]

    def dfs(l, r):
        if dp[l][r] != -1:
            return dp[l][r]
        if l == r:
            dp[l][r] = a[l]
            return a[l]
        dp[l][r] = max(a[l] - dfs(l + 1, r), a[r] - dfs(l, r - 1))
        return dp[l][r]

    dfs(0, n - 1)
    print(dp[0][n - 1])


if __name__ == '__main__':
    p_l()


Fixed submission:
def p_l_2():
    n = int(input())
    *a, = map(int, input().split())
    # dp[i][j]は区間[i,j]が残っているときの最大化
    dp = [[-1] * n for _ in range(n)]

    for i in range(n):
        for l in range(n - i):
            r = l + i
            if l == r:
                dp[l][r] = a[l]
            else:
                dp[l][r] = max(a[l] - dp[l + 1][r], a[r] - dp[l][r - 1])
    print(dp[0][n - 1])


if __name__ == '__main__':
    p_l_2()
Buggy python submission (verdict: Time Limit Exceeded):
def p_m():
    n, k = map(int, input().split())
    *a, = map(int, input().split())
    mod = 10 ** 9 + 7
    # dp[i][j]はi番目の子にj個の飴を配る方法が何通りかどうか
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    dp[0][0] = 1

    count = 0
    for i in range(n):
        for j in range(min(k + 1, count + 1)):
            count += a[i]
            for m in range(a[i] + 1):
                if j + m > k:
                    break
                dp[i + 1][j + m] += dp[i][j]
                dp[i + 1][j + m] %= mod
    print(dp[n][k])


if __name__ == '__main__':
    p_m()

Fixed submission:
def p_m():
    n, k = map(int, input().split())
    *a, = map(int, input().split())
    mod = 10 ** 9 + 7
    # dp[i][j]はi番目の子にj個の飴を配る方法が何通りかどうか
    dp = [[0] * (k + 1) for _ in range(n + 1)]
    for i in range(n + 1):
        dp[i][0] = 1

    for i in range(1, n + 1):
        for j in range(1, k + 1):
            if j - 1 - a[i - 1] >= 0:
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1 - a[i - 1]]) % mod
            else:
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod
    print(dp[n][k])


if __name__ == '__main__':
    p_m()
Buggy python submission (verdict: Time Limit Exceeded):
def p_c():
    import sys
    sys.setrecursionlimit(10 ** 9)
    n = int(input())
    ans = 0

    def dfs(s):
        """
        :type s: str
        """
        if int(s) > n:
            return 0
        ret = 1 if all(s.count(c) for c in "753") else 0
        for c in "753":
            ret += dfs(s.join(c))
        return ret

    print(dfs("0"))
    
p_c()

Fixed submission:
def p_c():
    import sys
    sys.setrecursionlimit(10 ** 9)
    n = int(input())
    ans = 0

    def dfs(s):
        """
        :type s: str
        """
        if int(s) > n:
            return 0
        ret = 1 if all(s.count(c) for c in "753") else 0
        for c in "753":
            ret += dfs(s + c)
        return ret

    print(dfs("0"))
    
p_c()
Buggy python submission (verdict: Runtime Error):
def p_d():
    from collections import Counter
    N = int(input())
    li = []
    for i in range(1, N + 1):
        li.extend(prime_factorize(i))
    prime_list = Counter(li).values()

    def num(m):
        return len(list(filter(lambda x: x >= m - 1, prime_list)))

    print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)


if __name__ == '__main__':
    p_d()


Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def p_d():
    from collections import Counter
    N = int(input())
    li = []
    for i in range(1, N + 1):
        li.extend(prime_factorize(i))
    prime_list = Counter(li).values()

    def num(m):
        return len(list(filter(lambda x: x >= m - 1, prime_list)))

    print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) + num(5) * (num(5) - 1) * (num(3) - 2) // 2)


if __name__ == '__main__':
    p_d()
Buggy python submission (verdict: Time Limit Exceeded):
def warshall_floyd(cost, num_v):
    """
    ワーシャルフロイド法
    :param cost: 隣接行列
    :param num_v: 頂点数
    :return: 各頂点からの最短距離
    """
    for k in range(num_v):
        for i in range(num_v):
            for j in range(num_v):
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
    return cost


import itertools


def abc073_d():
    n, m, r = map(int, input().split())
    *r, = map(int, input().split())
    inf = float("inf")
    cost = [[inf] * n for _ in range(n)]
    for _ in range(m):
        a, b, c = map(int, input().split())
        cost[a - 1][b - 1] = c
        cost[b - 1][a - 1] = c
    for i in range(n):
        cost[i][i] = 0

    cost = warshall_floyd(cost, n)
    ans = inf
    for permutation in itertools.permutations(r):
        c = 0
        b = permutation[0]
        for i in permutation[1:]:
            c += cost[b - 1][i - 1]
            b = i
        ans = min(ans, c)
    print(ans)


if __name__ == '__main__':
    abc073_d()


Fixed submission:
def warshall_floyd(cost, num_v):
    """
    ワーシャルフロイド法
    :param cost: 隣接行列
    :param num_v: 頂点数
    :return: 各頂点からの最短距離
    """
    for k in range(num_v):
        for i in range(num_v):
            for j in range(num_v):
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j])
    return cost


import itertools


def abc073_d():
    n, m, r = map(int, input().split())
    *r, = map(int, input().split())
    inf = float("inf")
    cost = [[inf] * n for _ in range(n)]
    for _ in range(m):
        a, b, c = map(int, input().split())
        cost[a - 1][b - 1] = c
        cost[b - 1][a - 1] = c
    for i in range(n):
        cost[i][i] = 0

    cost = warshall_floyd(cost, n)
    ans = inf
    for permutation in itertools.permutations(r):
        c = 0
        b = permutation[0]
        for i in permutation[1:]:
            c += cost[b - 1][i - 1]
            b = i
        ans = min(ans, c)
    print(ans)


if __name__ == '__main__':
    abc073_d()
Buggy python submission (verdict: Runtime Error):
import numpy as np
h,w=map(int,input().split())
s=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
	s[i]=list(input())
# h,w=3,3
# s=[['.', '.', '.'], ['.', '.', '.'], ['.', '.', '.']]
v=[[1000000 for i in range(w)] for j in range(h)]
s=np.array(s)
v=np.array(v)
def search(H,W,p):
	m=0
	if H<h-1 and s[H+1][W]=='.' and v[H+1][W]>p+1:
		v[H+1][W]=p+1
		m=p+1
	if H>0 and s[H-1][W]=='.' and v[H-1][W]>p+1:
		v[H-1][W]=p+1
		m=p+1
	if W>0 and s[H][W-1]=='.' and v[H][W-1]>p+1:
		v[H][W-1]=p+1
		m=p+1
	if W<w-1 and s[H][W+1]=='.' and v[H][W+1]>p+1:
		v[H][W+1]=p+1
		m=p+1
	return m

def dijk():
	f=False
	global P
	global M
	for i in range(h):
		for j in range(w):
			if v[i][j]==P:
				m=search(i,j,P)
				M=max(m,M)
				f=True

	P+=1
	if f==False:
		return 0
	dijk()
M_=0
for i in range(h):
	for j in range(w):
		v[i][j]=0
		P=0
		M=0
		if s[i][j]!='.':
			continue
		dijk()
		M_=max(M,M_)
		v=[[1000000 for i in range(w)] for j in range(h)]
print(M_)

Fixed submission:
C=input()

i=ord(C)+1
print(chr(i))
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
def fun(x):
	price=0
	if x==3:
		price=100000
	elif x==2:
		price=200000
	elif x==1:
		price=300000
	return price
if x ==1 and y ==1:
	print(fun(x)+fun(y)+4Ω00000)
else:
	print(fun(x)+fun(y))

Fixed submission:
x,y=map(int,input().split())
def fun(x):
	price=0
	if x==3:
		price=100000
	elif x==2:
		price=200000
	elif x==1:
		price=300000
	return price
if x ==1 and y ==1:
	print(fun(x)+fun(y)+400000)
else:
	print(fun(x)+fun(y))

Buggy python submission (verdict: Runtime Error):
try: 
	x,y=map(int,input().split())
except Exception:
 	exit(100)
def fun(x):
	price=0
	if x==3:
		price=100000
	elif x==2:
		price=200000
	elif x==1:
		price=300000
	return price
if x ==1 and y ==1:
	print(fun(x)+fun(y)+4Ω00000)
else:
	print(fun(x)+fun(y))

Fixed submission:
x,y=map(int,input().split())
def fun(x):
	price=0
	if x==3:
		price=100000
	elif x==2:
		price=200000
	elif x==1:
		price=300000
	return price
if x ==1 and y ==1:
	print(fun(x)+fun(y)+400000)
else:
	print(fun(x)+fun(y))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


N,K,Q=input().split()

N=int(N)
K=int(K)
Q=int(Q)
arr=np.full(N, K)
for i in range(Q):
	A=int(input())
	arr-=1
	arr[A-1]+=1

for j in arr:
	if j>0:
		print("Yes")
	else:
		print("No")

Fixed submission:
import numpy as np


N,K,Q=input().split()

N=int(N)
K=int(K)
Q=int(Q)
arr=np.full(N, K)
arr-=Q
for i in range(Q):
	A=int(input())
	arr[A-1]+=1
for j in arr:
	if j>0:
		print("Yes")
	else:
		print("No")

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import math
import subprocess
import random
import os
import sys

N,K,Q=input().split()

N=int(N)
K=int(K)
Q=int(Q)
A = [int(input()) for i in range(Q)]
arr=np.full(N, K)
for i in A:
	arr-=1
	arr[i-1]+=1
	
for j in arr:
	if j>0:
		print("Yes")
	else:
		print("No")
		

Fixed submission:
import numpy as np


N,K,Q=input().split()

N=int(N)
K=int(K)
Q=int(Q)
arr=np.full(N, K)
arr-=Q
for i in range(Q):
	A=int(input())
	arr[A-1]+=1
for j in arr:
	if j>0:
		print("Yes")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np

N=int(input())
W=list(map(int,input().split()))
S=list()


#W1=[i for i in Wd if i<=N]
#W2=[i for i in Wd if i>N]
for i in range(N):
	S1=sum(W[:i])
	S2=sum(W[i:])
	print(f'S1={S1}')
	print(f'S2={S2}')
	
	S.append(abs(S1-S2))
	print(S)
	S1=0
	S2=0

print(min(S))

Fixed submission:
import numpy as np

N=int(input())
W=list(map(int,input().split()))
S=list()


#W1=[i for i in Wd if i<=N]
#W2=[i for i in Wd if i>N]
for i in range(N):
	S1=sum(W[:i])
	S2=sum(W[i:])
	#print(f'S1={S1}')
	#print(f'S2={S2}')
	
	S.append(abs(S1-S2))
	#print(S)
	S1=0
	S2=0

print(min(S))