Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()])
#print(H)

for i in range(K):
	H.pop((N-1)-i)

#print(H)

print(sum(H))

Fixed submission:
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()])
#print(H)

if N<K:
	K=N

for i in range(K):
	H.pop((N-1)-i)

#print(H)

print(sum(H))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())

If N==M :
	print("Yes")
else :
	print("No")

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

if N == M :
	print("Yes")
else :
	print("No")
Buggy python submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
theta=0

if x<=a**2*b/2:
	theta=math.degrees(math.atan(2*x/(a*b**2)))
else:
	theta=math.degrees(math.atan(a**3/(2*(a**2*b-x))))

print(90-theta)

Fixed submission:
import math
a,b,x=map(int,input().split())
theta=0

if x<=a**2*b/2:
	theta=math.degrees(math.atan(a*b**2/(2*x)))
else:
	theta=math.degrees(math.atan(2*(a**2*b-x)/a**3))

print(theta)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N=int(input())
L=[int(x) for x in input().split()]
L0=copy.copy(L)
L.sort()
Ans=[]

for i in range(N):
	for j in range(N):
		if L[i]==L0[j]:
			Ans.append(j+1)

print(' '.join(map(str, Ans)))

Fixed submission:
import copy
N=int(input())
L=[int(x) for x in input().split()]
Ans=[0]*N

for i in range(N):
	Ans[L[i]-1]=i+1

print(' '.join(map(str, Ans)))
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()))
ans=0
j=0

for i in range(N):
	ans+=B[A[i]-1]
	if A[i]-j==1 and i>=1:
		ans+=C[j-1]
	j=A[i]

print(ans)

Fixed submission:
n=int(input())
print(n**3)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a=[0]*N
b=[0]*N
c=[0]*N

for i in range(N):
	a[i],b[i],c[i]=map(int,input().split())

dp=[[0 for j in range(3)] for k in range(N)]

for l in range(N):
	if l==0:
		dp[0][l]=a[l]
		dp[1][l]=b[l]
		dp[2][l]=c[l]
	else:
		dp[0][l]=max(dp[1][l-1],dp[2][l-1])+a[l]
		dp[1][l]=max(dp[0][l-1],dp[2][l-1])+b[l]
		dp[2][l]=max(dp[0][l-1],dp[1][l-1])+c[l]

print(max(dp[0][N-1],dp[1][N-1],dp[2][N-1]))

Fixed submission:
N=int(input())
a=[0]*N
b=[0]*N
c=[0]*N

for i in range(N):
	a[i],b[i],c[i]=map(int,input().split())

dp=[[0 for j in range(N)] for k in range(3)]

for l in range(N):
	if l==0:
		dp[0][l]=a[l]
		dp[1][l]=b[l]
		dp[2][l]=c[l]
	else:
		dp[0][l]=max(dp[1][l-1],dp[2][l-1])+a[l]
		dp[1][l]=max(dp[0][l-1],dp[2][l-1])+b[l]
		dp[2][l]=max(dp[0][l-1],dp[1][l-1])+c[l]

