Problem:
 Score : 300 points    Problem Statement Every day, N passengers arrive at Takahashi Airport.
The i -th passenger arrives at time T_i .  Every passenger arrived at Takahashi airport travels to the city by bus. Each bus can accommodate up to C passengers.
Naturally, a passenger cannot take a bus that departs earlier than the airplane arrives at the airport.
Also, a passenger will get angry if he/she is still unable to take a bus K units of time after the arrival of the airplane.
For that reason, it is necessary to arrange buses so that the i -th passenger can take a bus departing at time between T_i and T_i + K (inclusive).  When setting the departure times for buses under this condition, find the minimum required number of buses.
Here, the departure time for each bus does not need to be an integer, and there may be multiple buses that depart at the same time.      Constraints  2 \leq N \leq 100000  1 \leq C \leq 10^9  1 \leq K \leq 10^9  1 \leq T_i \leq 10^9  C , K and T_i are integers.         Input The input is given from Standard Input in the following format:  N  C  K  T_1  T_2  :  T_N       Output Print the minimum required number of buses.        Sample Input 1 5 3 5
1
2
3
6
12      Sample Output 1 3  For example, the following three buses are enough:   A bus departing at time 4.5 , that carries the passengers arriving at time 2 and 3 .  A bus departing at time 6 , that carries the passengers arriving at time 1 and 6 .  A bus departing at time 12 , that carries the passenger arriving at time 12 .        Sample Input 2 6 3 3
7
6
2
8
10
6      Sample Output 2 3

Solution (Python):
N, C, K = map(int,input().split())
T = []
for _ in range(N):
    T.append(int(input()))
T.sort()

ans = 0
i = 0
while i < N:
    t = T[i] + K
    j = 0
    while i + j < N and T[i+j] <= t and j < C:
        j += 1
    ans += 1
    i += j
print(ans)

Solution (Python):
from collections import deque

def solve():
	n,c,k,*t = map(int,open(0).read().split())
	d = deque(sorted(t)+[float("inf")])
	fir = d[0]
	cnt = ans = 0
	while d:
		if d[0]-fir <= k:
			del d[0]
			cnt += 1
			if cnt == c:
				fir = d[0]
				cnt = 0
				ans += 1
		else:
			fir = d.popleft()
			cnt = 1
			ans += 1
	print(ans-(c==1))

	
if __name__=="__main__":
	solve()

Solution (Python):
from collections import deque
n,c,k,*t = map(int,open(0).read().split())
d = deque(sorted(t)+[float("inf")])
f = d[0]
cnt = ans = 0
while d:
	if d[0]-f <= k:
		del d[0]
		cnt += 1
		if cnt == c:
			f = d[0]
			cnt = 0
			ans += 1
	else:
		f = d.popleft()
		cnt = 1
		ans += 1
print(ans-(c==1))

Solution (Python):
N,C,K=map(int,input().split())
l=[]

for i in range(N):
  l.append(int(input()))

l.sort()

bus_c=0
t_lim=0
jou_c=0

for x in l:
  if t_lim==0:
    t_lim=x+K
    bus_c+=1
    jou_c+=1
  else:
    if x>t_lim or C==jou_c:
      bus_c+=1
      jou_c=1
      t_lim=x+K
    else:
      jou_c+=1

print(bus_c)

Solution (Python):
n,c,k=map(int,input().split())
lista=[int(input())for i in range(n)]
listb=sorted(lista)
count=0
bustime=0
buspeople=0
for i in listb:
    if buspeople==0 or bustime<i:
        count+=1
        buspeople=c-1
        bustime=i+k
    else :
        buspeople-=1
print(count)

Solution (Python):
n,c,k=map(int,input().split())
lista=[int(input())for i in range(n)]
listb=sorted(lista)
count=0
bustime=0
buspeople=0
for i in listb:
    if buspeople==0 or bustime<i:
        count+=1
        buspeople=c-1
        bustime=i+k
    else :
        buspeople-=1
