ZhenlongDai/ACPR huggingface dataset:
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)]+[10**10]
li.sort()

time = li[0]
bus = 0
hito = 0

for i in li:
    hito += 1
    if i-time > k or hito > c:
        bus += 1
        hito = 0
        time = i
print(bus)

Failing test case input:
6 1 3
7
6
2
13
17
5

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
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)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()

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)


Failing test case input:
6 6 4
7
6
2
22
10
5

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()

Bcnt = 0
while True:
    if len(T) <= 0:
        break
    BS = T[0] + K
    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)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    n, c, k, *t = map(int, open(0).read().split())
    t = sorted(t)
    u = tuple(t)

    count = 1
    i = 0
    p = 1
    lim = u[i] + k
    while i < n:
        if u[i] <= lim or p < c:
            i += 1
            p += 1
        else:
            count += 1
            lim = u[i] + k
            p = 1
    print(count)


if __name__ == '__main__':
    main()


Failing test case input:
5 7 5
0
1
3
11
36

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
def main():
    n, c, k, *t = map(int, open(0).read().split())
    t = sorted(t)
    u = tuple(t)

    cnt = 1
    p, l = 0, u[0] + k
    for v in t:
        if v <= l and p < c:
            p += 1
        else:
            cnt += 1
            l = v + k
            p = 1
    print(cnt)


if __name__ == '__main__':
    main()
Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,c,k = map(int,input().split())
t = []
for i in range(n):
    t.append(int(input()))

t.sort()

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

while tmp < n:
    t1 = t[tmp]
    tmp += 1
    cnt += 1
    if cnt == c:
        if tmp < n:
            s = t[tmp]
            ans += 1
            cnt = 0
        else:
            print(ans)
            exit()
    elif t1 - s > k:
        ans += 1
        cnt = 0
        s = t[tmp-1]

print(ans+1)


Failing test case input:
6 3 6
4
0
2
22
10
6

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n,c,k = map(int,input().split())
t = []
for i in range(n):
    t.append(int(input()))

t.sort()

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

while tmp < n:
    t1 = t[tmp]
    cnt += 1
    if t1 - s > k:
        ans += 1
        cnt = 1
        s = t[tmp]
    elif cnt == c:
        if tmp < n - 1:
            s = t[tmp + 1]
            ans += 1
            cnt = 0

    tmp += 1

if cnt > 0:
    ans += 1

print(ans)

Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,c,k=map(int,input().split())
t=[]
for _ in range(n):
  t.append(int(input()))
t.sort()
renow=0
cun=0
for i in range(n):
  if t[i]-t[renow]>=k:
    cun+=1
    renow=i
  elif i-renow+1>=c:
    cun+=1
    renow=i+1
if renow>=n:
  print(cun)
else:
  print(cun+1)
  

Failing test case input:
6 6 0
7
3
8
9
19
5

Expected output:
6


Actual output:
7


Fixed submission (verdict: Accepted):
n,c,k=map(int,input().split())
t=[]
for _ in range(n):
  t.append(int(input()))
t.sort()
renow=0
cun=0
for i in range(n):
  if t[i]-t[renow]>k:
    cun+=1
    renow=i
  if i-renow+1>=c:
    cun+=1
    renow=i+1
if renow>=n:
  print(cun)
else:
  print(cun+1)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort(reverse=True)
ans = 1
c_cnt = 0
now = T[0]
for i in range(N):
    if c_cnt > C or now > T[i] + K:     
        ans += 1
        c_cnt = 0
        now = T[i]
    else:
        c_cnt += 1
    if i == N - 1:
        if c_cnt != 0:
            ans += 1
        else:
            pass
print(ans)

Failing test case input:
5 5 5
1
2
2
10
18

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort(reverse=True)
ans = 0
c_cnt = 0
now = T[0]



for i in range(N):
    if c_cnt >= C or now > T[i] + K:     
        ans += 1
        c_cnt = 1
        now = T[i]
    else:
        c_cnt += 1
    if i == N - 1:
        if c_cnt != 0:
            ans += 1
        else:
            pass
    
print(ans)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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][1]:
    last=cus[i][1]
    ans+=1
    rest=C-1
  elif rest>0:
    rest-=1
print(ans)

Failing test case input:
5 8 5
1
2
2
4
18

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):
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)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k = map(int,input().split())
list = [int(input()) for _ in range(n)]
sorted_list = sorted(list)
bus = 1
customer = 1
max_hour = sorted_list[0]+k
for i in sorted_list[1:]:
  if i > max_hour or customer >= c:
    bus+=1
    customer=1
    max_hour = i+k
