/**
 * This function takes a list of initial elements and an integer as inputs, and returns a new list
 * with the initial elements repeated for a number of times equal to or greater than the given integer.
 * The function handles various edge cases to ensure proper functionality.
 *
 * @param initialElements a list of elements
 * @param num an integer representing the minimum number of times the initial elements should be repeated
 * @return A list with the initial elements repeated for a number of times equal to or greater than num
 */
fun createListWithInitialElements(initialElements: List<Any>, num: Int): List<Any> {

    if (initialElements.isEmpty()) {
        return emptyList()
    }

    val outputList = mutableListOf<Any>()

    val repeatTimes = (num / initialElements.size) + 1

    repeat(repeatTimes) {
        outputList.addAll(initialElements)
    }

    return outputList.take(num)
}
/**
 * This function takes a list of initial elements and an integer as inputs, and returns a new list
 * with the initial elements repeated for a number of times equal to or greater than the given integer.
 * The function handles various edge cases to ensure proper functionality.
 *
 * @param initialElements a list of elements
 * @param num an integer representing the minimum number of times the initial elements should be repeated
 * @return A list with the initial elements repeated for a number of times equal to or greater than num
 */
fun createListWithInitialElements(initialElements: List<Any>, num: Int): List<Any> {
/**
 * This function takes a list of initial elements and an integer as inputs, and returns a new list
 * with the initial elements repeated for a number of times equal to or greater than the given integer.
 * The function handles various edge cases to ensure proper functionality.
 *
 * @param initialElements a list of elements
 * @param num an integer representing the minimum number of times the initial elements should be repeated
 * @return A list with the initial elements repeated for a number of times equal to or greater than num
 */
fun createListWithInitialElements(initialElements: List<Any>, num: Int): List<Any> {

    if (initialElements.isEmpty()) {
        return emptyList()
    }

    val outputList = mutableListOf<Any>()

    val repeatTimes = (num / initialElements.size) + 1

    repeat(repeatTimes) {
        outputList.addAll(initialElements)
    }

    return outputList.take(num)
}