Program: 175833
Project: 175833
Buggy source:
public List<MiniFacade> go(List<MiniFacade> in,double debugFrac,MegaFeatures megaFeatures){
  for (  MiniFacade mf : in)   if (mf.imageFeatures != null)   seenImages.add(mf.imageFeatures.ortho);
  if (in.isEmpty())   return Collections.singletonList(gridMini());
  System.out.println("String_Node_Str" + in.size() + "String_Node_Str");
  if (megaFeatures != null)   in=augmentWithTween(in,megaFeatures);
  System.out.println("String_Node_Str" + in.size() + "String_Node_Str");
  List<MiniFacade> out;
  if (true)   out=newFromWindows(in);
 else   out=in.stream().map(mf -> new MiniFacade(mf)).collect(Collectors.toList());
  System.out.println("String_Node_Str" + out.size() + "String_Node_Str");
  if (debugFrac < 0) {
    out.add(0,new MiniFacade());
    return out;
  }
  if (toReg.length > 0)   alignMFs(out);
 else {
    lp=in.get(0).left;
    rp=in.get(0).width;
  }
  if (debugFrac == 0) {
    out.add(0,new MiniFacade());
    return out;
  }
  for (  MiniFacade mf : out) {
    assignFeaturesToWindows(mf.featureGen.getRects(Feature.WINDOW,Feature.SHOP).stream().collect(Collectors.toList()),mf.featureGen);
    mf.featureGen.get(Feature.CORNICE).clear();
    mf.featureGen.get(Feature.BALCONY).clear();
    mf.featureGen.get(Feature.SILL).clear();
    mf.featureGen.get(Feature.GRID).clear();
  }
  for (  MiniFacade mf : out) {
    mergeRemoveSmall(mf);
    mergeRemoveSimilar(mf);
  }
  for (  Feature f : Feature.values())   for (  MiniFacade mf : out)   mf.featureGen.get(f).stream().forEach(r -> r.f=f);
  for (int i=0; i < 50 * debugFrac; i++) {
    for (    MiniFacade mf : out)     for (    Feature f : toReg)     cluster1(mf.featureGen.getRects(f),1 * scale,alpha,Bounds.XMIN,Bounds.XMAX,Bounds.YMIN,Bounds.YMAX);
    List<FRect> allRects=new ArrayList<>();
    for (    MiniFacade mf : out)     for (    Feature f : toReg)     allRects.addAll(mf.featureGen.get(f));
    for (    Feature f : toReg) {
      List<FRect> allF=out.stream().flatMap(mf -> mf.featureGen.get(f).stream()).collect(Collectors.toList());
      cluster1(allF,0.5 * scale,alpha,Bounds.WIDTH,Bounds.HEIGHT);
    }
    cluster1(allRects,0.2 * scale,alpha,Bounds.XMIN,Bounds.XMAX,Bounds.YMIN,Bounds.YMAX);
    if (i % 5 == 0)     for (    MiniFacade mf : out) {
      findNeighbours(mf.featureGen.getRects(Feature.WINDOW,Feature.SHOP));
      findNeighbours(mf.featureGen.getRects(Feature.MOULDING));
    }
    for (    Dir dir : Dir.values())     clusterDeltas(allRects,0.2 * scale,alpha,dir);
    for (    MiniFacade mf : out) {
      if (toReg.length > 0)       for (      FRect d : mf.featureGen.get(Feature.DOOR))       constrainDoor(mf,d,alpha);
      for (      FRect m : mf.featureGen.get(Feature.MOULDING))       constrainMoulding(mf,m,alpha);
    }
    for (    MiniFacade mf : out) {
      for (      Feature f : toReg) {
        Iterator<FRect> rit=mf.featureGen.get(f).iterator();
        while (rit.hasNext()) {
          FRect r=rit.next();
          if (r.width <= 0.4 * scale || r.height <= 0.4 * scale)           rit.remove();
 else           for (          FRect n : r.adjacent)           if (n != null && similar(n,r)) {
            n.attached.putAll(r.attached);
            rit.remove();
            break;
          }
        }
      }
    }
  }
  for (  MiniFacade mf : out) {
    findOuters(mf);
    mergeRemoveSmall(mf);
  }
  ids=0;
  for (  Feature f : toReg2) {
    List<Pair<MiniFacade,FRect>> allRects=new ArrayList<>();
    for (    MiniFacade mf : out)     for (    FRect r : mf.featureGen.get(f)) {
      r.id=-1;
      allRects.add(new Pair<>(mf,r));
    }
    Collections.sort(allRects,new Comparator<Pair<MiniFacade,FRect>>(){
      @Override public int compare(      Pair<MiniFacade,FRect> a_,      Pair<MiniFacade,FRect> b_){
        FRect a=a_.second(), b=b_.second();
        if (a.gridCoords != null && b.gridCoords == null)         return -1;
        if (b.gridCoords != null && a.gridCoords == null)         return 1;
        if (a.gridCoords != null && b.gridCoords != null) {
          int out=-Integer.compare(countCoords(a.gridCoords),countCoords(b.gridCoords));
          if (out != 0)           return out;
        }
        return Double.compare(a.area(),b.area());
      }
      private int countCoords(      int[] gridCoords){
        int out=0;
        for (        int i : gridCoords)         if (i != -Integer.MAX_VALUE)         out++;
        return out;
      }
    }
);
    for (    Pair<MiniFacade,FRect> pair : allRects) {
      FRect w=pair.second();
      if (w.id == -1)       findId(w,f,out,pair.first(),ids++);
    }
  }
  out.add(0,combine(out));
  System.out.println("String_Node_Str");
  return out;
}