print(bus+1 if customer != 1 else bus)

Failing test case input:
5 3 5
1
2
1
6
12

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,c,k = map(int,input().split())
list = [int(input()) for _ in range(n)]
sorted_list = sorted(list)
bus = 1
customer = 1
max_hour = sorted_list[0]+k
for i in sorted_list[1:]:
  if i > max_hour or customer >= c:
    bus+=1
    customer=1
    max_hour = i+k
  else:
    customer += 1
print(bus)

Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
a,b,c=map(int,input().split())
l=sorted([int(input()) for i in range(a)])
ans=0
now=l[0]
cur=1
for i in range(1,a):
  x=l[i]
  if cur==b:
    now=x
    cur=1
    ans+=1
  elif x-now>c:
    now=x
    ans+=1
    cur=1
  else:
    cur+=1
print(ans+min(1,cur-1))

Failing test case input:
5 8 5
1
1
1
4
18

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
l=sorted([int(input()) for i in range(a)])
ans=0
now=l[0]
cur=1
for i in range(1,a):
  x=l[i]
  if cur==b:
    now=x
    cur=1
    ans+=1
  elif x-now>c:
    now=x
    ans+=1
    cur=1
  else:
    cur+=1
print(ans+1)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
s = 0
e = T[0]+K
p = 0
ans = 0
flag = False
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
        if i == N-1:
            flag = True
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
if not flag:
    ans += 1
print(ans+1)

Failing test case input:
6 3 6
7
6
2
13
10
6

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
s = 0
e = T[0]+K
p = 0
ans = 0
for i in range(N):
    if p == C or e < T[i]:
        ans += 1
        s = T[i]
        e = T[i]+K
        p = 0
    s = max(s,T[i])
    e = min(e,T[i]+K)
    p += 1
print(ans+1)
Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N,C,K = map(int,input().split())

T = sorted([int(input()) for _ in range(N)])
print(T)
ans = 0
count = 0
time = 0
for i in range(N):
  if T[i] > time + K:
    ans += 1
    count = 0
  if count == 0:
    time = T[i]
  count += 1
  if count == C:
    ans += 1
    count = 0
if count > 0:
  ans += 1
print(ans)

Failing test case input:
5 5 5
1
2
2
7
18

Expected output:
3


Actual output:
[1, 2, 2, 7, 18]
3


Fixed submission (verdict: Accepted):
N,C,K = map(int,input().split())

T = sorted([int(input()) for _ in range(N)])
ans = 1
count = 0
time = 0
start = -1
for i in range(N):
  if start == -1:
    start = i
  if i != N-1:
    if T[i+1] > T[start] + K or i+1 -start == C:
      ans += 1
      start = -1
  
print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
r = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
    elif t[i] - l < k:
        waitP += 1
        if i == n - 1:
            ans += 1
    elif t[i] - l >= k:
        ans += 1
        l = t[i]
        waitP = 1
        if i == n - 1:
            ans += 1

print(ans)

Failing test case input:
4 3 10
1
7
3
6
12

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
        if i == n - 1:
            ans += 1
    elif waitP != c:
        if t[i] - l <= k:
            waitP += 1
            if i == n - 1:
                ans += 1
        elif t[i] - l > k:
            ans += 1
            l = t[i]
            waitP = 1
            if i == n - 1:
                ans += 1

print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l.sort()
l = l[::-1]
while l:
  h=l.pop()
  i=h
  j=1
  while l and j<C and h+K>l[-1]:
    i=l.pop()
    j+=1
  ans+=1
print(ans)

Failing test case input:
6 3 6
7
6
2
13
10
6

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):

N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l.sort()
l.append(float("INF"))
l = l[::-1]
while len(l)>1:
  h=l.pop()
  i=h
  j=1
  while len(l)>1 and j<C and h+K>=l[-1]:
    i=l.pop()
    j+=1
  ans+=1
print(ans)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().rstrip("\n").split())
time = sorted(int(input()) for _ in range(n))

iter_ = iter(time)
top = next(iter_)
ans = 0
i = 1

try:
    while True:
        next_ = next(iter_)
        i += 1
        while top + k <= next_ and i <= c:
            next_ = next(iter_)
            i += 1
        ans += 1
        top = next_
        i = 1
except:
    print(ans)


Failing test case input:
5 5 5
1
1
4
6
4

Expected output:
1


Actual output:
4


