/**
 * Given two tuples, tuple1 and tuple2, and a positive integer n,
 * concatenate tuple1 with itself n times and then concatenate the result with tuple2.
 * Return the final concatenated tuple.
 *
 * For example:
 * - concatAndRepeatTuple(listOf('a', 'b'), listOf('c', 'd'), 3) returns ['a', 'b', 'a', 'b', 'a', 'b', 'c', 'd'].
 *
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @param n The number of times tuple1 should be repeated.
 * @return The concatenated tuple.
 */
fun concatAndRepeatTuple(tuple1: List<Any>, tuple2: List<Any>, n: Int): List<Any> {

    // Repeat tuple1 n times
    val repeatedTuple1 = List(n) { tuple1 }.flatten()

    // Concatenate repeatedTuple1 with tuple2
    val concatenatedTuple = repeatedTuple1 + tuple2

    return concatenatedTuple
}
/**
 * Given two tuples, tuple1 and tuple2, and a positive integer n,
 * concatenate tuple1 with itself n times and then concatenate the result with tuple2.
 * Return the final concatenated tuple.
 *
 * For example:
 * - concatAndRepeatTuple(listOf('a', 'b'), listOf('c', 'd'), 3) returns ['a', 'b', 'a', 'b', 'a', 'b', 'c', 'd'].
 *
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @param n The number of times tuple1 should be repeated.
 * @return The concatenated tuple.
 */
fun concatAndRepeatTuple(tuple1: List<Any>, tuple2: List<Any>, n: Int): List<Any> {
/**
 * Given two tuples, tuple1 and tuple2, and a positive integer n,
 * concatenate tuple1 with itself n times and then concatenate the result with tuple2.
 * Return the final concatenated tuple.
 *
 * For example:
 * - concatAndRepeatTuple(listOf('a', 'b'), listOf('c', 'd'), 3) returns ['a', 'b', 'a', 'b', 'a', 'b', 'c', 'd'].
 *
 * @param tuple1 The first tuple.
 * @param tuple2 The second tuple.
 * @param n The number of times tuple1 should be repeated.
 * @return The concatenated tuple.
 */
fun concatAndRepeatTuple(tuple1: List<Any>, tuple2: List<Any>, n: Int): List<Any> {

    // Repeat tuple1 n times
    val repeatedTuple1 = List(n) { tuple1 }.flatten()

    // Concatenate repeatedTuple1 with tuple2
    val concatenatedTuple = repeatedTuple1 + tuple2

    return concatenatedTuple
}