/**
 * Given a nested dictionary 'accounts' containing financial information,
 * remove all the accounts that have a negative balance and return the updated dictionary.
 *
 * @param accounts A dictionary representing the accounts and their balances.
 * @return The updated 'accounts' dictionary with all negative balance accounts removed.
 */
fun deleteAndFilterData(accounts: MutableMap<String, MutableMap<String, Int>>): MutableMap<String, MutableMap<String, Int>> {

    // Iterate over the keys of the 'accounts' dictionary
    for (category in accounts.keys) {
        // Iterate over the keys of the nested dictionaries (each account within a category)
        val accountsInCategory = accounts[category]
        if (accountsInCategory != null) {
            val accountsToRemove = accountsInCategory.filter { it.value < 0 }.keys
            accountsToRemove.forEach { account -> accountsInCategory.remove(account) }
        }
    }
    return accounts
}
/**
 * Given a nested dictionary 'accounts' containing financial information,
 * remove all the accounts that have a negative balance and return the updated dictionary.
 *
 * @param accounts A dictionary representing the accounts and their balances.
 * @return The updated 'accounts' dictionary with all negative balance accounts removed.
 */
fun deleteAndFilterData(accounts: MutableMap<String, MutableMap<String, Int>>): MutableMap<String, MutableMap<String, Int>> {
/**
 * Given a nested dictionary 'accounts' containing financial information,
 * remove all the accounts that have a negative balance and return the updated dictionary.
 *
 * @param accounts A dictionary representing the accounts and their balances.
 * @return The updated 'accounts' dictionary with all negative balance accounts removed.
 */
fun deleteAndFilterData(accounts: MutableMap<String, MutableMap<String, Int>>): MutableMap<String, MutableMap<String, Int>> {

    // Iterate over the keys of the 'accounts' dictionary
    for (category in accounts.keys) {
        // Iterate over the keys of the nested dictionaries (each account within a category)
        val accountsInCategory = accounts[category]
        if (accountsInCategory != null) {
            val accountsToRemove = accountsInCategory.filter { it.value < 0 }.keys
            accountsToRemove.forEach { account -> accountsInCategory.remove(account) }
        }
    }
    return accounts
}