/**
 * This function takes a recipe and two lists of ingredients to remove and update.
 * It removes the ingredients specified in the list 'removeIngredients" from the recipe,
 * and updates the values of the ingredients with new values specified in the 'updateIngredients" list.
 *
 * @param recipe A map representing the recipe where keys are ingredient names and values are their quantities.
 * @param removeIngredients A list of ingredients to remove from the recipe.
 * @param updateIngredients A list of pairs containing the ingredient name and its new quantity to update in the recipe.
 * @return The updated recipe map after removing and updating ingredients.
 */
fun replaceIngredients(recipe: MutableMap<String, Int>, removeIngredients: List<String>, updateIngredients: List<Pair<String, Int>>): MutableMap<String, Int> {

    // Remove ingredients from the recipe
    removeIngredients.forEach { ingredient -> recipe.remove(ingredient) }

    // Update ingredients in the recipe
    updateIngredients.forEach { (ingredient, quantity) ->
        if (!recipe.containsKey(ingredient)) {
            throw IllegalArgumentException("'$ingredient' is not present in the recipe.")
        }
        recipe[ingredient] = quantity
    }

    return recipe
}
/**
 * This function takes a recipe and two lists of ingredients to remove and update.
 * It removes the ingredients specified in the list 'removeIngredients" from the recipe,
 * and updates the values of the ingredients with new values specified in the 'updateIngredients" list.
 *
 * @param recipe A map representing the recipe where keys are ingredient names and values are their quantities.
 * @param removeIngredients A list of ingredients to remove from the recipe.
 * @param updateIngredients A list of pairs containing the ingredient name and its new quantity to update in the recipe.
 * @return The updated recipe map after removing and updating ingredients.
 */
fun replaceIngredients(recipe: MutableMap<String, Int>, removeIngredients: List<String>, updateIngredients: List<Pair<String, Int>>): MutableMap<String, Int> {
/**
 * This function takes a recipe and two lists of ingredients to remove and update.
 * It removes the ingredients specified in the list 'removeIngredients" from the recipe,
 * and updates the values of the ingredients with new values specified in the 'updateIngredients" list.
 *
 * @param recipe A map representing the recipe where keys are ingredient names and values are their quantities.
 * @param removeIngredients A list of ingredients to remove from the recipe.
 * @param updateIngredients A list of pairs containing the ingredient name and its new quantity to update in the recipe.
 * @return The updated recipe map after removing and updating ingredients.
 */
fun replaceIngredients(recipe: MutableMap<String, Int>, removeIngredients: List<String>, updateIngredients: List<Pair<String, Int>>): MutableMap<String, Int> {

    // Remove ingredients from the recipe
    removeIngredients.forEach { ingredient -> recipe.remove(ingredient) }

    // Update ingredients in the recipe
    updateIngredients.forEach { (ingredient, quantity) ->
        if (!recipe.containsKey(ingredient)) {
            throw IllegalArgumentException("'$ingredient' is not present in the recipe.")
        }
        recipe[ingredient] = quantity
    }

    return recipe
}