/**
 * Chef is preparing a gourmet meal using a list of ingredients. Each ingredient has a specific quantity.
 * The chef needs to determine if all the necessary ingredients are available and in the correct quantity.
 * Use nested ternary operators and list element access to solve this problem.
 *
 * @param ingredients A list of pairs where each pair contains the ingredient name and its required quantity.
 * @return True if all ingredients are available in sufficient quantity, False otherwise.
 */
fun prepareGourmetMeal(ingredients: List<Pair<String, Int>>): Boolean {

    // Check if all necessary ingredients are available and in sufficient quantity
    return ingredients.mapIndexed { index, ingredient ->
        val quantity = if (ingredient.first.isNotEmpty() && ingredient.second > 0) ingredient.second else 0
        quantity <= ingredients.getOrNull(index)?.second ?: 0
    }.all { it }
}
/**
 * Chef is preparing a gourmet meal using a list of ingredients. Each ingredient has a specific quantity.
 * The chef needs to determine if all the necessary ingredients are available and in the correct quantity.
 * Use nested ternary operators and list element access to solve this problem.
 *
 * @param ingredients A list of pairs where each pair contains the ingredient name and its required quantity.
 * @return True if all ingredients are available in sufficient quantity, False otherwise.
 */
fun prepareGourmetMeal(ingredients: List<Pair<String, Int>>): Boolean {
/**
 * Chef is preparing a gourmet meal using a list of ingredients. Each ingredient has a specific quantity.
 * The chef needs to determine if all the necessary ingredients are available and in the correct quantity.
 * Use nested ternary operators and list element access to solve this problem.
 *
 * @param ingredients A list of pairs where each pair contains the ingredient name and its required quantity.
 * @return True if all ingredients are available in sufficient quantity, False otherwise.
 */
fun prepareGourmetMeal(ingredients: List<Pair<String, Int>>): Boolean {

    // Check if all necessary ingredients are available and in sufficient quantity
    return ingredients.mapIndexed { index, ingredient ->
        val quantity = if (ingredient.first.isNotEmpty() && ingredient.second > 0) ingredient.second else 0
        quantity <= ingredients.getOrNull(index)?.second ?: 0
    }.all { it }
}