





"""simple docstring"""
class 					_SCREAMING_SNAKE_CASE:




       def __init__(						self		,SCREAMING_SNAKE_CASE__							)			->      None:





             """simple docstring"""






             __SCREAMING_SNAKE_CASE   :Tuple						=  size
             __SCREAMING_SNAKE_CASE   :Dict						=  [0] * size
             __SCREAMING_SNAKE_CASE   :Optional[int]						=  [0] * size




       @staticmethod
       def     _UpperCamelCase     (						SCREAMING_SNAKE_CASE__							)			->      int:





             """simple docstring"""






             return index | (index + 1)




       @staticmethod
       def     _UpperCamelCase     (						SCREAMING_SNAKE_CASE__							)			->      int:





             """simple docstring"""






             return (index & (index + 1)) - 1




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





             """simple docstring"""






             __SCREAMING_SNAKE_CASE   :str						=  value
             while index < self.size:
                   __SCREAMING_SNAKE_CASE   :List[Any]						=  self.get_prev(SCREAMING_SNAKE_CASE__							) + 1
                   if current_left_border == index:
                         __SCREAMING_SNAKE_CASE   :Any						=  value
                   else:
                         __SCREAMING_SNAKE_CASE   :List[Any]						=  max(SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)
                   __SCREAMING_SNAKE_CASE   :str						=  self.get_next(SCREAMING_SNAKE_CASE__							)




       def     _UpperCamelCase     (						self		,SCREAMING_SNAKE_CASE__		,SCREAMING_SNAKE_CASE__							)			->      int:





             """simple docstring"""






             right -= 1  # Because of right is exclusive
             __SCREAMING_SNAKE_CASE   :Any						=  0
             while left <= right:
                   __SCREAMING_SNAKE_CASE   :str						=  self.get_prev(SCREAMING_SNAKE_CASE__							)
                   if left <= current_left:
                         __SCREAMING_SNAKE_CASE   :str						=  max(SCREAMING_SNAKE_CASE__		,self.tree[right]							)
                         __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  current_left
                   else:
                         __SCREAMING_SNAKE_CASE   :int						=  max(SCREAMING_SNAKE_CASE__		,self.arr[right]							)
                         right -= 1
             return result


if __name__ == "__main__":
  import doctest

  doctest.testmod()






"""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()