Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())
S=list(S)
ans=S.count('R')*S.count('G')*S.count('B')

for i in range(0,N-2):
    for j in range(i+1,N-1):
        k=(j-i)+j
        if k>N-1:
            continue
        if (S[i] != S[j]) and (S[j] != S[k]) and(S[k] != S[i]) :
            ans -= 1
print(ans)

Fixed submission:
N=int(input())
S=str(input())
S=list(S)
ans=S.count('R')*S.count('G')*S.count('B')
for i in range(N): #判定を簡単にするためR:=1,G:=2,B:=4と置き換えておく
    if S[i]=='R':
        S[i]=1
    elif S[i]=='G':
        S[i]=2
    elif S[i]=='B':
        S[i]=4
for i in range(0,N-2):
    for j in range(i+1,N-1):
        k=(j-i)+j
        if k>N-1:
            continue
        if S[i]+S[j]+S[k] == 7 :
            ans -= 1
print(ans)

Buggy python submission (verdict: Runtime Error):
N=int(input())
S=str(input())
S=list(S)
ans=S.count('R')*S.count('G')*S.count('B')

for i in range(0,N-2):
    for j in range(i+1,N-1):
        k=(j-i)+j-1
        if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]) :
            ans -= 1
print(ans)

Fixed submission:
N=int(input())
S=str(input())
S=list(S)
ans=S.count('R')*S.count('G')*S.count('B')
for i in range(N): #判定を簡単にするためR:=1,G:=2,B:=4と置き換えておく
    if S[i]=='R':
        S[i]=1
    elif S[i]=='G':
        S[i]=2
    elif S[i]=='B':
        S[i]=4
for i in range(0,N-2):
    for j in range(i+1,N-1):
        k=(j-i)+j
        if k>N-1:
            continue
        if S[i]+S[j]+S[k] == 7 :
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())
S=list(S)
ans=0
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if (S[i] != S[j]) and (S[j] != S[k]) and (S[k] != S[i]):
                if j-i != k-j:
                    ans += 1
                
print(ans)            

Fixed submission:
N=int(input())
S=str(input())
S=list(S)
ans=S.count('R')*S.count('G')*S.count('B')
for i in range(N): #判定を簡単にするためR:=1,G:=2,B:=4と置き換えておく
    if S[i]=='R':
        S[i]=1
    elif S[i]=='G':
        S[i]=2
    elif S[i]=='B':
        S[i]=4
for i in range(0,N-2):
    for j in range(i+1,N-1):
        k=(j-i)+j
        if k>N-1:
            continue
        if S[i]+S[j]+S[k] == 7 :
            ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
if n<k:
    print(n)
elif n==k:
    print('0')
