




'''simple docstring'''



import csv
import json
import os

import datasets


# TODO: Add BibTeX citation
# Find for instance the citation on arxiv or on the dataset repo/website
UpperCAmelCase_				:     Any     			=						'''\
@InProceedings{huggingface:dataset,
title = {A great new dataset},
author={huggingface, Inc.
},
year={2020}
}
'''

# TODO: Add description of the dataset here
# You can copy an official description
UpperCAmelCase_				:     str     			=						'''\
This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
'''

# TODO: Add a link to an official homepage for the dataset here
UpperCAmelCase_				:     Dict     			=						''''''

# TODO: Add the licence for the dataset here if you can find it
UpperCAmelCase_				:     Optional[Any]     			=						''''''

# TODO: Add link to the official dataset URLs here
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
UpperCAmelCase_				:     str     			=						{
    '''first_domain''': '''https://huggingface.co/great-new-dataset-first_domain.zip''',
    '''second_domain''': '''https://huggingface.co/great-new-dataset-second_domain.zip''',
}





class 			lowerCAmelCase      (       datasets.GeneratorBasedBuilder):
       __lowercase     :					Tuple       				=	datasets.Version('''1.1.0''')

       # This is an example of a dataset with multiple configurations.
       # If you don't want/need to define several sub-sets in your dataset,
       # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.

       # If you need to make complex sub-parts in the datasets with configurable options
       # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
       # BUILDER_CONFIG_CLASS = MyBuilderConfig

       # You will be able to load one or the other configurations in the following list with
       # data = datasets.load_dataset('my_dataset', 'first_domain')
       # data = datasets.load_dataset('my_dataset', 'second_domain')
       __lowercase     :					Tuple       				=	[
           datasets.BuilderConfig(name='''first_domain''' ,      version=__lowerCAmelCase ,      description='''This part of my dataset covers a first domain'''),
           datasets.BuilderConfig(name='''second_domain''' ,      version=__lowerCAmelCase ,      description='''This part of my dataset covers a second domain'''),
       ]

       __lowercase     :					Optional[int]       				=	'''first_domain'''  # It's not mandatory to have a default configuration. Just use one if it make sense.


       def 					lowerCAmelCase					(      self     )					->     Union[str, Any]:



            '''simple docstring'''




            if self.config.name == "first_domain":  # This is the name of the configuration selected in BUILDER_CONFIGS above
                 __snake_case			    =     datasets.Features(
                     {
                         '''sentence''': datasets.Value('''string'''     ),
                         '''option1''': datasets.Value('''string'''     ),
                         '''answer''': datasets.Value('''string'''     )
                         # These are the features of your dataset like images, labels ...
                     }     )
            else:  # This is an example to show how to have different features for "first_domain" and "second_domain"
                 __snake_case			    =     datasets.Features(
                     {
                         '''sentence''': datasets.Value('''string'''     ),
                         '''option2''': datasets.Value('''string'''     ),
                         '''second_domain_answer''': datasets.Value('''string'''     )
                         # These are the features of your dataset like images, labels ...
                     }     )
            return datasets.DatasetInfo(
                # This is the description that will appear on the datasets page.
                description=_DESCRIPTION			,     features=__SCREAMING_SNAKE_CASE			,     homepage=_HOMEPAGE			,     license=_LICENSE			,     citation=_CITATION			,     )


       def 					lowerCAmelCase					(      self			,     __SCREAMING_SNAKE_CASE     )					->     List[str]:



            '''simple docstring'''




            __snake_case			    =     _URLS[self.config.name]
            __snake_case			    =     dl_manager.download_and_extract(__SCREAMING_SNAKE_CASE     )
            return [
                datasets.SplitGenerator(
                    name=datasets.Split.TRAIN			,     gen_kwargs={
                        '''filepath''': os.path.join(__SCREAMING_SNAKE_CASE			,     '''train.jsonl'''     ),
                        '''split''': '''train''',
                    }			,     ),
                datasets.SplitGenerator(
                    name=datasets.Split.VALIDATION			,     gen_kwargs={
                        '''filepath''': os.path.join(__SCREAMING_SNAKE_CASE			,     '''dev.jsonl'''     ),
                        '''split''': '''dev''',
                    }			,     ),
                datasets.SplitGenerator(
                    name=datasets.Split.TEST			,     gen_kwargs={
                        '''filepath''': os.path.join(__SCREAMING_SNAKE_CASE			,     '''test.jsonl'''     ),
                        '''split''': '''test'''
                    }			,     ),
            ]




       def 					lowerCAmelCase					(      self			,     __SCREAMING_SNAKE_CASE			,     __SCREAMING_SNAKE_CASE     )					->     Dict:



            '''simple docstring'''




            with open(__SCREAMING_SNAKE_CASE			,     encoding='''utf-8'''     ) as f:
                 for key, row in enumerate(__SCREAMING_SNAKE_CASE     ):
                      __snake_case			    =     json.loads(__SCREAMING_SNAKE_CASE     )
                      if self.config.name == "first_domain":
                           # Yields examples as (key, example) tuples
                           yield key, {
                               "sentence": data["sentence"],
                               "option1": data["option1"],
                               "answer": "" if split == "test" else data["answer"],
                           }
                      else:
                           yield key, {
                               "sentence": data["sentence"],
                               "option2": data["option2"],
                               "second_domain_answer": "" if split == "test" else data["second_domain_answer"],
                           }












