
import math




class        UpperCAmelCase_			:


  '''simple docstring'''







  def __init__( self			: Optional[Any]			,							UpperCamelCase__			: List[Any]=0    )			->	Optional[Any]:  # a graph with Node 0,1,...,N-1







    """simple docstring"""






    __magic_name__				     =       n
    __magic_name__				     =       [
        [math.inf for j in range(0			,							UpperCamelCase__    )] for i in range(0			,							UpperCamelCase__    )
    ]  # adjacency matrix for weight
    __magic_name__				     =       [
        [math.inf for j in range(0			,							UpperCamelCase__    )] for i in range(0			,							UpperCamelCase__    )
    ]  # dp[i][j] stores minimum distance from i to j
  def 							_lowercase							( self			: Union[str, Any]			,							UpperCamelCase__			: Union[str, Any]			,							UpperCamelCase__			: List[str]			,							UpperCamelCase__			: List[Any]    )			->	str:







    """simple docstring"""






    __magic_name__				     =       w
  def 							_lowercase							( self			: str    )			->	str:







    """simple docstring"""






    for k in range(0			,							self.n    ):
      for i in range(0			,							self.n    ):
        for j in range(0			,							self.n    ):
          __magic_name__				     =       min(self.dp[i][j]			,							self.dp[i][k] + self.dp[k][j]    )





  def 							_lowercase							( self			: List[Any]			,							UpperCamelCase__			: Any			,							UpperCamelCase__			: Any    )			->	Union[str, Any]:







    """simple docstring"""






    return self.dp[u][v]


if __name__ == "__main__":
    __lowerCAmelCase			:     str           =   Graph(5)
    graph.add_edge(0, 2, 9)
    graph.add_edge(0, 4, 10)
    graph.add_edge(1, 3, 5)
    graph.add_edge(2, 3, 7)
    graph.add_edge(3, 0, 10)
    graph.add_edge(3, 1, 2)
    graph.add_edge(3, 2, 1)
    graph.add_edge(3, 4, 6)
    graph.add_edge(4, 1, 3)
    graph.add_edge(4, 2, 4)
    graph.add_edge(4, 3, 9)
    graph.floyd_warshall()
    graph.show_min(1, 4)
    graph.show_min(0, 3)



import pickle
import unittest

import torch

from accelerate import Accelerator
from accelerate.state import AcceleratorState
from accelerate.test_utils import require_cpu




@require_cpu
class        UpperCAmelCase_			( unittest.TestCase     ):


  '''simple docstring'''







  def 							_lowercase							( self			: List[Any]    )			->	Union[str, Any]:







    """simple docstring"""






    __magic_name__				     =       torch.nn.Linear(10			,							10    )
    __magic_name__				     =       torch.optim.SGD(model.parameters()			,							0.1    )
    __magic_name__				     =       Accelerator()
    __magic_name__				     =       accelerator.prepare(UpperCamelCase__    )
    try:
      pickle.loads(pickle.dumps(UpperCamelCase__    )    )
    except Exception as e:
      self.fail(F'''Accelerated optimizer pickling failed with {e}'''    )
    AcceleratorState._reset_state()

