

from __future__ import annotations

from typing import Any







def 						_snake_case		(     *SCREAMING_SNAKE_CASE					)							->   list[list[int]]:

     """simple docstring"""







     if all(_check_not_integer(SCREAMING_SNAKE_CASE					) for m in matrix_s					):
          for i in matrix_s[1:]:
               _verify_matrix_sizes(matrix_s[0]		,				SCREAMING_SNAKE_CASE					)
          return [[sum(SCREAMING_SNAKE_CASE					) for t in zip(*SCREAMING_SNAKE_CASE					)] for m in zip(*SCREAMING_SNAKE_CASE					)]
     raise TypeError("Expected a matrix, got int/list instead"					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   list[list[int]]:

     """simple docstring"""







     if (
         _check_not_integer(SCREAMING_SNAKE_CASE					)
         and _check_not_integer(SCREAMING_SNAKE_CASE					)
         and _verify_matrix_sizes(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)
     ):
          return [[i - j for i, j in zip(*SCREAMING_SNAKE_CASE					)] for m in zip(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)]
     raise TypeError("Expected a matrix, got int/list instead"					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   list[list[float]]:

     """simple docstring"""







     return [[x * n for x in row] for row in matrix]







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   list[list[int]]:

     """simple docstring"""







     if _check_not_integer(SCREAMING_SNAKE_CASE					) and _check_not_integer(SCREAMING_SNAKE_CASE					):
          _lowerCAmelCase   ,      _lowerCAmelCase :       str	   =     _verify_matrix_sizes(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)

     if cols[0] != rows[1]:
          _lowerCAmelCase :       Any	   =     (
              "Cannot multiply matrix of dimensions "
              f'''({rows[0]},{cols[0]}) and ({rows[1]},{cols[1]})'''
          )
          raise ValueError(SCREAMING_SNAKE_CASE					)
     return [
         [sum(m * n for m, n in zip(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)					) for j in zip(*SCREAMING_SNAKE_CASE					)] for i in matrix_a
     ]







def 						_snake_case		(     SCREAMING_SNAKE_CASE					)							->   list[list[int]]:

     """simple docstring"""







     _lowerCAmelCase :       Any	   =     int(SCREAMING_SNAKE_CASE					)
     return [[int(row == column					) for column in range(SCREAMING_SNAKE_CASE					)] for row in range(SCREAMING_SNAKE_CASE					)]







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE = True					)							->   list[list[int]] | map[list[int]]:

     """simple docstring"""







     if _check_not_integer(SCREAMING_SNAKE_CASE					):
          if return_map:
               return map(SCREAMING_SNAKE_CASE		,				zip(*SCREAMING_SNAKE_CASE					)					)
          else:
               return list(map(SCREAMING_SNAKE_CASE		,				zip(*SCREAMING_SNAKE_CASE					)					)					)
     raise TypeError("Expected a matrix, got int/list instead"					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   list[list[int]]:

     """simple docstring"""







     _lowerCAmelCase :       int	   =     matrix[:row] + matrix[row + 1 :]
     return [row[:column] + row[column + 1 :] for row in minor]







def 						_snake_case		(     SCREAMING_SNAKE_CASE					)							->   Any:

     """simple docstring"""







     if len(SCREAMING_SNAKE_CASE					) == 1:
          return matrix[0][0]

     return sum(
         x * determinant(minor(SCREAMING_SNAKE_CASE		,				0		,				SCREAMING_SNAKE_CASE					)					) * (-1) ** i
         for i, x in enumerate(matrix[0]					)					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE					)							->   list[list[float]] | None:

     """simple docstring"""







     _lowerCAmelCase :       int	   =     determinant(SCREAMING_SNAKE_CASE					)
     if det == 0:
          return None

     _lowerCAmelCase :       Any	   =     [
         [determinant(minor(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)					) for j in range(len(SCREAMING_SNAKE_CASE					)					)]
         for i in range(len(SCREAMING_SNAKE_CASE					)					)
     ]

     _lowerCAmelCase :       List[Any]	   =     [
         [x * (-1) ** (row + col) for col, x in enumerate(matrix_minor[row]					)]
         for row in range(len(SCREAMING_SNAKE_CASE					)					)
     ]
     _lowerCAmelCase :       Optional[int]	   =     list(transpose(SCREAMING_SNAKE_CASE					)					)
     return scalar_multiply(SCREAMING_SNAKE_CASE		,				1 / det					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE					)							->   bool:

     """simple docstring"""







     return not isinstance(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					) and not isinstance(matrix[0]		,				SCREAMING_SNAKE_CASE					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE					)							->   tuple[int, int]:

     """simple docstring"""







     return len(SCREAMING_SNAKE_CASE					), len(matrix[0]					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   tuple[tuple[int, int], tuple[int, int]]:

     """simple docstring"""







     _lowerCAmelCase :       Tuple	   =     _shape(SCREAMING_SNAKE_CASE					) + _shape(SCREAMING_SNAKE_CASE					)
     if shape[0] != shape[3] or shape[1] != shape[2]:
          _lowerCAmelCase :       Dict	   =     (
              "operands could not be broadcast together with shape "
              f'''({shape[0], shape[1]}), ({shape[2], shape[3]})'''
          )
          raise ValueError(SCREAMING_SNAKE_CASE					)
     return (shape[0], shape[2]), (shape[1], shape[3])







def 						_snake_case		(     )							->   None:

     """simple docstring"""







     _lowerCAmelCase :       List[str]	   =     [[12, 10], [3, 9]]
     _lowerCAmelCase :       Dict	   =     [[3, 4], [7, 4]]
     _lowerCAmelCase :       Optional[Any]	   =     [[11, 12, 13, 14], [21, 22, 23, 24], [31, 32, 33, 34], [41, 42, 43, 44]]
     _lowerCAmelCase :       List[str]	   =     [[3, 0, 2], [2, 0, -2], [0, 1, 1]]
     print(f'''Add Operation, {add(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					) = } \n'''					)
     print(
         f'''Multiply Operation, {multiply(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					) = } \n'''		,				)
     print(f'''Identity: {identity(5					)}\n'''					)
     print(f'''Minor of {matrix_c} = {minor(SCREAMING_SNAKE_CASE		,				1		,				2					)} \n'''					)
     print(f'''Determinant of {matrix_b} = {determinant(SCREAMING_SNAKE_CASE					)} \n'''					)
     print(f'''Inverse of {matrix_d} = {inverse(SCREAMING_SNAKE_CASE					)}\n'''					)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  main()









import unittest
from timeit import timeit







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







     _lowerCAmelCase :       List[str]	   =     first_num if first_num >= second_num else second_num
     _lowerCAmelCase :       List[str]	   =     max_num
     while (common_mult % first_num > 0) or (common_mult % second_num > 0):
          common_mult += max_num
     return common_mult







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







     return b if a == 0 else greatest_common_divisor(b % a		,				SCREAMING_SNAKE_CASE					)







def 						_snake_case		(     SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					)							->   int:

     """simple docstring"""







     return first_num // greatest_common_divisor(SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE					) * second_num







def 						_snake_case		(     )							->   str:

     """simple docstring"""







     _lowerCAmelCase :       List[Any]	   =     (
         "from __main__ import least_common_multiple_slow, least_common_multiple_fast"
     )
     print(
         "least_common_multiple_slow():"		,				timeit("least_common_multiple_slow(1000, 999)"		,				setup=SCREAMING_SNAKE_CASE					)		,				)
     print(
         "least_common_multiple_fast():"		,				timeit("least_common_multiple_fast(1000, 999)"		,				setup=SCREAMING_SNAKE_CASE					)		,				)





class A__     (			unittest.TestCase			):



 """simple docstring"""







 _lowercase  :       Union[str, Any]  			=    (
     (10, 20),
     (13, 15),
     (4, 31),
     (10, 42),
     (43, 34),
     (5, 12),
     (12, 25),
     (10, 25),
     (6, 9),
 )
 _lowercase  :       Dict  			=    (20, 195, 124, 210, 1_462, 60, 300, 50, 18)

 def  __magic_name__							(		self			:						int							):






      '''simple docstring'''




      for i, (first_num, second_num) in enumerate(self.test_inputs							):
           _lowerCAmelCase :       Optional[int]	   =     least_common_multiple_slow(A_  ,    A_							)
           _lowerCAmelCase :       Optional[int]	   =     least_common_multiple_fast(A_  ,    A_							)
           with self.subTest(i=A_							):
                self.assertEqual(A_  ,    self.expected_results[i]							)
                self.assertEqual(A_  ,    self.expected_results[i]							)


if __name__ == "__main__":
  benchmark()
  unittest.main()






