/**
 * Concatenates two tuples and repeats the resulting tuple multiple times.
 *
 * @param tup1 First input tuple
 * @param tup2 Second input tuple
 * @param repeatTimes Number of times the concatenated tuple should be repeated
 * @return The concatenated and repeated tuple
 *
 * Example:
 * Input:
 * tup1 = listOf(1, 2, 3)
 * tup2 = listOf(4, 5)
 * repeatTimes = 2
 *
 * Output:
 * listOf(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
 */
fun tupleConcatenationRepeat(tup1: List<Int>, tup2: List<Int>, repeatTimes: Int): List<Int> {

    val combinedList = tup1 + tup2  // Concatenate the two input tuples
    val repeatedList = combinedList.flatMap { List(repeatTimes) { it } }  // Repeat the concatenated tuple
    return repeatedList
}
/**
 * Concatenates two tuples and repeats the resulting tuple multiple times.
 *
 * @param tup1 First input tuple
 * @param tup2 Second input tuple
 * @param repeatTimes Number of times the concatenated tuple should be repeated
 * @return The concatenated and repeated tuple
 *
 * Example:
 * Input:
 * tup1 = listOf(1, 2, 3)
 * tup2 = listOf(4, 5)
 * repeatTimes = 2
 *
 * Output:
 * listOf(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
 */
fun tupleConcatenationRepeat(tup1: List<Int>, tup2: List<Int>, repeatTimes: Int): List<Int> {
/**
 * Concatenates two tuples and repeats the resulting tuple multiple times.
 *
 * @param tup1 First input tuple
 * @param tup2 Second input tuple
 * @param repeatTimes Number of times the concatenated tuple should be repeated
 * @return The concatenated and repeated tuple
 *
 * Example:
 * Input:
 * tup1 = listOf(1, 2, 3)
 * tup2 = listOf(4, 5)
 * repeatTimes = 2
 *
 * Output:
 * listOf(1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
 */
fun tupleConcatenationRepeat(tup1: List<Int>, tup2: List<Int>, repeatTimes: Int): List<Int> {

    val combinedList = tup1 + tup2  // Concatenate the two input tuples
    val repeatedList = combinedList.flatMap { List(repeatTimes) { it } }  // Repeat the concatenated tuple
    return repeatedList
}