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 = sorted([int(input()) for _ in range(N)])

ans = 1
bus = 0
before = T[0]

for i in T:
    if bus+1 > C or i - before > K:
        bus = 1
        ans += 1
        before = i
    else:
        bus += 1
    
    
print(ans)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')
AtoZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N,C,K = IL()
T = ILs(N)
T.sort()

now = 0
count = 0
while now < N:
  t = T[now]
  p = bisect.bisect_right(T,t+K)
  count += 1
  now = min(now+C,p)
print(count)

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

t=[]

for _ in range(n):
    t_i = int(input())

    t.append(t_i)

t = sorted(t)

bus=0
index=0
cnt=0

start =t[index]
while index<n:

    end = t[index]

    if end<=start+k:
        if cnt==c:
            bus+=1
            start=t[index]
            cnt=1
            index+=1
        else:
            cnt+=1
            index+=1
            if index==n:
                break
    else:
        bus+=1
        start=t[index]
        cnt=1
        index+=1

if cnt<=c:
    bus+=1

print(bus)

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

    T.sort()

    ans = 0
    temp = T[0]
    cnt = 1

    for i in range(1,N):
        if temp + K < T[i] or C == cnt:
            ans += 1
            temp = T[i]
            cnt = 1
        else:
            cnt += 1

    ans += 1
    return (ans)

print(main())

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,c,k=map(int, input().split())
    l=[int(input()) for i in range(n)]
    l.sort()
    saisyo=l[0]
    ninzu=1
    ans=0
    for j in range(1,n):
        x=l[j]-saisyo
        if x<=k and ninzu<c:
            ninzu+=1
        else:
            ans+=1
            saisyo=l[j]
            ninzu=1
    print(ans+1)
resolve()

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

N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
ans = 0
cnt = 1
mn = T[0]
for i in range(1,N):
    if cnt == C or mn+K < T[i]:
        ans += 1
        cnt = 1
        mn = T[i]
    else:
        cnt += 1
if cnt > 0:
    ans += 1
print(ans)

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

buses = 0
passengers = 1
first = ts[0]
for t in ts[1:]:
    if t > first + k or passengers == c:
        buses += 1
        passengers = 1
        first = t
    else:
        passengers += 1

if passengers > 0:
    buses += 1

print(buses)

Solution (Python):
import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction



mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]






n,c,k=l()
A=[l()[0] for i in range(n)]
A.sort()
i=0
count=0
while(i<n):
    j=i
    while(i<n and A[j]+k>=A[i]and i-j+1<=c):
        i+=1
    count+=1
print(count)

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

T.sort()

ans = 0

oko = 0
bus = False
cnt = 0
for i in range(N):
  t = T[i]
  
  if not bus:
    ans += 1
    bus = True
    oko = t + K
    cnt += 1
    continue
    
  if t <= oko:
    if cnt < C:
      cnt += 1
    else:
      bus = True
      oko = t + K
      cnt = 1
      ans += 1
  else:
    cnt = 1
    bus = True
    ans += 1
    oko = t + K
    
print(ans)

Solution (Python):
n,c,k=map(int,input().split())
a=sorted([int(input()) for _ in range(n)],reverse=True)
cnt=0
cnt2=1
while len(a) > 0:
    b=a.pop()
    cnt+=1
    if len(a)==0:
        break
    cnt2=1
    while cnt2<c:
        if a[-1]<=b+k:
            a.pop()
            cnt2+=1
            if len(a)==0:
                cnt2=1
                break
        else:
            cnt2=1
            break
print(cnt)

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

fast, cnt, ans = 0, 0, 0
for i in t:
    if fast + k < i or cnt == c:
        cnt = 0
    if cnt == 0:
        ans += 1
        fast = i
    cnt += 1
print(ans)

