/**
 * Given an artist name and a list of colors, modify the second half of the colors list
 * by applying the XOR operator on each element with the ASCII value of the first character
 * of the artist's name. Return the modified colors list.
 *
 * @param artist The artist's name.
 * @param colors A list of colors.
 * @return The modified colors list.
 *
 * Example:
 * modifyElementsAndUseXorOperator("Picasso", listOf(2, 5, 8, 11, 14, 17)) returns [2, 5, 8, 11, 82, 85]
 */
fun modifyElementsAndUseXorOperator(artist: String, colors: MutableList<Int>): List<Int> {

    val halfLen = colors.size / 2

    // XOR each element with the ASCII value of the first character of the artist's name
    val modifiedColors = colors.subList(halfLen, colors.size).map { it.xor(artist[0].toInt()) }

    // Replace the second half of the colors list with the modified colors
    colors.subList(halfLen, colors.size).clear()
    colors.addAll(modifiedColors)

    return colors
}
/**
 * Given an artist name and a list of colors, modify the second half of the colors list
 * by applying the XOR operator on each element with the ASCII value of the first character
 * of the artist's name. Return the modified colors list.
 *
 * @param artist The artist's name.
 * @param colors A list of colors.
 * @return The modified colors list.
 *
 * Example:
 * modifyElementsAndUseXorOperator("Picasso", listOf(2, 5, 8, 11, 14, 17)) returns [2, 5, 8, 11, 82, 85]
 */
fun modifyElementsAndUseXorOperator(artist: String, colors: MutableList<Int>): List<Int> {
/**
 * Given an artist name and a list of colors, modify the second half of the colors list
 * by applying the XOR operator on each element with the ASCII value of the first character
 * of the artist's name. Return the modified colors list.
 *
 * @param artist The artist's name.
 * @param colors A list of colors.
 * @return The modified colors list.
 *
 * Example:
 * modifyElementsAndUseXorOperator("Picasso", listOf(2, 5, 8, 11, 14, 17)) returns [2, 5, 8, 11, 82, 85]
 */
fun modifyElementsAndUseXorOperator(artist: String, colors: MutableList<Int>): List<Int> {

    val halfLen = colors.size / 2

    // XOR each element with the ASCII value of the first character of the artist's name
    val modifiedColors = colors.subList(halfLen, colors.size).map { it.xor(artist[0].toInt()) }

    // Replace the second half of the colors list with the modified colors
    colors.subList(halfLen, colors.size).clear()
    colors.addAll(modifiedColors)

    return colors
}