




'''simple docstring'''


import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging


_snake_case      :      Optional[Any]   							=		logging.get_logger(__name__)

_snake_case      :      List[Any]   							=		{
    'facebook/sam-vit-huge': 'https://huggingface.co/facebook/sam-vit-huge/resolve/main/config.json',
    'facebook/sam-vit-large': 'https://huggingface.co/facebook/sam-vit-large/resolve/main/config.json',
    'facebook/sam-vit-base': 'https://huggingface.co/facebook/sam-vit-base/resolve/main/config.json',
}

class 			A    (		_a    ):







							def __init__(  self       :  str							,			lowerCAmelCase_       :  Optional[Any]=2_56							,			lowerCAmelCase_       :  List[str]=10_24							,			lowerCAmelCase_       :  Dict=16							,			lowerCAmelCase_       :  int=16							,			lowerCAmelCase_       :  Tuple=4							,			lowerCAmelCase_       :  Any="gelu"							,			lowerCAmelCase_       :  int=1e-6							,			**lowerCAmelCase_       :  Optional[Any]							,			)			->							Optional[Any]:


														"""simple docstring"""


														super().__init__(**lowerCAmelCase_					)
														_a	     =				hidden_size
														_a	     =				image_size
														_a	     =				patch_size
														_a	     =				image_size // patch_size
														_a	     =				mask_input_channels
														_a	     =				num_point_embeddings
														_a	     =				hidden_act
														_a	     =				layer_norm_eps



class 			A    (		_a    ):







							def __init__(  self       :  Dict							,			lowerCAmelCase_       :  Tuple=2_56							,			lowerCAmelCase_       :  Union[str, Any]="relu"							,			lowerCAmelCase_       :  List[Any]=20_48							,			lowerCAmelCase_       :  str=2							,			lowerCAmelCase_       :  Optional[Any]=8							,			lowerCAmelCase_       :  int=2							,			lowerCAmelCase_       :  Any=3							,			lowerCAmelCase_       :  int=3							,			lowerCAmelCase_       :  Union[str, Any]=2_56							,			lowerCAmelCase_       :  Any=1e-6							,			**lowerCAmelCase_       :  Any							,			)			->							Tuple:


														"""simple docstring"""


														super().__init__(**lowerCAmelCase_					)
														_a	     =				hidden_size
														_a	     =				hidden_act
														_a	     =				mlp_dim
														_a	     =				num_hidden_layers
														_a	     =				num_attention_heads
														_a	     =				attention_downsample_rate
														_a	     =				num_multimask_outputs
														_a	     =				iou_head_depth
														_a	     =				iou_head_hidden_dim
														_a	     =				layer_norm_eps



class 			A    (		_a    ):







							def __init__(  self       :  Union[str, Any]							,			lowerCAmelCase_       :  List[str]=7_68							,			lowerCAmelCase_       :  Dict=2_56							,			lowerCAmelCase_       :  int=12							,			lowerCAmelCase_       :  Optional[Any]=12							,			lowerCAmelCase_       :  Any=3							,			lowerCAmelCase_       :  str=10_24							,			lowerCAmelCase_       :  Optional[Any]=16							,			lowerCAmelCase_       :  Dict="gelu"							,			lowerCAmelCase_       :  List[str]=1e-06							,			lowerCAmelCase_       :  Tuple=0.0							,			lowerCAmelCase_       :  List[Any]=1e-10							,			lowerCAmelCase_       :  Dict=True							,			lowerCAmelCase_       :  str=4.0							,			lowerCAmelCase_       :  Optional[Any]=True							,			lowerCAmelCase_       :  List[Any]=True							,			lowerCAmelCase_       :  List[str]=14							,			lowerCAmelCase_       :  Optional[Any]=[2, 5, 8, 11]							,			lowerCAmelCase_       :  List[str]=1_28							,			lowerCAmelCase_       :  List[str]=None							,			**lowerCAmelCase_       :  Union[str, Any]							,			)			->							Optional[int]:


														"""simple docstring"""


														super().__init__(**lowerCAmelCase_					)

														_a	     =				hidden_size
														_a	     =				output_channels
														_a	     =				num_hidden_layers
														_a	     =				num_attention_heads
														_a	     =				num_channels
														_a	     =				image_size
														_a	     =				patch_size
														_a	     =				hidden_act
														_a	     =				layer_norm_eps
														_a	     =				attention_dropout
														_a	     =				initializer_range
														_a	     =				qkv_bias
														_a	     =				mlp_ratio
														_a	     =				use_abs_pos
														_a	     =				use_rel_pos
														_a	     =				window_size
														_a	     =				global_attn_indexes
														_a	     =				num_pos_feats
														_a	     =				int(hidden_size * mlp_ratio					) if mlp_dim is None else mlp_dim