Solution (Python):
n,c,k=map(int,input().split())
a=sorted([int(input()) for _ in range(n)],reverse=True)
cnt=0
cnt2=1
while len(a) > 0:
    b=a.pop()
    cnt+=1
    if len(a)==0:
        break
    cnt2=1
    while cnt2<c:
        if a[-1]<=b+k:
            a.pop()
            cnt2+=1
            if len(a)==0:
                cnt2=1
                break
        else:
            cnt2=1
            break
print(cnt)

Solution (Python):
import sys

input = sys.stdin.readline


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

    T.sort()
    ans = 0
    s = 0  
    m = 0  
    for t in T:
        if m == 0:
            s = t
            m = 1
            ans += 1
        else:
            if t <= s + K:
                m += 1
            else:
                s = t
                m = 1
                ans += 1
        if m == C:
            m = 0

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
N,C,K = list(map(int,input().split()))
T = sorted([int(input()) for _ in range(N)])
ans = 1
count = 0
first = T[0]
for t in T:
    if t <= first+K and count < C:
        count += 1
    else:
        count = 1
        ans += 1
        first = t
print(ans)

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

Solution (Python):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])
ans = 0
bus = 0
pk = t[0] + k

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

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

bus = 1
lastPassenger = T[0]
waiting = 1
for t in T[1:]:
    if waiting < C and lastPassenger + K >= t:
        waiting += 1
    else:
        waiting = 1
        lastPassenger = t
        bus += 1

print(bus)

Solution (Python):
n, c, k = map(int, input().split())
t_lst = [int(input()) for _ in range(n)]
t_lst.sort()
ans = 0
cnt = 0
last = 0
if c == 1:
    print(n)
    exit()
for t in t_lst:
    if t > last:
        ans += 1
        last = t + k
        cnt = 1
    else:
        cnt += 1
        if cnt == c:
            last = 0
            cnt = 0
print(ans)

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]


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

ans = 1
bus_time = T[0]
bus_num = 0
for i in range(N):
    if T[i] <= bus_time+K and bus_num < C:
        
        bus_num += 1
    else:
        
        bus_time = T[i]
        bus_num = 1
        ans += 1

print(ans)

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]


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

T.sort()

ans = 0
bus_time = -1
bus_num = 0
for i in range(N):
    
    if bus_time == -1:
        bus_time = T[i]
        bus_num = 1
        ans += 1
    elif T[i] <= bus_time+K and bus_num <= C:
        bus_num += 1
    else:
        bus_time = T[i]
        bus_num = 1
        ans += 1

    if bus_num == C:
        bus_time = -1
        bus_num = 0
print(ans)

Solution (Python):
def main():
    n, c, k = list(map(int, input().split()))
    T = [int(input()) for _ in range(n)]
    T.sort()
    count = 0
    ans = 1
    t0 = T[0]
    for t in T:
        if t - t0 <= k:
            count += 1
        if count > c or t - t0 > k:
            ans += 1
            count = 1
            t0 = t
    print(ans)

if __name__ == '__main__':
    main()

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

cnt = 0
res = 1
time = T[0]
for i in range(N-1):
    cnt += 1
    if cnt == C or time + K < T[i+1]:
        res += 1
        cnt = 0
        time = T[i+1]
print(res)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, C, K = [int(x) for x in input().split()]
    T = [int(input()) for _ in range(N)]
    
    T.sort()

    ans = 1
    cnt = 1
    mi = T[0]
    for i in range(1, N):
        if cnt == C:
            ans += 1
            cnt = 1
            mi = T[i]
        else:
            if T[i] > mi + K:
                ans += 1
                cnt = 1
                mi = T[i]
            else:
                cnt += 1

    print(ans)

    
    
    

if __name__ == '__main__':
    main()

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,c,k = iim()
time = []
for _ in range(n):
    time.append(ii())

time.sort()

bus = 0
fst = time[0]
ans = 0
for item in time:
    if bus <= c-1 and item <= k+fst:
        bus += 1
    else:
        bus = 1
        ans += 1
        fst = item

print(ans if bus == 0 else ans+1)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

n,c,k = iim()
time = []
for _ in range(n):
    time.append(ii())

time.sort()

