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:
n, c, k = map(int, input().split())
array = sorted([int(input()) for x in range(n)])

bus_cnt = 0
bus = c
time_old = 0
time_now = 0
for i in array:
    div_time = i-time_old
    if bus != 0 and div_time < k:
        bus -= 1
    else:
        bus_cnt += 1
        bus = c-1
    time_old = i

print(bus_cnt)

Submission status: Wrong Answer

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

bus_cnt = 0
bus = 0
time_old = 0
time_now = 0
for i in array:
    div_time = i-time_old
    if bus < c and div_time < k:
        bus += 1
    else:
        bus_cnt += 1
        bus = 1
    time_old = i

print(bus_cnt+1)

Submission status: Wrong Answer

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

bus_cnt = 0
bus = 0
time_old = 0
time_now = 0
for i in array:
    div_time = i-time_old
    if bus < c and div_time <= k:
        bus += 1
    else:
        bus_cnt += 1
        bus = 1
    time_old = i

print(bus_cnt+1)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
data=[]
for i in range(n):
    data.append(int(input())+k)
data=sorted(data)
count=0
ans=0
while count<n:
    bus=data[count]
    mx=c
    while mx and count<n:
        if data[count]-k<bus and bus<=data[count]:
            mx-=1
        else:
            break
        count+=1
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
data=[]
for i in range(n):
    data.append(int(input())+k)
data=sorted(data)
count=0
ans=0
try:
    while count<n:
        bus=data[count]
        ans+=1
        mx=c
        while mx or count<n:
            if data[count]-k<bus and bus<=data[count]:
                mx-=1
            else:
                break
            count+=1
    print(ans)
except:
    print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
data=[]
for i in range(n):
    data.append(int(input())+k)
data=sorted(data)
count=0
ans=0
try:
    while count<n:
        bus=data[count]
        ans+=1
        mx=c
        while mx or count<n:
            if data[count]-k<bus and bus<=data[count]:
                mx-=1
            else:
                break
            count+=1
except:
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def merge(L,R):
    res = []
    
    l_L = len(L)
    l_R = len(R)
    i = 0
    j = 0
    while (i <= l_L) & (j <= l_R):
        if (i == l_L) & (j == l_R):
            return res
        elif i == l_L:
            res.append(R[j])
            j += 1
        elif j == l_R:
            res.append(L[i])
            i += 1
        elif L[i] <= R[j]:
            res.append(L[i])
            i += 1
        else:
            res.append(R[j])
            j += 1
    return res

def divide(A):
    l_A = len(A)
    l_L = int(l_A / 2)
    l_R = l_A - l_L
    L = A[:l_L]
    R = A[l_L:]
    return L,R

def my_sort(A):
    l_A = len(A)
    if l_A == 1:
        return A
    else:
        L,R = divide(A)
        L = my_sort(L)
        R = my_sort(R)
        return merge(L,R)
    
N , C, K = map(int,input().split())
T = []
for _ in range(0,N):
    T.append(int(input()))
T = my_sort(T)

bus = 0
t_0 = T[0]
t_B = T[0] + K
num = 0


i = 0
while i < len(T):
    t = T[i]
    dt = t - t_0
    if (dt < K) & (float((num + 1)) / float(C) <= 1):
        num += 1
    else:
        if num != 0:
            #print(T[i-1])
            bus += 1
            t_0 = t
            num = 1
    i += 1
bus += 1
print(bus)

Submission status: Wrong Answer

Solution code:
N,C,K=map(int,input().split())
tourist=[]
for i in range (N):
    T=int(input())
    tourist.append(T)
tourist.sort()
bus_count=1
bus_tourlist=1
bus_limit=tourist[0]+K
for j in range (1,len(tourist)):
    if bus_tourlist==C or tourist[j]>bus_limit:
        bus_count+=1
        bus_limit=tourist[j]+K
        bus_tourlist+=1
    
    else:
        bus_tourlist+=1
print(bus_count)

Submission status: Wrong Answer

