Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03646 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)

def solve_small(K):
    if K == 0:
        return [0, 1]
    elif K == 1:
        return [0, 2]

    return [i for i in range(1, K+1)]

def solve(K):
    N = 50
    q = K // N
    r = K %  N

    A = [q+i for i in range(N)]
    for i in range(r):
        for j in range(N):
            if j == i:
                A[j] += N
            else:
                A[j] -= 1

    return A

def main():
    K = int(input())

    if K < 50:
        A = solve_small(K)
    else:
        A = solve(K)

    print(len(A))
    print(" ".join(map(str, A)))

if __name__ == "__main__": main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)

def solve_small(K):
    if K == 0:
        return [0, 1]
    elif K == 1:
        return [0, 2]

    return [i for i in range(1, K+1)]

def solve(K):
    N = 50
    q = K // N
    r = K %  N

    if q < 10000 || r < 10:
        A = [q+i-r for i in range(N)]
        A[-1] += r + r*N
    else:
        A = [q+i-3*r for i in range(N)]
        A[-3] += r + r*N - 2
        A[-2] += r + r*N - 1
        A[-1] += r + r*N - 0
        A[-1] -= 2*r

    return A

def main():
    K = int(input())

    if K < 50:
        A = solve_small(K)
    else:
        A = solve(K)

    print(len(A))
    print(" ".join(map(str, A)))

if __name__ == "__main__": main()
Problem p02619 (python)

Fixed submission:

def read_input():
    D = int(input())
    C = input().split()
    C = [int(i) for i in C]
    S = [list(map(int, input().split())) for _ in range(D)]
    T = [int(input()) for _ in range(D)]
    return D, C, S, T


def scoring(S, D, T, C):
    res = []
    last = [0 for _ in range(26)]
    final = 0
    for i in range(D):
        dec = 0
        for j in range(26):
            for loc, val in enumerate(T[:i + 1]):
                if val == j + 1:
                    last[j] = loc + 1
            dec += C[j] * (i - last[j] + 1)
        final += S[i][T[i] - 1] - dec
        res.append(final)
    return res


D, C, S, T = read_input()
res = scoring(S, D, T, C)
for x in res:
    print(x)

Buggy submission (verdict: Runtime Error):
def read_input(filename):
    filein = open(filename, 'r')
    D = int(filein.readline())
    C = filein.readline().split()
    C = [int(i) for i in C]
    S = [list(map(int, filein.readline().split())) for x in range(D)]
    T = [int(filein.readline()) for x in range(D)]
    return D, C, S, T


def scoring(S, D, T, C):
    res = []
    last = [0 for _ in range(26)]
    final = 0
    for i in range(D):
        dec = 0
        for j in range(26):
            for loc, val in enumerate(T[:i + 1]):
                if val == j + 1:
                    last[j] = loc + 1
            dec += C[j] * (i - last[j] + 1)
        final += S[i][T[i] - 1] - dec
        res.append(final)
    return res


D, C, S, T = read_input("sample1.in")
res = scoring(S, D, T, C)
for x in res:
    print(x)
Problem p02630 (python)

Fixed submission:
from collections import defaultdict

N, _A, Q, *val = [[*map(int, line.split())] for line in open(0)]
N = N[0]
Q = Q[0]

A = defaultdict(int)
for _a in _A:
    A[_a] += 1

ans = sum(_A)
for v in val:
    if v[0] in A.keys():
        num = A[v[0]]
        A[v[0]] = 0
        A[v[1]] += num
        ans += (v[1] - v[0]) * num
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

N = int(input())
_A = [*map(int, input().split())]
Q = int(input())
val = [[*map(int, line.split())] for line in open(0)]

A = defaultdict(int)
for _a in _A:
    A[_a] += 1

ans = sum(_A)
for v in val:
    if v[0] in A.keys():
        num = A[v[0]]
        A[v[0]] = 0
        A[v[1]] += num
        ans += (v[1] - v[0]) * num
    print(ans)
Problem p02678 (python)

Fixed submission:
(N, M), *miti = [[*map(int, line.split())] for line in open(0)]

# print(miti)

A = [list() for _ in range(N+1)]
for m in miti:
    a, b = m
    A[a].append(b)
    A[b].append(a)

# print(A)

ans = [0] * (N + 1)
dist = [N] * (N + 1)
R = [list() for _ in range(N)]

