input: Write a function to determine if it is possible to get a given matrix sorted in non-decreasing order by performing any number of row or column shifts. If it is possible, return True; otherwise, return False. If the given matrix is empty, return True.
  assert can_sort_matrix([[3, 4], [5, 1]])==True
  assert can_sort_matrix([[3, 5], [10, 1]])==False
  assert can_sort_matrix([[4, 3], [1, 2]])==False
  assert can_sort_matrix([[3, 5], [4, 1]])==True
  assert can_sort_matrix([])==True
output: def can_sort_matrix(matrix):
      if not matrix:
          return True
      n = len(matrix)
      m = len(matrix[0])
      sorted_matrix = sorted([matrix[i][j] for i in range(n) for j in range(m)])
      for i in range(n):
          for j in range(m):
              if matrix[i][j] != sorted_matrix[i * m + j]:
                  return False
      return True