Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
import math
import fractions
from heapq import heappush, heappop


sys.setrecursionlimit(10 ** 7)

H, N = map(int, input().split())

MAGIC = []
for _ in range(N):
    a, b = map(int, input().split())
    MAGIC.append((a, b))

MAGIC = sorted(MAGIC, key=lambda x: x[0]//x[1])
dp = [[10**9] * (H+1) for _ in range(N+1)]

for i in range(N):
    dp[i][0] = 0


for i in range(N):
    for h in range(H+1):
        if h < MAGIC[i][0]:
            dp[i+1][h] = dp[i][h]
        elif h == H:
            m = min(dp[i+1][h-MAGIC[i][0]:])
            #print("num", h-MAGIC[i][0], dp[i][h-MAGIC[i][0]:])
            # print(m)
            dp[i+1][h] = min(dp[i][h], m+MAGIC[i][1])
        else:
            #print("ok", h)
            dp[i+1][h] = min(dp[i][h], dp[i+1][h-MAGIC[i][0]]+MAGIC[i][1])

    # print(dp[i+1])

# print(dp)
print(dp[N][H])


Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)

H, N = map(int, input().split())

MAGIC = []
for _ in range(N):
    a, b = map(int, input().split())
    MAGIC.append((a, b))

INF = 10 ** 10
dp = [INF] * 20000
dp[0] = 0

for i in range(N):
    for h in range(H):
        a, b = MAGIC[i]

        if dp[h+a] > (dp[h] + b):
            dp[h+a] = dp[h] + b

print(min(dp[H:]))

Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
import math
import fractions
from heapq import heappush, heappop


sys.setrecursionlimit(10 ** 7)

H, N = map(int, input().split())

MAGIC = []
for _ in range(N):
    a, b = map(int, input().split())
    MAGIC.append((a, b))

dp = [[10**9] * (H+1) for _ in range(N+1)]

for i in range(N):
    dp[i][0] = 0


for i in range(N):
    for h in range(H+1):
        if h < MAGIC[i][0]:
            dp[i+1][h] = dp[i][h]
        elif h == H:
            m = min(dp[i+1][h-MAGIC[i][0]:])
            #print("num", h-MAGIC[i][0], dp[i][h-MAGIC[i][0]:])
            # print(m)
            dp[i+1][h] = min(dp[i][h], m+MAGIC[i][1])
        else:
            #print("ok", h)
            dp[i+1][h] = min(dp[i][h], dp[i+1][h-MAGIC[i][0]]+MAGIC[i][1])

    # print(dp[i+1])

# print(dp)
print(dp[N][H])


Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)

H, N = map(int, input().split())

MAGIC = []
for _ in range(N):
    a, b = map(int, input().split())
    MAGIC.append((a, b))

INF = 10 ** 10
dp = [INF] * 20000
dp[0] = 0

for i in range(N):
    for h in range(H):
        a, b = MAGIC[i]

        if dp[h+a] > (dp[h] + b):
            dp[h+a] = dp[h] + b