print(count)

Solution (Python):
n, c, k = map(int, input().split())
T = sorted([int(input()) for i in range(n)])
ans = 0
last = 0
jokyaku = 0
for t in T:
    jokyaku += 1
    if jokyaku == c or t > last:
        jokyaku = 0
        last = t + k
        ans += 1
print(ans)

Solution (Python):
n, c, k = map(int,input().split())
T = sorted([int(input()) for _ in range(n)])
num = 0
count = 0
h0 = T[0]
h = T[0]+k
l = [0]
for i in range(n):
  if h0 <= T[i] <= h and num < c:
    num += 1
  elif num >= c or T[i] > h:
    num = 1
    l.append(count)
    h0 = T[i]
    h = T[i]+k
print(len(l))

Solution (Python):
import sys
input = sys.stdin.readline

n, c, k = map(int, input().split())
T = [int(input()) for t in range(n)]
T.sort()
bus_count = 0
vacant_seat = 0
limit = 0

for t in T:
    if t > limit or vacant_seat == 0:
        bus_count += 1
        vacant_seat = c-1
        limit = t + k

    else:
        vacant_seat -= 1

print(bus_count)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N, C, K = list(map(int, sys.stdin.readline().split()))
T = [int(sys.stdin.readline()) for _ in range(N)]

T.sort()
ans = 1
cnt = 0
departure = T[0] + K
for t in T:
    cnt += 1
    if t > departure or cnt > C:
        ans += 1
        cnt = 1
        departure = t + K
print(ans)

Solution (Python):
n, c, k = map(int,input().split())

t = []
for i in range(n):
    t.append(int(input()))
t.sort()

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

Solution (Python):
import sys
input = sys.stdin.readline

N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()

answer = 0
first = -K
rest = C
for t in T:
    if first + K >= t and rest > 0:
        
        rest -= 1
        continue
    
    answer += 1
    first = t
    rest = C-1

print(answer)

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

n,c,k = map(int,sys.stdin.readline().split())
t = [int(sys.stdin.readline()) for _ in range(n)]
t.sort()
ans = 0
time,passenger = 0,0
for i in range(n):
    if passenger == 0 or passenger == c or time + k < t[i]:
        passenger = 1
        ans += 1
        time = t[i]
    else:
        passenger += 1
print(ans)

Solution (Python):
import math
N, C, K = map(int, input().split())
T = [0] * N
for i in range(N):
    T[i] = int(input())

T.sort()

l = []
ans = 0

for i in range(N):
    l.append(T[i])

    if len(l) != 0:
        for j in range(len(l)):   
            if l[j] + K <= T[i] :
                a = l[j]
                for k in range(min(C, len(l))):
                    if l[0]  <= a + K:
                        l.pop(0)
                ans += 1
                if j >= len(l) - C:
                    break
            else:
                break



check = 0
while check == 0:
    a = l[0]
    for k in range(min(C, len(l))):
        if l[0]  <= a + K:
            l.pop(0)
    ans += 1
    if len(l) == 0:
        check = 1






print(ans)

Solution (Python):
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]

T.sort()
i = 0
ans = 0
time =0
p = 0

for i in range(N):
 
    if  p==0 or p ==C:
        ans = ans+1
        p =1
        time =T[i]+K
    elif p<C :
        if T[i]<=time:
            p +=1
        elif T[i]>time:
            ans =ans+1
            time=T[i]+K
            p =1

print(ans)

Solution (Python):
def main():
    n,c,k = map(int,input().split())
    t = [int(input()) for _ in range(n)]
    t = sorted(t)
    left = 0
    right = 0
    ans = 0
    while 1:
        if right == n-1:
            if t[right]-t[right-1]>k:
                ans +=2
                break
            else:
                ans +=1
                break
        if t[right]-t[left]<=k and right-left+1<=c:
            right +=1
        else:
            ans +=1
            left = right
    print(ans)
if __name__ == "__main__":
    main()

