/**
 * This exercise tests the intersection of tuple concatenation and repeating with if statements.
 * Given a list of tuples and a repeat value, the function should concatenate each tuple in the list with itself
 * a certain number of times, determined by the repeat value. If a tuple contains a negative number, it should be
 * excluded from the concatenation process.
 *
 * @param tuplesList A list of tuples.
 * @param repeatValue The number of times each tuple should be concatenated.
 * @return A list containing the concatenated tuples.
 */
fun concatenateAndRepeatTuples(tuplesList: List<List<Int>>, repeatValue: Int): List<List<Int>> {

    val concatenatedTuples = mutableListOf<List<Int>>()

    for (tuple in tuplesList) {
        if (tuple.any { it < 0 }) {
            continue
        } else {
            val repeatedTuple = tuple.flatMap { List(repeatValue) { it } }
            concatenatedTuples.add(repeatedTuple)
        }
    }

    return concatenatedTuples
}
/**
 * This exercise tests the intersection of tuple concatenation and repeating with if statements.
 * Given a list of tuples and a repeat value, the function should concatenate each tuple in the list with itself
 * a certain number of times, determined by the repeat value. If a tuple contains a negative number, it should be
 * excluded from the concatenation process.
 *
 * @param tuplesList A list of tuples.
 * @param repeatValue The number of times each tuple should be concatenated.
 * @return A list containing the concatenated tuples.
 */
fun concatenateAndRepeatTuples(tuplesList: List<List<Int>>, repeatValue: Int): List<List<Int>> {
/**
 * This exercise tests the intersection of tuple concatenation and repeating with if statements.
 * Given a list of tuples and a repeat value, the function should concatenate each tuple in the list with itself
 * a certain number of times, determined by the repeat value. If a tuple contains a negative number, it should be
 * excluded from the concatenation process.
 *
 * @param tuplesList A list of tuples.
 * @param repeatValue The number of times each tuple should be concatenated.
 * @return A list containing the concatenated tuples.
 */
fun concatenateAndRepeatTuples(tuplesList: List<List<Int>>, repeatValue: Int): List<List<Int>> {

    val concatenatedTuples = mutableListOf<List<Int>>()

    for (tuple in tuplesList) {
        if (tuple.any { it < 0 }) {
            continue
        } else {
            val repeatedTuple = tuple.flatMap { List(repeatValue) { it } }
            concatenatedTuples.add(repeatedTuple)
        }
    }

    return concatenatedTuples
}