






from collections import Counter
from functools import total_ordering

from data_structures.heap.heap import Heap




@total_ordering
class        _lowerCAmelCase:





       """simple docstring"""







       def __init__(      self						,    _lowerCamelCase						,    _lowerCamelCase							):
         UpperCamelCase_:      Optional[Any]					   =       word
         UpperCamelCase_:      int					   =       count





       def __eq__(      self						,    _lowerCamelCase							):
         if not isinstance(_lowerCamelCase						,    _lowerCamelCase							):
           return NotImplemented
         return self.count == other.count





       def __lt__(      self						,    _lowerCamelCase							):
         if not isinstance(_lowerCamelCase						,    _lowerCamelCase							):
           return NotImplemented
         return self.count < other.count







def 						snake_case      (UpperCAmelCase__			,					UpperCAmelCase__						) ->       list[str]:
  UpperCamelCase_:      Heap[WordCount]					   =       Heap()
  UpperCamelCase_:      Tuple					   =       Counter(UpperCAmelCase__						)
  heap.build_max_heap(
      [WordCount(UpperCAmelCase__			,					UpperCAmelCase__						) for word, count in count_by_word.items()]						)
  return [heap.extract_max().word for _ in range(min(UpperCAmelCase__			,					len(UpperCAmelCase__						)						)						)]


if __name__ == "__main__":
   import doctest

   doctest.testmod()







def 						snake_case      (UpperCAmelCase__ = 4_0_0_0_0_0_0						) ->       int:

  if n <= 1:
    return 0
  UpperCamelCase_:      Dict					   =       0
  UpperCamelCase_:      Union[str, Any]					   =       2
  UpperCamelCase_:      int					   =       0
  while 4 * b + a <= n:
    UpperCamelCase_   ,UpperCamelCase_:      List[str]					   =       b, 4 * b + a
    count += a
  return count + b


if __name__ == "__main__":
   print(F'''{solution() = }''')