Solution (Python):
n,c,k = map(int, input().split())
t = [0] * n
for i in range(n):
        t[i] = int(input())
t.sort()
ans = 0
t_from = 0 
p = 0 
for i in range(n):
        if p == 0:
                ans += 1
                p = 1
                t_from = t[i]
        elif p < c:
                if t_from + k >= t[i]: 
                        p += 1
                else: 
                        ans += 1
                        t_from = t[i]
                        p = 1
        else:
                ans += 1
                p = 1
                t_from = t[i]


print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(100000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *

N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
i, ans = 0, 0
while i < N:
    i = min(i+C, bisect_right(T, T[i]+K))
    ans += 1
print(ans)

Solution (Python):
N, C, K = map(int,input().split())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
time = T[0]
index = 0
buses = 1
passenger = 0
while index < N:
    if T[index] > time+K:
        buses += 1
        time = T[index]
        passenger = 0
    if passenger == C:
        buses += 1
        time = T[index]
        passenger = 0
    passenger += 1
    index += 1
if passenger == 0:
    print(str(buses-1))
else:
    print(str(buses))

Solution (Python):

import sys
input = sys.stdin.readline

def main():
    N, C, K = tuple(map(int, input().rstrip().split()))
    T = sorted(map(int, [input().rstrip() for _ in range(N)]))
    ans, cur, cnt = 0, T[0] + K, 0
    for i in T:
        if i > cur or cnt == C:  
            cur = i + K
            cnt = 1
            ans += 1
        else:  
            cnt += 1
    print(ans + 1)


if __name__ == "__main__":
    main()

Solution (Python):

import sys
input = sys.stdin.readline

def main():
    N, C, K = tuple(map(int, input().rstrip().split()))
    T = sorted(map(int, [input() for _ in range(N)]))
    ans, cur, cnt = 0, T[0] + K, 0
    for i in T:
        if i > cur:
            cur = i + K
            cnt = 1
            ans += 1
        else:
            if cnt != C:
                cnt += 1
            else:
                cur = i + K
                ans += 1
                cnt = 1
    print(ans + 1)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N, C, K = map(int, input().split())
    T = [int(input()) for _ in range(N)]
    T.sort()
    ans = 0
    remain = 0
    first = 0
    for t in T:
        if remain <= 0 or first + K < t:
            remain = C
            first = t
            ans += 1
        remain -= 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
from collections import deque
n,c,k=map(int,input().split())
l=sorted([int(input()) for _ in range(n)],reverse=True)
ans=0
d=deque(l)
while len(d)!=0:
    ans+=1
    t=d.popleft()
    cnt=1
    while len(d)!=0 and d[0]>=t-k and cnt<c:
        d.popleft()
        cnt+=1
print(ans)

Solution (Python):
from collections import deque
n,c,k=map(int,input().split())
l=sorted([int(input()) for _ in range(n)],reverse=True)
ans=0
d=deque(l)
while len(d)!=0:
    ans+=1
    t=d.popleft()
    cnt=1
    while len(d)!=0 and d[0]>=t-k and cnt<c:
        d.popleft()
        cnt+=1
print(ans)

Solution (Python):
N,C,K=map(int,input().split())
T=sorted([int(input()) for _ in range(N)])
l,r,ans=0,0,0
while l<N:
    while r<N and r-l+1<=C and T[r] <= T[l]+K:
        r+=1
    ans+=1
    l=r
print(ans)

Solution (Python):
n, c, k = map(int, input().split())
t_list = [int(input()) for i in range(n)]

t_sorted = sorted(t_list)

ans = 1
bus = 1
timer = 0
for i in range(1, len(t_sorted)):
    bus += 1
    timer += t_sorted[i] - t_sorted[i - 1]
    if bus > c or timer > k:
        ans += 1
        bus = 1
        timer = 0

print(ans)

Solution (Python):

N,C,K= list(map(int,input().split(" ")))

ans = 1
passed = 0
nums = [ int(input()) for _ in range(N)]
nums.sort()
before = nums[0]
c = 1

for t in nums[1:]:

    c += 1
    passed += t - before
    if passed > K or c > C: 
        c = 1
        passed = 0
        ans += 1
    before = t
print(ans)

Solution (Python):
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]

