/**
 * This function takes a list of tuples, each containing two elements, and a target element.
 * It returns a list of tuples that have the target element in their first position.
 */
fun intersectionOfTuplesAndLists(tupleList: List<Pair<Int, Int>>, targetElement: Int): List<Pair<Int, Int>> {

    val result = mutableListOf<Pair<Int, Int>>()
    for (tup in tupleList) {
        if (tup.first == targetElement) {
            result.add(tup)
        } else {
            println("Invalid input. Each element in the list must be a tuple containing two elements.")
        }
    }
    return result
}
/**
 * This function takes a list of tuples, each containing two elements, and a target element.
 * It returns a list of tuples that have the target element in their first position.
 */
fun intersectionOfTuplesAndLists(tupleList: List<Pair<Int, Int>>, targetElement: Int): List<Pair<Int, Int>> {
/**
 * This function takes a list of tuples, each containing two elements, and a target element.
 * It returns a list of tuples that have the target element in their first position.
 */
fun intersectionOfTuplesAndLists(tupleList: List<Pair<Int, Int>>, targetElement: Int): List<Pair<Int, Int>> {

    val result = mutableListOf<Pair<Int, Int>>()
    for (tup in tupleList) {
        if (tup.first == targetElement) {
            result.add(tup)
        } else {
            println("Invalid input. Each element in the list must be a tuple containing two elements.")
        }
    }
    return result
}