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



Sample input:
5 3 5
1
2
3
6
12


Sample output:
3

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def ceil(a, b=1): return int(-(-a // b))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, C, K = MAP()
tN = [INT() for i in range(N)]

tN.sort()
ans = 0
bus = 0
timer = K
for i in range(N):
    if bus == 1 or bus == 2:
        timer -= tN[i] - tN[i-1]
        # 時間が過ぎていたら今のバスは出発済にする
        if timer < 0:
            ans += 1
            bus = 0
            timer = K
    # 1,2人目は普通に乗せる
    if bus == 0 or bus == 1:
        bus += 1
    # 3人目が乗ったら出発
    elif bus == 2:
        ans += 1
        bus = 0
        timer = K
# 未出発のバスを出発させる
if bus != 0:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int,input().split(" "))
ar = []
for i in range(n):
    l = int(input())
    ar.append(l)
ar.sort()
count = 1
i = 0
t = 1
while True:
    if i == n-1:
        break
    else:
        if ar[i+1] - ar[i] <= k and t < c:
            t += 1
            i += 1
        else:
            count += 1
            i += 1
            t = 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

count=1

bus_count=0

for j in range(n-1):
    bus_count+=1
    if(x[j]+k<=x[j+1] or bus_count==c):
        count+=1
        bus_count=0

Submission status: Wrong Answer

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

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

count=1

bus_count=0

for j in range(n-1):
    bus_count+=1
    if(x[j]+k<x[j+1] or bus_count==c):
        count+=1
        bus_count=0

Submission status: Wrong Answer

Solution code:
import bisect
import sys

sys.setrecursionlimit(200000)


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


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


N, C, K = il()
T = sorted(imi(N))
ll = []
c = 1
for t in T:
    ll.append(t)
    if len(ll) == C:
        ll = []
        c += 1
    elif ll[0] + K < t:
        ll = [t]
        c += 1
print(c)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=[int(input()) for _ in [0]*n]
t.sort()
t=t+[0]
b=1
h=0
d=t[0]
for i in range(n):
  if(h<c and t[i]-d<=k):
    h+=1
  else:
    b+=1
    h=1
    d=t[i+1]
print(b)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=[int(input()) for _ in [0]*n]
t.sort()
t=t+[0]
b=1
h=0
d=t[0]
for i in range(n):
  if(h<=c and t[i]-d<=k):
    h+=1
  else:
    b+=1
    h=1
    d=t[i+1]
print(b)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=[int(input()) for _ in [0]*n]
t.sort()
t=t+[0]
b=1
h=0
d=t[0]
for i in range(n):
  if(h<=0 and t[i]-d<=k):
    h+=1
  else:
    b+=1
    h=0
    d=t[i+1]
print(b)

Submission status: Wrong Answer

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

T = []

for i in range(N):
    tmp = int(input())
    T.append(tmp)
    
T.sort()
    
ans = 0
now = 1
now_time = T[0]

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

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
T=[]
for i in range(N):
    p=int(input())
    T.append(p)
  
ans = 1
T = sorted(T)
ind = 0
 
for i in range(len(T)):
    if T[i] > T[ind]+K:
        ans += 1
        ind = i
    elif i >= ind + C:
        ans += 1

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, c, k = list(map(int, input().split()))
    t = []
    for i in range(n):
        t.append(int(input()))

    t.sort()
    p = 0
    bus = 0
    count = 0
    for i in t:
        count += 1
        if p + k < i or count == c:
            bus += 1
            p = i
            count = 0

    if p != 0:
        bus += 1

    print(bus)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, c, k = list(map(int, input().split()))
    t = []
    for i in range(n):
        t.append(int(input()))

    t.sort()
    p = 0
    bus = 0
    count = 0
    for i in t:
        count += 1
        if p + k < i or p == c:
            bus += 1
            p = i
            count = 0

    if p != 0:
        bus += 1

    print(bus)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, c, k = list(map(int, input().split()))
    t = []
    for i in range(n):
        t.append(int(input()))

    t.sort()

    p = t[0]
    buss = 1
    count = 1
    for i in t[1:]:
        if p < 0:
            p = i
            continue
        if p + k < i or count == c:
            buss += 1
            count = 0
            p = -1
        else:
            count += 1

    print(buss)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, c, k = list(map(int, input().split()))
    t = []
    for i in range(n):
        t.append(int(input()))

    t.sort()

    p = t[0]
    buss = 1
    count = 1
    for i in t[1:]:
        if p + k < i or count == c:
            buss += 1
            count = 0
            p = i
        else:
            count += 1
        
    print(buss)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n, c, k = list(map(int, input().split()))
    t = []
    for i in range(n):
        t.append(int(input()))

    t.sort()

    p = t[0]
    buss = 1
    count = 1
    for i in t[1:]:
        if p + k < i or count == c:
            print(i)
            buss += 1
            count = 0
            p = i
        else:
            count += 1
        
    print(buss)

Submission status: Wrong Answer

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

ANS=1
B=1
T=P[0]
for j in range(1,N):
    if C<(P[j]-T):
        ANS+=1
        B=1
        T=P[j]
    elif B<K:
        B+=1
    elif B>=K:
        ANS+=1
        B=1
        T=P[j]

print(ANS)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C
j=1
while j<N:
    k-=A[j]-A[j-1]
    c-=1
    if k>=0 and c>=0:    
        j+=1
    else:     
        a+=1
        c=C
        k=K
        j+=1
print(a+1)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
c=C
j=1
while j<N:
    k-=A[j]-A[j-1]
    c-=1
    if k>0 and c>0:    
        j+=1
    else:     
        a+=1
        c=C
        k=K
        j+=1
print(a+1)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
n=N
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and n>0:    
        j+=1
    else:     
        a+=1
        n=N
        k=K
        j+=1
print(a+1)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
n=N
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and n>0:    
        j+=1
        if j==N:
            a+=1
    else:     
        a+=1
        n=N
        k=K
        j+=1
        if j==N:
            a+=1
print(a)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
A=[]
for i in range(N):
    a=int(input())
    A.append(a)
A.sort()
k=K
a=0
n=N
j=1
while j<N:
    k-=A[j]-A[j-1]
    n-=1
    if k>0 and n>0:    
        j+=1
    else:     
        a+=1
        n=N
        k=K
        j+=1
        if j==N:
            a+=1
print(a)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()
tmp = T[0]
ans = 0
cnt = 1
for i in range(1, N):
    cnt += 1
    if T[i]-tmp>K:
        ans += 1
        cnt = 1
        tmp = T[i]
    elif cnt>C:
        ans += 1
        cnt = 1
        tmp = T[i]
print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
ans = 0
t = [int(input()) for _ in range(N)]
t.sort()
for i in range(N):
    if i==0:
        tmp = t[i]+K
        cnt = 1
    else:
        cnt += 1
        if t[i] > tmp or i==N-1 or cnt==C:
            ans += cnt//C if cnt%C==0 else cnt//C+1
            tmp = t[i]+K
            cnt = 1
    # print(i,cnt, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N,C,K = map(int, input().split())
ans = 0
t = [int(input()) for _ in range(N)]
t.sort()
for i in range(N):
    if i==0:
        tmp = t[i]+K
        cnt = 1
    elif t[i] < tmp and i<N-1:
        cnt += 1
    else:
        cnt += 1
        ans += cnt//C if cnt%C==0 else cnt//C+1
        tmp = t[i]+K
        cnt = 1
    # print(i,cnt, ans)
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int, input().split())
t = [int(input()) for i in range(n)]
t.sort()
ans = 1
while t:
    for i in range(min(c,len(t))):
        t.pop(0)
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
x=[0]*2
ans=0
l=[]
for i in range(n):
    n=int(input())
    l.append(n)
