code: 
  
  
  
  import functools
  from math import sqrt
  from time import time
  
  
  
  
  
  
  def 			__lowercase     (				a__							,     *a__							,     **a__     )       ->				Optional[Any]:
  							__SCREAMING_SNAKE_CASE								=      time()
  							__SCREAMING_SNAKE_CASE								=      func(*a__							,     **a__     )
  							__SCREAMING_SNAKE_CASE								=      time()
  							if int(end - start     ) > 0:
  														print(f"""{func.__name__} runtime: {(end - start):0.4f} s"""     )
  							else:
  														print(f"""{func.__name__} runtime: {(end - start) * 10_00:0.4f} ms"""     )
  							return output
  
  
  
  
  
  
  def 			__lowercase     (				a__     )       ->				list[int]:
  							if n < 0:
  														raise Exception('n is negative'     )
  							if n == 0:
  														return [0]
  							__SCREAMING_SNAKE_CASE								=      [0, 1]
  							for _ in range(n - 1     ):
  														fib.append(fib[-1] + fib[-2]     )
  							return fib
  
  
  
  
  
  
  def 			__lowercase     (				a__     )       ->				list[int]:
  
  							def fib_recursive_term(a__     ) -> int:
  														if i < 0:
  																					raise Exception('n is negative'     )
  														if i < 2:
  																					return i
  														return fib_recursive_term(i - 1     ) + fib_recursive_term(i - 2     )
  
  							if n < 0:
  														raise Exception('n is negative'     )
  							return [fib_recursive_term(a__     ) for i in range(n + 1     )]
  
  
  
  
  
  
  def 			__lowercase     (				a__     )       ->				list[int]:
  
  							@functools.cache
  							def fib_recursive_term(a__     ) -> int:
  														if i < 0:
  																					raise Exception('n is negative'     )
  														if i < 2:
  																					return i
  														return fib_recursive_term(i - 1     ) + fib_recursive_term(i - 2     )
  
  							if n < 0:
  														raise Exception('n is negative'     )
  							return [fib_recursive_term(a__     ) for i in range(n + 1     )]
  
  
  
  
  
  
  def 			__lowercase     (				a__     )       ->				list[int]:
  							if n < 0:
  														raise Exception('n is negative'     )
  							# Cache must be outside recursuive function
  							# other it will reset every time it calls itself.
  							__SCREAMING_SNAKE_CASE								=      {0: 0, 1: 1, 2: 1}  # Prefilled cache
  
  							def rec_fn_memoized(a__     ) -> int:
  														if num in cache:
  																					return cache[num]
  
  														__SCREAMING_SNAKE_CASE								=      rec_fn_memoized(num - 1     ) + rec_fn_memoized(num - 2     )
  														__SCREAMING_SNAKE_CASE								=      value
  														return value
  
  							return [rec_fn_memoized(a__     ) for i in range(n + 1     )]
  
  
  
  
  
  
  def 			__lowercase     (				a__     )       ->				list[int]:
  							if n < 0:
  														raise Exception('n is negative'     )
  							if n >= 14_75:
  														raise Exception('n is too large'     )
  							__SCREAMING_SNAKE_CASE								=      sqrt(5     )
  							__SCREAMING_SNAKE_CASE								=      (1 + sqrt_a) / 2
  							return [round(phi**i / sqrt_a     ) for i in range(n + 1     )]
  
  
  if __name__ == "__main__":
  			lowerCAmelCase__	:  Dict 		=30
  			time_func(fib_iterative, num)
  			time_func(fib_recursive, num)  # Around 3s runtime
  			time_func(fib_recursive_cached, num)  # Around 0ms runtime
  			time_func(fib_memoization, num)
  			time_func(fib_binet, num)
  
  
  
  
  
  
  
