import time

def merge(left, right):
    # If the first array is empty, then nothing needs
    # to be merged, and you can return the second array as the result
    if len(left) == 0:
        return right
    # If the second array is empty, then nothing needs
    # to be merged, and you can return the first array as the result
    if len(right) == 0:
        return left

    result = []
    index_left = index_right = 0
    # Now go through both arrays until all the elements
    # make it into the resultant array
    while len(result) < len(left) + len(right):
        # The elements need to be sorted to add them to the
        # resultant array, so you need to decide whether to get
        # the next element from the first or the second array
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1

        # If you reach the end of either array, then you can
        # add the remaining elements from the other array to
        # the result and break the loop
        if index_right == len(right):
            result += left[index_left:]
            break

        if index_left == len(left):
            result += right[index_right:]
            break

    return result


def merge_sort(array):
    # If the input array contains fewer than two elements,
    # then return it as the result of the function
    if len(array) < 2:
        return array

    midpoint = len(array) // 2

    # Sort the array by recursively splitting the input
    # into two equal halves, sorting each half and merging them
    # together into the final result
    return merge(left=merge_sort(array[:midpoint]),right=merge_sort(array[midpoint:]))

def main():

    longQueue = ''
    
    #qa = [1,2,3,5,7,8,6,4]
    #qb = [1,2,3,5,4,6,8,7]

    readFile = open('chaosInput.txt','r')
    #printFile = open('printFile.txt','w')
    #inputQ = readFile.split()
    for line in readFile:
        longQueue += line
    #print(longQueue,file=printFile)
    #printFile.close()
    readFile.close()

    longQ = list(map(int, longQueue.rstrip().split()))
    longQcpy = longQ.copy()

    t1Merge = time.time()
    merge_sort(longQ)
    t2Merge = time.time()
    t1Sort = time.time()
    longQcpy.sort()
    t2Sort = time.time()

    print(str(len(longQ)) + str(t2Merge - t1Merge))
    print(str(len(longQcpy)) + str(t2Sort - t1Sort))

main()

b9cb23ca06cfa5fb4f5fe991d3e5b73f091cdf41
<mask token>


def merge(left, right):
    if len(left) == 0:
        return right
    if len(right) == 0:
        return left
    result = []
    index_left = index_right = 0
    while len(result) < len(left) + len(right):
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1
        if index_right == len(right):
            result += left[index_left:]
            break
        if index_left == len(left):
            result += right[index_right:]
            break
    return result


def merge_sort(array):
    if len(array) < 2:
        return array
    midpoint = len(array) // 2
    return merge(left=merge_sort(array[:midpoint]), right=merge_sort(array[
        midpoint:]))


<mask token>

<mask token>


def merge(left, right):
    if len(left) == 0:
        return right
    if len(right) == 0:
        return left
    result = []
    index_left = index_right = 0
    while len(result) < len(left) + len(right):
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1
        if index_right == len(right):
            result += left[index_left:]
            break
        if index_left == len(left):
            result += right[index_right:]
            break
    return result


def merge_sort(array):
    if len(array) < 2:
        return array
    midpoint = len(array) // 2
    return merge(left=merge_sort(array[:midpoint]), right=merge_sort(array[
        midpoint:]))


def main():
    longQueue = ''
    readFile = open('chaosInput.txt', 'r')
    for line in readFile:
        longQueue += line
    readFile.close()
    longQ = list(map(int, longQueue.rstrip().split()))
    longQcpy = longQ.copy()
    t1Merge = time.time()
    merge_sort(longQ)
    t2Merge = time.time()
    t1Sort = time.time()
    longQcpy.sort()
    t2Sort = time.time()
    print(str(len(longQ)) + str(t2Merge - t1Merge))
    print(str(len(longQcpy)) + str(t2Sort - t1Sort))


<mask token>

<mask token>


def merge(left, right):
    if len(left) == 0:
        return right
    if len(right) == 0:
        return left
    result = []
    index_left = index_right = 0
    while len(result) < len(left) + len(right):
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1
        if index_right == len(right):
            result += left[index_left:]
            break
        if index_left == len(left):
            result += right[index_right:]
            break
    return result


