/**
 * Given a list of tuples and a repetition factor, this function repeats and concatenates the tuples.
 *
 * @param tupleList A list of tuples.
 * @param repetitionFactor An integer specifying the repetition factor.
 * @return A list containing the repeated and concatenated elements.
 */
fun tupleRepetitionAndConcatenation(tupleList: List<List<Any>>, repetitionFactor: Int): List<Any> {

    val result = mutableListOf<Any>()

    for (tpl in tupleList) {
        val repeatedTpl = tpl.flatMap { List(repetitionFactor) { it } }
        result.addAll(repeatedTpl)
    }

    return result
}
/**
 * Given a list of tuples and a repetition factor, this function repeats and concatenates the tuples.
 *
 * @param tupleList A list of tuples.
 * @param repetitionFactor An integer specifying the repetition factor.
 * @return A list containing the repeated and concatenated elements.
 */
fun tupleRepetitionAndConcatenation(tupleList: List<List<Any>>, repetitionFactor: Int): List<Any> {
/**
 * Given a list of tuples and a repetition factor, this function repeats and concatenates the tuples.
 *
 * @param tupleList A list of tuples.
 * @param repetitionFactor An integer specifying the repetition factor.
 * @return A list containing the repeated and concatenated elements.
 */
fun tupleRepetitionAndConcatenation(tupleList: List<List<Any>>, repetitionFactor: Int): List<Any> {

    val result = mutableListOf<Any>()

    for (tpl in tupleList) {
        val repeatedTpl = tpl.flatMap { List(repetitionFactor) { it } }
        result.addAll(repeatedTpl)
    }

    return result
}