Fixed submission (verdict: Accepted):

n, c, k = map(int, input().rstrip("\n").split())
time = sorted(int(input()) for _ in range(n))

ans = 1

iter_ = iter(time)
top = next(iter_)
i = 1
next_ = next(iter_)

try:
    while True:

        while next_ - top <= k and i < c:
            next_ = next(iter_)
            i += 1

        ans += 1
        top = next_
        i = 1
        next_ = next(iter_)
except StopIteration:
    print(ans)

Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,c,k=map(int,input().split())
t=[int(input()) for i in range(n)]
t.sort()
ans=1
x=t[0]
y=1
for i in range(1,n-1):
    y+=1
    if t[i]-x>k:
        ans+=1
        x=t[i]
        y=0
    elif y==c:
        ans+=1
        x=t[i+1]
        y=0
print(ans+1 if t[-1]-x>k else ans)

Failing test case input:
6 3 3
7
0
2
8
7
6

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,c,k=map(int,input().split())
t=[int(input()) for i in range(n)]
t.sort()
ans=0
x=t[0]
y=0
for i in range(n-1):
    y+=1
    if t[i]-x>k:
        ans+=1
        x=t[i]
        y=1
    elif y==c:
        ans+=1
        x=t[i+1]
        y=0
print(ans+2 if t[-1]-x>k else ans+1)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
6 6 0
7
9
8
9
19
5

Expected output:
5


Actual output:
1


Fixed submission (verdict: Accepted):
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 t[i]-w > k:
        p = 1
        res += 1
        w = t[i]
        if i == n-1:
            res += 1
    elif c == p:
        p = 0
        res += 1
        if i != n-1:
            w = t[i+1]
    
    else:
        if i == n-1:
            res += 1

print(res)
Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def resolve():
    
    N, C, K = [int(item) for item in input().split()]
    Ts = [int(input()) for _ in range(N)]
    Ts.sort()

    res = 0
    temp_psg = 0
    lim = Ts[0] + K

    for i in range(N):
        temp_psg += 1
        if Ts[i] > lim:
            res += 1
            temp_psg = 1
            lim = Ts[i] + K
        else:
            if temp_psg == C:
                res += 1
                temp_psg = 1
                lim = Ts[i] + K
        
    print(res)


if __name__ == "__main__":
    resolve()


Failing test case input:
6 3 6
7
9
4
28
19
5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
def resolve():
    
    N, C, K = [int(item) for item in input().split()]
    Ts = [int(input()) for _ in range(N)]
    Ts.sort()

    res = 0
    temp_psg = 0
    lim = Ts[0] + K

    for i in range(N):
        temp_psg += 1
        if Ts[i] > lim:
            res += 1
            temp_psg = 1
            lim = Ts[i] + K
        else:
            if temp_psg == C and i < N-1:
                res += 1
                temp_psg = 0
                lim = Ts[i+1] + K
        
    
    if temp_psg > 0:
        res += 1
    print(res)


if __name__ == "__main__":
    resolve()

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]

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


for i in t:
    if i - cun > k or passenger == c:
        ans += 1
        passenger = 1
    elif i - cun <= k and passenger != c:
        passenger += 1
    cun = i

print(ans)

Failing test case input:
6 6 6
7
6
2
22
10
5

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
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)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k=map(int,input().split())
a=[int(input()) for _ in range(n)]

a.sort()
count=0
c_count=1
box=a[0]
for i in range(1,n):
    if c_count<c:
        if a[i]-box<k:
            count+=1
            c_count+=1
        else:
            box=a[i]
    else:
        box=a[i]
        c_count=1
    
print(n-count)


Failing test case input:
6 3 6
7
0
2
18
10
6

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,c,k=map(int,input().split())
a=[int(input()) for _ in range(n)]

a.sort()
count=0
c_count=1
box=a[0]
for i in range(1,n):
    if c_count<c:
        if a[i]-box<=k:
            count+=1
            c_count+=1
        else:
            box=a[i]
            c_count=1
    else:
        box=a[i]
        c_count=1
    
print(n-count)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
def input():
    return sys.stdin.readline()[:-1]
N,C,K=map(int,input().split())
T=[int(input()) for i in range(N)]
T.sort()
t=T[0]+K
a=1
h=1
for i in T[1:]:
    if t>i and h<C:
        h+=1
    else:
        t=i+K
        h=1
        a+=1
print(a)

Failing test case input:
5 5 5
1
1
6
6
18

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import sys
def input():
    return sys.stdin.readline()[:-1]
