<gouthampradhan>dynamic_programming_CornerRectangles_1.java
public int countCornerRectangles(int[][] grid) {
    int[][] count = new int[grid[0].length][grid[0].length];
    int result = 0;
    for (int[] row : grid) {
      for (int i = 0; i < row.length; i++) {
        if (row[i] == 1) {
          for (int j = i + 1; j < row.length; j++) {
            if (row[j] == 1) {
              if (count[i][j] > 0) {
                result += count[i][j];
              }
              count[i][j]++;
            }
          }
        }
      }
    }
    return result;
  }
public int sample_funcname ( int [ ] [ ] var_0 ) {
  int [ ] [ ] var_3 = new int [ var_0 [ 0 ] . length ] [ var_0 [ 0 ] . length ] ;
  int var_4 = 0 ;
  for ( int [ ] var_5 : var_0 ) {
    for ( int var_6 = 0 ;
    var_6 < var_5 . length ;
    var_6 ++ ) {
      if ( var_5 [ var_6 ] == 1 ) {
        for ( int var_8 = var_6 + 1 ;
        var_8 < var_5 . length ;
        var_8 ++ ) {
          if ( var_5 [ var_8 ] == 1 ) {
            if ( var_3 [ var_6 ] [ var_8 ] > 0 ) {
              var_4 += var_3 [ var_6 ] [ var_8 ] ;
            }
            var_3 [ var_6 ] [ var_8 ] ++ ;
          }
        }
      }
    }
  }
  return var_4 ;
}