else:
    a=n-k*(n//k)
    print(min(a,abs(a-k)))

Fixed submission:
x,y,z=map(int,input().split())

p=x
x=y
y=p

p=x
x=z
z=p

print('%s %s %s' %(x,y,z))
Buggy python submission (verdict: Runtime Error):
#A
n=input()
if n%2=0:
    ans=int(n/2)
else:
    ans=int(n/2)+1
print(ans)

Fixed submission:
#A
n=int(input())
if n%2==0:
    ans=int(n/2)
else:
    ans=int(n/2)+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#B
n,k=map(int,input().split())
h_list=list(map(int,input().split()))
h1=abs(h_list[0]-h_list[1])
cst_list=[0,h1]
for i in range(2,n):
    x_list=[]
    for j in range(1,min(i+1,k+1)):
        x=cst_list[i-j]+abs(h_list[i]-h_list[i-j])
        x_list.append(x)
    cst_list.append(min(x_list))
print(cst_list[n-1])    

Fixed submission:
#B
n,k=map(int,input().split())
h_list=list(map(int,input().split()))
h1=abs(h_list[0]-h_list[1])
cst_list=[0,h1]
for i in range(2,n):
    x_list=[]
    for j in range(1,min(i+1,k+1)):
        x=cst_list[i-j]+abs(h_list[i]-h_list[i-j])
        x_list.append(x)
    cst_list.append(min(x_list))
print(cst_list[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
#D
N,W=map(int,input().split())
w_list=[]
v_list=[]

for i in range(N):
    w1,v1=map(int,input().split())
    w_list.append(w1)
    v_list.append(v1)
inf=float("inf")
dp=[[-inf for i in range(W+1)] for j in range(N+1)]
for i in range(W+1): dp[0][i]=0

for i in range(N):
    for w in range(W+1):
        if w_list[i]<=w:
            dp[i+1][w]=max(dp[i][w-w_list[i]]+v_list[i],dp[i][w])
        else:
            dp[i+1][w]=dp[i][w]
print(dp[N][W])

Fixed submission:
#D
N,W=map(int,input().split())
w_list=[]
v_list=[]

for i in range(N):
    w1,v1=map(int,input().split())
    w_list.append(w1)
    v_list.append(v1)
inf=float("inf")
dp=[[-inf for i in range(W+1)] for j in range(N+1)]
for i in range(W+1): dp[0][i]=0

for i in range(N):
    for w in range(W+1):
        if w_list[i]<=w:
            dp[i+1][w]=max(dp[i][w-w_list[i]]+v_list[i],dp[i][w])
        else:
            dp[i+1][w]=dp[i][w]
print(dp[N][W])
Buggy python submission (verdict: Time Limit Exceeded):
# import numpy as np

n = int(input())
a = list(map(int, input().split()))

result = 1

for i in range(0, n):
    result = result * a[i]

# result = np.prod(a)

if result > pow(10, 18):
    result = -1

print(result)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
result = 1

for i in a:
    result = result * i

    # result = np.prod(a)

    if (result > pow(10, 18)):
        result = -1
        break

print(result)

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

n = int(input())
a = list(map(int, input().split()))

# for i in range(0, n):
#     result = result * a[i]

result = np.prod(a)

if result > pow(10, 18):
    result = -1

print(a)
print(result)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
result = 1

for i in a:
    result = result * i

    # result = np.prod(a)

    if (result > pow(10, 18)):
        result = -1
        break

print(result)

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

for i in range(0, n):
    result = result * a[i]
    # print(i)

# print(result)
# print(101*9901*999999000001)
# print(pow(10, 18))

if result > pow(10, 18):
    result = -1

print(result)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
result = 1

for i in a:
    result = result * i

    # result = np.prod(a)

    if (result > pow(10, 18)):
        result = -1
        break

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
# print(n)
List=list(map(int,input().split()))
count = 0
# print(List)
# print(List[1])
for i in range(n):
    # print(List[i])
    count += List.count(List[i])
    # print(count)
if count == n:
    print('YES')
else:
    print('NO')

Fixed submission:
def has_duplicates(seq):
    return len(seq) != len(set(seq))

n =int(input())
List=list(map(int,input().split()))
if has_duplicates(List) == False:
    print('YES')
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
List=list(map(int,input().split()))
newList =[0] * n
count = 0
for i in range(1, n + 1):
    # print(i)
    # print(List[0:i])
    # print(min(List[0:i]))
    newList[i - 1] = min(List[0:i])

# print(newList)
for j in range(n):
    if(List[j] <= newList[j]):
        count = count + 1
print(count)

Fixed submission:
n=int(input())
List=list(map(int,input().split()))
newList =[0] * n
count = 0
min = List[0]
# print(List)
for i in List:
    # 最小値更新
    if i < min:
        min = i
    # カウントする
    if min >= i:
        count = count + 1

print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

# 定義してないリストを参照するとエラーがでるからダミー置いといた。
A.append(100)
C.append(0)

total = 0

total = sum(B)

for i in range(1, N):
    if (A[i] - A[i - 1] == 1):
        total += C[A[i] - 1 - 1]

print(total)

A = list(map(int, input().split()))
print(A)
print(sum(A))


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

A.append(100)
C.append(0)

total = 0

for i in range(0,N):
    if(A[i + 1] - A[i] == 1):
        total += C[A[i] - 1]
    total += B[A[i] - 1]

print(total)
Buggy python submission (verdict: Runtime Error):
import math
a = int(input())
b = int(input())
h = int(input())
m = int(input())
x = (h*60+m)/2  
y = 6*m   
angle = abs(x - y)  
angle = min(360 - angle, angle) 
pi = 3.14159265358979323
k = math.pi/180
if angle==180:
    print(a+b)
    
elif(angle==0):
    print(0.0000000000)
    
else:
    angle = angle*k
    p = math.cos(angle)
    if(p<-1):
        p=0
    ans=pow(a,2)+pow(b,2)- 2*a*b*p;
    ans = math.sqrt(ans);
    print(ans)

Fixed submission:
import math
a,b,h,m = [int(x) for x in input().split()] 
x = (h*60+m)/2  
y = 6*m   
angle = abs(x - y)  
angle = min(360 - angle, angle) 
pi = 3.14159265358979323
k = math.pi/180
if angle==180:
    print(a+b)
    
elif(angle==0):
    print(abs(a-b))
    
else:
    angle = angle*k
    p = math.cos(angle)
    if(p<-1):
        p=0
    ans=pow(a,2)+pow(b,2)- 2*a*b*p;
    ans = math.sqrt(ans);
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)
############################################

allxor=0
for i in range(N):
	#allxor=allxor ^ ds.pop()
	allxor=allxor ^ arr[i]

for i in range(N):
	if i==0 :
		s=str(allxor ^ arr[i])
	else:
		s=s + ' ' + str((allxor ^ arr[i]))

print(s)


Fixed submission:
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)
############################################

allxor=0
for i in range(N):
	#if len(ds)==0:
	#	break
	#allxor=allxor ^ ds.pop()
	allxor=allxor ^ arr[i]

for i in range(N):
	print(allxor ^ arr[i],end='')
	print(' ',end='')

#for i in range(N):
#	if i==0 :
#		s=str(allxor ^ arr[i])
#	else:
#		s=s + ' ' + str((allxor ^ arr[i]))
#print(s)

Buggy python submission (verdict: Runtime Error):
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)
############################################

