/**
 * Given a list of distances and a specific distance,
 * find the time taken by the athlete to complete the specific distance.
 * However, if the athlete takes longer than 20 seconds for any distance,
 * break out of the loop and return "Did not complete".
 */
fun breakOutOfLoop(athlete: String, distance: List<Int>): Any {

    val times = listOf(4, 6, 7, 9, 12, 15, 21, 18, 22, 26, 30, 27)

    for (i in distance.indices) {
        var timeTaken = 0
        for (j in times.indices) {
            if (times[j] > 20) {
                return "Did not complete"
            }
            timeTaken += times[j]
            if (timeTaken >= distance[i]) {
                return timeTaken
            }
        }
    }

    return "Did not complete"
}
/**
 * Given a list of distances and a specific distance,
 * find the time taken by the athlete to complete the specific distance.
 * However, if the athlete takes longer than 20 seconds for any distance,
 * break out of the loop and return "Did not complete".
 */
fun breakOutOfLoop(athlete: String, distance: List<Int>): Any {
/**
 * Given a list of distances and a specific distance,
 * find the time taken by the athlete to complete the specific distance.
 * However, if the athlete takes longer than 20 seconds for any distance,
 * break out of the loop and return "Did not complete".
 */
fun breakOutOfLoop(athlete: String, distance: List<Int>): Any {

    val times = listOf(4, 6, 7, 9, 12, 15, 21, 18, 22, 26, 30, 27)

    for (i in distance.indices) {
        var timeTaken = 0
        for (j in times.indices) {
            if (times[j] > 20) {
                return "Did not complete"
            }
            timeTaken += times[j]
            if (timeTaken >= distance[i]) {
                return timeTaken
            }
        }
    }

    return "Did not complete"
}