






'''simple docstring'''

import functools







def    lowercase__			(				__UpperCamelCase		,						__UpperCamelCase   )->			int:

      # Validation
      if not isinstance(__UpperCamelCase		,						__UpperCamelCase   ) or not all(isinstance(__UpperCamelCase		,						__UpperCamelCase   ) for day in days   ):
            raise ValueError("""The parameter days should be a list of integers"""   )

      if len(__UpperCamelCase   ) != 3 or not all(isinstance(__UpperCamelCase		,						__UpperCamelCase   ) for cost in costs   ):
            raise ValueError("""The parameter costs should be a list of three integers"""   )

      if len(__UpperCamelCase   ) == 0:
            return 0

      if min(__UpperCamelCase   ) <= 0:
            raise ValueError("""All days elements should be greater than 0"""   )

      if max(__UpperCamelCase   ) >= 366:
            raise ValueError("""All days elements should be less than 366"""   )

      UpperCamelCase      = set(__UpperCamelCase   )

      @functools.cache
      def dynamic_programming(__UpperCamelCase   ) -> int:
            if index > 365:
                  return 0

            if index not in days_set:
                  return dynamic_programming(index + 1   )

            return min(
                costs[0] + dynamic_programming(index + 1   )		,						costs[1] + dynamic_programming(index + 7   )		,						costs[2] + dynamic_programming(index + 30   )		,						)

      return dynamic_programming(1   )


if __name__ == "__main__":
     import doctest

     doctest.testmod()








'''simple docstring'''

from timeit import timeit







def    lowercase__			(				__UpperCamelCase   )->			int:
      if number < 0:
            raise ValueError("""the value of input must not be negative"""   )
      UpperCamelCase      = 0
      while number:
            number &= number - 1
            result += 1
      return result







def    lowercase__			(				__UpperCamelCase   )->			int:
      if number < 0:
            raise ValueError("""the value of input must not be negative"""   )
      UpperCamelCase      = 0
      while number:
            if number % 2 == 1:
                  result += 1
            number >>= 1
      return result







def    lowercase__			(				)->			None:

      def do_benchmark(__UpperCamelCase   ) -> None:
            UpperCamelCase      = """import __main__ as z"""
            print(F"Benchmark when {number = }:"   )
            print(F"{get_set_bits_count_using_modulo_operator(__UpperCamelCase   ) = }"   )
            UpperCamelCase      = timeit("""z.get_set_bits_count_using_modulo_operator(25)"""		,						setup=__UpperCamelCase   )
            print(F"timeit() runs in {timing} seconds"   )
            print(F"{get_set_bits_count_using_brian_kernighans_algorithm(__UpperCamelCase   ) = }"   )
            UpperCamelCase      = timeit(
                """z.get_set_bits_count_using_brian_kernighans_algorithm(25)"""		,						setup=__UpperCamelCase		,						)
            print(F"timeit() runs in {timing} seconds"   )

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


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     benchmark()