Solution code:
def main():
    n, c, k = map(int, input().split())
    t_lst = [int(input()) for i in range(n)]

    t_lst.sort()
    idx, bus = 0, 0
    while idx < n:
        t = t_lst[idx]
        bus += 1
        cus = 1
        idx += 1
        while idx < n and cus < c and t_lst[idx] - t < k:
            cus += 1
            idx += 1

    print(bus)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
ans, ws, wn = 0, 0, 0 #wait_start, wait_number
for i in t:
    if(wn == 0):
        ws = i
    wn += 1
    if(i - ws >= k):
        ans += 1
        ws = i
        wn = 1
        continue
    if(wn == c):
        ans += 1
        wn = 0
print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]
t.sort()
ans, ws, wn = 0, 0, 0 #wait_start, wait_number
for i in t:
    if(wn == 0):
        ws = i
    wn += 1
    if(i - ws >= k):
        ans += 1
        ws = i
        wn = 1
        continue
    if(wn == c):
        ans += 1
        wn == 0
print(ans)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = []
T.append(int(input()))
K1 = T[0] + K
hito = 1
bus = 1
for i in range(1, N):
    T.append(int(input()))
    if T[i] > K1 or hito + 1 > C:
        bus += 1
        hito = 1
        K1 = T[i] + K
    hito += 1
print(bus)

Submission status: Wrong Answer

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

p = C-1
d = T[0]
ans = 1
for t in T[1:]:
    if p == 0 or t > d:
        d = t+K
        p = C-1
        ans += 1
    else:
        p -= 1

print(ans)

Submission status: Wrong Answer

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

p = C
d = T[0]
ans = 1
for t in T:
    if p == 0 or t > d:
        d = t+K
        p = C-1
        ans += 1
    else:
        p -= 1

print(ans)

Submission status: Wrong Answer

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

p = C
d = T[0]
ans = 1
for t in T:
    if C == 0 or t > d:
        d = t+K
        p = C-1
        ans += 1
    else:
        p -= 1

print(ans)

Submission status: Wrong Answer

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

T = []

for i in range(N):    
    T.append(int(input()))
    
T = sorted(T)
    
start = T[0]
ans = 1
now_C = 1
for t in T:
    if t<=start+K and now_C < C:
        now_C += 1
    else:
        start = t
        ans += 1
        now_C = 1

print(ans)

Submission status: Wrong Answer

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

T = []

for i in range(N):    
    T.append(int(input()))
    
start = T[0]
ans = 1
now_C = 1
for t in sorted(T[1:]):
    if t<=start+K and now_C < C:
        now_C += 1
    else:
        start = t
        ans += 1
        now_C = 1

print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=[int(i) for i in input().split()]
a=sorted([int(input()) for i in range(n)])
b=[i+k for i in a]
i0=[]
ans=0
bi=0
for i in range(n):
  i0.append(a[i])
  if len(i0) == c or (b[bi] < a[i] and i!=0) :
    ans+=1
    i0=[]
    bi=i
  if len(i0) != c and i==n-1:
    ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
n,c,k=[int(i) for i in input().split()]
a=sorted([int(input()) for i in range(n)])
b=[i+k for i in a]
i0=[]
ans=0
bi=0
for i in range(n):
  i0.append(a[i])
  if len(i0) == c or (b[bi] < a[i] and i!=0) :
    ans+=1
    i0=[]
    bi=i
  if i==n-1:
    ans+=1

print(ans)

Submission status: Wrong Answer

Solution code:
n,m,c = map(int,input().split())
lis = []
for i in range(n):lis.append(int(input()))
lis.sort()
ans = 0
time = 0
cou = 0
for i in range(n):
    if time == 0:
        time = lis[i]
        cou += 1
    elif lis[i] <= time + c and cou < i:
        cou += 1
    else:
        ans += 1
        cou = 1
        time = lis[i]
ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, C, K] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    T = []
    for i in range(N):
        input_raw = read_func().strip().split()
        T.append(int(input_raw[0]))
    T.sort()
    bus_count = 0
    first_time = T[0]
    people_count = 0
    for i in range(N):
        if T[i] <= first_time + K:
            people_count += 1
        else:
            bus_count += people_count/C + (0 if people_count % C == 0 else 1)
            first_time = T[i]
            if i < N - 1:
                people_count = 1
            else:
                people_count = 0
    bus_count += people_count/C + (0 if people_count % C == 0 else 1)
    print bus_count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, c, k = map(int,input().split())
