/**
 * Given a list [arr1] containing integers and a list [arr2] containing booleans of the same length,
 * modify the elements of [arr1] based on the corresponding values in [arr2].
 * If the value in [arr2] is true, multiply the element in [arr1] by 2.
 * If the value in [arr2] is false, divide the element in [arr1] by 2.
 *
 * @param arr1 A list of integers
 * @param arr2 A list of booleans of the same length as [arr1]
 * @return The modified list [arr1]
 *
 * Example:
 * modifyElements(listOf(1, 2, 3, 4), listOf(true, false, true, false)) // [2, 1.0, 6, 2.0]
 */
fun modifyElements(arr1: MutableList<Int>, arr2: List<Boolean>): List<Number> {

    for (i in arr1.indices) {
        if (arr2[i]) {
            arr1[i] *= 2
        } else {
            arr1[i] /= 2
        }
    }
    return arr1.map { it.toDouble() }
}
/**
 * Given a list [arr1] containing integers and a list [arr2] containing booleans of the same length,
 * modify the elements of [arr1] based on the corresponding values in [arr2].
 * If the value in [arr2] is true, multiply the element in [arr1] by 2.
 * If the value in [arr2] is false, divide the element in [arr1] by 2.
 *
 * @param arr1 A list of integers
 * @param arr2 A list of booleans of the same length as [arr1]
 * @return The modified list [arr1]
 *
 * Example:
 * modifyElements(listOf(1, 2, 3, 4), listOf(true, false, true, false)) // [2, 1.0, 6, 2.0]
 */
fun modifyElements(arr1: MutableList<Int>, arr2: List<Boolean>): List<Number> {
/**
 * Given a list [arr1] containing integers and a list [arr2] containing booleans of the same length,
 * modify the elements of [arr1] based on the corresponding values in [arr2].
 * If the value in [arr2] is true, multiply the element in [arr1] by 2.
 * If the value in [arr2] is false, divide the element in [arr1] by 2.
 *
 * @param arr1 A list of integers
 * @param arr2 A list of booleans of the same length as [arr1]
 * @return The modified list [arr1]
 *
 * Example:
 * modifyElements(listOf(1, 2, 3, 4), listOf(true, false, true, false)) // [2, 1.0, 6, 2.0]
 */
fun modifyElements(arr1: MutableList<Int>, arr2: List<Boolean>): List<Number> {

    for (i in arr1.indices) {
        if (arr2[i]) {
            arr1[i] *= 2
        } else {
            arr1[i] /= 2
        }
    }
    return arr1.map { it.toDouble() }
}