/**
 * Given a dictionary of employees and their salaries, calculate the average salary of all employees.
 *
 * @param data A nested dictionary where the keys represent employees and the values are dictionaries with
 * 'salary' as a key and the corresponding salary as the value.
 * @return The average salary of all employees.
 */
fun calculateAvgSalary(data: Map<String, Map<String, Int>>): Double {

    var totalSalaries = 0
    var numEmployees = 0

    for ((_, employeeData) in data) {
        // Accessing the salary value for the current employee
        val salary = employeeData["salary"] ?: 0

        // Updating the total salaries
        totalSalaries += salary

        // Counting the number of employees
        numEmployees++
    }

    // Calculating the average salary
    val avgSalary = totalSalaries.toDouble() / numEmployees
    return avgSalary
}
/**
 * Given a dictionary of employees and their salaries, calculate the average salary of all employees.
 *
 * @param data A nested dictionary where the keys represent employees and the values are dictionaries with
 * 'salary' as a key and the corresponding salary as the value.
 * @return The average salary of all employees.
 */
fun calculateAvgSalary(data: Map<String, Map<String, Int>>): Double {
/**
 * Given a dictionary of employees and their salaries, calculate the average salary of all employees.
 *
 * @param data A nested dictionary where the keys represent employees and the values are dictionaries with
 * 'salary' as a key and the corresponding salary as the value.
 * @return The average salary of all employees.
 */
fun calculateAvgSalary(data: Map<String, Map<String, Int>>): Double {

    var totalSalaries = 0
    var numEmployees = 0

    for ((_, employeeData) in data) {
        // Accessing the salary value for the current employee
        val salary = employeeData["salary"] ?: 0

        // Updating the total salaries
        totalSalaries += salary

        // Counting the number of employees
        numEmployees++
    }

    // Calculating the average salary
    val avgSalary = totalSalaries.toDouble() / numEmployees
    return avgSalary
}