l.sort()


for n in l:
    if x[0]==0 and c>1:
        x=[n,1]
    elif x[0]==0:
        ans+=1
    if n>x[0]+k:
        ans+=1
        x=[n,1]
    elif x[1]+1<c:
        x[1]+=1
    else:
        ans+=1
        x=[0,0]
print(ans+[0,1][x[0]>0])

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
x=[0]*2
ans=0
l=[]
for i in range(n):
    n=int(input())
    l.append(n)
l.sort()


for n in l:
    if x[0]==0 and c>1:
        x=[n,1]
    elif x[0]==0:
        ans+=1
    if n>x[0]+k:
        ans+=1
        x=[n,1]
    elif x[1]+1<c:
        x[1]+=1
    else:
        ans+=1
        x=[n,1]
print(ans)

Submission status: Wrong Answer

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

p = 0 #t[i]を処理し終えた時点で、待機してる人数
w = t[0] #t[i]を処理し終えた時点で、待機してる人の中で一番最初から待ってる人の時間

res = 0 #t[i]を処理し終えた時点で、用いたバスの数
for i in range(n):
    p += 1
    if c == p:
        p = 0
        res += 1
        if i != n-1:
            w = t[i+1]
    elif t[i]-w > k:
        p = 1
        res += 1
        w = t[i]
        if i == n-1:
            res += 1
    else:
        if i == n-1:
            res += 1

