"""simple docstring"""







def     __UpperCAmelCase							(       UpperCAmelCase_       :							list[int]    )				->     list[int]:

	'''simple docstring'''





	if len(UpperCAmelCase_    ) > 1:
		__snake_case     :				Optional[Any] 						=					len(UpperCAmelCase_    ) // 2  # Finds the middle of the array
		__snake_case     :				Optional[int] 						=					arr[
		    :middle_length
		]  # Creates an array of the elements in the first half.
		__snake_case     :				Optional[Any] 						=					arr[
		    middle_length:
		]  # Creates an array of the elements in the second half.
		__snake_case     :				Optional[int] 						=					len(UpperCAmelCase_    )
		__snake_case     :				Tuple 						=					len(UpperCAmelCase_    )
		merge(UpperCAmelCase_    )  # Starts sorting the left.
		merge(UpperCAmelCase_    )  # Starts sorting the right
		__snake_case     :				Dict 						=					0  # Left Counter
		__snake_case     :				Dict 						=					0  # Right Counter
		__snake_case     :				str 						=					0  # Position Counter
		while (
		    left_index < left_size and right_index < right_size
		):  # Runs until the lowers size of the left and right are sorted.
			if left_array[left_index] < right_array[right_index]:
				__snake_case     :				Optional[int] 						=					left_array[left_index]
				left_index += 1
			else:
				__snake_case     :				str 						=					right_array[right_index]
				right_index += 1
			index += 1
		while (
		    left_index < left_size
		):  # Adds the left over elements in the left half of the array
			__snake_case     :				Tuple 						=					left_array[left_index]
			left_index += 1
			index += 1
		while (
		    right_index < right_size
		):  # Adds the left over elements in the right half of the array
			__snake_case     :				str 						=					right_array[right_index]
			right_index += 1
			index += 1
	return arr


if __name__ == "__main__":
	import doctest

	doctest.testmod()






"""simple docstring"""







_a	:	Optional[Any]=					{
    "+": lambda x, y: x + y,
    "-": lambda x, y: x - y,
    "*": lambda x, y: x * y,
    "/": lambda x, y: x / y,
}
def     __UpperCAmelCase							(       UpperCAmelCase_       :							List[Any]    )				->     List[Any]:

	'''simple docstring'''





	return c.isdigit()
def     __UpperCAmelCase							(       UpperCAmelCase_       :							int    )				->     List[Any]:

	'''simple docstring'''





	__snake_case     :				Dict 						=					[]

	# iterate over the string in reverse order
	for c in expression.split()[::-1]:
		# push operand to stack
		if is_operand(UpperCAmelCase_    ):
			stack.append(int(UpperCAmelCase_    )    )

		else:
			# pop values from stack can calculate the result
			# push the result onto the stack again
			__snake_case     :				Optional[Any] 						=					stack.pop()
			__snake_case     :				int 						=					stack.pop()
			stack.append(calc[c](UpperCAmelCase_     ,				UpperCAmelCase_    )    )

	return stack.pop()


# Driver code
if __name__ == "__main__":
	_a	:	Union[str, Any]=					"+ 9 * 2 6"
	print(evaluate(test_expression))

	_a	:	List[Any]=					"/ * 10 2 + 4 1 "
	print(evaluate(test_expression))





