Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N = int(input())
    act = np.array([[int(item) for item in input().split()] for _ in range(N)])

    dp = np.zeros((2, 3), dtype='int64')
    selector = np.array([[0,1,1], [1,0,1], [1,1,0]])

    for i in range(0,N):
        for k in range(3):
            act_array = act[i][k]
            dp[i%2^1][k] = np.max(dp[i%2]*selector[k]) + act_array

        # print(dp)

    print(max(dp[N%2]))

main()

Fixed submission:
N = int(input())
act = [[int(item) for item in input().split()] for _ in range(N)]

dp = [[0 for _ in range(3)] for _ in range(N+1)]

for i in range(N):
    for j in range(3):
        temp_hp = []
        for k in range(3):
            if k != j:
                temp_hp.append(dp[i-1][k] + act[i][j])
        dp[i][j] = max(temp_hp)
# print(dp)
print(max(dp[N-1]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N = int(input())
    act = np.array([[int(item) for item in input().split()] for _ in range(N)])

    dp = np.zeros((2, 3), dtype='int64')

    for i in range(0,N):
        for j in range(3):
            prev_dp_array = [dp[i%2][k] if k != j else 0 for k in range(3)]
            dp[i%2 ^ 1][j] = np.max(prev_dp_array + act[i][j])
        # print(dp)
    print(np.max(dp))

main()


Fixed submission:
N = int(input())
act = [[int(item) for item in input().split()] for _ in range(N)]

dp = [[0 for _ in range(3)] for _ in range(N+1)]

for i in range(N):
    for j in range(3):
        temp_hp = []
        for k in range(3):
            if k != j:
                temp_hp.append(dp[i-1][k] + act[i][j])
        dp[i][j] = max(temp_hp)
# print(dp)
print(max(dp[N-1]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import numpy as np

N = int(input())
act = np.array([[int(item) for item in input().split()] for _ in range(N)])

dp = np.zeros((2, 3), dtype='int64')

for i in range(0,N):
    for j in range(3):
        prev_dp_array = [dp[i%2][k] if k != j else 0 for k in range(3)]
        dp[i%2 ^ 1][j] = max(prev_dp_array + act[i][j])
    # print(dp)
print(np.max(dp))

Fixed submission:
N = int(input())
act = [[int(item) for item in input().split()] for _ in range(N)]

dp = [[0 for _ in range(3)] for _ in range(N+1)]

for i in range(N):
    for j in range(3):
        temp_hp = []
        for k in range(3):
            if k != j:
                temp_hp.append(dp[i-1][k] + act[i][j])
        dp[i][j] = max(temp_hp)
# print(dp)
print(max(dp[N-1]))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import numpy as np

N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])


dp = np.full((N+1, 10**5 + 1), 10**12+1)
dp[0][0] = 0

for i in range(N):
    for j in range(10**5 + 1):
        w, v = item[i]
        if j >= v:
            dp[i+1][j] = min(dp[i][j], dp[i][j - v] + w)
        else:
            dp[i+1][j] = dp[i][j]

print(np.where(dp[N] <= W)[0][-1])

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])


dp = np.full((N+1, 10**5 + 1), 10**12+1)
dp[0][0] = 0

for i in range(N):
    dp[i+1] = dp[i]
    w, v = item[i]
    np.minimum(dp[i][v:], dp[i][:-v] + w, out=dp[i+1][v:])

print(np.where(dp[N] <= W)[0][-1])

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])

dp = np.zeros((N+1, W+1), dtype='int64')

for i in range(N):
    dp[i+1] = dp[i]
    w, v = item[i]
    np.maximum(dp[i][w:], dp[i][:-w] + v, out=dp[i+1][w:])
    #print(dp)

print(np.max(dp))

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])


dp = np.full((N+1, 10**5 + 1), 10**12+1)
dp[0][0] = 0

for i in range(N):
    dp[i+1] = dp[i]
    w, v = item[i]
    np.minimum(dp[i][v:], dp[i][:-v] + w, out=dp[i+1][v:])

