/**
 * Given a list of tribes, this function calculates the total population of all tribes that satisfy the following conditions:
 * - The tribe has more than 100 members
 * - The tribe is located in a mountainous region
 *
 * @param tribes A list of dictionaries representing tribes. Each dictionary contains the following keys:
 *               - 'name': (string) The name of the tribe.
 *               - 'members': (int) The number of members in the tribe.
 *               - 'location': (string) The location of the tribe.
 * @return The total population of tribes that satisfy the conditions.
 */
fun calculateTribalPopulation(tribes: List<Map<String, Any>>): Int {

    var totalPopulation = 0

    // Iterate over each tribe in the list
    for (tribe in tribes) {
        if (tribe["members"] as Int > 100 && tribe["location"] == "mountainous") {
            totalPopulation += tribe["members"] as Int
        }
    }

    return totalPopulation
}
/**
 * Given a list of tribes, this function calculates the total population of all tribes that satisfy the following conditions:
 * - The tribe has more than 100 members
 * - The tribe is located in a mountainous region
 *
 * @param tribes A list of dictionaries representing tribes. Each dictionary contains the following keys:
 *               - 'name': (string) The name of the tribe.
 *               - 'members': (int) The number of members in the tribe.
 *               - 'location': (string) The location of the tribe.
 * @return The total population of tribes that satisfy the conditions.
 */
fun calculateTribalPopulation(tribes: List<Map<String, Any>>): Int {
/**
 * Given a list of tribes, this function calculates the total population of all tribes that satisfy the following conditions:
 * - The tribe has more than 100 members
 * - The tribe is located in a mountainous region
 *
 * @param tribes A list of dictionaries representing tribes. Each dictionary contains the following keys:
 *               - 'name': (string) The name of the tribe.
 *               - 'members': (int) The number of members in the tribe.
 *               - 'location': (string) The location of the tribe.
 * @return The total population of tribes that satisfy the conditions.
 */
fun calculateTribalPopulation(tribes: List<Map<String, Any>>): Int {

    var totalPopulation = 0

    // Iterate over each tribe in the list
    for (tribe in tribes) {
        if (tribe["members"] as Int > 100 && tribe["location"] == "mountainous") {
            totalPopulation += tribe["members"] as Int
        }
    }

    return totalPopulation
}