/**
 * Given a map 'items" containing the names of different items 
 * and their respective costs, calculate the remaining budget after making 
 * a division assignment operation on the most expensive item. Finally, 
 * return a Pair containing the new budget and the name of the item.
 *
 * @param items A map containing the names of items as keys and 
 *              their respective costs as values.
 * @return A Pair containing the updated budget (after division assignment) 
 *         and the name of the most expensive item.
 *
 * Example:
 * val items = mapOf("Paint" to 50, "Furniture" to 300, "Curtains" to 60)
 * calculateBudget(items) // Output: Pair(12, "Furniture")
 */
fun calculateBudget(items: Map<String, Int>): Pair<Int, String> {

    var budget = items.values.sum()
    val maxCost = items.values.maxOrNull() ?: 0
    var mostExpensiveItem = ""

    for (item in items) {
        if (item.value == maxCost) {
            mostExpensiveItem = item.key
            break
        }
    }

    budget /= maxCost

    return Pair(budget.toInt(), mostExpensiveItem)
}
/**
 * Given a map 'items" containing the names of different items 
 * and their respective costs, calculate the remaining budget after making 
 * a division assignment operation on the most expensive item. Finally, 
 * return a Pair containing the new budget and the name of the item.
 *
 * @param items A map containing the names of items as keys and 
 *              their respective costs as values.
 * @return A Pair containing the updated budget (after division assignment) 
 *         and the name of the most expensive item.
 *
 * Example:
 * val items = mapOf("Paint" to 50, "Furniture" to 300, "Curtains" to 60)
 * calculateBudget(items) // Output: Pair(12, "Furniture")
 */
fun calculateBudget(items: Map<String, Int>): Pair<Int, String> {
/**
 * Given a map 'items" containing the names of different items 
 * and their respective costs, calculate the remaining budget after making 
 * a division assignment operation on the most expensive item. Finally, 
 * return a Pair containing the new budget and the name of the item.
 *
 * @param items A map containing the names of items as keys and 
 *              their respective costs as values.
 * @return A Pair containing the updated budget (after division assignment) 
 *         and the name of the most expensive item.
 *
 * Example:
 * val items = mapOf("Paint" to 50, "Furniture" to 300, "Curtains" to 60)
 * calculateBudget(items) // Output: Pair(12, "Furniture")
 */
fun calculateBudget(items: Map<String, Int>): Pair<Int, String> {

    var budget = items.values.sum()
    val maxCost = items.values.maxOrNull() ?: 0
    var mostExpensiveItem = ""

    for (item in items) {
        if (item.value == maxCost) {
            mostExpensiveItem = item.key
            break
        }
    }

    budget /= maxCost

    return Pair(budget.toInt(), mostExpensiveItem)
}