/**
 * This function takes a list of numbers and another list of elements.
 * It appends all the elements from the second list to the first list, and then
 * slices the resulting list using different slicing techniques.
 */
fun appendAndSlice(numbers: MutableList<Int>, elements: List<Int>): List<List<Int>> {

    // Appending elements from the second list to the first list
    numbers.addAll(elements)

    // Slicing the resulting list using different techniques
    // Slice 1: Second half of the list
    val slice1 = numbers.subList(numbers.size / 2, numbers.size)

    // Slice 2: First 3 elements of the list
    val slice2 = numbers.subList(0, 3)

    // Slice 3: Every other element, starting from the second element
    val slice3 = numbers.filterIndexed { index, _ -> index % 2 == 1 }

    // Slice 4: Reverse the list
    val slice4 = numbers.reversed()

    return listOf(slice1, slice2, slice3, slice4)
}
/**
 * This function takes a list of numbers and another list of elements.
 * It appends all the elements from the second list to the first list, and then
 * slices the resulting list using different slicing techniques.
 */
fun appendAndSlice(numbers: MutableList<Int>, elements: List<Int>): List<List<Int>> {
/**
 * This function takes a list of numbers and another list of elements.
 * It appends all the elements from the second list to the first list, and then
 * slices the resulting list using different slicing techniques.
 */
fun appendAndSlice(numbers: MutableList<Int>, elements: List<Int>): List<List<Int>> {

    // Appending elements from the second list to the first list
    numbers.addAll(elements)

    // Slicing the resulting list using different techniques
    // Slice 1: Second half of the list
    val slice1 = numbers.subList(numbers.size / 2, numbers.size)

    // Slice 2: First 3 elements of the list
    val slice2 = numbers.subList(0, 3)

    // Slice 3: Every other element, starting from the second element
    val slice3 = numbers.filterIndexed { index, _ -> index % 2 == 1 }

    // Slice 4: Reverse the list
    val slice4 = numbers.reversed()

    return listOf(slice1, slice2, slice3, slice4)
}