print(res)

Submission status: Wrong Answer

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

p = 0 #待機してる人数
w = t[0] #待機してる人の中で一番最初から待ってる人の時間

res = 0
for i in range(n):
    p += 1
    if c == p:
        p = 0
        res += 1
        if i != n-1:
            w = t[i+1]
    elif t[i]-w > c:
        p = 1
        res += 1
        w = t[i]
        if i == n-1:
            res += 1
    else:
        if i == n-1:
            res += 1

print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n,c,k = map(int, input().split())
k *= 2
t = []
for _ in range(n):
    t.append(int(input())*2)
t.sort()
# print(t)
res = 0
s = []
for x in t:
    if len(s)==0:
        s.append(x)
    else:
        # print(x,s,x-s[0])
        if x-s[0]>=k:
            res += 1
            s = [x]
        elif len(s)+1>c:
            res += 1
            s = s[c:]
            s.append(x)
        else:
            s.append(x)
# print(s)
if len(s)>0:
    res += 1
print(res)

Submission status: Wrong Answer

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

bus = 0
kyaku = 0
dep_time = 0
for t in T:
    if t > dep_time:
        dep_time = t + K
        kyaku += 1
        bus += 1
    elif kyaku == C:
        dep_time = t + K
        kyaku = 1
        bus += 1
    else:
        kyaku += 1

print(bus)

Submission status: Wrong Answer

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

bus = 0
kyaku = 0
dep_time = 0
for t in T:
    if t > dep_time:
        dep_time = t + K
        kyaku += 1
        bus += 1
    elif kyaku == C:
        dep_time = t + K
        kyaku = 0
        bus += 1
    else:
        kyaku += 1

print(bus)

Submission status: Wrong Answer

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

Bus, Cap = 1, 1
Lim = T[0]+K
for i in range(N-1):
    if T[i+1] <= Lim:
        if Cap < C:
            Cap += 1
        else:
            Bus += 1
            Cap = 1
            Lim = T[i] + K
    else:
        Bus += 1
        Cap = 1
        Lim = T[i+1] + K
print(Bus)

Submission status: Wrong Answer

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

Bus, Cap = 1, 1
Lim = T[0]+K
for i in range(N-1):
    if T[i+1] <= Lim:
        if Cap < C:
            Cap += 1
        else:
            Bus += 1
            Cap = 0
            Lim = T[i] + K
    else:
        Bus += 1
        Cap = 0
        Lim = T[i+1] + K
print(Bus)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = []
for _ in range(N):
    T.append((int(input()), False))
    T.append((T[-1][0] + K, True))
T.sort(key=lambda x: (x[0], x[1]))
ans = 0
arrived = 0
head = -1
for t, bo in T:
    if arrived == 0 and not bo:
        head = t
    arrived += not bo
    if (bo and arrived > 0 and head > t - K) or arrived == C:
        arrived = 0
        ans += 1
        head = -1
if arrived > 0:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = []
for _ in range(N):
    T.append((int(input()), True))
    T.append((T[-1][0] + K, False))
T.sort(key=lambda x: (x[0], x[1]))
ans = 0
arrived = 0
head = -1
for t, bo in T:
    if arrived == 0 and bo:
        head = t
    arrived += bo
    if (not bo and arrived > 0 and head > t - K) or arrived == C:
        arrived = 0
        ans += 1
        head = -1
if arrived > 0:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = []
for _ in range(N):
    T.append((int(input()), True))
    T.append((T[-1][0] + K, False))
