/**
 * Given a list of team names and a dictionary of scores, calculate the average score for each team.
 * If a team's average score is below 50, skip the iteration and move to the next team using the break statement.
 * Return a dictionary with team names as keys and their average scores as values.
 *
 * @param teams A list of team names.
 * @param scores A dictionary where the keys are team names and the values are lists of scores.
 * @return A dictionary containing team names as keys and their average scores as values.
 */
fun calculateTeamAverageScores(teams: List<String>, scores: Map<String, List<Int>>): Map<String, Double> {

    val teamAverageScores = mutableMapOf<String, Double>()

    for (team in teams) {
        val teamScores = scores.getOrDefault(team, emptyList())

        if (teamScores.isEmpty()) {
            teamAverageScores[team] = 0.0
            continue
        }

        var sumScores = 0

        for (score in teamScores) {
            sumScores += score

            if (sumScores >= 200) {  // Only consider the first 4 scores
                break
            }
        }

        teamAverageScores[team] = sumScores.toDouble() / teamScores.size
    }

    return teamAverageScores
}
/**
 * Given a list of team names and a dictionary of scores, calculate the average score for each team.
 * If a team's average score is below 50, skip the iteration and move to the next team using the break statement.
 * Return a dictionary with team names as keys and their average scores as values.
 *
 * @param teams A list of team names.
 * @param scores A dictionary where the keys are team names and the values are lists of scores.
 * @return A dictionary containing team names as keys and their average scores as values.
 */
fun calculateTeamAverageScores(teams: List<String>, scores: Map<String, List<Int>>): Map<String, Double> {
/**
 * Given a list of team names and a dictionary of scores, calculate the average score for each team.
 * If a team's average score is below 50, skip the iteration and move to the next team using the break statement.
 * Return a dictionary with team names as keys and their average scores as values.
 *
 * @param teams A list of team names.
 * @param scores A dictionary where the keys are team names and the values are lists of scores.
 * @return A dictionary containing team names as keys and their average scores as values.
 */
fun calculateTeamAverageScores(teams: List<String>, scores: Map<String, List<Int>>): Map<String, Double> {

    val teamAverageScores = mutableMapOf<String, Double>()

    for (team in teams) {
        val teamScores = scores.getOrDefault(team, emptyList())

        if (teamScores.isEmpty()) {
            teamAverageScores[team] = 0.0
            continue
        }

        var sumScores = 0

        for (score in teamScores) {
            sumScores += score

            if (sumScores >= 200) {  // Only consider the first 4 scores
                break
            }
        }

        teamAverageScores[team] = sumScores.toDouble() / teamScores.size
    }

    return teamAverageScores
}