input: def num_unique_paths(m: int, n: int) -> int:
      """
      Given dimensions m and n, representing a grid, this function calculates
      the number of unique paths from the top-left corner to the bottom-right
      corner. Moving is restricted to right or down.
      
      >>> num_unique_paths(3, 3)
      6
      >>> num_unique_paths(2, 2)
      2
      >>> num_unique_paths(1, 1)
      1
      >>> num_unique_paths(4, 3)
      10
      """
output:     if m == 1 or n == 1:
          return 1
      
      dp = [[0] * n for _ in range(m)]
      
      for i in range(m):
          dp[i][0] = 1
      for j in range(n):
          dp[0][j] = 1
      
      for i in range(1, m):
          for j in range(1, n):
              dp[i][j] = dp[i-1][j] + dp[i][j-1]
      
      return dp[m-1][n-1]