/**
 * This function calculates the total dose of medication that needs to be administered to each patient
 * based on their condition. It checks for any short-circuiting conditions with if-else statements 
 * and uses looping statements to iterate over the patient list.
 */
fun computeTotalDose(patientList: List<Map<String, Any>>, dosageDict: Map<String, Int>, maxDose: Int): Int {

    var totalDose = 0
    
    for (patient in patientList) {
        val condition = patient["condition"] as String
        var dosage = dosageDict.getOrDefault(condition, 0)
        
        if (condition.isEmpty()) {
            dosage *= 2
        }
        
        if (dosage <= maxDose || condition.isNotEmpty()) {
            totalDose += dosage
        } else {
            println("Maximum dosage exceeded for patient: ${patient["name"]}")
        }
    }
    
    return totalDose
}
/**
 * This function calculates the total dose of medication that needs to be administered to each patient
 * based on their condition. It checks for any short-circuiting conditions with if-else statements 
 * and uses looping statements to iterate over the patient list.
 */
fun computeTotalDose(patientList: List<Map<String, Any>>, dosageDict: Map<String, Int>, maxDose: Int): Int {
/**
 * This function calculates the total dose of medication that needs to be administered to each patient
 * based on their condition. It checks for any short-circuiting conditions with if-else statements 
 * and uses looping statements to iterate over the patient list.
 */
fun computeTotalDose(patientList: List<Map<String, Any>>, dosageDict: Map<String, Int>, maxDose: Int): Int {

    var totalDose = 0
    
    for (patient in patientList) {
        val condition = patient["condition"] as String
        var dosage = dosageDict.getOrDefault(condition, 0)
        
        if (condition.isEmpty()) {
            dosage *= 2
        }
        
        if (dosage <= maxDose || condition.isNotEmpty()) {
            totalDose += dosage
        } else {
            println("Maximum dosage exceeded for patient: ${patient["name"]}")
        }
    }
    
    return totalDose
}