

'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowerCAmelCase__										= {
    "configuration_xlm_roberta": [
        "XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "XLMRobertaConfig",
        "XLMRobertaOnnxConfig",
    ],
}

try:
						if not is_sentencepiece_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= ["XLMRobertaTokenizer"]

try:
						if not is_tokenizers_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= ["XLMRobertaTokenizerFast"]

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= [
						    "XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "XLMRobertaForCausalLM",
						    "XLMRobertaForMaskedLM",
						    "XLMRobertaForMultipleChoice",
						    "XLMRobertaForQuestionAnswering",
						    "XLMRobertaForSequenceClassification",
						    "XLMRobertaForTokenClassification",
						    "XLMRobertaModel",
						    "XLMRobertaPreTrainedModel",
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= [
						    "TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "TFXLMRobertaForCausalLM",
						    "TFXLMRobertaForMaskedLM",
						    "TFXLMRobertaForMultipleChoice",
						    "TFXLMRobertaForQuestionAnswering",
						    "TFXLMRobertaForSequenceClassification",
						    "TFXLMRobertaForTokenClassification",
						    "TFXLMRobertaModel",
						    "TFXLMRobertaPreTrainedModel",
						]

try:
						if not is_flax_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase__										= [
						    "FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST",
						    "FlaxXLMRobertaForMaskedLM",
						    "FlaxXLMRobertaForCausalLM",
						    "FlaxXLMRobertaForMultipleChoice",
						    "FlaxXLMRobertaForQuestionAnswering",
						    "FlaxXLMRobertaForSequenceClassification",
						    "FlaxXLMRobertaForTokenClassification",
						    "FlaxXLMRobertaModel",
						    "FlaxXLMRobertaPreTrainedModel",
						]

if TYPE_CHECKING:
						from .configuration_xlm_roberta import (
						    XLM_ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP,
						    XLMRobertaConfig,
						    XLMRobertaOnnxConfig,
						)

						try:
												if not is_sentencepiece_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_xlm_roberta import XLMRobertaTokenizer

						try:
												if not is_tokenizers_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .tokenization_xlm_roberta_fast import XLMRobertaTokenizerFast

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_xlm_roberta import (
												    XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
												    XLMRobertaForCausalLM,
												    XLMRobertaForMaskedLM,
												    XLMRobertaForMultipleChoice,
												    XLMRobertaForQuestionAnswering,
												    XLMRobertaForSequenceClassification,
												    XLMRobertaForTokenClassification,
												    XLMRobertaModel,
												    XLMRobertaPreTrainedModel,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_xlm_roberta import (
												    TF_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
												    TFXLMRobertaForCausalLM,
												    TFXLMRobertaForMaskedLM,
												    TFXLMRobertaForMultipleChoice,
												    TFXLMRobertaForQuestionAnswering,
												    TFXLMRobertaForSequenceClassification,
												    TFXLMRobertaForTokenClassification,
												    TFXLMRobertaModel,
												    TFXLMRobertaPreTrainedModel,
												)

						try:
												if not is_flax_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_flax_xlm_roberta import (
												    FLAX_XLM_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
												    FlaxXLMRobertaForCausalLM,
												    FlaxXLMRobertaForMaskedLM,
												    FlaxXLMRobertaForMultipleChoice,
												    FlaxXLMRobertaForQuestionAnswering,
												    FlaxXLMRobertaForSequenceClassification,
												    FlaxXLMRobertaForTokenClassification,
												    FlaxXLMRobertaModel,
												    FlaxXLMRobertaPreTrainedModel,
												)

else:
						import sys

						lowerCAmelCase__										= _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)









'''simple docstring'''


import math



class 					lowercase						:


							def __init__(			self    ,			_snake_case=0)							->				Union[str, Any]:  # a graph with Node 0,1,...,N-1
								UpperCAmelCase_		:      Tuple       	=					n
								UpperCAmelCase_		:      Optional[Any]       	=					[
								    [math.inf for j in range(0    ,			_snake_case)] for i in range(0    ,			_snake_case)
								]  # adjacency matrix for weight
								UpperCAmelCase_		:      Tuple       	=					[
								    [math.inf for j in range(0    ,			_snake_case)] for i in range(0    ,			_snake_case)
								]  # dp[i][j] stores minimum distance from i to j


							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case    ,			_snake_case)							->				List[Any]:
								UpperCAmelCase_		:      Union[str, Any]       	=					w


							def 						_snake_case							(			self)							->				str:
								for k in range(0    ,			self.n):
									for i in range(0    ,			self.n):
										for j in range(0    ,			self.n):
											UpperCAmelCase_		:      Optional[int]       	=					min(self.dp[i][j]    ,			self.dp[i][k] + self.dp[k][j])





							def 						_snake_case							(			self    ,			_snake_case    ,			_snake_case)							->				str:
								return self.dp[u][v]


if __name__ == "__main__":
						lowerCAmelCase__										= 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)