print(min(dp[H:]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
import math
import fractions
from heapq import heappush, heappop


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

MOD = 10**9+7


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    # return (x * y) * modinv(fractions.gcd(x, y), MOD)


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

lm = 1
s = 0

for i in range(N):
    lm = lcm(A[i], lm)
    #s += lm // MOD
    #lm %= MOD

#lm %= MOD
# print(lm)
ans = 0
for i in range(N):
    m = modinv(A[i], MOD)
    ans += lm * m
    ans %= MOD

print(ans)


Fixed submission:
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
import math
import fractions
from heapq import heappush, heappop


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

MOD = 10**9+7


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    # return (x * y) * modinv(fractions.gcd(x, y), MOD)


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

lm = 1
s = 0

for i in range(N):
    lm = lcm(A[i], lm)
    #s += lm // MOD
    #lm %= MOD

lm %= MOD
# print(lm)
ans = 0
for i in range(N):
    m = modinv(A[i], MOD)
    ans += lm * m
    ans %= MOD

print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import random


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
MEIJI = [[0] * W for i in range(H)]

for i in range(H):
    a = input()
    for j in range(len(a)):
        if a[j] == "#":
            MEIJI[i][j] = 1


def findStart():
    while(True):
        x, y = random.randint(H), random.randint(W)
        if MEIJI[x][y] == 0:
            return x, y

    return False


def bfs(H, W, sx, sy):
    d = [[-1] * W for i in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque([])
    q.append((sx, sy))
    d[sx][sy] = 0

    mx = -1
    gx, gy = -1, -1
    while(len(q) != 0):
        x, y = q.popleft()

        for i in range(4):
            nx, ny = x + dx[i], y + dy[i]

            if (0 <= nx and nx <= (H-1) and 0 <= ny and ny <= (W-1) and MEIJI[nx][ny] == 0 and d[nx][ny] == -1):
                q.append((nx, ny))
                l = d[x][y] + 1
                d[nx][ny] = l

                if l > mx:
                    gx, gy = nx, ny
                    mx = l
    return d, gx, gy, mx


sx, sy = findStart()
_, x, y, _ = bfs(H, W, sx, sy)
_, _, _, l = bfs(H, W, x, y)

if l < 0:
    l = 0

print(l)


Fixed submission:
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import random


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
MEIJI = [[0] * W for i in range(H)]

for i in range(H):
    a = input()
    for j in range(len(a)):
        if a[j] == "#":
            MEIJI[i][j] = 1


def findStart():
    for x in range(H):
        for y in range(W):
            if MEIJI[x][y] == 0:
                return x, y

    return False


def bfs(H, W, sx, sy):
    if MEIJI[sx][sy] == 1:
        return 0, 0, 0, -1
    d = [[-1] * W for i in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque([])
    q.append((sx, sy))
    d[sx][sy] = 0

    mx = -1
    gx, gy = -1, -1
    while(len(q) != 0):
        x, y = q.popleft()

        for i in range(4):
            nx, ny = x + dx[i], y + dy[i]

            if (0 <= nx and nx <= (H-1) and 0 <= ny and ny <= (W-1) and MEIJI[nx][ny] == 0 and d[nx][ny] == -1):
                q.append((nx, ny))
                l = d[x][y] + 1
                d[nx][ny] = l

                if l > mx:
                    gx, gy = nx, ny
                    mx = l
    return d, gx, gy, mx


mx = 0
for x in range(H):
    for y in range(W):
        _, _, _, l = bfs(H, W, x, y)
        if l > mx:
            mx = l

print(mx)
exit()

sx, sy = findStart()
_, x, y, _ = bfs(H, W, sx, sy)
_, _, _, l = bfs(H, W, x, y)

if l < 0:
    l = 0

print(l)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import math


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N = int(input())
C = []

for _ in range(N):
    x, y = map(int, input().split())
    C.append((x, y))

r_large = 800.
r_small = 0.
r = (r_large + r_small) / 2.

for _ in range(100):
    isValid = True
    r2 = (r * 2.)**2.
    for i in range(N):
        for j in range(N):
            l = (C[i][0] - C[j][0]) ** 2 + (C[i][1] - C[j][1]) ** 2
            if l > r2:
                isValid = False
                break

            nx, ny = (C[i][0]+C[j][0])/2., (C[i][1]+C[j][1])/2.

            for k in range(N):
                l2 = (C[k][0] - nx) ** 2 + (C[k][1] - ny) ** 2
                if l2 > r2:
                    isValid = False
                    break

        if not isValid:
            break

    if isValid:
        r_large = r
    else:
        r_small = r

    r = (r_large + r_small) / 2.

print(r)

#print(math.sqrt(lm) / 2.)


Fixed submission:
import math
import sys
import itertools
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
XY = [[float(x) for x in input().split()] for _ in range(N)]

ans = 1500.
eps = 10. ** -8


def circumcenter(A, B, C):
    ax = A[0]
    ay = A[1]
    bx = B[0]
    by = B[1]
    cx = C[0]
    cy = C[1]
    d = 2 * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by))

    if d == 0.:
        return None

    ux = ((ax * ax + ay * ay) * (by - cy) + (bx * bx + by * by)
          * (cy - ay) + (cx * cx + cy * cy) * (ay - by)) / d
    uy = ((ax * ax + ay * ay) * (cx - bx) + (bx * bx + by * by)
          * (ax - cx) + (cx * cx + cy * cy) * (bx - ax)) / d
    return (ux, uy)


def check(center_x, center_y, R2):
    ok = True
    for x, y in XY:
        d = (center_x - x) ** 2. + (center_y - y) ** 2.
        if R2 + eps < d:
            ok = False
            break

    return ok


# 2点
for i, j in itertools.combinations(range(N), 2):
    ax, ay = XY[i]
    bx, by = XY[j]

    center_x = (ax + bx) / 2.
    center_y = (ay + by) / 2.
    R2 = (ax - center_x) ** 2 + (ay - center_y) ** 2
    R = math.sqrt(R2)

    if check(center_x, center_y, R2):
        ans = min(R, ans)


# 3点
for a, b, c in itertools.combinations(range(N), 3):
    d = circumcenter(XY[a], XY[b], XY[c])

    if d is None:
        continue

    center_x = d[0]
    center_y = d[1]

    ax = XY[a][0]
    ay = XY[a][1]
    R2 = (ax - center_x) ** 2. + (ay - center_y) ** 2.
    R = math.sqrt(R2)

    ok = check(center_x, center_y, R2)

    if check(center_x, center_y, R2):
        ans = min(ans, R)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappop, heappush
import math

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N = int(input())
X = list(map(int, input().split()))

F = math.factorial(N-1)
t = 0
f = 0

for i in range(N-1):
    f += F // (i+1)
    x = X[i+1] - X[i]
    t += x * f

print(t % (10 ** 9 + 7))


Fixed submission:
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappop, heappush
from fractions import Fraction

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)


def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0


def modinv(a, m):
    g, x, y = xgcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m


N = int(input())
X = list(map(int, input().split()))
MOD = 10**9+7

MAXN = N+5
fac = [1, 1] + [0] * MAXN
inv = [0, 1] + [0] * MAXN


for i in range(2, N):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = modinv(i, MOD)


c = 0
t = 0
f = fac[N-1]

for i in range(0, N-1):
    x = X[i+1] - X[i]
    c += f * inv[i+1]
    c %= MOD
    t += c * x
    t %= MOD

print(t)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M, V, P = map(int, input().split())

A = list(map(int, input().split()))
A.sort(reverse=True)

NUM = [0] * N
ACN = [0] * N
cnt = 0
mx = A[0]

# cnt and accumulation
for a in A:
    d = mx - a
    cnt += 1
    NUM[d] += 1
    ACN[d] = cnt

# P Number Problem
PROBLEM_P = 0
p = P
for i in range(0, A[0]+1):
    if NUM[i] == 0:
        continue

    p -= NUM[i]

    if p < 0:
        PROBLEM_P = i
        break

    if i == (A[0]+1) and p > 0:
        print(N)
        exit()

#print("NUM", NUM)
#print("PROBLEM_P", PROBLEM_P)

# R Number Problem
R = PROBLEM_P + M

# P-1 Problem
ans = 0
NG_POINT = (P-1) * M
NG_POINT += (N - ACN[R]) * M
MV = M * V

# p problem num
num_p = ACN[PROBLEM_P] - P

print(1)
exit()

for r in range(R, -1, -1):
    need_point = M
    total = (need_point * NUM[r]) + NG_POINT

    for q in range(r-1, PROBLEM_P, -1):
        if NUM[q] == 0:
            continue
        total += NUM[q] * (q - r + M)

    total += num_p * (PROBLEM_P - r + M)

    if total >= MV:
        ans = r
        break
    else:
        NG_POINT += NUM[r] * M

print(ACN[ans])


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

ans = 0

sml = A
big = B

if (A-B) > 0:
    sml = B
    big = A

if (A - B) % 2 == 0:
    ans = (big - sml) // 2
else:
    s = sml - 1
    b = N - big

    if s > b:
        t = (big - sml) + (2*b) + 1
    else:
        t = (big - sml) + (2*s) + 1

    ans = t // 2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 7)

X, Y = map(int, input().split())

cnt_d1 = 0
cnt_d2 = 0

diff = Y - X
if diff == 0:
    if X % 3 != 0:
        print(0)
        exit()
    cnt_d1 = X // 3
    cnt_d2 = cnt_d1
elif diff > 0:
    Y -= 2 * diff
    X -= 1 * diff
    if X < 0 or X % 3 != 0:
        print(0)
        exit()

    cnt_d1 = X // 3
    cnt_d2 = diff + X // 3
else:
    diff = - diff
    X -= 2 * diff
    Y -= 1 * diff
    if X < 0 or X % 3 != 0:
        print(0)
        exit()

    cnt_d1 = diff + X // 3
    cnt_d2 = X // 3

MOD = 10**9 + 7
fact = [1]
fact_inv = [1]
for i in range(cnt_d1+cnt_d2 + 10):
    new_fact = fact[-1]*(i+1) % MOD
    fact.append(new_fact)
    fact_inv.append(pow(new_fact, MOD-2, MOD))


def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] % mod


