


'''simple docstring'''



import unittest

import numpy as np




def 			_a			(		_lowercase      :			np.ndarray    ,      _lowercase      :			np.ndarray    ,      _lowercase      :			np.ndarray    ,      _lowercase      :			np.ndarray | None = None    ,      )     ->   Optional[Any]:





     '''simple docstring'''






     __UpperCAmelCase			:				List[str]													=    np.shape(_lowercase						)
     __UpperCAmelCase			:				List[Any]													=    np.shape(_lowercase						)
     __UpperCAmelCase			:				int													=    np.shape(_lowercase						)

     if shape_a[0] != shape_b[0]:
          __UpperCAmelCase			:				Optional[Any]													=    (
              '''Expected the same number of rows for A and B. '''
              F'Instead found A of size {shape_a} and B of size {shape_b}'
          )
          raise ValueError(_lowercase						)

     if shape_b[1] != shape_c[1]:
          __UpperCAmelCase			:				str													=    (
              '''Expected the same number of columns for B and C. '''
              F'Instead found B of size {shape_b} and C of size {shape_c}'
          )
          raise ValueError(_lowercase						)

     __UpperCAmelCase			:				Optional[Any]													=    pseudo_inv
     if a_inv is None:
          try:
               __UpperCAmelCase			:				List[Any]													=    np.linalg.inv(_lowercase						)
          except np.linalg.LinAlgError:
               raise ValueError(
                   '''Input matrix A is not invertible. Cannot compute Schur complement.'''						)

     return mat_c - mat_b.T @ a_inv @ mat_b



class 			a       (	unittest.TestCase ):


     """simple docstring"""






     def 				lowerCamelCase__				(       self  :	Optional[Any]    )		->							None:
          __UpperCAmelCase			:				List[str]													=    np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]    )
          __UpperCAmelCase			:				int													=    np.array([[0, 3], [3, 0], [2, 3]]    )
          __UpperCAmelCase			:				int													=    np.array([[2, 1], [6, 3]]    )

          __UpperCAmelCase			:				str													=    schur_complement(snake_case							,				snake_case							,				snake_case    )

          __UpperCAmelCase			:				Optional[int]													=    np.block([[a, b], [b.T, c]]    )

          __UpperCAmelCase			:				List[Any]													=    np.linalg.det(snake_case    )
          __UpperCAmelCase			:				int													=    np.linalg.det(snake_case    )
          __UpperCAmelCase			:				Tuple													=    np.linalg.det(snake_case    )

          self.assertAlmostEqual(snake_case							,				det_a * det_s    )

     def 				lowerCamelCase__				(       self  :	int    )		->							None:
          __UpperCAmelCase			:				Optional[int]													=    np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]    )
          __UpperCAmelCase			:				Any													=    np.array([[0, 3], [3, 0], [2, 3]]    )
          __UpperCAmelCase			:				Optional[int]													=    np.array([[2, 1], [6, 3]]    )

          with self.assertRaises(snake_case    ):
               schur_complement(snake_case							,				snake_case							,				snake_case    )






     def 				lowerCamelCase__				(       self  :	Union[str, Any]    )		->							None:
          __UpperCAmelCase			:				Tuple													=    np.array([[1, 2, 1], [2, 1, 2], [3, 2, 4]]    )
          __UpperCAmelCase			:				Any													=    np.array([[0, 3], [3, 0], [2, 3]]    )
          __UpperCAmelCase			:				Any													=    np.array([[2, 1, 3], [6, 3, 5]]    )

          with self.assertRaises(snake_case    ):
               schur_complement(snake_case							,				snake_case							,				snake_case    )


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      unittest.main()



'''simple docstring'''



def 			_a			(		_lowercase      :			List[str]						):





     '''simple docstring'''






     __UpperCAmelCase			:				int													=    len(_lowercase						)
     while cur > 1:
          # Find the maximum number in arr
          __UpperCAmelCase			:				Union[str, Any]													=    arr.index(max(arr[0:cur]						)						)
          # Reverse from 0 to mi
          __UpperCAmelCase			:				Any													=    arr[mi::-1] + arr[mi + 1 : len(_lowercase						)]
          # Reverse whole list
          __UpperCAmelCase			:				List[str]													=    arr[cur - 1 :: -1] + arr[cur : len(_lowercase						)]
          cur -= 1
     return arr


if __name__ == "__main__":
      __UpperCAmelCase    :Any				       =     input("Enter numbers separated by a comma:\n").strip()
      __UpperCAmelCase    :Optional[int]				       =     [int(item) for item in user_input.split(",")]
      print(pancake_sort(unsorted))