



'''simple docstring'''





import random
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  Optional[Any]							      =					a[left_index]
    lowerCAmelCase__ :  Tuple							      =					left_index + 1
    for j in range(left_index + 1							,    UpperCamelCase			):
        if a[j] < pivot:
            lowerCAmelCase__      ,   lowerCAmelCase__ :  str							      =					a[i], a[j]
            i += 1
    lowerCAmelCase__      ,   lowerCAmelCase__ :  Any							      =					a[i - 1], a[left_index]
    return i - 1
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			):



    """simple docstring"""





    if left < right:
        lowerCAmelCase__ :  Tuple							      =					random.randint(UpperCamelCase							,    right - 1			)
        lowerCAmelCase__      ,   lowerCAmelCase__ :  Tuple							      =					(
            a[left],
            a[pivot],
        )  # switches the pivot with the left most bound
        lowerCAmelCase__ :  Optional[Any]							      =					partition(UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			)
        quick_sort_random(
            UpperCamelCase							,    UpperCamelCase							,    UpperCamelCase			)  # recursive quicksort to the left of the pivot point
        quick_sort_random(
            UpperCamelCase							,    pivot_index + 1							,    UpperCamelCase			)  # recursive quicksort to the right of the pivot point
def    _SCREAMING_SNAKE_CASE  (       ):



    """simple docstring"""





    lowerCAmelCase__ :  Optional[int]							      =					input("""Enter numbers separated by a comma:\n"""			).strip()
    lowerCAmelCase__ :  List[str]							      =					[int(UpperCamelCase			) for item in user_input.split(""","""			)]

    quick_sort_random(UpperCamelCase							,    0							,    len(UpperCamelCase			)			)

    print(UpperCamelCase			)


if __name__ == "__main__":
 main()







'''simple docstring'''





def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  Tuple							      =					abs(UpperCamelCase			)
    lowerCAmelCase__ :  List[Any]							      =					0
    while n > 0:
        res += n % 10
        n //= 10
    return res
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  Union[str, Any]							      =					abs(UpperCamelCase			)
    return n if n < 10 else n % 10 + sum_of_digits(n // 10			)
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    return sum(int(UpperCamelCase			) for c in str(abs(UpperCamelCase			)			)			)
def    _SCREAMING_SNAKE_CASE  (       ):



    """simple docstring"""





    from collections.abc import Callable
    from timeit import timeit

    def benchmark_a_function(UpperCamelCase							,    UpperCamelCase			) -> None:
        lowerCAmelCase__ :  str							      =					f"""{func.__name__}({value})"""
        lowerCAmelCase__ :  str							      =					timeit(f"""__main__.{call}"""							,    setup="""import __main__"""			)
        print(f"""{call:56} = {func(UpperCamelCase			)} -- {timing:.4f} seconds"""			)

    for value in (262144, 1125899906842624, 1267650600228229401496703205376):
        for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
            benchmark_a_function(UpperCamelCase							,    UpperCamelCase			)
        print()


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 benchmark()


