



from __future__ import annotations

import bisect







def    _snake_case (       __snake_case					,  __snake_case					,  __snake_case = 0					,  __snake_case = -1    )     ->     int:






      '''simple docstring'''







      if hi < 0:
            UpperCAmelCase_  :	int				      =		len(__snake_case    )

      while lo < hi:
            UpperCAmelCase_  :	Optional[Any]				      =		lo + (hi - lo) // 2
            if sorted_collection[mid] < item:
                  UpperCAmelCase_  :	str				      =		mid + 1
            else:
                  UpperCAmelCase_  :	Optional[Any]				      =		mid

      return lo







def    _snake_case (       __snake_case					,  __snake_case					,  __snake_case = 0					,  __snake_case = -1    )     ->     int:






      '''simple docstring'''







      if hi < 0:
            UpperCAmelCase_  :	str				      =		len(__snake_case    )

      while lo < hi:
            UpperCAmelCase_  :	Tuple				      =		lo + (hi - lo) // 2
            if sorted_collection[mid] <= item:
                  UpperCAmelCase_  :	str				      =		mid + 1
            else:
                  UpperCAmelCase_  :	Union[str, Any]				      =		mid

      return lo







def    _snake_case (       __snake_case					,  __snake_case					,  __snake_case = 0					,  __snake_case = -1    )     ->     None:






      '''simple docstring'''







      sorted_collection.insert(bisect_left(__snake_case					,  __snake_case					,  __snake_case					,  __snake_case    )					,  __snake_case    )







def    _snake_case (       __snake_case					,  __snake_case					,  __snake_case = 0					,  __snake_case = -1    )     ->     None:






      '''simple docstring'''







      sorted_collection.insert(bisect_right(__snake_case					,  __snake_case					,  __snake_case					,  __snake_case    )					,  __snake_case    )







def    _snake_case (       __snake_case					,  __snake_case    )     ->     int | None:






      '''simple docstring'''







      UpperCAmelCase_  :	int				      =		0
      UpperCAmelCase_  :	int				      =		len(__snake_case    ) - 1

      while left <= right:
            UpperCAmelCase_  :	List[str]				      =		left + (right - left) // 2
            UpperCAmelCase_  :	List[str]				      =		sorted_collection[midpoint]
            if current_item == item:
                  return midpoint
            elif item < current_item:
                  UpperCAmelCase_  :	List[Any]				      =		midpoint - 1
            else:
                  UpperCAmelCase_  :	Dict				      =		midpoint + 1
      return None







def    _snake_case (       __snake_case					,  __snake_case    )     ->     int | None:






      '''simple docstring'''







      UpperCAmelCase_  :	str				      =		bisect.bisect_left(__snake_case					,  __snake_case    )
      if index != len(__snake_case    ) and sorted_collection[index] == item:
            return index
      return None







def    _snake_case (       __snake_case					,  __snake_case					,  __snake_case					,  __snake_case    )     ->     int | None:






      '''simple docstring'''







      if right < left:
            return None

      UpperCAmelCase_  :	Optional[Any]				      =		left + (right - left) // 2

      if sorted_collection[midpoint] == item:
            return midpoint
      elif sorted_collection[midpoint] > item:
            return binary_search_by_recursion(__snake_case					,  __snake_case					,  __snake_case					,  midpoint - 1    )
      else:
            return binary_search_by_recursion(__snake_case					,  __snake_case					,  midpoint + 1					,  __snake_case    )


if __name__ == "__main__":
    __lowerCamelCase         =			input('''Enter numbers separated by comma:\n''').strip()
    __lowerCamelCase         =			sorted(int(item) for item in user_input.split(''','''))
    __lowerCamelCase         =			int(input('''Enter a single number to be found in the list:\n'''))
    __lowerCamelCase         =			binary_search(collection, target)
    if result is None:
        print(F'''{target} was not found in {collection}.''')
    else:
        print(F'''{target} was found at position {result} in {collection}.''')





def    _snake_case (       __snake_case					,  __snake_case    )     ->     int:






      '''simple docstring'''







      return int((input_a, input_a).count(0    ) != 0    )







def    _snake_case (       )     ->     None:






      '''simple docstring'''







      assert nand_gate(0					,  0    ) == 1
      assert nand_gate(0					,  1    ) == 1
      assert nand_gate(1					,  0    ) == 1
      assert nand_gate(1					,  1    ) == 0


if __name__ == "__main__":
   print(nand_gate(0, 0))
   print(nand_gate(0, 1))
   print(nand_gate(1, 0))
   print(nand_gate(1, 1))
