
def 					_a      (		lowerCamelCase							):
 # base case
 if len(lowerCamelCase							) == 1:
  return a[0], a[0]
 else:
  # split A into half.
  lowerCamelCase	:			Tuple           =   a[: len(lowerCamelCase							) // 2]
  lowerCamelCase	:			Any           =   a[len(lowerCamelCase							) // 2 :]

  # 2 sub problems, 1/2 of original size.
  lowerCamelCase    ,					lowerCamelCase	:			str           =   max_difference(lowerCamelCase							)
  lowerCamelCase    ,					lowerCamelCase	:			str           =   max_difference(lowerCamelCase							)

  # get min of first and max of second
  # linear time
  lowerCamelCase	:			Optional[Any]           =   min(lowerCamelCase							)
  lowerCamelCase	:			str           =   max(lowerCamelCase							)

  # 3 cases, either (small1, big1),
  # (min_first, max_second), (small2, big2)
  # constant comparisons
  if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
   return smalla, biga
  elif biga - smalla > max_second - min_first:
   return smalla, biga
  else:
   return min_first, max_second


if __name__ == "__main__":
      import doctest

      doctest.testmod()






from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_lowerCamelCase           ={
    """configuration_musicgen""": [
        """MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """MusicgenConfig""",
        """MusicgenDecoderConfig""",
    ],
    """processing_musicgen""": ["""MusicgenProcessor"""],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      _lowerCamelCase           =[
          """MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """MusicgenForConditionalGeneration""",
          """MusicgenForCausalLM""",
          """MusicgenModel""",
          """MusicgenPreTrainedModel""",
      ]

if TYPE_CHECKING:
      from .configuration_musicgen import (
          MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP,
          MusicgenConfig,
          MusicgenDecoderConfig,
      )
      from .processing_musicgen import MusicgenProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_musicgen import (
                MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST,
                MusicgenForCausalLM,
                MusicgenForConditionalGeneration,
                MusicgenModel,
                MusicgenPreTrainedModel,
            )

else:
      import sys

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




