/**
 * Takes in a list of elements and a target value.
 * Modifies the list by replacing all occurrences of the target value with the sum of the target value and its index.
 * Exits the while loop when there are no more occurrences of the target value in the list.
 *
 * @param elements List of elements
 * @param target Target value to modify in the list
 * @return The modified list
 */
fun modifyList(elements: MutableList<Int>, target: Int): List<Int> {

    var index = 0
    while (true) {
        if (index >= elements.size) {
            break
        }
        if (elements[index] == target) {
            elements[index] = target + index
            index++
            continue
        }
        index++
    }
    return elements
}
/**
 * Takes in a list of elements and a target value.
 * Modifies the list by replacing all occurrences of the target value with the sum of the target value and its index.
 * Exits the while loop when there are no more occurrences of the target value in the list.
 *
 * @param elements List of elements
 * @param target Target value to modify in the list
 * @return The modified list
 */
fun modifyList(elements: MutableList<Int>, target: Int): List<Int> {
/**
 * Takes in a list of elements and a target value.
 * Modifies the list by replacing all occurrences of the target value with the sum of the target value and its index.
 * Exits the while loop when there are no more occurrences of the target value in the list.
 *
 * @param elements List of elements
 * @param target Target value to modify in the list
 * @return The modified list
 */
fun modifyList(elements: MutableList<Int>, target: Int): List<Int> {

    var index = 0
    while (true) {
        if (index >= elements.size) {
            break
        }
        if (elements[index] == target) {
            elements[index] = target + index
            index++
            continue
        }
        index++
    }
    return elements
}