T.sort()
ans = 1
now_t = T[0] + K
now_p = 1

for t in T:
    if now_t < t or now_p > C:
        ans += 1
        now_p = 1
        now_t = t + K
    now_p += 1

print(ans)

Solution (Python):
N, C, K = map(int, input().split()) 
T = [int(input()) for _ in range(N)]

T.sort()

first = True
ans = 0
peo = 0
limit = T[-1]
for t in T:
    if peo == C or t > limit:
        ans += 1
        first = True
    if first:
        limit = t + K
        peo = 1
        first = False
    elif t <= limit:
        peo += 1

if peo > 0:
    ans += 1

print(ans)

Solution (Python):
n,c,k=map(int,input().split())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
ans=0
p=0
q=0
for i in range(n):
    if p==0:
        p=t[i]
        ans+=1
        q=i
    elif t[i]>p+k or i>=q+c:
        p=t[i]
        ans+=1
        q=i
print(ans)

Solution (Python):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()

ans = 1
c = 0
now = T[0]
for i in range(N):
    if c == C:
        c = 0
        ans += 1
        now = T[i]
    if T[i] <= now + K:
        c += 1
    else:
        ans += 1
        c = 1
        now = T[i]
print(ans)

Solution (Python):
n, capa, k = list(map(int, input().split()))

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

ans = 0
t_first_arrived = times[0]
num_first_arrived = 0

for i in range(n):
	if (times[i] > t_first_arrived + k):
		ans += 1
		t_first_arrived = times[i]
		num_first_arrived = i

	elif i >= num_first_arrived + capa:
		ans += 1
		t_first_arrived = times[i]
		num_first_arrived = i

ans += 1

print(ans)

Solution (Python):
N,C,K=map(int,input().split())
T=sorted([int(input()) for _ in range(N)]) + [10000000]

ans=0
c=0
t=0

for i in range(N):
    if c==0:
        ans+=1
        t=T[i]

    c+=1

    if c==C or T[i+1]>t+K:
        c=0

print(ans)

Solution (Python):


import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    num_psgr, bus_cap, max_itvl = read_h()
    arv_tms = sorted(read_v(num_psgr))

    num_bus = 1
    cur_bus_cap = bus_cap - 1
    deadline = arv_tms[0] + max_itvl
    for t in arv_tms[1:]:
        if t <= deadline and cur_bus_cap >= 1:
            cur_bus_cap -= 1
        else:
            num_bus += 1
            cur_bus_cap = bus_cap - 1
            deadline = t + max_itvl

    print(num_bus)


if __name__ == '__main__':
    main()

Solution (Python):
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()

result = 0
wating = 0
first = None
for i in range(N):
    if wating == 0:
        first = i
        wating = 1
    elif T[first] + K < T[i]:
        result += 1
        first = i
        wating = 1
    else:
        wating += 1
    if wating == C:
        result += 1
        first = None
        wating = 0
if wating > 0:
    result += 1
print(result)

Solution (Python):
from sys import stdin
N,C,K = [int(x) for x in stdin.readline().rstrip().split()]
 
data = []
for _ in range(N):
    data.append(int(input()))
data = sorted(data)
ans = 0
time = 0
buss = 0
 
for ind,i in enumerate(data):
    if buss == 0:
        time = i
    if time + K >= i:
        buss += 1
        if ind == N - 1 and time != i:
          ans += 1
    else:
        buss = 1
        tmp = time
        time = i
        ans += 1
        if ind == N - 1 and time - tmp > K:
            ans += 1
        
    if buss == C:
        if ind == N - 1 and i != time:
          ans -= 1
        time = i
        ans += 1
        buss = 0
    
print(ans)