T.sort(key=lambda x: (x[0], x[1]))
ans = 0
arrived = 0
head = -1
for t, bo in T:
    if arrived == 0 and bo:
        head = t
    arrived += bo
    if (not bo and arrived > 0 and head > t - K) or arrived == C:
        arrived = 0
        ans += 1
        head = 9999999
if arrived > 0:
    ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
first = 0
sum_v = 0
count = 0
d = {}

for t in T:
    if t in d:
        d[t] += 1
    else:
        d[t] = 1
d = sorted(d.items())

for i in range(len(d)):

    if K <= d[i][0] - first and first != 0:
        #print("最初の人の待ち時間オーバーなので出発", first, ":", d[i])
        first = 0
        sum_v = 0
        count += 1

    if first == 0:
        #print("firstが０なのでストックする", d[i])
        first = d[i][0]
        sum_v += d[i][1]
    else:
        #print("追加：", d[i])
        sum_v += d[i][1]
        
    if sum_v >= C:
        #print("バスの定員に達したので出発", d[i])
        count += sum_v // C
        sum_v = sum_v % C
        first = 0

if sum_v != 0:
    #print("残った人を乗せて出発")
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
first = 0
sum_v = 0
count = 0
d = {}

for t in T:
    print("t", t)
    if t in d:
        d[t] += 1
    else:
        d[t] = 1
d = sorted(d.items())

for i in range(len(d)):

    if K <= d[i][0] - first and first != 0:
        #print("最初の人の待ち時間オーバーなので出発", first, ":", d[i])
        first = 0
        sum_v = 0
        count += 1

    if first == 0:
        #print("firstが０なのでストックする", d[i])
        first = d[i][0]
        sum_v += d[i][1]
    else:
        #print("追加：", d[i])
        sum_v += d[i][1]
        
    if sum_v >= C:
        #print("バスの定員に達したので出発", d[i])
        count += sum_v // C
        sum_v = sum_v % C
        first = 0

if sum_v != 0:
    #print("残った人を乗せて出発")
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
first = 0
sum_v = 0
count = 0
d = {}

for t in T:
    if t in d:
        t += 1
    else:
        d[t] = 1
d = sorted(d.items())

for i in range(len(d)):

    if K <= d[i][0] - first and first != 0:
        #print("最初の人の待ち時間オーバーなので出発", first, ":", d[i])
        first = 0
        sum_v = 0
        count += 1
       
    if first == 0:
        #print("firstが０なのでストックする", d[i])
        first = d[i][0]
        sum_v += d[i][1]
    else:
        #print("追加：", d[i])
        sum_v += d[i][1]
        
    if sum_v >= C:
        #print("バスの定員に達したので出発", d[i])
        count += sum_v // C
        sum_v = sum_v % C
        first = 0

if sum_v != 0:
    #print("残った人を乗せて出発")
    count += 1

