




"""simple docstring"""


from __future__ import annotations


def    UpperCAmelCase__			(snake_case__				:   Any						,  snake_case__				:   Any       ):
  """simple docstring"""

  print(F"Vertex\tShortest Distance from vertex {src}"       )
  for i, d in enumerate(_UpperCamelCase       ):
    print(F"{i}\t\t{d}"       )


def    UpperCAmelCase__			(snake_case__				:   Union[str, Any]						,  snake_case__				:   Any						,  snake_case__				:   str       ):
  """simple docstring"""

  for j in range(_UpperCamelCase       ):
    _snake_case						,   _snake_case						,   _snake_case				:						Tuple								=    (graph[j][k] for k in ["""src""", """dst""", """weight"""])
    if distance[u] != float("""inf"""       ) and distance[u] + w < distance[v]:
      return True
  return False


def    UpperCAmelCase__			(snake_case__				:   List[str]						,  snake_case__				:   Tuple						,  snake_case__				:   Optional[Any]						,  snake_case__				:   Optional[Any]       ):
  """simple docstring"""

  _snake_case				:						Optional[int]								=    [float("""inf"""       )] * vertex_count
  _snake_case				:						Any								=    0.0

  for _ in range(vertex_count - 1       ):
    for j in range(_UpperCamelCase       ):
      _snake_case						,   _snake_case						,   _snake_case				:						List[str]								=    (graph[j][k] for k in ["""src""", """dst""", """weight"""])

      if distance[u] != float("""inf"""       ) and distance[u] + w < distance[v]:
        _snake_case				:						Any								=    distance[u] + w

  _snake_case				:						List[str]								=    check_negative_cycle(_UpperCamelCase						,  _UpperCamelCase						,  _UpperCamelCase       )
  if negative_cycle_exists:
    raise Exception("""Negative cycle found"""       )

  return distance


if __name__ == "__main__":
     import doctest

     doctest.testmod()

     A_         =							int(input('''Enter number of vertices: ''').strip())
     A_         =							int(input('''Enter number of edges: ''').strip())

     A_         =							[{} for _ in range(E)]

     for i in range(E):
          print('''Edge ''', i + 1)
          A_         =							(
              int(x)
              for x in input('''Enter source, destination, weight: ''').strip().split(''' ''')
          )
          A_         =							{'''src''': src, '''dst''': dest, '''weight''': weight}

     A_         =							int(input('''\nEnter shortest path source:''').strip())
     A_         =							bellman_ford(graph, V, E, source)
     print_distance(shortest_distance, 0)










from pathlib import Path

import fire
def 		lowercase__  (				_UpperCamelCase       ,							_UpperCamelCase       ,							_UpperCamelCase) ->			Optional[int]:
      """simple docstring"""

      UpperCamelCase					       =  Path(_UpperCamelCase)
      UpperCamelCase					       =  Path(_UpperCamelCase)
      dest_dir.mkdir(exist_ok=_UpperCamelCase)
      for path in src_dir.iterdir():
            UpperCamelCase					       =  [x.rstrip() for x in list(path.open().readlines())][:n]
            UpperCamelCase					       =  dest_dir.joinpath(path.name)
            print(_UpperCamelCase)
            dest_path.open('w').write('\n'.join(_UpperCamelCase))


if __name__ == "__main__":
       fire.Fire(minify)