Fixed version (ground truth):
public List<MiniFacade> go(List<MiniFacade> in,double debugFrac,MegaFeatures megaFeatures){
  for (  MiniFacade mf : in)   if (mf.imageFeatures != null)   seenImages.add(mf.imageFeatures.ortho);
  if (in.isEmpty())   return Collections.singletonList(gridMini());
  System.out.println("String_Node_Str" + in.size() + "String_Node_Str");
  if (megaFeatures != null)   in=augmentWithTween(in,megaFeatures);
  System.out.println("String_Node_Str" + in.size() + "String_Node_Str");
  List<MiniFacade> out;
  if (true)   out=newFromWindows(in);
 else   out=in.stream().map(mf -> new MiniFacade(mf)).collect(Collectors.toList());
  System.out.println("String_Node_Str" + out.size() + "String_Node_Str");
  if (debugFrac < 0) {
    out.add(0,new MiniFacade());
    return out;
  }
  if (toReg.length > 0)   alignMFs(out);
 else {
    lp=in.get(0).left;
    rp=in.get(0).width;
  }
  if (debugFrac == 0) {
    out.add(0,new MiniFacade());
    return out;
  }
  for (  MiniFacade mf : out) {
    assignFeaturesToWindows(mf.featureGen.getRects(Feature.WINDOW,Feature.SHOP).stream().collect(Collectors.toList()),mf.featureGen);
    mf.featureGen.get(Feature.CORNICE).clear();
    mf.featureGen.get(Feature.BALCONY).clear();
    mf.featureGen.get(Feature.SILL).clear();
    mf.featureGen.get(Feature.GRID).clear();
  }
  for (  MiniFacade mf : out) {
    mergeRemoveSmall(mf);
    mergeRemoveSimilar(mf);
  }
  for (  Feature f : Feature.values())   for (  MiniFacade mf : out)   mf.featureGen.get(f).stream().forEach(r -> r.f=f);
  for (int i=0; i < 50 * debugFrac; i++) {
    for (    MiniFacade mf : out)     for (    Feature f : toReg)     cluster1(mf.featureGen.getRects(f),1 * scale,alpha,Bounds.XMIN,Bounds.XMAX,Bounds.YMIN,Bounds.YMAX);
    List<FRect> allRects=new ArrayList<>();
    for (    MiniFacade mf : out)     for (    Feature f : toReg)     allRects.addAll(mf.featureGen.get(f));
    for (    Feature f : toReg) {
      List<FRect> allF=out.stream().flatMap(mf -> mf.featureGen.get(f).stream()).collect(Collectors.toList());
      cluster1(allF,0.5 * scale,alpha,Bounds.WIDTH,Bounds.HEIGHT);
    }
    cluster1(allRects,0.2 * scale,alpha,Bounds.XMIN,Bounds.XMAX,Bounds.YMIN,Bounds.YMAX);
    if (i % 5 == 0)     for (    MiniFacade mf : out) {
      findNeighbours(mf.featureGen.getRects(Feature.WINDOW,Feature.SHOP));
      findNeighbours(mf.featureGen.getRects(Feature.MOULDING));
    }
    for (    Dir dir : Dir.values())     clusterDeltas(allRects,0.2 * scale,alpha,dir);
    for (    MiniFacade mf : out) {
      if (toReg.length > 0)       for (      FRect d : mf.featureGen.get(Feature.DOOR))       constrainDoor(mf,d,alpha);
      for (      FRect m : new ArrayList<>(mf.featureGen.get(Feature.MOULDING)))       constrainMoulding(mf,m,alpha);
    }
    for (    MiniFacade mf : out) {
      for (      Feature f : toReg) {
        Iterator<FRect> rit=mf.featureGen.get(f).iterator();
        while (rit.hasNext()) {
          FRect r=rit.next();
          if (r.width <= 0.4 * scale || r.height <= 0.4 * scale)           rit.remove();
 else           for (          FRect n : r.adjacent)           if (n != null && similar(n,r)) {
            n.attached.putAll(r.attached);
            rit.remove();
            break;
          }
        }
      }
    }
  }
  for (  MiniFacade mf : out) {
    findOuters(mf);
    mergeRemoveSmall(mf);
  }
  ids=0;
  for (  Feature f : toReg2) {
    List<Pair<MiniFacade,FRect>> allRects=new ArrayList<>();
    for (    MiniFacade mf : out)     for (    FRect r : mf.featureGen.get(f)) {
      r.id=-1;
      allRects.add(new Pair<>(mf,r));
    }
    Collections.sort(allRects,new Comparator<Pair<MiniFacade,FRect>>(){
      @Override public int compare(      Pair<MiniFacade,FRect> a_,      Pair<MiniFacade,FRect> b_){
        FRect a=a_.second(), b=b_.second();
        if (a.gridCoords != null && b.gridCoords == null)         return -1;
        if (b.gridCoords != null && a.gridCoords == null)         return 1;
        if (a.gridCoords != null && b.gridCoords != null) {
          int out=-Integer.compare(countCoords(a.gridCoords),countCoords(b.gridCoords));
          if (out != 0)           return out;
        }
        return Double.compare(a.area(),b.area());
      }
      private int countCoords(      int[] gridCoords){
        int out=0;
        for (        int i : gridCoords)         if (i != -Integer.MAX_VALUE)         out++;
        return out;
      }
    }
);
    for (    Pair<MiniFacade,FRect> pair : allRects) {
      FRect w=pair.second();
      if (w.id == -1)       findId(w,f,out,pair.first(),ids++);
    }
  }
  out.add(0,combine(out));
  System.out.println("String_Node_Str");
  return out;
}