"""simple docstring"""
from timeit import timeit





def 				lowerCAmelCase__      (     _UpperCamelCase    :			int   )   ->			Any:





						"""simple docstring"""






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





def 				lowerCAmelCase__      (     _UpperCamelCase    :			int   )   ->			Any:





						"""simple docstring"""






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





def 				lowerCAmelCase__      (     )   ->			str:





						"""simple docstring"""






						def do_benchmark(_UpperCamelCase    :			int   ) -> None:
												snake_case        =     'import __main__ as z'
												print(f"""Benchmark when {number = }:"""   )
												print(f"""{get_set_bits_count_using_modulo_operator(__lowerCAmelCase   ) = }"""   )
												snake_case        =     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   ) = }"""   )
												snake_case        =     timeit(
												    'z.get_set_bits_count_using_brian_kernighans_algorithm(25)'	,     setup=__lowerCAmelCase	,     )
												print(f"""timeit() runs in {timing} seconds"""   )

						for number in (2_5, 3_7, 5_8, 0):
												do_benchmark(__lowerCAmelCase   )
												print()


if __name__ == "__main__":
					import doctest

					doctest.testmod()
					benchmark()



"""simple docstring"""
from __future__ import annotations

from typing import Any



class 					lowerCAmelCase_      (     lowerCAmelCase   ):



				"""simple docstring"""
				pass





class 					lowerCAmelCase_      :



				"""simple docstring"""

				def __init__(			self						,      lowerCAmelCase      ):






										"""simple docstring"""

										snake_case        =     data
										snake_case        =     None

				def __iter__(			self      ):






										"""simple docstring"""

										snake_case        =     self
										snake_case        =     []
										while node:
																if node in visited:
																						raise ContainsLoopError
																visited.append(lowerCAmelCase      )
																yield node.data
																snake_case        =     node.next_node

				@property
				def 						snake_case	(			self      ):






										"""simple docstring"""

										try:
																list(self      )
																return False
										except ContainsLoopError:
																return True


if __name__ == "__main__":
					SCREAMING_SNAKE_CASE__   =					Node(1)
					SCREAMING_SNAKE_CASE__   =					Node(2)
					SCREAMING_SNAKE_CASE__   =					Node(3)
					SCREAMING_SNAKE_CASE__   =					Node(4)
					print(root_node.has_loop)  # False
					SCREAMING_SNAKE_CASE__   =					root_node.next_node
					print(root_node.has_loop)  # True

					SCREAMING_SNAKE_CASE__   =					Node(5)
					SCREAMING_SNAKE_CASE__   =					Node(6)
					SCREAMING_SNAKE_CASE__   =					Node(5)
					SCREAMING_SNAKE_CASE__   =					Node(6)
					print(root_node.has_loop)  # False

					SCREAMING_SNAKE_CASE__   =					Node(1)
					print(root_node.has_loop)  # False