bus = 0
fst = time[0]
ans = 0
for item in time:
    if bus <= c-1 and item <= k+fst:
        bus += 1
    elif bus > c-1:
        bus = 1
        ans += 1
        fst = item
    elif item-fst > k:
        bus = 1
        ans += 1
        fst = item
    

print(ans if bus == 0 else ans+1)

Solution (Python):
def main():
    import sys
    import heapq
    input = sys.stdin.readline
    N, C, K = [int(x) for x in input().strip().split()]
    T = []
    for _ in range(N):
        heapq.heappush(T, int(input()))
    
    k = 0
    c = 0
    ans = 0
    while T:
        t = heapq.heappop(T)
        if c % C == 0:
            k = t + K
            ans += (c > 0)
            c += 1
        elif t <= k:
            c += 1
        else:
            ans += 1
            c = 1
            k = t + K
    else:
        ans += (c > 0)

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N, C, K, *T = map(int, open(0).read().split())
T = sorted(T)
ans = 0
curr = [T[0]]
for i in range(N - 1):
    if len(curr) < C and T[i + 1] - curr[0] <= K:
        curr.append(T[i + 1])
    else:
        ans += 1
        curr = [T[i + 1]]
print(ans + 1)

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

Solution (Python):
n,c,k = map(int,input().split())
t = [int(input()) for nesya in range(n)]
t.sort()
bus = 0
wait = []
for i in range(n):
  wait.append(t[i])
  if wait[0] + k < t[i]:
    bus += 1
    wait = [t[i]]
  elif len(wait) == c:
    bus += 1
    wait = []
  elif wait[0] + k == t[i]:
    bus += 1
    wait = []
  if i == n-1 and len(wait) > 0:
    bus += 1
print(bus)

Solution (Python):
def main():
    n, c, k = map(int, input().split())
    customers = [int(input()) for i in range(n)]
    
    customers.sort()
    bus_count = 0
    in_bus = []

    for i in range(n):
        if len(in_bus) == 0:
            in_bus.append(customers[i])
        elif len(in_bus) < c and customers[i] <= in_bus[0] + k:
            in_bus.append(customers[i])
        else:
            bus_count += 1
            in_bus = []
            in_bus.append(customers[i])
    
    print(bus_count+1)

if __name__ == '__main__':
    main()

Solution (Python):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.buffer.readline

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

    if C == 1:
        print(N)
        exit()

    cnt = 0
    ans = 0
    t0 = -10**10
    for t in T:
        if t0 + K < t:
            t0 = t
            cnt = 1
            ans += 1
        else:
            cnt += 1
            if cnt == C:
                cnt = 0
                t0 = -10**10
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n,c,k=map(int,input().split())
t = [int(input()) for _ in range(n)]
a = [0]*(n+1)
i = 0
j = 0
t = sorted(t)
while i < n:
    now = t[i]
    a[j] += 1
    i += 1
    while a[j] <c and i<n:
        if now<=t[i]<=now+k:
            a[j] += 1
        else:
            break
        i += 1
    j += 1
print(len([x for x in a if x != 0]))

Solution (Python):
N, C, K = [int(x) for x in input().split()]

times = [int(input()) for x in range(N)]
times.sort()

count = 0
minimum = None
passenger = 0

for t in times:
    passenger += 1
    if minimum  and (t - minimum) > K:
        count += 1
        minimum = t
        passenger = 1
    elif passenger == C:
        count += 1
        minimum = None
        passenger = 0
    elif minimum is None:
        minimum = t

if passenger:
    count += 1

print(count)

Solution (Python):
n,c,k,*t=map(int,open(0).read().split())
t.sort()
busstart=t[0]
passenger=0
buscount=0
for i in t:
    if i>busstart+k or passenger==c:
        busstart=i
        passenger=1
        buscount+=1
    else:
        passenger+=1
print(buscount+1)

Solution (Python):
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)