def merge_sort(array):
    if len(array) < 2:
        return array
    midpoint = len(array) // 2
    return merge(left=merge_sort(array[:midpoint]), right=merge_sort(array[
        midpoint:]))


def main():
    longQueue = ''
    readFile = open('chaosInput.txt', 'r')
    for line in readFile:
        longQueue += line
    readFile.close()
    longQ = list(map(int, longQueue.rstrip().split()))
    longQcpy = longQ.copy()
    t1Merge = time.time()
    merge_sort(longQ)
    t2Merge = time.time()
    t1Sort = time.time()
    longQcpy.sort()
    t2Sort = time.time()
    print(str(len(longQ)) + str(t2Merge - t1Merge))
    print(str(len(longQcpy)) + str(t2Sort - t1Sort))


main()

import time


def merge(left, right):
    if len(left) == 0:
        return right
    if len(right) == 0:
        return left
    result = []
    index_left = index_right = 0
    while len(result) < len(left) + len(right):
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1
        if index_right == len(right):
            result += left[index_left:]
            break
        if index_left == len(left):
            result += right[index_right:]
            break
    return result


def merge_sort(array):
    if len(array) < 2:
        return array
    midpoint = len(array) // 2
    return merge(left=merge_sort(array[:midpoint]), right=merge_sort(array[
        midpoint:]))


def main():
    longQueue = ''
    readFile = open('chaosInput.txt', 'r')
    for line in readFile:
        longQueue += line
    readFile.close()
    longQ = list(map(int, longQueue.rstrip().split()))
    longQcpy = longQ.copy()
    t1Merge = time.time()
    merge_sort(longQ)
    t2Merge = time.time()
    t1Sort = time.time()
    longQcpy.sort()
    t2Sort = time.time()
    print(str(len(longQ)) + str(t2Merge - t1Merge))
    print(str(len(longQcpy)) + str(t2Sort - t1Sort))


main()

import time

def merge(left, right):
    # If the first array is empty, then nothing needs
    # to be merged, and you can return the second array as the result
    if len(left) == 0:
        return right
    # If the second array is empty, then nothing needs
    # to be merged, and you can return the first array as the result
    if len(right) == 0:
        return left

    result = []
    index_left = index_right = 0
    # Now go through both arrays until all the elements
    # make it into the resultant array
    while len(result) < len(left) + len(right):
        # The elements need to be sorted to add them to the
        # resultant array, so you need to decide whether to get
        # the next element from the first or the second array
        if left[index_left] <= right[index_right]:
            result.append(left[index_left])
            index_left += 1
        else:
            result.append(right[index_right])
            index_right += 1

        # If you reach the end of either array, then you can
        # add the remaining elements from the other array to
        # the result and break the loop
        if index_right == len(right):
            result += left[index_left:]
            break

        if index_left == len(left):
            result += right[index_right:]
            break

    return result


def merge_sort(array):
    # If the input array contains fewer than two elements,
    # then return it as the result of the function
    if len(array) < 2:
        return array

    midpoint = len(array) // 2

    # Sort the array by recursively splitting the input
    # into two equal halves, sorting each half and merging them
    # together into the final result
    return merge(left=merge_sort(array[:midpoint]),right=merge_sort(array[midpoint:]))

def main():

    longQueue = ''
    
    #qa = [1,2,3,5,7,8,6,4]
    #qb = [1,2,3,5,4,6,8,7]

    readFile = open('chaosInput.txt','r')
    #printFile = open('printFile.txt','w')
    #inputQ = readFile.split()
    for line in readFile:
        longQueue += line
    #print(longQueue,file=printFile)
    #printFile.close()
    readFile.close()

    longQ = list(map(int, longQueue.rstrip().split()))
    longQcpy = longQ.copy()

    t1Merge = time.time()
    merge_sort(longQ)
    t2Merge = time.time()
    t1Sort = time.time()
    longQcpy.sort()
    t2Sort = time.time()

    print(str(len(longQ)) + str(t2Merge - t1Merge))
    print(str(len(longQcpy)) + str(t2Sort - t1Sort))

main()
