Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())

check = [0] * (n+10)

for i in range(n):
    check[int(input())] += 1

wait = False
time_cnt = 0
people_cnt = 0
ans = 0

for i in range(len(check)):
    if wait == False:
        if check[i] > 0:
            wait = True
            people_cnt += check[i]
            time_cnt = 1
            continue
        else:
            continue
        
    if people_cnt > c:
        ans += people_cnt//c
        people_cnt = people_cnt%c
        time_cnt = 1
        
    
    if time_cnt > k:
        ans += 1
        people_cnt = 0
        time_cnt = 0
        wait = False
    
    people_cnt += check[i]
    time_cnt += 1
else:
    if people_cnt > 0:
        ans += people_cnt//c
    if people_cnt%c > 0:
        ans += 1

print(ans)

Fixed submission:
n, c, k = map(int, input().split())
from collections import deque

t = [int(input()) for _ in range(n)]
t.sort()
t=deque(t)

ans = 1
bus=t[0]+k
cnt = 0

while t:
    i=t.popleft()
    if i>bus:
        bus=i+k
        ans+=1
        cnt=1
    elif cnt==c:
        bus=i+k
        ans+=1
        cnt=1
    else:
        cnt+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

check = [0] * (n+10)

for i in t:
    check[i] += 1

wait = False
time_cnt = 0
people_cnt = 0
ans = 0

for i in range(len(check)):
    if wait == False:
        if check[i] > 0:
            wait = True
            people_cnt += check[i]
            time_cnt = 1
            continue
        else:
            continue
        
    if people_cnt > c:
        ans += people_cnt//c
        people_cnt = people_cnt%c
        time_cnt = 1
        
    
    if time_cnt > k:
        ans += 1
        people_cnt = 0
        time_cnt = 0
        wait = False
    
    people_cnt += check[i]
    time_cnt += 1
else:
    if people_cnt > 0:
        ans += people_cnt//c
    if people_cnt%c > 0:
        ans += 1

print(ans)

Fixed submission:
n, c, k = map(int, input().split())
from collections import deque

t = [int(input()) for _ in range(n)]
t.sort()
t=deque(t)

ans = 1
bus=t[0]+k
cnt = 0

while t:
    i=t.popleft()
    if i>bus:
        bus=i+k
        ans+=1
        cnt=1
    elif cnt==c:
        bus=i+k
        ans+=1
        cnt=1
    else:
        cnt+=1

print(ans)

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

check = [0] * (n+10)

for i in t:
    check[i] += 1

wait = False
time_cnt = 0
people_cnt = 0
ans = 0

for i in range(len(check)):
    if wait == False:
        if check[i] > 0:
            wait = True
            people_cnt += check[i]
            time_cnt = 1
            continue
        else:
            continue
        
    if people_cnt > c:
        ans += people_cnt//c
        people_cnt = people_cnt%c
        time_cnt = 1
        
    
    if time_cnt > k:
        ans += 1
        people_cnt = 0
        time_cnt = 0
        wait = False
    
    people_cnt += check[i]
    time_cnt += 1
else:
    if people_cnt > 0:
        ans += people_cnt//c
    if people_cnt%c > 0:
        ans += 1

print(ans)

Fixed submission:
n, c, k = map(int, input().split())
from collections import deque

t = [int(input()) for _ in range(n)]
t.sort()
t=deque(t)

ans = 1
bus=t[0]+k
cnt = 0

while t:
    i=t.popleft()
    if i>bus:
        bus=i+k
        ans+=1
        cnt=1
    elif cnt==c:
        bus=i+k
        ans+=1
        cnt=1
    else:
        cnt+=1

print(ans)