/**
 * Given a list of artists, calculate the average sales made by each artist and return the result.
 *
 * @param artists List of artists, where each artist is represented as a Pair containing their name,
 * followed by a list of their sales for each month.
 * @return The average sales made by each artist.
 *
 * Example:
 * calculateAverageSales(listOf(Pair("Artist A", listOf(100, 200, 300)), Pair("Artist B", listOf(400, 500, 600, 700)), Pair("Artist C", listOf(800, 900))))
 * Output: 416.6666666666667
 */
fun calculateAverageSales(artists: List<Pair<String, List<Int>>>): Double {

    var totalSales = 0
    var totalMonths = 0

    for (artist in artists) {
        val (_, sales) = artist
        totalSales += sales.sum()
        totalMonths += sales.size
    }

    return totalSales.toDouble() / totalMonths
}
/**
 * Given a list of artists, calculate the average sales made by each artist and return the result.
 *
 * @param artists List of artists, where each artist is represented as a Pair containing their name,
 * followed by a list of their sales for each month.
 * @return The average sales made by each artist.
 *
 * Example:
 * calculateAverageSales(listOf(Pair("Artist A", listOf(100, 200, 300)), Pair("Artist B", listOf(400, 500, 600, 700)), Pair("Artist C", listOf(800, 900))))
 * Output: 416.6666666666667
 */
fun calculateAverageSales(artists: List<Pair<String, List<Int>>>): Double {
/**
 * Given a list of artists, calculate the average sales made by each artist and return the result.
 *
 * @param artists List of artists, where each artist is represented as a Pair containing their name,
 * followed by a list of their sales for each month.
 * @return The average sales made by each artist.
 *
 * Example:
 * calculateAverageSales(listOf(Pair("Artist A", listOf(100, 200, 300)), Pair("Artist B", listOf(400, 500, 600, 700)), Pair("Artist C", listOf(800, 900))))
 * Output: 416.6666666666667
 */
fun calculateAverageSales(artists: List<Pair<String, List<Int>>>): Double {

    var totalSales = 0
    var totalMonths = 0

    for (artist in artists) {
        val (_, sales) = artist
        totalSales += sales.sum()
        totalMonths += sales.size
    }

    return totalSales.toDouble() / totalMonths
}