dist[1] = 0
R[0].append(1)
ans[1] = 88888
for i in range(N):
    for p in R[i]:
        for t in A[p]:
            if i + 1 < dist[t]:
                dist[t] = i + 1
                R[i+1].append(t)
                ans[t] = p

dist = dist[1:]
ans = ans[2:]
if all(d < N for d in dist):
    print("Yes")
    for a in ans:
        print(a)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
(N, M), *miti = [[*map(int, line.split())] for line in open(0)]

# print(miti)

A = [list() for _ in range(N+1)]
for m in miti:
    a, b = m
    A[a].append(b)
    A[b].append(a)

# print(A)

ans = [0] * (N + 1)
dist = [N] * (N + 1)


def check(p, d):
    for t in A[p]:
        if d + 1 < dist[t]:
            dist[t] = d + 1
            ans[t] = p
            check(t, d + 1)


dist[1] = 0
ans[1] = 88888
check(1, 0)

dist = dist[1:]
ans = ans[2:]
print("foo")
exit()
if all(d < N for d in dist):
    print("Yes")
    for a in ans:
        print(a)
else:
    print("No")

Buggy submission (verdict: Runtime Error):
(N, M), *miti = [[*map(int, line.split())] for line in open(0)]

# print(miti)

A = [list() for _ in range(N+1)]
for m in miti:
    a, b = m
    A[a].append(b)
    A[b].append(a)

# print(A)

ans = [0] * (N + 1)
dist = [N] * (N + 1)


def check(p, d):
    for t in A[p]:
        if d + 1 < dist[t]:
            dist[t] = d + 1
            ans[t] = p
            check(t, d + 1)


dist[1] = 0
ans[1] = 88888
check(1, 0)

dist = dist[1:]
ans = ans[2:]
if all(d < N for d in dist):
    print("Yes")
    for a in ans:
        print(a)
else:
    print("No")
Problem p02687 (python)

Fixed submission:
S = input()
  
print("ARC" if S == "ABC" else "ABC")

Buggy submission (verdict: Runtime Error):
S = input()
  
