Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
Alist=list(map(int, input().split()))
for _ in range(M):
    b,c = map(int, input().split())
    Alist+=[c]*b
Alist.sort()
print(sum(Alist[::-1][:N]))

Fixed submission:
N, M = map(int, input().split())
anlist=[]
for a in map(int, input().split()):
    anlist.append([1,a])
for _ in range(M):
    anlist.append(list(map(int, input().split())))
anlist=sorted(anlist, key=lambda x: x[1], reverse=True)
cnt = 0
ans = 0
for b, c in anlist:
    if cnt + b > N:
        ans += c*(N-cnt)
        break
    else:
        ans +=b*c
        cnt += b
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, M = map(int, input().split())
Alist=list(map(int, input().split()))
Alist.sort()
bclist=[]
for _ in range(M):
    bclist.append(list(map(int, input().split())))
bclist=sorted(bclist, key=lambda x: x[1])
bclist.reverse()
for b,c in bclist:
    if c <=Alist[0]:
        break
    index=bisect.bisect_left(Alist,c)
    if index < b:
        Alist=[c]*index+Alist[index:]
    else:
        Alist=Alist[b:index]+[c]*b+Alist[index:]
print(sum(Alist))

Fixed submission:
N, M = map(int, input().split())
anlist=[]
for a in map(int, input().split()):
    anlist.append([1,a])
for _ in range(M):
    anlist.append(list(map(int, input().split())))
anlist=sorted(anlist, key=lambda x: x[1], reverse=True)
cnt = 0
ans = 0
for b, c in anlist:
    if cnt + b > N:
        ans += c*(N-cnt)
        break
    else:
        ans +=b*c
        cnt += b
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N, M = map(int, input().split())
Alist=list(map(int, input().split()))
Alist.sort()
for _ in range(M):
    b, c = map(int, input().split())
    index=bisect.bisect_left(Alist,c)
    if index < b:
        Alist=[c]*index+Alist[index:]
    else:
        Alist=Alist[b:index]+[c]*b+Alist[index:]
print(sum(Alist))

Fixed submission:
N, M = map(int, input().split())
anlist=[]
for a in map(int, input().split()):
    anlist.append([1,a])
for _ in range(M):
    anlist.append(list(map(int, input().split())))
anlist=sorted(anlist, key=lambda x: x[1], reverse=True)
cnt = 0
ans = 0
for b, c in anlist:
    if cnt + b > N:
        ans += c*(N-cnt)
        break
    else:
        ans +=b*c
        cnt += b
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
mod = 10**9+7
ans = 0

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for d in range(1,N):
    ans += d*(N-d)*M**2 % mod
for d in range(1,M):
    ans += d*(M-d)*N**2 % mod
ans *= cmb(N*M-2, K-2, mod) % mod
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
ans=0
mod = 10**9+7 #出力の制限
max = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, max + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
for d in range(1,N):
    ans += d*(N-d)*M**2 % mod
for d in range(1,M):
    ans += d*(M-d)*N**2 % mod
ans = ans*cmb(N*M-2, K-2, mod) % mod
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
mod = 10**9+7
ans = 0
def combination(a,b, mod):
    b = min(b, a-b)
    ans = 1
    for i in range(0,b):
        ans *= (a-i)/(i+1) % mod
    return int(ans)
for d in range(1,N):
    ans += d*(N-d)*M**2 % mod
for d in range(1,M):
    ans += d*(M-d)*N**2 % mod
ans *= combination(N*M-2, K-2, mod) % mod
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
ans=0
mod = 10**9+7 #出力の制限
max = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, max + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
for d in range(1,N):
    ans += d*(N-d)*M**2 % mod
for d in range(1,M):
    ans += d*(M-d)*N**2 % mod
ans = ans*cmb(N*M-2, K-2, mod) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
N = int(input())
Alist = [0]+list(map(int, input().split()))+[0]
Rlist = [0]*(N+2)
Llist = [0]*(N+1)
for i in range(N):
    Llist[i+1] = gcd(Llist[i], Alist[i])
    Rlist[N-i] = gcd(Rlist[N-i+1], Alist[N-i+1])
print(max([gcd(Rlist[i], Llist[i]) for i in range(1,N+1)]))