Solution (Python):
n,c,k=map(int,input().split())
a=[int(input())for _ in range(n)]
a.sort()
t=a[0]
ans=0
cc=1
for i in range(1,n):
  tt=a[i]
  if t+k<tt or cc==c:ans+=1;t=tt;cc=1
  else:cc+=1
print(ans+1)

Solution (Python):
N,C,K=map(int,input().split())
T=[]
for i in range(N):
  T.append(int(input()))

T.sort()
cnt=1
bus=0
for j in range(N):
  if bus==0:
    start=T[j]
    bus+=1
  elif start+K>=T[j] and bus < C:
    bus+=1
  else:
    cnt+=1
    bus=1
    start=T[j]

print(cnt)

Solution (Python):
row = list(map(int, input().split()))
T = [input() for i in range(row[0])]
T = list(map(int, T))
T.sort()

sub = []
for i in range(row[0]-1):
    sub.append(T[i+1]-T[i])
i = 0
sum = 0
C_count = 0
count = 0
while i < len(sub):
    sum += sub[i]
    C_count += 1
    if sum > row[2] or C_count == row[1]:
        sum = 0
        C_count = 0
        count += 1
        i += 1
    else:
        i += 1
print(count+1)

Solution (Python):
N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]

T.sort()

bus=-10**9
cnt=0
ans=0
for t in T:
    if t>bus or cnt>=C:
        bus=t+K
        cnt=1
        ans+=1
    else:
        cnt+=1

print(ans)

Solution (Python):
n,c,k = map(int,input().split())
t = [int(input()) for _ in range(n)]

t_sorted= sorted(t)
bus_num=0
i=0

while i < n:
  j=1
  while j < c:
    if i+j >= n:
      break
    if (t_sorted[i] + k >= t_sorted[i+j]):      
      j+=1      
    else:
      break      
  bus_num+=1
  i+=j
print(bus_num)

Solution (Python):
N,C,K = [int(x) for x in input().split()]
T = [int(input()) for _ in range(N)]
T.sort()
cnt = 0
first = -float('inf')
peop = 0
for i in T:
    if(i-first>K or peop>=C):
        cnt += 1
        first = i
        peop = 1
    else:
        peop += 1
print(cnt)

Solution (Python):
n, c, k = map(int, input().split())
l = [int(input()) for i in range(n)]
l.sort()
count = 0
first = l[0]
people = 1
count = 1
for i in range(1, n):
    if people < c and l[i] - first <= k:
        people += 1
    else:
        first = l[i]
        people = 1
        count += 1
print(count)

Solution (Python):
n,c,k=map(int,input().split())

t=[]
for i in range(n):
  t.append(int(input()))
t.sort()

first=t[0]
people=1
count=1

for i in range(1,n):
  if people<c and t[i]-first<=k:
    people +=1
  else:
    first=t[i]
    people =1
    count+=1
print(count)

Solution (Python):
def solve(n, c, k, t):
    t = list(sorted(t))
    ans = 0
    i = 0
    while i < n:
        num = 0
        threshold = t[i] + k
        while (i < n) and (t[i] <= threshold) and (num < c):
            num += 1
            i += 1
        ans += 1
    return ans

n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]
print(solve(n, c, k, t))

Solution (Python):
N, C, K =map(int, input().split())
T = [int(input()) for _ in range(N)]
T = sorted(T)
ans = 1
tmp = 1
mintime = T[0]

for i in range(1, N):
    nowtime = T[i]
    tmp += 1   
    if tmp > C or nowtime - mintime > K:
        mintime = nowtime
        ans += 1
        tmp = 1

print(ans)

Solution (Python):
N, C, K = map(int, input().split())
T = sorted([int(input()) for _ in range(N)])
ans = 1
now = T[0]
cap = C
for t in T:
    if t in range(now, now + K + 1):
        if cap == 0:
            ans += 1
            now = t
            cap = C
    else:
        ans += 1
        now = t
        cap = C
    cap -= 1
print(ans)

