
'''simple docstring'''

def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 for i in range(len(lowerCamelCase_			) - 1      ,			0      ,			-1			):
  lowerCAmelCase__     :   List[Any]     		=	False

  for j in range(lowerCamelCase_      ,			0      ,			-1			):
   if unsorted[j] < unsorted[j - 1]:
    lowerCAmelCase__		,     lowerCAmelCase__     :   Tuple     		=	unsorted[j - 1], unsorted[j]
    lowerCAmelCase__     :   str     		=	True

  for j in range(lowerCamelCase_			):
   if unsorted[j] > unsorted[j + 1]:
    lowerCAmelCase__		,     lowerCAmelCase__     :   List[Any]     		=	unsorted[j + 1], unsorted[j]
    lowerCAmelCase__     :   Dict     		=	True

  if not swapped:
   break
 return unsorted


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     snake_case									=    input("""Enter numbers separated by a comma:\n""").strip()
     snake_case									=    [int(item) for item in user_input.split(""",""")]
     print(f'{cocktail_shaker_sort(unsorted) = }')







'''simple docstring'''

def        UpperCAmelCase_ (  lowerCamelCase_			):







 """simple docstring"""


 lowerCAmelCase__     :   str     		=	len(lowerCamelCase_			)
 lowerCAmelCase__     :   Optional[Any]     		=	len(matrix[0]			)
 lowerCAmelCase__     :   Any     		=	min(lowerCamelCase_      ,			lowerCamelCase_			)

 for row in range(lowerCamelCase_			):
  # Check if diagonal element is not zero
  if matrix[row][row] != 0:
   # Eliminate all the elements below the diagonal
   for col in range(row + 1      ,			lowerCamelCase_			):
    lowerCAmelCase__     :   Tuple     		=	matrix[col][row] / matrix[row][row]
    for i in range(lowerCamelCase_      ,			lowerCamelCase_			):
     matrix[col][i] -= multiplier * matrix[row][i]
  else:
   # Find a non-zero diagonal element to swap rows
   lowerCAmelCase__     :   Dict     		=	True
   for i in range(row + 1      ,			lowerCamelCase_			):
    if matrix[i][row] != 0:
     lowerCAmelCase__		,     lowerCAmelCase__     :   Optional[Any]     		=	matrix[i], matrix[row]
     lowerCAmelCase__     :   Optional[Any]     		=	False
     break
   if reduce:
    rank -= 1
    for i in range(lowerCamelCase_			):
     lowerCAmelCase__     :   Union[str, Any]     		=	matrix[i][rank]

            # Reduce the row pointer by one to stay on the same row
   row -= 1

 return rank


if __name__ == "__main__":
     import doctest

     doctest.testmod()