print(np.where(dp[N] <= W)[0][-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, W = [int(item) for item in input().split()]
item = [[int(item) for item in input().split()] for _ in range(N)]

dp = [[0 for _ in range(W+1)] for _ in range(N+1)]

for i in range(N):
    for w in range(W+1):
        if 0 <= w - item[i][0]:
            dp[i+1][w] = max(dp[i][w], dp[i][w - item[i][0]] + item[i][1])
        else:
            dp[i+1][w] = dp[i][w]
print(dp[N][W])


Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

N, W = [int(item) for item in input().split()]
item = np.array([[int(item) for item in input().split()] for _ in range(N)])


dp = np.full((N+1, 10**5 + 1), 10**12+1)
dp[0][0] = 0

for i in range(N):
    dp[i+1] = dp[i]
    w, v = item[i]
    np.minimum(dp[i][v:], dp[i][:-v] + w, out=dp[i+1][v:])

print(np.where(dp[N] <= W)[0][-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

s = input()
t = input()

num_s = len(s)
num_t = len(t)

dp = np.zeros((num_s + 1, num_t +1), dtype='int64')


for i in range(num_s):
    for j in range(num_t):
        if s[i] == t[j]:
            dp[i+1, j+1] = max([dp[i, j] + 1, dp[i+1, j], dp[i, j+1]])
        else:
            dp[i+1, j+1] = max([dp[i+1, j], dp[i, j+1]])

# print(dp)

is_search = True
res=''
pos_s = num_s
pos_t = num_t


while len(res) < np.max(dp):
    temp = dp[pos_s, pos_t]
    # print(temp)
    if dp[pos_s-1, pos_t] == temp:
        pos_s -= 1

    if dp[pos_s, pos_t-1] == temp:
        pos_t -= 1

    if dp[pos_s-1, pos_t-1] != temp:
        res += s[pos_s-1]
        pos_s -= 1
        pos_t -= 1

    # print(res, pos_s-1)
        

print(res[::-1])


Fixed submission:
import numpy as np

def main():
    s = np.array([str(i) for i in input()], dtype=np.unicode)
    t = np.array([str(i) for i in input()], dtype=np.unicode)

    num_s = int(s.shape[0])
    num_t = int(t.shape[0])


    dp = np.zeros((num_s +1, num_t +1), dtype='int64')

    eq = s[:,None] == t[None,:]
    # print(len(eq[0]))

    for i in range(num_s):
        np.maximum(dp[i, 1:], dp[i, :-1] + eq[i], out=dp[i+1, 1:])
        np.maximum.accumulate(dp[i+1], out=dp[i+1])
    # print(dp)

    res=''
    pos_s = num_s
    pos_t = num_t


    while len(res) < np.max(dp[num_s]):
        temp = dp[pos_s, pos_t]
        # print(temp)
        if dp[pos_s-1, pos_t] == temp:
            pos_s -= 1

        if dp[pos_s, pos_t-1] == temp:
            pos_t -= 1

        if s[pos_s - 1] == t[pos_t - 1]:
            res += s[pos_s-1]
            pos_s -= 1
            pos_t -= 1

        # print(res, pos_s-1)
        
    print(res[::-1])

main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
p0_list = np.array([float(item) for item in input().split()])
p1_list = 1 - p0_list

dp = np.zeros((N+1, N+1), dtype='float')
dp[0, 0] = 1


for i in range(N):
    dp[i+1, 0] = dp[i, 0] * p1_list[i]
    for j in range(i+1):
        dp[i+1, j+1] = dp[i, j] * p0_list[i] + dp[i, j+1] * p1_list[i]

# print(dp)
print(sum(dp[N, N//2 + 1:]))

    

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline

N = int(input())
p0_list = np.array([float(item) for item in input().split()])
p1_list = 1 - p0_list

dp = np.zeros((N+1, N+1), dtype='float')
dp[0, 0] = 1

for i in range(N):
    dp[i+1][:-1] += dp[i][:-1] * p1_list[i]
    dp[i+1][1:]  += dp[i][:-1] * p0_list[i]

print(np.sum(dp[N, (N+1)//2:]))
Buggy python submission (verdict: Runtime Error):
#
from resolve import resolve
####################################
####################################
# 以下にプラグインの内容をペーストする
#  
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5 3
-30 -10 10 20 50"""
        output = """40"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 2
10 20 30"""
        output = """20"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1 1
0"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """8 5
-9 -7 -4 -3 1 2 3 4"""
        output = """10"""
        self.assertIO(input, output)


if __name__ == "__main__":
    unittest.main()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]
    xs = [int(item) for item in input().split()]
    
    min_lr = 10**9
    min_rl = 10**9

    if N != K:
        for i in range(N-K+1):
            min_lr = min(min_lr, abs(xs[i]) + abs(xs[i+K-1] - xs[i]))
            min_rl = min(min_rl, abs(xs[i+K-1]) + abs(xs[i+K-1] - xs[i]))

        print(min(min_lr, min_rl))
    elif N ==1:
        print(abs(xs[0]))
    else:
        print(min(abs(xs[0]) + abs(xs[N-1] - xs[0]), abs(xs[N-1]) + abs(xs[N-1] - xs[0])))

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    D, X = [int(item) for item in input().split()]
    As = [int(input()) for _ in range(N)]

    cnt = 0
    for i in range(N):
        day = 0
        j = 0
        while day <= D:
            day = j * As[i] + 1 
            cnt +=1
    print(cnt)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    D, X = [int(item) for item in input().split()]
    As = [int(input()) for _ in range(N)]

    cnt = 0
    for i in range(N):
        day = 1
        while day <= D:
            day +=As[i] 
            cnt +=1

    print(cnt+X)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    N, H = [int(item) for item in input().split()]
    ab = [[int(item) for item in input().split()] for _ in range(N)]

    a_max = max(ab, key=lambda x:x[0])
    res = H // a_max
    if H % a_max != 0:
        res += 1
    
    temp_attack = res * a_max
    b_delta = [b - a_max for a, b in ab]

    throw_atk_sum = 0
    throw_num = 0

    for item in b_delta:
        if b_delta > 0:
            throw_atk_sum += item
            throw_num += 1

    if throw_atk_sum < temp_attack:
        reduce_num = throw_atk_sum//a_max
        print(res - reduce_num)
    else:
        res = 0
        for a, b in ab:
            H -= b
            res += 1
            if H <= 0:
                break
        print(res)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N, H = [int(item) for item in input().split()]
    ab = [[int(item) for item in input().split()] for _ in range(N)]
    ab.sort(reverse=True, key=lambda x:x[1])
    a_max_ab = max(ab, key=lambda x:x[0])

    cnt = 0    
    for a, b in ab:
        if b > a_max_ab[0]:
            H -= b
            cnt += 1
        
        if H <= 0:
            break

    if H > 0:
        cnt += H // a_max_ab[0]
        if H  % a_max_ab[0] != 0:
            cnt += 1

    print(cnt)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
Sd = input()
T = input()

r_Sd = Sd[::-1]
r_T = T[::-1]

for i in range(len(Sd)- len(T)):
    temp_words = r_Sd[i:i+len(T)]
    res = r_Sd[0:i] + ''
    for j in range(len(T)):
        if temp_words[j] == '?' or temp_words[j] == r_T[j]:
            res+=r_T[j]
        else:
            break
    else:
        res = res + r_Sd[i+len(T):]
        break
else:
    print('UNRESTORABLE')

print(res.replace('?', 'a')[::-1])

Fixed submission:
def resolve():
    '''
    code here
    '''
    S_dash = input()
    T = input()

    is_flag = False

    res = ''
    res_list = ['zzzzz']
    for i in range(len(S_dash) - len(T) +1):
        res = S_dash[:i]
        # print(i, res)
        if len(S_dash) - len(res) >= len(T):
            for j in range(len(T)):
                if S_dash[i+j] == T[j] or S_dash[i+j] == '?':
                    res += T[j]
                else:
                    # print('bk')
                    break
            else:
                is_flag = True
                res += S_dash[i+len(T):]
                res_list.append(res)


    # print(res_list)

    res2_list = []
    for res in res_list:
        res = res.replace('?','a')
        res2_list.append(res)

    res2_list.sort()
    res = res2_list[0]

    print(res) if is_flag else print('UNRESTORABLE')     

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    Sd = input()
    T = input()

    r_Sd = Sd[::-1]
    r_T = T[::-1]

    for i in range(len(Sd)- len(T)):
        temp_words = r_Sd[i:i+len(T)]
        res = r_Sd[0:i] + ''
        for j in range(len(T)):
            if temp_words[j] == '?' or temp_words[j] == r_T[j]:
                res+=r_T[j]
            else:
                break
        else:
            res = res + r_Sd[i+len(T):]
            break
    else:
        print('UNRESTORABLE')

    print(res.replace('?', 'a')[::-1])

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    S_dash = input()
    T = input()

    is_flag = False

    res = ''
    res_list = ['zzzzz']
    for i in range(len(S_dash) - len(T) +1):
        res = S_dash[:i]
        # print(i, res)
        if len(S_dash) - len(res) >= len(T):
            for j in range(len(T)):
                if S_dash[i+j] == T[j] or S_dash[i+j] == '?':
                    res += T[j]
                else:
                    # print('bk')
                    break
            else:
                is_flag = True
                res += S_dash[i+len(T):]
                res_list.append(res)


    # print(res_list)

    res2_list = []
    for res in res_list:
        res = res.replace('?','a')
        res2_list.append(res)

    res2_list.sort()
    res = res2_list[0]

    print(res) if is_flag else print('UNRESTORABLE')     

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(input()) for _ in range(N)]
 
    num_list = []
 
    for i in A_list:
        if i in num_list:
            num_list.remove(i)
        else:
            num_list.append(i)
 
    print(len(num_list))

if __name__ == "__main__":
    resolve()


Fixed submission:

def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    cnt_dic = collections.Counter(A_list)

    cnt = 0
    for v in cnt_dic.values():
        if v % 2 == 1:
            cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(input()) for _ in range(N)]

    num_cnt_list = [0 for _ in range(10**9+1)]

    for i in A_list:
        num_cnt_list[i] += 1
    
    res_list = [i%2 for i in num_cnt_list]

    print(sum(res_list))


if __name__ == "__main__":
    resolve()


Fixed submission:

def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    cnt_dic = collections.Counter(A_list)

    cnt = 0
    for v in cnt_dic.values():
        if v % 2 == 1:
            cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(input()) for _ in range(N)]

    num_cnt_list = [0 for _ in range(10**9+1)]

    for i in A_list:
        num_cnt_list[i] += 1
    
    res_list = [i%2 for i in num_cnt_list]

    print(sum(res_list))


if __name__ == "__main__":
    resolve()


Fixed submission:

def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    cnt_dic = collections.Counter(A_list)

    cnt = 0
    for v in cnt_dic.values():
        if v % 2 == 1:
            cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(input()) for _ in range(N)]

    num_list = []

    for i in A_list:
        try:
            num_list.remove(i)
        except ValueError:
            num_list.append(i)

    print(len(num_list))


if __name__ == "__main__":
    resolve()


Fixed submission:

def resolve():
    '''
    code here
    '''
    import collections

    N = int(input())
    A_list = [int(input()) for _ in range(N)]
    cnt_dic = collections.Counter(A_list)

    cnt = 0
    for v in cnt_dic.values():
        if v % 2 == 1:
            cnt += 1

    print(cnt)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    import sys
    sys.setrecursionlimit(10000000)
    N = int(input())
    T_list = [int(input()) for _ in range(N)]

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a,b):
        return int(a * b / gcd(a, b))

    res = 1
    for i in T_list:
        res = lcm(res, i)
        # print(res, i)

    print(res)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    import sys
    sys.setrecursionlimit(10000000)
    from decimal import Decimal
    N = int(input())
    T_list = [int(input()) for _ in range(N)]

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a,b):
        return int(a // gcd(a, b) * b)

    res = 1
    for i in T_list:
        res = lcm(res, i)
        # print(res, i)

    print(res)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve(N):
    '''
    code here
    '''
    N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 0
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    res = 1
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt < tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 1
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt <= tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve(N):
    '''
    code here
    '''
    # N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 0
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    res = 1
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt < tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    res = 0

    def div2(num):
        if num == 1:
            return 1
        else:
            cnt = 0
            while True:
                if num % 2 == 0:
                    num //= 2
                    cnt += 1
                else:
                    return cnt


    res_max_cnt = 0
    for i in range(N):
        tepm_cnt = div2(i+1)
        if res_max_cnt <= tepm_cnt:
            res_max_cnt = tepm_cnt
            res = i+1
    print(res)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''

    import collections
    N = int(input())
    S_list = [collections.Counter(input()) for _ in range(N)]

    abcd_list = string.ascii_lowercase
    cnt_dict = S_list[0]

    for line in S_list:
        for item in cnt_dict.keys():
            cnt_dict[item] = min(line[item], cnt_dict[item])
        prev_dict = cnt_dict
        # print(cnt_dict)
    
    cnt_tuple = sorted(cnt_dict.items())
    # print(cnt_tuple)
    res = ''
    for i, v in cnt_tuple:
        if v > 0:
            res += i*v

    print(res)

if __name__ == "__main__":
    resolve()    



Fixed submission:
def resolve():
    '''
    code here
    '''

    import collections
    N = int(input())
    S_list = [collections.Counter(input()) for _ in range(N)]

    cnt_dict = S_list[0]

    for line in S_list:
        for item in cnt_dict.keys():
            cnt_dict[item] = min(line[item], cnt_dict[item])
        prev_dict = cnt_dict
        # print(cnt_dict)
    
    cnt_tuple = sorted(cnt_dict.items())
    # print(cnt_tuple)
    res = ''
    for i, v in cnt_tuple:
        if v > 0:
            res += i*v

    print(res)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    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 = 0
                lim = Ts[i+1] + K
        # print(Ts[i], temp_psg, res, lim)
    
    if temp_psg > 0:
        res += 1
    print(res)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    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
        # print(Ts[i], temp_psg, res, lim)
    
    if temp_psg > 0:
        res += 1
    print(res)


if __name__ == "__main__":
    resolve()