'''simple docstring'''



def 	_UpperCamelCase       (_lowerCamelCase							:   list[list[int]]      ,		_lowerCamelCase							:   list[list[int]]		)->      list[list[int]]:




     '''simple docstring'''





     __snake_case			    =     []
     __snake_case			    =     len(_lowerCamelCase		)
     for i in range(_lowerCamelCase		):
          __snake_case			    =     []
          for j in range(_lowerCamelCase		):
               __snake_case			    =     0
               for k in range(_lowerCamelCase		):
                    __snake_case			    =     val + matrix_a[i][k] * matrix_b[k][j]
               list_a.append(_lowerCamelCase		)
          matrix_c.append(_lowerCamelCase		)
     return matrix_c







def 	_UpperCamelCase       (_lowerCamelCase							:   int		)->      list[list[int]]:




     '''simple docstring'''





     return [[int(row == column		) for column in range(_lowerCamelCase		)] for row in range(_lowerCamelCase		)]







def 	_UpperCamelCase       (_lowerCamelCase							:   int		)->      int:




     '''simple docstring'''





     if n <= 1:
          return n
     __snake_case			    =     identity(2		)
     __snake_case			    =     [[1, 1], [1, 0]]
     __snake_case			    =     n - 1
     while n > 0:
          if n % 2 == 1:
               __snake_case			    =     multiply(_lowerCamelCase      ,		_lowerCamelCase		)
          __snake_case			    =     multiply(_lowerCamelCase      ,		_lowerCamelCase		)
          __snake_case			    =     int(n / 2		)
     return res_matrix[0][0]







def 	_UpperCamelCase       (_lowerCamelCase							:   int		)->      int:




     '''simple docstring'''





     if n <= 1:
          return n
     __snake_case			    =     0
     __snake_case			    =     1
     for _ in range(2      ,		n + 1		):
          __snake_case    ,			__snake_case			    =     fiba, fiba + fiba
     return fiba







def 	_UpperCamelCase       ()->      None:




     '''simple docstring'''





     for ordinal in "0th 1st 2nd 3rd 10th 100th 1000th".split():
          __snake_case			    =     int(''''''.join(c for c in ordinal if c in '''0123456789'''		)		)  # 1000th --> 1000
          print(
              f'''{ordinal} fibonacci number using matrix exponentiation is '''
              f'''{nth_fibonacci_matrix(_lowerCamelCase		)} and using bruteforce is '''
              f'''{nth_fibonacci_bruteforce(_lowerCamelCase		)}\n'''		)
     # from timeit import timeit
     # print(timeit("nth_fibonacci_matrix(1000000)",
     #              "from main import nth_fibonacci_matrix", number=5))
     # print(timeit("nth_fibonacci_bruteforce(1000000)",
     #              "from main import nth_fibonacci_bruteforce", number=5))
     # 2.3342058970001744
     # 57.256506615000035


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()






