




"""simple docstring"""







import os
import string
import sys


a      =							1 << 8

a      =							{
    'tab': ord('\t'),
    'newline': ord('\r'),
    'esc': 2_7,
    'up': 6_5 + ARROW_KEY_FLAG,
    'down': 6_6 + ARROW_KEY_FLAG,
    'right': 6_7 + ARROW_KEY_FLAG,
    'left': 6_8 + ARROW_KEY_FLAG,
    'mod_int': 9_1,
    'undefined': sys.maxsize,
    'interrupt': 3,
    'insert': 5_0,
    'delete': 5_1,
    'pg_up': 5_3,
    'pg_down': 5_4,
}

a      =							KEYMAP['up']
a      =							KEYMAP['left']

if sys.platform == "win32":
		a      =							[]
		a      =							{
		    b'\xe0H': KEYMAP['up'] - ARROW_KEY_FLAG,
		    b'\x00H': KEYMAP['up'] - ARROW_KEY_FLAG,
		    b'\xe0P': KEYMAP['down'] - ARROW_KEY_FLAG,
		    b'\x00P': KEYMAP['down'] - ARROW_KEY_FLAG,
		    b'\xe0M': KEYMAP['right'] - ARROW_KEY_FLAG,
		    b'\x00M': KEYMAP['right'] - ARROW_KEY_FLAG,
		    b'\xe0K': KEYMAP['left'] - ARROW_KEY_FLAG,
		    b'\x00K': KEYMAP['left'] - ARROW_KEY_FLAG,
		}

for i in range(1_0):
		a      =							ord(str(i))





def 							lowercase					()     ->  str:


				'''simple docstring'''






				if os.name == "nt":
								import msvcrt

								lowerCAmelCase  =				"""mbcs"""
								# Flush the keyboard buffer
								while msvcrt.kbhit():
												msvcrt.getch()
								if len(snake_case__ ) == 0:
												# Read the keystroke
												lowerCAmelCase  =				msvcrt.getch()

												# If it is a prefix char, get second part
												if ch in (b"\x00", b"\xe0"):
																lowerCAmelCase  =				ch + msvcrt.getch()
																# Translate actual Win chars to bullet char types
																try:
																				lowerCAmelCase  =				chr(WIN_KEYMAP[cha] )
																				WIN_CH_BUFFER.append(chr(KEYMAP["""mod_int"""] ) )
																				WIN_CH_BUFFER.append(snake_case__ )
																				if ord(snake_case__ ) in (
																				    KEYMAP["insert"] - 1 << 9,
																				    KEYMAP["delete"] - 1 << 9,
																				    KEYMAP["pg_up"] - 1 << 9,
																				    KEYMAP["pg_down"] - 1 << 9,
																				):
																								WIN_CH_BUFFER.append(chr(126 ) )
																				lowerCAmelCase  =				chr(KEYMAP["""esc"""] )
																except KeyError:
																				lowerCAmelCase  =				cha[1]
												else:
																lowerCAmelCase  =				ch.decode(snake_case__ )
								else:
												lowerCAmelCase  =				WIN_CH_BUFFER.pop(0 )
				elif os.name == "posix":
								import termios
								import tty

								lowerCAmelCase  =				sys.stdin.fileno()
								lowerCAmelCase  =				termios.tcgetattr(snake_case__ )
								try:
												tty.setraw(snake_case__ )
												lowerCAmelCase  =				sys.stdin.read(1 )
								finally:
												termios.tcsetattr(snake_case__      ,       termios.TCSADRAIN      ,       snake_case__ )
				return ch






def 							lowercase					()     ->  List[str]:


				'''simple docstring'''






				lowerCAmelCase  =				get_raw_chars()
				if ord(snake_case__ ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
								return char

				elif ord(snake_case__ ) == KEYMAP["esc"]:
								lowerCAmelCase  =				get_raw_chars()
								if ord(snake_case__ ) == KEYMAP["mod_int"]:
												lowerCAmelCase  =				get_raw_chars()
												if ord(snake_case__ ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(snake_case__ ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
																return chr(ord(snake_case__ ) + ARROW_KEY_FLAG )
												else:
																return KEYMAP["undefined"]
								else:
												return get_raw_chars()

				else:
								if char in string.printable:
												return char
								else:
												return KEYMAP["undefined"]











"""simple docstring"""







from __future__ import annotations





def 							lowercase					(snake_case__   : list[int]      ,       snake_case__   : int      ,       snake_case__   : int      ,       snake_case__   : int )     ->  None:


				'''simple docstring'''






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





def 							lowercase					(snake_case__   : list[int]      ,       snake_case__   : int      ,       snake_case__   : int      ,       snake_case__   : int )     ->  None:


				'''simple docstring'''






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





def 							lowercase					(snake_case__   : list[int]      ,       snake_case__   : int      ,       snake_case__   : int      ,       snake_case__   : int )     ->  None:


				'''simple docstring'''






				if length > 1:
								lowerCAmelCase  =				int(length / 2 )
								bitonic_sort(snake_case__      ,       snake_case__      ,       snake_case__      ,       1 )
								bitonic_sort(snake_case__      ,       low + middle      ,       snake_case__      ,       0 )
								bitonic_merge(snake_case__      ,       snake_case__      ,       snake_case__      ,       snake_case__ )


if __name__ == "__main__":
		a      =							input('Enter numbers separated by a comma:\n').strip()
		a      =							[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=', ')