take = [int(input()) for _ in range(n)]
take.sort()
ans = 1
p = take[0]
r = 1
for i in range(1, n):
    if r < c:
        if take[i] - p <= k:
            r += 1
        else:
            ans += 1
            p = take[i]
    else:
        ans += 1
        r = 1
        p = take[i]

print(ans)

Submission status: Wrong Answer

Solution code:
n,e,k = list(map(int,input().split()))
a =[]
for i in range(n):
    a.append(int(input()))
a.sort()
b = a[0]
c = 1
d = 1
for i in range(1,n):
    if a[i] <= (b+k):
        if (c+1) > e:
            d += 1
            b = a[i]
            c = 0
        else:
            c += 1
    else:
        b = a[i]
        d += 1
        c = 0
if c == 0:
    print(d)
else:
    print(d+1)

Submission status: Wrong Answer

Solution code:
n,e,k = list(map(int,input().split()))
a =[]
for i in range(n):
    a.append(int(input()))
a.sort()
print(a)
b = a[0]
c = 1
d = 1
for i in range(1,n):
    if a[i] <= (b+k):
        if (c+1) > e:
            d += 1
            b = a[i]
            c = 0
        else:
            c += 1
    else:
        b = a[i]
        d += 1
        c = 0
if c == 0:
    print(d)
else:
    print(d+1)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=[]
for i in range(n):
  t.append(int(input()))
t.sort()
num=0
pas=0
end=-1
for i in range(n):
  if(end<t[i]):
    num+=1
    end=t[i]+k
    pas+=1
    if(pas==c):
      end=-1
      pas=0
  else:
    pas+=1
    if(pas==c):
      end=-1
      pas=0
  
print(num)

Submission status: Wrong Answer

Solution code:
n,c,k=map(int,input().split())
t=[]
for i in range(n):
  t.append(int(input()))
t.sort()
num=0
pas=0
end=-1
for i in range(n):
  if(end<t[i]):
    num+=1
    end=t[i]+k
    pas=1
  elif(pas==c-1):
  	end=-1
  else:
    pas+=1
  
print(num)

Submission status: Wrong Answer

Solution code:
n,c,k = (int(i) for i in input().split())
t = [int(input()) for i in range(n)]
t.sort()
num,num2,answer = t[0]+k,0,1
for i in range(n):
	num2 += 1
	if t[i]>num or num2>c:
		num,num2=t[i]+k,0
		answer+=1
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,c,k = map(int,input().split())
lis = []
for i in range(n):lis.append(int(input()))
lis.sort()
ans = 0
time = 0
cou = 0
for m in range(n):
    if time == 0:
        time = lis[m]
        cou += 1
    elif lis[m] <= time + k and cou < c:
        cou += 1
    else:
        ans += 1
        cou = 1
        time = lis[m]
print(lis)

Submission status: Wrong Answer

Solution code:
n,c,k = map(int,input().split())
lis = []
for i in range(n):lis.append(int(input()))
lis.sort()
ans = 0
time = 0
cou = 0
for m in range(n):
    if time == 0:
        time = lis[m]
        cou += 1
    elif lis[m] < time + k and cou < c:
        cou += 1
    else:
        ans += 1
        cou = 1
        time = lis[m]
ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, input().split())
t_list = []
for i in range(n):
    t = int(input())
    t_list.append(t)
t_list = sorted(t_list)
bus = 1
pas = 0
time = t_list[0]
for i in range(1, n):
    if t_list[i] - time <= k:
        pas += 1
    else:
        pas = 0
        bus += 1
    if pas >= c:
        pas = 0
        bus += 1
    time = t_list[i]
