


"""simple docstring"""

from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCAmelCase__					=logging.get_logger(__name__)

UpperCAmelCase__					={
    "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json",
}





class  lowerCamelCase__    (		_a     ):
      a			:  Any           =		"""roc_bert"""
      def __init__(		self						:						int   ,							A_						:						Dict=3_0_5_2_2   ,							A_						:						Union[str, Any]=7_6_8   ,							A_						:						int=1_2   ,							A_						:						Any=1_2   ,							A_						:						Dict=3_0_7_2   ,							A_						:						Union[str, Any]="gelu"   ,							A_						:						List[Any]=0.1   ,							A_						:						List[Any]=0.1   ,							A_						:						str=5_1_2   ,							A_						:						Any=2   ,							A_						:						Any=0.02   ,							A_						:						Union[str, Any]=1e-1_2   ,							A_						:						Optional[Any]=True   ,							A_						:						Union[str, Any]=0   ,							A_						:						Optional[int]="absolute"   ,							A_						:						List[Any]=None   ,							A_						:						Optional[Any]=True   ,							A_						:						List[str]=True   ,							A_						:						Dict=7_6_8   ,							A_						:						Optional[Any]=9_1_0   ,							A_						:						Tuple=5_1_2   ,							A_						:						Optional[int]=2_4_8_5_8   ,							A_						:						Tuple=True   ,							**A_						:						Tuple   ,							):






       '''simple docstring'''


       __lowercase						=						vocab_size
       __lowercase						=						max_position_embeddings
       __lowercase						=						hidden_size
       __lowercase						=						num_hidden_layers
       __lowercase						=						num_attention_heads
       __lowercase						=						intermediate_size
       __lowercase						=						hidden_act
       __lowercase						=						hidden_dropout_prob
       __lowercase						=						attention_probs_dropout_prob
       __lowercase						=						initializer_range
       __lowercase						=						type_vocab_size
       __lowercase						=						layer_norm_eps
       __lowercase						=						use_cache
       __lowercase						=						enable_pronunciation
       __lowercase						=						enable_shape
       __lowercase						=						pronunciation_embed_dim
       __lowercase						=						pronunciation_vocab_size
       __lowercase						=						shape_embed_dim
       __lowercase						=						shape_vocab_size
       __lowercase						=						concat_input
       __lowercase						=						position_embedding_type
       __lowercase						=						classifier_dropout
       super().__init__(pad_token_id=A_   ,							**A_				)




"""simple docstring"""

from __future__ import annotations


def lowerCAmelCase_   (					UpperCamelCase__						:			list[float]					, UpperCamelCase__						:			Any			):






 """simple docstring"""







 print(f'''Vertex\tShortest Distance from vertex {src}'''			)
 for i, d in enumerate(UpperCamelCase__			):
  print(f'''{i}\t\t{d}'''			)


def lowerCAmelCase_   (					UpperCamelCase__						:			list[dict[str, int]]					, UpperCamelCase__						:			list[float]					, UpperCamelCase__						:			int			):






 """simple docstring"""







 for j in range(UpperCamelCase__			):
  __lowercase				,		__lowercase				,		__lowercase						=						(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_   (					UpperCamelCase__						:			list[dict[str, int]]					, UpperCamelCase__						:			int					, UpperCamelCase__						:			int					, UpperCamelCase__						:			int			):






 """simple docstring"""







 __lowercase						=						[float("""inf"""			)] * vertex_count
 __lowercase						=						0.0

 for _ in range(vertex_count - 1			):
  for j in range(UpperCamelCase__			):
   __lowercase				,		__lowercase				,		__lowercase						=						(graph[j][k] for k in ["""src""", """dst""", """weight"""])

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

 __lowercase						=						check_negative_cycle(UpperCamelCase__					, UpperCamelCase__					, UpperCamelCase__			)
 if negative_cycle_exists:
  raise Exception("""Negative cycle found"""			)

 return distance


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       UpperCAmelCase__					=int(input("Enter number of vertices: ").strip())
       UpperCAmelCase__					=int(input("Enter number of edges: ").strip())

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

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

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