<doocs>1260.Shift 2D Grid_1.py
def shiftGrid( grid: List[List[int]], k: int) -> List[List[int]]:
    m, n = len(grid), len(grid[0])
    k %= m * n
    t = [grid[i][j] for i in range(m) for j in range(n)]
    t = t[-k:] + t[:-k]
    for i in range(m):
        for j in range(n):
            grid[i][j] = t[i * n + j]
    return grid
def sample_funcname ( var_0 : List [ List [ int ] ] , var_3 : int ) -> List [ List [ int ] ] :
    var_5 , var_7 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_3 %= var_5 * var_7
    var_11 = [ var_0 [ var_8 ] [ var_9 ] for var_8 in range ( var_5 ) for var_9 in range ( var_7 ) ]
    var_11 = var_11 [ - var_3 : ] + var_11 [ : - var_3 ]
    for var_8 in range ( var_5 ) :
        for var_9 in range ( var_7 ) :
            var_0 [ var_8 ] [ var_9 ] = var_11 [ var_8 * var_7 + var_9 ]
    return var_0