print(bus)

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
N, C, K = map(int, input().split())
T = sorted([ int(input()) for tmp in range(N) ])
minTime = T[0]
maxTime = T[0]+K
counter = 1
line = 0
for tmp in range(1,N):
    if counter == C:
        counter = 1
        line += 1
        maxTime = T[tmp]+K
        minTime = T[tmp]
    else:
        minTime = max(minTime, T[tmp])
    if maxTime < minTime:
        line += 1
        maxTime = T[tmp]+K
        minTime = T[tmp]
        counter = 1
        continue
    counter += 1
print(line+1)

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split())
t = [int(raw_input()) for _ in xrange(n)] + [10**12]
t.sort()
cnt = 0
i = 0
while i < n:
    lt = t[i] + k
    for j in xrange(i, min(i + c, n + 1)):
        if t[j] > lt :break
    if j == n:break
    cnt += 1
    i = j
print cnt

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split())
t = [int(raw_input()) for _ in xrange(n)] + [10**12]
t.sort()
cnt = 0
i = 0
while i < n:
    lt = t[i] + k
    for j in xrange(i, min(i + c, n + 1)):
        if t[j] > lt :break
    cnt += 1
    i = j
print cnt

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split())
arr = [input() for i in xrange(n)]
arr.sort()

res = 1
start = 0
cur = c

for i in arr:
	if c == 0:
		start = i
		c = cur - 1
		res += 1
		continue

	if (i <= start + k):
		c -= 1
	else:
		res += 1
		c = cur - 1
		start = i

print res

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split())
arr = [input() for i in xrange(n)]
arr.sort()

res = 0
start = 0
cur = c

for i in arr:
	if c == 0:
		start = i
		c = cur - 1
		res += 1
		continue

	if (i <= start + k):
		c -= 1
	else:
		res += 1
		c = cur
		c -=1
		start = i

if c:
	res += 1
print res

Submission status: Wrong Answer

Solution code:
n, c, k = map(int, raw_input().split())
arr = [input() for i in xrange(n)]
arr.sort()

res = 0
start = 0
cur = c

for i in arr:
	if c == 0:
		start = i
		c = cur
		res += 1
		continue

	if (i <= start + k):
		c -= 1
	else:
		res += 1
		c = cur
		c -=1
		start = i

if c:
	res += 1
print res

Submission status: Wrong Answer

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

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

t_list.sort()

bus_cnt = 0
bus_member = []
for t in t_list:
    if len(bus_member) != 0 and K < t - bus_member[0]:
        bus_member.clear()
        bus_cnt += 1

    bus_member.append(t)

    if C <= len(bus_member):
        bus_member.clear()
        bus_cnt += 1

bus_cnt += 1

print(bus_cnt)

Submission status: Wrong Answer

Solution code:


def main():
	n = 0 #乗客数
	c = 0 #バスの定員
	k = 0 #猶予
	arraival_time = [] 

	n,c,k = input().split(' ')
	n = int(n)
	c = int(c)
	k = int(k)

	for i in range(n):
		tmp = int(input())
		arraival_time.append(tmp)

	arraival_time.sort()
	counting_bus = 0

	while(1):
		passenger = []
		times = 0
		rslt = making_bus(c, k, arraival_time, passenger, times) 
		if rslt == 0:
			break
		elif rslt == 1:
			counting_bus += 1

	print(counting_bus)
		
		

def making_bus(c, k, arraival_time, passenger,times):
	if arraival_time:
		if not passenger:
			passenger.append(arraival_time.pop(0))
			times += 1
			#recursion
			making_bus(c, k, arraival_time, passenger, times)
			return 1
	
		elif (len(passenger) < c):
			if (arraival_time[0]-passenger[0] < k):
				passenger.append(arraival_time.pop(0))
				times += 1
				#recursion
				making_bus(c, k, arraival_time, passenger, times)
				return 1
			else:
				return 1
		else:
			return 1
				
	elif times == 0:
		return 0
	elif times > 0:
		return 1




