Buggy python submission (verdict: Runtime Error):
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    limit = t[0] + k
    bus = 0
    for i in range(n):
        if t[i] <= limit:
            bus += 1
            if bus == c:
                ans += 1
                bus = 0
                if i < n:
                    limit = t[i + 1] + k
        else:
            ans += 1
            bus = 1
            limit = t[i] + k
    if bus > 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    limit = t[0] + k
    bus = 0
    for i in range(n):
        if t[i] <= limit:
            bus += 1
            if bus == c:
                ans += 1
                bus = 0
                limit = t[i + 1] + k
        else:
            ans += 1
            bus = 1
            limit = t[i] + k
    if bus > 0:
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    limit = t[0] + k
    bus = 0
    for i in range(n):
        if t[i] <= limit:
            bus += 1
            if bus == c:
                ans += 1
                bus = 0
                limit = t[i + 1] + k
        else:
            ans += 1
            bus = 1
            limit = t[i] + k
    if bus:
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import bisect


def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    while t:
        candidates = bisect.bisect_left(t, t[0] + k)
        # candidates = len([tj for tj in t if tj <= t[0] + k])
        num = min(c, candidates)
        t = t[num:]
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 0
    while t:
        candidates = len([tj for tj in t if tj <= t[0] + k])
        num = min(c, candidates)
        t = t[num:]
        ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    n, c, k = map(int, input().split())
    t = list(int(input()) for _ in range(n))
    t.sort()
    ans = 1
    limit = t[0] + k
    bus = 0
    for i in range(n):
        bus += 1
        if t[i] > limit or bus > c:
            limit = t[i] + k
            ans += 1
            bus = 1
    print(ans)


if __name__ == "__main__":
    resolve()