



"""simple docstring"""

from __future__ import annotations

import math
def  __snake_case							(	__A      :						list							,		__A      :						list     )     ->       list:






				'''simple docstring'''
				if len(__A     ) != 2 or len(a[0]     ) != 2 or len(__A     ) != 2 or len(b[0]     ) != 2:
								raise Exception('Matrices are not 2x2'     )
				SCREAMING_SNAKE_CASE						:							Tuple							=     [
				    [a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1]],
				    [a[1][0] * b[0][0] + a[1][1] * b[1][0], a[1][0] * b[0][1] + a[1][1] * b[1][1]],
				]
				return new_matrix
def  __snake_case							(	__A      :						list							,		__A      :						list     )     ->       Union[str, Any]:






				'''simple docstring'''
				return [
				    [matrix_a[row][col] + matrix_b[row][col] for col in range(len(matrix_a[row]     )     )]
				    for row in range(len(__A     )     )
				]
def  __snake_case							(	__A      :						list							,		__A      :						list     )     ->       Optional[Any]:






				'''simple docstring'''
				return [
				    [matrix_a[row][col] - matrix_b[row][col] for col in range(len(matrix_a[row]     )     )]
				    for row in range(len(__A     )     )
				]
def  __snake_case							(	__A      :						list     )     ->       tuple[list, list, list, list]:






				'''simple docstring'''
				if len(__A     ) % 2 != 0 or len(a[0]     ) % 2 != 0:
								raise Exception('Odd matrices are not supported!'     )

				SCREAMING_SNAKE_CASE						:							Any							=     len(__A     )
				SCREAMING_SNAKE_CASE						:							Dict							=     matrix_length // 2

				SCREAMING_SNAKE_CASE						:							Dict							=     [[a[i][j] for j in range(__A							,		__A     )] for i in range(__A     )]
				SCREAMING_SNAKE_CASE						:							Optional[int]							=     [
				    [a[i][j] for j in range(__A							,		__A     )] for i in range(__A							,		__A     )
				]

				SCREAMING_SNAKE_CASE						:							Tuple							=     [[a[i][j] for j in range(__A     )] for i in range(__A     )]
				SCREAMING_SNAKE_CASE						:							Optional[Any]							=     [[a[i][j] for j in range(__A     )] for i in range(__A							,		__A     )]

				return top_left, top_right, bot_left, bot_right
def  __snake_case							(	__A      :						list     )     ->       tuple[int, int]:






				'''simple docstring'''
				return len(__A     ), len(matrix[0]     )
def  __snake_case							(	__A      :						list     )     ->       None:






				'''simple docstring'''
				print('\n'.join(str(__A     ) for line in matrix     )     )
def  __snake_case							(	__A      :						list							,		__A      :						list     )     ->       list:






				'''simple docstring'''
				if matrix_dimensions(__A     ) == (2, 2):
								return default_matrix_multiplication(__A							,		__A     )

				SCREAMING_SNAKE_CASE				,						SCREAMING_SNAKE_CASE				,						SCREAMING_SNAKE_CASE				,						SCREAMING_SNAKE_CASE						:							int							=     split_matrix(__A     )
				SCREAMING_SNAKE_CASE				,						SCREAMING_SNAKE_CASE				,						SCREAMING_SNAKE_CASE				,						SCREAMING_SNAKE_CASE						:							List[Any]							=     split_matrix(__A     )

				SCREAMING_SNAKE_CASE						:							Dict							=     actual_strassen(__A							,		matrix_subtraction(__A							,		__A     )     )
				SCREAMING_SNAKE_CASE						:							int							=     actual_strassen(matrix_addition(__A							,		__A     )							,		__A     )
				SCREAMING_SNAKE_CASE						:							Optional[int]							=     actual_strassen(matrix_addition(__A							,		__A     )							,		__A     )
				SCREAMING_SNAKE_CASE						:							Dict							=     actual_strassen(__A							,		matrix_subtraction(__A							,		__A     )     )
				SCREAMING_SNAKE_CASE						:							Tuple							=     actual_strassen(matrix_addition(__A							,		__A     )							,		matrix_addition(__A							,		__A     )     )
				SCREAMING_SNAKE_CASE						:							int							=     actual_strassen(matrix_subtraction(__A							,		__A     )							,		matrix_addition(__A							,		__A     )     )
				SCREAMING_SNAKE_CASE						:							Optional[int]							=     actual_strassen(matrix_subtraction(__A							,		__A     )							,		matrix_addition(__A							,		__A     )     )

				SCREAMING_SNAKE_CASE						:							Optional[int]							=     matrix_addition(matrix_subtraction(matrix_addition(__A							,		__A     )							,		__A     )							,		__A     )
				SCREAMING_SNAKE_CASE						:							List[Any]							=     matrix_addition(__A							,		__A     )
				SCREAMING_SNAKE_CASE						:							Any							=     matrix_addition(__A							,		__A     )
				SCREAMING_SNAKE_CASE						:							Optional[Any]							=     matrix_subtraction(matrix_subtraction(matrix_addition(__A							,		__A     )							,		__A     )							,		__A     )

				# construct the new matrix from our 4 quadrants
				SCREAMING_SNAKE_CASE						:							Optional[Any]							=     []
				for i in range(len(__A     )     ):
								new_matrix.append(top_left[i] + top_right[i]     )
				for i in range(len(__A     )     ):
								new_matrix.append(bot_left[i] + bot_right[i]     )
				return new_matrix