print("ARC" if S == "ABC else "ABC")
Problem p02690 (python)

Fixed submission:
X = int(input())

R = 3000
go = [i**5 for i in range(R)]


def foo():
    for i in range(R):
        for j in range(R):
            if go[i] - go[j] == X:
                return i, j
        for j in range(i, R):
            if go[i] + go[j] == X:
                return i, -j

    return 0, 0


A, B = foo()
print(A, B)

Buggy submission (verdict: Runtime Error):
X = int(input())

go = [i**5 for i in range(1000)]


def foo():
    for i in range(1000):
        for j in range(i, 1000):
            if go[i] - go[j] == X:
                return i, j
        for j in range(1000):
            if go[i] + go[j] == X:
                return i, -j


A, B = foo()
print(A, B)
Problem p02709 (python)

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

A = sorted([(val, pos) for pos, val in enumerate(A)], reverse=True)

dp = [0]
for i, (val, pos) in enumerate(A):
    ldp = [e + val * abs(pos - (i - r)) for r, e in enumerate(dp)]
    rdp = [e + val * abs(N - 1 - r - pos) for r, e in enumerate(dp)]
    dp = [max(L, R) for L, R in zip(ldp + [0], [0] + rdp)]

print(max(dp))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

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

index = [i for i in range(N)]
index = sorted(index, key=lambda i: A[i], reverse=True)


def LorR(index, res):
    i = index[0]
    dist = max(i, N - 1 - i)
    end = False
    cand1 = cand2 = 0
    while not end:
        j = i + dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand1 = A[i] * dist + loop(index[1:], r)
            end = True

        j = i - dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand2 = A[i] * dist + loop(index[1:], r)
            end = True

        dist -= 1
    return max(cand1, cand2)


def loop(index, res):
    if not index:
        return 0

    return LorR(index, res)


print(loop(index, [False] * N))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

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

index = [i for i in range(N)]
index = sorted(index, key=lambda i: A[i], reverse=True)

print(A)
print(index)


def LorR(index, res):
    i = index[0]
    dist = max(i, N - 1 - i)
    end = False
    cand1 = cand2 = 0
    while not end:
        j = i + dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand1 = A[i] * dist + loop(index[1:], r)
            end = True

        j = i - dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand2 = A[i] * dist + loop(index[1:], r)
            end = True

        dist -= 1
    return max(cand1, cand2)


def loop(index, res):
    if not index:
        return 0

    num = 0
    a = A[index[0]]
    while num < len(index) and A[index[num]] == a:
        num += 1

    cand = [0] * num
    for i in range(num):
        ind = deepcopy(index)
        head = ind.pop(i)
        ind.insert(0, head)
        cand[i] = LorR(ind, res)

    return max(cand)


print(loop(index, [False] * N))
Problem p02973 (python)

Fixed submission:
import bisect

N = int(input())

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

colors = []

for i in range(N-1, -1, -1):
    target = bisect.bisect_right(colors, A[i])

    if target == len(colors):
        colors.append(A[i])
    else:
        colors[target] = A[i]

print(len(colors))

Buggy submission (verdict: Runtime Error):
N = int(input())

A = []

for i in range(N):
    A.append(int(input()))

color = 1

def hantei(start):
    global color
    current = start - 1

    while current >= 0:
        if A[current] >= A[start]:
            color += 1
            hantei(current)
            return
        else:
            current -= 1
            start -= 1

hantei(N-1)

print(color)
Problem p02995 (python)

Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // fractions.gcd(C, D))

print(U - (possible_C + possible_D) + possible_CD)

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // math.gcd(C, D))

print(U)
print(possible_C)
print(possible_D)
print(possible_CD)

print(U - (possible_C + possible_D) + possible_CD)
Problem p02619 (python)

Fixed submission:
import numpy as np

d = int(input())    # Day
C = list(map(int, input().split()))  # 満足度の減少係数
S = []  # 各日にち、各タイプの満足度
T = []  # d日目の開催タイプ
L = [0] * 26    # 各コンテストが開催された最後の日付

for _ in range(d):
    S.append(list(map(int, input().split())))  # Si,d type_iをdayDに開いた時の満足度 [5, 26]

for _ in range(d):
    T.append(int(input()))

# print("d:", d)
# print("C:", C)
# print("S:", S)
# print("T:", T)

sat = 0
S = np.array(S)

for i in range(d):
    con_type = T[i]
    # print("開催するコンテストタイプ：", con_type)
    complain = 0
    L[con_type - 1] = i + 1     # 最終開催日の更新
    for j in range(26):
        # print("{} + {} * ({} - {})".format(complain, C[j], i+1, L[j]))
        complain = complain + C[j] * (i + 1 - L[j])

    # print("complain:", complain)
    # print("S:", S[i][con_type - 1])
    # print("satの計算: {} + {} - {}".format(sat, S[i][con_type - 1], complain ))

    sat = sat + S[i][con_type - 1] - complain

    print(sat)

Buggy submission (verdict: Runtime Error):
import numpy as np

d = int(input())    # Day
C = list(map(int, input().split()))  # 満足度の減少係数
S = []  # 各日にち、各タイプの満足度
T = []  # d日目の開催タイプ
L = [0] * 26    # 各コンテストが開催された最後の日付

for _ in range(d):
    S.append(list(map(int, input().split())))  # Si,d type_iをdayDに開いた時の満足度 [5, 26]

for _ in range(d):
    T.append(int(input()))

print("S:", S)
print("T:",T)

sat = 0
S = np.array(S)
print("S_shape:", S.shape)

for i in range(d):
    con_type = T[i]
    print(i)
    print("開催するコンテストタイプ：", con_type)
    complain = 0
    for j in range(26):
        complain = complain + C[j] * (d - L[j])
    L[con_type] = d     # 最終開催日の更新

    sat = sat + S[d][con_type] - complain
    sat = max(10^6 + sat, 0)

    print(sat)
Problem p02646 (python)

Fixed submission:
def main():
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())

    if v == w:
        print('NO')
        return 0
    if v-w < 0:
        print('NO')
        return 0
    if abs(b-a)/(v-w) <= t:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())

    if b == 
    a += 10**9
    b += 10**9
    if v == w:
        print('NO')
        return 0
#    if a > b:
#        print('NO')
#        return 0
    if (b-a)%(v-w) != 0:
        print('NO')
    elif 0 <= (b-a)/(v-w) <= t:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
Problem p02720 (python)

