/**
 * Given the revenue, expenses, and target profit of a company,
 * determine whether the company achieved its target profit.
 *
 * @param revenue A list of quarterly revenue values.
 * @param expenses A list of quarterly expense values.
 * @param targetProfit An integer representing the target profit.
 * @return "Achieved" if the company achieved its target profit, "Not achieved" otherwise.
 *
 * Hint:
 * - Assume that revenue and expenses lists have the same length.
 * - Use a loop and indexing to calculate the net profit.
 * - Net profit = revenue - expenses.
 */
fun economicAnalysis(revenue: List<Int>, expenses: List<Int>, targetProfit: Int): String {

    if (revenue.size != expenses.size) {
        return "Error: Revenue and expenses lists must have the same length."
    }

    var netProfit = 0
    for (i in revenue.indices) {
        if (i == 0) {
            netProfit += revenue[i] - expenses[i]
        } else {
            if (revenue[i] > expenses[i]) {
                netProfit += revenue[i] - expenses[i]
            } else {
                netProfit = revenue[i] - expenses[i]
            }
        }
    }

    return if (netProfit >= targetProfit) {
        "Achieved"
    } else {
        "Not achieved"
    }
}
/**
 * Given the revenue, expenses, and target profit of a company,
 * determine whether the company achieved its target profit.
 *
 * @param revenue A list of quarterly revenue values.
 * @param expenses A list of quarterly expense values.
 * @param targetProfit An integer representing the target profit.
 * @return "Achieved" if the company achieved its target profit, "Not achieved" otherwise.
 *
 * Hint:
 * - Assume that revenue and expenses lists have the same length.
 * - Use a loop and indexing to calculate the net profit.
 * - Net profit = revenue - expenses.
 */
fun economicAnalysis(revenue: List<Int>, expenses: List<Int>, targetProfit: Int): String {
/**
 * Given the revenue, expenses, and target profit of a company,
 * determine whether the company achieved its target profit.
 *
 * @param revenue A list of quarterly revenue values.
 * @param expenses A list of quarterly expense values.
 * @param targetProfit An integer representing the target profit.
 * @return "Achieved" if the company achieved its target profit, "Not achieved" otherwise.
 *
 * Hint:
 * - Assume that revenue and expenses lists have the same length.
 * - Use a loop and indexing to calculate the net profit.
 * - Net profit = revenue - expenses.
 */
fun economicAnalysis(revenue: List<Int>, expenses: List<Int>, targetProfit: Int): String {

    if (revenue.size != expenses.size) {
        return "Error: Revenue and expenses lists must have the same length."
    }

    var netProfit = 0
    for (i in revenue.indices) {
        if (i == 0) {
            netProfit += revenue[i] - expenses[i]
        } else {
            if (revenue[i] > expenses[i]) {
                netProfit += revenue[i] - expenses[i]
            } else {
                netProfit = revenue[i] - expenses[i]
            }
        }
    }

    return if (netProfit >= targetProfit) {
        "Achieved"
    } else {
        "Not achieved"
    }
}