class 			A    (		_a    ):
							lowercase_							=				'sam'
							lowercase_							=				True







							def __init__(  self       :  Dict							,			lowerCAmelCase_       :  List[str]=None							,			lowerCAmelCase_       :  List[str]=None							,			lowerCAmelCase_       :  Optional[Any]=None							,			lowerCAmelCase_       :  str=0.0_2							,			**lowerCAmelCase_       :  Optional[int]							,			)			->							List[str]:


														"""simple docstring"""


														super().__init__(**lowerCAmelCase_					)
														_a	     =				vision_config if vision_config is not None else {}
														_a	     =				prompt_encoder_config if prompt_encoder_config is not None else {}
														_a	     =				mask_decoder_config if mask_decoder_config is not None else {}

														if isinstance(lowerCAmelCase_							,			lowerCAmelCase_					):
																					_a	     =				vision_config.to_dict()
														if isinstance(lowerCAmelCase_							,			lowerCAmelCase_					):
																					_a	     =				prompt_encoder_config.to_dict()
														if isinstance(lowerCAmelCase_							,			lowerCAmelCase_					):
																					_a	     =				mask_decoder_config.to_dict()

														_a	     =				SamVisionConfig(**lowerCAmelCase_					)
														_a	     =				SamPromptEncoderConfig(**lowerCAmelCase_					)
														_a	     =				SamMaskDecoderConfig(**lowerCAmelCase_					)
														_a	     =				initializer_range







							def    __lowerCAmelCase			(  self       :  List[str]					)			->							List[Any]:


														"""simple docstring"""


														_a	     =				copy.deepcopy(self.__dict__					)
														_a	     =				self.vision_config.to_dict()
														_a	     =				self.prompt_encoder_config.to_dict()
														_a	     =				self.mask_decoder_config.to_dict()
														_a	     =				self.__class__.model_type
														return output







'''simple docstring'''


def 		snake_case_    (UpperCamelCase       :  List[str] ,						UpperCamelCase       :  List[Any] ,						UpperCamelCase       :  Union[str, Any]      ):





							'''simple docstring'''


							_a	     =				index
							_a	     =				2 * index + 1
							_a	     =				2 * index + 2
							if left_index < heap_size and unsorted[left_index] > unsorted[largest]:
														_a	     =				left_index

							if right_index < heap_size and unsorted[right_index] > unsorted[largest]:
														_a	     =				right_index

							if largest != index:
														_a     ,							_a	     =				unsorted[index], unsorted[largest]
														heapify(UpperCamelCase ,						UpperCamelCase ,						UpperCamelCase      )
def 		snake_case_    (UpperCamelCase       :  Union[str, Any]      ):





							'''simple docstring'''


							_a	     =				len(UpperCamelCase      )
							for i in range(n // 2 - 1 ,						-1 ,						-1      ):
														heapify(UpperCamelCase ,						UpperCamelCase ,						UpperCamelCase      )
							for i in range(n - 1 ,						0 ,						-1      ):
														_a     ,							_a	     =				unsorted[i], unsorted[0]
														heapify(UpperCamelCase ,						0 ,						UpperCamelCase      )
							return unsorted


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