Fixed submission:
A, B, T = map(int, input().split())
print((T // A ) * B)
Buggy python submission (verdict: Runtime Error):
times = [int(input()) for _ in range(5)]
times1 = []
total = 0
for t in times:
  t1 = t % 10
  if t1 == 0:
    total += t
  else:
    times1.append(t1)
    total += (t//10 + 1) * 10
if len(times) >= 1:
    total = total + min(times1) - 10
print(total)

Fixed submission:
times = [int(input()) for _ in range(5)]
times1 = []
total = 0
for t in times:
  t1 = t % 10
  if t1 == 0:
    total += t
  else:
    times1.append(t1)
    total += (t//10 + 1) * 10
if len(times1) >= 1:
    total = total + min(times1) - 10
print(total)
Buggy python submission (verdict: Runtime Error):
n = int(input())
clist = [int(input()) for _ in range(5)]
cmin = min(clist)
if cmin = 1:
  print(5 + n//cmin + 1)
else:
  print(5 + n//cmin)


Fixed submission:
n = int(input())
clist = [int(input()) for _ in range(5)]
cmin = min(clist)
if cmin == 1:
  print(5 + n//cmin - 1)
else:
  print(5 + n//cmin)
Buggy python submission (verdict: Runtime Error):
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
indexlist = []
for i in range(len(S)-1):
    if S[i] == 'A':
        if S[i+1] == 'C':
            indexlist.append(i)
for LR in LRlist:
    L = LR[0]
    R = LR[1]
    answer = 0
    for i in indexlist:
        if L - 1 <= i:
            if i <= R - 2:
                answer += 1
        elif R - 2 < i:
            break
    print(answer)

Fixed submission:
b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print('C')
else:
    print('G')

Buggy python submission (verdict: Runtime Error):
b = input()
if b == 'A':
    print('C')
elif b == 'C':
    print('A')
elif b == 'G':
    print('T')
else b == 'T':
    print('G')


Fixed submission:
b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print('C')
else:
    print('G')
Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
indexlist = []
for i in range(len(S)-1):
    if S[i] == 'A':
        if S[i+1] == 'C':
            indexlist.append(i)
for LR in LRlist:
    L = LR[0]
    R = LR[1]
    answer = 0
    for i in indexlist:
        if L - 1 <= i and i <= R - 2:
            answer += 1
        elif R - 2 < i:
            break
    print(answer)

Fixed submission:
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0) #t[i]=i文字目までのACのAの数：累積和
for LR in LRlist:
     L = LR[0]
     R = LR[1]
     print(t[R-1] - t[L-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
indexlist = []
for i in range(len(S)-1):
    if S[i] == 'A':
        if S[i+1] == 'C':
            indexlist.append(i)
for LR in LRlist:
    L = LR[0]
    R = LR[1]
    answer = 0
    for i in indexlist:
        if L - 1 <= i <= R - 2:
            answer += 1
        elif R - 2 < i:
            break
    print(answer)

Fixed submission:
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0) #t[i]=i文字目までのACのAの数：累積和
for LR in LRlist:
     L = LR[0]
     R = LR[1]
     print(t[R-1] - t[L-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
indexlist = []
for i in range(len(S)-1):
    if S[i] == 'A':
        if S[i+1] == 'C':
            indexlist.append(i)
for LR in LRlist:
    L = LR[0]
    R = LR[1]
    answer = 0
    for i in indexlist:
        if L - 1 <= i <= R - 2:
            answer += 1
    print(answer)  

Fixed submission:
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
t = [0] * (N + 1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0) #t[i]=i文字目までのACのAの数：累積和
for LR in LRlist:
     L = LR[0]
     R = LR[1]
     print(t[R-1] - t[L-1])
Buggy python submission (verdict: Runtime Error):
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return  False
    return True

def dfs(cur, last3):
    #メモ化
    if last3 in memo[cur]:
        return memo[cur][last3]
    #最後までたどり着いた数列
    if cur == N:
        return 1
    #漸化式計算
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0, 'TTT'))

Fixed submission:
N, MOD = int(input()), 10**9+7
memo = [{} for i in range(N+1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return  False
    return True

def dfs(cur, last3):
    #メモ化
    if last3 in memo[cur]:
        return memo[cur][last3]
    #最後までたどり着いた数列
    if cur == N:
        return 1
    #漸化式計算
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0, 'TTT'))

Buggy python submission (verdict: Runtime Error):
N, MOD = int(input()), 10**9+7
memo = [{} fot i in range(N+1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return  False
    return True

def dfs(cur, last3):
    #メモ化
    if last3 in memo[cur]:
        return memo[cur][last3]
    #最後までたどり着いた数列
    if cur == N:
        return 1
    #漸化式計算
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0, 'TTT'))

Fixed submission:
N, MOD = int(input()), 10**9+7
memo = [{} for i in range(N+1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return  False
    return True

def dfs(cur, last3):
    #メモ化
    if last3 in memo[cur]:
        return memo[cur][last3]
    #最後までたどり着いた数列
    if cur == N:
        return 1
    #漸化式計算
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret

print(dfs(0, 'TTT'))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
if N % 500 =< A:
    print('YES')
else:
    print('NO')


Fixed submission:
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
if N % 500 =< A:
    print('YES')
else:
    print('NO')


Fixed submission:
N = int(input())
A = int(input())
if N % 500 <= A:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import itertools
a1row = np.array(list(map(int,input().split())))
a2row = np.array(list(map(int,input().split())))
a3row = np.array(list(map(int,input().split())))
flag = 'No'
L = list(range(0,101))
for a1,a2,a3 in itertools.product(L,L,L):
    if all(a1row - a1 == a2row - a2) and all(a2row - a2 == a3row - a3):
        flag = 'Yes'
        break
print(flag)


Fixed submission:
import numpy as np
import itertools
a1row = np.array(list(map(int,input().split())))
a2row = np.array(list(map(int,input().split())))
a3row = np.array(list(map(int,input().split())))
amatrix = np.array([a1row,a2row,a3row])
a1a2row = amatrix[0,:]-amatrix[1,:]
a2a3row = amatrix[1,:]-amatrix[2,:]
a1a2col = amatrix[:,0]-amatrix[:,1]
a2a3col = amatrix[:,1]-amatrix[:,2]
flag1 = all(a1a2row == a1a2row[0])
flag2 = all(a2a3row == a2a3row[0])
flag3 = all(a1a2col == a1a2col[0])
flag4 = all(a2a3col == a2a3col[0])
if flag1*flag2*flag3*flag4:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
#バケット法による解
N = int(input())
dlist = []
for i in range(N):
    dlist.append(int(input()))
dbacket = [0]*100
for d in dlist:
    dbacket[d] += 1
answer = 0
for db in dbacket:
    if db > 0:
        answer += 1
print(answer)

Fixed submission:
day = input()
day = day.replace('2017','2018')
print(day)
Buggy python submission (verdict: Runtime Error):
#バケット法による解
N = int(input())
dlist = []
for i in range(N):
    dlist.append(int(input()))
dbacket = [0]*100
for d in dlist:
    dbacket[d] += 1
answer = 0
for db in dbacket:
    if db > 0:
        answer += 1
print(answer)

Fixed submission:
N = int(input())
dlist = []
for i in range(N):
    dlist.append(int(input()))
dset = set(dlist)
print(len(dset))
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
N = a+b
if N % 2 = 0:
    print(N//2)
else:
    print((N+1)//2)


Fixed submission:
a,b = map(int,input().split())
N = a+b
if N % 2 == 0:
    print(N//2)
else:
    print((N+1)//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=A[:]
i=0
while i < N:
    if A[i] % 2 == 0:
        A[i] = A[i]//2
        if i == N - 1:
            B = A[:]
            i = -1
        i += 1
    else:
        break
print(B)


Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=A[:]
i=0
while i < N:
    if A[i] % 2 == 0:
        A[i] = A[i]//2
        print(A[i])
        if i == N - 1:
            B = A[:]
            i = -1
        i += 1
    else:
        break
print(B)

Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int, input().split()))
B=A[:]
i=0
while i < N:
    if A[i] % 2 == 0:
        A[i] = A[i]//2
        print(A[i])
        if i == N - 1:
            B = A[:]
            i = -1
        i += 1
    else:
        break
print(B)

Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
list = list(input())
for i in len(list):
    n = 0:
    if int(list[i]) ==1:
        n += 1
print(n)


Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
list = list(input())
for i in len(list):
    n = 0:
    if int(list[i]) ==1:
        n += 1
print(n)


Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
list = list(input())
for i in len(list):
    n = 0:
    if int(list[i]) ==1:
        n += 1
print(n)


Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
list = list(input())
for i in len(list):
    n = 0:
    if int(list[i]) ==1:
        n =+ 1
print(n)


Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)

Buggy python submission (verdict: Runtime Error):
list = list(input())
for i in len(list):
    n = 0:
    if list[i] ==1:
        n =+ 1
print(n)


Fixed submission:
L = input()
n=0
for i in range(len(L)):
    if int(L[i]) ==1:
        n += 1
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
alist
alistp = alist + 1
alistm = alist - 1
k = []
d = {}
for a in alist:
    if a not in k:
        k.append(a)
        d[a] = 1
    else:
        d[a] += 1
for a in alistp:
    if a not in k:
        k.append(a)
        d[a] = 1
    else:
        d[a] += 1
for a in alistm:
    if a not in k:
        k.append(a)
        d[a] = 1
    else:
        d[a] += 1
print(max(d.values()))

Fixed submission:
import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
alist
alistp = alist + 1
alistm = alist - 1
d = {}
for a in alist:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
for a in alistp:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
for a in alistm:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
print(max(d.values()))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
alist
alistp = alist + 1
alistm = alist - 1
alists = np.hstack([alistm, alist, alistp])
k = []
d = {}
for a in alists:
    if a not in k:
        k.append(a)
        d[a] = 1
    else:
        d[a] += 1
print(max(d.values()))

Fixed submission:
import numpy as np
N = int(input())
alist = np.array(list(map(int, input().split())))
alist
alistp = alist + 1
alistm = alist - 1
d = {}
for a in alist:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
for a in alistp:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
for a in alistm:
    if a not in d.keys():
        d[a] = 1
    else:
        d[a] += 1
print(max(d.values()))
Buggy python submission (verdict: Runtime Error):
S = set(list(input()))
alpha = set([chr(ord('a') + i) for i in range(26)])
answer = alpha - S
L=list(answer)
L.sort()
if len(L) = 0:
    print('None')
else:
    print(L[0])


Fixed submission:
S = set(list(input()))
alpha = set([chr(ord('a') + i) for i in range(26)])
answer = alpha - S
L=list(answer)
if len(L) == 0:
    print('None')
else:
    L.sort()
    print(L[0])

Buggy python submission (verdict: Runtime Error):
S = set(list(input()))
alpha = set([chr(ord('a') + i) for i in range(26)])
answer = alpha - S
L=list(answer)
L.sort()
print(L[0])


Fixed submission:
S = set(list(input()))
alpha = set([chr(ord('a') + i) for i in range(26)])
answer = alpha - S
L=list(answer)
if len(L) == 0:
    print('None')
else:
    L.sort()
    print(L[0])
Buggy python submission (verdict: Runtime Error):
K, N = map(int, input().split())
L = list(map(int, input().split())).sort(reverse=True)
print(sum(L[:K]))


Fixed submission:
N, K = map(int, input().split())
L = list(map(int, input().split()))
L.sort(reverse=True)
print(sum(L[:K]))
Buggy python submission (verdict: Runtime Error):
r,g,b = map(map, input().split())
number=int(r+g+b)
if number % 4 ==0:
    print('YES')
else:
    print('NO')


Fixed submission:
r,g,b = input().split()
number=int(r+g+b)
if number % 4 ==0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 0
while len(T) >　0:
    limit = T[0] + K
    counter = 0
    while counter < C:
        if len(T) == 0:
            break
        if T[0] > limit:
            break
        del T[0]
        counter += 1
    answer += 1
print(answer)

Fixed submission:
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 0
while len(T) > 0:
    limit = T[0] + K
    counter = 0
    while counter < C:
        if len(T) == 0:
            break
        if T[0] > limit:
            break
        del T[0]
        counter += 1
    answer += 1
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
T
answer = 0
while len(T) >0:
    limit = T[0] + K
    counter = 0
    while counter < C:
        if len(T) == 0:
            break
        t = T.pop(0)
        if t > limit:
            T = [t] + T
            break
        counter += 1
    answer += 1
print(answer)

Fixed submission:
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
answer = 0
while len(T) > 0:
    limit = T[0] + K
    counter = 0
    while counter < C:
        if len(T) == 0:
            break
        if T[0] > limit:
            break
        del T[0]
        counter += 1
    answer += 1
print(answer)
Buggy python submission (verdict: Runtime Error):
K,S = map(int,input().split())
print(sum(range(S+1))


Fixed submission:
K, S = map(int, input().split())
answer = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - x - y <= K:
            answer += 1
print(answer)
Buggy python submission (verdict: Runtime Error):
S=list(map(int,list(input())))
def manyformulas(s):
    if len(s)==1:
        return s[0]
    return s[0]*2**(len(s)-2)+manyformulas(s[1:])+manyformulas([s[0]*10+s[1], *s[2:]])
print(manyformulas(S))

Fixed submission:
S=list(map(int,list(input())))
def manyformulas(s):
    if len(s)==1:
        return s[0]
    return s[0]*2**(len(s)-2)+manyformulas(s[1:])+manyformulas([s[0]*10+s[1]]+s[2:])
print(manyformulas(S))
Buggy python submission (verdict: Runtime Error):
N, L = map(int, input().split())
Slist = list(input() for _ in range(N))
print(''.join(Slist.sort()))


Fixed submission:
N, L = map(int, input().split())
Slist = list(input() for _ in range(N))
Slist.sort()
print(''.join(Slist))