/**
 * This function takes a list of integers as input and modifies the elements based on a given boolean condition.
 * It replaces the even elements with their squared values if the condition is true, otherwise it replaces the odd
 * elements with their doubled values. The modified list is returned.
 *
 * @param lst A list of integers.
 * @param condition A boolean value indicating whether to modify even elements or odd elements.
 * @return The modified list after applying the appropriate operation based on the condition.
 */
fun modifyElementsWithBooleanCondition(lst: List<Int>, condition: Boolean): List<Int> {

    val modifiedList = lst.toMutableList()

    for (i in modifiedList.indices) {
        if (condition) {
            if (modifiedList[i] % 2 == 0) {
                modifiedList[i] = modifiedList[i] * modifiedList[i]
            }
        } else {
            if (modifiedList[i] % 2 != 0) {
                modifiedList[i] = modifiedList[i] * 2
            }
        }
    }

    return modifiedList
}
/**
 * This function takes a list of integers as input and modifies the elements based on a given boolean condition.
 * It replaces the even elements with their squared values if the condition is true, otherwise it replaces the odd
 * elements with their doubled values. The modified list is returned.
 *
 * @param lst A list of integers.
 * @param condition A boolean value indicating whether to modify even elements or odd elements.
 * @return The modified list after applying the appropriate operation based on the condition.
 */
fun modifyElementsWithBooleanCondition(lst: List<Int>, condition: Boolean): List<Int> {
/**
 * This function takes a list of integers as input and modifies the elements based on a given boolean condition.
 * It replaces the even elements with their squared values if the condition is true, otherwise it replaces the odd
 * elements with their doubled values. The modified list is returned.
 *
 * @param lst A list of integers.
 * @param condition A boolean value indicating whether to modify even elements or odd elements.
 * @return The modified list after applying the appropriate operation based on the condition.
 */
fun modifyElementsWithBooleanCondition(lst: List<Int>, condition: Boolean): List<Int> {

    val modifiedList = lst.toMutableList()

    for (i in modifiedList.indices) {
        if (condition) {
            if (modifiedList[i] % 2 == 0) {
                modifiedList[i] = modifiedList[i] * modifiedList[i]
            }
        } else {
            if (modifiedList[i] % 2 != 0) {
                modifiedList[i] = modifiedList[i] * 2
            }
        }
    }

    return modifiedList
}