


'''simple docstring'''
def 					lowerCamelCase_ ( __UpperCamelCase					:       list[int]		)					->	list[list[int]]:







     """simple docstring"""
     _A				=							[]
     if len(__UpperCamelCase		) == 1:
          return [nums.copy()]
     for _ in range(len(__UpperCamelCase		)		):
          _A				=							nums.pop(0		)
          _A				=							permute(__UpperCamelCase		)
          for perm in permutations:
               perm.append(__UpperCamelCase		)
          result.extend(__UpperCamelCase		)
          nums.append(__UpperCamelCase		)
     return result

def 					lowerCamelCase_ ( __UpperCamelCase					:       List[str]		)					->	Dict:







     """simple docstring"""

     def backtrack(__UpperCamelCase					:       str		):
          if start == len(__UpperCamelCase		) - 1:
               output.append(nums[:]		)
          else:
               for i in range(__UpperCamelCase							,    len(__UpperCamelCase		)		):
                    _A		,				_A				=							nums[i], nums[start]
                    backtrack(start + 1		)
                    _A		,				_A				=							nums[i], nums[start]  # backtrack

     _A				=							[]
     backtrack(0		)
     return output


if __name__ == "__main__":
    import doctest

    # use res to print the data in permute2 function
    lowerCAmelCase						=					permutea([1, 2, 3])
    print(res)
    doctest.testmod()









'''simple docstring'''
class        lowerCAmelCase_  :






       def __init__( self			,     _UpperCamelCase   )->      None:
            _A				=							size
            _A				=							[0] * size
            _A				=							[0] * size






       @staticmethod
       def   UpperCamelCase						( _UpperCamelCase   )->      int:
            return index | (index + 1)






       @staticmethod
       def   UpperCamelCase						( _UpperCamelCase   )->      int:
            return (index & (index + 1)) - 1






       def   UpperCamelCase						( self			,     _UpperCamelCase			,     _UpperCamelCase   )->      None:
            _A				=							value
            while index < self.size:
                 _A				=							self.get_prev(_UpperCamelCase   ) + 1
                 if current_left_border == index:
                      _A				=							value
                 else:
                      _A				=							max(_UpperCamelCase			,     _UpperCamelCase			,     _UpperCamelCase   )
                 _A				=							self.get_next(_UpperCamelCase   )






       def   UpperCamelCase						( self			,     _UpperCamelCase			,     _UpperCamelCase   )->      int:
            right -= 1  # Because of right is exclusive
            _A				=							0
            while left <= right:
                 _A				=							self.get_prev(_UpperCamelCase   )
                 if left <= current_left:
                      _A				=							max(_UpperCamelCase			,     self.tree[right]   )
                      _A				=							current_left
                 else:
                      _A				=							max(_UpperCamelCase			,     self.arr[right]   )
                      right -= 1
            return result


if __name__ == "__main__":
    import doctest

    doctest.testmod()