N,C,K=map(int,input().split())
T=[int(input()) for i in range(N)]
T.sort()
t=T[0]+K
a=1
h=1
for i in T[1:]:
    if t>=i and h<C:
        h+=1
    else:
        t=i+K
        h=1
        a+=1
print(a)

Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, C, K = map(int, input().split())
T = [int(input()) for _ in range(N)]
T.sort()

a = 1; t = T[0] + K; c = 1
for i in range(1,N):
    if T[i]>=t or c+1>C:
        a += 1; t = T[i] + K; c = 1
    else:
        c += 1
print(a)


Failing test case input:
5 5 5
1
4
3
6
12

Expected output:
2


Actual output:
3


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

a = 1; t = T[0] + K; c = 1
for i in range(1,N):
    if T[i]>t or c+1>C:
        a += 1; t = T[i] + K; c = 1
    else:
        c += 1
print(a)

Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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 = 1
  c += 1
print(res)

Failing test case input:
6 3 6
7
6
2
18
10
6

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
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)
Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,c,k = map(int,input().split())
li = []
for _ in range(n):
    li.append(int(input()))
li.sort()

all_count = 0
kazu = 0
start = 0
for l in li:
    if kazu == 0 and start == 0:
        all_count += 1
        kazu += 1
        start = l
        continue
    if kazu < c and l - start <= k:
        kazu += 1
    if kazu == c:
        kazu = 0
        start = 0
        continue
    if l - start > k:
        all_count += 1
        kazu = 1
        start = l
print(all_count)

Failing test case input:
6 1 3
7
6
2
13
17
5

Expected output:
6


Actual output:
3


Fixed submission (verdict: Accepted):
n,c,k = map(int,input().split())
li = []
for _ in range(n):
    li.append(int(input()))
li.sort()

all_count = 0
kazu = 0
start = 0
if c == 1:
    print(n)
    exit()
for l in li:
    if kazu == 0 and start == 0:
        all_count += 1
        kazu += 1
        start = l
        continue
    if kazu < c and l - start <= k:
        kazu += 1
    if kazu == c:
        kazu = 0
        start = 0
        continue
    if l - start > k:
        all_count += 1
        kazu = 1
        start = l
print(all_count)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k=map(int,input().split())
t=[]
for i in range(n):
  t.append(int(input()))
t.sort()

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    arr=tt
    que+=1
  else:
    if que==c:
      bus+=1
      arr=tt
      que=1
    else:
      if arr+k>tt:
        bus+=1
        arr=tt
        que=1
      else:
        que+=1
  
print(bus)

Failing test case input:
6 3 6
7
6
2
37
10
6

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
n,c,k=map(int,input().split())
t=[]
for i in range(n):
  t.append(int(input()))
t.sort()

bus=0
arr=0
que=0
for i in range(n):
  tt=t[i]
  if que==0:
    
    arr=tt
    que+=1
    bus+=1
  else:
    if que==c:
      
      bus+=1
      arr=tt
      que=1
    else:
      if arr+k<tt:
        
        bus+=1
        arr=tt
        que=1
      else:
        
        que+=1

print(bus)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,C,K = map(int,input().split())
T = [int(input()) for _ in range(N)]
T.sort()
time = T.pop(0)+K
people = 1
ans = 1
for t in T:
    if t <= time and people < C:
        people += 1
    else:
        if people == C:
            time += t
        else:
            time += K
        people = 0
        ans += 1
print(ans)

Failing test case input:
6 2 6
7
9
2
22
10
5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
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)
Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, C, K = map(int, input().split())
        T = [int(input()) for _ in range(N)]

        T.sort()
        bus = 1
        p = 1
        start = T[0]
        for i in range(1, N):
            p += 1
            if T[i] - start >= K or p >= C:
                bus += 1
                p = 1
                start = T[i]

        print(bus)



if __name__ == '__main__':
    AtCoder().main()

Failing test case input:
6 3 6
7
6
2
18
10
6

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        N, C, K = map(int, input().split())
        T = [int(input()) for _ in range(N)]

        T.sort()
        bus = 1
        p = 1
        start = T[0]
        for i in range(1, N):
            p += 1
            if T[i] > K + start or p > C:
                bus += 1
                p = 1
                start = T[i]

        print(bus)



if __name__ == '__main__':
    AtCoder().main()

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
5 5 5
1
1
2
7
18

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
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]
print(b)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k = map(int, input().split())
Ts = [int(input()) for i in range(n)]
Ts = sorted(Ts)

