javascript solution 140 ms, faster than 100.00%
\nvar allCellsDistOrder = function(R, C, r0, c0) {\n    var arr = new Array();\n    for(let i = 0; i < R; i++){\n        for(let j = 0; j < C; j++){\n          
```\nvar allCellsDistOrder = function(R, C, r0, c0) {\n    var arr = new Array();\n    for(let i = 0; i < R; i++){\n        for(let j = 0; j < C; j++){\n            arr.push([i, j]);\n        }\n    }\n\n    arr.sort((v1, v2) => {\n        return Math.abs(v1[0] - r0) + Math.abs(v1[1] - c0) - (Math.abs(v2[0] - r0) + Math.abs(v2[1] - c0));\n    });\n\n    return arr;\n};\n```
[]