def  __snake_case							(	__A      :						list							,		__A      :						list     )     ->       list:






				'''simple docstring'''
				if matrix_dimensions(__A     )[1] != matrix_dimensions(__A     )[0]:
								SCREAMING_SNAKE_CASE						:							Tuple							=     (
								    'Unable to multiply these matrices, please check the dimensions.\n'
								    F"""Matrix A: {matrixa}\n"""
								    F"""Matrix B: {matrixa}"""
								)
								raise Exception(__A     )
				SCREAMING_SNAKE_CASE						:							List[Any]							=     matrix_dimensions(__A     )
				SCREAMING_SNAKE_CASE						:							Dict							=     matrix_dimensions(__A     )

				if dimensiona[0] == dimensiona[1] and dimensiona[0] == dimensiona[1]:
								return [matrixa, matrixa]

				SCREAMING_SNAKE_CASE						:							List[Any]							=     max(*__A							,		*__A     )
				SCREAMING_SNAKE_CASE						:							Tuple							=     int(math.pow(2							,		math.ceil(math.loga(__A     )     )     )     )
				SCREAMING_SNAKE_CASE						:							Tuple							=     matrixa
				SCREAMING_SNAKE_CASE						:							List[Any]							=     matrixa

				# Adding zeros to the matrices so that the arrays dimensions are the same and also
				# power of 2
				for i in range(0							,		__A     ):
								if i < dimensiona[0]:
												for _ in range(dimensiona[1]							,		__A     ):
																new_matrixa[i].append(0     )
								else:
												new_matrixa.append([0] * maxim     )
								if i < dimensiona[0]:
												for _ in range(dimensiona[1]							,		__A     ):
																new_matrixa[i].append(0     )
								else:
												new_matrixa.append([0] * maxim     )

				SCREAMING_SNAKE_CASE						:							int							=     actual_strassen(__A							,		__A     )

				# Removing the additional zeros
				for i in range(0							,		__A     ):
								if i < dimensiona[0]:
												for _ in range(dimensiona[1]							,		__A     ):
																final_matrix[i].pop()
								else:
												final_matrix.pop()
				return final_matrix


if __name__ == "__main__":
							A_						:    str				=      [
							    [2, 3, 4, 5],
							    [6, 4, 3, 1],
							    [2, 3, 6, 7],
							    [3, 1, 2, 4],
							    [2, 3, 4, 5],
							    [6, 4, 3, 1],
							    [2, 3, 6, 7],
							    [3, 1, 2, 4],
							    [2, 3, 4, 5],
							    [6, 2, 3, 1],
							]
							A_						:    int				=      [[0, 2, 1, 1], [16, 2, 3, 3], [2, 2, 7, 7], [13, 11, 22, 4]]
							print(strassen(matrixa, matrixa))










"""simple docstring"""

def  __snake_case							(	__A      :						int							,		__A      :						int     )     ->       float:






				'''simple docstring'''
				return base * power(__A							,		(exponent - 1)     ) if exponent else 1


if __name__ == "__main__":
							print('Raise base to the power of exponent using recursion...')
							A_						:    str				=      int(input('Enter the base: ').strip())
							A_						:    Dict				=      int(input('Enter the exponent: ').strip())
							A_						:    List[str]				=      power(base, abs(exponent))
							if exponent < 0:  # power() does not properly deal w/ negative exponents
														A_						:    Any				=      1 / result
							print(f'''{base} to the power of {exponent} is {result}''')