ans = 1
cnt = 0
flg = 0
prev = Ts[0]
for i in range(1,len(Ts)):
    now = Ts[i]
    if now - prev < k:
        cnt += 1
    else:
        ans += 1
        cnt = 1
        prev = Ts[i]
    if cnt > c:
        ans += 1
        cnt = 1
        prev = Ts[i]
    
print(ans)



Failing test case input:
4 3 10
1
7
3
6
12

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n,c,k = map(int, input().split())
Ts = [int(input()) for i in range(n)] + [10**10]
Ts = sorted(Ts)

ans = 0
cnt = 1
flg = 0
prev = Ts[0]
for i in range(1,len(Ts)):
    now = Ts[i]
    if now - prev <= k:
        cnt += 1
    else:
        ans += 1
        cnt = 1
        prev = Ts[i]
    if cnt > c:
        ans += 1
        cnt = 1
        prev = Ts[i]
    
print(ans)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
6 3 3
7
0
2
8
7
6

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
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[1:]:
    if t<=start+K and now_C < C:
        now_C += 1
    else:
        start = t
        ans += 1
        now_C = 1

print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().split())

lt = list()
for i in range(n):
    lt.append(int(input()))
lt.sort()

b = 1  
p = 0  
m = lt[0]

for i in range(n):
    if p < c and lt[i]-m < k:
        p += 1
    else:
        p = 1
        b += 1
        m = lt[i]
        
print(b)

Failing test case input:
5 3 5
1
4
3
7
12

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n, c, k = map(int, input().split())

lt = list()
for i in range(n):
    lt.append(int(input()))
lt.sort()

b = 1  
p = 0  
m = lt[0]

for i in range(n):
    if p < c and lt[i]-m <= k:
        p += 1
    else:
        p = 1
        b += 1
        m = lt[i]

print(b)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().split())
l = [int(input()) for i in range(n)]
count = 0
first = l[0]
people = 1
count = 1
for i in range(1, n):
    if people < c and l[i] - first <= k:
        people += 1
    else:
        first = l[i]
        people = 1
        count += 1
print(count)

Failing test case input:
6 6 6
7
9
4
28
19
5

Expected output:
3


Actual output:
2


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

Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
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)


Failing test case input:
6 2 3
7
6
2
13
17
5

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
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)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,C,K=map(int,input().split())
T=[int(input())for i in range(N)]
T.sort()
ans=0
bus_seat=0
tmp_time=0
for i in range(len(T)):
    if T[i]>=tmp_time+K:
        bus_seat=0
    if bus_seat==0:
        ans+=1
        tmp_time=T[i]
    
    bus_seat+=1
    if bus_seat==C:
        bus_seat=0
print(ans)

Failing test case input:
5 5 5
1
1
3
6
12

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N,C,K=map(int,input().split())
T=[int(input())for i in range(N)]
T.sort()
ans=0
bus_seat=0
tmp_time=0
for i in range(len(T)):
    if T[i]>tmp_time+K:
        bus_seat=0
    if bus_seat==0:
        ans+=1
        tmp_time=T[i]
    
    bus_seat+=1
    if bus_seat==C:
        bus_seat=0
print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k = map(int, input().split())
T = []
for i in range(n):
    T.append(int(input()))
T.sort()
ans = 1
last_t = T[0]
passengers = 0
for t in T:
    if last_t +k >= t and passengers < c:
        passengers += 1
    else:
        last_t = t
        passengers = 0
        ans += 1

print(ans)





Failing test case input:
6 2 6
7
9
2
22
10
5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
n,c,k = map(int, input().split())
T = []
for i in range(n):
    T.append(int(input()))
T.sort()
ans = 1
last_t = T[0]
passengers = 0
for t in T:
    if last_t +k >= t and passengers < c:
        passengers += 1
    else:
        last_t = t
        passengers = 1
        ans += 1

print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
while l:
  h=l.pop()
  i=h
  j=1
  while l and j<C and i-h<K:
    i=l.pop()
    j+=1
  if i-h>K:
    l.append(i)
  ans+=1
print(ans)


Failing test case input:
6 3 3
7
6
2
13
10
6

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):

N,C,K=map(int, input().split())
l = []
ans = 0
for i in range(N):
    l.append(int(input()))
l.sort()
l.append(float("INF"))
l = l[::-1]
while len(l)>1:
  h=l.pop()
  i=h
  j=1
  while len(l)>1 and j<C and h+K>=l[-1]:
    i=l.pop()
    j+=1
  ans+=1