print(max(dp[0][N-1],dp[1][N-1],dp[2][N-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from numpy.fft import rfft, irfft
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
X = np.zeros(10**5+1)
l = 2*(10**5)+10
for i in range(N):
    X[A[i]] += 1
data = irfft(rfft(X, l)**2 )
num = 0
ans = 0
for i in range(len(data) -1 ,0,-1):
    if int(round(data[i])) != 0:
        if num + int(round(data[i])) >= M:
            ans += (M - num) * i
            break
        else:
            ans += int(round(data[i]))*i
            num += int(round(data[i]))
print(ans)

Fixed submission:
import bisect
N, M = list(map(int,input().split()))
data = list(map(int,input().split()))
data.sort()
def cost(x):
    re = 0
    for i in range(N):
        idx = bisect.bisect_left(data,x - data[i])
        re += N - idx
    return re
#binery_search
lb = 0
ub = 2*max(data) + 1
while ub - lb > 1:
    mid = (ub+lb)//2
    if cost(mid) >= M:
        lb = mid
    else:
        ub = mid
ans = 0 - (cost(lb) - M)* lb
cum_data = [0]*(N+1)
for i in range(1,N+1):
    cum_data[i] = cum_data[i -1] + data[i-1]
data_idx = [0]*N
for i in range(N):
    idx = bisect.bisect_left(data,lb - data[i])
    data_idx[i] = idx
for i in range(N):
    ans += (N - data_idx[i]) * data[i]
    ans += cum_data[N] - cum_data[data_idx[i]]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from numpy.fft import rfft, irfft
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
X = np.zeros(10**5+1)
l = 2*(10**5)+10
for i in range(N):
    X[A[i]] += 1
data = irfft(rfft(X, l) * rfft(X, l))
num = 0
ans = 0
for i in range(len(data) -1 ,0,-1):
    if int(round(data[i])) != 0:
        if num + int(round(data[i])) >= M:
            ans += (M - num) * i
            break
        else:
            ans += int(round(data[i]))*i
            num += int(round(data[i]))
print(ans)

Fixed submission:
import bisect
N, M = list(map(int,input().split()))
data = list(map(int,input().split()))
data.sort()
def cost(x):
    re = 0
    for i in range(N):
        idx = bisect.bisect_left(data,x - data[i])
        re += N - idx
    return re
#binery_search
lb = 0
ub = 2*max(data) + 1
while ub - lb > 1:
    mid = (ub+lb)//2
    if cost(mid) >= M:
        lb = mid
    else:
        ub = mid
ans = 0 - (cost(lb) - M)* lb
cum_data = [0]*(N+1)
for i in range(1,N+1):
    cum_data[i] = cum_data[i -1] + data[i-1]
data_idx = [0]*N
for i in range(N):
    idx = bisect.bisect_left(data,lb - data[i])
    data_idx[i] = idx
for i in range(N):
    ans += (N - data_idx[i]) * data[i]
    ans += cum_data[N] - cum_data[data_idx[i]]
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
data_xy = []
for i in range(N):
    A = int(input())
    xy = []
    for i in range(A):
        [x,y] = list(map(int,input().split()))
        xy.append([x-1, y])
    data_xy.append(xy)
data_xy = np.array(data_xy,dtype=np.int64)
ans = 0
for i in range(2**N):
    p_list = [0]*N
    for j in range(N):
        if (i>>j) & 1 == 1:
            p_list[j] = 1
    flag = True
    for j in range(N):
        if p_list[j] == 1:
            for k in range(len(data_xy[j])):
                x = data_xy[j][k][0]
                y = data_xy[j][k][1]
                if p_list[x] != y:
                    flag = False
    if flag == True:
        ans = max(sum(p_list),ans)
print(ans)

Fixed submission:
A = list(map(int,input().split()))
if sum(A) >= 22:
    print('bust')
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
data_xy = []
for i in range(N):
    A = int(input())
    xy = []
    for i in range(A):
        [x,y] = list(map(int,input().split()))
        xy.append([x-1, y])
    data_xy.append(xy)
ans = 0
for i in range(2**N):
    p_list = [0]*N
    for j in range(N):
        if (i>>j) & 1 == 1:
            p_list[j] = 1
    flag = True
    for j in range(N):
        if p_list[j] == 1:
            for k in range(len(data_xy[j])):
                x = data_xy[j][k][0]
                y = data_xy[j][k][1]
                if p_list[x] != y:
                    flag = False
    if flag == True:
        ans = max(sum(p_list),ans)
print(ans)

Fixed submission:
A = list(map(int,input().split()))
if sum(A) >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
data_xy = []
for i in range(N):
    A = int(input())
    xy = []
    for i in range(A):
        [x,y] = list(map(int,input().split()))
        xy.append([x-1, y])
    data_xy.append(xy)
data_xy = np.array(data_xy,dtype=np.int64)
ans = 0
for i in range(2**N):
    p_list = np.zeros(N,dtype=np.int64)
    for j in range(N):
        if (i>>j) & 1 == 1:
            p_list[j] = 1
    flag = True
    for j in range(N):
        if p_list[j] == 1:
            for k in range(len(data_xy[j])):
                x = data_xy[j][k][0]
                y = data_xy[j][k][1]
                if p_list[x] != y:
                    flag = False
    if flag == True:
        ans = max(sum(p_list),ans)
print(ans)

Fixed submission:
N = int(input())
syougen = [[] for i in range(N)]
for i in range(N):
    a_tmp = int(input())
    for j in range(a_tmp):
        [x, y] = list(map(int,input().split()))
        syougen[i].append([x-1,y])
ans = 0
for i in range(2**N):
    data = [0]*N
    for j in range(N):
        if ((i >> j) & 1):
            data[j] = 1
    flag = True
    for k in range(N):
        if data[k] == 1:
            for l in range(len(syougen[k])):
                x = syougen[k][l][0]
                y = syougen[k][l][1]
                if data[x] != y:
                    flag = False
    if flag:
        ans = max(ans,sum(data))
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
data_xy = []
for i in range(N):
    A = int(input())
    xy = []
    for i in range(A):
        [x,y] = list(map(int,input().split()))
        xy.append([x-1, y])
    data_xy.append(xy)
data_xy = np.array(data_xy,dtype=np.int64)
ans = 0
for i in range(2**N):
    p_list = np.zeros(N,dtype=np.int64)
    for j in range(N):
        if (i>>j) & 1 == 1:
            p_list[j] = 1
    flag = True
    for j in range(N):
        if p_list[j] == 1:
            for k in range(len(data_xy[j])):
                x = data_xy[j][k][0]
                y = data_xy[j][k][1]
                if p_list[x] != y:
                    flag = False
    if flag == True:
        ans = max(sum(p_list),ans)
print(ans)

Fixed submission:
N = int(input())
syougen = [[] for i in range(N)]
for i in range(N):
    a_tmp = int(input())
    for j in range(a_tmp):
        [x, y] = list(map(int,input().split()))
        syougen[i].append([x-1,y])
ans = 0
for i in range(2**N):
    data = [0]*N
    for j in range(N):
        if ((i >> j) & 1):
            data[j] = 1
    flag = True
    for k in range(N):
        if data[k] == 1:
            for l in range(len(syougen[k])):
                x = syougen[k][l][0]
                y = syougen[k][l][1]
                if data[x] != y:
                    flag = False
    if flag:
        ans = max(ans,sum(data))
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
import heapq
A,B = list(map(int,input().split()))
GCD = math.gcd(A,B)
CD = []
for i in range(1,int(GCD**(0.5))+1):
    if GCD % i == 0:
        CD.append(i)
        if not i == GCD//i:
            CD.append(GCD//i)
CD.sort()
ans = 1
tmp_idx = 0
CD.pop(0)
CD_old = CD[:]
while (len(CD_old)>0):
    tmp = CD_old.pop(0)
    CD_new = []
    for i in range(len(CD_old)):
        if not CD_old[i] % tmp == 0:
            CD_new.append(CD_old[i])
    ans += 1
    CD_old = CD_new
print(ans)

Fixed submission:
def gcd(a,b):
    while b != 0:
        a,b = b,a%b
    return a

A,B = list(map(int,input().split()))
GCD = gcd(A,B)
CD = []
for i in range(1,int(GCD**(0.5))+1):
    if GCD % i == 0:
        CD.append(i)
        if not i == GCD//i:
            CD.append(GCD//i)
CD.sort()
ans = 1
tmp_idx = 0
CD.pop(0)
CD_old = CD[:]
while (len(CD_old)>0):
    tmp = CD_old.pop(0)
    CD_new = []
    for i in range(len(CD_old)):
        if not CD_old[i] % tmp == 0:
            CD_new.append(CD_old[i])
    ans += 1
    CD_old = CD_new
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
S = [0]*len(s)
for i in range(len(s)):
    S[i] = int(s[i])
# 0:-, 1:+
for i in range(2**len(op)):
    op = [0]*(len(S) - 1)
    for j in range(len(op)):
        if (i >> j & 1):
            op[j] = 1
    tmp = S[0]
    for j in range(len(op)):
        if op[j] == 0:
            tmp -= S[j+1]
        else:
            tmp += S[j+1]
    if tmp == 7:
        ans = op[:]
ans_str = s[0]
for i in range(len(S)-1):
    if ans[i] == 0:
        ans_str = ans_str + "-"
    else:
        ans_str = ans_str + "+"
    ans_str = ans_str + s[i+1]
ans_str = ans_str + "=7"
print(ans_str)

Fixed submission:
s = input()
S = [0]*len(s)
for i in range(len(s)):
    S[i] = int(s[i])

# 0:-, 1:+
op = [0]*(len(S) - 1)
for i in range(2**len(op)):
    op = [0]*(len(S) - 1)
    for j in range(len(op)):
        if (i >> j & 1):
            op[j] = 1
    tmp = S[0]
    for j in range(len(op)):
        if op[j] == 0:
            tmp -= S[j+1]
        else:
            tmp += S[j+1]
    if tmp == 7:
        ans = op[:]
ans_str = s[0]
for i in range(len(S)-1):
    if ans[i] == 0:
        ans_str = ans_str + "-"
    else:
        ans_str = ans_str + "+"
    ans_str = ans_str + s[i+1]
ans_str = ans_str + "=7"
print(ans_str)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N,Q = map(int, input().split())
ki = [[] for i in range(N+1)]
val = [0 for _ in range(N+1)]
 
for _ in range(N-1):
    a,b = map(int, input().split())
    ki[a].append(b)
for _ in range(Q):
    p,x = map(int, input().split())
    val[p] += x

touched = []
def add_num(p):
  touched.append(p)
  for k in ki[p]:
    if (k!=p)&(k not in touched):
      val[k] += val[p]
      add_num(k)

add_num(1)
print(*val[1:])

Fixed submission:
N,Q = map(int, input().split())
ki = [[] for i in range(N+1)]
val = [0 for _ in range(N+1)]

for _ in range(N-1):
  a,b = map(int, input().split())
  ki[a].append(b)
  ki[b].append(a)
for _ in range(Q):
  p,x = map(int, input().split())
  val[p] += x

q = [(1,0)]
while q:
  c,p = q.pop()
  val[c] += val[p]
  for x in ki[c]:
    if x==p:
      continue
    q.append((x,c))
print(' '.join(map(str, val[1:])))

Buggy python submission (verdict: Runtime Error):
def search_add_num(p,x):
    for k in ki[p]:
        if k!=p:
            search_add_num(k,x)
        else:
            k_values[p] += x
N,Q = map(int, input().split())
ki = [[i] for i in range(N+1)]
k_values = [0 for _ in range(N+1)]

for _ in range(N-1):
    a,b = map(int, input().split())
    ki[a].append(b)
for _ in range(Q):
    p,x = map(int, input().split())
    search_add_num(p,x)
print(' '.join(map(str, k_values[1:])))

Fixed submission:
N,Q = map(int, input().split())
ki = [[] for i in range(N+1)]
val = [0 for _ in range(N+1)]

for _ in range(N-1):
  a,b = map(int, input().split())
  ki[a].append(b)
  ki[b].append(a)
for _ in range(Q):
  p,x = map(int, input().split())
  val[p] += x

q = [(1,0)]
while q:
  c,p = q.pop()
  val[c] += val[p]
  for x in ki[c]:
    if x==p:
      continue
    q.append((x,c))
print(' '.join(map(str, val[1:])))
Buggy python submission (verdict: Runtime Error):
S = input()
S = list(S.replace('RL', '11'))
lp,rp = 0,0
for i,s in enumerate(S):
    #l並びが終わったとき
    if (lp>0)&(!='L'):
        S[i-lp-1] = int(S[i-lp-1])+lp//2
        S[i-lp-2] = int(S[i-lp-2])+lp-lp//2
        lp = 0
    #最後がL(RLで11になっていない)
    if (i==len(S)-1)&(s=='L'):
        lp += 1
        S[i] = 0
        S[i-lp] = int(S[i-lp])+lp//2
        S[i-lp-1] = int(S[i-lp-1])+lp-lp//2
    elif s=='L':
        lp += 1
        S[i] = 0
    elif s=='R':
        rp += 1
        S[i] = 0
    #R並びが終わったとき
    elif rp>0:
        S[i] = int(S[i+1]) + rp//2
        S[i+1] = int(s) + rp-rp//2
        rp = 0
print(' '.join(map(str, S)))

Fixed submission:
S = input()
S = list(S.replace('RL', '11'))
lp,rp = 0,0
for i,s in enumerate(S):
    #l並びが終わったとき
    if (lp>0)&(s!='L'):
        S[i-lp-1] = int(S[i-lp-1])+lp//2
        S[i-lp-2] = int(S[i-lp-2])+lp-lp//2
        lp = 0
    #最後がL(RLで11になっていない)
    if (i==len(S)-1)&(s=='L'):
        lp += 1
        S[i] = 0
        S[i-lp] = int(S[i-lp])+lp//2
        S[i-lp-1] = int(S[i-lp-1])+lp-lp//2
    elif s=='L':
        lp += 1
        S[i] = 0
    elif s=='R':
        rp += 1
        S[i] = 0
    #R並びが終わったとき
    elif rp>0:
        S[i] = int(S[i+1]) + rp//2
        S[i+1] = int(s) + rp-rp//2
        rp = 0
print(' '.join(map(str, S)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
A_max = max(A)
for a in A:
    if a==A_max:
        print(sorted(A)[-2])
    else:
        print(A_max)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
A_max = max(A)
A_max2 = sorted(A)[-2]
for a in A:
    if a==A_max:
        print(A_max2)
    else:
        print(A_max)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
for _ in range(q):
  first, last = map(int, input().split())
  print(s[first-1:last].count("AC"))

Fixed submission:
print('ATCG'['TAGC'.find(input())])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
s = input()
for _ in range(q):
  first, last = map(int, input().split())
  print(s[first-1:last].count("AC"))

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

n, q = map(int, input().split())
s = input()
ac_list = [0]

for i in range(1, n):
  if s[i-1:i+1] == 'AC':
    ac_list.append(ac_list[i-1]+1)
  else:
    ac_list.append(ac_list[i-1])

for _ in range(q):
  first, last = map(int, input().split())
  print(ac_list[last-1] - ac_list[first-1])

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

n, q = map(int, input().split())
s = input()
for _ in range(q):
  first, last = map(int, input().split())
  print(s[first-1:last].count("AC"))

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

n, q = map(int, input().split())
s = input()
ac_list = [0]

for i in range(1, n):
  if s[i-1:i+1] == 'AC':
    ac_list.append(ac_list[i-1]+1)
  else:
    ac_list.append(ac_list[i-1])

for _ in range(q):
  first, last = map(int, input().split())
  print(ac_list[last-1] - ac_list[first-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for _ in range(q):
  first, last = map(int, input().split())
  print(s[first-1:last].count("AC"))

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

n, q = map(int, input().split())
s = input()
ac_list = [0]

for i in range(1, n):
  if s[i-1:i+1] == 'AC':
    ac_list.append(ac_list[i-1]+1)
  else:
    ac_list.append(ac_list[i-1])

for _ in range(q):
  first, last = map(int, input().split())
  print(ac_list[last-1] - ac_list[first-1])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab = []
for _ in range(n):
  a, b = map(int, input().split())
  ab.extend([a for _ in range(b)])
  
ab.sort()
print(sum(ab[:m]))

Fixed submission:
n,m,*t = map(int, open(0).read().split())
ans = 0
for a, b in sorted(zip(t[::2], t[1::2])):
  ans += min(b, m)*a
  m -= b
  if m <= 0:
    print(ans)
    break
Buggy python submission (verdict: Runtime Error):
a,b = int(input())
if a*b%2 == 0:
	print("Even")
else:
  	print("Odd")
  

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

if a*b%2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
import collections
n, k = map(int, input().split())
a = map(int, input().split())
c = collections.Counter(a)

if len(c) <= k:
  print(0)
else:
  c = c.most_common()
  print(sum(c[:k-1][0]))

Fixed submission:
str = list(input())
c = 0
for s in str:
 c += int(s)
print(c)
Buggy python submission (verdict: Runtime Error):
import collections
n, k = map(int, input().split())
a = map(int, input().split())
c = collections.Counter(a)

if len(c) <= K:
  print(0)
else:
  c = c.most_common()
  print(sum(c[:K-1][0]))

Fixed submission:
from collections import Counter 
n,k = map(int, input().split())
a = list(map(int, input().split()))
ct = sorted(list(Counter(a).values()), reverse=True)
print(sum(ct[k:]))

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
dic = list(set(A))

if len(dic) <= K:
  print(0)
else:
  count_list = []
  for i in range(len(dic)):
    count_list.append(A.count(dic[i]))
  
  count_list.sort()
  print(sum(count_list[:len(dic)-K]))

Fixed submission:
from collections import Counter 
n,k = map(int, input().split())
a = list(map(int, input().split()))
ct = sorted(list(Counter(a).values()), reverse=True)
print(sum(ct[k:]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
temp = N
while temp > 0:
  test += temp %10
  temp //= 10
if N % test == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
temp = N
test = 0
while temp > 0:
  test += temp %10
  temp //= 10
if N % test == 0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
temp = N
while temp > 0:
  test += temp %10
  temp //= 10
if N % test == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
temp = N
test = 0
while temp > 0:
  test += temp %10
  temp //= 10
if N % test == 0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, c, k = map(int, input().split())
t = []
for i in range(n):
  t.append(int(input()))
t.sort()
result = 1
count = 0

for i in range(n):
  if (t[count] - t[0]) > k or c == count:
    result += 1
    t = t[count:]
    count = 1
  else:
    count += 1
print(result)

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

result = 1
count = 0
f = 0

for i in range(n):
  if (t[i] - t[f]) > k or c == count:
    result += 1
    count = 1
    f = i
  else:
    count += 1
print(result)

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = []
for i in range(n):
  t.append(int(input()))
t.sort()
result = 1
j = 0

for i in range(n):
  if (t[j] - t[0]) > k or c == count:
    result += 1
    t = t[j:]
    j = 1
  else:
    j += 1
print(result)

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

result = 1
count = 0
f = 0

for i in range(n):
  if (t[i] - t[f]) > k or c == count:
    result += 1
    count = 1
    f = i
  else:
    count += 1
print(result)
Buggy python submission (verdict: Runtime Error):
import sys
sys.stdin.readline()
count = 0
a_list = list(map(int, sys.stdin.readline().split()))
for a in x_list:
  count += a%2

print("YES") if count%2==0 else print("NO")

Fixed submission:
import sys
input()
count = 0
a_list = list(map(int, input().split()))
for a in a_list:
  count += a%2

print("YES") if count%2==0 else print("NO")

Buggy python submission (verdict: Runtime Error):
import sys
input_ = sys.stdin.readline
input_()
x_list = list(map(int, input_().split()))
for x in x_list:
  if x%2==0:
    a += 1

if a%2==0:
  print("YES")
else:
  print("NO")

Fixed submission:
import sys
input()
count = 0
a_list = list(map(int, input().split()))
for a in a_list:
  count += a%2

print("YES") if count%2==0 else print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()[::-1]

while True:
  if s[:5] == "maerd":
    s = s[5:]
  elif s[:7] == "remaerd":
    s - s[7:]
  elif s[:5] == "esare":
    s = s[5:]
  elif s[:6] == "resare":
    s - s[6:]
  else:
    break

if s == "":
  print("YES")
else:
  print("NO")

Fixed submission:
#C - 白昼夢 / Daydream

s = input()[::-1]

while True:
  if s[:5] == "maerd":
    s = s[5:]
  elif s[:7] == "remaerd":
    s = s[7:]
  elif s[:5] == "esare":
    s = s[5:]
  elif s[:6] == "resare":
    s = s[6:]
  else:
    break

if s == "":
  print("YES")
else:
  print("NO")