





'''simple docstring'''




from __future__ import annotations

import math
import random
from collections.abc import Collection
from typing import overload
class 			_lowerCAmelCase		:






     """simple docstring"""






     def __init__(   self							:			List[Any]   ,       __snake_case							:			Collection[float] | None = None						)->	None:
        if components is None:
           snake_case 						=   []
        snake_case 						=   list(__snake_case						)



     def __len__(   self							:			Union[str, Any]						)->	int:
        return len(self.__components						)



     def __str__(   self							:			List[str]						)->	str:
        return "(" + ",".join(map(__snake_case   ,       self.__components						)						) + ")"



     def __add__(   self							:			List[str]   ,       __snake_case							:			Vector						)->	Vector:
        snake_case 						=   len(self						)
        if size == len(__snake_case						):
           snake_case 						=   [self.__components[i] + other.component(__snake_case						) for i in range(__snake_case						)]
           return Vector(__snake_case						)
        else:
           raise Exception("""must have the same size"""						)



     def __sub__(   self							:			Union[str, Any]   ,       __snake_case							:			Vector						)->	Vector:
        snake_case 						=   len(self						)
        if size == len(__snake_case						):
           snake_case 						=   [self.__components[i] - other.component(__snake_case						) for i in range(__snake_case						)]
           return Vector(__snake_case						)
        else:  # error case
           raise Exception("""must have the same size"""						)



     @overload
     def __mul__(   self							:			Optional[int]   ,       __snake_case							:			float						)->	Vector:
        ...



     @overload
     def __mul__(   self							:			List[Any]   ,       __snake_case							:			Vector						)->	float:
        ...



     def __mul__(   self							:			Optional[Any]   ,       __snake_case							:			float | Vector						)->	float | Vector:
        if isinstance(__snake_case   ,       (float, int)						):
           snake_case 						=   [c * other for c in self.__components]
           return Vector(__snake_case						)
        elif isinstance(__snake_case   ,       __snake_case						) and len(self						) == len(__snake_case						):
           snake_case 						=   len(self						)
           snake_case 						=   [self.__components[i] * other.component(__snake_case						) for i in range(__snake_case						)]
           return sum(__snake_case						)
        else:  # error case
           raise Exception("""invalid operand!"""						)



     def      lowerCAmelCase			(   self							:			Any						)->	Vector:
        return Vector(self.__components						)



     def      lowerCAmelCase			(   self							:			Union[str, Any]   ,       __snake_case							:			int						)->	float:
        if isinstance(__snake_case   ,       __snake_case						) and -len(self.__components						) <= i < len(self.__components						):
           return self.__components[i]
        else:
           raise Exception("""index out of range"""						)



     def      lowerCAmelCase			(   self							:			Dict   ,       __snake_case							:			int   ,       __snake_case							:			float						)->	None:
        assert -len(self.__components						) <= pos < len(self.__components						)
        snake_case 						=   value



     def      lowerCAmelCase			(   self							:			List[Any]						)->	float:
        if len(self.__components						) == 0:
           raise Exception("""Vector is empty"""						)
        snake_case 						=   [c**2 for c in self.__components]
        return math.sqrt(sum(__snake_case						)						)



     def      lowerCAmelCase			(   self							:			List[str]   ,       __snake_case							:			Vector   ,       __snake_case							:			bool = False						)->	float:
        snake_case 						=   self * other
        snake_case 						=   self.euclidean_length() * other.euclidean_length()
        if deg:
           return math.degrees(math.acos(num / den						)						)
        else:
           return math.acos(num / den						)





def 	__lowerCamelCase			(      __lowerCAmelCase       :							int		)		->  Vector:
   assert isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		)
   return Vector([0] * dimension		)





def 	__lowerCamelCase			(      __lowerCAmelCase       :							int      ,    __lowerCAmelCase       :							int		)		->  Vector:
   assert isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		) and (isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		))
   snake_case 						=   [0] * dimension
   snake_case 						=   1
   return Vector(__lowerCAmelCase		)





def 	__lowerCamelCase			(      __lowerCAmelCase       :							float      ,    __lowerCAmelCase       :							Vector      ,    __lowerCAmelCase       :							Vector		)		->  Vector:
   assert (
       isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		)
       and isinstance(__lowerCAmelCase      ,    __lowerCAmelCase		)
       and (isinstance(__lowerCAmelCase      ,    (int, float)		))
   )
   return x * scalar + y