print(ans)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
for _ in range(N):
    T = int(input())
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    else:
        if T > time_limit:
            time_limit = T + K
            bus_count += 1
            waiting_count = 1
        if waiting_count == C:
            bus_count += 1
            waiting_count = 0
            time_limit = 0

print(bus_count+1)


Failing test case input:
6 6 6
7
6
2
22
10
5

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N, C, K = map(int, input().split())
bus_count = 0
waiting_count = 0
time_limit = 0
D = [int(input()) for _ in range(N)]
D.sort()

for i in range(N):
    T = D[i]
    waiting_count += 1
    if T > time_limit and not time_limit == 0:
        time_limit = T + K
        bus_count += 1
        waiting_count = 1
    if waiting_count == C:
        bus_count += 1
        waiting_count = 0
        time_limit = 0
    else:
        if waiting_count == 1:
            time_limit = T + K

if not waiting_count == 0:
    print(bus_count+1)
else:
    print(bus_count)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().split())
t = [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
    busNin += 1
print(ans)


Failing test case input:
5 5 5
1
1
0
6
3

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
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)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0)
    for Ti in Ts:
        if Ti <= st:
            in_bus += 1
        
        elif Ti > st or in_bus > C:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()


Failing test case input:
6 3 3
7
0
2
8
2
6

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0) + K
    for Ti in Ts:
        if Ti > st:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
        elif Ti <= st:
            in_bus += 1

        if in_bus > C:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve(N, C, K, Ts):
    count = 0
    ans = 0
    time = 0
    for t in Ts:
        if count >= C or t >= time + K:
            ans += 1
            count = 0
            time = 0
        count += 1
        if time == 0:
            time = t
    if count > 0:
        ans += 1
    return ans

if __name__ == "__main__":
    N, C, K = tuple(map(int, input().split(" ")))
    Ts = [int(input()) for _ in range(N)]
    print(solve(N, C, K, Ts))


Failing test case input:
6 6 0
7
3
8
9
19
5

Expected output:
6


Actual output:
5


Fixed submission (verdict: Accepted):
def solve(N, C, K, Ts):
    Ts.sort()
    count = 0
    ans = 0
    time = 0
    for t in Ts[::-1]:
        if count >= C or t < time - K:
            ans += 1
            count = 0
            time = 0
        count += 1
        if time == 0:
            time = t
    if count > 0:
        ans += 1
    return ans


if __name__ == "__main__":
    N, C, K = tuple(map(int, input().split(" ")))
    Ts = [int(input()) for _ in range(N)]
    print(solve(N, C, K, Ts))

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k = map(int, input().split())
t = []
for i in range(n):
    t.append(int(input()))
t.sort()

ni,nt,ans = 0,0,0
while 1:
    if ni >= n:
        break
    nt = t[ni]
    for i in range(1,c+1):
        if ni+i<n and t[ni+i] < nt + k:
            ni += 1
        else:
            break
    ni += 1
    ans += 1
print(ans)


Failing test case input:
5 5 5
1
1
3
4
18

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n,c,k = map(int, input().split())
t = []
for i in range(n):
    t.append(int(input()))
t.sort()

ni,nt,ans = 0,0,0
while 1:
    if ni >= n:
        break
    nt = t[ni]
    for i in range(1,c+1):
        if ni>=n or t[ni] > nt + k:
            break
        ni += 1
    ans += 1
print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,c,k=map(int,input().split())
t=[0]*n
for i in range(n):
  t[i]=int(input())
t=sorted(t)

ans=1
cnt=0
time=t[0]+k

for i in range(n):
  if cnt==c or time<t[i]:
    cnt=0
    ans+=1
    time=t[i]+k
  else:
    cnt+=1
    
print(ans)

Failing test case input:
6 3 3
7
0
2
8
7
6

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n,c,k=map(int,input().split())
t=[0]*n
for i in range(n):
  t[i]=int(input())
t=sorted(t)

ans=1
cnt=0
time=t[0]+k

for i in range(n):
  if cnt==c or time<t[i]:
    cnt=1
    ans+=1
    time=t[i]+k
  else:
    cnt+=1
    
print(ans)
Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort()
counter = 0
i = 0
while i<N:
    for j in range(i+C-N,C):
        if T[i]+K >= T[i+(C-j-1)]:
            counter += 1
            i = i+(C-j-1)+1
            break
print(counter)


