/**
 * Given a dictionary of athlete scores and a list of athlete results, modify the scores of athletes based on the given threshold value.
 *
 * @param athleteScores A dictionary where keys are athlete names (String) and values are their scores (Int).
 * @param athleteResults A list of athlete names (String) who have achieved new results.
 * @param threshold The threshold value to compare against the scores.
 * @return The modified athlete scores dictionary.
 */
fun modifyAthleteScores(athleteScores: MutableMap<String, Int>, athleteResults: List<String>, threshold: Int): MutableMap<String, Int> {

    for (athlete in athleteResults) {
        if (athleteScores.containsKey(athlete)) {
            if (athleteScores[athlete]!! > threshold) {
                athleteScores[athlete] = athleteScores[athlete]!! + 10
            } else {
                athleteScores[athlete] = athleteScores[athlete]!! - 5
            }
        } else {
            athleteScores[athlete] = 0
        }
    }
    return athleteScores
}

// Complete the code to solve the exercise

val athleteScores = mutableMapOf("John" to 80, "Emma" to 90, "Ryan" to 75, "Sophia" to 85)
val athleteResults = listOf("John", "Emma", "Michael")
val threshold = 80

val modifiedScores = modifyAthleteScores(athleteScores, athleteResults, threshold)
/**
 * Given a dictionary of athlete scores and a list of athlete results, modify the scores of athletes based on the given threshold value.
 *
 * @param athleteScores A dictionary where keys are athlete names (String) and values are their scores (Int).
 * @param athleteResults A list of athlete names (String) who have achieved new results.
 * @param threshold The threshold value to compare against the scores.
 * @return The modified athlete scores dictionary.
 */
fun modifyAthleteScores(athleteScores: MutableMap<String, Int>, athleteResults: List<String>, threshold: Int): MutableMap<String, Int> {
/**
 * Given a dictionary of athlete scores and a list of athlete results, modify the scores of athletes based on the given threshold value.
 *
 * @param athleteScores A dictionary where keys are athlete names (String) and values are their scores (Int).
 * @param athleteResults A list of athlete names (String) who have achieved new results.
 * @param threshold The threshold value to compare against the scores.
 * @return The modified athlete scores dictionary.
 */
fun modifyAthleteScores(athleteScores: MutableMap<String, Int>, athleteResults: List<String>, threshold: Int): MutableMap<String, Int> {

    for (athlete in athleteResults) {
        if (athleteScores.containsKey(athlete)) {
            if (athleteScores[athlete]!! > threshold) {
                athleteScores[athlete] = athleteScores[athlete]!! + 10
            } else {
                athleteScores[athlete] = athleteScores[athlete]!! - 5
            }
        } else {
            athleteScores[athlete] = 0
        }
    }
    return athleteScores
}

// Complete the code to solve the exercise

val athleteScores = mutableMapOf("John" to 80, "Emma" to 90, "Ryan" to 75, "Sophia" to 85)
val athleteResults = listOf("John", "Emma", "Michael")
val threshold = 80

val modifiedScores = modifyAthleteScores(athleteScores, athleteResults, threshold)