Fixed submission:
from collections import deque
k=int(input())
q=deque(list(range(1, 10)))
ans,x,y=0,0,0
for i in range(k):
  ans=q.popleft()
  y=ans%10
  x=ans*10+y
  if y != 0:
    q.append(x-1)
  q.append(x)
  if y != 9:
    q.append(x+1)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
k=int(input())
q=deque(list(range(1, 10)))
ans,x,y=0,0,0
for i in range(k):
  ans=q.popleft()
  y=ans%10
  x=ans*10+y
  if y != 0:
    q.append(tmp-1)
  q.append(tmp)
  if y != 9:
    q.append(tmp+1)
print(ans)
Problem p02780 (python)

Fixed submission:
n,k=map(int,input().split())
d = tuple(map(int, input().split()))
e = [0]*n

for i in range(n):
    s = (1+d[i])*d[i]/2
    e[i] = s / d[i]

max1 = 0
tmp = 0
for j in range(n-k+1):
#    if len(e[j:j+k]) < k:
#        break
    if j == 0:
        tmp = sum(e[j:j+k])
    else:
        tmp = tmp - e[j-1] + e[j+k-1]
    if max1 < tmp:
        max1 = tmp
print(max1)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
d = list(map(int, input().split()))
e = [0]*n

for i in d:
    s = (1+i)*i/2
    e[i] = s / i

max1 = 0
idx = 0
tmp = 0
for j in range(n):
    if len(e[j:j+k]) < k:
        break
    if j == 0:
        tmp = sum(e[j:j+k])
    else:
        tmp = tmp - e[j-1] + e[j+k-1]
    if max1 < tmp:
        idx = j
        max1 = tmp
print(max1)
Problem p02791 (python)

Fixed submission:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    a = list(map(int, r.split()))
    #a, b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]

    res = 1
    bk = a[0]
    for i in range(1,n):
        if bk >= a[i]:
            bk = a[i]
            res += 1
    print(res)


#    b = [0]*n
#    for i in range(n):
#        b[a[i]-1] = i

#    res = 0
#    mem = b[0]
#    for i in range(1,n):
#        if mem <= b[i]:
#            print(b[i])
##            mem = b[i]
#        else:
#            res += 1
#    print(res)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    a = list(map(int, r.split()))
    #a, b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]

    res = 1
    import numpy as np
#    d = [i for i in a if ma != i or mi != i]
    b = (np.array(a[1:]) - np.array(a[:-1]))
    res += sum(1 for x in b if x <= 0)
    print(res)

#    for i in range(1,a):
#        for j in range(0,a-1):
#            a[i]
#    b = a[1:] - a[:1]
#    res = 
#    print(res)
#    ans = sum(1 for x in res if x <= 0)
#    print(ans)
#    for i in range(1,len(a)):
#        if i >= a[i]:
#            res += 1
#    print(res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()
Problem p02797 (python)

