/**
 * Given two tuples t1 and t2, the function compares the values of corresponding elements in both tuples and
 * returns a new tuple that contains the sum of the elements if they are equal, otherwise returns null.
 *
 * @param t1 The first tuple.
 * @param t2 The second tuple.
 * @return A new tuple containing the sum of corresponding elements if they are equal, otherwise returns null.
 */
fun compareAndAddTuples(t1: List<Int>, t2: List<Int>): List<Int>? {

    // Check if the lengths of t1 and t2 are equal
    if (t1.size != t2.size) {
        return null
    }

    val result = mutableListOf<Int>()
    for (i in t1.indices) {
        // Compare if the element at index i in t1 is equal to the element at index i in t2
        if (t1[i] == t2[i]) {
            // Add the elements and append the result to the new tuple
            result.add(t1[i] + t2[i])
        } else {
            // If elements are not equal, return null
            return null
        }
    }

    return result
}
/**
 * Given two tuples t1 and t2, the function compares the values of corresponding elements in both tuples and
 * returns a new tuple that contains the sum of the elements if they are equal, otherwise returns null.
 *
 * @param t1 The first tuple.
 * @param t2 The second tuple.
 * @return A new tuple containing the sum of corresponding elements if they are equal, otherwise returns null.
 */
fun compareAndAddTuples(t1: List<Int>, t2: List<Int>): List<Int>? {
/**
 * Given two tuples t1 and t2, the function compares the values of corresponding elements in both tuples and
 * returns a new tuple that contains the sum of the elements if they are equal, otherwise returns null.
 *
 * @param t1 The first tuple.
 * @param t2 The second tuple.
 * @return A new tuple containing the sum of corresponding elements if they are equal, otherwise returns null.
 */
fun compareAndAddTuples(t1: List<Int>, t2: List<Int>): List<Int>? {

    // Check if the lengths of t1 and t2 are equal
    if (t1.size != t2.size) {
        return null
    }

    val result = mutableListOf<Int>()
    for (i in t1.indices) {
        // Compare if the element at index i in t1 is equal to the element at index i in t2
        if (t1[i] == t2[i]) {
            // Add the elements and append the result to the new tuple
            result.add(t1[i] + t2[i])
        } else {
            // If elements are not equal, return null
            return null
        }
    }

    return result
}