/**
 * Given a list of athletes and an age range, find the common elements (age) between
 * the athletes' ages and the given range.
 *
 * @param athletes A list of maps representing athletes. Each map contains
 * the athlete's name (String) and age (Int).
 * @param ageRange A Pair representing the age range. It should consist of two integers,
 * where the first number represents the inclusive lower bound and the second number
 * represents the exclusive upper bound.
 *
 * @return A list containing the ages of athletes that fall within the given age range.
 */
fun findCommonElements(athletes: List<Map<String, Any>>, ageRange: Pair<Int, Int>): List<Int> {

    val commonAges = mutableListOf<Int>()
    for (athlete in athletes) {
        if (athlete["age"] as Int in (ageRange.first until ageRange.second)) {
            commonAges.add(athlete["age"] as Int)
        }
    }
    return commonAges
}
/**
 * Given a list of athletes and an age range, find the common elements (age) between
 * the athletes' ages and the given range.
 *
 * @param athletes A list of maps representing athletes. Each map contains
 * the athlete's name (String) and age (Int).
 * @param ageRange A Pair representing the age range. It should consist of two integers,
 * where the first number represents the inclusive lower bound and the second number
 * represents the exclusive upper bound.
 *
 * @return A list containing the ages of athletes that fall within the given age range.
 */
fun findCommonElements(athletes: List<Map<String, Any>>, ageRange: Pair<Int, Int>): List<Int> {
/**
 * Given a list of athletes and an age range, find the common elements (age) between
 * the athletes' ages and the given range.
 *
 * @param athletes A list of maps representing athletes. Each map contains
 * the athlete's name (String) and age (Int).
 * @param ageRange A Pair representing the age range. It should consist of two integers,
 * where the first number represents the inclusive lower bound and the second number
 * represents the exclusive upper bound.
 *
 * @return A list containing the ages of athletes that fall within the given age range.
 */
fun findCommonElements(athletes: List<Map<String, Any>>, ageRange: Pair<Int, Int>): List<Int> {

    val commonAges = mutableListOf<Int>()
    for (athlete in athletes) {
        if (athlete["age"] as Int in (ageRange.first until ageRange.second)) {
            commonAges.add(athlete["age"] as Int)
        }
    }
    return commonAges
}