


from __future__ import annotations





def 	_lowerCAmelCase       (    _lowerCAmelCase      ,	_lowerCAmelCase )						->	list[tuple[int, int]]:


						'''simple docstring'''






						__snake_case		,					__snake_case				=		position
						__snake_case				=		[
						    (y + 1, x + 2),
						    (y - 1, x + 2),
						    (y + 1, x - 2),
						    (y - 1, x - 2),
						    (y + 2, x + 1),
						    (y + 2, x - 1),
						    (y - 2, x + 1),
						    (y - 2, x - 1),
						]
						__snake_case				=		[]

						for position in positions:
												__snake_case		,					__snake_case				=		position
												if 0 <= y_test < n and 0 <= x_test < n:
																		permissible_positions.append(_lowerCAmelCase )

						return permissible_positions





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	bool:


						'''simple docstring'''






						return not any(elem == 0 for row in board for elem in row )





def 	_lowerCAmelCase       (    _lowerCAmelCase      ,	_lowerCAmelCase      ,	_lowerCAmelCase )						->	bool:


						'''simple docstring'''






						if is_complete(_lowerCAmelCase ):
												return True

						for position in get_valid_pos(_lowerCAmelCase      ,	len(_lowerCAmelCase ) ):
												__snake_case		,					__snake_case				=		position

												if board[y][x] == 0:
																		__snake_case				=		curr + 1
																		if open_knight_tour_helper(_lowerCAmelCase      ,	_lowerCAmelCase      ,	curr + 1 ):
																								return True
																		__snake_case				=		0

						return False





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	list[list[int]]:


						'''simple docstring'''






						__snake_case				=		[[0 for i in range(_lowerCAmelCase )] for j in range(_lowerCAmelCase )]

						for i in range(_lowerCAmelCase ):
												for j in range(_lowerCAmelCase ):
																		__snake_case				=		1
																		if open_knight_tour_helper(_lowerCAmelCase      ,	(i, j)      ,	1 ):
																								return board
																		__snake_case				=		0

						__snake_case				=		F'''Open Kight Tour cannot be performed on a board of size {n}'''
						raise ValueError(_lowerCAmelCase )


if __name__ == "__main__":
	import doctest

	doctest.testmod()









from __future__ import annotations





def 	_lowerCAmelCase       (    _lowerCAmelCase )						->	list:


						'''simple docstring'''






						if len(_lowerCAmelCase ) == 0:
												return []
						__snake_case		,					__snake_case				=		min(_lowerCAmelCase ), max(_lowerCAmelCase )
						__snake_case				=		int(max_value - min_value ) + 1
						__snake_case				=		[[] for _ in range(_lowerCAmelCase )]

						for i in my_list:
												buckets[int(i - min_value )].append(_lowerCAmelCase )

						return [v for bucket in buckets for v in sorted(_lowerCAmelCase )]


if __name__ == "__main__":
	from doctest import testmod

	testmod()
	assert bucket_sort([4, 5, 3, 2, 1]) == [1, 2, 3, 4, 5]
	assert bucket_sort([0, 1, -10, 15, 2, -2]) == [-10, -2, 0, 1, 2, 15]





