/**
 * You are a Marketing Manager and you are given a tuple 'tup'. Your task is to modify the value at a specific index
 * in the tuple and return the modified tuple. If the index is out of range or the value is null, you should return
 * the original tuple without any modifications.
 *
 * @param tup The input tuple
 * @param index The index at which the value needs to be modified
 * @param value The new value that needs to be inserted at the given index
 * @return The modified tuple, if modification is possible, otherwise the original tuple
 */
fun modifyTuple(tup: List<Any>, index: Int, value: Any?): List<Any> {

    // Check if the index is within the range and if the value is not null
    if (index in tup.indices && value != null) {
        // Modify the value at the given index
        val modifiedList = tup.toMutableList()
        modifiedList[index] = value
        return modifiedList
    }
    
    // If index is out of range or value is null, return the original tuple
    return tup
}
/**
 * You are a Marketing Manager and you are given a tuple 'tup'. Your task is to modify the value at a specific index
 * in the tuple and return the modified tuple. If the index is out of range or the value is null, you should return
 * the original tuple without any modifications.
 *
 * @param tup The input tuple
 * @param index The index at which the value needs to be modified
 * @param value The new value that needs to be inserted at the given index
 * @return The modified tuple, if modification is possible, otherwise the original tuple
 */
fun modifyTuple(tup: List<Any>, index: Int, value: Any?): List<Any> {
/**
 * You are a Marketing Manager and you are given a tuple 'tup'. Your task is to modify the value at a specific index
 * in the tuple and return the modified tuple. If the index is out of range or the value is null, you should return
 * the original tuple without any modifications.
 *
 * @param tup The input tuple
 * @param index The index at which the value needs to be modified
 * @param value The new value that needs to be inserted at the given index
 * @return The modified tuple, if modification is possible, otherwise the original tuple
 */
fun modifyTuple(tup: List<Any>, index: Int, value: Any?): List<Any> {

    // Check if the index is within the range and if the value is not null
    if (index in tup.indices && value != null) {
        // Modify the value at the given index
        val modifiedList = tup.toMutableList()
        modifiedList[index] = value
        return modifiedList
    }
    
    // If index is out of range or value is null, return the original tuple
    return tup
}