/**
 * Given a list of sizes and corresponding prices, as well as a discount percentage and a maximum size,
 * this function calculates the discounted price for each size that is below or equal to the maximum size.
 *
 * @param sizes A list of sizes.
 * @param prices A list of corresponding prices.
 * @param discount The discount percentage to be applied.
 * @param maxSize The maximum size to consider for the discount.
 * @return A list containing the discounted prices.
 */
fun calculatePrice(sizes: List<Int>, prices: List<Double>, discount: Double, maxSize: Int): List<Double> {

    val discountedPrices = mutableListOf<Double>()

    for ((index, size) in sizes.withIndex()) {
        val price = prices[index]

        if (size <= maxSize) {
            val discountedPrice = price - (price * discount) // Apply discount
            discountedPrices.add(discountedPrice)
        } else {
            discountedPrices.add(price) // No discount for sizes above the maximum size
        }
    }

    return discountedPrices
}

// Exercise:
// A fashion designer wants to calculate the discounted prices for a collection of sizes and prices.
// For sizes below or equal to 5, a discount of 20% should be applied.
/**
 * Given a list of sizes and corresponding prices, as well as a discount percentage and a maximum size,
 * this function calculates the discounted price for each size that is below or equal to the maximum size.
 *
 * @param sizes A list of sizes.
 * @param prices A list of corresponding prices.
 * @param discount The discount percentage to be applied.
 * @param maxSize The maximum size to consider for the discount.
 * @return A list containing the discounted prices.
 */
fun calculatePrice(sizes: List<Int>, prices: List<Double>, discount: Double, maxSize: Int): List<Double> {
/**
 * Given a list of sizes and corresponding prices, as well as a discount percentage and a maximum size,
 * this function calculates the discounted price for each size that is below or equal to the maximum size.
 *
 * @param sizes A list of sizes.
 * @param prices A list of corresponding prices.
 * @param discount The discount percentage to be applied.
 * @param maxSize The maximum size to consider for the discount.
 * @return A list containing the discounted prices.
 */
fun calculatePrice(sizes: List<Int>, prices: List<Double>, discount: Double, maxSize: Int): List<Double> {

    val discountedPrices = mutableListOf<Double>()

    for ((index, size) in sizes.withIndex()) {
        val price = prices[index]

        if (size <= maxSize) {
            val discountedPrice = price - (price * discount) // Apply discount
            discountedPrices.add(discountedPrice)
        } else {
            discountedPrices.add(price) // No discount for sizes above the maximum size
        }
    }

    return discountedPrices
}

// Exercise:
// A fashion designer wants to calculate the discounted prices for a collection of sizes and prices.
// For sizes below or equal to 5, a discount of 20% should be applied.