/**
 * Given a list of athletes, update a slice of the list with new values.
 *
 * @param athleteList A list of athletes.
 * @param updateValues A list of new values to update the athlete list.
 * @param startIndex The index of the athlete list where the update should begin.
 * @param endIndex The index of the athlete list where the update should end (exclusive).
 * @return The updated list of athletes.
 */
fun updateSliceList(athleteList: MutableList<String>, updateValues: List<String>, startIndex: Int, endIndex: Int): List<String> {

    if (startIndex < 0) {
        // Negative start index is not allowed
        return athleteList
    }

    val updateLength = updateValues.size
    val sliceLength = endIndex - startIndex

    if (sliceLength != updateLength) {
        // Length of update values does not match the slice length
        return athleteList
    }

    athleteList.subList(startIndex, endIndex).clear()
    athleteList.addAll(startIndex, updateValues)
    return athleteList
}
/**
 * Given a list of athletes, update a slice of the list with new values.
 *
 * @param athleteList A list of athletes.
 * @param updateValues A list of new values to update the athlete list.
 * @param startIndex The index of the athlete list where the update should begin.
 * @param endIndex The index of the athlete list where the update should end (exclusive).
 * @return The updated list of athletes.
 */
fun updateSliceList(athleteList: MutableList<String>, updateValues: List<String>, startIndex: Int, endIndex: Int): List<String> {
/**
 * Given a list of athletes, update a slice of the list with new values.
 *
 * @param athleteList A list of athletes.
 * @param updateValues A list of new values to update the athlete list.
 * @param startIndex The index of the athlete list where the update should begin.
 * @param endIndex The index of the athlete list where the update should end (exclusive).
 * @return The updated list of athletes.
 */
fun updateSliceList(athleteList: MutableList<String>, updateValues: List<String>, startIndex: Int, endIndex: Int): List<String> {

    if (startIndex < 0) {
        // Negative start index is not allowed
        return athleteList
    }

    val updateLength = updateValues.size
    val sliceLength = endIndex - startIndex

    if (sliceLength != updateLength) {
        // Length of update values does not match the slice length
        return athleteList
    }

    athleteList.subList(startIndex, endIndex).clear()
    athleteList.addAll(startIndex, updateValues)
    return athleteList
}