input: from typing import List
  
  def transform_matrix(matrix: List[List[int]]) -> List[List[int]]:
      """
      For a 0-indexed m x n integer matrix, generate a new 0-indexed matrix called result. Start with result as a copy of the initial matrix, then substitute each -1 with the largest element in the same column.
  
      Return the result matrix.
  
      Examples:
      >>> matrix = [[1,2,-1],[4,-1,6],[7,8,9]]
      [[1,2,9],[4,8,6],[7,8,9]]
      >>> matrix = [[3,-1],[5,2]]
      [[3,2],[5,2]]
  
      Constraints:
      m == len(matrix)
      n == len(matrix[i])
      2 <= m, n <= 50
      -1 <= matrix[i][j] <= 100
      Each column is guaranteed to contain at least one non-negative integer.
      """
output:     result = [row[:] for row in matrix]
      m, n = len(matrix), len(matrix[0])
  
      for col in range(n):
          max_in_col = max(matrix[row][col] for row in range(m) if matrix[row][col] != -1)
          for row in range(m):
              if matrix[row][col] == -1:
                  result[row][col] = max_in_col
  
      return result