




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.
UpperCamelCase								=	10



def 				_A  (		lowerCAmelCase_	:   int  ,							lowerCAmelCase_	:   int  ,							lowerCAmelCase_	:   list[int]  ,							lowerCAmelCase_	:   int     ):
     """simple docstring"""

     for i in range(lowerCAmelCase_  ,							lowerCAmelCase_     ):
          if array[i] == target:
               return i
     return -1



def 				_A  (		lowerCAmelCase_	:   list[int]  ,							lowerCAmelCase_	:   int     ):
     """simple docstring"""

     lowerCAmelCase__            =					0
     lowerCAmelCase__            =					len(lowerCAmelCase_     )
     while left <= right:
          if right - left < precision:
               return lin_search(lowerCAmelCase_  ,							lowerCAmelCase_  ,							lowerCAmelCase_  ,							lowerCAmelCase_     )

          lowerCAmelCase__            =					(left + right) // 3 + 1
          lowerCAmelCase__            =					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]:
               lowerCAmelCase__            =					one_third - 1
          elif array[two_third] < target:
               lowerCAmelCase__            =					two_third + 1

          else:
               lowerCAmelCase__            =					one_third + 1
               lowerCAmelCase__            =					two_third - 1
     else:
          return -1



def 				_A  (		lowerCAmelCase_	:   int  ,							lowerCAmelCase_	:   int  ,							lowerCAmelCase_	:   list[int]  ,							lowerCAmelCase_	:   int     ):
     """simple docstring"""

     if left < right:
          if right - left < precision:
               return lin_search(lowerCAmelCase_  ,							lowerCAmelCase_  ,							lowerCAmelCase_  ,							lowerCAmelCase_     )
          lowerCAmelCase__            =					(left + right) // 3 + 1
          lowerCAmelCase__            =					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(lowerCAmelCase_  ,							one_third - 1  ,							lowerCAmelCase_  ,							lowerCAmelCase_     )
          elif array[two_third] < target:
               return rec_ternary_search(two_third + 1  ,							lowerCAmelCase_  ,							lowerCAmelCase_  ,							lowerCAmelCase_     )
          else:
               return rec_ternary_search(one_third + 1  ,							two_third - 1  ,							lowerCAmelCase_  ,							lowerCAmelCase_     )
     else:
          return -1


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     UpperCamelCase								=	input('Enter numbers separated by comma:\n').strip()
     UpperCamelCase								=	[int(item.strip()) for item in user_input.split(',')]
     assert collection == sorted(collection), F"List must be ordered.\n{collection}."
     UpperCamelCase								=	int(input('Enter the number to be found in the list:\n').strip())
     UpperCamelCase								=	ite_ternary_search(collection, target)
     UpperCamelCase								=	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')





"""simple docstring"""






from ..utils import DummyObject, requires_backends



class      A__  (    metaclass=__SCREAMING_SNAKE_CASE				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      ['torch', 'transformers', 'onnx']

	def __init__(	self:						Union[str, Any]			,     *_SCREAMING_SNAKE_CASE:						Any			,     **_SCREAMING_SNAKE_CASE:						int)							->			List[Any]:

				"""simple docstring"""

				requires_backends(self			,     ["torch", "transformers", "onnx"])

	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Union[str, Any]			,     *_SCREAMING_SNAKE_CASE:						List[Any]			,     **_SCREAMING_SNAKE_CASE:						Union[str, Any])							->			Union[str, Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])







	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						int			,     *_SCREAMING_SNAKE_CASE:						Any			,     **_SCREAMING_SNAKE_CASE:						str)							->			Union[str, Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])






class      A__  (    metaclass=__SCREAMING_SNAKE_CASE				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      ['torch', 'transformers', 'onnx']

	def __init__(	self:						Tuple			,     *_SCREAMING_SNAKE_CASE:						Optional[Any]			,     **_SCREAMING_SNAKE_CASE:						List[str])							->			Optional[int]:

				"""simple docstring"""

				requires_backends(self			,     ["torch", "transformers", "onnx"])

	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Dict			,     *_SCREAMING_SNAKE_CASE:						Optional[Any]			,     **_SCREAMING_SNAKE_CASE:						int)							->			List[Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])







	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Optional[Any]			,     *_SCREAMING_SNAKE_CASE:						Dict			,     **_SCREAMING_SNAKE_CASE:						Optional[Any])							->			Union[str, Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])






class      A__  (    metaclass=__SCREAMING_SNAKE_CASE				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      ['torch', 'transformers', 'onnx']

	def __init__(	self:						int			,     *_SCREAMING_SNAKE_CASE:						List[Any]			,     **_SCREAMING_SNAKE_CASE:						int)							->			List[str]:

				"""simple docstring"""

				requires_backends(self			,     ["torch", "transformers", "onnx"])

	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Dict			,     *_SCREAMING_SNAKE_CASE:						Any			,     **_SCREAMING_SNAKE_CASE:						Any)							->			str:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])







	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						List[Any]			,     *_SCREAMING_SNAKE_CASE:						List[str]			,     **_SCREAMING_SNAKE_CASE:						int)							->			int:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])






class      A__  (    metaclass=__SCREAMING_SNAKE_CASE				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      ['torch', 'transformers', 'onnx']

	def __init__(	self:						Tuple			,     *_SCREAMING_SNAKE_CASE:						List[str]			,     **_SCREAMING_SNAKE_CASE:						List[str])							->			Optional[Any]:

				"""simple docstring"""

				requires_backends(self			,     ["torch", "transformers", "onnx"])

	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						List[str]			,     *_SCREAMING_SNAKE_CASE:						Tuple			,     **_SCREAMING_SNAKE_CASE:						int)							->			int:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])







	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Optional[int]			,     *_SCREAMING_SNAKE_CASE:						str			,     **_SCREAMING_SNAKE_CASE:						Any)							->			int:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])






class      A__  (    metaclass=__SCREAMING_SNAKE_CASE				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      ['torch', 'transformers', 'onnx']

	def __init__(	self:						Optional[Any]			,     *_SCREAMING_SNAKE_CASE:						Union[str, Any]			,     **_SCREAMING_SNAKE_CASE:						Optional[int])							->			str:

				"""simple docstring"""

				requires_backends(self			,     ["torch", "transformers", "onnx"])

	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Optional[int]			,     *_SCREAMING_SNAKE_CASE:						List[Any]			,     **_SCREAMING_SNAKE_CASE:						Tuple)							->			Union[str, Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])







	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						int			,     *_SCREAMING_SNAKE_CASE:						str			,     **_SCREAMING_SNAKE_CASE:						Any)							->			Optional[Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])






class      A__  (    metaclass=__SCREAMING_SNAKE_CASE				):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE        =      ['torch', 'transformers', 'onnx']

	def __init__(	self:						List[Any]			,     *_SCREAMING_SNAKE_CASE:						List[str]			,     **_SCREAMING_SNAKE_CASE:						List[str])							->			int:

				"""simple docstring"""

				requires_backends(self			,     ["torch", "transformers", "onnx"])

	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						Union[str, Any]			,     *_SCREAMING_SNAKE_CASE:						Optional[int]			,     **_SCREAMING_SNAKE_CASE:						Optional[Any])							->			List[Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])







	@classmethod
	def 				_SCREAMING_SNAKE_CASE  (	cls:						str			,     *_SCREAMING_SNAKE_CASE:						Optional[int]			,     **_SCREAMING_SNAKE_CASE:						Dict)							->			Optional[Any]:

				"""simple docstring"""

				requires_backends(cls			,     ["torch", "transformers", "onnx"])