



"""simple docstring"""






import functools
import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


lowerCAmelCase__      =    threading.Lock()
lowerCAmelCase__      =    None

lowerCAmelCase__      =    {
    '''debug''': logging.DEBUG,
    '''info''': logging.INFO,
    '''warning''': logging.WARNING,
    '''error''': logging.ERROR,
    '''critical''': logging.CRITICAL,
}

lowerCAmelCase__      =    logging.WARNING

lowerCAmelCase__      =    True






def 	snake_case_  (				):


       '''simple docstring'''





       _lowerCamelCase						:    Optional[int]         =			os.getenv('''TRANSFORMERS_VERBOSITY''',    __lowerCAmelCase						)
       if env_level_str:
              if env_level_str in log_levels:
                     return log_levels[env_level_str]
              else:
                     logging.getLogger().warning(
                         F'''Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, '''
                         F'''has to be one of: { ", ".join(log_levels.keys()						) }'''						)
       return _default_log_level






def 	snake_case_  (				):


       '''simple docstring'''





       return __name__.split('''.'''						)[0]






def 	snake_case_  (				):


       '''simple docstring'''





       return logging.getLogger(_get_library_name()						)






def 	snake_case_  (				):


       '''simple docstring'''





       global _default_handler

       with _lock:
              if _default_handler:
                     # This library has already configured the library root logger.
                     return
              _lowerCamelCase						:    Union[str, Any]         =			logging.StreamHandler()  # Set sys.stderr as stream.
              _lowerCamelCase						:    str         =			sys.stderr.flush

              # Apply our default configuration to the library root logger.
              _lowerCamelCase						:    List[Any]         =			_get_library_root_logger()
              library_root_logger.addHandler(_default_handler						)
              library_root_logger.setLevel(_get_default_logging_level()						)
              _lowerCamelCase						:    Optional[int]         =			False






def 	snake_case_  (				):


       '''simple docstring'''





       global _default_handler

       with _lock:
              if not _default_handler:
                     return

              _lowerCamelCase						:    str         =			_get_library_root_logger()
              library_root_logger.removeHandler(_default_handler						)
              library_root_logger.setLevel(logging.NOTSET						)
              _lowerCamelCase						:    Optional[Any]         =			None






def 	snake_case_  (				):


       '''simple docstring'''





       return log_levels






