






"""simple docstring"""





from __future__ import annotations

from collections.abc import Callable
from typing import Generic, TypeVar

_SCREAMING_SNAKE_CASE					:				Any					    =						TypeVar('''T''')
_SCREAMING_SNAKE_CASE					:				Tuple					    =						TypeVar('''U''')






class      a						(					Generic[T, U]		):






    def __init__(       self     :							Dict       ,						__SCREAMING_SNAKE_CASE     :							List[Any]       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]					)     ->		Any:
      lowerCamelCase_         =						key
      lowerCamelCase_         =						val
      lowerCamelCase_         =						None
      lowerCamelCase_         =						None






    def __repr__(       self     :							Optional[Any]					)     ->		Tuple:
      return (
          F'''Node: key: {self.key}, val: {self.val}, '''
          F'''has next: {bool(self.next					)}, has prev: {bool(self.prev					)}'''
      )






class      a						(					Generic[T, U]		):






    def __init__(       self     :							int					)     ->		Union[str, Any]:
      lowerCamelCase_         =						DoubleLinkedListNode(_a       ,						_a					)
      lowerCamelCase_         =						DoubleLinkedListNode(_a       ,						_a					)
      lowerCamelCase_         =						self.rear, self.head






    def __repr__(       self     :							Tuple					)     ->		List[Any]:
      lowerCamelCase_         =						["DoubleLinkedList"]
      lowerCamelCase_         =						self.head
      while node.next is not None:
        rep.append(str(_a					)					)
        lowerCamelCase_         =						node.next
      rep.append(str(self.rear					)					)
      return ",\n    ".join(_a					)






    def    UpperCamelCase       (       self     :							Any       ,						__SCREAMING_SNAKE_CASE     :							Optional[int]					)     ->		Union[str, Any]:
      lowerCamelCase_         =						self.rear.prev

      # All nodes other than self.head are guaranteed to have non-None previous
      assert previous is not None

      lowerCamelCase_         =						node
      lowerCamelCase_         =						previous
      lowerCamelCase_         =						node
      lowerCamelCase_         =						self.rear






    def    UpperCamelCase       (       self     :							Optional[int]       ,						__SCREAMING_SNAKE_CASE     :							int					)     ->		Optional[Any]:

      if node.prev is None or node.next is None:
        return None

      lowerCamelCase_         =						node.next
      lowerCamelCase_         =						node.prev
      lowerCamelCase_         =						None
      lowerCamelCase_         =						None
      return node






class      a						(					Generic[T, U]		):
    SCREAMING_SNAKE_CASE						:     List[str]						= {}






    def __init__(       self     :							Optional[Any]       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]					)     ->		Any:
      lowerCamelCase_         =						DoubleLinkedList()
      lowerCamelCase_         =						capacity
      lowerCamelCase_         =						0
      lowerCamelCase_         =						0
      lowerCamelCase_         =						0
      lowerCamelCase_         =						{}






    def __repr__(       self     :							Tuple					)     ->		Any:
      return (
          F'''CacheInfo(hits={self.hits}, misses={self.miss}, '''
          F'''capacity={self.capacity}, current size={self.num_keys})'''
      )






    def __contains__(       self     :							Dict       ,						__SCREAMING_SNAKE_CASE     :							Optional[Any]					)     ->		Optional[Any]:
      return key in self.cache






    def    UpperCamelCase       (       self     :							Optional[int]       ,						__SCREAMING_SNAKE_CASE     :							Tuple					)     ->		int:
      # Note: pythonic interface would throw KeyError rather than return None

      if key in self.cache:
        self.hits += 1
        lowerCamelCase_         =						self.cache[key]
        lowerCamelCase_         =						self.list.remove(self.cache[key]					)
        assert node == value_node

        # node is guaranteed not None because it is in self.cache
        assert node is not None
        self.list.add(_a					)
        return node.val
      self.miss += 1
      return None






    def    UpperCamelCase       (       self     :							Optional[int]       ,						__SCREAMING_SNAKE_CASE     :							Dict       ,						__SCREAMING_SNAKE_CASE     :							Dict					)     ->		Tuple:

      if key not in self.cache:
        if self.num_keys >= self.capacity:
          # delete first node (oldest) when over capacity
          lowerCamelCase_         =						self.list.head.next

          # guaranteed to have a non-None first node when num_keys > 0
          # explain to type checker via assertions
          assert first_node is not None
          assert first_node.key is not None
          assert (
              self.list.remove(_a					) is not None
          )  # node guaranteed to be in list assert node.key is not None

          del self.cache[first_node.key]
          self.num_keys -= 1
        lowerCamelCase_         =						DoubleLinkedListNode(_a       ,						_a					)
        self.list.add(self.cache[key]					)
        self.num_keys += 1

      else:
        # bump node to the end of the list, update value
        lowerCamelCase_         =						self.list.remove(self.cache[key]					)
        assert node is not None  # node guaranteed to be in list
        lowerCamelCase_         =						value
        self.list.add(_a					)






    @classmethod
    def    UpperCamelCase       (       cls     :							List[Any]       ,						__SCREAMING_SNAKE_CASE     :							Dict = 128					)     ->		int:

      def cache_decorator_inner(__SCREAMING_SNAKE_CASE     :							Optional[int]					) -> Callable[..., U]:
        def cache_decorator_wrapper(*__SCREAMING_SNAKE_CASE     :							List[Any]					) -> U:
          if func not in cls.decorator_function_to_instance_map:
            lowerCamelCase_         =						LRUCache(_a					)

          lowerCamelCase_         =						cls.decorator_function_to_instance_map[func].get(args[0]					)
          if result is None:
            lowerCamelCase_         =						func(*_a					)
            cls.decorator_function_to_instance_map[func].put(args[0]       ,						_a					)
          return result

        def cache_info() -> LRUCache[T, U]:
          return cls.decorator_function_to_instance_map[func]

        setattr(_a       ,						'cache_info'       ,						_a					)  # noqa: B010

        return cache_decorator_wrapper

      return cache_decorator_inner


if __name__ == "__main__":
  import doctest

  doctest.testmod()






"""simple docstring"""




from __future__ import annotations


def   __magic_name__	(      __snake_case				:       list[int]  ) ->				list[int]:
       if len(__snake_case  ) == 0:
              return array

       lowercase		,    lowercase    :				Tuple       		=							min(__snake_case  ), max(__snake_case  )

       # Compute the variables
       lowercase    :				Optional[Any]       		=							_max - _min + 1
       lowercase		,    lowercase    :				List[str]       		=							[0] * holes_range, [0] * holes_range

       # Make the sorting.
       for i in array:
              lowercase    :				Tuple       		=							i - _min
              lowercase    :				str       		=							i
              holes_repeat[index] += 1

       # Makes the array back by replacing the numbers.
       lowercase    :				Union[str, Any]       		=							0
       for i in range(__snake_case  ):
              while holes_repeat[i] > 0:
                     lowercase    :				Tuple       		=							holes[i]
                     index += 1
                     holes_repeat[i] -= 1

    # Returns the sorted array.
       return array


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   _A			:       str   		=       input("""Enter numbers separated by comma:\n""")
   _A			:       Optional[Any]   		=       [int(x) for x in user_input.split(""",""")]
   print(pigeon_sort(unsorted))


