Help me in solving DSSA13 problem

My issue

Runtime Error

My code


def can_win_race(N, K, L, S):
    S_last=S[N-1]
    S.pop(N-1)
    max_speed = max(S)
    needed_speed = S_last + K
    if needed_speed <= max_speed:
        return "No"
    return "Yes"

# Input reading and test case execution
T = int(input().strip())

for _ in range(T):
    N, K, L = map(int, input().strip().split())
    S = list(map(int, input().strip().split()))
    result = can_win_race(N, K, L, S)
    print(result)

Learning course: Kalasalingam Academy of Research and Education
Problem Link: Problem 3 - Solve the problem! Practice Problem in Kalasalingam Academy of Research and Education - CodeChef