TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
T = [int(input()) for _ in range(N)]
T.sort()

def init_bus():
    global bus, min_t, ans
    bus = []
    bus.append(t)
    min_t = t
    ans += 1

min_t = 0
for t in T:
    if len(bus) == 0:
        init_bus()
        continue
    if t - min_t < K and len(bus) < C:
        bus.append(t)
    else:
        init_bus()
print(ans)

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

def init_bus():
    global bus, min_t, ans
    bus = []
    bus.append(t)
    min_t = t
    ans += 1

min_t = 0
for t in T:
    if len(bus) == 0:
        init_bus()
        continue
    if t - min_t < K and len(bus) < C:
        bus.append(t)

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

min_t = 0
i = 0
while i < N:
    ans += 1
    start = i
    while i < N and T[i] - T[start] <= K and i - start < C:
        i += 1
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

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

ans=0
nexttime=0
people=0
for t in T:
  if t>nexttime:
    nexttime=t+K
    ans+=1
    people=0
  people+=1
  if people==C:
    nexttime=0

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

ans=0
nexttime=0
people=0
for t in T:
  if t>nexttime:
    nexttime=t+K
    ans+=1
    people=0
  people+=1
  if people==C:
    nexttime=0
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
nums ,limit ,wait = map(int, input().split())
nums_ary = [0 for i in range(nums)]

for i in range(nums):
    nums_ary[i] = int(input())

nums_ary.sort()
nums_ary.append(10000000000000)
count = 0
i = 0
while i < nums:
    time = nums_ary[i]
    for x in range(limit):
        print(i,count,nums_ary[i])
        if not time <= nums_ary[i] <= time + wait:
            count += 1
            break
        i += 1
    else:
        count += 1
print(count)

nums ,limit ,wait = map(int, input().split())
nums_ary = [0 for i in range(nums)]

for i in range(nums):
    nums_ary[i] = int(input())

nums_ary.sort()
nums_ary.append(10000000000000)
count = 0
i = 0
while i < nums:
    time = nums_ary[i]
    for x in range(limit):
        if not time <= nums_ary[i] <= time + wait:
            count += 1
            break
        i += 1
    else:
        count += 1
print(count)

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

listT.sort()

def func(listT,bus):
    if len(listT)<2:
            print(bus+1)
            sys.exit()

    elif len(listT)>=2:
        for i in range(1,max(C,len(listT))):

            if listT[i]-listT[0]>K:
                bus += 1
                return func(listT[i:],bus)

        bus += 1

        if len(listT)<C:
            print(bus)
            sys.exit()


        return func(listT[C:],bus)

func(listT,0)


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

listT.sort()

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

print(count)            


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n,c,k=map(int, input().split())
t=[int(input()) for i in range(n)]
t.sort()
ans=0
s=0
g=10**9
for i in range(n):
    if s==0:
        g=t[i]+k
        s+=1
    elif g>t[i]:
        ans+=1
        g=t[i]+s
        s+=1
    else:
        s+=1
    if s==c:
        ans+=1
        g=10**8
        s=0
print(ans)

n,c,k=map(int,input().split())
t=sorted(map(int,input().split()))
ans=0
j=0
e=0
for i in t:
    if j==0:
        j=1
        e=i+k
    elif e<=i:
        j=1
        e=i+k
        ans+=1
    else:
        j+=1
    if j==c:
        j=0
        ans+=1
        e=0
if j>0:ans+=1
print(ans)


n,c,k=map(int,input().split())
t=sorted([int(input()) for i in range(n)])
ans=0
j=0
e=0
for i in t:
    if j==0:
        j=1
        e=i+k
        ans+=1
    elif e<i:
        j=1
        e=i+k
        ans+=1
    else:
        j+=1
    if j==c:
        j=0
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import bisect

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

if T[0]+K>=T[-1]:
  print(1)
else:
  while True:
    if i==N-1:
      ans+=1
      break
    i=bisect.bisect_right(T,T[i]+K)
    print(T,i)
    ans+=1
  print(ans)

import bisect
import sys

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