Solution (Python):
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
def m():
    ans = 0
    time = 0
    while time < N:
        high = T[time] + K
        for i in range(C):
            if time >= N:
                break
            if T[time] <= high:
                time += 1
            else:
                break
        ans += 1
    return ans
print(m())

Solution (Python):
passengers, bus_size, time_lim = map(int, input().split())
pass_list = [int(input()) for passenger in range(passengers)]
pass_list.sort()
front = 0
now = 0
cnt = 0
ans = 0
for psngr_lst in pass_list:
    if cnt == 0:
        front = psngr_lst
        now = psngr_lst
        cnt += 1
    elif cnt == bus_size:
        front = psngr_lst
        now = psngr_lst
        cnt = 1
        ans += 1
    elif now - front <= time_lim:
        if psngr_lst - front <= time_lim:
            now = psngr_lst
            cnt += 1
        else:
            front = psngr_lst
            now = psngr_lst
            cnt = 1
            ans += 1
if cnt:
    ans += 1
print(ans)

Solution (Python):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
ans = 0
i = 0
while i < n:
    ans += 1
    m = t[i]
    cnt = 0
    while i < n and m <= t[i] <= m + k and cnt < c:
        cnt += 1
        i += 1
print(ans)

Solution (Python):
N,C,K = map(int, input().split())

T = [int(input()) for i in range(N)]
sort_T = sorted(T)
a = 1 
cnt = 1 
t = sort_T[0] + K 

for i in range(1,N):
    if a < C and sort_T[i] <= t:
        a +=1
    else:
        a = 1
        cnt += 1
        t = sort_T[i] + K

print(cnt)

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

tmp=t[0]
ans=0
cnt=1

for i in range(1,n):
    if t[i]>tmp+k or cnt>=c:
        tmp=t[i]
        cnt=1
        ans+=1
    else:cnt+=1
ans+=1
print(ans)

Solution (Python):
n,c,k = map(int, input().split())
t = []

for i in range(n):
    x = int(input())
    t.append([x,x+k])

t.sort()

ans = 0
while t:
    x = t[-1][0]
    ans += 1
    for i in range(c):
        if t:
            if t[-1][0] <= x <= t[-1][1]:
                t.pop()
            else:
                break

print(ans)

Solution (Python):
n,c,k = map(int, input().split())
tl = [int(input()) for _ in range(n)]
tl.sort(reverse=True)
cnt = 0
while tl:
  t = tl.pop()
  cnt += 1
  for _ in range(c-1):
    if tl and tl[-1] <= t+k:
      tl.pop()
    else:
      break
print(cnt)

Solution (Python):
n, c, k = list(map(int, input().split()))
t = sorted([int(input()) for i in range(n)], reverse=True)
result = 1
bus = 1
time = t[0]
for i in range(1, n):
  if bus + 1 > c or time-t[i] > k:
    time = t[i]
    result += 1
    bus = 1
  else:
    bus += 1
print(result)

Solution (Python):
N,C,K=map(int,input().split())
T=[int(input()) for _ in range(N)]
T.sort()

ans=0
nexttime=0
people=0
for t in T:
  if t>nexttime:
    nexttime=t+K
    ans+=1
    people=0
  people+=1
  if people==C:
    nexttime=0
print(ans)

Solution (Python):
N,C,K = map(int, input().split())
T = []
for i in range(N):
    T.append(int(input()))
T.sort()

cnt = 0
tmp = []
for i in T:
    if tmp != [] and (min(tmp) + K < i or len(tmp) == C):
        cnt += 1
        tmp = [i]
    else:
        tmp.append(i)

if tmp != []:
    cnt += 1
print(cnt)

Solution (Python):

"""
A - Airport Bus
https://atcoder.jp/contests/agc011/tasks/agc011_a

"""
import sys


def solve(N, C, K, T):
    ans, i, j = 0, 0, 0
    while i < N:
        while j < N and i+C > j and T[i]+K >= T[j]:
            j += 1
        ans += 1
        i = j
    return ans


