

import heapq as hq
import math
from collections.abc import Iterator




class 			UpperCAmelCase_      :




							'''simple docstring'''



							def __init__(					self       :	Dict       ,     a       :	Tuple			)			->					Optional[int]:
										SCREAMING_SNAKE_CASE           =					str(id_			)
										SCREAMING_SNAKE_CASE           =					None
										SCREAMING_SNAKE_CASE           =					None
										SCREAMING_SNAKE_CASE           =					[]
										SCREAMING_SNAKE_CASE           =					{}  # {vertex:distance}





							def __lt__(					self       :	Tuple       ,     a       :	Optional[int]			)			->					Optional[Any]:
										return self.key < other.key





							def __repr__(					self       :	Tuple			)			->					Tuple:
										return self.id





							def    _UpperCAmelCase     (					self       :	Union[str, Any]       ,     a       :	Any			)			->					Any:
										self.neighbors.append(A_			)







							def    _UpperCAmelCase     (					self       :	List[str]       ,     a       :	Any       ,     a       :	Dict			)			->					List[str]:
										SCREAMING_SNAKE_CASE           =					weight





def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			# add the neighbors:
			graph[a - 1].add_neighbor(graph[b - 1]   )
			graph[b - 1].add_neighbor(graph[a - 1]   )
			# add the edges:
			graph[a - 1].add_edge(graph[b - 1]					,	_lowerCAmelCase   )
			graph[b - 1].add_edge(graph[a - 1]					,	_lowerCAmelCase   )
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			SCREAMING_SNAKE_CASE           =					[]
			for u in graph:
						SCREAMING_SNAKE_CASE           =					math.inf
						SCREAMING_SNAKE_CASE           =					None
			SCREAMING_SNAKE_CASE           =					0
			SCREAMING_SNAKE_CASE           =					graph[:]
			while q:
						SCREAMING_SNAKE_CASE           =					min(_lowerCAmelCase   )
						q.remove(_lowerCAmelCase   )
						for v in u.neighbors:
									if (v in q) and (u.edges[v.id] < v.key):
												SCREAMING_SNAKE_CASE           =					u
												SCREAMING_SNAKE_CASE           =					u.edges[v.id]
			for i in range(1					,	len(_lowerCAmelCase   )   ):
						a.append((int(graph[i].id   ) + 1, int(graph[i].pi.id   ) + 1)   )
			return a
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			for u in graph:
						SCREAMING_SNAKE_CASE           =					math.inf
						SCREAMING_SNAKE_CASE           =					None
			SCREAMING_SNAKE_CASE           =					0

			SCREAMING_SNAKE_CASE           =					list(_lowerCAmelCase   )
			hq.heapify(_lowerCAmelCase   )

			while h:
						SCREAMING_SNAKE_CASE           =					hq.heappop(_lowerCAmelCase   )
						for v in u.neighbors:
									if (v in h) and (u.edges[v.id] < v.key):
												SCREAMING_SNAKE_CASE           =					u
												SCREAMING_SNAKE_CASE           =					u.edges[v.id]
												hq.heapify(_lowerCAmelCase   )

			for i in range(1					,	len(_lowerCAmelCase   )   ):
						yield (int(graph[i].id   ) + 1, int(graph[i].pi.id   ) + 1)
def 					lowerCamelCase_    (    ):
			'''simple docstring'''
			pass


if __name__ == "__main__":
		import doctest

		doctest.testmod()












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


__A						:							Any							=  logging.get_logger(__name__)

__A						:							int							=  {
    # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert
}




class 			UpperCAmelCase_      (   A       ):




							'''simple docstring'''



							a__						  =     '''megatron-bert'''





							def __init__(					self       :	str       ,     a       :	Union[str, Any]=29_056       ,     a       :	Optional[int]=1_024       ,     a       :	str=24       ,     a       :	str=16       ,     a       :	str=4_096       ,     a       :	Any="gelu"       ,     a       :	Any=0.1       ,     a       :	Optional[int]=0.1       ,     a       :	Optional[int]=512       ,     a       :	Optional[Any]=2       ,     a       :	List[str]=0.02       ,     a       :	List[Any]=1E-1_2       ,     a       :	Any=0       ,     a       :	List[Any]="absolute"       ,     a       :	List[str]=True       ,     **a       :	Optional[Any]       ,     )			->					List[str]:
										super().__init__(pad_token_id=a       ,     **a			)

										SCREAMING_SNAKE_CASE           =					vocab_size
										SCREAMING_SNAKE_CASE           =					hidden_size
										SCREAMING_SNAKE_CASE           =					num_hidden_layers
										SCREAMING_SNAKE_CASE           =					num_attention_heads
										SCREAMING_SNAKE_CASE           =					hidden_act
										SCREAMING_SNAKE_CASE           =					intermediate_size
										SCREAMING_SNAKE_CASE           =					hidden_dropout_prob
										SCREAMING_SNAKE_CASE           =					attention_probs_dropout_prob
										SCREAMING_SNAKE_CASE           =					max_position_embeddings
										SCREAMING_SNAKE_CASE           =					type_vocab_size
										SCREAMING_SNAKE_CASE           =					initializer_range
										SCREAMING_SNAKE_CASE           =					layer_norm_eps
										SCREAMING_SNAKE_CASE           =					position_embedding_type
										SCREAMING_SNAKE_CASE           =					use_cache






