/**
 * Given a dictionary and an index, modify the value of each item in the dictionary by subtracting the index.
 *
 * @param dictionary A dictionary containing integer keys and corresponding values
 * @param index The integer value to be subtracted from each item value in the dictionary
 * @return The modified dictionary with updated values
 *
 * Example:
 * modifyDictItems(mapOf("A" to 5, "B" to -3, "C" to 10), 2) -> mapOf("A" to 3, "B" to -5, "C" to 8)
 * modifyDictItems(mapOf("X" to 100, "Y" to -50, "Z" to 0), -5) -> mapOf("X" to 105, "Y" to -45, "Z" to 5)
 */
fun modifyDictItems(dictionary: Map<String, Int>, index: Int): Map<String, Int> {

    val modifiedDict = mutableMapOf<String, Int>()
    val adjustedIndex = if (index < 0) -index else index

    for ((key, value) in dictionary) {
        if (value is Int) {
            modifiedDict[key] = value - adjustedIndex
        }
    }

    return modifiedDict
}
/**
 * Given a dictionary and an index, modify the value of each item in the dictionary by subtracting the index.
 *
 * @param dictionary A dictionary containing integer keys and corresponding values
 * @param index The integer value to be subtracted from each item value in the dictionary
 * @return The modified dictionary with updated values
 *
 * Example:
 * modifyDictItems(mapOf("A" to 5, "B" to -3, "C" to 10), 2) -> mapOf("A" to 3, "B" to -5, "C" to 8)
 * modifyDictItems(mapOf("X" to 100, "Y" to -50, "Z" to 0), -5) -> mapOf("X" to 105, "Y" to -45, "Z" to 5)
 */
fun modifyDictItems(dictionary: Map<String, Int>, index: Int): Map<String, Int> {
/**
 * Given a dictionary and an index, modify the value of each item in the dictionary by subtracting the index.
 *
 * @param dictionary A dictionary containing integer keys and corresponding values
 * @param index The integer value to be subtracted from each item value in the dictionary
 * @return The modified dictionary with updated values
 *
 * Example:
 * modifyDictItems(mapOf("A" to 5, "B" to -3, "C" to 10), 2) -> mapOf("A" to 3, "B" to -5, "C" to 8)
 * modifyDictItems(mapOf("X" to 100, "Y" to -50, "Z" to 0), -5) -> mapOf("X" to 105, "Y" to -45, "Z" to 5)
 */
fun modifyDictItems(dictionary: Map<String, Int>, index: Int): Map<String, Int> {

    val modifiedDict = mutableMapOf<String, Int>()
    val adjustedIndex = if (index < 0) -index else index

    for ((key, value) in dictionary) {
        if (value is Int) {
            modifiedDict[key] = value - adjustedIndex
        }
    }

    return modifiedDict
}