def main(args):
    N, C, K = map(int, input().split())
    T = sorted([int(input()) for _ in range(N)])
    ans = solve(N, C, K, T)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
n,c,k = map(int,input().split())
a = sorted([int(input()) for i in range(n)])



s = 1
p = 1
w = a[0]+k 
for t in a[1:]:
  if p == c or t > w:
    p = 1
    s += 1
    w = t+k
  else:
    p += 1
print(s)

Solution (Python):
n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
a,x,y=1,1,t[0]
for i in t[1:]:
    if x==c or i>y+k:
        a+=1
        x=0
        y=i
    x+=1
print(a)

Solution (Python):
N,C,K=map(int,input().split())
T=sorted([int(input()) for _ in range(N)])
First=T[0]
bus_rider=1
bus_cnt=1
for i in range(1,N):
    if bus_rider<C and T[i]-First<=K:
        bus_rider+=1
    else:
        First=T[i]
        bus_rider=1
        bus_cnt+=1
print(bus_cnt)

Solution (Python):
n,c,k = map(int, input().split())
t = [int(input()) for i in range(n)]
t.sort()
cnt = 0
st=-1
num = 0
for i in t:
    num+=1
    if num>c:
        st=i
        cnt+=1
        num=1
        continue
    if st == -1:
        st = i
    if i-st > k:
        st = i
        cnt += 1
        num = 1
        continue
if num:
    cnt+=1
print(cnt)

Solution (Python):
if __name__ == '__main__':
    [N, C, K] = [int(i) for i in input().split()]

    T = []
    for i in range(N):
        T.append(int(input()))
    T.sort()

    counter = 1

    num_people = 0

    flag = False

    for time in T:
        num_people += 1
        if flag:
            if time - first_time <= K and num_people <= C:
                continue
            else:
                counter += 1
                num_people = 1
                first_time = time

        else:
            first_time = time
            flag = True

    print(counter)

Solution (Python):
if __name__ == '__main__':
    [N, C, K] = [int(i) for i in input().split()]

    T = []
    for i in range(N):
        T.append(int(input()))
    T.sort()

    counter = 1

    num_people = 0

    flag = False

    for num in T:
        num_people += 1
        if flag:
            if num - first_time <= K and num_people <= C:
                continue
            else:
                counter += 1
                num_people = 1
                first_time = num

        else:
            first_time = num
            flag = True

    print(counter)

Solution (Python):
N,C,K = [int(s) for s in input().split()]
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
 
pas = 0
leave = T[0]
ans = 1
 
for t in T:
    if pas == C or K < t - leave:
        leave = t
        ans += 1
        pas = 0
    pas += 1
print(ans)

Solution (Python):
N, C, K = map(int, input().split())
flag = True
pass_num = 0
count = 1
for t in sorted([int(input()) for _ in range(N)]):
    if flag:
        first_pass_time = t
        flag = False
    if t - first_pass_time > K or pass_num == C:
        first_pass_time = t
        pass_num = 0
        count += 1
    pass_num += 1
print(count)

Solution (Python):

