/**
 * Given a sequence and a number, find the intersection of the sequence after adding the number to each element.
 *
 * @param sequence A list of integers.
 * @param number An integer to be added to each element of the sequence.
 * @return A list with the intersection of elements after adding the number.
 */
fun intersectionOfSequenceAndAdditionAssignment(sequence: List<Int>, number: Int): List<Int> {

    var result = setOf(sequence[0] + number)
    for (i in 1 until sequence.size) {
        val currentSet = mutableSetOf<Int>()
        for (j in result) {
            currentSet.add(j + sequence[i])
        }
        result = result.intersect(currentSet)
    }
    return result.toList()
}
/**
 * Given a sequence and a number, find the intersection of the sequence after adding the number to each element.
 *
 * @param sequence A list of integers.
 * @param number An integer to be added to each element of the sequence.
 * @return A list with the intersection of elements after adding the number.
 */
fun intersectionOfSequenceAndAdditionAssignment(sequence: List<Int>, number: Int): List<Int> {
/**
 * Given a sequence and a number, find the intersection of the sequence after adding the number to each element.
 *
 * @param sequence A list of integers.
 * @param number An integer to be added to each element of the sequence.
 * @return A list with the intersection of elements after adding the number.
 */
fun intersectionOfSequenceAndAdditionAssignment(sequence: List<Int>, number: Int): List<Int> {

    var result = setOf(sequence[0] + number)
    for (i in 1 until sequence.size) {
        val currentSet = mutableSetOf<Int>()
        for (j in result) {
            currentSet.add(j + sequence[i])
        }
        result = result.intersect(currentSet)
    }
    return result.toList()
}