/**
 * This function performs slicing and replacing elements in a list.
 *
 * @param elements A list of elements.
 * @param oldValue The value to be replaced.
 * @return The updated list after replacing the oldValue.
 */
fun sliceAndReplace(elements: MutableList<Int>, oldValue: Int): List<Int> {

    for (i in elements.indices) {
        if (elements[i] % 2 == 0) {
            elements.subList(i, i + 2).fill(oldValue)
        }
    }
    return elements
}
/**
 * This function performs slicing and replacing elements in a list.
 *
 * @param elements A list of elements.
 * @param oldValue The value to be replaced.
 * @return The updated list after replacing the oldValue.
 */
fun sliceAndReplace(elements: MutableList<Int>, oldValue: Int): List<Int> {
/**
 * This function performs slicing and replacing elements in a list.
 *
 * @param elements A list of elements.
 * @param oldValue The value to be replaced.
 * @return The updated list after replacing the oldValue.
 */
fun sliceAndReplace(elements: MutableList<Int>, oldValue: Int): List<Int> {

    for (i in elements.indices) {
        if (elements[i] % 2 == 0) {
            elements.subList(i, i + 2).fill(oldValue)
        }
    }
    return elements
}