input: def transpose(A):
      """
      Optimize the given Python program that processes a 2D array and stores the transpose output in a new array.
      >>> transpose([[1, 2], [3, 4]])
      [[1, 3], [2, 4]]
      >>> transpose([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
      [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
      """
output:     rows = len(A)
      cols = len(A[0])
      transposed = [[0] * rows for _ in range(cols)]
      for i in range(rows):
          for j in range(cols):
              transposed[j][i] = A[i][j]
      return transposed