



from dataclasses import dataclass
from typing import Optional, Tuple

import torch
from torch import nn
from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel
from transformers.utils import ModelOutput







@dataclass
class 				_a				(   _lowerCAmelCase					):
			A      		=	None
			A      		=	None
			A      		=	None
			A      		=	None







class 				_a				(   _lowerCAmelCase					):

			def __init__(self,   SCREAMING_SNAKE_CASE_=1,   SCREAMING_SNAKE_CASE_=0,   SCREAMING_SNAKE_CASE_=2,   SCREAMING_SNAKE_CASE_=512,   SCREAMING_SNAKE_CASE_="cls",   SCREAMING_SNAKE_CASE_=False,   SCREAMING_SNAKE_CASE_=True,   **SCREAMING_SNAKE_CASE_,   )       ->   Union[str, Any]:
						super().__init__(pad_token_id=SCREAMING_SNAKE_CASE_,   bos_token_id=SCREAMING_SNAKE_CASE_,   eos_token_id=SCREAMING_SNAKE_CASE_,   **SCREAMING_SNAKE_CASE_					)
						UpperCAmelCase_:		Any							      =     project_dim
						UpperCAmelCase_:		str							      =     pooler_fn
						UpperCAmelCase_:		int							      =     learn_encoder
						UpperCAmelCase_:		int							      =     use_attention_mask







class 				_a				(   _lowerCAmelCase					):
			A      		=	[r'''pooler''', r'''logit_scale''']
			A      		=	[r'''position_ids''', r'''predictions.decoder.bias''']
			A      		=	'''roberta'''
			A      		=	RobertaSeriesConfig

			def __init__(self,   SCREAMING_SNAKE_CASE_					)       ->   Optional[int]:
						super().__init__(SCREAMING_SNAKE_CASE_					)
						UpperCAmelCase_:		List[Any]							      =     XLMRobertaModel(SCREAMING_SNAKE_CASE_					)
						UpperCAmelCase_:		Tuple							      =     nn.Linear(config.hidden_size,   config.project_dim					)
						UpperCAmelCase_:		int							      =     getattr(SCREAMING_SNAKE_CASE_,   """has_pre_transformation""",   SCREAMING_SNAKE_CASE_					)
						if self.has_pre_transformation:
									UpperCAmelCase_:		Any							      =     nn.Linear(config.hidden_size,   config.project_dim					)
									UpperCAmelCase_:		int							      =     nn.LayerNorm(config.hidden_size,   eps=config.layer_norm_eps					)
						self.post_init()

			def      __snake_case       (self,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   SCREAMING_SNAKE_CASE_ = None,   )       ->   List[str]:
						UpperCAmelCase_:		Union[str, Any]							      =     return_dict if return_dict is not None else self.config.use_return_dict

						UpperCAmelCase_:		str							      =     self.base_model(
						    input_ids=SCREAMING_SNAKE_CASE_,   attention_mask=SCREAMING_SNAKE_CASE_,   token_type_ids=SCREAMING_SNAKE_CASE_,   position_ids=SCREAMING_SNAKE_CASE_,   head_mask=SCREAMING_SNAKE_CASE_,   inputs_embeds=SCREAMING_SNAKE_CASE_,   encoder_hidden_states=SCREAMING_SNAKE_CASE_,   encoder_attention_mask=SCREAMING_SNAKE_CASE_,   output_attentions=SCREAMING_SNAKE_CASE_,   output_hidden_states=True if self.has_pre_transformation else output_hidden_states,   return_dict=SCREAMING_SNAKE_CASE_,   )

						if self.has_pre_transformation:
									UpperCAmelCase_:		str							      =     outputs["""hidden_states"""][-2]
									UpperCAmelCase_:		Any							      =     self.pre_LN(SCREAMING_SNAKE_CASE_					)
									UpperCAmelCase_:		List[Any]							      =     self.transformation_pre(SCREAMING_SNAKE_CASE_					)

									return TransformationModelOutput(
									    projection_state=SCREAMING_SNAKE_CASE_,   last_hidden_state=outputs.last_hidden_state,   hidden_states=outputs.hidden_states,   attentions=outputs.attentions,   )
						else:
									UpperCAmelCase_:		Union[str, Any]							      =     self.transformation(outputs.last_hidden_state					)
									return TransformationModelOutput(
									    projection_state=SCREAMING_SNAKE_CASE_,   last_hidden_state=outputs.last_hidden_state,   hidden_states=outputs.hidden_states,   attentions=outputs.attentions,   )











def  lowerCAmelCase_	(lowerCAmelCase__:		list  ):





			"""simple docstring"""


			if len(lowerCAmelCase__  ) <= 1:
						return [tuple(lowerCAmelCase__  )]

			UpperCAmelCase_:		List[Any]							      =     []

			def generate(lowerCAmelCase__:		int		,						lowerCAmelCase__:		list  ):
						if k == 1:
									res.append(tuple(arr[:]  )  )
									return

						generate(k - 1		,						lowerCAmelCase__  )

						for i in range(k - 1  ):
									if k % 2 == 0:  # k is even
												UpperCAmelCase_      ,							UpperCAmelCase_:		Union[str, Any]							      =     arr[k - 1], arr[i]
									else:  # k is odd
												UpperCAmelCase_      ,							UpperCAmelCase_:		Optional[int]							      =     arr[k - 1], arr[0]
									generate(k - 1		,						lowerCAmelCase__  )

			generate(len(lowerCAmelCase__  )		,						lowerCAmelCase__  )
			return res


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






