






'''simple docstring'''


from collections import defaultdict







def 	__magic_name__( _A					):
						'''simple docstring'''





						UpperCamelCase__         = 1
						UpperCamelCase__         = True
						for v in tree[start]:
												if v not in visited:
																		ret += dfs(_A					)
						if ret % 2 == 0:
												cuts.append(_A					)
						return ret







def 	__magic_name__( ):
						'''simple docstring'''





						dfs(1					)


if __name__ == "__main__":
					lowerCamelCase_	,     lowerCamelCase_				: int    	=							10, 9
					lowerCamelCase_				: int    	=							defaultdict(list)
					lowerCamelCase_				: dict[int, bool]    	=							{}
					lowerCamelCase_				: list[int]    	=							[]
					lowerCamelCase_				: Union[str, Any]    	=							0
					lowerCamelCase_				: Tuple    	=							[(2, 1), (3, 1), (4, 3), (5, 2), (6, 1), (7, 2), (8, 6), (9, 8), (10, 8)]
					for u, v in edges:
										tree[u].append(v)
										tree[v].append(u)
					even_tree()
					print(len(cuts) - 1)








'''simple docstring'''


import copy

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


lowerCamelCase_				: str    	=							logging.get_logger(__name__)

lowerCamelCase_				: Optional[int]    	=							{
    '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.json''',
    # See all Deformable DETR models at https://huggingface.co/models?filter=deformable-detr
}
class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE	):


			'''simple docstring'''





			__a							:							Tuple					     =					"deformable_detr"
			__a							:							str					     =					{
			    "hidden_size": "d_model",
			    "num_attention_heads": "encoder_attention_heads",
			}






			def __init__(   self							:						List[Any] ,      lowercase							:						List[Any]=True ,      lowercase							:						Tuple=None ,      lowercase							:						Tuple=3 ,      lowercase							:						List[str]=3_0_0 ,      lowercase							:						List[Any]=1_0_2_4 ,      lowercase							:						List[Any]=6 ,      lowercase							:						Tuple=1_0_2_4 ,      lowercase							:						Union[str, Any]=8 ,      lowercase							:						Optional[Any]=6 ,      lowercase							:						Tuple=1_0_2_4 ,      lowercase							:						Any=8 ,      lowercase							:						List[str]=0.0 ,      lowercase							:						Any=True ,      lowercase							:						Union[str, Any]="relu" ,      lowercase							:						Dict=2_5_6 ,      lowercase							:						Optional[int]=0.1 ,      lowercase							:						Optional[int]=0.0 ,      lowercase							:						List[str]=0.0 ,      lowercase							:						Any=0.0_2 ,      lowercase							:						Optional[int]=1.0 ,      lowercase							:						Tuple=True ,      lowercase							:						Optional[int]=False ,      lowercase							:						Any="sine" ,      lowercase							:						List[str]="resnet50" ,      lowercase							:						List[str]=True ,      lowercase							:						Optional[int]=False ,      lowercase							:						int=4 ,      lowercase							:						str=4 ,      lowercase							:						Dict=4 ,      lowercase							:						int=False ,      lowercase							:						List[Any]=3_0_0 ,      lowercase							:						List[Any]=False ,      lowercase							:						Dict=1 ,      lowercase							:						int=5 ,      lowercase							:						List[Any]=2 ,      lowercase							:						List[str]=1 ,      lowercase							:						Tuple=1 ,      lowercase							:						Dict=5 ,      lowercase							:						Dict=2 ,      lowercase							:						Dict=0.1 ,      lowercase							:						List[str]=0.2_5 ,      lowercase							:						Tuple=False ,      **lowercase							:						str ,      )							->    str:

									'''simple docstring'''







									if backbone_config is not None and use_timm_backbone:
															raise ValueError("""You can't specify both `backbone_config` and `use_timm_backbone`."""			)

									if not use_timm_backbone:
															if backbone_config is None:
																					logger.info("""`backbone_config` is `None`. Initializing the config with the default `ResNet` backbone."""			)
																					UpperCamelCase__         = CONFIG_MAPPING["""resnet"""](out_features=["""stage4"""]			)
															elif isinstance(lowercase ,      lowercase			):
																					UpperCamelCase__         = backbone_config.get("""model_type"""			)
																					UpperCamelCase__         = CONFIG_MAPPING[backbone_model_type]
																					UpperCamelCase__         = config_class.from_dict(lowercase			)
									UpperCamelCase__         = use_timm_backbone
									UpperCamelCase__         = backbone_config
									UpperCamelCase__         = num_channels
									UpperCamelCase__         = num_queries
									UpperCamelCase__         = max_position_embeddings
									UpperCamelCase__         = d_model
									UpperCamelCase__         = encoder_ffn_dim
									UpperCamelCase__         = encoder_layers
									UpperCamelCase__         = encoder_attention_heads
									UpperCamelCase__         = decoder_ffn_dim
									UpperCamelCase__         = decoder_layers
									UpperCamelCase__         = decoder_attention_heads
									UpperCamelCase__         = dropout
									UpperCamelCase__         = attention_dropout
									UpperCamelCase__         = activation_dropout
									UpperCamelCase__         = activation_function
									UpperCamelCase__         = init_std
									UpperCamelCase__         = init_xavier_std
									UpperCamelCase__         = encoder_layerdrop
									UpperCamelCase__         = auxiliary_loss
									UpperCamelCase__         = position_embedding_type
									UpperCamelCase__         = backbone
									UpperCamelCase__         = use_pretrained_backbone
									UpperCamelCase__         = dilation
									# deformable attributes
									UpperCamelCase__         = num_feature_levels
									UpperCamelCase__         = encoder_n_points
									UpperCamelCase__         = decoder_n_points
									UpperCamelCase__         = two_stage
									UpperCamelCase__         = two_stage_num_proposals
									UpperCamelCase__         = with_box_refine
									if two_stage is True and with_box_refine is False:
															raise ValueError("""If two_stage is True, with_box_refine must be True."""			)
									# Hungarian matcher
									UpperCamelCase__         = class_cost
									UpperCamelCase__         = bbox_cost
									UpperCamelCase__         = giou_cost
									# Loss coefficients
									UpperCamelCase__         = mask_loss_coefficient
									UpperCamelCase__         = dice_loss_coefficient
									UpperCamelCase__         = bbox_loss_coefficient
									UpperCamelCase__         = giou_loss_coefficient
									UpperCamelCase__         = eos_coefficient
									UpperCamelCase__         = focal_alpha
									UpperCamelCase__         = disable_custom_kernels
									super().__init__(is_encoder_decoder=lowercase ,      **lowercase			)






			@property
			def 				A      (   self							:						str			)							->    int:

									'''simple docstring'''







									return self.encoder_attention_heads






			@property
			def 				A      (   self							:						Tuple			)							->    int:

									'''simple docstring'''







									return self.d_model







			def 				A      (   self							:						Dict			)							->    Optional[Any]:

									'''simple docstring'''







									UpperCamelCase__         = copy.deepcopy(self.__dict__			)
									if self.backbone_config is not None:
															UpperCamelCase__         = self.backbone_config.to_dict()
									UpperCamelCase__         = self.__class__.model_type
									return output