def 	snake_case_  (				A_ :		Optional[Any] = None						):


       '''simple docstring'''





       if name is None:
              _lowerCamelCase						:    int         =			_get_library_name()

       _configure_library_root_logger()
       return logging.getLogger(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       _configure_library_root_logger()
       return _get_library_root_logger().getEffectiveLevel()






def 	snake_case_  (				A_ :		Optional[Any]						):


       '''simple docstring'''





       _configure_library_root_logger()
       _get_library_root_logger().setLevel(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       return set_verbosity(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       return set_verbosity(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       return set_verbosity(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       return set_verbosity(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       _configure_library_root_logger()

       assert _default_handler is not None
       _get_library_root_logger().removeHandler(_default_handler						)






def 	snake_case_  (				):


       '''simple docstring'''





       _configure_library_root_logger()

       assert _default_handler is not None
       _get_library_root_logger().addHandler(_default_handler						)






def 	snake_case_  (				A_ :		str						):


       '''simple docstring'''





       _configure_library_root_logger()

       assert handler is not None
       _get_library_root_logger().addHandler(__lowerCAmelCase						)






def 	snake_case_  (				A_ :		int						):


       '''simple docstring'''





       _configure_library_root_logger()

       assert handler is not None and handler not in _get_library_root_logger().handlers
       _get_library_root_logger().removeHandler(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       _configure_library_root_logger()
       _lowerCamelCase						:    int         =			False






def 	snake_case_  (				):


       '''simple docstring'''





       _configure_library_root_logger()
       _lowerCamelCase						:    Tuple         =			True






def 	snake_case_  (				):


       '''simple docstring'''





       _lowerCamelCase						:    List[Any]         =			_get_library_root_logger().handlers

       for handler in handlers:
              _lowerCamelCase						:    str         =			logging.Formatter('''[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'''						)
              handler.setFormatter(__lowerCAmelCase						)






def 	snake_case_  (				):


       '''simple docstring'''





       _lowerCamelCase						:    int         =			_get_library_root_logger().handlers

       for handler in handlers:
              handler.setFormatter(__lowerCAmelCase						)






def 	snake_case_  (				self :		Dict,    *A_ :		str,    **A_ :		Union[str, Any]						):


       '''simple docstring'''





       _lowerCamelCase						:    Optional[Any]         =			os.getenv('''TRANSFORMERS_NO_ADVISORY_WARNINGS''',    __lowerCAmelCase						)
       if no_advisory_warnings:
              return
       self.warning(*__lowerCAmelCase,    **__lowerCAmelCase						)


lowerCAmelCase__      =    warning_advice






@functools.lru_cache(__lowerCAmelCase						)
def 	snake_case_  (				self :		Tuple,    *A_ :		List[str],    **A_ :		Dict						):


       '''simple docstring'''





       self.warning(*__lowerCAmelCase,    **__lowerCAmelCase						)


lowerCAmelCase__      =    warning_once






class 	__snake_case	:




  def __init__(			self					:						List[str]						, *__lowerCAmelCase					:						Union[str, Any]						, **__lowerCAmelCase					:						str		):  # pylint: disable=unused-argument






         """simple docstring"""






         _lowerCamelCase						:    Any         =			args[0] if args else None




  def __iter__(			self					:						Optional[Any]		):






         """simple docstring"""






         return iter(self._iterator		)




  def __getattr__(			self					:						Any						, __lowerCAmelCase					:						Tuple		):






         """simple docstring"""






         def empty_fn(*__lowerCAmelCase					:						Any						, **__lowerCAmelCase					:						List[str]		):  # pylint: disable=unused-argument
                return

         return empty_fn




  def __enter__(			self					:						Any		):






         """simple docstring"""






         return self




  def __exit__(			self					:						Dict						, __lowerCAmelCase					:						List[Any]						, __lowerCAmelCase					:						Dict						, __lowerCAmelCase					:						int		):






         """simple docstring"""






         return






class 	__snake_case	:




  def __call__(			self					:						int						, *__lowerCAmelCase					:						str						, **__lowerCAmelCase					:						str		):






         """simple docstring"""






         if _tqdm_active:
                return tqdm_lib.tqdm(*snake_case__						, **snake_case__		)
         else:
                return EmptyTqdm(*snake_case__						, **snake_case__		)




  def 						SCREAMING_SNAKE_CASE    (			self					:						Optional[int]						, *__lowerCAmelCase					:						Union[str, Any]						, **__lowerCAmelCase					:						List[str]		):






         """simple docstring"""






         _lowerCamelCase						:    Union[str, Any]         =			None
         if _tqdm_active:
                return tqdm_lib.tqdm.set_lock(*snake_case__						, **snake_case__		)




  def 						SCREAMING_SNAKE_CASE    (			self					:						Dict		):






         """simple docstring"""






         if _tqdm_active:
                return tqdm_lib.tqdm.get_lock()


lowerCAmelCase__      =    _tqdm_cls()






def 	snake_case_  (				):


       '''simple docstring'''





       global _tqdm_active
       return bool(_tqdm_active						)






def 	snake_case_  (				):


       '''simple docstring'''





       global _tqdm_active
       _lowerCamelCase						:    Dict         =			True
       hf_hub_utils.enable_progress_bars()







def 	snake_case_  (				):


       '''simple docstring'''





       global _tqdm_active
       _lowerCamelCase						:    List[str]         =			False
       hf_hub_utils.disable_progress_bars()







"""simple docstring"""






def 	snake_case_  (				A_ :		list						):


       '''simple docstring'''





       _lowerCamelCase						:    Union[str, Any]         =			len(A_						)
       for i in range(1,    A_						):
              _lowerCamelCase						:    Tuple         =			collection[i]
              _lowerCamelCase						:    Dict         =			0
              _lowerCamelCase						:    Any         =			i - 1

              while low <= high:
                     _lowerCamelCase						:    Optional[int]         =			(low + high) // 2
                     if val < collection[mid]:
                            _lowerCamelCase						:    List[str]         =			mid - 1
                     else:
                            _lowerCamelCase						:    Dict         =			mid + 1
              for j in range(A_,    A_,    -1						):
                     _lowerCamelCase						:    Optional[int]         =			collection[j - 1]
              _lowerCamelCase						:    Tuple         =			val
       return collection


if __name__ == "__main__":
   lowerCAmelCase__      =    input('''Enter numbers separated by a comma:\n''').strip()
   lowerCAmelCase__      =    [int(item) for item in user_input.split(''',''')]
   print(binary_insertion_sort(unsorted))


