




"""simple docstring"""




import builtins
import sys

from ...utils.imports import _is_package_available
from . import cursor, input
from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor
from .keymap import KEYMAP


lowerCAmelCase							:			Dict     							=							False
try:
					lowerCAmelCase							:			List[str]     							=							_is_package_available("""google.colab""")
except ModuleNotFoundError:
					pass






@input.register
class     __magic_name__							:






				'''simple docstring'''





				def __init__(       self		, _a = None		, _a = [] ):





							"""simple docstring"""
							lowerCamelCase			      =					0
							lowerCamelCase			      =					choices
							lowerCamelCase			      =					prompt
							if sys.platform == "win32":
										lowerCamelCase			      =					"""*"""
							else:
										lowerCamelCase			      =					"""➔ """





				def    _lowerCAmelCase				(       self		, _a		, _a = "" ):





							"""simple docstring"""
							if sys.platform != "win32":
										writeColor(self.choices[index]		, 32		, A__ )
							else:
										forceWrite(self.choices[index]		, A__ )





				def    _lowerCAmelCase				(       self		, _a ):





							"""simple docstring"""
							if index == self.position:
										forceWrite(f' {self.arrow_char} ' )
										self.write_choice(A__ )
							else:
										forceWrite(f'    {self.choices[index]}' )
							reset_cursor()





				def    _lowerCAmelCase				(       self		, _a		, _a = 1 ):





							"""simple docstring"""
							lowerCamelCase			      =					self.position
							if direction == Direction.DOWN:
										if self.position + 1 >= len(self.choices ):
													return
										self.position += num_spaces
							else:
										if self.position - 1 < 0:
													return
										self.position -= num_spaces
							clear_line()
							self.print_choice(A__ )
							move_cursor(A__		, direction.name )
							self.print_choice(self.position )





				@input.mark(KEYMAP["""up"""] )
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							self.move_direction(Direction.UP )





				@input.mark(KEYMAP["""down"""] )
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							self.move_direction(Direction.DOWN )





				@input.mark(KEYMAP["""newline"""] )
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							move_cursor(len(self.choices ) - self.position		, """DOWN""" )
							return self.position





				@input.mark(KEYMAP["""interrupt"""] )
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							move_cursor(len(self.choices ) - self.position		, """DOWN""" )
							raise KeyboardInterrupt





				@input.mark_multiple(*[KEYMAP[str(A__ )] for number in range(10 )] )
				def    _lowerCAmelCase				(       self ):





							"""simple docstring"""
							lowerCamelCase			      =					int(chr(self.current_selection ) )
							lowerCamelCase			      =					index - self.position
							if index == self.position:
										return
							if index < len(self.choices ):
										if self.position > index:
													self.move_direction(Direction.UP		, -movement )
										elif self.position < index:
													self.move_direction(Direction.DOWN		, A__ )
										else:
													return
							else:
										return





				def    _lowerCAmelCase				(       self		, _a = 0 ):





							"""simple docstring"""
							if self.prompt:
										linebreak()
										forceWrite(self.prompt		, """\n""" )
										if in_colab:
													forceWrite("""Please input a choice index (starting from 0), and press enter"""		, """\n""" )
										else:
													forceWrite("""Please select a choice using the arrow or number keys, and selecting with enter"""		, """\n""" )
							lowerCamelCase			      =					default_choice
							for i in range(len(self.choices ) ):
										self.print_choice(A__ )
										forceWrite("""\n""" )
							move_cursor(len(self.choices ) - self.position		, """UP""" )
							with cursor.hide():
										while True:
													if in_colab:
																try:
																			lowerCamelCase			      =					int(builtins.input() )
																except ValueError:
																			lowerCamelCase			      =					default_choice
													else:
																lowerCamelCase			      =					self.handle_input()
													if choice is not None:
																reset_cursor()
																for _ in range(len(self.choices ) + 1 ):
																			move_cursor(1		, """UP""" )
																			clear_line()
																self.write_choice(A__		, """\n""" )
																return choice






from math import factorial

def 						UpperCamelCase					(lowercase_: int = 20					)     ->      int:
	A__							:    Union[str, Any]        =		2 * n  # middle entry of odd rows starting at row 3 is the solution for n = 1,
	# 2, 3,...
	A__							:    Tuple        =		n // 2

	return int(factorial(lowercase_					) / (factorial(lowercase_					) * factorial(n - k					))					)


if __name__ == "__main__":
	import sys

	if len(sys.argv) == 1:
		print(solution(20))
	else:
		try:
			A_       : List[str]         =			int(sys.argv[1])
			print(solution(n))
		except ValueError:
			print('Invalid entry - please enter a number.')