Fixed submission:
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**9)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #r = [int(stdin.readline()) for i in range(3)]
    
    a = list(map(int, r.split()))
    n = a[0]
    k = a[1]
    s = a[2]

    tmp = 0
    if s == 10**9:
        tmp = 1
    else:
        tmp = 10**9
    res = [tmp]*n
    for i in range(k):
        res[i] = s
    print(*res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**10)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #r = [int(stdin.readline()) for i in range(3)]
    
    a = list(map(int, r.split()))
    n = a[0]
    k = a[1]
    s = a[2]

    res = [s+1]*n
    for i in range(k):
        res[i] = s
    print(*res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()
Problem p02841 (python)

Fixed submission:
m1,d1=map(int,input().split())
m2,d2=map(int,input().split())
if d2 == 1:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
m1,d1=map(int,input().split())
m2,d2=map(int,input().split())
if d2 = 1:
    print(1)
else:
    print(0)
Problem p02854 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
cn=0
buf=s
for i in range(n):
  cn+=a[i]
  buf=min(buf,abs(s-2*cn))
print(buf)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
cn=0
buf=s
for i in range(n):
  cn+=a[i]
  buf=min(bug,abs(s-2+cn))
print(buf)
Problem p02861 (python)

Fixed submission:
import math
import itertools

n = int(input())
x = [list(map(int, input().split())) for i in range(n)]

res = 0
cnt = 0
for v in itertools.permutations(x):
  for i in range(n-1):
    res += math.sqrt((v[i+1][0] - v[i][0]) ** 2 + (v[i+1][1] - v[i][1]) ** 2)
  cnt += 1

print((res+0.0)/cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

n = map(int, input().split())
x = [list(map(int,input().split())) for i in range(n)]

res = 0
cnt = 0
for v in itertools.permutations(x):
  a = numpy.array(v[0])
  b = numpy.array(v[1])
  res += np.linalg.norm(b-a)
  cnt += 1

print((res+0.0)/cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

n = map(int, input().split())
x = [list(map(int,input().split())) for i in range(n)]

res = 0
for v in itertools.combinations(x, 2):
  a = numpy.array(v[0])
  b = numpy.array(v[1])
  res += np.linalg.norm(b-a)

print(res)
Problem p02909 (python)

Fixed submission:
l = ["Sunny", "Cloudy", "Rainy"]
s = input()
print(l[(l.index(s)+1)%3])

Buggy submission (verdict: Runtime Error):
l = ["Sunny", "Cloudy", "Rain"]
s = input()
print(l[(l.index(s)+1)%3])

Buggy submission (verdict: Runtime Error):
t = ("Sunny", "Cloudy", "Rain")
s = input()
print(t(t.index(s)+1)%3))
Problem p02910 (python)

Fixed submission:
k = ['R','U','D']
g = ['L','U','D']

s = input()
for i in range(len(s)):
  if s[i] == 'U' or s[i] == 'D':
    continue
  else:
    if i%2 != 0:
      if s[i] != 'L':
        print("No")
        exit()
    else:
      if s[i] != 'R':
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
k = ['R','U','D']
g = ['L','U','D']

s = input()
for i in s:
  if i == 'U' or i == 'D':
    continue
  else:
    if i%2 == 0:
      if i != 'L':
        print("No")
        exit()
    else:
      if i != 'R':
        print("No")
        exit()
print("Yes")
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

if k - q > 0:
  res = ['Yes'] * n
else:
  res = ['No'] * n
  ans = [0] * n
  for i in range(len(a)):
    ans[a[i]-1] += 1
  for i in range(n):
    if k - q + ans[i] > 0:
      res[i] = 'Yes'
print('\n'.join(map(str, res)))

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

if k - q > 0:
  res = ['Yes'] * n
else:
  res = ['No'] * n
  ans = [0] * n
  for i in range(len(a)):
    ans[a[i]-1] += 1
  for i in range(len(n)):
    if k - q + ans[i] > 0:
      res[i] = 'Yes'
print('\n'.join(map(str, res)))

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

if k - q > 0:
  res = ['Yes'] * n
else:
  res = ['No'] * n
  ans = [0] * n
  for i in range(len(a)):
    ans[a[i]-1] += 1
  for i in range(len(n)):
    if k - q + a[i] > 0:
      res[i] = 'Yes'
print('\n'.join(map(str, res)))

Buggy submission (verdict: Runtime Error):
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]

if k > q:
  res = ['Yes'] * n
else:
  res = ['No'] * n
  ans = set(a)
  for i in range(len(ans)):
    if k - q + a.count(ans[i]) > 0:
      res[ans[i]-1] = 'Yes'
print('\n'.join(map(str, res)))
Problem p02939 (python)

Fixed submission:
s=list(input())
cnt=0
now=''
buf=''
for i in range(len(s)):
    now+=s[i]
    if buf!=now:
        buf=now
        now=''
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
s=list(input())
cnt=0
now=''
for i in range(len(s)):
    now+=s[i]
    if buf!=now:
        buf=now
        now=''
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
s=list(input())
res=1
tmp = ''
bef = s[0]
for i in range(1,len(s)):
    tmp.join(s[i])
    if bef != tmp:
        cnt += 1
        bef = tmp
        tmp = ''
print(cnt)
Problem p02947 (python)

Fixed submission:
def main():
    n = int(input())
    s = ["".join(sorted(input())) for i in range(n)]
    
    from collections import Counter
    c = Counter(s)
    res = 0
    for i in c.values():
        if i < 2:
            continue
        else:
            res += i * (i-1) // 2
    print(res)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = ["".join(sorted(input())) for i in range(n)]
    
    from collections import Counter
    c = Counter(s)
    res = 0
    for i in c.values:
        if i < 2:
            continue
        else:
            res += i * (i-1) // 2
    print(res)
    
if __name__ == '__main__':
    main()