





"""simple docstring"""
from collections import deque

from .hash_table import HashTable






class 					_SCREAMING_SNAKE_CASE(   A  ):




       def __init__(						self		,*SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)			->      str:





             """simple docstring"""






             super().__init__(*SCREAMING_SNAKE_CASE__		,**SCREAMING_SNAKE_CASE__							)




       def     _UpperCamelCase     (						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)			->      List[str]:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE   :List[str]						=  deque([]							) if self.values[key] is None else self.values[key]
             self.values[key].appendleft(SCREAMING_SNAKE_CASE__							)
             __SCREAMING_SNAKE_CASE   :Optional[Any]						=  self.values[key]




       def     _UpperCamelCase     (						self							)			->      Any:





             """simple docstring"""






             return (
                 sum(self.charge_factor - len(SCREAMING_SNAKE_CASE__							) for slot in self.values							)
                 / self.size_table
                 * self.charge_factor
             )




       def     _UpperCamelCase     (						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__=None							)			->      Tuple:





             """simple docstring"""






             if not (
                 len(self.values[key]							) == self.charge_factor and self.values.count(SCREAMING_SNAKE_CASE__							) == 0
             ):
                   return key
             return super()._collision_resolution(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)






"""simple docstring"""
def      __lowerCamelCase   (							a_     :		int ,   a_     :		str							)			->      Optional[int]:
      __SCREAMING_SNAKE_CASE   :Optional[int]						=  [1]
      for i in range(2 ,   a_							):
            factorials.append(factorials[-1] * i							)
      assert 0 <= k < factorials[-1] * n, "k out of bounds"

      __SCREAMING_SNAKE_CASE   :List[str]						=  []
      __SCREAMING_SNAKE_CASE   :Optional[Any]						=  list(range(a_							)							)

      # Find permutation
      while factorials:
            __SCREAMING_SNAKE_CASE   :Optional[int]						=  factorials.pop()
            __SCREAMING_SNAKE_CASE				,__SCREAMING_SNAKE_CASE   :Dict						=  divmod(a_ ,   a_							)
            permutation.append(elements[number]							)
            elements.remove(elements[number]							)
      permutation.append(elements[0]							)

      return permutation


if __name__ == "__main__":
  import doctest

  doctest.testmod()