Buggy python submission (verdict: Runtime Error):
import bisect
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])


def AirportBus(x=0, y=0):
    if x == n:
        return    
    y = min(bisect.bisect(t, t[x]+k), x+3)
    l.append(t[x:y])
    AirportBus(y)
    
l = []    
AirportBus()

print(len(l))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

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


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

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])


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

print(len(l))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

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


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

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])


def AirportBus1(x=0):
    y = x
    for i in range(x, n):
        if t[x]+k < t[i] or i-x >= c:
            y = i
            break
    if y == x:
        l.append(t[x:n])
        return
    l.append(t[x:y])
    AirportBus1(y)
    
def AirportBus2(x=0):
    y = x
    for i in range(x, n):
        if t[x]-k > t[i] or i-x >= c:
            y = i
            break
    if y == x:
        r.append(t[x:n])
        return
    r.append(t[x:y])
    AirportBus2(y)

l = []    
AirportBus1()
t.sort(reverse = True)
r = []
AirportBus2()

ans1 = 0
for lis in l:
    ans1 += -(-len(lis) // c)

ans2 = 0
for lis in r:
    ans2 += -(-len(lis) // c)

print(min(ans1,ans2))

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

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


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

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)], reverse = True)

l = []
def AirportBus(x=0):
    y = x
    for i in range(x, n):
        if t[x]-k > t[i]:
            y = i
            break
    if y == x:
        l.append(t[x:n])
        return
    l.append(t[x:y])
    AirportBus(y)
    
AirportBus()

ans = 0
for lis in l:
    ans += -(-len(lis) // c)

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

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


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

Buggy python submission (verdict: Runtime Error):
n, c, k = map(int, input().split())
t = sorted([int(input()) for _ in range(n)])

l = []
def AirportBus(x=0):
    y = x
    for i in range(x, n):
        if t[x]+k < t[i]:
            y = i
            break
    if y == x:
        l.append(t[x:n])
        return
    l.append(t[x:y])
    AirportBus(y)
    
AirportBus()

ans = 0
for lis in l:
    ans += -(-len(lis) // c)

print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

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


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