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


def main():
    N = int(input())
    S = [i for i in input()]
    min_count = 30000
    for i in range(N):
        left = S[:i-1]
        right = S[i:]
        tmp_c = left.count("W")+right.count("E")
        if tmp_c < min_count:
            min_count = tmp_c
    print(min_count)

if __name__ == "__main__":
    main()

Fixed submission:


def main():
    N = int(input())
    S = input()

    l = [0]*N
    r = [0]*N
    for i in range(1, N):
        l[i] = l[i-1] + (S[i-1]=="W")
    for i in range(N-1)[::-1]:
        r[i] = r[i+1] + (S[i+1]=="E")

    
    ans = 10**6
    for a, b, in zip(l, r):
        ans = min(a+b, ans)
    print(ans)
    

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):


def main():
    N = int(input())
    S = input()
    min_count = 30000
    for i in range(N):
        count = 0
        for loc, j in enumerate(S):
            if i == loc: 
                continue

            if loc > i:
                if j == "E":
                    count += 1
            if loc < i:
                if j == "W":
                    count += 1
        if count < min_count:
            min_count = count
    print(min_count)

if __name__ == "__main__":
    main()

Fixed submission:


def main():
    N = int(input())
    S = input()

    l = [0]*N
    r = [0]*N
    for i in range(1, N):
        l[i] = l[i-1] + (S[i-1]=="W")
    for i in range(N-1)[::-1]:
        r[i] = r[i+1] + (S[i+1]=="E")

    
    ans = 10**6
    for a, b, in zip(l, r):
        ans = min(a+b, ans)
    print(ans)
    

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
range_N = range(N)
m = []
for i in range_N:
  m.append(int(input()))

# 最低でも消費する量を求める。
min_consump = sum(m)
# 残りのお菓子の元の量
rest = X - min_consump
# 残りの量と、一つのドーナツを作るのに消費する量で最大公約数を求める
if rest != 0:
	max_num = 0
	for consump in m:
      doughnut = rest // consump
      if doughnut > max_num :
        max_num = doughnut
    print(len(m) + max_num)
else:print(len(m))

Fixed submission:
N, X = map(int, input().split())
range_N = range(N)
m = []
for i in range_N:
  m.append(int(input()))

min_consump = sum(m)
rest = X - min_consump
if rest != 0:
	max_num = 0
	for consump in m:
		doughnut = rest // consump
		if doughnut > max_num :
			max_num = doughnut
	print(len(m) + max_num)
else:print(len(m))
Buggy python submission (verdict: Runtime Error):
N = int(input()) # 支払い金学
A = int(input()) # 1円の枚数
range_A = range(A)
flag = False
for a in range_A:
  if (N - a) % 500 == 0:
    flag = True
if flag: print("Yes")
  print("No")

Fixed submission:
N = int(input()) # 支払い金学
A = int(input()) # 1円の枚数
B = N % 500 # ５００円が商枚使われた時の余り、これが１円より多いか少ないかで決める
if B <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
S[:4] = "2018"
print(S)


Fixed submission:
S = input()
S = S.replace("2017", "2018")
print(S)
Buggy python submission (verdict: Runtime Error):
s = input()
s＿asc = "".join(sorted(s))
    
t = input()
t_dasc = "".join(sorted(t, reverse=True))

if s_asc < t_desc:
	print("Yes")
else:
    print("No")



