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_2 ( int [ ] [ ] var_3 , int var_4 ) {
    int [ ] [ ] var_7 = new int [ var_3 . length ] [ var_3 [ 0 ] . length ] ;
    int var_8 = var_3 . length ;
    int var_9 = var_3 [ 0 ] . length ;
    int var_10 = var_4 % ( var_8 * var_9 ) ;
    int var_11 = var_10 / var_9 ;
    int var_12 = var_10 % var_9 ;
    for ( int var_13 = 0 ;
    var_13 < var_3 . length ;
    var_13 ++ ) {
      for ( int var_14 = 0 ;
      var_14 < var_3 [ var_13 ] . length ;
      var_14 ++ ) {
        int var_15 = var_13 + var_11 ;
        int var_16 = ( var_14 + var_12 ) % var_9 ;
        if ( var_12 + var_14 >= var_9 ) var_15 ++ ;
        var_15 %= var_8 ;
        var_7 [ var_15 ] [ var_16 ] = var_3 [ var_13 ] [ var_14 ] ;
      }
    }
    List < List < Integer >> var_18 = new ArrayList < > ( ) ;
    for ( int [ ] var_19 : var_7 ) {
      List < Integer > var_20 = new ArrayList < > ( ) ;
      var_18 . add ( var_20 ) ;
      for ( int var_22 : var_19 ) var_20 . add ( var_22 ) ;
    }
    return var_18 ;
  }
  