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

T.sort()

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

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 

def ii(): return int(sys.stdin.readline().rstrip()) 
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) 
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]

def ss(): return sys.stdin.readline().rstrip() 
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) 
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]





n,c,k=mii()
arr=lin(n)
arr.sort()

bas_cnt=1
pep_cnt=0
time=arr[0]+k

for i in range(n):
    
    arri=arr[i]
    if arri <= time:
        if pep_cnt < c:
            pep_cnt+=1
        else:
            bas_cnt+=1
            pep_cnt=1
            time=arri+k
            
    else:
        bas_cnt+=1
        pep_cnt=1
        time=arri+k
    
print(bas_cnt)

Solution (Python):

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

T.sort()


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

print(ans)

Solution (Python):
N,C,K = map(int,input().split())
T = sorted([int(input()) for i in range(N)],reverse=1)
count = 0
bus = 0
arr = T[0] -K
for i in range(N):
    if arr <= T[i]:
        count += 1
    else:
        count = 1
        arr = T[i] - K
        bus += 1

    if count == C:
        bus += 1
        count = 0
        if i != N-1:
            arr = T[i+1]-K 
if count:
    bus += 1
print(bus)

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

start,ans,cnt=T[0],0,0
for i in range(n+1):
    if start+k<T[i] or cnt+1>c:
        ans +=1
        cnt=0
        start=T[i]
    cnt +=1

print(ans)

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

for i in range(N):
    now = Tlist[i]
    if count == 0:
        rl = now + K
        count += 1
        continue
    else:
        if now <= rl <= now + K and count < C:
            count += 1
        else:
            ans += 1
            rl = now + K
            count = 1
print(ans + 1)

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

now = 0
past = t[0]
num = 0
ans = 1

for i in range(n):
    now = t[i]
    num += 1

    if now-past > k or num > c:
        ans += 1
        num = 1
        past = t[i]

print(ans)

Solution (Python):

import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue


class Scanner():
    @staticmethod
    def int():
        return int(sys.stdin.readline().rstrip())

    @staticmethod
    def string():
        return sys.stdin.readline().rstrip()

    @staticmethod
    def map_int():
        return [int(x) for x in Scanner.string().split()]

    @staticmethod
    def string_list(n):
        return [input() for i in range(n)]

    @staticmethod
    def int_list_list(n):
        return [Scanner.map_int() for i in range(n)]

    @staticmethod
    def int_cols_list(n):
        return [int(input()) for i in range(n)]


