/**
 * This function simulates a series of firefighting operations conducted by a group of firefighters.
 *
 * @param firefighters A dictionary containing information about the firefighters and the fires they are assigned to.
 * @return Total number of gallons of water used by the firefighters.
 */
fun firefightingOperations(firefighters: Map<String, Map<String, Map<String, Any>>>): Int {

    var totalWaterUsed = 0
    
    // Iterate over each firefighter
    for ((firefighter, attributes) in firefighters) {
        val fires = attributes["fires"] as Map<String, Map<String, Any>>
        
        // Iterate over each fire assigned to the firefighter
        for ((fire, details) in fires) {
            val fireLocation = details["location"] as String
            var waterUsed = 0
            
            // Extinguish the fire using the required amount of water
            when {
                details["intensity"] as Int > 5 -> waterUsed = 2000
                details["intensity"] as Int > 3 -> waterUsed = 1500
                else -> waterUsed = 1000
            }
            
            // Update the total water used by the firefighters
            totalWaterUsed += waterUsed
            
            // Print the firefighting operation details
            println("Firefighter $firefighter extinguished the fire at $fireLocation.")
        }
    }
    
    return totalWaterUsed
}
/**
 * This function simulates a series of firefighting operations conducted by a group of firefighters.
 *
 * @param firefighters A dictionary containing information about the firefighters and the fires they are assigned to.
 * @return Total number of gallons of water used by the firefighters.
 */
fun firefightingOperations(firefighters: Map<String, Map<String, Map<String, Any>>>): Int {
/**
 * This function simulates a series of firefighting operations conducted by a group of firefighters.
 *
 * @param firefighters A dictionary containing information about the firefighters and the fires they are assigned to.
 * @return Total number of gallons of water used by the firefighters.
 */
fun firefightingOperations(firefighters: Map<String, Map<String, Map<String, Any>>>): Int {

    var totalWaterUsed = 0
    
    // Iterate over each firefighter
    for ((firefighter, attributes) in firefighters) {
        val fires = attributes["fires"] as Map<String, Map<String, Any>>
        
        // Iterate over each fire assigned to the firefighter
        for ((fire, details) in fires) {
            val fireLocation = details["location"] as String
            var waterUsed = 0
            
            // Extinguish the fire using the required amount of water
            when {
                details["intensity"] as Int > 5 -> waterUsed = 2000
                details["intensity"] as Int > 3 -> waterUsed = 1500
                else -> waterUsed = 1000
            }
            
            // Update the total water used by the firefighters
            totalWaterUsed += waterUsed
            
            // Print the firefighting operation details
            println("Firefighter $firefighter extinguished the fire at $fireLocation.")
        }
    }
    
    return totalWaterUsed
}