/**
 * This function takes a list of exercises as input and calculates the total duration of the exercises
 * performed by a physical therapist.
 *
 * @param exercises A list of exercises where each exercise is a sublist consisting of the exercise name
 *                  (string) and the duration in minutes (integer).
 * @return The total duration of all exercises in minutes.
 */
fun calculateDuration(exercises: List<Pair<String, Int>>): Int {

    var totalDuration = 0

    // Iterate over each exercise sublist
    for (exercise in exercises) {
        val exerciseName = exercise.first
        var exerciseDuration = exercise.second

        // Skip the current exercise if the exercise duration is less than 5 minutes
        if (exerciseDuration < 5) {
            continue
        }

        // Multiply the duration of the exercise by 2 if the exercise name contains the word "stretch"
        if ("stretch" in exerciseName.toLowerCase()) {
            exerciseDuration *= 2
        }

        // Check if the exercise duration is greater than or equal to 30 minutes
        if (exerciseDuration >= 30) {
            break
        }

        // Add the exercise duration to the total duration
        totalDuration += exerciseDuration
    }

    return totalDuration
}
/**
 * This function takes a list of exercises as input and calculates the total duration of the exercises
 * performed by a physical therapist.
 *
 * @param exercises A list of exercises where each exercise is a sublist consisting of the exercise name
 *                  (string) and the duration in minutes (integer).
 * @return The total duration of all exercises in minutes.
 */
fun calculateDuration(exercises: List<Pair<String, Int>>): Int {
/**
 * This function takes a list of exercises as input and calculates the total duration of the exercises
 * performed by a physical therapist.
 *
 * @param exercises A list of exercises where each exercise is a sublist consisting of the exercise name
 *                  (string) and the duration in minutes (integer).
 * @return The total duration of all exercises in minutes.
 */
fun calculateDuration(exercises: List<Pair<String, Int>>): Int {

    var totalDuration = 0

    // Iterate over each exercise sublist
    for (exercise in exercises) {
        val exerciseName = exercise.first
        var exerciseDuration = exercise.second

        // Skip the current exercise if the exercise duration is less than 5 minutes
        if (exerciseDuration < 5) {
            continue
        }

        // Multiply the duration of the exercise by 2 if the exercise name contains the word "stretch"
        if ("stretch" in exerciseName.toLowerCase()) {
            exerciseDuration *= 2
        }

        // Check if the exercise duration is greater than or equal to 30 minutes
        if (exerciseDuration >= 30) {
            break
        }

        // Add the exercise duration to the total duration
        totalDuration += exerciseDuration
    }

    return totalDuration
}