



"""simple docstring"""





import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import CONFIG_MAPPING


__lowerCAmelCase       :					List[Any]      					=					logging.get_logger(__name__)



class    _lowerCAmelCase    (				SCREAMING_SNAKE_CASE__		):





		"""simple docstring"""






		_lowerCamelCase			  =       '''upernet'''





		def __init__(					self							,    _lowercase=None							,    _lowercase=5_1_2							,    _lowercase=0.02							,    _lowercase=[1, 2, 3, 6]							,    _lowercase=True							,    _lowercase=0.4							,    _lowercase=3_8_4							,    _lowercase=2_5_6							,    _lowercase=1							,    _lowercase=False							,    _lowercase=2_5_5							,    **_lowercase							,    ) ->						List[Any]:







								'''simple docstring'''

								super().__init__(**_lowercase   )

								if backbone_config is None:
														logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""   )
														snake_case_   : Optional[Any]						=			CONFIG_MAPPING["""resnet"""](out_features=["""stage1""", """stage2""", """stage3""", """stage4"""]   )
								elif isinstance(_lowercase							,    _lowercase   ):
														snake_case_   : List[Any]						=			backbone_config.get("""model_type"""   )
														snake_case_   : Optional[Any]						=			CONFIG_MAPPING[backbone_model_type]
														snake_case_   : Any						=			config_class.from_dict(_lowercase   )

								snake_case_   : str						=			backbone_config
								snake_case_   : Union[str, Any]						=			hidden_size
								snake_case_   : Dict						=			initializer_range
								snake_case_   : Union[str, Any]						=			pool_scales
								snake_case_   : Optional[Any]						=			use_auxiliary_head
								snake_case_   : Any						=			auxiliary_loss_weight
								snake_case_   : List[Any]						=			auxiliary_in_channels
								snake_case_   : str						=			auxiliary_channels
								snake_case_   : Dict						=			auxiliary_num_convs
								snake_case_   : List[Any]						=			auxiliary_concat_input
								snake_case_   : int						=			loss_ignore_index





		def    UpperCAmelCase__							(					self   ) ->						List[str]:







								'''simple docstring'''

								snake_case_   : List[Any]						=			copy.deepcopy(self.__dict__   )
								snake_case_   : Optional[int]						=			self.backbone_config.to_dict()
								snake_case_   : Dict						=			self.__class__.model_type
								return output






"""simple docstring"""





def 	__lowerCAmelCase						(		__UpperCamelCase      :			int					, __UpperCamelCase      :			int    ):


						'''simple docstring'''






						snake_case_   : Any						=			1  # To kept the Calculated Value
						# Since C(n, k) = C(n, n-k)
						if k > (n - k):
												snake_case_   : Optional[int]						=			n - k
						# Calculate C(n,k)
						for i in range(__UpperCamelCase    ):
												result *= n - i
												result //= i + 1
						return result
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						return binomial_coefficient(2 * node_count					, __UpperCamelCase    ) // (node_count + 1)
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						if n < 0:
												raise ValueError("""factorial() not defined for negative values"""    )
						snake_case_   : Optional[int]						=			1
						for i in range(1					, n + 1    ):
												result *= i
						return result
def 	__lowerCAmelCase						(		__UpperCamelCase      :			int    ):


						'''simple docstring'''






						return catalan_number(__UpperCamelCase    ) * factorial(__UpperCamelCase    )


if __name__ == "__main__":
					__lowerCAmelCase       :					Optional[Any]      					=					int(input('''Enter the number of nodes: ''').strip() or 0)
					if node_count <= 0:
										raise ValueError('''We need some nodes to work with.''')
					print(
					    F'''Given {node_count} nodes, there are {binary_tree_count(node_count)} '''
					    F'''binary trees and {catalan_number(node_count)} binary search trees.'''
					)

