






import timeit
class        __snake_case:



 def __init__(	self   :   Dict ,		UpperCAmelCase__   :   List[Any]	):

    """simple docstring"""






    if isinstance(UpperCAmelCase__ ,		UpperCAmelCase__	):  # Initializes a matrix identical to the one provided.
       lowercase__						:	Optional[int]         = arg
       lowercase__						:	Tuple         = len(UpperCAmelCase__	)
    else:  # Initializes a square matrix of the given size and set values to zero.
       lowercase__						:	List[str]         = arg
       lowercase__						:	Tuple         = [[0 for _ in range(self.n	)] for _ in range(self.n	)]







 def __mul__(	self   :   str ,		UpperCAmelCase__   :   int	):

    """simple docstring"""






    lowercase__						:	Tuple         = Matrix(self.n	)
    for i in range(self.n	):
       for j in range(self.n	):
          for k in range(self.n	):
             matrix.t[i][j] += self.t[i][k] * b.t[k][j]
    return matrix
def       a__						(  A		,				A					):
   lowercase__						:	Union[str, Any]         = Matrix([[1, 0], [0, 1]]					)
   while b > 0:
      if b & 1:
         matrix *= a
      a *= a
      b >>= 1
   return matrix
def       a__						(  A		,				A		,				A					):
   # Trivial Cases
   if n == 1:
      return fa
   elif n == 2:
      return fa
   lowercase__						:	str         = Matrix([[1, 1], [1, 0]]					)
   lowercase__						:	Dict         = modular_exponentiation(__lowerCAmelCase		,				n - 2					)
   return fa * matrix.t[0][0] + fa * matrix.t[0][1]
def       a__						(  A		,				A		,				A					):
   # Trivial Cases
   if n == 1:
      return fa
   elif n == 2:
      return fa

   lowercase__						:	Union[str, Any]         = fa
   lowercase__						:	int         = fa
   n -= 2

   while n > 0:
      lowercase__						:	Any         = fn_a + fn_a, fn_a
      n -= 1

   return fn_a
def       a__						(  ):
   lowercase__						:	Any         = "\nfrom random import randint\nfrom __main__ import fibonacci_with_matrix_exponentiation\n"
   lowercase__						:	Tuple         = "fibonacci_with_matrix_exponentiation(randint(1,70000), 1, 1)"
   lowercase__						:	Any         = timeit.timeit(setup=__lowerCAmelCase		,				stmt=__lowerCAmelCase		,				number=100					)
   print("""With matrix exponentiation the average execution time is """		,				exec_time / 100					)
   return exec_time
def       a__						(  ):
   lowercase__						:	str         = "\nfrom random import randint\nfrom __main__ import simple_fibonacci\n"
   lowercase__						:	str         = "simple_fibonacci(randint(1,70000), 1, 1)"
   lowercase__						:	Union[str, Any]         = timeit.timeit(setup=__lowerCAmelCase		,				stmt=__lowerCAmelCase		,				number=100					)
   print(
       """Without matrix exponentiation the average execution time is """		,				exec_time / 100					)
   return exec_time
def       a__						(  ):
   matrix_exponentiation_time()
   simple_fibonacci_time()


if __name__ == "__main__":
 main()










from dataclasses import dataclass
from typing import Callable, Optional

import datasets
@dataclass
class        __snake_case(					datasets.BuilderConfig      ):
 lowercase :       Optional[Callable]		      =		None
 lowercase :       Optional[dict]		      =		None
 lowercase :       Optional[datasets.Features]		      =		None



 def 						UpperCAmelCase    (	self   :   int	):

    """simple docstring"""






    assert self.generator is not None, "generator must be specified"

    if self.gen_kwargs is None:
       lowercase__						:	List[Any]         = {}
class        __snake_case(					datasets.GeneratorBasedBuilder      ):
 lowercase :       Dict		      =		GeneratorConfig



 def 						UpperCAmelCase    (	self   :   Any	):

    """simple docstring"""






    return datasets.DatasetInfo(features=self.config.features	)



 def 						UpperCAmelCase    (	self   :   List[str] ,		UpperCAmelCase__   :   Optional[int]	):

    """simple docstring"""






    return [datasets.SplitGenerator(name=datasets.Split.TRAIN ,		gen_kwargs=self.config.gen_kwargs	)]







 def 						UpperCAmelCase    (	self   :   Dict ,		**UpperCAmelCase__   :   List[str]	):

    """simple docstring"""






    for idx, ex in enumerate(self.config.generator(**UpperCAmelCase__	)	):
       yield idx, ex


