comefrom: <qiyuangong>1260_Shift_2D_Grid_1.java
code: public List<List<Integer>> shiftGrid(int[][] grid, int k) {
          int[][] newGrid = new int[grid.length][grid[0].length];
          int m = grid.length;
          int n = grid[0].length;
          int true_k = k % (m * n);
          int move_i = true_k / n;
          int move_j = true_k % n;
  
          for (int i = 0; i < grid.length; i++) {
              for (int j = 0; j < grid[i].length; j++) {
                  int new_i = i + move_i;
                  int new_j = (j + move_j) % n;
                  if (move_j + j >= n) new_i ++;
                  new_i %= m;
                  newGrid[new_i][new_j] = grid[i][j];
              }
          }
          List<List<Integer>> result = new ArrayList<>();
          for (int[] row : newGrid) {
              List<Integer> listRow = new ArrayList<>();
              result.add(listRow);
              for (int v : row) listRow.add(v);
          }
          return result;
      }
masked: public List < List < Integer >> var_0 ( int [ ] [ ] var_1 , int var_2 ) {
    int [ ] [ ] var_3 = new int [ var_1 . length ] [ var_1 [ 0 ] . length ] ;
    int var_4 = var_1 . length ;
    int var_5 = var_1 [ 0 ] . length ;
    int var_6 = var_2 % ( var_4 * var_5 ) ;
    int var_7 = var_6 / var_5 ;
    int var_8 = var_6 % var_5 ;
    for ( int var_9 = 0 ;
    var_9 < var_1 . length ;
    var_9 ++ ) {
      for ( int var_10 = 0 ;
      var_10 < var_1 [ var_9 ] . length ;
      var_10 ++ ) {
        int var_11 = var_9 + var_7 ;
        int var_12 = ( var_10 + var_8 ) % var_5 ;
        if ( var_8 + var_10 >= var_5 ) var_11 ++ ;
        var_11 %= var_4 ;
        var_3 [ var_11 ] [ var_12 ] = var_1 [ var_9 ] [ var_10 ] ;
      }
    }
    List < List < Integer >> var_13 = new ArrayList < > ( ) ;
    for ( int [ ] var_14 : var_3 ) {
      List < Integer > var_15 = new ArrayList < > ( ) ;
      var_13 . add ( var_15 ) ;
      for ( int var_16 : var_14 ) var_15 . add ( var_16 ) ;
    }
    return var_13 ;
  }
  