



"""simple docstring"""







from functools import partial
from typing import Any, Callable, Dict, List, Type, TypeVar, Union, overload

import torch
import torch.nn as nn
import torch.types


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		# The first operation in a checkpoint can't be in-place, but it's
		# nice to have in-place addition during inference. Thus...
		if not inplace:
				_lowercase				: Any     =   ma + ma
		else:
				ma += ma

		return ma


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Any     =   -1 * len(snake_case_      )
		_lowercase				: List[Any]     =   list(range(len(tensor.shape[:zero_index]      )      )      )
		return tensor.permute(first_inds + [zero_index + i for i in inds]      )


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		return t.reshape(t.shape[:-no_dims] + (-1,)      )


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase = 1E-4      ):
		_lowercase				: Union[str, Any]     =   mask.expand(*value.shape      )
		return torch.sum(mask * value   ,				dim=snake_case_      ) / (eps + torch.sum(snake_case_   ,				dim=snake_case_      ))


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase = 2.3_1_2_5   ,				__UpperCAmelCase = 21.6875   ,				__UpperCAmelCase = 64      ):
		_lowercase				: List[Any]     =   torch.linspace(snake_case_   ,				snake_case_   ,				no_bins - 1   ,				device=pts.device      )
		_lowercase				: Union[str, Any]     =   torch.sqrt(torch.sum((pts.unsqueeze(-2      ) - pts.unsqueeze(-3      )) ** 2   ,				dim=-1      )      )
		return torch.bucketize(snake_case_   ,				snake_case_      )


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Any     =   dicts[0]
		_lowercase				: Tuple     =   {}
		for k, v in first.items():
				_lowercase				: List[str]     =   [d[k] for d in dicts]
				if isinstance(snake_case_   ,				snake_case_      ):
						_lowercase				: Dict     =   dict_multimap(snake_case_   ,				snake_case_      )
				else:
						_lowercase				: List[str]     =   fn(snake_case_      )

		return new_dict


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Optional[Any]     =   v_bins.view(((1,) * len(x.shape      )) + (len(snake_case_      ),)      )
		_lowercase				: Optional[int]     =   x[..., None] - reshaped_bins
		_lowercase				: Optional[int]     =   torch.argmin(torch.abs(snake_case_      )   ,				dim=-1      )
		return nn.functional.one_hot(snake_case_   ,				num_classes=len(snake_case_      )      ).float()


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase = 0   ,				__UpperCAmelCase = 0      ):
		_lowercase				: List[Union[slice, torch.Tensor]]     =   []
		for i, s in enumerate(data.shape[:no_batch_dims]      ):
				_lowercase				: Tuple     =   torch.arange(snake_case_      )
				_lowercase				: Optional[int]     =   r.view(*(*((1,) * i), -1, *((1,) * (len(inds.shape      ) - i - 1)))      )
				ranges.append(snake_case_      )

		_lowercase				: List[Union[slice, torch.Tensor]]     =   [slice(snake_case_      ) for _ in range(len(data.shape      ) - no_batch_dims      )]
		_lowercase				: Optional[Any]     =   inds
		ranges.extend(snake_case_      )
		# Matt note: Editing this to get around the behaviour of using a list as an array index changing
		# in recent Numpy versions
		return data[tuple(snake_case_      )]


UpperCAmelCase:  Optional[int]			     =				TypeVar("""T""")


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		_lowercase				: Dict[Any, Union[dict, list, tuple, Any]]     =   {}
		for k, v in dic.items():
				if isinstance(snake_case_   ,				snake_case_      ):
						_lowercase				: Any     =   dict_map(snake_case_   ,				snake_case_   ,				snake_case_      )
				else:
						_lowercase				: List[str]     =   tree_map(snake_case_   ,				snake_case_   ,				snake_case_      )

		return new_dict


@overload
def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		...


@overload
def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		...


@overload
def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		...


@overload
def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		...


def  __SCREAMING_SNAKE_CASE (  __UpperCAmelCase   ,				__UpperCAmelCase   ,				__UpperCAmelCase      ):
		if isinstance(snake_case_   ,				snake_case_      ):
				return dict_map(snake_case_   ,				snake_case_   ,				snake_case_      )
		elif isinstance(snake_case_   ,				snake_case_      ):
				return [tree_map(snake_case_   ,				snake_case_   ,				snake_case_      ) for x in tree]
		elif isinstance(snake_case_   ,				snake_case_      ):
				return tuple(tree_map(snake_case_   ,				snake_case_   ,				snake_case_      ) for x in tree      )
		elif isinstance(snake_case_   ,				snake_case_      ):
				return fn(snake_case_      )
		else:
				print(type(snake_case_      )      )
				raise ValueError("""Not supported"""      )
UpperCAmelCase:  Dict			     =				partial(tree_map, leaf_type=torch.Tensor)








'''simple docstring'''






def 				_SCREAMING_SNAKE_CASE(					snake_case_    :     List[str]  )		->Dict:






							'''simple docstring'''
							_lowercase							:		Optional[Any]				=   [7_01, 3_01, 1_32, 57, 23, 10, 4, 1]
							for gap in gaps:
														for i in range(snake_case_ ,       len(snake_case_  )  ):
																					_lowercase							:		int				=   collection[i]
																					_lowercase							:		Any				=   i
																					while j >= gap and collection[j - gap] > insert_value:
																												_lowercase							:		Optional[int]				=   collection[j - gap]
																												j -= gap
																					if j != i:
																												_lowercase							:		str				=   insert_value
							return collection


if __name__ == "__main__":
						from doctest import testmod

						testmod()
						lowerCamelCase__	  =		input('Enter numbers separated by a comma:\n').strip()
						lowerCamelCase__	  =		[int(item) for item in user_input.split(',')]
						print(shell_sort(unsorted))



