/**
 * This function takes the population of a village and the average temperature of the region
 * during different years, and returns the years when the village had a high population and a
 * high temperature simultaneously.
 */
fun findCommonYear(population: Map<Int, Int>, temperature: Map<Int, Double>): List<Int> {

    val highPopulationYears = mutableListOf<Int>()
    val highTempYears = mutableListOf<Int>()

    // Iterate over each year in the population data
    for ((year, pop) in population) {
        // Check if the population is high in the current year
        if (pop > 10000) {
            // Check if the average temperature is also high in the current year
            if (temperature.containsKey(year) && temperature[year]!! > 30.0) {
                // Append the year to the list of high population years
                highPopulationYears.add(year)
                // Append the year to the list of high temperature years
                highTempYears.add(year)
            }
        }
    }

    // Find the common years in both lists
    val commonYears = mutableListOf<Int>()
    for (year in highPopulationYears) {
        if (highTempYears.contains(year)) {
            commonYears.add(year)
        }
    }

    return commonYears
}
/**
 * This function takes the population of a village and the average temperature of the region
 * during different years, and returns the years when the village had a high population and a
 * high temperature simultaneously.
 */
fun findCommonYear(population: Map<Int, Int>, temperature: Map<Int, Double>): List<Int> {
/**
 * This function takes the population of a village and the average temperature of the region
 * during different years, and returns the years when the village had a high population and a
 * high temperature simultaneously.
 */
fun findCommonYear(population: Map<Int, Int>, temperature: Map<Int, Double>): List<Int> {

    val highPopulationYears = mutableListOf<Int>()
    val highTempYears = mutableListOf<Int>()

    // Iterate over each year in the population data
    for ((year, pop) in population) {
        // Check if the population is high in the current year
        if (pop > 10000) {
            // Check if the average temperature is also high in the current year
            if (temperature.containsKey(year) && temperature[year]!! > 30.0) {
                // Append the year to the list of high population years
                highPopulationYears.add(year)
                // Append the year to the list of high temperature years
                highTempYears.add(year)
            }
        }
    }

    // Find the common years in both lists
    val commonYears = mutableListOf<Int>()
    for (year in highPopulationYears) {
        if (highTempYears.contains(year)) {
            commonYears.add(year)
        }
    }

    return commonYears
}