Help me in solving DSSA13 problem

My issue

My code

def can_help_friend_win_race(N, K, L, speeds):
    friend_speed = speeds[N - 1]  # Assuming the friend is the Nth participant (0-indexed)
    max_speed = max(speeds)

    if friend_speed >= max_speed:
        return "Yes"

    units_to_win = (max_speed - friend_speed) // K
    if friend_speed + units_to_win * K >= max_speed and units_to_win <= L:
        return "Yes"
    else:
        return "No"

# Main function to handle input and output
def main():
    T = int(input())  # Number of test cases

    for _ in range(T):
        N, K, L = map(int, input().split())  # Input values for each test case
        speeds = list(map(int, input().split()))  # Speeds of participants
        result = can_help_friend_win_race(N, K, L, speeds)
        print(result)

if __name__ == "__main__":
    main()


Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone