"""simple docstring"""







from __future__ import annotations

import math


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	if depth < 0:
		raise ValueError('Depth cannot be less than 0'			)

	if len(__UpperCAmelCase			) == 0:
		raise ValueError('Scores cannot be empty'			)

	if depth == height:
		return scores[node_index]

	if is_max:
		return max(
		    minimax(depth + 1     ,node_index * 2     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			)     ,minimax(depth + 1     ,node_index * 2 + 1     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			)     ,)

	return min(
	    minimax(depth + 1     ,node_index * 2     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			)     ,minimax(depth + 1     ,node_index * 2 + 1     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			)     ,)


def      __lowerCAmelCase(		):






	"""simple docstring"""





	_lowercase :    List[str]							=							[90, 23, 6, 33, 21, 65, 123, 34_423]
	_lowercase :    Any							=							math.log(len(__UpperCAmelCase			)     ,2			)
	print('Optimal value : '     ,end=''			)
	print(minimax(0     ,0     ,__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			)			)


if __name__ == "__main__":
						import doctest

						doctest.testmod()
						main()




"""simple docstring"""







def      __lowerCAmelCase(		__UpperCAmelCase			):






	"""simple docstring"""





	stooge(__UpperCAmelCase     ,0     ,len(__UpperCAmelCase			) - 1			)
	return arr


def      __lowerCAmelCase(		__UpperCAmelCase     ,__UpperCAmelCase     ,__UpperCAmelCase			):






	"""simple docstring"""





	if i >= h:
		return

	# If first element is smaller than the last then swap them
	if arr[i] > arr[h]:
		_lowercase				,      _lowercase :    List[str]							=							arr[h], arr[i]

	# If there are more than 2 elements in the array
	if h - i + 1 > 2:
		_lowercase :    Optional[int]							=							(int)((h - i + 1) / 3			)

		# Recursively sort first 2/3 elements
		stooge(__UpperCAmelCase     ,__UpperCAmelCase     ,(h - t)			)

		# Recursively sort last 2/3 elements
		stooge(__UpperCAmelCase     ,i + t     ,(__UpperCAmelCase)			)

		# Recursively sort first 2/3 elements
		stooge(__UpperCAmelCase     ,__UpperCAmelCase     ,(h - t)			)


if __name__ == "__main__":
						SCREAMING_SNAKE_CASE									=						input('Enter numbers separated by a comma:\n').strip()
						SCREAMING_SNAKE_CASE									=						[int(item) for item in user_input.split(',')]
						print(stooge_sort(unsorted))