style_context: 
  
  
  
  import unittest
  
  from cer import CER
  
  
  lowerCAmelCase__	:  Dict 		=CER()
  
  class      UpperCAmelCase_						(     unittest.TestCase ):
  
  						'''simple docstring'''
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['White House']
  													__SCREAMING_SNAKE_CASE								=      ['white house']
  													# S = 2, D = 0, I = 0, N = 11, CER = 2 / 11
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.1_8_1_8_1_8_1_8_1_8	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['were wolf']
  													__SCREAMING_SNAKE_CASE								=      ['werewolf']
  													# S = 0, D = 0, I = 1, N = 9, CER = 1 / 9
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.1_1_1_1_1_1_1	) < 1e-6	)
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf']
  													__SCREAMING_SNAKE_CASE								=      ['weae     wolf']
  													# S = 1, D = 1, I = 0, N = 8, CER = 0.25
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.2_5	) < 1e-6	)
  
  													# consecutive whitespaces case 1
  													__SCREAMING_SNAKE_CASE								=      ['were wolf']
  													__SCREAMING_SNAKE_CASE								=      ['were               wolf']
  													# S = 0, D = 0, I = 0, N = 9, CER = 0
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.0	) < 1e-6	)
  
  													# consecutive whitespaces case 2
  													__SCREAMING_SNAKE_CASE								=      ['were   wolf']
  													__SCREAMING_SNAKE_CASE								=      ['were               wolf']
  													# S = 0, D = 0, I = 0, N = 9, CER = 0
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.0	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf']
  													__SCREAMING_SNAKE_CASE								=      ['weaewolf']
  													# S = 1, D = 0, I = 0, N = 8, CER = 0.125
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.1_2_5	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf']
  													__SCREAMING_SNAKE_CASE								=      ['wereawolf']
  													# S = 0, D = 1, I = 0, N = 8, CER = 0.125
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.1_2_5	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf']
  													__SCREAMING_SNAKE_CASE								=      ['wereolf']
  													# S = 0, D = 0, I = 1, N = 8, CER = 0.125
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.1_2_5	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf']
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertEqual(_A   ,							0.0	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf', 'I am your father']
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertEqual(_A   ,							0.0	)
  
  													__SCREAMING_SNAKE_CASE								=      ['werewolf', 'I am your father', 'doge']
  													__SCREAMING_SNAKE_CASE								=      ['werxwolf', 'I       am your father', 'doge']
  													# S = 1, D = 0, I = 0, N = 28, CER = 1 / 28
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.0_3_5_7_1_4_2_8	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['My hovercraft', 'is full of eels']
  													__SCREAMING_SNAKE_CASE								=      ['My hovercraft is full', ' of eels']
  													# S = 0, D = 0, I = 2, N = 28, CER = 2 / 28
  													# whitespace at the front of " of eels" will be strip during preporcessing
  													# so need to insert 2 whitespaces
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A   ,							concatenate_texts=_A	)
  													self.assertTrue(abs(char_error_rate - 0.0_7_1_4_2_8	) < 1e-6	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['我能吞下玻璃而不伤身体']
  													__SCREAMING_SNAKE_CASE								=      [' 能吞虾玻璃而 不霜身体啦']
  													# S = 3, D = 2, I = 0, N = 11, CER = 5 / 11
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.4_5_4_5_4_5_4_5_4_5	) < 1e-6	)
  
  													__SCREAMING_SNAKE_CASE								=      ['我能吞下玻璃', '而不伤身体']
  													__SCREAMING_SNAKE_CASE								=      ['我    能 吞 下 玻 璃', '而不伤身体']
  													# S = 0, D = 5, I = 0, N = 11, CER = 5 / 11
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertTrue(abs(char_error_rate - 0.4_5_4_5_4_5_4_5_4_5_4_5	) < 1e-6	)
  
  													__SCREAMING_SNAKE_CASE								=      ['我能吞下玻璃而不伤身体']
  													__SCREAMING_SNAKE_CASE								=      cer.compute(predictions=_A   ,							references=_A	)
  													self.assertFalse(_A   ,							0.0	)
  
  
  
  
  
  
  						def  _A			(					self	):
  
  
  
  
  
  
  
  													'''simple docstring'''
  
  													__SCREAMING_SNAKE_CASE								=      ['']
  													__SCREAMING_SNAKE_CASE								=      ['Hypothesis']
  													with self.assertRaises(_A	):
  																				cer.compute(predictions=_A   ,							references=_A	)
  
  
  if __name__ == "__main__":
  			unittest.main()
  
  
  
  
  
  
  