allxor=0
for i in range(N):
	allxor=allxor ^ ds.pop()

for i in range(N):
	if i==0 :
		s=str(allxor ^ arr[i])
	else:
		s=s + ' ' + str((allxor ^ arr[i]))

print(s)


Fixed submission:
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)
############################################

allxor=0
for i in range(N):
	#if len(ds)==0:
	#	break
	#allxor=allxor ^ ds.pop()
	allxor=allxor ^ arr[i]

for i in range(N):
	print(allxor ^ arr[i],end='')
	print(' ',end='')

#for i in range(N):
#	if i==0 :
#		s=str(allxor ^ arr[i])
#	else:
#		s=s + ' ' + str((allxor ^ arr[i]))
#print(s)

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

allxor=0
for i in range(len(arr)):
	allxor=allxor ^ arr[i]


for i in range(len(arr)):
	if i==0 :
		s=str(allxor ^ arr[i])
	else:
		s=s + ' ' + str((allxor ^ arr[i]))

print(s)


Fixed submission:
N=int(input())
arr = list(map(int,list(input().split())))
ds = set(arr)
############################################

allxor=0
for i in range(N):
	#if len(ds)==0:
	#	break
	#allxor=allxor ^ ds.pop()
	allxor=allxor ^ arr[i]

for i in range(N):
	print(allxor ^ arr[i],end='')
	print(' ',end='')

#for i in range(N):
#	if i==0 :
#		s=str(allxor ^ arr[i])
#	else:
#		s=s + ' ' + str((allxor ^ arr[i]))
#print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = [int(w) for w in input().split()]
la = [int(w) for w in input().split()]

mul = 1
for i in range(k):
    mul *= la[i]

bef = mul

for i in range(k, n):
    mul /= la[i-k]
    mul *= la[i]

    cond = mul > bef
    print("Yes" if cond else "No")

    bef = mul


Fixed submission:
n, k = [int(w) for w in input().split()]
la = [int(w) for w in input().split()]


for i in range(k, n):
    cond = la[i] > la[i-k]
    print("Yes" if cond else "No")

