
'''simple docstring'''




from collections import Counter
from pathlib import Path
from typing import Optional, Tuple

import yaml





class 					A							(				yaml.SafeLoader		):





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






         """simple docstring"""






         A			:  List[Any]   =		[self.constructed_objects[key_node] for key_node, _ in node.value]
         A			:  str   =		[tuple(SCREAMING_SNAKE_CASE      ) if isinstance(SCREAMING_SNAKE_CASE		,     SCREAMING_SNAKE_CASE      ) else key for key in keys]
         A			:  str   =		Counter(SCREAMING_SNAKE_CASE      )
         A			:  Union[str, Any]   =		[key for key in counter if counter[key] > 1]
         if duplicate_keys:
             raise TypeError(F'Got duplicate yaml keys: {duplicate_keys}'      )





     def 							__lowerCAmelCase				(				self		,     SCREAMING_SNAKE_CASE		,     SCREAMING_SNAKE_CASE=False      )					->							str:






         """simple docstring"""






         A			:  List[Any]   =		super().construct_mapping(SCREAMING_SNAKE_CASE		,     deep=SCREAMING_SNAKE_CASE      )
         self._check_no_duplicates_on_constructed_node(SCREAMING_SNAKE_CASE      )
         return mapping







def 						lowerCAmelCase_							(  snake_case__		):




    '''simple docstring'''



    A			:  Union[str, Any]   =		list(readme_content.splitlines()		)
    if full_content and full_content[0] == "---" and "---" in full_content[1:]:
        A			:  Any   =		full_content[1:].index('''---'''		) + 1
        A			:  Optional[int]   =		'''\n'''.join(full_content[1:sep_idx]		)
        return yamlblock, "\n".join(full_content[sep_idx + 1 :]		)

    return None, "\n".join(snake_case__		)





class 					A							(				__snake_case		):
     # class attributes
     __magic_name__          =						{'''train_eval_index'''}  # train-eval-index in the YAML metadata





     @classmethod
     def 							__lowerCAmelCase				(				cls		,     SCREAMING_SNAKE_CASE      )					->							"DatasetMetadata":






         """simple docstring"""






         with open(SCREAMING_SNAKE_CASE		,     encoding='''utf-8'''      ) as readme_file:
             A,    A			:  Dict   =		_split_yaml_from_readme(readme_file.read()      )
         if yaml_string is not None:
             return cls.from_yaml_string(SCREAMING_SNAKE_CASE      )
         else:
             return cls()





     def 							__lowerCAmelCase				(				self		,     SCREAMING_SNAKE_CASE      )					->							Optional[Any]:






         """simple docstring"""






         if path.exists():
             with open(SCREAMING_SNAKE_CASE		,     encoding='''utf-8'''      ) as readme_file:
                 A			:  List[str]   =		readme_file.read()
         else:
             A			:  int   =		None
         A			:  int   =		self._to_readme(SCREAMING_SNAKE_CASE      )
         with open(SCREAMING_SNAKE_CASE		,     '''w'''		,     encoding='''utf-8'''      ) as readme_file:
             readme_file.write(SCREAMING_SNAKE_CASE      )





     def 							__lowerCAmelCase				(				self		,     SCREAMING_SNAKE_CASE = None      )					->							str:






         """simple docstring"""






         if readme_content is not None:
             A,    A			:  List[Any]   =		_split_yaml_from_readme(SCREAMING_SNAKE_CASE      )
             A			:  str   =		'''---\n''' + self.to_yaml_string() + '''---\n''' + content
         else:
             A			:  int   =		'''---\n''' + self.to_yaml_string() + '''---\n'''
         return full_content





     @classmethod
     def 							__lowerCAmelCase				(				cls		,     SCREAMING_SNAKE_CASE      )					->							"DatasetMetadata":






         """simple docstring"""






         A			:  Optional[Any]   =		yaml.load(SCREAMING_SNAKE_CASE		,     Loader=_NoDuplicateSafeLoader      ) or {}

         # Convert the YAML keys to DatasetMetadata fields
         A			:  Any   =		{
             (key.replace('''-'''		,     '''_'''      ) if key.replace('''-'''		,     '''_'''      ) in cls._FIELDS_WITH_DASHES else key): value
             for key, value in metadata_dict.items()
         }
         return cls(**SCREAMING_SNAKE_CASE      )





     def 							__lowerCAmelCase				(				self      )					->							str:






         """simple docstring"""






         return yaml.safe_dump(
             {
                 (key.replace('''_'''		,     '''-'''      ) if key in self._FIELDS_WITH_DASHES else key): value
                 for key, value in self.items()
             }		,     sort_keys=SCREAMING_SNAKE_CASE		,     allow_unicode=SCREAMING_SNAKE_CASE		,     encoding='''utf-8'''		,     ).decode('''utf-8'''      )





lowercase     :							List[Any]       						=     {
    'image-classification': [],
    'translation': [],
    'image-segmentation': [],
    'fill-mask': [],
    'automatic-speech-recognition': [],
    'token-classification': [],
    'sentence-similarity': [],
    'audio-classification': [],
    'question-answering': [],
    'summarization': [],
    'zero-shot-classification': [],
    'table-to-text': [],
    'feature-extraction': [],
    'other': [],
    'multiple-choice': [],
    'text-classification': [],
    'text-to-image': [],
    'text2text-generation': [],
    'zero-shot-image-classification': [],
    'tabular-classification': [],
    'tabular-regression': [],
    'image-to-image': [],
    'tabular-to-text': [],
    'unconditional-image-generation': [],
    'text-retrieval': [],
    'text-to-speech': [],
    'object-detection': [],
    'audio-to-audio': [],
    'text-generation': [],
    'conversational': [],
    'table-question-answering': [],
    'visual-question-answering': [],
    'image-to-text': [],
    'reinforcement-learning': [],
    'voice-activity-detection': [],
    'time-series-forecasting': [],
    'document-question-answering': [],
}


if __name__ == "__main__":
      from argparse import ArgumentParser

      lowercase     :							Any       						=     ArgumentParser(usage='Validate the yaml metadata block of a README.md file.')
      ap.add_argument('readme_filepath')
      lowercase     :							str       						=     ap.parse_args()

      lowercase     :							str       						=     Path(args.readme_filepath)
      lowercase     :							str       						=     DatasetMetadata.from_readme(readme_filepath)
      print(dataset_metadata)
      dataset_metadata.to_readme(readme_filepath)






'''simple docstring'''




def 						lowerCAmelCase_							(  snake_case__		):




    '''simple docstring'''



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

    A			:  int   =		[]

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

        generate(k - 1						,							snake_case__		)

        for i in range(k - 1		):
            if k % 2 == 0:  # k is even
                A,    A			:  Any   =		arr[k - 1], arr[i]
            else:  # k is odd
                A,    A			:  List[str]   =		arr[k - 1], arr[0]
            generate(k - 1						,							snake_case__		)

    generate(len(snake_case__		)						,							snake_case__		)
    return res


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