class Math():
    @staticmethod
    def gcd(a, b):
        if b == 0:
            return a
        return Math.gcd(b, a % b)

    @staticmethod
    def lcm(a, b):
        return (a * b) // Math.gcd(a, b)

    @staticmethod
    def roundUp(a, b):
        return -(-a // b)

    @staticmethod
    def toUpperMultiple(a, x):
        return Math.roundUp(a, x) * x

    @staticmethod
    def toLowerMultiple(a, x):
        return (a // x) * x

    @staticmethod
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

    @staticmethod
    def sign(n):
        if n == 0:
            return 0
        if n < 0:
            return -1
        return 1

    @staticmethod
    def isPrime(n):
        if n < 2:
            return False
        if n == 2:
            return True
        if n % 2 == 0:
            return False
        d = int(n ** 0.5) + 1
        for i in range(3, d + 1, 2):
            if n % i == 0:
                return False
        return True


class PriorityQueue:
    def __init__(self, l=[]):
        self.__q = l
        heapq.heapify(self.__q)
        return

    def push(self, n):
        heapq.heappush(self.__q, n)
        return

    def pop(self):
        return heapq.heappop(self.__q)


MOD = int(1e09) + 7
INF = int(1e15)


def main():
    
    N, C, K = Scanner.map_int()
    T = Scanner.int_cols_list(N)
    T.sort()
    ans = 0
    cnt = 0
    lim = 0
    for i in range(N):
        if cnt == 0:
            lim = T[i] + K
        elif lim < T[i]:
            ans += 1
            lim = T[i] + K
            cnt = 0
        cnt += 1
        if cnt == C:
            ans += 1
            cnt = 0
            lim = 0
    if cnt > 0:
        ans += 1
    print(ans)
    return


if __name__ == "__main__":
    main()

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



bus = 1
org = T[0]
_count = 0

for t in T:

    if t - org <= K and _count < C:
        _count += 1
        
    else:
        bus += 1
        org = t
        _count = 1
        

print(bus)

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

T.sort()

time = T[0]
people = 0
bus = 1
for i in T:
    people += 1 
    if i - time > K or people > C: 
        bus += 1 
        time = i
        people = 1 
print(bus)

Solution (Python):
from sys import stdin

n,c,k = [int(x) for x in stdin.readline().rstrip().split()]
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
time = li[0]
people = 0
bus_num = 1

for i in li:
    people += 1
    if i-time > k or people > c:
        bus_num += 1
        time = i
        people = 1
print(bus_num)

Solution (Python):
from sys import stdin

n,c,k = [int(x) for x in stdin.readline().rstrip().split()]
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
time = li[0]
people = 0
bus_num = 1

for i in li:
    people += 1
    if i-time > k or people > c:
        bus_num += 1
        time = i
        people = 1
print(bus_num)

Solution (Python):
from sys import stdin

n,c,k = [int(x) for x in stdin.readline().rstrip().split()]
li = [int(stdin.readline().rstrip()) for _ in range(n)]
li.sort()
time = li[0]
people = 0
bus_num = 1

for i in li:
    people += 1
    if i-time > k or people > c:
        bus_num += 1
        time = i
        people = 1
print(bus_num)

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

passengers = sorted([int(input()) for i in range(N)])
res = 0
bus_time = passengers[0]
bus_count = C
for p in passengers:
    if bus_count == 0 or p - bus_time > K:
        res += 1
        bus_time = p
        bus_count = C - 1
    else:
        bus_count -= 1
if bus_count != C:
    res += 1
print(res)

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

bus_t = -k - 100
bus_c = c
ans = 0

for t in T:
    bl = (bus_t + k >= t) and (bus_c + 1 <= c)
    if bl:
        bus_c += 1
        continue
    ans += 1
    bus_t = t
    bus_c = 1
print(ans)

Solution (Python):
N,C,K = map(int,input().split())
T = []
for _ in range(N):
    t = int(input())
    T.append(t)
T.sort()
t_0 = T[0]
ans = 0
c = C
for t in T:
    if c == 0 or t - t_0 > K:
        ans += 1
        t_0 = t
        c = C - 1
    else:
        c -= 1
if c != C:
    ans += 1
print(ans)

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

T.sort(key = lambda x: x[1])
c = 0
bus = 0
limit = T[0][1]

for i, t in enumerate(T):
  if limit < t[0]:  
    c = 1
    bus += 1
    limit = t[1]
  elif (c+1) > C:  
    c = 1
    bus += 1
    limit = t[1]
  else:  
    c += 1

if c > 0:
  bus += 1
    
print(bus)

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

res = 0

t_0 = T[0]
c = C

for t in T:
    if c == 0 or t - t_0 > K:
        res += 1
        t_0 = t
        c = C - 1
    else:
        c -= 1
else:
    if c != C:
        res += 1

print(res)

Solution (Python):
import sys

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

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

cnt = 0
capacity = 0
time_limit = 0
for i in range(N):
	if capacity == 0:
		capacity += 1
		time_limit = T[i] + K
		continue
	if capacity > 0:
		if T[i] <= time_limit:
			capacity += 1
			if capacity == C:
				cnt += 1
				capacity = 0
				continue
		elif T[i] > time_limit:
			cnt += 1
			capacity = 1
			time_limit = T[i] + K


print(cnt+1)

Solution (Python):
import sys
n, c, k = [int(i) for i in sys.stdin.readline().split()]
t_ls = []
for i in range(n):
    t = int(sys.stdin.readline().strip())
    t_ls.append(t)
t_ls.sort()
last = t_ls[0]
cnt = 1
ans = 1
for t in t_ls[1:]:
    if t <= last + k and cnt < c:
        cnt += 1
        continue
    last = t
    cnt = 1
    ans += 1
print(ans)

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

count = 0
ans = 0

newLi = sorted(li)

while(len(newLi)):
  for c in range(C - 1):
    if len(newLi) < 2:
      break
    
    if newLi[1] <= newLi[0] + K:
      newLi.pop(1)
    else:
      break

  newLi.pop(0)
  ans += 1

print(ans)

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

listT.sort()

count=0
while listT != []:
    bus = []
    time = listT[0]
    count += 1
    while len(bus) != C and time+K>=listT[0]:
        bus.append(listT.pop(0))
        if listT==[]:
            break

print(count)

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

listT.sort(reverse = True)

count=0
while listT != []:
    bus =[]
    time = listT[0]
    count += 1
    while len(bus) != C and time - K <= listT[0]:
        bus.append(listT.pop(0))
        if listT ==[]:
            break

print(count)

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

count=1
cus=0
pre=T[0]
for t in T:
    if C>cus and pre+K>=t:
        cus+=1
    else:
        cus=1
        pre=t
        count+=1
print(count)

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

out = T.pop(0) + k
peo = 1
bus = 1

for t in T:
    if t <= out and peo < c:
        peo += 1

    else:
        out = t + k
        peo = 1
        bus += 1

print(bus)

Solution (Python):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()
time = T.pop(0)
people = 1
ans = 1
for t in T:
    if t <= time + K and people < C:
        people += 1
    else:
        time = t
        people = 1
        ans += 1
print(ans)

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

Solution (Python):



n, c, k = map(int, input().split())
ans = 0
arr = sorted([int(input()) for _ in range(n)])
cur_passenger = 0
limit = arr[0] + k
for i in range(n):
    if cur_passenger < c and arr[i] <= limit:
        cur_passenger += 1
        
    else:
        cur_passenger = 1
        limit = arr[i] + k
        ans += 1
        

if cur_passenger > 0:
    ans += 1
print(ans)

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


count = 0
while passenger != []:
    bus = []
    time = passenger[0]
    count += 1
    while len(bus) != c and time - k <= passenger[0]:
        bus.append(passenger.pop(0))
        if passenger == []:
            break
print(count)

Solution (Python):


n, c, k = map(int, input().split())
passenger = sorted([int(input()) for _ in range(n)], reverse = True)





count = 0
while passenger != []:
    bus = []
    time = passenger[0]
    count += 1
    while len(bus) != c and time - k <= passenger[0]:
        bus.append(passenger.pop(0))
        if passenger == []:
            break

print(count)

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

print(ans+1)

Solution (Python):

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

ans = 0
idx = 0
s = T[0]
cnt = 1
for i in range(1,N):
    if cnt >= C:
        ans += 1
        cnt = 1
        s = T[i]
    else:
        if T[i] - s <= K:
            cnt += 1
        else:
            ans += 1
            cnt = 1
            s = T[i]
if cnt != 0:
    ans += 1
print(ans)

Solution (Python):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()
time = T.pop(0)
people = 1
ans = 1
for t in T:
    if t <= time + K and people < C:
        people += 1
    else:
        time = t
        people = 1
        ans += 1
print(ans)

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

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

T.sort()
A = T[0]
SUM = 1
ans = 0
for i in range(1, N):
    SUM += 1
    if T[i] - A > K:
        ans += 1
        SUM = 1
        A = T[i]
    elif SUM > C:
        ans += 1
        SUM = 1
        A = T[i]

        
print(ans+1)

Solution (Python):
n,c,k = map(int, input().split())
l=[int(input()) for x in range(n)]
l.sort()
flg=l[0]
bus=1
capa=1
for i in range(1,n):

    if capa==c:
        bus+=1
        capa=1
        flg=l[i]
    
    elif flg <= l[i] <= flg+k:
            capa+=1
    else:
        bus+=1
        capa=1
        flg=l[i]    
print(bus)

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

t = sorted([int(input()) for i in range(n)])

count = 1
bus = 1
start = t[0]
for i in range(1, n):
    if count == c:
        start = t[i]
        count = 1
        bus += 1
        
    elif start <= t[i] <= start + k:
        count += 1
    else:
        start = t[i]
        bus += 1
        count = 1

print(bus)

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

ans = 0
bus = []

for i in range(n):
    if len(bus) == c:
        ans += 1
        bus = [t[i]]
    elif bus != [] and bus[0] + k < t[i]:
        ans += 1
        bus = [t[i]]
    else:
        bus.append(t[i])

print(ans+1)

Solution (Python):
N, C, K = [int(i) for i in input().split()]
T = sorted([int(input()) for i in range(N)])
ans = 1
limit = 0
ti = T[0]
for i in range(N - 1):
    limit += 1
    if ti + K < T[i + 1] or limit == C:
        ti = T[i + 1]
        ans += 1
        limit = 0
print(ans)

Solution (Python):
n,c,k= map(int,input().split())
t=sorted([int(input()) for i in range(n)])
cnt=1
lim=0
ti=t[0]
for i in range(n-1):
	lim+=1
	if ti+k<t[i+1] or lim==c:
		
		ti=t[i+1]
		cnt+=1
		lim=0

print(cnt)

Solution (Python):

n,c,k=map(int,input().split())
T=[int(input()) for i in range(n)]
T.sort()

until_next=0
cur_t=0
bus_fig=False
bus=0
bus_people=0

for i in range(n):
    cur_t=T[i]
    if bus_fig==False:
        bus+=1
        bus_people+=1
        until_next=T[i]+k
        bus_fig=True
    elif bus_fig==True:
        if bus_people<c:
            if cur_t<=until_next:
                bus_people+=1
                pass
            elif cur_t>until_next:
                bus_fig=True
                bus+=1
                bus_people=1
                until_next=T[i]+k
        else:
            bus_fig=True
            bus+=1
            bus_people=1
            until_next=T[i]+k
print(bus)

Solution (Python):
n,c,k=map(int,input().split())
s=[]
for i in range(n):
    s.append(int(input()))
s.sort()
ans=1
count=0
a=s[0]
for i in range(n):
    if s[i]-a>k:
        a=s[i]
        count=1
        ans+=1
    else:
        count+=1
    if count==c:
        if i!=n-1:
            count=0
            ans+=1
            a=s[i+1]
    
print(ans)

Solution (Python):
n, c, k = map(int, input().split())
T = sorted([ int(input()) for _ in range(n) ])
ans = 0
count = 0
bus = T[0] + k
for i in range(n):
  if not (T[i] <= bus <= T[i]+k) or count >= c:
    ans += 1
    bus = T[i]+k
    count = 0
  count += 1
if count > 0:
  ans += 1
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



N,C,K,*T = map(int,read().split())

T.sort()

bus_t = -K - 100
bus_c = C
answer = 0
for t in T:
    bl = (bus_t + K >= t) and (bus_c + 1 <= C)
    if bl:
        bus_c += 1
        continue
    answer += 1
    bus_t = t
    bus_c = 1

print(answer)

Solution (Python):
from bisect import bisect_right
N,C,K = map(int,input().split())
T = sorted([int(input()) for _ in range(N)])
cnt = 0
cur = 0
while cur<N:
    i = min(cur+C,N)-1
    if T[i]-T[cur]<=K:
        cnt += 1
        cur = i+1
    else:
        i = bisect_right(T,T[cur]+K)-1
        cnt += 1
        cur = i+1
print(cnt)

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

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

ans = 0
t_lim = 0
cnt = 0
for t in T:
    cnt += 1
    if t_lim == 0:
        t_lim = t+k
    if t > t_lim:
        ans += 1
        t_lim = t+k
        cnt = 1
    if cnt == c:
        ans += 1
        t_lim = 0
        cnt = 0
if cnt != 0:
    ans += 1
print(ans)

Solution (Python):

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

buf = []
ans = 0
c, n = C, 0
for t in T:
    if c == C:
        c = 1
        n = t + K
        ans += 1

        
        

    else:
        if t <= n:
            c += 1
            
        else:
            c = 1
            n = t + K
            ans += 1

            
            


print(ans)

Solution (Python):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()
ans = 0
bus = 0
bus_start = 0
passengers = 0
for t in T:
    if passengers == 0:
        bus_start = t
    if bus_start <= t <= bus_start + K:
        passengers += 1
    else:
        passengers = 1
        bus += 1
        bus_start = t
    if passengers == C:
        bus += 1
        passengers = 0
if passengers > 0:
    bus += 1
print(bus)

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

bus = 0
time = 0
i = 0

while i < n:
    bus += 1  
    time = T[i]
    passenger = 1
    while i < n - 1:  
        if T[i + 1] - time > k:  
            break
        if passenger >= c:  
            break
        passenger += 1
        i += 1
    i += 1

print(bus)

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

Solution (Python):
n,c,k = map(int,input().split())
t = []
for i in range(n):
  t.append(int(input()))
t = sorted(t)
count = 1
first = t[0]
first_j = 0
for j in range(n):
  if t[j] - first > k:
    count += 1
    first = t[j]
    first_j = j
  elif j - first_j > c - 1:
    count += 1
    first = t[j]
    first_j = j
print(count)

Solution (Python):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
bus = 1 
passenger = 1 
p = 0 
t = T[0]
while p < N - 1:
        if T[p + 1] <= t + K and passenger < C:
                passenger += 1
        else:
                bus += 1
                passenger = 1 
                t = T[p + 1]
        p += 1
print(bus)

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

t.sort()
passenger = 0
start = t[0]
ans = 1


for i in t:
    if i - start > k or passenger == c:
        ans += 1
        passenger = 1
        start = i
    else:
        passenger += 1


print(ans)

Solution (Python):
from collections import deque

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

ans=0
q=deque()
q.append(T[0])
for Ti in T[1:]:
    if q[0]+K<Ti or len(q)==C:
        q.clear()
        ans+=1
    q.append(Ti)
ans+=1

print(ans)

Solution (Python):




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(input()) for i in range_N] 
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = T[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = T[i] + K
            passenger = 1

        else:
            if T[i] > start:
                bus += 1
                start = T[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()

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

T.sort()

ret = 1
cnt = 1
pre = T[0]
for i in range(1, N) :
  if cnt == C or T[i] > pre + K :
    ret += 1
    cnt = 1
    pre = T[i]
  
  else :
    cnt += 1
  
print(ret)

Solution (Python):
N,C,K = map(int,input().split())
T = sorted([int(input()) for _ in range(N)])
ans = 0
for i in range(N):
  if i == 0:
    st=T[i]
    cnt = 1
  else:
    if cnt==C:
      ans += 1
      cnt = 1
      st = T[i]
    else:
      if T[i]-st > K:
        ans += 1
        cnt = 1
        st = T[i]
      else:
        cnt += 1

if cnt >0: ans += 1
print(ans)

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

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

print(ans)

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

t.sort()
p = t[0]
h = 1
ans = 1
for x in t[1:]:
    h += 1
    if x > p + k or h > c:
        ans += 1
        p = x
        h = 1

print(ans)

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

t = sorted(t)

bus = 0
jyokyaku = 0
start = 0

for i in range(n):
	if jyokyaku == 0:
		start = t[i] + k
		jyokyaku = 1
	
	elif jyokyaku == c:
		bus = bus + 1
		start = t[i] + k
		jyokyaku = 1
							
	else:	
		if t[i] > start:
			bus = bus + 1
			start = t[i] + k
			jyokyaku = 1
				
		elif t[i] <= start:
			jyokyaku = jyokyaku + 1

	

print(bus+1)

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

cnt = 0
t = 0

while t < N:
    cnt += 1
    s = t
    while t < N and T[t] - T[s] <= K and t - s < C:
        t += 1
print(cnt)

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

cnt = 0
l, r = 0, 0
while l < n:
    b = 0
    while r < n and b + 1 <= c and t[r] - t[l] <= k:
        b += 1
        r += 1
    l = r
    cnt += 1
print(cnt)

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

count = []
ans = []
start = 0
for i in range(N):
    if abs(T[start] - T[i]) <= K and len(count) < C:
        count.append(T[i])
    else:
        ans.append(count)
        count = [T[i]]
        start = i
    
    if i == N-1:
        ans.append(count)

print(len(ans))

Solution (Python):
n,c,k=map(int,input().split())
tl=[int(input()) for i in range(n)]
tl.sort()
i=0
bus_count=0
while i<n:
  bus_count+=1
  start=i
  while i<n and tl[i]-tl[start]<=k and i-start<c:
    i+=1
print(bus_count)

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

Solution (Python):
import sys
input = sys.stdin.readline
N, C, K = map(int, input().split())
res = 1
t = []
for _ in range(N):
  t.append(int(input()))
t.sort()
x = t.pop()
c = 1
for i in range(N - 1):
  y = t.pop()
  if abs(x - y) > K or (c >= C):
    res += 1
    x = y
    c = 0
  c += 1
print(res)

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

Solution (Python):


import sys,bisect
input = sys.stdin.readline
n,c,k = map(int, input().split( ))
t = []
for i in range(n):
    ti = int(input())
    t.append(ti)

t.sort()
cnt = 0
fin = 0
while fin <n:
    fin2 = bisect.bisect_right(t,t[fin]+k)
    fin = min(fin+c,fin2)
    
    
    cnt+=1
print(cnt)

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

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

T.sort()
ans = 1
head = T[0]
num = 1

for i in range(1,N):
    if num+1 > C or head+K < T[i]:
        ans += 1
        head = T[i]
        num = 1
    else:
        num += 1
        
print(ans)

Solution (Python):
N,C,K=map(int,input().split())
cus=[None]*N
for i in range(N):
  t=int(input())
  cus[i]=[t,t+K]
cus=sorted(cus,key=lambda x:x[1])

last=-1
ans=0
rest=0
for i in range(N):
  if rest==0 or last<cus[i][0]:
    last=cus[i][1]
    ans+=1
    rest=C-1
  elif rest>0:
    rest-=1
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

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


def AirportBus(x=0,ans=0):
    y = x
    for i in range(x, n):
        if t[x]+k < t[i] or i - x >= c:
          y = i
          break
    if y == x:
      print(ans+1)
      return
    ans += 1
    AirportBus(y,ans)
    
AirportBus()

Solution (Python):
n,c,k=map(int,input().split())
s=[]
for i in range(n):
    s.append(int(input()))
s.sort()
ans=1
count=0
a=s[0]
for i in range(n):
    if s[i]-a>k:
        a=s[i]
        count=1
        ans+=1
    else:
        count+=1
    if count==c:
        if i!=n-1:
            count=0
            ans+=1
            a=s[i+1]
    
print(ans)

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

Ts = sorted(Ts)
bus_num = 1
bus_i = [1]
bus_t = Ts[0]
for t in Ts[1:]:
    if (t<=(bus_t+K)) & (len(bus_i) < C):
        bus_i.append(1)
    else:
        bus_i = [1]
        bus_t = t
        bus_num +=1
print(bus_num)

Solution (Python):

import sys


def main():
    n, c, k, *T = [int(x) for x in sys.stdin.read().split()]
    T.sort()


    count = 0
    bus_count = 1
    t = T[0]
    for i in range(n):
        if T[i] - t > k:
            bus_count += 1
            count = 1
            t = T[i]
            continue
        count += 1
        if count > c:
            bus_count += 1
            count = 1
            t = T[i]
    
    print(bus_count)


if __name__ == '__main__':
    main()

Solution (Python):
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
time = T[0] + K
answer = 0
passenger = 0
for i, t in enumerate(T):
    if time < t or passenger == C:
        answer += 1 
        passenger = 0
        time = t + K
    
    passenger += 1
    if i == N - 1:
        answer += 1
print(answer)

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

Solution (Python):

N, C, K = map(int, input().split())
T = []
for i in range(N):
    t1 = int(input())
    T.append(t1)
    
T.sort()
conut = 0
l = T[0]
n = 1
i = 0
ans = 0
while True:
    if T[i] - l > K:
        ans += 1
        n = 1
        l = T[i]
    elif n == C:
        if i <= N-2:
            l = T[i+1]
        ans += 1
        n = 0
    if i == N-1:
        if n > 0:
            ans += 1
        break
    i += 1
    n += 1    

print(ans)

Solution (Python):
N, C, K = map(int, input().split())
t = list(int(input()) for _ in range(N))
t.sort()
ans = 0
s = t[0] + K
cnt = 0
cntF = True
for i in range(N):
    cntF = True
    if t[i] <= s:
        if cnt == C:
            cnt = 1
            ans += 1
            s = t[i] + K
            cntF = False
        else:
            cnt += 1
        continue

    cnt = 1
    s = t[i] + K
    ans += 1
if cntF:
    ans += 1

print(ans)

Solution (Python):

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

T = []

for i in range(N):

    t = int(input())
    T.append(t)

T.sort()

ans = 0
now = 0
nt = T[0]
for i in range(N):

    if T[i] - nt > K:
        ans += 1
        nt = T[i]
        now = 1

    elif now == C:
        ans += 1
        nt = T[i]
        now = 1

    else:
        now += 1

print (ans+1)