code: 
  
  from __future__ import annotations
  
  
  
  
  def     UpperCAmelCase__       (    _A   :				List[Any]			,   _A   :				List[Any]							):
  
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    a__						=0
    a__						=len(_A							) - 1
    while left <= right:
      a__						=(left + right) // 2
      if left == right:
        if sorted_list[middle] < item:
          a__						=middle + 1
        break
      elif sorted_list[middle] < item:
        a__						=middle + 1
      else:
        a__						=middle - 1
    sorted_list.insert(_A			,   _A							)
    return sorted_list
  
  
  
  
  def     UpperCAmelCase__       (    _A   :				Any			,   _A   :				Tuple							):
  
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    a__						=[]
    while left and right:
      if left[0][0] < right[0][0]:
        result.append(left.pop(0							)							)
      else:
        result.append(right.pop(0							)							)
    return result + left + right
  
  
  
  
  def     UpperCAmelCase__       (    _A   :				Optional[Any]							):
  
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    a__						=len(_A							)
    if length <= 1:
      return list_ad
    a__						=length // 2
    return merge(sortlist_ad(list_ad[:middle]							)			,   sortlist_ad(list_ad[middle:]							)							)
  
  
  
  
  def     UpperCAmelCase__       (    _A   :				list[int]							):
  
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    if len(_A							) <= 1:
      return collection
    a__						=[]
    a__						=False
    for i in range(0			,   len(_A							)			,   2							):
      if i == len(_A							) - 1:
        a__						=True
      else:
        if collection[i] < collection[i + 1]:
          two_paired_list.append([collection[i], collection[i + 1]]							)
        else:
          two_paired_list.append([collection[i + 1], collection[i]]							)
    a__						=sortlist_ad(_A							)
    a__						=[i[0] for i in sorted_list_ad]
    result.append(sorted_list_ad[-1][1]							)
    if has_last_odd_item:
      a__						=collection[-1]
      a__						=binary_search_insertion(_A			,   _A							)
    a__						=False
    for i in range(len(_A							) - 1							):
      if result[i] == collection[-1] and has_last_odd_item:
        a__						=True
      a__						=sorted_list_ad[i][1]
      # If last_odd_item is inserted before the item's index,
      # you should forward index one more.
      if is_last_odd_item_inserted_before_this_index:
        a__						=result[: i + 2] + binary_search_insertion(result[i + 2 :]			,   _A							)
      else:
        a__						=result[: i + 1] + binary_search_insertion(result[i + 1 :]			,   _A							)
  
    return result
  
  
  if __name__ == "__main__":
         lowerCamelCase     =      input('''Enter numbers separated by a comma:\n''').strip()
         lowerCamelCase     =      [int(item) for item in user_input.split(''',''')]
         print(merge_insertion_sort(unsorted))
  