if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
def main():
	n = 0 #乗客数
	c = 0 #バスの定員
	k = 0 #猶予
	arraival_time = [] 

	n,c,k = input().split(' ')
	n = int(n)
	c = int(c)
	k = int(k)

	for i in range(n):
		tmp = int(input())
		arraival_time.append(tmp)

	arraival_time.sort()
	counting_bus = 0

	while(1):
		passenger = []
		times = 0
		rslt = making_bus(c, k, arraival_time, passenger, times) 
		if rslt == 0:
			break
		elif rslt == 1:
			counting_bus += 1

	print(counting_bus)
		
		

def making_bus(c, k, arraival_time, passenger,times):
	if arraival_time:
		if not passenger:
			passenger.append(arraival_time.pop(0))
			times += 1
			#recursion
			making_bus(c, k, arraival_time, passenger, times)
			return 1
	
		elif passenger and (len(passenger) < c):
			if (arraival_time[0]-passenger[-1] < k):
				passenger.append(arraival_time.pop(0))
				times += 1
				#recursion
				making_bus(c, k, arraival_time, passenger, times)
				return 1
			else:
				return 1
		else:
			return 1
				
	elif times == 0:
		return 0
	elif times > 0:
		return 1



if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def readln():
    _res = list(map(int,str(input()).split(' ')))
    return _res

def mapv(f,s):
    return list(map(f,s))

n,c,k = readln()
t = [0 for i in range(0,n)]
for i in range(0,n):
    t[i] = int(input())
t = sorted(t)
# t = mapv(lambda x: x + k, t)
head = 0
ans = 0
for i in range(0,n):
    if t[i] - t[head] > k or i - head >= c:
        head = min(head + c,i)
        ans = ans + 1
if head < n - 1: ans = ans + 1
print(ans)

# 6 3 3
# 2
# 6
# 6
# 7
# 8
# 10

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n_cus, n_bus, n_wai = map(int, input().split())
l_arr = [int(input()) for i in range(n_cus)]
l_arr.sort()

l_waiting_cus = []
n_need_bus = 0

for arr in l_arr:
    if len(l_waiting_cus) == n_bus:
        l_waiting_cus = []
        n_need_bus += 1

    if len(l_waiting_cus) >= 1 and (l_waiting_cus[0] + n_wai) <= arr:
        l_waiting_cus = []
        n_need_bus += 1

    l_waiting_cus.append(arr)

if len(l_waiting_cus) >= 1:
    n_need_bus += 1

print(n_need_bus)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n_cus, n_bus, n_wai = map(int, input().split())
l_arr = [int(input()) for i in range(n_cus)]
l_arr.sort()

l_waiting_cus = []
n_need_bus = 0

for arr in l_arr:
    if len(l_waiting_cus) == n_bus:
        l_waiting_cus = []
        n_need_bus += 1

    if len(l_waiting_cus) >= 1 and (l_waiting_cus[0] + n_wai) <= arr:
        l_waiting_cus = []
        n_need_bus += 1

    l_waiting_cus.append(arr)

n_need_bus += 1

print(n_need_bus)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n_cus, n_bus, n_wai = map(int, input().split())
l_arr = [int(input()) for i in range(n_cus)]
l_arr.sort()

l_waiting_cus = []
n_need_bus = 0

for arr in l_arr:
    for cus in l_waiting_cus:
        if (cus + n_wai) < arr:
            l_waiting_cus = []
            n_need_bus += 1

    if len(l_waiting_cus) == n_bus:
        l_waiting_cus =[]
        n_need_bus += 1

    l_waiting_cus.append(arr)

n_need_bus += 1

print(n_need_bus)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

from sys import stdin

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

T.sort()
t_star=T[0]
b_star=0
cnt=0
for b,t in enumerate(T):
    if t-t_star>K or b-b_star>C:
        cnt+=1
        t_star=t
        b_star=b

print cnt+1

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

from sys import stdin

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

T.sort()
t_star=T[0]
b_star=0
cnt=0
for b,t in enumerate(T):
    if t-t_star>K or b-b_star+1==C:
        cnt+=1
        t_star=t
        b_star=b

print cnt

Submission status: Wrong Answer

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

bus = 1
new_bus = True
start_time = 0
capacity = 0