Buggy python submission (verdict: Time Limit Exceeded):
n, k = [int(w) for w in input().split()]
la = [int(w) for w in input().split()]

mul = 1
for i in range(k-1):
    mul *= la[i]


score = [0]*(n-k+1)

for i in range(n-k+1):
    score[i] = mul*la[i+k-1]


for i in range(k-1, n):
    mul *= la[i]
    score[i-k+1] = mul
    mul /= la[i-k+1]

for i in range(1, len(score)):
    cond = score[i] > score[i-1]
    print("Yes" if cond else "No")


Fixed submission:
n, k = [int(w) for w in input().split()]
la = [int(w) for w in input().split()]


for i in range(k, n):
    cond = la[i] > la[i-k]
    print("Yes" if cond else "No")
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            s = x**2+y**2+z**2+x*y+y*z+z*x
            if s <= n+1:
                ans[s] += 1


for i in range(1, n+1):
    print(ans[i])


Fixed submission:
import numpy as np

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            s = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if s < n+1:
                ans[s] += 1


for i in range(1, n+1):
    print(ans[i])

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

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            s = x**2+y**2+z**2+x*y+y*z+z*x
            if s <= 1000:
                ans[s] += 1


for i in range(1, n+1):
    print(ans[i])


Fixed submission:
import numpy as np

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            s = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if s < n+1:
                ans[s] += 1


for i in range(1, n+1):
    print(ans[i])

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

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))


for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            memo[x][y][z] = x**2+y**2+z**2+x*y+y*z+z*x

for i in range(1, (n + 1)):
    print(np.count_nonzero(memo == i))


Fixed submission:
import numpy as np

n = int(input())
max_n = int(n ** 0.5)
memo = np.zeros((max_n, max_n, max_n))

ans = [0]*(n+1)

for x in range(1, max_n):
    for y in range(1, max_n):
        for z in range(1, max_n):
            s = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if s < n+1:
                ans[s] += 1


for i in range(1, n+1):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
def calc_inv(n, mod_n):
    inv_li = [0] * (n + 2)
    inv_li[0] = 0
    inv_li[1] = 1
    for i in range(2, n + 2):
        q, r = divmod(mod_n, i)
        inv_li[i] = -inv_li[r] * q % mod_n
    return inv_li


MOD = 10**9 + 7
inv = calc_inv(max(K, 26) + 10, MOD)

K = int(input())
S = input()
s_len = len(S)


ans = 0
p = pow(26, K, MOD)

for i in range(1, K + 2):
    ans = (ans + p % MOD) % MOD
    p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD

print(ans)


Fixed submission:
def calc_inv(n, mod_n):
    inv_li = [0] * (n + 2)
    inv_li[0] = 0
    inv_li[1] = 1
    for i in range(2, n + 2):
        q, r = divmod(mod_n, i)
        inv_li[i] = -inv_li[r] * q % mod_n
    return inv_li


K = int(input())
S = input()
s_len = len(S)

MOD = 10**9 + 7
inv = calc_inv(max(K, 26) + 10, MOD)

ans = 0
p = pow(26, K, MOD)

for i in range(1, K + 2):
    ans = (ans + p % MOD) % MOD
    p = p * (s_len + i - 1) * inv[i] * 25 * inv[26] % MOD

print(ans)
Buggy python submission (verdict: Runtime Error):
n, m = [int(w) for w in input().split()]
links = [[] for i in range(n + 1)]
ldist = [10 ** 7] * (n + 1)
mark = [10 ** 7] * (n + 1)


def marking(node, dist, parent):
    if dist < ldist[node]:
        ldist[node] = dist
        mark[node] = parent
        for l in links[node]:
            marking(l, dist + 1, node)


for i in range(m):
    a, b = [int(w) for w in input().split()]
    links[a].append(b)
    links[b].append(a)

marking(1, 0, 0)

if 10 ** 7 in mark[2:]:
    print("No")
else:
    print("Yes")
    print("\n".join([str(w) for w in mark[2:]]))


Fixed submission:
from collections import deque

n, m = [int(w) for w in input().split()]
links = [[] for i in range(n + 1)]
mark = [-1] * (n + 1)