print(mod_comb_k(cnt_d1+cnt_d2, cnt_d1, MOD))

'''
dp = np.array([[0] * (Y + 1) for _ in range(X + 1)], dtype=np.int64)
#dp = [np.zeros(Y+1, np.int64) for _ in range(X+1)]
print(dp)

for i in range(X):
    if i > 0:
        dp[i] = dp[i]
'''


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)

X, Y = map(int, input().split())

cnt_d1 = 0
cnt_d2 = 0

diff = Y - X
if diff == 0:
    if X % 3 != 0:
        print(0)
        exit()
    cnt_d1 = X // 3
    cnt_d2 = cnt_d1
elif diff > 0:
    Y -= 2 * diff
    X -= 1 * diff
    if X < 0 or X % 3 != 0:
        print(0)
        exit()

    cnt_d1 = X // 3
    cnt_d2 = diff + X // 3
else:
    diff = - diff
    X -= 2 * diff
    Y -= 1 * diff
    if X < 0 or X % 3 != 0:
        print(0)
        exit()

    cnt_d1 = diff + X // 3
    cnt_d2 = X // 3

MOD = 10**9 + 7
fact = [1]
fact_inv = [1]
for i in range(cnt_d1+cnt_d2 + 10):
    new_fact = fact[-1]*(i+1) % MOD
    fact.append(new_fact)
    fact_inv.append(pow(new_fact, MOD-2, MOD))


