input: Write a Python function that, given an m x n matrix of positive integers, allows movement from any cell to another cell either below or to the right (not necessarily adjacent). The score of a move is defined as the difference between values of the cells involved (target cell value minus the initial cell value). Starting from any cell with at least one move, the function should return the maximum achievable total score.
  
  Example:
  >>> grid = [[9,5,7,3],[8,9,6,1],[6,7,14,3],[2,5,3,1]]
  9
  >>> grid = [[4,3,2],[3,2,1]]
  -1
  
  Constraints:
  m == grid.length
  n == grid[i].length
  2 <= m, n <= 1000
  4 <= m * n <= 10^5
  1 <= grid[i][j] <= 10^5
output: def max_total_score(grid):
      m, n = len(grid), len(grid[0])
      dp = [[float('-inf')] * n for _ in range(m)]
      
      for i in range(m):
          for j in range(n):
              if i > 0:
                  dp[i][j] = max(dp[i][j], grid[i][j] - grid[i-1][j] + dp[i-1][j])
              if j > 0:
                  dp[i][j] = max(dp[i][j], grid[i][j] - grid[i][j-1] + dp[i][j-1])
      
      max_score = float('-inf')
      for i in range(m):
          for j in range(n):
              if i < m - 1:
                  max_score = max(max_score, dp[i+1][j])
              if j < n - 1:
                  max_score = max(max_score, dp[i][j+1])
      
      return max_score if max_score != float('-inf') else -1