Failing test case input:
5 3 5
1
4
3
6
12

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort(reverse = True)
counter = 1
i = 0           
A = T.pop()     
while T:
  a = T.pop()
  i+=1
  if i>=C or a>A+K:
    i=0
    A=a
    counter += 1
  
print(counter)

Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]

T.sort()

cnt = 0
ans = 1
for t in T:
    if cnt == 0:
        time = t

    if time <= t < time + K and cnt < C:
        cnt += 1
        if cnt == C:
            ans += 1
            cnt = 0
    else:
        ans += 1
        cnt = 0

print(ans)

Failing test case input:
5 7 5
1
1
3
11
36

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):

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)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

from math import ceil
N, C, K = map(int, input().split())
T = []
for _ in range(N):
    t = int(input())
    T.append(t)
T.sort()
ans = 0
time = 0
l = []
for i in range(N):
    l.append(T[i])
    
    if len(l) == C:
        ans += 1
        l = []
    elif i < N - 1:
        if T[i+1] - l[-1] >= K:
            ans += ceil(len(l) / C)
            l = []
print(ans + ceil(len(l)/C))

Failing test case input:
5 5 5
1
1
1
6
18

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):

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)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,C,K=map(int, input().split())
T=[]
for i in range(N):
    t=int(input())
    T.append(t)

T=sorted(T)
ans=0
mint=0
now=0
for i,t in enumerate(T):
    if now==C:
        ans+=1
        now=1
        mint=t
    elif t-mint<=K:
        now+=1
    else:
        ans+=1
        now=1
        mint=t
    if i==N-1:
        ans+=1
print(ans)

Failing test case input:
6 6 4
7
6
2
22
10
5

Expected output:
3


Actual output:
4


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

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

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,C,K=map(int,input().split())
TT=[int(input()) for _ in range(N)]
TT.sort()

B=0
L=0
ans=0
for T in TT:
  if B==0:
    L=T+K
    B=C-1
    ans+=1
  else:
    if L>T:
      B-=1
    else:
      L=T+K
      B=C-1
      ans+=1
  
print(ans)

Failing test case input:
5 5 5
1
4
4
6
12

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
N,C,K=map(int,input().split())
TT=[int(input()) for _ in range(N)]
TT.sort()

B=0
L=0
ans=0
for T in TT:
  if B==0:
    L=T+K
    B=C-1
    ans+=1
  else:
    if L>=T:
      B-=1
    else:
      L=T+K
      B=C-1
      ans+=1
  
print(ans)

Problem: p03785
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):

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

ans = 1
c, n = 0, T[0] + K
for i in range(N):
    if c == C:
        c = 0
        ans += 1
        n = T[i] + K

    else:
        if T[i] < n:
            c += 1
        else:
            n = T[i] + K
            ans += 1
            c = 0

print(ans)


Failing test case input:
5 5 5
1
1
4
6
4

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):

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)
Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])

nw = T[0]
bs = 1
ans = 1
for i in range(1, N):
    t = T[i]
    if bs == C:
        bs = 0
        nw = t
        ans += 1
    elif t-nw > K:
        bs = 0
        nw = t
        ans += 1
    else:
        bs += 1

print(ans)

Failing test case input:
6 2 6
7
9
2
22
10
5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
N, C, K = map(int, input().split())
T = sorted([int(input()) for i in range(N)])

bs = 0
st = 0
ans = 0
for t in T:
    if bs == 0:
        st = t
    if bs == C or t-st>K:
        bs = 1
        st = t
        ans += 1
    else:
        bs += 1

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

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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

ans = 1 
count = 0 
ts = T[0] 
for t in T:
    if t-ts > K:
        ans += 1 
        ts = t 
        count = 0 
    else:
        count += 1 
    if count == C: 
        ans += 1 
        ts = t 
        count = 0 
print(ans)

Failing test case input:
6 2 3
7
0
1
8
7
6

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):


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

ans = 1 
count = 0 
T.sort()
ts = T[0] 


for t in T:
    if t-ts > K or count == C: 
        ans += 1 
        ts = t 
        count = 1 
    else:
        count += 1 
print(ans)

Problem: p03785
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n, c, k = map(int, input().split())
t = []
for i in range(n):
    t.append(int(input()))
t.sort()
ans = 0
counter = 0
lim = t[0]
for i in range(n):
    if counter <= c and (t[i] - lim) < k:
        counter += 1
    else:
        counter = 1
        lim = t[i]
        ans += 1
print(ans + 1)

Failing test case input:
5 3 5
1
4
3
7
12

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n, c, k = map(int, input().split())
t = []
for i in range(n):
    t.append(int(input()))
