





def 					lowerCAmelCase_			(	__a		)					->		list[int]:







  """simple docstring"""





  if length <= 0 or not isinstance(__a     ,   __a		):
    raise ValueError("Length must be a positive integer."		)
  return [n * (2 * n - 1) for n in range(__a		)]


if __name__ == "__main__":
     print(hexagonal_numbers(length=5))
     print(hexagonal_numbers(length=10))








from __future__ import annotations





def 					lowerCAmelCase_			(	__a     ,   __a		)					->		List[Any]:







  """simple docstring"""





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





def 					lowerCAmelCase_			(	__a     ,   __a     ,   __a		)					->		Tuple:







  """simple docstring"""





  for j in range(__a		):
    lowerCamelCase__  , lowerCamelCase__  , lowerCamelCase__:				str        =(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 					lowerCAmelCase_			(	__a     ,   __a     ,   __a     ,   __a		)					->		list[float]:







  """simple docstring"""





  lowerCamelCase__:				List[str]        =[float("inf"		)] * vertex_count
  lowerCamelCase__:				List[str]        =0.0

  for _ in range(vertex_count - 1		):
    for j in range(__a		):
      lowerCamelCase__  , lowerCamelCase__  , lowerCamelCase__:				Union[str, Any]        =(graph[j][k] for k in ["src", "dst", "weight"])

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

  lowerCamelCase__:				Tuple        =check_negative_cycle(__a     ,   __a     ,   __a		)
  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 ,     __A ,     __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)