def mod_comb_k(n, k, mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] % mod


print(mod_comb_k(cnt_d1+cnt_d2, cnt_d1, MOD))

'''
dp = np.array([[0] * (Y + 1) for _ in range(X + 1)], dtype=np.int64)
#dp = [np.zeros(Y+1, np.int64) for _ in range(X+1)]
print(dp)

for i in range(X):
    if i > 0:
        dp[i] = dp[i]
'''
Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S) + 1

mn = 0
ans = 0
for s in S:
  if s == '<':
    a += 1
  elif s == '>':
    a -= 1
    mn = min(mn,a)    
  
  ans += a
  
ans -= mn * N
print(ans)


Fixed submission:
S = list(input())
N = len(S) + 1

from_left = [0] * N
from_right = [0] * N

for i in range(N-1):
  s = S[i]
  if s == '<':
    from_left[i+1] = from_left[i] + 1

for i in range(N-2,-1,-1):
  s = S[i]
  if s == '>':
    from_right[i] = from_right[i+1] + 1
    
ans = 0
for i in range(N):
  ans += max(from_left[i],from_right[i])
  
print(ans)

Buggy python submission (verdict: Runtime Error):
S = list(input())

mn = 0
ans = 0
for s in S:
  if s == '<':
    a += 1
  elif s == '>':
    a -= 1
    mn = min(mn,a)    
  
  ans += a
  
ans -= mn * (len(S) + 1)
print(ans)


Fixed submission:
S = list(input())
N = len(S) + 1

from_left = [0] * N
from_right = [0] * N

for i in range(N-1):
  s = S[i]
  if s == '<':
    from_left[i+1] = from_left[i] + 1

for i in range(N-2,-1,-1):
  s = S[i]
  if s == '>':
    from_right[i] = from_right[i+1] + 1
    
ans = 0
for i in range(N):
  ans += max(from_left[i],from_right[i])
  
print(ans)

Buggy python submission (verdict: Runtime Error):
S = list(input())

mn = 0
ans = 0
for s in S:
  if s == '<':
    a += 1
  elif s == '>':
    a -= 1
    mn = min(mn,a)    
  
  ans += a
  
plus = -mn
ans += plus * (len(S) + 1)
print(ans)


Fixed submission:
S = list(input())
N = len(S) + 1

from_left = [0] * N
from_right = [0] * N

for i in range(N-1):
  s = S[i]
  if s == '<':
    from_left[i+1] = from_left[i] + 1

for i in range(N-2,-1,-1):
  s = S[i]
  if s == '>':
    from_right[i] = from_right[i+1] + 1
    
ans = 0
for i in range(N):
  ans += max(from_left[i],from_right[i])
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import bisect

N = int(input())
LS = list(map(int,input().split()))
LS.sort()

ans = 0

for a,b in itertools.combinations(LS,2):
  a,b = min(a,b),max(a,b)
  lo = b - a
  up = a + b
  
  cnt = bisect.bisect_left(LS,up) - bisect.bisect_right(LS,lo) - 1
  if lo < a:
    cnt -= 1
    
  if cnt <= 0:
    continue
    
  ans += cnt
  