print(count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
first = 0
sum_v = 0
count = 0
d = {}

for t in T:
    if t in d:
        t += 1
    else:
        d[t] = 1
d = sorted(d.items())

for i in range(len(d)):
       
    if first == 0:
        first = d[i][0]
        sum_v += d[i][1]
        
    if K <= d[i][0] - first:
        first = 0
        sum_v = 0
        count += 1

    else:
        sum_v += d[i][1]
        
    if sum_v >= C:
        count += sum_v // C
        sum_v = sum_v % C
        first = 0

if sum_v != 0:
    count += 1
    
print(count)

Submission status: Wrong Answer

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

t_list.sort(reverse=True)
tmp = t_list.copy()
ignore = 0
count = 0
for i, t in enumerate(t_list):
    if i != 0 and ignore >= i:
        continue
    passenger = 1
    count += 1
    ignore = i
    while True:
        if tmp:
            if i == 0 and passenger == 1:
                tmp.pop(0)
            tm = tmp.pop(0)
            if t - tm <= K:
                passenger += 1
                ignore += 1
                if passenger == C:
                    tmp.pop(0)
                    break
            else:
                break
        else:
            break
print(count)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
last = T[0]
ans = 0; awaiting = 0
for i in range(N):
    if T[i] <= last+K:
        awaiting += 1
        while awaiting >= C:
            ans += 1
            awaiting -= C
            last = T[i]
            # print("a")
        # else:
            # print("b")
    else:
        while awaiting >= C:
            ans += 1
            awaiting -= C
            last = T[i]
        if awaiting > 0:
            ans += 1
        last = T[i]
        awaiting = 1
        # print("c")

while awaiting >= C:
    ans += 1
    awaiting -= C
    last = T[i]
if awaiting > 0:
    ans += 1

print(ans)
# print(T)

Submission status: Wrong Answer

Solution code:
import math
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
last = T[0]
ans = 0; awaiting = 0
for i in range(N):
    if T[i] <= last+K:
        awaiting += 1
        if awaiting%C == 0:
            ans += awaiting // C
            awaiting = 0
            last = T[i]
            # print("a")
        # else:
            # print("b")
    else:
        if awaiting > 0:
            ans += math.ceil(awaiting / C)
            awaiting = 0
        last = T[i]
        awaiting = 1
        # print("c")

if awaiting > 0:
    ans += math.ceil(awaiting / C)
print(ans)
# print(T)

Submission status: Wrong Answer

Solution code:
import math
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
last = T[0]
ans = 0; awaiting = 1
for i in range(1,N):
    if T[i] <= last+K:
        awaiting += 1
        if awaiting%C == 0:
            ans += awaiting // C
            awaiting = 0
            last = T[i]
            # print("a")
        # else:
            # print("b")
    else:
        if awaiting > 0:
            ans += math.ceil(awaiting / C)
            awaiting = 0
        last = T[i]
        awaiting = 1
        # print("c")

if awaiting > 0:
    ans += math.ceil(awaiting / C)
print(ans)
# print(T)

Submission status: Wrong Answer

Solution code:
import math
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
last = T[0]
ans = 0; awaiting = 1
for i in range(1,N):
    if T[i] <= last+K:
        awaiting += 1
        if awaiting%C == 0:
            ans += awaiting // C
            awaiting = 0
            last = T[i]
            # print("a")
        # else:
            # print("b")
    else:
        if awaiting > 0:
            ans += math.ceil(awaiting / C)
            awaiting = 0
        last = T[i]
        awaiting = 1
        # print("c")

if awaiting > 0:
    ans += 1
print(ans)
# print(T)

Submission status: Wrong Answer

Solution code:
import math
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
last = T[0]
ans = 0; awaiting = 1
for i in range(1,N):
    if T[i] <= last+K:
        awaiting += 1
        if awaiting%C == 0:
            ans += awaiting // C
            awaiting = 0
            last = T[i]
            # print("a")
        # else:
            # print("b")
    else:
        if awaiting > 0:
            ans += 1
            awaiting = 0
        last = T[i]
        awaiting = 1
        # print("c")

if awaiting > 0:
    ans += 1
print(ans)
# print(T)

Submission status: Wrong Answer

Solution code:
import math
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
last = T[0]
ans = 0; awaiting = 1
for i in range(1,N):
    if T[i] <= last+K:
        awaiting += 1
        if awaiting%C == 0:
            ans += 1
            awaiting = 0
            last = T[i]
    else:
        if awaiting > 0:
            ans += 1
            awaiting = 0
        last = T[i]
        awaiting = 1

if awaiting > 0:
    ans += 1
print(ans)
# print(T)

Submission status: Wrong Answer

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

res = 0
count_teiin = 0
prev_bus = -1
for i in t:
    # 前のバスが行ってしまったら、i分に出発するバスを手配
    if prev_bus == -1 or prev_bus+k < i:
        res += 1
        prev_bus = i
        count_teiin = 1
    else:
        count_teiin += 1
        # 定員になったら出発
        if count_teiin == c:
            prev_bus = -1
print(res)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
#print(T)
Bcnt = 0
while True:
    if len(T) <= 0:
        break
    BS = T[0] + K - 0.1
    Bcnt += 1
    del T[0]
    cnt = 1
    while cnt < C and len(T) > 0:
        if T[0] <= BS:
            del T[0]
            cnt += 1
        else:
            break
print(Bcnt)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
#print(T)
Bcnt = 0
while True:
    if len(T) <= 0:
        break
    BS = T[0] + K - 0.1
    Bcnt += 1
    del T[0]
    cnt = 1
    while cnt < 3 and len(T) > 0:
        if T[0] <= BS:
            del T[0]
            cnt += 1
        else:
            break
print(Bcnt)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
#print(T)
Bcnt = 0
while True:
    if len(T) <= 0:
        break
    BS = T[0] + K
    Bcnt += 1
    del T[0]
    cnt = 1
    while cnt < 3 and len(T) > 0:
        if T[0] <= BS:
            del T[0]
            cnt += 1
        else:
            break
print(Bcnt)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
o=sorted(int(input()) for _ in range(n))
cnt=0
l=0
r=0

while l<n:
  while r<n and o[r]<=o[l]+c and r-l+1<=k:
    r+=1
  cnt+=1
  l=r

print(cnt)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split(' '))

