






from __future__ import annotations

import math



def 					_lowerCamelCase(			lowerCAmelCase__				:		int    ,    lowerCAmelCase__				:		int    ,    lowerCAmelCase__				:		bool    ,    lowerCAmelCase__				:		list[int]    ,    lowerCAmelCase__				:		float      ):





				'''simple docstring'''







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

				if len(lowerCAmelCase__      ) == 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    ,    lowerCAmelCase__    ,    lowerCAmelCase__    ,    lowerCAmelCase__      )    ,    minimax(depth + 1    ,    node_index * 2 + 1    ,    lowerCAmelCase__    ,    lowerCAmelCase__    ,    lowerCAmelCase__      )    ,    )

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



def 					_lowerCamelCase(			):





				'''simple docstring'''







				SCREAMING_SNAKE_CASE_   :	List[str]													=   [90, 23, 6, 33, 21, 65, 123, 3_4423]
				SCREAMING_SNAKE_CASE_   :	Union[str, Any]													=   math.log(len(lowerCAmelCase__      )    ,    2      )
				print('Optimal value : '    ,    end=''      )
				print(minimax(0    ,    0    ,    lowerCAmelCase__    ,    lowerCAmelCase__    ,    lowerCAmelCase__      )      )


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				main()







from timeit import timeit



def 					_lowerCamelCase(			lowerCAmelCase__				:		int      ):





				'''simple docstring'''







				if number < 0:
								raise ValueError('the value of input must not be negative'      )
				SCREAMING_SNAKE_CASE_   :	Tuple													=   0
				while number:
								number &= number - 1
								result += 1
				return result



def 					_lowerCamelCase(			lowerCAmelCase__				:		int      ):





				'''simple docstring'''







				if number < 0:
								raise ValueError('the value of input must not be negative'      )
				SCREAMING_SNAKE_CASE_   :	Optional[Any]													=   0
				while number:
								if number % 2 == 1:
												result += 1
								number >>= 1
				return result



def 					_lowerCamelCase(			):





				'''simple docstring'''







				def do_benchmark(lowerCAmelCase__				:		int      ) -> None:
								SCREAMING_SNAKE_CASE_   :	int													=   'import __main__ as z'
								print(F'''Benchmark when {number = }:'''      )
								print(F'''{get_set_bits_count_using_modulo_operator(lowerCAmelCase__      ) = }'''      )
								SCREAMING_SNAKE_CASE_   :	int													=   timeit('z.get_set_bits_count_using_modulo_operator(25)'    ,    setup=lowerCAmelCase__      )
								print(F'''timeit() runs in {timing} seconds'''      )
								print(F'''{get_set_bits_count_using_brian_kernighans_algorithm(lowerCAmelCase__      ) = }'''      )
								SCREAMING_SNAKE_CASE_   :	Optional[Any]													=   timeit(
								    'z.get_set_bits_count_using_brian_kernighans_algorithm(25)'    ,    setup=lowerCAmelCase__    ,    )
								print(F'''timeit() runs in {timing} seconds'''      )

				for number in (25, 37, 58, 0):
								do_benchmark(lowerCAmelCase__      )
								print()


if __name__ == "__main__":
				import doctest

				doctest.testmod()
				benchmark()