print(ans // 3)



Fixed submission:
import itertools
import bisect

N = int(input())
LS = list(map(int,input().split()))
LS.sort()

ans = 0

for a,b in itertools.combinations(LS,2):
  a,b = min(a,b),max(a,b)
  lo = b - a
  up = a + b
  
  cnt = bisect.bisect_left(LS,up) - bisect.bisect_right(LS,lo) - 1
  if lo < a:
    cnt -= 1
    
  if cnt <= 0:
    continue
    
  ans += cnt
  
print(ans // 3)
Buggy python submission (verdict: Runtime Error):
N = int(input())

if N == 1:
  print(1)
elif N % 2 == 0:
  print(0.5)
else:
  print((N - (N//2) / N)


Fixed submission:
N = int(input())

if N == 1:
  print(1)
elif N % 2 == 0:
  print(0.5)
else:
  print(-(-N//2) / N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
i_a = [a,i+1 for i,a in enumerate(A)]
i_a.sort()

ans = []
for i,a in i_a:
  ans.append(a)
  
print(' '.join(map(str,ans)))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
i_a = [[a,i+1] for i,a in enumerate(A)]
i_a.sort()

ans = []
for i,a in i_a:
  ans.append(a)
  
print(' '.join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
R = []
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    R.append('No')
  else:
	R.append('Yes')
    
print('\n'.join(R))


Fixed submission:
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    print('No')
  else:
    print('Yes')
    
exit()

Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
R = []
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    R.append('No')
  else:
	R.append('Yes')
    
print('\n'.join(R))


Fixed submission:
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    print('No')
  else:
    print('Yes')
    
exit()

Buggy python submission (verdict: Runtime Error):
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
for i in range(N):
  p = K - Q + A[i]
  if p <= 0:
    print('No')
  else:
    print('Yes')
    
exit()


Fixed submission:
N,K,Q = map(int,input().split())
ANS = [0] * N
A = [int(input()) for _ in range(Q)]
for a in A:
  ANS[a-1] += 1
  
for i in range(N):
  p = K - Q + ANS[i]
  if p <= 0:
    print('No')
  else:
    print('Yes')
    
exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
S = list(input())

ans = 0

for l2 in range(1, N):
    same_len = 0
    for i in range(N):
        if N - 1 < l2 + i:
            continue

        if S[i] == S[l2 + i]:
            same_len += 1
        else:
            same_len = min(l2, same_len)
            ans = max(ans, same_len)
            same_len = 0
    same_len = min(l2, same_len)
    ans = max(same_len, ans)

print(ans)


Fixed submission:
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
S = list(input())

ans = 0

for l2 in range(1, N):
    same_len = 0
    for i in range(N):
        if N - 1 < l2 + i:
            continue

        if S[i] == S[l2 + i]:
            same_len += 1
        else:
            same_len = min(l2, same_len)
            ans = max(ans, same_len)
            same_len = 0
    same_len = min(l2, same_len)
    ans = max(same_len, ans)

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

if B == 1:
  return 0

if B <= A:
  return 1

B -= A
ans = 1

while B > 0:
  B -= (A - 1)
  ans += 1
  
print(ans)
exit()


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

if B == 1:
  print(0)
  exit()

if B <= A:
  print(1)
  exit()

B -= A
ans = 1

while B > 0:
  B -= (A - 1)
  ans += 1
  
print(ans)
exit()

Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

if B == 1:
  return 0

if B <= A:
  return 1

B -= A
ans = 1

while B >= 0:
  B -= (A - 1)
  ans += 1
  
print(ans)
exit()


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

if B == 1:
  print(0)
  exit()

if B <= A:
  print(1)
  exit()

B -= A
ans = 1

while B > 0:
  B -= (A - 1)
  ans += 1
  
print(ans)
exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Q = map(int, readline().split())

PATH = [[] for _ in range(N + 1)]

for _ in range(N-1):
    a, b = map(int, readline().split())
    PATH[a].append(b)
    PATH[b].append(a)

POINT = [0] * (N + 1)

for _ in range(Q):
    p, x = map(int, readline().split())
    POINT[p] += x


ans = [0] * (N+1)

STATE = [False] * (N+1)


def dfs(s, plus):
    p = POINT[s]
    pt = p + plus
    ans[s] += pt

    STATE[s] = True

    for v in PATH[s]:
        if STATE[v]:
            continue
        dfs(v, pt)


dfs(1, 0)
print(" ".join(map(str, ans[1:])))


Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, Q = map(int, readline().split())

PATH = [[] for _ in range(N + 1)]

for _ in range(N-1):
    a, b = map(int, readline().split())
    PATH[a].append(b)
    PATH[b].append(a)

POINT = [0] * (N + 1)

for _ in range(Q):
    p, x = map(int, readline().split())
    POINT[p] += x


ans = [0] * (N+1)

STATE = [False] * (N+1)


def dfs(s, plus):
    p = POINT[s]
    pt = p + plus
    ans[s] += pt

    STATE[s] = True

    for v in PATH[s]:
        if STATE[v]:
            continue
        dfs(v, pt)


dfs(1, 0)
print(" ".join(map(str, ans[1:])))