comefrom: <gouthampradhan>array_BestMeetingPoint_1.java
code: public int minTotalDistance(int[][] grid) {
      int[] countR = new int[grid.length];
      int[] countC = new int[grid[0].length];
      int[] distR = new int[grid.length];
      int[] distC = new int[grid[0].length];
      for (int i = 0; i < grid.length; i++) {
        for (int j = 0; j < grid[0].length; j++) {
          if (grid[i][j] == 1) {
            countR[i]++;
            countC[j]++;
          }
        }
      }
      for (int i = 0; i < distR.length; i++) {
        for (int j = 0; j < distR.length; j++) {
          if (countR[j] != 0) {
            distR[i] += Math.abs(j - i) * countR[j];
          }
        }
      }
      for (int i = 0; i < distC.length; i++) {
        for (int j = 0; j < distC.length; j++) {
          if (countC[j] != 0) {
            distC[i] += Math.abs(j - i) * countC[j];
          }
        }
      }
      int min = Integer.MAX_VALUE;
      for (int i = 0; i < distR.length; i++) {
        for (int j = 0; j < distC.length; j++) {
          min = Math.min(min, distR[i] + distC[j]);
        }
      }
      return min;
    }
masked: public int sample_funcname ( int [ ] [ ] var_0 ) {
    int [ ] var_2 = new int [ var_0 . length ] ;
    int [ ] var_4 = new int [ var_0 [ 0 ] . length ] ;
    int [ ] var_5 = new int [ var_0 . length ] ;
    int [ ] var_6 = new int [ var_0 [ 0 ] . length ] ;
    for ( int var_7 = 0 ;
    var_7 < var_0 . length ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_0 [ 0 ] . length ;
      var_8 ++ ) {
        if ( var_0 [ var_7 ] [ var_8 ] == 1 ) {
          var_2 [ var_7 ] ++ ;
          var_4 [ var_8 ] ++ ;
        }
      }
    }
    for ( int var_7 = 0 ;
    var_7 < var_5 . length ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_5 . length ;
      var_8 ++ ) {
        if ( var_2 [ var_8 ] != 0 ) {
          var_5 [ var_7 ] += Math . abs ( var_8 - var_7 ) * var_2 [ var_8 ] ;
        }
      }
    }
    for ( int var_7 = 0 ;
    var_7 < var_6 . length ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_6 . length ;
      var_8 ++ ) {
        if ( var_4 [ var_8 ] != 0 ) {
          var_6 [ var_7 ] += Math . abs ( var_8 - var_7 ) * var_4 [ var_8 ] ;
        }
      }
    }
    int min = Integer . MAX_VALUE ;
    for ( int var_7 = 0 ;
    var_7 < var_5 . length ;
    var_7 ++ ) {
      for ( int var_8 = 0 ;
      var_8 < var_6 . length ;
      var_8 ++ ) {
        min = Math . min ( min , var_5 [ var_7 ] + var_6 [ var_8 ] ) ;
      }
    }
    return min ;
  }
  