/**
 * Calculate performance statistics of an athlete based on their race time and age.
 */
fun calculatePerformanceStats(raceTime: Int, age: Int): String {

    if (raceTime < 10 || raceTime > 30) {
        return "Invalid race time"
    }

    if (age < 18 || age > 40) {
        return "Invalid age"
    }

    return when {
        raceTime > 10 && raceTime <= 15 -> {
            when {
                age >= 18 && age <= 25 -> "Excellent performance"
                age > 25 && age <= 30 -> "Good performance"
                age > 30 && age <= 40 -> "Average performance"
                else -> "Invalid age"
            }
        }
        raceTime > 15 && raceTime <= 20 -> {
            when {
                age >= 18 && age <= 25 -> "Good performance"
                age > 25 && age <= 30 -> "Average performance"
                age > 30 && age <= 40 -> "Below average performance"
                else -> "Invalid age"
            }
        }
        raceTime > 20 && raceTime <= 25 -> {
            when {
                age >= 18 && age <= 25 -> "Average performance"
                else -> "Invalid age"
            }
        }
        else -> "Invalid performance"
    }
}
/**
 * Calculate performance statistics of an athlete based on their race time and age.
 */
fun calculatePerformanceStats(raceTime: Int, age: Int): String {
/**
 * Calculate performance statistics of an athlete based on their race time and age.
 */
fun calculatePerformanceStats(raceTime: Int, age: Int): String {

    if (raceTime < 10 || raceTime > 30) {
        return "Invalid race time"
    }

    if (age < 18 || age > 40) {
        return "Invalid age"
    }

    return when {
        raceTime > 10 && raceTime <= 15 -> {
            when {
                age >= 18 && age <= 25 -> "Excellent performance"
                age > 25 && age <= 30 -> "Good performance"
                age > 30 && age <= 40 -> "Average performance"
                else -> "Invalid age"
            }
        }
        raceTime > 15 && raceTime <= 20 -> {
            when {
                age >= 18 && age <= 25 -> "Good performance"
                age > 25 && age <= 30 -> "Average performance"
                age > 30 && age <= 40 -> "Below average performance"
                else -> "Invalid age"
            }
        }
        raceTime > 20 && raceTime <= 25 -> {
            when {
                age >= 18 && age <= 25 -> "Average performance"
                else -> "Invalid age"
            }
        }
        else -> "Invalid performance"
    }
}