if T[0]+K>=T[-1]:
  if N%C==0:
    print(N//C)
  else:
    print(N//C+1)
  sys.exit()
else:
  while True:
    t=bisect.bisect_right(T,T[i]+K)
    if t-i>C:
      i+=C
    else:
      i=t
    ans+=1
    if i==N-1:
      ans+=1
      break
    if i>N-1:
      i=N-1
      break
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = input()
b = input()

for i in range(n):
  if i == 1:
    if a == b:
      print(n)
      exit()
  if a[i:] == b[:-i]:
    print(n+i)
    exit()
print(n*2)

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:
    people += 1
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

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


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


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


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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N, C, K = map(int, input().split())
T = list(int(input()) for i in range(N))
T.sort()
bus = 1
passenger = 0
limit = T[0] + K
for i in range(N):
    if T[i] <= limit and passenger < c:
        passenger += 1
    else:
        bus += 1
        limit = T[i]+K
        passenger = 1
print(bus)

bus = 1
time = 0
for i in range(N):
    if T[i]-time > K:
        bus +=1
        time = T[i]
    else:
        time = time
print(bus)

N, C, K = map(int, input().split())
T = list(int(input()) for i in range(N))
T.sort()
bus = 1
passenger = 0
limit = T[0] + K
for i in range(N):
    if T[i] <= limit and passenger < C:
        passenger += 1
    else:
        bus += 1
        limit = T[i]+K
        passenger = 1
print(bus)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import bisect
kyaku, teiin, jikan = map(int, input().split(" "))
a=sorted([(int)(input()) for i in range(kyaku)])
print(a)
count = 0
while(True):
  print(a)
  if len(a) > teiin:
    if a[0] + jikan >= a[teiin]:
      a = a[teiin:]
    else:
      a = a[bisect.bisect_left(a, a[0] + jikan):]
  else:
    if a[0] + jikan >= a[-1]:
      count += 1
      break
    else:
      a = a[bisect.bisect_left(a, a[0] + jikan):]
  count += 1
print(count)

n,c,k = map(int ,input().split(" "))
t = sorted([int(input()) for i in range(n)])
total = 0
count = 0
while(count != n):
  temp = 0
  
  for i in range(c):
    if count + i >= n:
      
      if t[-1] - t[count] <= k:
        
        count = n
        total += 1
        break
      else:
        temp = 0
        while(count != n):
          
          if t[count + temp] - t[count] <= k:
            temp += 1
          else:
            count += temp + 1
            total += 1
        break
      break
    if t[count + i] - t[count] > k:
      
      count += i
      total += 1
      break
  else:
    
    count += c
    total += 1
    if count == n:
      break
print(total)

Verdicts: Runtime Error

Accepted
Problem: 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.

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

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)
  


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

time=T[0]
count = 1
ans = 0

for i in range(1,N):
  if T[i]-time>K or count==C:
    time = T[i]
    count = 1
    ans += 1
  else:
    count += 1
if count>0:
  ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

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

limit = T[0] + k
bus = [0]
ans = 0
for t in T:
    if t <= limit:
        if bus[-1] <= c:
            bus[-1] += 1
        else:
            bus.append(1)
    else:
        limit = t + k
        ans += len(bus)
        bus = [1]

ans += len(bus)

print(ans)

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

limit = T[0] + k
bus = [0]
ans = 0
for t in T:
    if t <= limit:
        if bus[-1] < c:
            bus[-1] += 1
        else:
            bus.append(1)
            limit = t + k

    else:
        limit = t + k
        ans += len(bus)
        bus = [1]

ans += len(bus)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    N = int(input())
    A = list(map(int, input().split()))

    A.sort()
    i = 1
    j = N - 1
    x = sum(A)
    while j > 0:
        if (x - A[j]) * 2 >= A[j]:
            i += 1
        else:
            break
        x -= A[j]
        j -= 1
    print(str(i))

main()

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()

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()

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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()


def main():
    n, c, k, *t = map(int, open(0).read().split())
    t.sort()
    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
            p = 1
            l = v + k
    print(cnt)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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
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)


N,C,K = map(int,input().split())
T = [int(input()) for i in range(N)]
s = 0
e = 0
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
if p > 0:
    ans += 1
print(ans)


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)



Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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] > T[start] + K or i+1 -start == C:
      ans += 1
      start = -1
  
print(ans)

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, C, K = map(int, input().split())
sorted_Ts = sorted([int(x) for x in input().split()])

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

N, C, K = map(int, input().split())
sorted_Ts = sorted([int(x) for x in input().split()])

bus_num = 1
bus_i = [1]
bus_t = sorted_Ts[0]
for t in sorted_Ts:
    if (t<=(bus_t+K)) & (len(bus_i) <= C):
        bus_i.append(1)
    else:
#         print("add bus")
        bus_i = []
        bus_t = t
        bus_num +=1
print(bus_num)

N, C, K = map(int, input().split())
sorted_Ts = sorted([int(x) for x in input().split()])

bus_num = 1
bus_i = [1]
bus_t = sorted_Ts[0]
for t in sorted_Ts:
    if (t<=(bus_t+K)) & (len(bus_i) <= C):
        bus_i.append(1)
    else:
        #print("add bus")
        bus_i = []
        bus_t = t
        bus_num +=1
print(bus_num)

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

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

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n, c, k = map(int, input().split())
l = list(int(input()) for i in range(n))

count = 1
count_m = 0
l.sort()

while len(l) > 0:
    for i in range(1, c):
        try:
            if l[i] > l[0] + k:
                l = l[count_m + 1:]
                count += 1

            else:
                count_m += 1
            if count_m == c - 1:
                l = l = l[count_m + 1:]
                count += 1
                
        except IndexError:
            print(count)
            exit()

print(count)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def solve():

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

    T = sorted(T)
    i = 0
    k = 0

    ans = 0

    print(T)

    while i < N:
        n = 0
        while k < N and n < C and T[i] <= T[k] <= T[i]+K:
            n += 1
            k += 1
            if n == C:
                ans += 1
                break

        if n != C:
            ans += 1

        i = k



    print(ans)            


if __name__ == "__main__":
    solve()


