/**
 * Given a list of tuples containing integers, return a list of tuples
 * where each tuple is the complement of the corresponding tuple in the
 * input list.
 *
 * The complement of a tuple is obtained by replacing each element of the tuple
 * with its complement (flip the bits).
 *
 * @param tuplesList A list of tuples containing integers.
 * @return A list of tuples where each tuple is the complement
 * of the corresponding tuple in the input list.
 *
 * Example:
 * Input:
 * [(0, 120), (13, 255), (65, 240)]
 *
 * Output:
 * [(255, 135), (242, 0), (190, 15)]
 */
fun findComplementTuples(tuplesList: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    val complementedTuples = mutableListOf<Pair<Int, Int>>()
    for (tup in tuplesList) {
        val complementedTuple = Pair(tup.first.inv(), tup.second.inv())
        complementedTuples.add(complementedTuple)
    }
    return complementedTuples
}
/**
 * Given a list of tuples containing integers, return a list of tuples
 * where each tuple is the complement of the corresponding tuple in the
 * input list.
 *
 * The complement of a tuple is obtained by replacing each element of the tuple
 * with its complement (flip the bits).
 *
 * @param tuplesList A list of tuples containing integers.
 * @return A list of tuples where each tuple is the complement
 * of the corresponding tuple in the input list.
 *
 * Example:
 * Input:
 * [(0, 120), (13, 255), (65, 240)]
 *
 * Output:
 * [(255, 135), (242, 0), (190, 15)]
 */
fun findComplementTuples(tuplesList: List<Pair<Int, Int>>): List<Pair<Int, Int>> {
/**
 * Given a list of tuples containing integers, return a list of tuples
 * where each tuple is the complement of the corresponding tuple in the
 * input list.
 *
 * The complement of a tuple is obtained by replacing each element of the tuple
 * with its complement (flip the bits).
 *
 * @param tuplesList A list of tuples containing integers.
 * @return A list of tuples where each tuple is the complement
 * of the corresponding tuple in the input list.
 *
 * Example:
 * Input:
 * [(0, 120), (13, 255), (65, 240)]
 *
 * Output:
 * [(255, 135), (242, 0), (190, 15)]
 */
fun findComplementTuples(tuplesList: List<Pair<Int, Int>>): List<Pair<Int, Int>> {

    val complementedTuples = mutableListOf<Pair<Int, Int>>()
    for (tup in tuplesList) {
        val complementedTuple = Pair(tup.first.inv(), tup.second.inv())
        complementedTuples.add(complementedTuple)
    }
    return complementedTuples
}