/**
 * This function takes in a dictionary representing a building's floor plan and calculates the total area of the building.
 * The floor plan is represented by nested lists where each element is a row and each row contains the width of each room.
 *
 * @param building A dictionary representing the building's floor plan.
 * @return The total area of the building.
 */
fun calculateBuildingArea(building: Map<String, List<Any>>): Int {

    var totalArea = 0

    for (floor in building.values) {
        for (room in floor) {
            when (room) {
                is Int -> {
                    // Calculate the area of each room
                    val roomArea = room * room
                    totalArea += roomArea
                }
                is List<*> -> {
                    // Calculate the combined area of multiple rooms in a single row
                    var rowArea = 0
                    for (subRoom in room) {
                        val subRoomArea = (subRoom as Int) * (subRoom as Int)
                        rowArea += subRoomArea
                    }
                    totalArea += rowArea
                }
            }
        }
    }

    return totalArea
}
/**
 * This function takes in a dictionary representing a building's floor plan and calculates the total area of the building.
 * The floor plan is represented by nested lists where each element is a row and each row contains the width of each room.
 *
 * @param building A dictionary representing the building's floor plan.
 * @return The total area of the building.
 */
fun calculateBuildingArea(building: Map<String, List<Any>>): Int {
/**
 * This function takes in a dictionary representing a building's floor plan and calculates the total area of the building.
 * The floor plan is represented by nested lists where each element is a row and each row contains the width of each room.
 *
 * @param building A dictionary representing the building's floor plan.
 * @return The total area of the building.
 */
fun calculateBuildingArea(building: Map<String, List<Any>>): Int {

    var totalArea = 0

    for (floor in building.values) {
        for (room in floor) {
            when (room) {
                is Int -> {
                    // Calculate the area of each room
                    val roomArea = room * room
                    totalArea += roomArea
                }
                is List<*> -> {
                    // Calculate the combined area of multiple rooms in a single row
                    var rowArea = 0
                    for (subRoom in room) {
                        val subRoomArea = (subRoom as Int) * (subRoom as Int)
                        rowArea += subRoomArea
                    }
                    totalArea += rowArea
                }
            }
        }
    }

    return totalArea
}