/**
 * Given an array of integers, shift the elements to the left by k positions,
 * then change the individual elements by multiplying each element with the right shift operator.
 *
 * @param array A list of integers
 * @return A list of integers with shifted and multiplied elements
 *
 * Example:
 * shiftElements(listOf(1, 2, 3, 4, 5), 2) -> [8, 16, 32, 64, 128]
 * shiftElements(listOf(10, 20, 30, 40, 50), 3) -> [160, 320, 640, 1280, 2560]
 */
fun shiftElements(array: List<Int>, k: Int): List<Int> {

    val result = mutableListOf<Int>()
    // Determine the value of k (number of positions to shift elements)
    val shiftAmount = array.size / 2

    for (i in array.indices) {
        // Shift the element to the left by k positions
        val shiftedIndex = (i + shiftAmount) % array.size
        val shiftedElement = array[shiftedIndex]
        // Multiply the shifted element with the right shift operator
        val multipliedElement = shiftedElement shr 1

        result.add(multipliedElement)
    }

    return result
}
/**
 * Given an array of integers, shift the elements to the left by k positions,
 * then change the individual elements by multiplying each element with the right shift operator.
 *
 * @param array A list of integers
 * @return A list of integers with shifted and multiplied elements
 *
 * Example:
 * shiftElements(listOf(1, 2, 3, 4, 5), 2) -> [8, 16, 32, 64, 128]
 * shiftElements(listOf(10, 20, 30, 40, 50), 3) -> [160, 320, 640, 1280, 2560]
 */
fun shiftElements(array: List<Int>, k: Int): List<Int> {
/**
 * Given an array of integers, shift the elements to the left by k positions,
 * then change the individual elements by multiplying each element with the right shift operator.
 *
 * @param array A list of integers
 * @return A list of integers with shifted and multiplied elements
 *
 * Example:
 * shiftElements(listOf(1, 2, 3, 4, 5), 2) -> [8, 16, 32, 64, 128]
 * shiftElements(listOf(10, 20, 30, 40, 50), 3) -> [160, 320, 640, 1280, 2560]
 */
fun shiftElements(array: List<Int>, k: Int): List<Int> {

    val result = mutableListOf<Int>()
    // Determine the value of k (number of positions to shift elements)
    val shiftAmount = array.size / 2

    for (i in array.indices) {
        // Shift the element to the left by k positions
        val shiftedIndex = (i + shiftAmount) % array.size
        val shiftedElement = array[shiftedIndex]
        // Multiply the shifted element with the right shift operator
        val multipliedElement = shiftedElement shr 1

        result.add(multipliedElement)
    }

    return result
}