






'''simple docstring'''

from __future__ import annotations

import requests







def    lowercase__			(				__UpperCamelCase   )->			dict:
      UpperCamelCase      = F"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"
      return requests.get(__UpperCamelCase   ).json()







def    lowercase__			(				__UpperCamelCase = 10   )->			list[dict]:
      UpperCamelCase      = """https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"""
      UpperCamelCase      = requests.get(__UpperCamelCase   ).json()[:max_stories]
      return [get_hackernews_story(__UpperCamelCase   ) for story_id in story_ids]







def    lowercase__			(				__UpperCamelCase = 10   )->			str:
      UpperCamelCase      = hackernews_top_stories(__UpperCamelCase   )
      return "\n".join("""* [{title}]({url})""".format(**__UpperCamelCase   ) for story in stories   )


if __name__ == "__main__":
     print(hackernews_top_stories_as_markdown())








'''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()