Fixed submission:
a, b = map(int, input().split())
print((a + b + 1) // 2)

Buggy python submission (verdict: Runtime Error):
s = input()
s＿asc = "".join(sorted(s))
    
t = input()
t_dasc = "".join(sorted(t, reverse=True))

if s_asc < t_desc:
        print("Yes")
else:
        print("No")



Fixed submission:
a, b = map(int, input().split())
print((a + b + 1) // 2)

Buggy python submission (verdict: Runtime Error):
import math
a, b = int(input().split(" "))
c = (a + b)/2 # 平均値
if (a+b) % 2 != 0: # 余りが０以外の時小数点以下をきりあげる必要がある。
  print(math.ceil(c))
else:
  print(c)


Fixed submission:
a, b = map(int, input().split())
print((a + b + 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def main()->None:
    N, K = map(int, input().split())
    A = list(map(int, input().split()))


    if len(A) > K:
        set_A = set(A)
        
        count = np.empty(len(set_A), dtype=int)
        i = 0
        for s_a in set_A:
            count[i] = A.count(s_a)
            i += 1

        sorted_count = np.sort(count)
        reduce_num = len(set_A) - K
        
        sum_count = 0
        counter = 0
        for c in sorted_count:
            if counter == reduce_num :
                break
            sum_count += c
            counter += 1

        print(sum_count)
    else:
        print(0)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import Counter


def main()->None:
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a = sorted(Counter(a).values(), reverse=True)
    print(sum(a[k:]))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np


def main()->None:
    N, K = map(int, input().split())
    A = list(map(int, input().split()))


    if len(A) > K:
        set_A = set(A)
        #print(set_A)
        count = np.empty(len(set_A), dtype=int)
        for i, s_a in enumerate(set_A):
            count[i] = A.count(s_a)
        sorted_count = np.sort(count)
        #print(sorted_count)
        reduce_num = len(set_A) - K
        sum_count = 0
        counter = 0
        for c in sorted_count:
            if counter == reduce_num :
                break
            sum_count += c
            counter += 1

        print(sum_count)
    else:
        print(0)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import Counter


def main()->None:
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a = sorted(Counter(a).values(), reverse=True)
    print(sum(a[k:]))

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):



def main()->None:
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    if len(A) > K:
        set_A = set(A)
        count = []
        for s_a in set_A:
            card = A.count(s_a)
            count.append(card)
        sorted_count = sorted(count)
        reduce_num = len(count) - K
        sum_count = 0
        counter = 0
        for c in sorted_count:
            if counter == reduce_num :
                break
            sum_count += c
            counter += 1

        print(sum_count)
    else:
        print(0)

if __name__ == "__main__":
    main()

Fixed submission:
from collections import Counter


def main()->None:
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a = sorted(Counter(a).values(), reverse=True)
    print(sum(a[k:]))

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


def main()->None:
    # gridの処理
    # 近傍の座標をdx=[-1,0,1], dy=[-1,0,1]を用いて
    # (xx, yy) が　xx = x + dx , yy = y + dy　とできる
    # 参考：http://prd-xxx.hateblo.jp/entry/2017/10/19/205331
    # 入力のグリッドから一点ずつ座標指定して選んでその周囲８マスを調べる。
    H, W = map(int, input().split())
    src = [input() for _ in range(H)]
    ans = []
    for row in src:
        ans.append(list(row))


    dxdy = [(-1,-1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
    for y in range(H):
        for x in range(W):
            if src[y][x] == "#":continue
            c = 0
            for dx, dy in dxdy:
                # 探索範囲はx:0~W, y:0~Hでその周囲８マスを探索する
                if x+dx < 0 or x+dx > W-1 or y+dy < 0 or y+dy > H-1: continue
                if src[y+dy][x+dx] == "#": c += 1
        ans[y][x] = c
    
    for row in ans:
        print("".join(list(map(str, row))))




if __name__ == "__main__":
    main()

Fixed submission:


def main()->None:
    # gridの処理
    # 近傍の座標をdx=[-1,0,1], dy=[-1,0,1]を用いて
    # (xx, yy) が　xx = x + dx , yy = y + dy　とできる
    # 参考：http://prd-xxx.hateblo.jp/entry/2017/10/19/205331
    # 入力のグリッドから一点ずつ座標指定して選んでその周囲８マスを調べる。
    H, W = map(int, input().split())
    src = [input() for _ in range(H)]
    ans = []
    for row in src:
        ans.append(list(row))


    dxdy = [(-1,-1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
    for y in range(H):
        for x in range(W):
            if src[y][x] == "#":continue
            c = 0
            for dx, dy in dxdy:
                # 探索範囲はx:0~W, y:0~Hでその周囲８マスを探索する
                if x+dx < 0 or x+dx > W-1 or y+dy < 0 or y+dy > H-1: continue
                if src[y+dy][x+dx] == "#": c += 1
            ans[y][x] = c
    
    for row in ans:
        print("".join(list(map(str, row))))


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
r, g, b = input()

num = r + g + b
num = int(num)

if num % 4== 0:
  print("Yes")
else:
  print("No")


Fixed submission:
r, g, b = input().split(" ")
num = int(r + g + b)
if num % 4 == 0:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):


def main():
    N, K = map(int, input().split())
    res = K * (K -1)**(N-1)

    print(res)

if __name__ == "__main__":
    main()

Fixed submission:


def main():
    # 状態がループする
    A, B, C = map(int, input().split())
    flag = False
    for i in range(1, B+1):
        if i * A % B == C:
            flag = True
    if flag:print("YES")
    else:print("NO")


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from typing import Tuple, List

def main()->None:
    # ヒント見たけど参考にしてない
    N, x = map(int, input().split())
    a:List[int] = list(map(int, input().split()))
    sorted_a:List[int] = sorted(a) # 小さい順にならべる
    count:int = 0 # 何回配ったか
    for d in sorted_a:
        x -= d
        if x < 0: # 持ってた量が配る総量より少なかった時
            break
        count += 1
    # ちょうど配れない、必要な量より多く持ってた時はおおもらう人が出てくる。
    # 幸福人数の最大を求めればいいから余りを全部一人にあげればいいから−１
    if x > 0:
        print(count-1)
    else: # ちょうどの時はcount=N,持ってた量が配る総量より少なかった時は配れた人数
        print(count)

if __name__ == "__main__":
    main()

Fixed submission:


def main()->None:
    # 解説見た
    # 強さを弱い順に並べて、初めからN番目までは各チームの１番弱い人
    # N番から２N番は各チームで２番目に強い人
    N = int(input()) # team数
    a = list(map(int, input().split()))
    sorted_a = sorted(a)
    
    sum_a = 0 # ２番目の人の和
    range_N = range(N)
    for i in range(N):
        sum_a += sorted_a[3*N - 2*i - 2]
    print(sum_a)


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




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(input()) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = t[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = t[i] + K
            passenger = 1

        else:
            if t[i] > start:
                bus += 1
                start = t[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()

Fixed submission:




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(input()) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = T[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = T[i] + K
            passenger = 1

        else:
            if T[i] > start:
                bus += 1
                start = T[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(i) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = t[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = t[i] + K
            passenger = 1

        else:
            if t[i] > start:
                bus += 1
                start = t[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()

Fixed submission:




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(input()) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = T[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = T[i] + K
            passenger = 1

        else:
            if T[i] > start:
                bus += 1
                start = T[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
A = list(map(int,(input().split())))
Asum = 0
c_list = list(itertools.combinations(A, 2))

for l in c_list:
    Asum = Asum + l[0]*l[1]

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

Fixed submission:
N = int(input())
A = list(map(int,(input().split())))
total = 0
result = 0
MOD = pow(10,9)+7
l = []

for i in range(N):
    total += A[i]
    l.append(total)#累積和

for i,num in enumerate(l):
    temp = total-num #A[i+1]+A[i+2]+...+A[N]
    result += temp*A[i]#A[i](A[i+1]+A[i+2]+...+A[N])の総和

print(result%MOD)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
Min,Max = min(x),max(x)
s = [0] * (Max - Min)
k = 0

for i in range(Min,Max):
    for j in x:
        s[k] += (j - i) ** 2
    k += 1
print(min(s)) 

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
Min,Max = min(x),max(x)
if Min == Max:
    print(0)
    exit()
s = [0] * (Max - Min)
k = 0

for i in range(Min,Max):
    for j in x:
        s[k] += (j - i) ** 2
    k += 1
print(min(s))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))
ans = 0

for i in range(n-1):
    if min(p[:i+1]) > p[i+1]:
        ans += 1
print(ans+1)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
ans = 0
Min= float('inf')
for i in range(n-1):
    if Min > p[i]:
        Min = p[i]
    if Min > p[i+1]:
        ans += 1
print(ans+1)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * (m+2)
s = [0] * (m+2)
w_count = 0
a_count = 0
flag = 0
for i in range(m+1):
    p[i],s[i] = input().split()
    if p[i] != p[i-1]:
        flag = 0
    if s[i] == 'AC' and flag == 0:
        flag = 1
        a_count += 1
    elif s[i] == 'WA':
        w_count += 1 and flag == 0
    


print(a_count,w_count)

Fixed submission:
n, m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0] * n
ac_c = [False] * n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == 'AC':
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * m 
s = [0] * m
w_count = 0
a_count = 0

for i in range(m):
    p[i],s[i] = input().split()

p = sorted(set(p))
i = int(p[0])
j = 0

while i != int(p[-1]) + 1:
    if p[j] == i and s[j] == 'WA':
        w_count += 1
    elif p[j] == i and s[j] == 'AC':
        a_count += 1
        i += 1
    j += 1

print(a_count,w_count)

        


Fixed submission:
n, m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0] * n
ac_c = [False] * n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == 'AC':
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
if m ==0:
    print(0,0)
    exit()
p = [0] * m 
s = [0] * m
w_count = 0
a_count = 0

for i in range(m):
    p[i],s[i] = input().split()

p = sorted(set(p))
i = int(p[0])
j = 0

while i != int(p[-1]) + 1:
    if s[j] == 'WA':
        w_count += 1
    elif s[j] == 'AC':
        a_count += 1
        i += 1
    j += 1

print(a_count,w_count)

        


Fixed submission:
n, m = map(int,input().split())
a = [input().split() for i in range(m)]
p = [int(i[0]) for i in a]
q = [j[1] for j in a]

ac = 0
wa = 0
wa_c = [0] * n
ac_c = [False] * n

for t in range(m):
    if ac_c[p[t]-1]:
        continue
    if q[t] == 'AC':
        ac += 1
        ac_c[p[t]-1] = True
        wa += wa_c[p[t]-1]
    else:
        wa_c[p[t]-1] += 1
print(ac,wa)
Buggy python submission (verdict: Runtime Error):
import math 
a,b = map(int,input().split())
gcd = math.gcd(a,b)

if gcd !=1:
    left = 1
    right = 10**5
    while right -left > 1:
        m = (right+left) // 2 
        if  gcd * m < a * b:
            left = m
        else:
            right = m

    print(right)

else:
    print(a*b)

Fixed submission:
import fractions
a,b = map(int,input().split())
gcd = fractions.gcd(a,b)

print(a*b//gcd)
Buggy python submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def main():
    Min = 2000000000000
    divisors = make_divisors(int(input()))
    if len(divisors)%2==1:
        divisors[len(divisors)] = divisors[len(divisors)-1]
    #print(divisors)
    for i in range(0,len(divisors)-1,2):
        Min = min(divisors[i]+divisors[i+1],Min)
    print(Min-2)

main()

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def main():
    Min = 2000000000000
    divisors = make_divisors(int(input()))
    if len(divisors)%2==1:
        divisors.append(divisors[len(divisors)-1])
    #print(divisors)
    for i in range(0,len(divisors)-1,2):
        Min = min(divisors[i]+divisors[i+1],Min)
    print(Min-2)

main()
Buggy python submission (verdict: Runtime Error):
A=input()
B=input()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Fixed submission:
A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Buggy python submission (verdict: Runtime Error):
A = input('A=: ')
B = input('B=: ')

length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Fixed submission:
A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Buggy python submission (verdict: Runtime Error):
A = input('A=: ')
B = input('B=: ')
if not((1<=int(A)<=100) and (1<=int(B)<=100)):
    print("1<=A,B<=100")
    A = input('A=: ')
    B = input('B=: ')

length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Fixed submission:
A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Buggy python submission (verdict: Runtime Error):
A = input('A=: ')
B = input('B=: ')
if not((1<=A<=100) && (1<=B<=100)):
    print("1<=A,B<=100")
    A = input('A=: ')
    B = input('B=: ')

Fixed submission:
A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Buggy python submission (verdict: Runtime Error):
A-2*B

Fixed submission:
A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)

Buggy python submission (verdict: Runtime Error):
A-2B

Fixed submission:
A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()
i = 0
while i != len(S) - 1:
    if S[i] == S[i+1]:
        S = S[:i+1] + S[i+2:]
        i = 0
        continue
    i = i + 1 
print(len(S))

Fixed submission:
N = int(input())
S = input()
i = 0
while i != len(S) - 1:
    if S[i] == S[i+1]:
        S = S[:i] + S[i+1:]
        continue
    i = i + 1 
print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = []
A = [int(input()) for i in range(Q)]

for i in range(N):
    P = K - Q + A.count(i+1)
    if P > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
p = [0] * N 
for i in A:
    p[i-1] += 1    

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')

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

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

for i in range(N):
    P = K - Q + A.count(i+1)
    if P > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
p = [0] * N 
for i in A:
    p[i-1] += 1    

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = []
p = []
for i in range(Q):
    A.append(int((input())))

for i in range(N):
    p.append(A.count(i+1))
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
p = [0] * N 
for i in A:
    p[i-1] += 1    

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = []
p = []
for i in range(Q):
    A.append(int((input())))

for i in range(N):
    p.append(A.count(i+1))
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
p = [0] * N 
for i in A:
    p[i-1] += 1    

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int,input().split())
A = []
p = []
for i in range(Q):
    A.append(int((input())))
    
for i in range(N):
    p.append(A.count(i+1))

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K,Q = map(int,input().split())
A = [int(input()) for i in range(Q)]
p = [0] * N 
for i in A:
    p[i-1] += 1    

for i in range(N):
    P = K - Q + p[i]
    if P > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(n**3)2


Fixed submission:
n = int(input())
print(n**3)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int,input().split()))
count = [0] * len(H)
j = 0
k = 0
for i in range(len(H)-1):
    j = i
    while H[i]>=H[i+1]:
        #print(H[i])
        i += 1 
        k += 1
        if i >=len(H)-1:
            break
    count[j] = k
    k = 0
print(max(count))

Fixed submission:
N = int(input())
H = list(map(int,input().split()))
count = [0] * len(H)
i = 0
k = 0
while i < len(H)-1:
    while H[i]>=H[i+1]:
        i += 1 
        k += 1
        if i >=len(H)-1:
            break
    count[i] = k
    i += 1
    k = 0
print(max(count))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [str(sorted(input())) for i in range(N)]
count = [0]*N
for i in range(N):
    count[i] = s.count(s[0])-1
    s = s[1:]
print(sum(count))

Fixed submission:
import collections

N = int(input())
s = ["".join(sorted(input())) for _ in range(N)]
c = collections.Counter(s)
ans = 0
for si in set(s):
    n = c[si]
    ans += n * (n - 1) // 2
print(ans)