



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}.''')





from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass


@dataclass
class   snake_case_ :




       """simple docstring"""






       _lowerCamelCase			    =				42
       _lowerCamelCase			    =				42


class   snake_case_ :




       """simple docstring"""






       def __init__(     self     ,lowercase):

             """simple docstring"""





             UpperCAmelCase_  :	list[list[Edge]]				      =		[[] for _ in range(lowercase)]
             UpperCAmelCase_  :	str				      =		size



       def __getitem__(     self     ,lowercase):

             """simple docstring"""





             return iter(self._graph[vertex])



       @property
       def  A_   (     self):

             """simple docstring"""





             return self._size



       def  A_   (     self     ,lowercase     ,lowercase     ,lowercase):

             """simple docstring"""





             if weight not in (0, 1):
                   raise ValueError("Edge weight must be either 0 or 1.")

             if to_vertex < 0 or to_vertex >= self.size:
                   raise ValueError("Vertex indexes must be in [0; size).")

             self._graph[from_vertex].append(Edge(lowercase     ,lowercase))



       def  A_   (     self     ,lowercase     ,lowercase):

             """simple docstring"""





             UpperCAmelCase_  :	int				      =		deque([start_vertex])
             UpperCAmelCase_  :	list[int | None]				      =		[None] * self.size
             UpperCAmelCase_  :	Dict				      =		0

             while queue:
                   UpperCAmelCase_  :	List[Any]				      =		queue.popleft()
                   UpperCAmelCase_  :	Any				      =		distances[current_vertex]
                   if current_distance is None:
                         continue

                   for edge in self[current_vertex]:
                         UpperCAmelCase_  :	Tuple				      =		current_distance + edge.weight
                         UpperCAmelCase_  :	Optional[Any]				      =		distances[edge.destination_vertex]
                         if (
                             isinstance(lowercase     ,lowercase)
                             and new_distance >= dest_vertex_distance
                         ):
                               continue
                         UpperCAmelCase_  :	Tuple				      =		new_distance
                         if edge.weight == 0:
                               queue.appendleft(edge.destination_vertex)
                         else:
                               queue.append(edge.destination_vertex)

             if distances[finish_vertex] is None:
                   raise ValueError("No path from start_vertex to finish_vertex.")

             return distances[finish_vertex]


if __name__ == "__main__":
   import doctest

   doctest.testmod()