style_context: 
  
  import unittest
  
  import numpy as np
  
  from transformers.testing_utils import require_torch, require_vision
  from transformers.utils import is_torch_available, is_vision_available
  
  from ...test_image_processing_common import ImageProcessingSavingTestMixin
  
  
  if is_torch_available():
         import torch
  
  if is_vision_available():
         from PIL import Image
  
         from transformers import TvltImageProcessor
  
  
  
  
  def     UpperCAmelCase__       (    _A   :				Optional[int]			,   _A   :				List[Any]=10			,   _A   :				Optional[int]=10			,   _A   :				Dict=False			,   _A   :				Any=False							):
  
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    a__						=[]
    for i in range(image_processor_tester.num_frames							):
      video.append(np.random.randint(2_55			,   size=(image_processor_tester.num_channels, width, height)			,   dtype=np.uinta							)							)
  
    if not numpify and not torchify:
      # PIL expects the channel dimension as last dimension
      a__						=[Image.fromarray(np.moveaxis(_A			,   0			,   -1							)							) for frame in video]
  
    if torchify:
      a__						=[torch.from_numpy(_A							) for frame in video]
  
    return video
  
  
  
  
  def     UpperCAmelCase__       (    _A   :				List[str]			,   _A   :				Optional[int]=False			,   _A   :				Dict=False			,   _A   :				Optional[Any]=False							):
  
  
  
  
  
    '''simple docstring'''
  
  
  
  
  
  
  
    assert not (numpify and torchify), "You cannot specify both numpy and PyTorch tensors at the same time"
  
    a__						=[]
    for i in range(image_processor_tester.batch_size							):
      if equal_resolution:
        a__						=a__						=image_processor_tester.max_resolution
      else:
        a__,   a__						=np.random.choice(
            np.arange(image_processor_tester.min_resolution			,   image_processor_tester.max_resolution							)			,   2							)
        a__						=prepare_video(
            image_processor_tester=_A			,   width=_A			,   height=_A			,   numpify=_A			,   torchify=_A			,   )
      video_inputs.append(_A							)
  
    return video_inputs
  
  
  
  
  
  
  
  class 		__magic_name__    (							unittest.TestCase							):
  
     '''simple docstring'''
  
  
  
  
     def __init__(       self,					lowercase_,					lowercase_=7,					lowercase_=3,					lowercase_=4,					lowercase_=18,					lowercase_=30,					lowercase_=400,					lowercase_=True,					lowercase_=None,					lowercase_=True,					lowercase_=[0.5, 0.5, 0.5],					lowercase_=[0.5, 0.5, 0.5],					lowercase_=True,					lowercase_=None,					)							->					Optional[int]:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=size if size is not None else {'''shortest_edge''': 18}
       a__						=crop_size if crop_size is not None else {'''height''': 18, '''width''': 18}
  
       a__						=parent
       a__						=batch_size
       a__						=num_channels
       a__						=num_frames
       a__						=image_size
       a__						=min_resolution
       a__						=max_resolution
       a__						=do_resize
       a__						=size
       a__						=do_normalize
       a__						=image_mean
       a__						=image_std
       a__						=do_center_crop
       a__						=crop_size
  
  
  
     def 				_UpperCAmelCase				(       self )							->					Any:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       return {
           "image_mean": self.image_mean,
           "image_std": self.image_std,
           "do_normalize": self.do_normalize,
           "do_resize": self.do_resize,
           "size": self.size,
           "do_center_crop": self.do_center_crop,
           "crop_size": self.crop_size,
       }
  
  
  
  
  
  
  
  @require_torch
  @require_vision
  class 		__magic_name__    (							lowerCamelCase__	, unittest.TestCase							):
  
     '''simple docstring'''
  
  
  
  
     lowerCamelCase__				:			str												=     TvltImageProcessor if is_vision_available() else None
  
  
  
     def 				_UpperCAmelCase				(       self )							->					Optional[Any]:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=TvltImageProcessorTester(self )
  
  
  
     @property
     def 				_UpperCAmelCase				(       self )							->					Optional[Any]:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       return self.image_processor_tester.prepare_image_processor_dict()
  
  
  
     def 				_UpperCAmelCase				(       self )							->					str:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=self.image_processing_class(**self.image_processor_dict )
       self.assertTrue(hasattr(lowercase_,					'''image_mean''' ) )
       self.assertTrue(hasattr(lowercase_,					'''image_std''' ) )
       self.assertTrue(hasattr(lowercase_,					'''do_normalize''' ) )
       self.assertTrue(hasattr(lowercase_,					'''do_resize''' ) )
       self.assertTrue(hasattr(lowercase_,					'''do_center_crop''' ) )
       self.assertTrue(hasattr(lowercase_,					'''size''' ) )
  
  
  
     def 				_UpperCAmelCase				(       self )							->					Tuple:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=self.image_processing_class(**self.image_processor_dict )
       # create random PIL videos
       a__						=prepare_video_inputs(self.image_processor_tester,					equal_resolution=lowercase_ )
       for video in video_inputs:
         self.assertIsInstance(lowercase_,					lowercase_ )
         self.assertIsInstance(video[0],					Image.Image )
  
       # Test not batched input
       a__						=image_processor(video_inputs[0],					return_tensors='''pt''' ).pixel_values
       self.assertEqual(
           encoded_videos.shape,					(
               1,
               self.image_processor_tester.num_frames,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size['''height'''],
               self.image_processor_tester.crop_size['''width'''],
           ),					)
  
       # Test batched
       a__						=image_processor(lowercase_,					return_tensors='''pt''' ).pixel_values
       self.assertEqual(
           encoded_videos.shape,					(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_frames,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size['''height'''],
               self.image_processor_tester.crop_size['''width'''],
           ),					)
  
  
  
     def 				_UpperCAmelCase				(       self )							->					int:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=self.image_processing_class(**self.image_processor_dict )
       # create random numpy tensors
       a__						=prepare_video_inputs(self.image_processor_tester,					equal_resolution=lowercase_,					numpify=lowercase_ )
       for video in video_inputs:
         self.assertIsInstance(lowercase_,					lowercase_ )
         self.assertIsInstance(video[0],					np.ndarray )
  
       # Test not batched input
       a__						=image_processor(video_inputs[0],					return_tensors='''pt''' ).pixel_values
       self.assertEqual(
           encoded_videos.shape,					(
               1,
               self.image_processor_tester.num_frames,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size['''height'''],
               self.image_processor_tester.crop_size['''width'''],
           ),					)
  
       # Test batched
       a__						=image_processor(lowercase_,					return_tensors='''pt''' ).pixel_values
       self.assertEqual(
           encoded_videos.shape,					(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_frames,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size['''height'''],
               self.image_processor_tester.crop_size['''width'''],
           ),					)
  
  
  
     def 				_UpperCAmelCase				(       self )							->					int:
  
  
  
  
  
  
       """simple docstring"""
  
  
  
  
  
  
       a__						=self.image_processing_class(**self.image_processor_dict )
       # create random PyTorch tensors
       a__						=prepare_video_inputs(self.image_processor_tester,					equal_resolution=lowercase_,					torchify=lowercase_ )
       for video in video_inputs:
         self.assertIsInstance(lowercase_,					lowercase_ )
         self.assertIsInstance(video[0],					torch.Tensor )
  
       # Test not batched input
       a__						=image_processor(video_inputs[0],					return_tensors='''pt''' ).pixel_values
       self.assertEqual(
           encoded_videos.shape,					(
               1,
               self.image_processor_tester.num_frames,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size['''height'''],
               self.image_processor_tester.crop_size['''width'''],
           ),					)
  
       # Test batched
       a__						=image_processor(lowercase_,					return_tensors='''pt''' ).pixel_values
       self.assertEqual(
           encoded_videos.shape,					(
               self.image_processor_tester.batch_size,
               self.image_processor_tester.num_frames,
               self.image_processor_tester.num_channels,
               self.image_processor_tester.crop_size['''height'''],
               self.image_processor_tester.crop_size['''width'''],
           ),					)
  