/**
 * This function takes a list of rock layers and the number of times the shift operators should be applied.
 * It calculates the average depth of the rock layers after applying the shift operators.
 *
 * @param rockLayers a list containing the depths of rock layers
 * @param numShifts an integer representing the number of times the shift operators should be applied
 * @return averageDepth a float representing the average depth of the rock layers
 *
 * Example:
 * calculateAverageDepth(listOf(10, 20, 30, 40, 50), 3)
 * Output: 25.0
 */
fun calculateAverageDepth(rockLayers: List<Int>, numShifts: Int): Float {

    val shiftedLayers = rockLayers.toMutableList()

    repeat(numShifts) {
        for (i in shiftedLayers.indices) {
            if (i == 0) {
                shiftedLayers[i] = shiftedLayers[i] shl 1
            } else {
                shiftedLayers[i] = shiftedLayers[i] shr 1
            }
        }
    }

    val totalDepth = shiftedLayers.sum()
    val averageDepth = totalDepth.toFloat() / shiftedLayers.size

    return averageDepth
}

val rockLayers = listOf(10, 20, 30, 40, 50)
/**
 * This function takes a list of rock layers and the number of times the shift operators should be applied.
 * It calculates the average depth of the rock layers after applying the shift operators.
 *
 * @param rockLayers a list containing the depths of rock layers
 * @param numShifts an integer representing the number of times the shift operators should be applied
 * @return averageDepth a float representing the average depth of the rock layers
 *
 * Example:
 * calculateAverageDepth(listOf(10, 20, 30, 40, 50), 3)
 * Output: 25.0
 */
fun calculateAverageDepth(rockLayers: List<Int>, numShifts: Int): Float {
/**
 * This function takes a list of rock layers and the number of times the shift operators should be applied.
 * It calculates the average depth of the rock layers after applying the shift operators.
 *
 * @param rockLayers a list containing the depths of rock layers
 * @param numShifts an integer representing the number of times the shift operators should be applied
 * @return averageDepth a float representing the average depth of the rock layers
 *
 * Example:
 * calculateAverageDepth(listOf(10, 20, 30, 40, 50), 3)
 * Output: 25.0
 */
fun calculateAverageDepth(rockLayers: List<Int>, numShifts: Int): Float {

    val shiftedLayers = rockLayers.toMutableList()

    repeat(numShifts) {
        for (i in shiftedLayers.indices) {
            if (i == 0) {
                shiftedLayers[i] = shiftedLayers[i] shl 1
            } else {
                shiftedLayers[i] = shiftedLayers[i] shr 1
            }
        }
    }

    val totalDepth = shiftedLayers.sum()
    val averageDepth = totalDepth.toFloat() / shiftedLayers.size

    return averageDepth
}

val rockLayers = listOf(10, 20, 30, 40, 50)