






from __future__ import annotations

import math

def      lowerCAmelCase__	(    _a       :			Tuple  ,      _a       :			List[Any]    ):
		if len(_a    ) != 2 or len(a[0]    ) != 2 or len(_a    ) != 2 or len(b[0]    ) != 2:
				raise Exception("Matrices are not 2x2"    )
		snake_case_				:							Optional[int]						 =       [
		    [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      lowerCAmelCase__	(    _a       :			int  ,      _a       :			Dict    ):
		return [
		    [matrix_a[row][col] + matrix_b[row][col] for col in range(len(matrix_a[row]    )    )]
		    for row in range(len(_a    )    )
		]

def      lowerCAmelCase__	(    _a       :			Union[str, Any]  ,      _a       :			Optional[Any]    ):
		return [
		    [matrix_a[row][col] - matrix_b[row][col] for col in range(len(matrix_a[row]    )    )]
		    for row in range(len(_a    )    )
		]

def      lowerCAmelCase__	(    _a       :			Any    ):
		if len(_a    ) % 2 != 0 or len(a[0]    ) % 2 != 0:
				raise Exception("Odd matrices are not supported!"    )

		snake_case_				:							str						 =       len(_a    )
		snake_case_				:							List[Any]						 =       matrix_length // 2

		snake_case_				:							List[str]						 =       [[a[i][j] for j in range(_a  ,      _a    )] for i in range(_a    )]
		snake_case_				:							Dict						 =       [
		    [a[i][j] for j in range(_a  ,      _a    )] for i in range(_a  ,      _a    )
		]

		snake_case_				:							int						 =       [[a[i][j] for j in range(_a    )] for i in range(_a    )]
		snake_case_				:							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      lowerCAmelCase__	(    _a       :			int    ):
		return len(_a    ), len(matrix[0]    )

def      lowerCAmelCase__	(    _a       :			Union[str, Any]    ):
		print("\n".join(str(_a    ) for line in matrix    )    )

def      lowerCAmelCase__	(    _a       :			Optional[int]  ,      _a       :			Tuple    ):
		if matrix_dimensions(_a    ) == (2, 2):
				return default_matrix_multiplication(_a  ,      _a    )

		snake_case_				:							str						 =       split_matrix(_a    )
		snake_case_				:							List[Any]						 =       split_matrix(_a    )

		snake_case_				:							Any						 =       actual_strassen(_a  ,      matrix_subtraction(_a  ,      _a    )    )
		snake_case_				:							Tuple						 =       actual_strassen(matrix_addition(_a  ,      _a    )  ,      _a    )
		snake_case_				:							List[str]						 =       actual_strassen(matrix_addition(_a  ,      _a    )  ,      _a    )
		snake_case_				:							Optional[int]						 =       actual_strassen(_a  ,      matrix_subtraction(_a  ,      _a    )    )
		snake_case_				:							Any						 =       actual_strassen(matrix_addition(_a  ,      _a    )  ,      matrix_addition(_a  ,      _a    )    )
		snake_case_				:							Any						 =       actual_strassen(matrix_subtraction(_a  ,      _a    )  ,      matrix_addition(_a  ,      _a    )    )
		snake_case_				:							List[Any]						 =       actual_strassen(matrix_subtraction(_a  ,      _a    )  ,      matrix_addition(_a  ,      _a    )    )

		snake_case_				:							List[Any]						 =       matrix_addition(matrix_subtraction(matrix_addition(_a  ,      _a    )  ,      _a    )  ,      _a    )
		snake_case_				:							Union[str, Any]						 =       matrix_addition(_a  ,      _a    )
		snake_case_				:							str						 =       matrix_addition(_a  ,      _a    )
		snake_case_				:							Dict						 =       matrix_subtraction(matrix_subtraction(matrix_addition(_a  ,      _a    )  ,      _a    )  ,      _a    )

		# construct the new matrix from our 4 quadrants
		snake_case_				:							List[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      lowerCAmelCase__	(    _a       :			Any  ,      _a       :			int    ):
		if matrix_dimensions(_a    )[1] != matrix_dimensions(_a    )[0]:
				snake_case_				:							Dict						 =       (
				    'Unable to multiply these matrices, please check the dimensions.\n'
				    F'''Matrix A: {matrixa}\n'''
				    F'''Matrix B: {matrixa}'''
				)
				raise Exception(_a    )
		snake_case_				:							int						 =       matrix_dimensions(_a    )
		snake_case_				:							Any						 =       matrix_dimensions(_a    )

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

		snake_case_				:							List[Any]						 =       max(*_a  ,      *_a    )
		snake_case_				:							Optional[Any]						 =       int(math.pow(2  ,      math.ceil(math.loga(_a    )    )    )    )
		snake_case_				:							Union[str, Any]						 =       matrixa
		snake_case_				:							Optional[int]						 =       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    )

		snake_case_				:							str						 =       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__":
							lowercase  :							Union[str, Any]			  =    [
							    [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],
							]
							lowercase  :							Optional[Any]			  =    [[0, 2, 1, 1], [16, 2, 3, 3], [2, 2, 7, 7], [13, 11, 22, 4]]
							print(strassen(matrixa, matrixa))








import qiskit

def      lowerCAmelCase__	(    _a       :			int  ,      _a       :			int    ):
		snake_case_				:							Tuple						 =       qiskit.Aer.get_backend("aer_simulator"    )

		# Create a Quantum Circuit acting on the q register
		snake_case_				:							Any						 =       qiskit.QuantumCircuit(_a  ,      _a    )

		# Apply X (NOT) Gate to Qubits 0 & 1
		circuit.x(0    )
		circuit.x(1    )

		# Map the quantum measurement to the classical bits
		circuit.measure([0, 1]  ,      [0, 1]    )

		# Execute the circuit on the qasm simulator
		snake_case_				:							Any						 =       qiskit.execute(_a  ,      _a  ,      shots=10_00    )

		# Return the histogram data of the results of the experiment.
		return job.result().get_counts(_a    )


if __name__ == "__main__":
							lowercase  :							List[Any]			  =    single_qubit_measure(2, 2)
							print(F"""Total count for various states are: {counts}""")
