
'''simple docstring'''
from timeit import timeit







def        A_     (						__SCREAMING_SNAKE_CASE						:  int )				->       int:





  """simple docstring"""

  if number < 0:
    raise ValueError("""the value of input must not be negative""" )
  __A		:     Optional[int]												=		0
  while number:
    number &= number - 1
    result += 1
  return result







def        A_     (						__SCREAMING_SNAKE_CASE						:  int )				->       int:





  """simple docstring"""

  if number < 0:
    raise ValueError("""the value of input must not be negative""" )
  __A		:     Any												=		0
  while number:
    if number % 2 == 1:
      result += 1
    number >>= 1
  return result







def        A_     (						)				->       None:





  """simple docstring"""

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

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


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     benchmark()





'''simple docstring'''
from collections.abc import Sequence







def        A_     (						__SCREAMING_SNAKE_CASE						:  Sequence[float]			,     __SCREAMING_SNAKE_CASE						:  bool = False )				->       float:





  """simple docstring"""

  if not arr:
    return 0

  __A		:     Any												=		0 if allow_empty_subarrays else float("""-inf""" )
  __A		:     List[Any]												=		0.0
  for num in arr:
    __A		:     Tuple												=		max(0 if allow_empty_subarrays else num			,     curr_sum + num )
    __A		:     Optional[int]												=		max(__SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE )

  return max_sum


if __name__ == "__main__":
     from doctest import testmod

     testmod()

     A__   :		Any 		=[-2, 1, -3, 4, -1, 2, 1, -5, 4]
     print(F"{max_subarray_sum(nums) = }")



