/**
 * Given two lists, concatenates them and modifies the elements based on a specific rule.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The modified concatenated list.
 *
 * Example:
 * concatenateAndModifyList(listOf(1, 2, 3), listOf(4, 5, 6)) returns [8, 10, 12]
 */
fun concatenateAndModifyList(list1: List<Int>, list2: List<Int>): List<Int> {

    val result = mutableListOf<Int>()
    
    // Concatenate the two lists
    result.addAll(list1)
    result.addAll(list2)
    
    // Modify the elements based on the rule: multiply the even numbers by 2
    for (i in result.indices) {
        if (result[i] % 2 == 0) {
            result[i] *= 2
        }
    }
    
    return result
}
/**
 * Given two lists, concatenates them and modifies the elements based on a specific rule.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The modified concatenated list.
 *
 * Example:
 * concatenateAndModifyList(listOf(1, 2, 3), listOf(4, 5, 6)) returns [8, 10, 12]
 */
fun concatenateAndModifyList(list1: List<Int>, list2: List<Int>): List<Int> {
/**
 * Given two lists, concatenates them and modifies the elements based on a specific rule.
 *
 * @param list1 The first list.
 * @param list2 The second list.
 * @return The modified concatenated list.
 *
 * Example:
 * concatenateAndModifyList(listOf(1, 2, 3), listOf(4, 5, 6)) returns [8, 10, 12]
 */
fun concatenateAndModifyList(list1: List<Int>, list2: List<Int>): List<Int> {

    val result = mutableListOf<Int>()
    
    // Concatenate the two lists
    result.addAll(list1)
    result.addAll(list2)
    
    // Modify the elements based on the rule: multiply the even numbers by 2
    for (i in result.indices) {
        if (result[i] % 2 == 0) {
            result[i] *= 2
        }
    }
    
    return result
}