/**
 * Modify the elements of a list based on the given sets.
 *
 * @param data_list A list of elements.
 * @param remove_set A set of elements to be removed from the list.
 * @param update_set A set of elements to update the list.
 * @return The modified list after removing elements from the remove_set and updating elements from the update_set.
 *
 * Example:
 * modifyListElements(listOf(1, 2, 3, 4), setOf(2, 4), setOf(3, 5)) => [1, 3, 5]
 */
fun modifyListElements(dataList: MutableList<Int>, removeSet: Set<Int>, updateSet: Set<Int>): List<Int> {

    for (removeItem in removeSet) {
        if (removeItem in dataList) {
            dataList.remove(removeItem)
        }
    }

    for (updateItem in updateSet) {
        if (updateItem in dataList) {
            val index = dataList.indexOf(updateItem)
            dataList[index] = updateItem
        }
    }

    return dataList
}
/**
 * Modify the elements of a list based on the given sets.
 *
 * @param data_list A list of elements.
 * @param remove_set A set of elements to be removed from the list.
 * @param update_set A set of elements to update the list.
 * @return The modified list after removing elements from the remove_set and updating elements from the update_set.
 *
 * Example:
 * modifyListElements(listOf(1, 2, 3, 4), setOf(2, 4), setOf(3, 5)) => [1, 3, 5]
 */
fun modifyListElements(dataList: MutableList<Int>, removeSet: Set<Int>, updateSet: Set<Int>): List<Int> {
/**
 * Modify the elements of a list based on the given sets.
 *
 * @param data_list A list of elements.
 * @param remove_set A set of elements to be removed from the list.
 * @param update_set A set of elements to update the list.
 * @return The modified list after removing elements from the remove_set and updating elements from the update_set.
 *
 * Example:
 * modifyListElements(listOf(1, 2, 3, 4), setOf(2, 4), setOf(3, 5)) => [1, 3, 5]
 */
fun modifyListElements(dataList: MutableList<Int>, removeSet: Set<Int>, updateSet: Set<Int>): List<Int> {

    for (removeItem in removeSet) {
        if (removeItem in dataList) {
            dataList.remove(removeItem)
        }
    }

    for (updateItem in updateSet) {
        if (updateItem in dataList) {
            val index = dataList.indexOf(updateItem)
            dataList[index] = updateItem
        }
    }

    return dataList
}