/**
 * Given a set [s], a list of [indices], and a list of [values], this function modifies the elements in the set
 * at the specified indices with the corresponding values.
 *
 * It returns the modified set.
 *
 * @param s The set of elements to be modified.
 * @param indices A list of indices indicating the positions of elements to be modified.
 * @param values A list of values to replace the elements at the specified indices.
 * @return The modified set.
 *
 * Example:
 * modifyElements(setOf(1, 2, 3, 4, 5), listOf(2, 4), listOf(10, 20)) // Output: setOf(1, 2, 10, 4, 20)
 */
fun modifyElements(s: Set<Int>, indices: List<Int>, values: List<Int>): Set<Int> {

    val modifiedSet = mutableSetOf<Int>()

    for ((index, value) in indices.zip(values)) {
        for ((i, element) in s.withIndex()) {
            if (i == index) {
                modifiedSet.add(value)
            } else {
                modifiedSet.add(element)
            }
        }
    }

    return modifiedSet.toSet()
}
/**
 * Given a set [s], a list of [indices], and a list of [values], this function modifies the elements in the set
 * at the specified indices with the corresponding values.
 *
 * It returns the modified set.
 *
 * @param s The set of elements to be modified.
 * @param indices A list of indices indicating the positions of elements to be modified.
 * @param values A list of values to replace the elements at the specified indices.
 * @return The modified set.
 *
 * Example:
 * modifyElements(setOf(1, 2, 3, 4, 5), listOf(2, 4), listOf(10, 20)) // Output: setOf(1, 2, 10, 4, 20)
 */
fun modifyElements(s: Set<Int>, indices: List<Int>, values: List<Int>): Set<Int> {
/**
 * Given a set [s], a list of [indices], and a list of [values], this function modifies the elements in the set
 * at the specified indices with the corresponding values.
 *
 * It returns the modified set.
 *
 * @param s The set of elements to be modified.
 * @param indices A list of indices indicating the positions of elements to be modified.
 * @param values A list of values to replace the elements at the specified indices.
 * @return The modified set.
 *
 * Example:
 * modifyElements(setOf(1, 2, 3, 4, 5), listOf(2, 4), listOf(10, 20)) // Output: setOf(1, 2, 10, 4, 20)
 */
fun modifyElements(s: Set<Int>, indices: List<Int>, values: List<Int>): Set<Int> {

    val modifiedSet = mutableSetOf<Int>()

    for ((index, value) in indices.zip(values)) {
        for ((i, element) in s.withIndex()) {
            if (i == index) {
                modifiedSet.add(value)
            } else {
                modifiedSet.add(element)
            }
        }
    }

    return modifiedSet.toSet()
}