/**
 * Given a list of integers 'elements', an index 'index', and a new value 'newValue', modify the element at the specified index
 * in the list to have the new value.
 *
 * Example:
 * modifyElements(listOf(1, 2, 3, 4, 5), 2, 10)
 * Output: [1, 2, 10, 4, 5]
 *
 * @param elements A list of integers.
 * @param index An integer representing the index to be modified.
 * @param newValue An integer representing the new value to be assigned.
 */
fun modifyElements(elements: MutableList<Int>, index: Int, newValue: Int) {

    if (elements.isEmpty()) {
        println("Invalid input: 'elements' list is empty.")
        return
    }

    if (index < 0 || index >= elements.size) {
        println("Invalid input: 'index' is out of range.")
        return
    }

    elements[index] = newValue
}
/**
 * Given a list of integers 'elements', an index 'index', and a new value 'newValue', modify the element at the specified index
 * in the list to have the new value.
 *
 * Example:
 * modifyElements(listOf(1, 2, 3, 4, 5), 2, 10)
 * Output: [1, 2, 10, 4, 5]
 *
 * @param elements A list of integers.
 * @param index An integer representing the index to be modified.
 * @param newValue An integer representing the new value to be assigned.
 */
fun modifyElements(elements: MutableList<Int>, index: Int, newValue: Int) {
/**
 * Given a list of integers 'elements', an index 'index', and a new value 'newValue', modify the element at the specified index
 * in the list to have the new value.
 *
 * Example:
 * modifyElements(listOf(1, 2, 3, 4, 5), 2, 10)
 * Output: [1, 2, 10, 4, 5]
 *
 * @param elements A list of integers.
 * @param index An integer representing the index to be modified.
 * @param newValue An integer representing the new value to be assigned.
 */
fun modifyElements(elements: MutableList<Int>, index: Int, newValue: Int) {

    if (elements.isEmpty()) {
        println("Invalid input: 'elements' list is empty.")
        return
    }

    if (index < 0 || index >= elements.size) {
        println("Invalid input: 'index' is out of range.")
        return
    }

    elements[index] = newValue
}