t.sort()
ans = 0
counter = 0
lim = t[0]
for i in range(n):
    if counter < c and (t[i] - lim) <= k:
        counter += 1
    else:
        counter = 1
        lim = t[i]
        ans += 1
print(ans + 1)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
r = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
    elif waitP != c:
        if t[i] - l <= k:
            waitP += 1
            if i == n - 1:
                ans += 1
        elif t[i] - l > k:
            ans += 1
            l = t[i]
            waitP = 1
            if i == n - 1:
                ans += 1

print(ans)

Failing test case input:
6 3 3
7
0
2
8
7
6

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
n, c, k = map(int, input().split())
t = [int(input()) for _ in range(n)]

t.sort()

waitP = 1
l = t[0]
ans = 0

for i in range(1, n):
    if waitP == c:
        ans += 1
        l = t[i]
        waitP = 1
        if i == n - 1:
            ans += 1
    elif waitP != c:
        if t[i] - l <= k:
            waitP += 1
            if i == n - 1:
                ans += 1
        elif t[i] - l > k:
            ans += 1
            l = t[i]
            waitP = 1
            if i == n - 1:
                ans += 1

print(ans)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import deque

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

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

T = sorted(T)
con = 0
bus = deque()

for i in range(N):
  t = T[i]
  
  
  
  
  if len(bus) == 0 or (t - bus[0] < K and len(bus) < C):
    bus.append(t)
  else:
    bus = deque()
    con += 1
    bus.append(t)
  
print(con + 1)

Failing test case input:
6 3 6
4
0
2
22
10
0

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
from collections import deque

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

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

T = sorted(T)
con = 0
bus = deque()

for i in range(N):
  t = T[i]
  
  
  
  
  if len(bus) == 0 or (t - bus[0] <= K and len(bus) < C):
    bus.append(t)
  else:
    bus = deque()
    con += 1
    bus.append(t)
    
if len(bus) > 0:
  con += 1
  
print(con)

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

n, c, k = map(int, input().split())
ans = 0
arr = sorted([int(input()) for _ in range(n)])
l, r = 0, 0
cur = arr[r]
limit = cur + c
tmp = 0
while r < n:
    
    while r < n and tmp < c and cur <= limit:
        tmp += 1
        r += 1
        if r >= n:
            break
        cur = arr[r]
    
    limit = cur + c
    tmp = 0
    ans += 1
    

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


Failing test case input:
6 4 3
11
9
2
13
17
5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):



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)
Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0)
    for Ti in Ts:
        if Ti <= st:
            in_bus += 1
        
        elif Ti > st or in_bus > C:
            bus_ct += 1
            in__bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()


Failing test case input:
6 1 3
7
6
2
13
17
5

Expected output:
6


Actual output:
4


Fixed submission (verdict: Accepted):
from math import ceil

def main():
    N, C, K =list(map(int, input().split()))
    Ts = []
    for _ in range(N):
        Ts.append(int(input()))

    Ts.sort()

    bus_ct = 0
    in_bus = 1
    st = Ts.pop(0) + K
    for Ti in Ts:
        if Ti > st:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
        elif Ti <= st:
            in_bus += 1

        if in_bus > C:
            bus_ct += 1
            in_bus = 1
            st = Ti + K
    
    if in_bus:
        bus_ct += 1
    
    print(bus_ct)

main()

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
6 6 4
7
5
2
22
10
5

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
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 = 1
    time = T[0]
    while i < N:
        if time - T[i] > K or c == C:
            bus += 1
            c = 1
            time = T[i]
        elif time - T[i] <= K:
            c += 1
        i += 1

    print(str(bus))

main()

Problem: p03785
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, C, K = map(int, input().rstrip().split())
TT = sorted(map(int, [input() for _ in range(N)]))
startT = TT[0]
bus_count = 1
p = 1
for T in TT[1:]:
    if T - startT > K or p > C:
        bus_count += 1
        startT = T
        p = 1
    else:
        p += 1
print(bus_count)


Failing test case input:
6 2 6
7
9
2
22
10
5

Expected output:
4


Actual output:
3


Fixed submission (verdict: Accepted):
N, C, K = map(int, input().rstrip().split())
TT = sorted(map(int, [input() for _ in range(N)]))
startT = TT[0]
bus_count = 1
p = 1
for T in TT[1:]:
    if T - startT > K or p >= C:
        bus_count += 1
        startT = T
        p = 1
    else:
        p += 1
print(bus_count)