Solution (Python):
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
count=0
while T:
    i=T.popleft()
    if i>bus:
        bus=i+K
        ans+=1
        count=1
    elif count==C:
        bus=i+K
        ans+=1
        count=1
    else:
        count+=1
print(ans)

Solution (Python):

"""
時刻順にソート
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,c,k = map(int,readline().split())
t = []
for i in range(n):
    t.append(int(readline()))

t.sort()
res_k = t[0]
res_c = 0
ans = 0
for i in range(n):
    res_c += 1
    if i+1 < n:
        if t[i+1] - res_k > k:
            ans += 1
            res_c = 0
            res_k = t[i+1]
    if res_c == c:
        ans += 1
        if i+1 < n:
            res_k = t[i+1]
        res_c = 0

print(ans if res_c == 0 else ans + 1)

Solution (Python):
n,c,k = [int(x) for x in input().split()]
t = [int(input()) for _ in range(n)]
t.sort()
bus = c
f_bus = 0
ans = 0
for i in range(n):
    if t[i] > f_bus or bus == 0:
        ans += 1
        f_bus = t[i]+k
        bus = c-1
    else:
        bus -= 1

print(ans)

Solution (Python):
n,c,k = [int(x) for x in input().split()]
t = [int(input()) for _ in range(n)]
t.sort()
bus = c
f_bus = 0
ans = 0
for i in range(n):
    if t[i] > f_bus or bus == 0:
        ans += 1
        f_bus = t[i]+k
        bus = c-1
    else:
        bus -= 1

print(ans)

Solution (Python):
from collections import deque

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

T_list = list() 

for i in range(N):
    T = int(input())
    T_list.append(T)

T_list.sort(reverse=False)

waiting_deque = deque(T_list)
ans = 0

while 1:
    if len(waiting_deque) != 0:
        ans += 1
        bus_passenger = list()
        bus_passenger.append(waiting_deque.popleft())
        while 1:
            if len(waiting_deque)!=0 and len(bus_passenger) < C and bus_passenger[0] + K >= waiting_deque[0]:
                bus_passenger.append(waiting_deque.popleft())
            else:
                
                break
    else:
        break

print(ans)

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

bus = 0
idx = 0
while idx < N:
    bus_go = t[idx] + K
    tmp = 0
    while idx < N:
        if t[idx] <= bus_go:
            tmp += 1
            idx += 1
            if idx == N:
                break
            if tmp == C:
                bus += 1
                tmp = 0
                bus_go = t[idx] + K
        else:
            break
    if tmp > 0:
        bus += 1

print(bus)

Solution (Python):
n,c,k=map(int,input().split())
buscount=1
waiting=0
T=[]
for _ in range(n):
    t=int(input())
    T.append(t)
T=sorted(T)
mae_no_time=T[0]
noruhito=1
for i in range(1,n):
    waiting+=T[i]-mae_no_time
    noruhito+=1
    mae_no_time=T[i]
    if waiting>k or noruhito>c:
        buscount+=1
        waiting=0
        noruhito=1

print(buscount)

Solution (Python):
N, C, K = map(int, input().split())
T = sorted(map(int, (input() for _ in range(N))))
ans = 0
count = 0
bus = None
for t in T:
    tk = t + K
    if bus is None or bus < t or count + 1 > C:
        bus = tk
        count = 0
        ans += 1
    count += 1
print(ans)

Solution (Python):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _i in range(n)])+[float('inf')]

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

Solution (Python):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _i in range(n)])+[float('inf')]

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

Solution (Python):
from collections import deque
n,c,k=map(int,input().split())
t=deque(sorted([int(input()) for i in range(n)]))
b=[]
b.append(t.popleft())
ans=0
while t:
    if len(b)==c or t[0]>b[0]+k:
        ans+=1
        b=[]
    b.append(t.popleft())
if len(b)>0:
    ans+=1
print(ans)

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

Bus = 1
Capa = 0
first = T[0]
for i in range(N):
    t = T[i]
    if t-first>K or Capa+1>C:
        Bus+=1
        Capa = 1
        first = t
    else:
        Capa += 1
print(Bus)

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    

    
    

    n,c,k = map(int, input().split())
    t = [int(input()) for _ in range(n)]
    t.sort()
    res = 1
    time, hito = t[0], 0
    for i in range(n):
        if t[i] - time > k:
            time = t[i]
            res += 1
            hito = 1
        elif hito + 1 > c:
            time = t[i]
            res += 1
            hito = 1
        else:
            hito += 1

    print(res)

if __name__ == '__main__':
    main()

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

t.sort()
ans = 0
now = 0
ter = -1
for i in range(n):
  if ter < t[i]:
    ans += 1
    ter = t[i]+k
    now = 1
  else:
    if(c<=now):
      ans+=1
      ter = t[i]+k
      now = 1
    else:
      now += 1
      
print(ans)

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

ans=0
wait=[]
for i in range(N):
    t=T[i]
    if len(wait)>0 and t-wait[0]>K:
        ans+=1
        wait=[]
    wait.append(t)
    if len(wait)==C:
        ans+=1
        wait=[]
if len(wait)>0:
    ans+=1
print(ans)

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True




def warshall_floyd(d, n):
    
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d



def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)






def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



n, c, k = map(int, input().split())
t = sorted([int(input()) for i in range(n)])
ans = 1
cnt = 1
start = t[0]
for i in range(1, n):
    if t[i] - start > k or cnt == c:
        start = t[i]
        cnt = 1
        ans += 1
        continue
    cnt += 1
print(ans)

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

T = sorted([int(input()) for _ in range(N)])

x = T[0]
p = 1
b = 1
for i in range(1, N):
    if T[i] <= x + K and p < C:
        p += 1
    else:
        x = T[i]
        b += 1
        p = 1
print(b)

Solution (Python):
n, c, k = map(int, input().split())
t = sorted(int(input()) for _ in range(n))
cnt = 0
bus_people = 0
bus_time = 0
for i in range(n):
    if bus_people >= c or t[i] > bus_time:
        bus_people = 1
        bus_time = t[i] + k
        cnt += 1
    else:
        bus_people += 1
print(cnt)

Solution (Python):

import bisect
from collections import deque

n, c, k = map(int, input().split())
t_list = [int(input()) for _ in range(n)]

t_list.sort()
t_list = deque(t_list)
ans = 0

while len(t_list) > 0:
    _tmp = t_list.popleft() + k
    _idx = bisect.bisect_right(t_list, _tmp)
    if c-1 <= _idx:
        for _ in range(c-1):
            t_list.popleft()
    else:
        for _ in range(_idx):
            t_list.popleft()
    ans += 1

print(ans)

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

t = [0] * n
for i in range(n):
    t[i] = int(input())
t = sorted(t)
ans = 0
i = 0
while i < n:
    j = 1
    while i + j < n and t[i + j] <= t[i] + k and j < c:
        j += 1
    i += j
    ans += 1 
print(ans)

Solution (Python):
from collections import deque

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

t.sort()

q = deque(t)
cnt = 1
ans = 1
curr = q.popleft()

while q:
    tmp = q.popleft()
    if tmp - curr <= k and cnt < c:
        cnt += 1
    else:
        ans += 1
        cnt = 1
        curr = tmp

print(ans)

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

ans = 1
temp = [T[0], 0]
for t in T:
    if temp[0] + K < t or temp[1] + 1 > C:
        ans += 1
        temp = [t, 0]
    temp[1] += 1
print(ans)

Solution (Python):
n,c,k,*t=map(int,open(0).read().split())
t.sort()
s=t[0]
ss=0

p=0
for i in range(n):
    if t[i]-s>k or i-ss+1>c:
        p+=1
        s=t[i]
        ss=i
print(p+1)

Solution (Python):

n, c, k, *t = map(int, open(0).read().split())
t.sort()
m = l = s = 0
for t in t:
    m += 1
    if m > c or t > l:
        s += 1
        m = 1
        l = t + k
print(s)