/**
 * This function concatenates two tuples and then repeats the resulting tuple a specified number of times.
 *
 * @param tupleA First input tuple
 * @param tupleB Second input tuple
 * @param repeat Number of times the resulting tuple is repeated
 * @return Concatenated and repeated tuple
 * @throws IllegalArgumentException If repeat argument is negative
 */
fun concatenateRepeatTuples(tupleA: List<Any>, tupleB: List<Any>, repeat: Int): List<Any> {

    if (repeat < 0) {
        throw IllegalArgumentException("The repeat argument must be non-negative")
    }

    val concatenatedTuple = tupleA + tupleB  // Concatenates the two input tuples

    return when {
        repeat == 0 -> emptyList()  // If repeat is 0, return an empty list
        repeat == 1 -> concatenatedTuple  // If repeat is 1, return the concatenated tuple as it is
        else -> {  // For repeat values greater than 1
            var result = concatenatedTuple  // Initialize the result with the concatenated tuple
            repeat(repeat - 1) {
                result += concatenatedTuple  // Concatenate the tuples
            }
            result
        }
    }
}
/**
 * This function concatenates two tuples and then repeats the resulting tuple a specified number of times.
 *
 * @param tupleA First input tuple
 * @param tupleB Second input tuple
 * @param repeat Number of times the resulting tuple is repeated
 * @return Concatenated and repeated tuple
 * @throws IllegalArgumentException If repeat argument is negative
 */
fun concatenateRepeatTuples(tupleA: List<Any>, tupleB: List<Any>, repeat: Int): List<Any> {
/**
 * This function concatenates two tuples and then repeats the resulting tuple a specified number of times.
 *
 * @param tupleA First input tuple
 * @param tupleB Second input tuple
 * @param repeat Number of times the resulting tuple is repeated
 * @return Concatenated and repeated tuple
 * @throws IllegalArgumentException If repeat argument is negative
 */
fun concatenateRepeatTuples(tupleA: List<Any>, tupleB: List<Any>, repeat: Int): List<Any> {

    if (repeat < 0) {
        throw IllegalArgumentException("The repeat argument must be non-negative")
    }

    val concatenatedTuple = tupleA + tupleB  // Concatenates the two input tuples

    return when {
        repeat == 0 -> emptyList()  // If repeat is 0, return an empty list
        repeat == 1 -> concatenatedTuple  // If repeat is 1, return the concatenated tuple as it is
        else -> {  // For repeat values greater than 1
            var result = concatenatedTuple  // Initialize the result with the concatenated tuple
            repeat(repeat - 1) {
                result += concatenatedTuple  // Concatenate the tuples
            }
            result
        }
    }
}