while t:
    time = t.pop(0)
    if new_bus:
        new_bus = False
        capacity = 0
        start_time = time

    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
        bus += 1
        continue
    if wait_time > k:
        if not t or (t[0] - start_time <= k):
            new_bus = True
            bus += 1
            continue
    if not t:
        bus += 1

print(bus)

Submission status: Wrong Answer

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

bus = 1
new_bus = True
start_time = 0
capacity = 0

while t:
    time = t.pop(0)
    if new_bus:
        new_bus = False
        capacity = 0
        start_time = time

    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
        bus += 1
        continue
    if wait_time > k:
        if (t == []) or (t[0] - start_time <= k):
            new_bus = True
            bus += 1
            continue


print(bus)

Submission status: Wrong Answer

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

bus = 1
new_bus = False
start_time = 0
capacity = 0

while t:
    if new_bus:
        new_bus = False
        capacity = 0

    time = t.pop(0)
    if capacity == 0:
        start_time = time
    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
        bus += 1
        continue
    if wait_time > k:
        if (t == []) or (t[0] - wait_time <= k):
            new_bus = True
            bus += 1
            continue


print(bus)

Submission status: Wrong Answer

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

bus = 1
new_bus = False
start_time = 0
capacity = 0

while t:
    if new_bus:
        new_bus = False
        bus += 1
        capacity = 0

    time = t.pop(0)
    if capacity == 0:
        start_time = time
    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
        continue
    if wait_time > k:
        if (t == []) or (t[0] - wait_time <= k):
            new_bus = True
            continue

print(bus)

Submission status: Wrong Answer

Solution code:
N, C, K = map(int, input().split())
T = []
bus = [[]]
bus_index = 0
index = 0

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

while T:
    top = T.pop(0)
    deperture_time = top + K
    bus[bus_index].append(top)
    for i in reversed(range(top, deperture_time+1)):
        if len(bus[bus_index])==C:
            break
        if top in T:
            bus[bus_index].append(T.pop(T.index(top)))
        if i in T:
            bus[bus_index].append(T.pop(T.index(i)))
    bus_index += 1
    bus.append([])

bus.sort()
for i, j in enumerate(bus):
    if not j:
        bus.pop(i)
    else:
        break

print(len(bus))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

N,C,K=map(float,raw_input().strip().split(" "))
N=int(N)

T=[]
bmember=0
bf=0.0
b_cnt=0

for i in range(N):
    T.append(float(raw_input()))

T.sort()
for i in range(N):
    if bmember==0:
        bf=T[i]
        bmember=1

    if bmember==C:
        bmember=0
        b_cnt+=1
    elif T[i]-bf<=K:
        bmember+=1
        if bmember==C:
            bmember=0
            b_cnt+=1
    else:
        bmember=1
        bf=T[i]
        b_cnt+=1

if bmember>0:
    b_cnt+=1

print  b_cnt

Submission status: Wrong Answer

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

res = 0
room = c
bus_start = None

for t in arrivals:

    previous_bus_has_left = bus_start is not None and bus_start + k < t
    if previous_bus_has_left:
        res += 1
        room = c

    if room == c:
        bus_start = t

    room -= 1

    if room == 0:
        res += 1
        room = c

if room < c:
    res += 1

print(res)

Submission status: Wrong Answer

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

countBus = 0
startTime = 0
countPeople = 0
for i in range(N):
    countPeople += 1
    if (i == 0) or (K <= T[i] - startTime) or (C < countPeople):
        countBus += 1
        countPeople = 1
        startTime = T[i]

print countBus

Submission status: Wrong Answer

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

bus = 1
new_bus = False
start_time = 0
capacity = 0

while t:
    time = t.pop(0)
    if capacity == 0:
        start_time = time
    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
    if wait_time > k:
        if (t == []) or (t[0] - wait_time <= k):
            new_bus = True

    if new_bus:
        new_bus = False
        bus += 1
        capacity = 0

print(bus)

Submission status: Wrong Answer

Solution code:
def main():
    N, C, K = map(int, input().split())
    i = 0
    T = []
    while i < N:
        T.append(int(input()))
        i += 1
    T.sort()
    T.reverse()

    c = 1
    i = 1
    bus = 0
    time = T[0]
    while i < N:
        if time - T[i] <= K:
            c += 1
        if time - T[i] > K or c == C:
            bus += 1
            c = 1
            time = T[i]
        i += 1

    print(str(bus))

