



from __future__ import annotations


def 	_A	(   _UpperCamelCase      ,					_UpperCamelCase			):
				_UpperCAmelCase						:  int     					=	[None] * (len(_UpperCamelCase			) + len(_UpperCamelCase			))

				_UpperCAmelCase						:  int     					=	0  # pointer to current index for left Half
				_UpperCAmelCase						:  List[str]     					=	0  # pointer to current index for the right Half
				_UpperCAmelCase						:  List[Any]     					=	0  # pointer to current index for the sorted array Half

				while pointera < len(_UpperCamelCase			) and pointera < len(_UpperCamelCase			):
								if left_half[pointera] < right_half[pointera]:
												_UpperCAmelCase						:  List[str]     					=	left_half[pointera]
												pointera += 1
												index += 1
								else:
												_UpperCAmelCase						:  Dict     					=	right_half[pointera]
												pointera += 1
												index += 1
				while pointera < len(_UpperCamelCase			):
								_UpperCAmelCase						:  int     					=	left_half[pointera]
								pointera += 1
								index += 1

				while pointera < len(_UpperCamelCase			):
								_UpperCAmelCase						:  Tuple     					=	right_half[pointera]
								pointera += 1
								index += 1

				return sorted_array


def 	_A	(   _UpperCamelCase			):
				if len(_UpperCamelCase			) <= 1:
								return array
				# the actual formula to calculate the middle element = left + (right - left) // 2
				# this avoids integer overflow in case of large N
				_UpperCAmelCase						:  Any     					=	0 + (len(_UpperCamelCase			) - 0) // 2

				# Split the array into halves till the array length becomes equal to One
				# merge the arrays of single length returned by mergeSort function and
				# pass them into the merge arrays function which merges the array
				_UpperCAmelCase						:  Any     					=	array[:middle]
				_UpperCAmelCase						:  Union[str, Any]     					=	array[middle:]

				return merge(merge_sort(_UpperCamelCase			)      ,					merge_sort(_UpperCamelCase			)			)


if __name__ == "__main__":
					import doctest

					doctest.testmod()





from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


UpperCAmelCase__			:   Optional[int]      			=    {
    'configuration_ernie_m': ['ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ErnieMConfig'],
}

try:
					if not is_sentencepiece_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCAmelCase__			:   List[Any]      			=    ['ErnieMTokenizer']

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCAmelCase__			:   Dict      			=    [
					    'ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST',
					    'ErnieMForMultipleChoice',
					    'ErnieMForQuestionAnswering',
					    'ErnieMForSequenceClassification',
					    'ErnieMForTokenClassification',
					    'ErnieMModel',
					    'ErnieMPreTrainedModel',
					    'ErnieMForInformationExtraction',
					]


if TYPE_CHECKING:
					from .configuration_ernie_m import ERNIE_M_PRETRAINED_CONFIG_ARCHIVE_MAP, ErnieMConfig

					try:
										if not is_sentencepiece_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_ernie_m import ErnieMTokenizer

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_ernie_m import (
										    ERNIE_M_PRETRAINED_MODEL_ARCHIVE_LIST,
										    ErnieMForInformationExtraction,
										    ErnieMForMultipleChoice,
										    ErnieMForQuestionAnswering,
										    ErnieMForSequenceClassification,
										    ErnieMForTokenClassification,
										    ErnieMModel,
										    ErnieMPreTrainedModel,
										)


else:
					import sys

					UpperCAmelCase__			:   Union[str, Any]      			=    _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
