




'''simple docstring'''

def 		__magic_name__    (	__UpperCAmelCase	)		->					int:

					'''simple docstring'''

					snake_case_									=				abs(__UpperCAmelCase	)
					snake_case_									=				0
					while n > 0:
										res += n % 10
										n //= 10
					return res


def 		__magic_name__    (	__UpperCAmelCase	)		->					int:

					'''simple docstring'''

					snake_case_									=				abs(__UpperCAmelCase	)
					return n if n < 10 else n % 10 + sum_of_digits(n // 10	)


def 		__magic_name__    (	__UpperCAmelCase	)		->					int:

					'''simple docstring'''

					return sum(int(__UpperCAmelCase	) for c in str(abs(__UpperCAmelCase	)	)	)


def 		__magic_name__    (	)		->					None:

					'''simple docstring'''

					from collections.abc import Callable
					from timeit import timeit

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

					for value in (26_2144, 1125_8999_0684_2624, 126_7650_6002_2822_9401_4967_0320_5376):
										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()







'''simple docstring'''

from __future__ import annotations

import math


def 		__magic_name__    (	__UpperCAmelCase,      __UpperCAmelCase,      __UpperCAmelCase,      __UpperCAmelCase,      __UpperCAmelCase	)		->					int:

					'''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 		__magic_name__    (	)		->					None:

					'''simple docstring'''

					snake_case_									=				[90, 23, 6, 33, 21, 65, 123, 3_4423]
					snake_case_									=				math.log(len(__UpperCAmelCase	),      2	)
					print('''Optimal value : ''',      end=''''''	)
					print(minimax(0,      0,      __UpperCAmelCase,      __UpperCAmelCase,      __UpperCAmelCase	)	)


if __name__ == "__main__":
							import doctest

							doctest.testmod()
							main()