def 	__lowerCamelCase			(      __lowerCAmelCase       :							int      ,    __lowerCAmelCase       :							int      ,    __lowerCAmelCase       :							int		)		->  Vector:
   random.seed(__lowerCAmelCase		)
   snake_case 						=   [random.randint(__lowerCAmelCase      ,    __lowerCAmelCase		) for _ in range(__lowerCAmelCase		)]
   return Vector(__lowerCAmelCase		)
class 			_lowerCAmelCase		:






     """simple docstring"""






     def __init__(   self							:			int   ,       __snake_case							:			list[list[float]]   ,       __snake_case							:			int   ,       __snake_case							:			int						)->	None:
        snake_case 						=   matrix
        snake_case 						=   w
        snake_case 						=   h



     def __str__(   self							:			int						)->	str:
        snake_case 						=   """"""
        for i in range(self.__height						):
           ans += "|"
           for j in range(self.__width						):
              if j < self.__width - 1:
                 ans += str(self.__matrix[i][j]						) + ","
              else:
                 ans += str(self.__matrix[i][j]						) + "|\n"
        return ans



     def __add__(   self							:			int   ,       __snake_case							:			Matrix						)->	Matrix:
        if self.__width == other.width() and self.__height == other.height():
           snake_case 						=   []
           for i in range(self.__height						):
              snake_case 						=   [
                  self.__matrix[i][j] + other.component(__snake_case   ,       __snake_case						)
                  for j in range(self.__width						)
              ]
              matrix.append(__snake_case						)
           return Matrix(__snake_case   ,       self.__width   ,       self.__height						)
        else:
           raise Exception("""matrix must have the same dimension!"""						)



     def __sub__(   self							:			List[Any]   ,       __snake_case							:			Matrix						)->	Matrix:
        if self.__width == other.width() and self.__height == other.height():
           snake_case 						=   []
           for i in range(self.__height						):
              snake_case 						=   [
                  self.__matrix[i][j] - other.component(__snake_case   ,       __snake_case						)
                  for j in range(self.__width						)
              ]
              matrix.append(__snake_case						)
           return Matrix(__snake_case   ,       self.__width   ,       self.__height						)
        else:
           raise Exception("""matrices must have the same dimension!"""						)



     @overload
     def __mul__(   self							:			int   ,       __snake_case							:			float						)->	Matrix:
        ...



     @overload
     def __mul__(   self							:			str   ,       __snake_case							:			Vector						)->	Vector:
        ...



     def __mul__(   self							:			Union[str, Any]   ,       __snake_case							:			float | Vector						)->	Vector | Matrix:
        if isinstance(__snake_case   ,       __snake_case						):  # matrix-vector
           if len(__snake_case						) == self.__width:
              snake_case 						=   zero_vector(self.__height						)
              for i in range(self.__height						):
                 snake_case 						=   [
                     self.__matrix[i][j] * other.component(__snake_case						)
                     for j in range(self.__width						)
                 ]
                 ans.change_component(__snake_case   ,       sum(__snake_case						)						)
              return ans
           else:
              raise Exception(
                  """vector must have the same size as the """
                  """number of columns of the matrix!"""						)
        elif isinstance(__snake_case   ,       (int, float)						):  # matrix-scalar
           snake_case 						=   [
               [self.__matrix[i][j] * other for j in range(self.__width						)]
               for i in range(self.__height						)
           ]
           return Matrix(__snake_case   ,       self.__width   ,       self.__height						)
        return None



     def      lowerCAmelCase			(   self							:			str						)->	int:
        return self.__height



     def      lowerCAmelCase			(   self							:			Optional[Any]						)->	int:
        return self.__width



     def      lowerCAmelCase			(   self							:			List[str]   ,       __snake_case							:			int   ,       __snake_case							:			int						)->	float:
        if 0 <= x < self.__height and 0 <= y < self.__width:
           return self.__matrix[x][y]
        else:
           raise Exception("""change_component: indices out of bounds"""						)



     def      lowerCAmelCase			(   self							:			Optional[Any]   ,       __snake_case							:			int   ,       __snake_case							:			int   ,       __snake_case							:			float						)->	None:
        if 0 <= x < self.__height and 0 <= y < self.__width:
           snake_case 						=   value
        else:
           raise Exception("""change_component: indices out of bounds"""						)



     def      lowerCAmelCase			(   self							:			Optional[Any]   ,       __snake_case							:			int   ,       __snake_case							:			int						)->	float:
        if self.__height != self.__width:
           raise Exception("""Matrix is not square"""						)
        snake_case 						=   self.__matrix[:x] + self.__matrix[x + 1 :]
        for i in range(len(__snake_case						)						):
           snake_case 						=   minor[i][:y] + minor[i][y + 1 :]
        return Matrix(__snake_case   ,       self.__width - 1   ,       self.__height - 1						).determinant()



     def      lowerCAmelCase			(   self							:			Optional[Any]   ,       __snake_case							:			int   ,       __snake_case							:			int						)->	float:
        if self.__height != self.__width:
           raise Exception("""Matrix is not square"""						)
        if 0 <= x < self.__height and 0 <= y < self.__width:
           return (-1) ** (x + y) * self.minor(__snake_case   ,       __snake_case						)
        else:
           raise Exception("""Indices out of bounds"""						)



     def      lowerCAmelCase			(   self							:			Tuple						)->	float:
        if self.__height != self.__width:
           raise Exception("""Matrix is not square"""						)
        if self.__height < 1:
           raise Exception("""Matrix has no element"""						)
        elif self.__height == 1:
           return self.__matrix[0][0]
        elif self.__height == 2:
           return (
               self.__matrix[0][0] * self.__matrix[1][1]
               - self.__matrix[0][1] * self.__matrix[1][0]
           )
        else:
           snake_case 						=   [
               self.__matrix[0][y] * self.cofactor(0   ,       __snake_case						) for y in range(self.__width						)
           ]
           return sum(__snake_case						)