import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in read(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    N, C, K = readi(3)
    ts = sorted(readi(N))
    ans = 1
    diff = 0
    c = 1
    for i in range(N - 1):
        diff += ts[i + 1] - ts[i]
        dbg(i=i, diff=diff, c=c)
        if diff > K or c == C:
            dbg(ii=i)
            ans += 1
            diff = 0
            c = 1
        else:
            c += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N, C, K = map(int, input().split())
Ts = [int(input()) for _ in range(N)]
Ts.sort()
front = 0
now = 0
cnt = 0
ans = 0
for i in Ts:
    if cnt == 0:
        front = i
        now = i
        cnt += 1
    elif cnt == C:
        front = i
        now = i
        cnt = 1
        ans += 1
    elif now - front <= K:
        if i - front <= K:
            now = i
            cnt += 1
        else:
            front = i
            now = i
            cnt = 1
            ans += 1
if cnt:
    ans += 1
print(ans)

Solution (Python):
N, C, K = map(int, input().split())
T = sorted([int(input()) for _ in range(N)])
cnt = 1
passengers = [T[0]]

for i in range(1, N):
    if T[i] - passengers[0] <= K and len(passengers) < C:
        passengers.append(T[i])
    else:
        cnt += 1
        passengers = [T[i]]

print(cnt)

Solution (Python):
N, C, K = map(int, input().split())
T = []
for i in range(N):
    T.append(int(input()))
sorted_T = sorted(T)
bus_count = 1
pas_count = 0
bus_start = sorted_T[0]
for t in sorted_T:
    if pas_count == C or t - bus_start > K:
        bus_count += 1
        pas_count = 0
        bus_start = t
    pas_count += 1
print(bus_count)

Solution (Python):
n, c, k = map(int, input().split())
t = []
for i in range(n):
  t.append(int(input()))
t.sort()
person = 0
firsttime = 0
ans = 0
for i in range(n):
  if person == 0:
    firsttime = t[i]
    person += 1
  elif person <= c-1 and (firsttime + k) >= t[i]:
    person += 1
  else:
    person = 1
    firsttime = t[i]
    ans += 1
    
if person != 0:
  ans += 1
print(ans)

Solution (Python):
N,C,K=map(int,input().split())
T=[int(input()) for i in range(N)]
S=sorted(T)
B=0
first=-1
board=0
for i in range(N):
	if first==-1:
		first=S[i]
		board+=1
		B+=1
	elif board<C and S[i]-first<=K:
		board+=1
	else:
		first=S[i]
		board=1
		B+=1
print(B)

Solution (Python):
N,C,K = map(int,input().split(" "))
T = [0]*N
for i in range(N):
    T[i] = int(input())

T = sorted(T)

bus_time = T[0]
bus_people = 1
c = 1
for i in range(1,N):
    bus_people += 1
    if T[i] > bus_time + K or bus_people > C:
        bus_time = T[i]
        bus_people = 1
        c += 1

print(c)

Solution (Python):
n, c, k = map(int, input().split())
t = []
for _ in range(n):
    t.append(int(input()))
t.sort()
temp = t[0]
count = 0
ans = 1
for i in range(n):
    if count < c:
        if t[i] <= temp + k:
            count += 1
        elif t[i] > temp + k:
            temp = t[i]
            ans += 1
            count = 1
    elif count == c:
        count = 1
        temp = t[i]
        ans += 1
print(ans)

Solution (Python):
n,c,k=map(int,input().split())
T=[int(input()) for i in range(n)]
T.sort()
count=1
t=T[0]
number=1
for i in range(1,n):
  if T[i]-t>k or number==c:
    count+=1
    t=T[i]
    number=1
  else:
    number+=1
print(count)

Solution (Python):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]

T.sort()
ans = 0
index = 0
while index < N:
    bus = T[index] + K
    for i in range(C):
        if index+i < N and T[index+i] > bus:
            i -= 1
            break
    index += i+1
    ans += 1

print(ans)

Solution (Python):
n,c,k = map(int,input().split())
t = [int(input()) for _ in range(n)]
t.sort()
ans = 0
i = 0
while i<n:
    time = t[i]
    for j in range(0,c+1):
        if j>c or not t[i+j]-time<=k:
            ans += 1
            i += j
            break
        if (i+j)==(n-1):
            ans += 1
            i += j+1
            break
        if j==c:
            ans += 1
            i += j
print(ans)

Solution (Python):
n,c,k=map(int,input().split())
arr=[int(input()) for _ in range(n)]
arr=sorted(arr)
pos=0
cnt=0
for i in range(n):
  if pos==i:
    for j in range(c):
      if i+j==n:
        break
      if arr[i+j]-arr[i]>k:
        pos=pos+j
        break
    else:
      pos=pos+c
    cnt+=1
  else:
    continue
print(cnt)