






"""simple docstring"""






from __future__ import annotations



def       _A    (__a					,       __a					,       __a					,       __a							)				-> list:
    """simple docstring"""






    SCREAMING_SNAKE_CASE_   :						List[Any]							=	[]
    SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_   :						Tuple							=	input_list[low:mid], input_list[mid : high + 1]
    while left and right:
        result.append((left if left[0] <= right[0] else right).pop(0							)							)
    SCREAMING_SNAKE_CASE_   :						Dict							=	result + left + right
    return input_list



def       _A    (__a							)				-> list:
    """simple docstring"""






    if len(__a							) <= 1:
        return input_list
    SCREAMING_SNAKE_CASE_   :						Dict							=	list(__a							)

    # iteration for two-way merging
    SCREAMING_SNAKE_CASE_   :						Any							=	2
    while p <= len(__a							):
        # getting low, high and middle value for merge-sort of single list
        for i in range(0					,       len(__a							)					,       __a							):
            SCREAMING_SNAKE_CASE_   :						int							=	i
            SCREAMING_SNAKE_CASE_   :						List[str]							=	i + p - 1
            SCREAMING_SNAKE_CASE_   :						Any							=	(low + high + 1) // 2
            SCREAMING_SNAKE_CASE_   :						List[Any]							=	merge(__a					,       __a					,       __a					,       __a							)
        # final merge of last two parts
        if p * 2 >= len(__a							):
            SCREAMING_SNAKE_CASE_   :						Dict							=	i
            SCREAMING_SNAKE_CASE_   :						Any							=	merge(__a					,       0					,       __a					,       len(__a							) - 1							)
            break
        p *= 2

    return input_list


if __name__ == "__main__":
  UpperCAmelCase_     :				str         =				input("""Enter numbers separated by a comma:\n""").strip()
  if user_input == "":
    UpperCAmelCase_     :				Dict         =				[]
  else:
    UpperCAmelCase_     :				Optional[Any]         =				[int(item.strip()) for item in user_input.split(""",""")]
  print(iter_merge_sort(unsorted))










"""simple docstring"""






from collections import defaultdict

from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst



def       _A    ()				-> Union[str, Any]:
    """simple docstring"""






    SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_   :						Tuple							=	9, 14  # noqa: F841
    SCREAMING_SNAKE_CASE_   :						Tuple							=	[
        [0, 1, 4],
        [0, 7, 8],
        [1, 2, 8],
        [7, 8, 7],
        [7, 6, 1],
        [2, 8, 2],
        [8, 6, 6],
        [2, 3, 7],
        [2, 5, 4],
        [6, 5, 2],
        [3, 5, 14],
        [3, 4, 9],
        [5, 4, 10],
        [1, 7, 11],
    ]

    SCREAMING_SNAKE_CASE_   :						Dict							=	defaultdict(__a							)
    for nodea, nodea, cost in edges:
        adjancency[nodea].append([nodea, cost]							)
        adjancency[nodea].append([nodea, cost]							)

    SCREAMING_SNAKE_CASE_   :						Any							=	mst(__a							)

    SCREAMING_SNAKE_CASE_   :						Optional[int]							=	[
        [7, 6, 1],
        [2, 8, 2],
        [6, 5, 2],
        [0, 1, 4],
        [2, 5, 4],
        [2, 3, 7],
        [0, 7, 8],
        [3, 4, 9],
    ]

    for answer in expected:
        SCREAMING_SNAKE_CASE_   :						Dict							=	tuple(answer[:2]							)
        SCREAMING_SNAKE_CASE_   :						Optional[int]							=	tuple(edge[::-1]							)
        assert edge in result or reverse in result


