/**
 * Given a list of years and corresponding GDP values, calculate the average annual GDP growth rate.
 *
 * @param years A list of integers representing the years.
 * @param gdpValues A list of floats representing the GDP values.
 * @return The average annual GDP growth rate.
 */
fun calculateGdp(years: List<Int>, gdpValues: List<Float>): String {

    val growthRates = mutableListOf<Float>()

    for (i in 0 until gdpValues.size - 1) {
        val growthRate = (gdpValues[i + 1] - gdpValues[i]) / gdpValues[i] * 100
        growthRates.add(growthRate)
    }

    val averageGrowthRate = growthRates.sum() / growthRates.size

    val trend = when {
        averageGrowthRate > 0 -> "positive"
        averageGrowthRate < 0 -> "negative"
        else -> "stable"
    }

    return trend
}
/**
 * Given a list of years and corresponding GDP values, calculate the average annual GDP growth rate.
 *
 * @param years A list of integers representing the years.
 * @param gdpValues A list of floats representing the GDP values.
 * @return The average annual GDP growth rate.
 */
fun calculateGdp(years: List<Int>, gdpValues: List<Float>): String {
/**
 * Given a list of years and corresponding GDP values, calculate the average annual GDP growth rate.
 *
 * @param years A list of integers representing the years.
 * @param gdpValues A list of floats representing the GDP values.
 * @return The average annual GDP growth rate.
 */
fun calculateGdp(years: List<Int>, gdpValues: List<Float>): String {

    val growthRates = mutableListOf<Float>()

    for (i in 0 until gdpValues.size - 1) {
        val growthRate = (gdpValues[i + 1] - gdpValues[i]) / gdpValues[i] * 100
        growthRates.add(growthRate)
    }

    val averageGrowthRate = growthRates.sum() / growthRates.size

    val trend = when {
        averageGrowthRate > 0 -> "positive"
        averageGrowthRate < 0 -> "negative"
        else -> "stable"
    }

    return trend
}