



def 							A     (					_UpperCAmelCase    :       int							,       _UpperCAmelCase    :       int   )    ->			int:







			'''simple docstring'''
			while a != 0:
						_UpperCAmelCase	,					_UpperCAmelCase			=       b % a, a
			return b





def 							A     (					_UpperCAmelCase    :       int							,       _UpperCAmelCase    :       int   )    ->			int:







			'''simple docstring'''
			if gcd(_UpperCAmelCase							,       _UpperCAmelCase   ) != 1:
						_UpperCAmelCase			=       F"mod inverse of {a!r} and {m!r} does not exist"
						raise ValueError(_UpperCAmelCase   )
			_UpperCAmelCase	,					_UpperCAmelCase	,					_UpperCAmelCase			=       1, 0, a
			_UpperCAmelCase	,					_UpperCAmelCase	,					_UpperCAmelCase			=       0, 1, m
			while va != 0:
						_UpperCAmelCase			=       ua // va
						_UpperCAmelCase	,					_UpperCAmelCase	,					_UpperCAmelCase	,					_UpperCAmelCase	,					_UpperCAmelCase	,					_UpperCAmelCase			=       (ua - q * va), (ua - q * va), (ua - q * va), va, va, va
			return ua % m





from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


UpperCAmelCase__       =	{
    "configuration_mega": ["MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegaConfig", "MegaOnnxConfig"],
}

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__       =	[
							    "MEGA_PRETRAINED_MODEL_ARCHIVE_LIST",
							    "MegaForCausalLM",
							    "MegaForMaskedLM",
							    "MegaForMultipleChoice",
							    "MegaForQuestionAnswering",
							    "MegaForSequenceClassification",
							    "MegaForTokenClassification",
							    "MegaModel",
							    "MegaPreTrainedModel",
							]

if TYPE_CHECKING:
							from .configuration_mega import MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP, MegaConfig, MegaOnnxConfig

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_mega import (
														    MEGA_PRETRAINED_MODEL_ARCHIVE_LIST,
														    MegaForCausalLM,
														    MegaForMaskedLM,
														    MegaForMultipleChoice,
														    MegaForQuestionAnswering,
														    MegaForSequenceClassification,
														    MegaForTokenClassification,
														    MegaModel,
														    MegaPreTrainedModel,
														)

else:
							import sys

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