t = [0 for i in range(n)]

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

t.sort()

lowest = t[0]
res = 1

for i in range(n):
	if i - lowest >= c:
		lowest = i
		res += 1
	elif t[i] - t[lowest] > k:
		lowest = i
		res += 1

print res

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split(' '))

t = [0 for i in range(n)]

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

lowest = -1
res = 0

for i in range(n):
	if lowest == -1:
		lowest = i
		res += 1
	elif i - lowest >= c:
		lowest = i
		res += 1
	elif t[i] - t[lowest] > k:
		lowest = i
		res += 1
print res

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = [0] * n

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

    sorted_t = sorted(t, key=lambda x: x[1])
    current_pos = sorted_t[0][1]
    remain = c - 1
    bus_count = 1

    for i in range(1, n):
        if remain >= 1 and current_pos <= sorted_t[i][1]:
            remain -= 1
        else:
            bus_count += 1
            current_pos = sorted_t[i][1]
            remain = c - 1

    print(bus_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = [0] * n

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

    sorted_t = sorted(t, key=lambda x: x[1])
    current_pos = sorted_t[0][1]
    remain = c - 1
    bus_count = 1

    for i in range(1, n):
        if remain >= 1 and sorted_t[i][0] < current_pos <= sorted_t[i][1]:
            remain -= 1
        else:
            bus_count += 1
            current_pos = sorted_t[i][1]
            remain = c - 1

    print(bus_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = [0] * n

    for i in range(n):
        ti = int(input())
        t[i] = (ti, ti + k - 1)

    sorted_t = sorted(t, key=lambda x: x[1])
    current_pos = sorted_t[0][1]
    remain = c
    bus_count = 1

    for i in range(1, n):
        if remain >= 1 and sorted_t[i][0] <= current_pos <= sorted_t[i][1]:
            remain -= 1
        elif remain == 0:
            bus_count += 1
            remain = c
        else:
            bus_count += 1
            current_pos = sorted_t[i][1]
            remain = c

    print(bus_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = [0] * n

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

    sorted_t = sorted(t, key=lambda x: x[1])
    current_pos = sorted_t[0][1]
    remain = c
    bus_count = 1

    for i in range(1, n):
        if remain >= 1 and sorted_t[i][0] < current_pos <= sorted_t[i][1]:
            remain -= 1
        elif remain == 0:
            bus_count += 1
            remain = c
        else:
            bus_count += 1
            current_pos = sorted_t[i][1]
            remain = c

    print(bus_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


def main():
    n, c, k = list(map(int, input().split()))
    t = [0] * n

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

    sorted_t = sorted(t, key=lambda x: x[1])
    current_pos = sorted_t[0][1]
    remain = c
    bus_count = 1

    for i in range(1, n):
        if remain >= 1 and sorted_t[i][0] < current_pos <= sorted_t[i][1]:
            remain -= 1
        else:
            bus_count += 1
            current_pos = sorted_t[i][1]
            remain = c

    print(bus_count)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

t = []
for i in range(n):
    t.append(int(input()))
t.sort()
a = t[0]
b = 1
ans = 1
for i in range(1,n):
    if t[i]-a <= k and b < c:
        b += 1
    else:
        ans += 1
        a = t[i]
        b = 0
print(ans)

Submission status: Wrong Answer

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

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

a = t[0]
b = 1
ans = 0
for i in range(1,n):
    if t[i] <= a+k and b < c:
        a = t[i]
        b += 1
    else:
        ans += 1
        if i < n-1:
            a = t[i+1]
        
print(ans)