
from __future__ import annotations


def       A__      (    __lowerCamelCase,   __lowerCamelCase		):
   SCREAMING_SNAKE_CASE_     =	position
   SCREAMING_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),
   ]
   SCREAMING_SNAKE_CASE_     =	[]

   for position in positions:
      SCREAMING_SNAKE_CASE_     =	position
      if 0 <= y_test < n and 0 <= x_test < n:
         permissible_positions.append(__lowerCamelCase		)

   return permissible_positions


def       A__      (    __lowerCamelCase		):
   return not any(elem == 0 for row in board for elem in row		)


def       A__      (    __lowerCamelCase,   __lowerCamelCase,   __lowerCamelCase		):





   if is_complete(__lowerCamelCase		):
      return True

   for position in get_valid_pos(__lowerCamelCase,   len(__lowerCamelCase		)		):
      SCREAMING_SNAKE_CASE_     =	position

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

   return False


def       A__      (    __lowerCamelCase		):
   SCREAMING_SNAKE_CASE_     =	[[0 for i in range(__lowerCamelCase		)] for j in range(__lowerCamelCase		)]

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

   SCREAMING_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()







'''simple docstring'''





def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  Tuple							      =					abs(UpperCamelCase			)
    lowerCAmelCase__ :  List[Any]							      =					0
    while n > 0:
        res += n % 10
        n //= 10
    return res
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    lowerCAmelCase__ :  Union[str, Any]							      =					abs(UpperCamelCase			)
    return n if n < 10 else n % 10 + sum_of_digits(n // 10			)
def    _SCREAMING_SNAKE_CASE  (       UpperCamelCase			):



    """simple docstring"""





    return sum(int(UpperCamelCase			) for c in str(abs(UpperCamelCase			)			)			)
def    _SCREAMING_SNAKE_CASE  (       ):



    """simple docstring"""





    from collections.abc import Callable
    from timeit import timeit

    def benchmark_a_function(UpperCamelCase							,    UpperCamelCase			) -> None:
        lowerCAmelCase__ :  str							      =					f"""{func.__name__}({value})"""
        lowerCAmelCase__ :  str							      =					timeit(f"""__main__.{call}"""							,    setup="""import __main__"""			)
        print(f"""{call:56} = {func(UpperCamelCase			)} -- {timing:.4f} seconds"""			)

    for value in (262144, 1125899906842624, 1267650600228229401496703205376):
        for func in (sum_of_digits, sum_of_digits_recursion, sum_of_digits_compact):
            benchmark_a_function(UpperCamelCase							,    UpperCamelCase			)
        print()


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 benchmark()


