<garvit244>1030_1.py
def allCellsDistOrder( R, C, r0, c0):
    cells = [[x, y] for x in range(R) for y in range(C)]
    distance = {}
    for cell in cells:
        diff = abs(cell[0]-r0) + abs(cell[1]-c0)
        if diff in distance:
            distance[diff].append(cell)
        else:
            distance[diff] = [cell]
    result = []
    for key in sorted(distance):
        for value in distance[key]:
            result.append(value)
    return result
def sample_funcname ( var_0 , var_1 , var_2 , var_3 ) :
    var_7 = [ [ var_4 , var_5 ] for var_4 in range ( var_0 ) for var_5 in range ( var_1 ) ]
    var_8 = { }
    for var_9 in var_7 :
        var_13 = abs ( var_9 [ 0 ] - var_2 ) + abs ( var_9 [ 1 ] - var_3 )
        if var_13 in var_8 :
            var_8 [ var_13 ].append ( var_9 )
        else :
            var_8 [ var_13 ] = [ var_9 ]
    var_15 = [ ]
    for var_17 in sorted ( var_8 ) :
        for var_18 in var_8 [ var_17 ] :
            var_15.append ( var_18 )
    return var_15