main()

Submission status: Wrong Answer

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

bus = 1
new_bus = False
start_time = 0
capacity = 0

while t:
    time = t.pop(0)
    if capacity == 0:
        start_time = time
    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
    if wait_time > k:
        if (t == []) or (t[0] - wait_time <= k):
            new_bus = True

    if new_bus:
        new_bus = False
        bus += 1
        capacity = 0

print(bus)

Submission status: Wrong Answer

Solution code:
def count_bus(N, C, K, tList):
    B = 0
    while(len(tList) > 0):
        firstTime = tList[0]
        leaveTime = tList[0] + int(K)
        count = 0
        for i in range(int(C)):
            if(i >= len(tList)):
                break
            if(tList[i] < leaveTime):
                count = count + 1
        tList = tList[count:]
        B = B + 1
    return B

try:
    N, C, K = raw_input().strip().upper().split()
    tList = []
    for i in range(int(N)):
        tList.append(int(raw_input().strip()))
    
    tList.sort()
    print N, C, K
    print tList
    print count_bus(N, C, K, tList)
except EOFError:
    pass

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

N,C,K=map(int,raw_input().strip().split(" "))

T=[]
bmember=0
bf=0
b_cnt=0

for i in range(N):
    T.append(int(raw_input()))

T.sort()
for i in range(N):
    if bmember==0:
        bf=T[i]
        bmember=1

    if bmember==C:
        bmember=0
        b_cnt+=1
    elif T[i]-bf<=K:
        bmember+=1
        if bmember==C:
            bmember=0
            b_cnt+=1
    else:
        bmember=1
        bf=T[i]
        b_cnt+=1

if bmember>0:
    b_cnt+=1

print  b_cnt

Submission status: Wrong Answer

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

bus = 1
new_bus = False
start_time = 0
capacity = 0

while t:
    time = t.pop(0)
    if capacity == 0:
        start_time = time
    wait_time = time - start_time
    capacity += 1

    if capacity == c:
        new_bus = True
    if wait_time > k:
        if (not t) or (t[0] - wait_time <= k):
            new_bus = True

    if new_bus:
        new_bus = False
        bus += 1
        capacity = 0

print(bus)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

N,C,K=map(int,raw_input().strip().split(" "))

T=[]
bmember=0
bf=0
b_cnt=0

for i in range(N):
    T.append(int(raw_input()))

T.sort()
for i in range(N):
    if bmember==0:
        bf=T[i]
        bmember=1

    if bmember==C:
        bmember=0
        b_cnt+=1
    elif T[i]-bf<K:
        bmember+=1
        if bmember==C:
            bmember=0
            b_cnt+=1
    else:
        bmember=1
        bf=T[i]
        b_cnt+=1

if bmember>0:
    b_cnt+=1

print  b_cnt

Submission status: Wrong Answer

Solution code:
def main():
    N, C, K = map(int, input().split())
    i = 0
    T = []
    while i < N:
        T.append(int(input()))
        i += 1
    T.sort()
    T.reverse()

    c = 0
    i = 1
    bus = 1
    time = T[0]
    while i < N:
        if time - T[i] <= K:
            c += 1
        if time - T[i] > K or c == C:
            bus += 1
            c = 1
            time = T[i]
        i += 1

    print(str(bus))

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

N,C,K=map(int,raw_input().strip().split(" "))

T=[]
bmember=0
bf=0
b_cnt=0

for i in range(N):
    T.append(int(raw_input()))

T.sort()
for i in range(N):
    if bmember==0:
        bf=T[i]
        bmember=1

    if bmember==C:
        bmember=0
        b_cnt+=1

    if T[i]-bf<K:
        bmember+=1
        if bmember==C:
            bmember=0
            b_cnt+=1
    else:
        bmember=1
        bf=T[i]
        b_cnt+=1

if bmember>0:
    b_cnt+=1

print  b_cnt