

"""simple docstring"""




from __future__ import annotations

__A	:       Tuple        =						'Alexander Joslin'
def   __SCREAMING_SNAKE_CASE		(		lowercase__ ):
					"""simple docstring"""

					if number <= 0:
										A     =   F"""n must be greater than 0. Got n = {number}"""
										raise ValueError(lowercase__ )

					A     =   [number + 1] * (number + 1)

					# starting position
					A     =   0
					for i in range(1     ,				lowercase__ ):
										A     =   min(table[i + 1]     ,				table[i] + 1 )
										# check if out of bounds
										if i * 2 <= number:
															A     =   min(table[i * 2]     ,				table[i] + 1 )
										# check if out of bounds
										if i * 3 <= number:
															A     =   min(table[i * 3]     ,				table[i] + 1 )
					return table[number]


if __name__ == "__main__":
	import doctest

	doctest.testmod()









from collections import Counter
from functools import total_ordering

from data_structures.heap.heap import Heap



@total_ordering
class 							lowercase__:






      '''simple docstring'''







      def __init__(		self   ,			__SCREAMING_SNAKE_CASE   ,			__SCREAMING_SNAKE_CASE)					->						None:







         """simple docstring"""







         UpperCamelCase__ :			Optional[int] 						=word
         UpperCamelCase__ :			Dict 						=count




      def __eq__(		self   ,			__SCREAMING_SNAKE_CASE)					->						bool:







         """simple docstring"""







         if not isinstance(__SCREAMING_SNAKE_CASE   ,			__SCREAMING_SNAKE_CASE):
            return NotImplemented
         return self.count == other.count




      def __lt__(		self   ,			__SCREAMING_SNAKE_CASE)					->						bool:







         """simple docstring"""







         if not isinstance(__SCREAMING_SNAKE_CASE   ,			__SCREAMING_SNAKE_CASE):
            return NotImplemented
         return self.count < other.count




def 	_lowerCamelCase  (		A_  :	list[str]							,  A_  :	int      )			->			list[str]:

   '''simple docstring'''






   UpperCamelCase__ :			Heap[WordCount] 						=Heap()
   UpperCamelCase__ :			Any 						=Counter(A_      )
   heap.build_max_heap(
       [WordCount(A_							,  A_      ) for word, count in count_by_word.items()]      )
   return [heap.extract_max().word for _ in range(min(A_							,  len(A_      )      )      )]


if __name__ == "__main__":
     import doctest

     doctest.testmod()

