
from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
lowercase  :					Optional[int]						    =							10







def 						_snake_case(  SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__				) ->    str:
       for i in range(_UpperCAmelCase					,	_UpperCAmelCase				):
              if array[i] == target:
                     return i
       return -1







def 						_snake_case(  SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__				) ->    Optional[int]:
       lowercase							:     Optional[int]       	=      0
       lowercase							:     str       	=      len(_UpperCAmelCase				)
       while left <= right:
              if right - left < precision:
                     return lin_search(_UpperCAmelCase					,	_UpperCAmelCase					,	_UpperCAmelCase					,	_UpperCAmelCase				)

              lowercase							:     List[str]       	=      (left + right) // 3 + 1
              lowercase							:     Optional[Any]       	=      2 * (left + right) // 3 + 1

              if array[one_third] == target:
                     return one_third
              elif array[two_third] == target:
                     return two_third

              elif target < array[one_third]:
                     lowercase							:     Optional[Any]       	=      one_third - 1
              elif array[two_third] < target:
                     lowercase							:     Dict       	=      two_third + 1

              else:
                     lowercase							:     List[Any]       	=      one_third + 1
                     lowercase							:     Any       	=      two_third - 1
       else:
              return -1







def 						_snake_case(  SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__					,	SCREAMING_SNAKE_CASE__				) ->    Optional[int]:
       if left < right:
              if right - left < precision:
                     return lin_search(_UpperCAmelCase					,	_UpperCAmelCase					,	_UpperCAmelCase					,	_UpperCAmelCase				)
              lowercase							:     str       	=      (left + right) // 3 + 1
              lowercase							:     int       	=      2 * (left + right) // 3 + 1

              if array[one_third] == target:
                     return one_third
              elif array[two_third] == target:
                     return two_third

              elif target < array[one_third]:
                     return rec_ternary_search(_UpperCAmelCase					,	one_third - 1					,	_UpperCAmelCase					,	_UpperCAmelCase				)
              elif array[two_third] < target:
                     return rec_ternary_search(two_third + 1					,	_UpperCAmelCase					,	_UpperCAmelCase					,	_UpperCAmelCase				)
              else:
                     return rec_ternary_search(one_third + 1					,	two_third - 1					,	_UpperCAmelCase					,	_UpperCAmelCase				)
       else:
              return -1


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  lowercase  :					int						    =							input("""Enter numbers separated by comma:\n""").strip()
  lowercase  :					Any						    =							[int(item.strip()) for item in user_input.split(""",""")]
  assert collection == sorted(collection), F"List must be ordered.\n{collection}."
  lowercase  :					Optional[int]						    =							int(input("""Enter the number to be found in the list:\n""").strip())
  lowercase  :					List[Any]						    =							ite_ternary_search(collection, target)
  lowercase  :					Dict						    =							rec_ternary_search(0, len(collection) - 1, collection, target)
  if resulta != -1:
    print(F'''Iterative search: {target} found at positions: {resulta}''')
    print(F'''Recursive search: {target} found at positions: {resulta}''')
  else:
    print("""Not found""")



import math
import sys







def 			A_      (    _UpperCAmelCase    ):
						if number != int(_UpperCAmelCase    ):
												raise ValueError("the value of input must be a natural number"    )
						if number < 0:
												raise ValueError("the value of input must not be a negative number"    )
						if number == 0:
												return 1
						SCREAMING_SNAKE_CASE_: List[str]  		=       [-1] * (number + 1)
						SCREAMING_SNAKE_CASE_: str  		=       0
						for i in range(1				,	number + 1    ):
												SCREAMING_SNAKE_CASE_: str  		=       sys.maxsize
												SCREAMING_SNAKE_CASE_: List[Any]  		=       int(math.sqrt(_UpperCAmelCase    )    )
												for j in range(1				,	root + 1    ):
																		SCREAMING_SNAKE_CASE_: List[str]  		=       1 + answers[i - (j**2)]
																		SCREAMING_SNAKE_CASE_: Optional[Any]  		=       min(_UpperCAmelCase				,	_UpperCAmelCase    )
												SCREAMING_SNAKE_CASE_: Dict  		=       answer
						return answers[number]


if __name__ == "__main__":
						import doctest

						doctest.testmod()






