C# easy to understand
\n\n\t\tpublic class Solution {\n\t\t\n\t\tpublic int[][] AllCellsDistOrder(int R, int C, int r0, int c0) {        \n        List cells=new List();\n        for
\n\n\t\tpublic class Solution {\n\t\t\n\t\tpublic int[][] AllCellsDistOrder(int R, int C, int r0, int c0) {        \n        List<cell> cells=new List<cell>();\n        for(int i=0; i<R; i++){            \n            for(int j=0;j<C; j++){\n                var c=new cell(){x=i,y=j, dis=Math.Abs(i-r0)+ Math.Abs(j-c0)};\n                cells.Add(c);\n            }\n         }\n       return cells.OrderBy(t=>t.dis).Select(t=> new int[]{t.x,t.y}).ToArray();\n       }\n\t}\n\tpublic class cell{\n       public int x;\n       public int y;\n       public int dis;\n\t   }
[]