
'''simple docstring'''


from heapq import heappop, heappush

import numpy as np




def lowercase_	(   _lowercase			,       _lowercase			,       _lowercase			,       _lowercase			,       )     ->							tuple[float | int, list[tuple[int, int]]]:
					'''simple docstring'''

					lowerCamelCase_,      lowerCamelCase_					:      int     =		grid.shape
					lowerCamelCase_					:      List[Any]     =		[-1, 1, 0, 0]
					lowerCamelCase_					:      List[Any]     =		[0, 0, -1, 1]
					if allow_diagonal:
										dx += [-1, -1, 1, 1]
										dy += [-1, 1, -1, 1]

					lowerCamelCase_,      lowerCamelCase_					:      str     =		[(0, source)], set()
					lowerCamelCase_					:      Optional[int]     =		np.full((rows, cols)			,       np.inf				)
					lowerCamelCase_					:      List[str]     =		0
					lowerCamelCase_					:      List[Any]     =		np.empty((rows, cols)			,       dtype=_lowercase				)
					lowerCamelCase_					:      Optional[Any]     =		None

					while queue:
										((lowerCamelCase_),      (lowerCamelCase_))					:      int     =		heappop(_lowercase				)
										if (x, y) in visited:
															continue
										visited.add((x, y)				)

										if (x, y) == destination:
															lowerCamelCase_					:      str     =		[]
															while (x, y) != source:
																				path.append((x, y)				)
																				lowerCamelCase_,      lowerCamelCase_					:      Tuple     =		predecessors[x, y]
															path.append(_lowercase				)  # add the source manually
															path.reverse()
															return matrix[destination], path

										for i in range(len(_lowercase				)				):
															lowerCamelCase_,      lowerCamelCase_					:      Any     =		x + dx[i], y + dy[i]
															if 0 <= nx < rows and 0 <= ny < cols:
																				lowerCamelCase_					:      Optional[Any]     =		grid[nx][ny]
																				if next_node == 1 and matrix[nx, ny] > dist + 1:
																									heappush(_lowercase			,       (dist + 1, (nx, ny))				)
																									lowerCamelCase_					:      Optional[Any]     =		dist + 1
																									lowerCamelCase_					:      Optional[int]     =		(x, y)

					return np.inf, []


if __name__ == "__main__":
					import doctest

					doctest.testmod()




'''simple docstring'''


from __future__ import annotations




def lowercase_	(   _lowercase			,       _lowercase			,       _lowercase			,       _lowercase				)     ->							None:
					'''simple docstring'''

					if (direction == 1 and array[indexa] > array[indexa]) or (
					    direction == 0 and array[indexa] < array[indexa]
					):
										lowerCamelCase_,      lowerCamelCase_					:      str     =		array[indexa], array[indexa]




def lowercase_	(   _lowercase			,       _lowercase			,       _lowercase			,       _lowercase				)     ->							None:
					'''simple docstring'''

					if length > 1:
										lowerCamelCase_					:      int     =		int(length / 2				)
										for i in range(_lowercase			,       low + middle				):
															comp_and_swap(_lowercase			,       _lowercase			,       i + middle			,       _lowercase				)
										bitonic_merge(_lowercase			,       _lowercase			,       _lowercase			,       _lowercase				)
										bitonic_merge(_lowercase			,       low + middle			,       _lowercase			,       _lowercase				)




def lowercase_	(   _lowercase			,       _lowercase			,       _lowercase			,       _lowercase				)     ->							None:
					'''simple docstring'''

					if length > 1:
										lowerCamelCase_					:      Dict     =		int(length / 2				)
										bitonic_sort(_lowercase			,       _lowercase			,       _lowercase			,       1				)
										bitonic_sort(_lowercase			,       low + middle			,       _lowercase			,       0				)
										bitonic_merge(_lowercase			,       _lowercase			,       _lowercase			,       _lowercase				)


if __name__ == "__main__":
					__lowercase							:   Any					=     input('''Enter numbers separated by a comma:\n''').strip()
					__lowercase							:   Tuple					=     [int(item.strip()) for item in user_input.split(''',''')]

					bitonic_sort(unsorted, 0, len(unsorted), 1)
					print('''\nSorted array in ascending order is: ''', end='''''')
					print(*unsorted, sep=''', ''')

					bitonic_merge(unsorted, 0, len(unsorted), 0)
					print('''Sorted array in descending order is: ''', end='''''')
					print(*unsorted, sep=''', ''')


