

from __future__ import annotations

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





@dataclass
class  __lowerCAmelCase     :
  _a									=  42
  _a									=  42





class  __lowerCAmelCase     :




  def __init__(				self							,   lowerCAmelCase					)  -> Dict:
        '''simple docstring'''






        _lowercase	       =[[] for _ in range(lowerCAmelCase					)]
        _lowercase	       =size




  def __getitem__(				self							,   lowerCAmelCase					)  -> Iterator[Edge]:
        '''simple docstring'''






        return iter(self._graph[vertex]					)




  @property
  def   A__     (				self					)  -> Any:
        '''simple docstring'''






        return self._size




  def   A__     (				self							,   lowerCAmelCase							,   lowerCAmelCase							,   lowerCAmelCase					)  -> List[Any]:
        '''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(lowerCAmelCase							,   lowerCAmelCase					)					)




  def   A__     (				self							,   lowerCAmelCase							,   lowerCAmelCase					)  -> int | None:
        '''simple docstring'''






        _lowercase	       =deque([start_vertex]					)
        _lowercase	       =[None] * self.size
        _lowercase	       =0

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

              for edge in self[current_vertex]:
                    _lowercase	       =current_distance + edge.weight
                    _lowercase	       =distances[edge.destination_vertex]
                    if (
                        isinstance(lowerCAmelCase							,   lowerCAmelCase					)
                        and new_distance >= dest_vertex_distance
                    ):
                          continue
                    _lowercase	       =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()





from __future__ import annotations
def      a      (			A__	:   list[int]     )    ->      int:





      """simple docstring"""



      if not nums:
            return 0
      _lowercase	       =nums[0]
      _lowercase	       =0
      for num in nums[1:]:
            _lowercase       ,       _lowercase	       =(
                max_excluding + num,
                max(A__      ,   A__     ),
            )
      return max(A__      ,   A__     )


if __name__ == "__main__":
  import doctest

  doctest.testmod()