def 	__lowerCamelCase			(      __lowerCAmelCase       :							int		)		->  Matrix:
   snake_case 						=   [[0] * n for _ in range(__lowerCAmelCase		)]
   return Matrix(__lowerCAmelCase      ,    __lowerCAmelCase      ,    __lowerCAmelCase		)





def 	__lowerCamelCase			(      __lowerCAmelCase       :							int      ,    __lowerCAmelCase       :							int      ,    __lowerCAmelCase       :							int      ,    __lowerCAmelCase       :							int		)		->  Matrix:
   random.seed(__lowerCAmelCase		)
   snake_case 						=   [
       [random.randint(__lowerCAmelCase      ,    __lowerCAmelCase		) for _ in range(__lowerCAmelCase		)] for _ in range(__lowerCAmelCase		)
   ]
   return Matrix(__lowerCAmelCase      ,    __lowerCAmelCase      ,    __lowerCAmelCase		)








'''simple docstring'''




import os
from collections.abc import Iterator





def 	__lowerCamelCase			(      __lowerCAmelCase       :							str = "."		)		->  Iterator[str]:
   for dir_path, dir_names, filenames in os.walk(__lowerCAmelCase		):
      snake_case 						=   [d for d in dir_names if d != """scripts""" and d[0] not in """._"""]
      for filename in filenames:
         if filename == "__init__.py":
            continue
         if os.path.splitext(__lowerCAmelCase		)[1] in (".py", ".ipynb"):
            yield os.path.join(__lowerCAmelCase      ,    __lowerCAmelCase		).lstrip("""./"""		)





def 	__lowerCamelCase			(      __lowerCAmelCase       :							List[str]		)		->  Any:
   return F'''{i * "  "}*''' if i else "\n##"





def 	__lowerCamelCase			(      __lowerCAmelCase       :							str      ,    __lowerCAmelCase       :							str		)		->  str:
   snake_case 						=   old_path.split(os.sep		)
   for i, new_part in enumerate(new_path.split(os.sep		)		):
      if (i + 1 > len(__lowerCAmelCase		) or old_parts[i] != new_part) and new_part:
         print(F'''{md_prefix(__lowerCAmelCase		)} {new_part.replace("_"      ,    " "		).title()}'''		)
   return new_path





def 	__lowerCamelCase			(      __lowerCAmelCase       :							str = "."		)		->  None:
   snake_case 						=   """"""
   for filepath in sorted(good_file_paths(__lowerCAmelCase		)		):
      snake_case						,    snake_case 						=   os.path.split(__lowerCAmelCase		)
      if filepath != old_path:
         snake_case 						=   print_path(__lowerCAmelCase      ,    __lowerCAmelCase		)
      snake_case 						=   (filepath.count(os.sep		) + 1) if filepath else 0
      snake_case 						=   F'''{filepath}/{filename}'''.replace(""" """      ,    """%20"""		)
      snake_case 						=   os.path.splitext(filename.replace("""_"""      ,    """ """		).title()		)[0]
      print(F'''{md_prefix(__lowerCAmelCase		)} [{filename}]({url})'''		)


if __name__ == "__main__":
 print_directory_md(".")