def solve():

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

    T = sorted(T)
    i = 0
    k = 0

    ans = 0

    #print(T)

    while i < N:
        n = 0
        while k < N and n < C and T[i] <= T[k] <= T[i]+K:
            n += 1
            k += 1
            if n == C:
                ans += 1
                break

        if n != C:
            ans += 1

        i = k



    print(ans)            


if __name__ == "__main__":
    solve()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N, C, K=map(int, input().split())
X=[]
for _ in range(N):
  X.append(int(input()))
X.sort()
X.append(10**19)
ans=0
tamatta=0
hayaihito=X[0]
for i in range(N):
  if tamatta<C and hayaihito+K>=X[i+1]:
    tamatta+=1
  else:
    tamatta=0
    hayaihito=X[i+1]
    ans+=1
print(ans)

N, C, K=map(int, input().split())
X=[]
for _ in range(N):
  X.append(int(input()))
X.sort()
X.append(10**19)
ans=0
tamatta=0
hayaihito=X[0]
for i in range(N+1):
  if tamatta<C and hayaihito+K>=X[i]:
    tamatta+=1
  else:
    ans+=1
    tamatta=1
    hayaihito=X[i]
    
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n,c,k = map(int,input().split())
t = []
cnt,ans = 0,0
bt = 10**10
btl = []
for i in range(n):
    t.append(int(input()))

t.sort()

for i in range(n):
    if (t[i] >= bt)&(cnt == c):
        ans += 1
        cnt,bt = 0,10**10
    if (bt == 10**10):
        bt = t[i]+k
        cnt += 1
    else:
        cnt += 1
        
if (cnt != 0):
    ans += 1

print(ans)

n,c,k = map(int,input().split())
t = []
cnt,ans = 0,0
bt = 10**10
btl = []
for i in range(n):
    t.append(int(input()))

t.sort()

for i in range(n):
    if (t[i] >= bt):
        ans += 1
        btl.append(bt)
        cnt,bt = 0,10**10
    if (bt == 10**10):
        bt = t[i]+k
        cnt += 1
    else:
        cnt += 1
    if (cnt == c):
        btl.append(t[i])
        ans += 1
        cnt,bt = 0,10**9+1

if (cnt != 0):
    ans += 1

print(ans)

n,c,k = map(int,input().split())
t = []
cnt,ans = 0,0
bt = 10**10
btl = []
for i in range(n):
    t.append(int(input()))

t.sort()

for i in range(n):
    if (t[i] > bt)|(cnt == c):
        ans += 1
        cnt,bt = 0,10**10
    if (bt == 10**10):
        bt = t[i]+k
        cnt += 1
    else:
        cnt += 1
        
if (cnt != 0):
    ans += 1

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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
        

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
        

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+1-bus_count]+k<x[j+1] or bus_count==c):
        count+=1
        bus_count=0
        
print(count)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,C,K = map(int,input().split())
T = []
for i in range(N):
  L.append(int(input()))
  
ans = 1
T = sorted(T)
ind = 0

for i in range(T):
    if T[i] > T[ind]+K:
        ans += 1
        ind = i
    elif i >= ind + C:
        ans += 1
        ind = i
    
print(ans)

N,C,K = map(int,input().split())
T = []
for i in range(N):
  T.append(int(input()))
  
ans = 1
T = sorted(T)
ind = 0

for i in range(T):
    if T[i] > T[ind]+K:
        ans += 1
        ind = i
    elif i >= ind + C:
        ans += 1
        ind = i
    
print(ans)

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

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

  
ans = 1
T = sorted(T)
ind = 0

for i in range(T):
    if T[i] > T[ind]+K:
        ans += 1
        ind = i
    elif i >= ind + C:
        ans += 1
        ind = i
    
print(ans)

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(T):
    if T[i] > T[ind]+K:
        ans += 1
        ind = i
    elif i >= ind + C:
        ans += 1
        ind = i
    
print(ans)

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
        ind = i
print(ans)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

ans=0
c=0
t=0

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

    if c==0:
        t=T[i]

    c+=1

if c>=2:
    print(ans+1)
else:
    print(ans)


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

ans=0
c=0
t=0

for i in range(N):
    if c==0:
        ans+=1
        t=T[i]

    c+=1

    if c==C or T[i+1]>t+K:
        c=0

print(ans)




Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# -*- 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()


# -*- 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])
    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] <= pos:
            remain -= 1
        else:
            bus_count += 1
            pos = sorted_t[i][1]
            remain = c - 1

    print(bus_count)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N,C,K = [int(s) for s in input().split()]
T = []
for i in range(N):
    T.append(int(input()))
T.sort()

pas = 0
leave = T[0]
ans = 1

for t in T:
    if pas == C and K < t - leave:
        pas += 1
    else:
        leave = t
        ans += 1
        pas = 0
print(ans)

N,C,K = [int(s) for s in input().split()]
T = []
for i in range(N):
    T.append(int(input()))
T.sort()
 
pas = 0
leave = T[0]
ans = 1
 
for t in T:
    if pas == C or K < t - leave:
        leave = t
        ans += 1
        pas = 0
    pas += 1
print(ans)

Verdicts: Wrong Answer

Accepted