for i in range(m):
    a, b = [int(w) for w in input().split()]
    links[a].append(b)
    links[b].append(a)

q = deque([1])
while q:
    now = q.popleft()
    for l in links[now]:
        if mark[l] == -1:
            q.append(l)
            mark[l] = now

if -1 in mark[2:]:
    print("No")
else:
    print("Yes")
    print("\n".join([str(w) for w in mark[2:]]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

unique_list = list()
for _ in range(n):
    s = input()
    if s not in unique_list:
        unique_list.append(s)

print(len(unique_list))


Fixed submission:
n = int(input())

gacha_set = set()
for _ in range(n):
    s = input()
    gacha_set.add(s)

print(len(gacha_set))
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys

n, a, b = [int(w) for w in input().split()]

ans = 0
while n > 0:
    if n >= a:
        n -= a
        ans += a
    else:
        ans += n
        n = 0
    n -= b

print(ans)


Fixed submission:
import math
import sys

n, a, b = [int(w) for w in input().split()]

if a == 0:
    print(0)
    sys.exit()

if a + b >= n:
    print(min(a, n))
    sys.exit()

ans = 0
rep = n // (a + b)

ans += a * rep
n -= (a + b) * rep

ans += (min(a, n))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

cnt_l = [0]*(len(s)+1)
cnt_r = [0]*(len(s)+1)

for i in range(len(s)+1):
    if i == 0:
        cnt_l[i] = 0
    else:
        if s[i-1] == "<":
            cnt_l[i] = cnt_l[i-1] + 1
        else:
            cnt_l[i] = 0

    if i == len(s):
        cnt_r[i] = 0
    else:
        if s[i] == ">":
            j = i
            tr = 0
            while j < len(s) and s[j] == ">":
                tr += 1
                j += 1
            cnt_r[i] = tr
        else:
            cnt_r[i] = 0

ans = 0
for l, r in zip(cnt_l, cnt_r):
    ans += max(l, r)
print(ans)


Fixed submission:
s = input()

cnt_l = [0]*(len(s)+1)
cnt_r = [0]*(len(s)+1)

for i in range(1, len(s)+1):
    if s[i-1] == "<":
        cnt_l[i] = cnt_l[i-1] + 1
    else:
        cnt_l[i] = 0

for i in range(len(s)-1, -1, -1):
    if s[i] == ">":
        cnt_r[i] = cnt_r[i+1]+1
    else:
        cnt_r[i] = 0

ans = 0
for l, r in zip(cnt_l, cnt_r):
    ans += max(l, r)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ll = [int(w) for w in input().split()]
ll.sort(reverse=True)

ans = 0
for ei, i in enumerate(ll):
    for ej, j in enumerate(ll[ei + 1:]):
        ans += len([w for w in ll[ei + ej + 2:] if w > i - j])

print(ans)


Fixed submission:
import bisect

n = int(input())
ll = [int(w) for w in input().split()]
ll.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(ll, ll[i] + ll[j]) - (j + 1)

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
ll = [int(w) for w in input().split()]
ll.sort(reverse=True)

ans = 0
for ei, i in enumerate(ll):
    for ej, j in enumerate(ll[ei + 1:]):
        ans += len([w for w in ll[ei + ej + 2] if w > i - j])

print(ans)


Fixed submission:
import bisect

n = int(input())
ll = [int(w) for w in input().split()]
ll.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(ll, ll[i] + ll[j]) - (j + 1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ll = [int(w) for w in input().split()]
ll.sort(reverse=True)

ans = 0
for ei, i in enumerate(ll):
    for ej, j in enumerate(ll[ei + 1:]):
        for k in ll[ei + ej + 2:]:
            if i < (j + k):
                ans += 1
            else:
                break


print(ans)


Fixed submission:
import bisect

n = int(input())
ll = [int(w) for w in input().split()]
ll.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(ll, ll[i] + ll[j]) - (j + 1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ll = [int(w) for w in input().split()]
ll.sort(reverse=True)

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if ll[i] < (ll[j] + ll[k]):
                ans += 1
            else:
                break


print(ans)


Fixed submission:
import bisect

n = int(input())
ll = [int(w) for w in input().split()]
ll.sort()

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(ll, ll[i] + ll[j]) - (j + 1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n, k, q = [int(w) for w in input().split()]

score = [k] * n

for i in range(q):
    a = int(input())
    score = [w - 1 for w in score]
    score[a - 1] += 1

for s in score:
    cond = s > 0
    print("Yes" if cond else "No")


Fixed submission:
import sys
input = sys.stdin.readline

n, k, q = [int(w) for w in input().split()]


score = [0] * n

for i in range(q):
    a = int(input())
    score[a - 1] += 1


for s in score:
    print('Yes' if s + k - q > 0 else 'No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(range(n))
print(sum(l))


Fixed submission:
n = int(input())
s = (n*(n-1))//2
print(s)
Buggy python submission (verdict: Runtime Error):
import math
n, x = [int(w) for w in input().split()]
la = [int(w)-x for w in input().split()]
la.sort()
if la[0] < 0:
    m = la[0]
    la = [w+m for w in la]

diff = [0]*(n-1)
for i in range(n-1):
    diff[i] = la[i+1]-la[i-1]

g = diff[0]
for i in diff[1:]:
    g = math.gcd(g, i)

print(g)


Fixed submission:
import math
n, x = [int(w) for w in input().split()]
la = [int(w) for w in input().split()]+[x]
la.sort()
if la[0] < 0:
    m = la[0]
    la = [w+m for w in la]

diff = [0]*n
for i in range(n):
    diff[i] = la[i+1]-la[i]
g = diff[0]
for i in diff[1:]:
    g = math.gcd(g, i)

print(g)
Buggy python submission (verdict: Runtime Error):
import math

#least multi
def lm(a,b):
    return a*b // math.gcd(a,b)

N =input()
list = input().split(" ")
int_li = [int(s) for s in list]

m = 1
for i in int_li:
    m = lm(m,i)
m-=1

ans = 0
for i in int_li:
    ans += m%i

print(ans);


Fixed submission:
def gcd(a, b):
    a,b = min(a,b),max(a,b)
    while b:
	    a, b = b, a % b
    return a

#least multi
def lm(a,b):
    return a*b // gcd(a,b)

N =input()
list = input().split(" ")
int_li = [int(s) for s in list]

m = 1
for i in int_li:

    m = lm(m,i)
m-=1

ans = 0
for i in int_li:
    ans += m%i

print(ans);
Buggy python submission (verdict: Runtime Error):
import collections
s = input()


cnt = collections.Counter(s)
used = set(cnt.keys())
c = -1
if len(used) < 26:
    for i in range(26):
        if not chr(i+ord("a")) in used:
            c = chr(i+ord("a"))
            break
if c != -1:
    print(s+c)
else:
    i = 25
    while s[i-1] > s[i]:
        i -= 1
        lused = sorted(s[i-1:])
        print(s[:i-1]+lused[lused.index(s[i-1])+1])
        break
    else:
        print("-1")


Fixed submission:
import collections
s = input()


cnt = collections.Counter(s)
used = set(cnt.keys())
c = -1
if len(used) < 26:
    for i in range(26):
        if not chr(i+ord("a")) in used:
            c = chr(i+ord("a"))
            break
if c != -1:
    print(s+c)
else:
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print("-1")
        exit()
    i = 25
    while i > 1 and s[i-1] > s[i]:
        i -= 1
    lused = sorted(s[i-1:])
    print(s[:i-1]+lused[lused.index(s[i-1])+1])
Buggy python submission (verdict: Runtime Error):
5
30 44
26
18
81
18
6

Fixed submission:
import sys
input = sys.stdin.readline

n = int(input())
d, x = [int(w) for w in input().split()]

ans = x
for i in range(n):
    a = int(input())
    ans += 1 + (d - 1) // a
print(ans)
Buggy python submission (verdict: Runtime Error):
31415 92653

Fixed submission:
a, b = [int(w) for w in input().split()]

ans = 0
for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        ans += 1
print(ans)