Program: 175832
Project: 175832
Buggy source:
private MiniFacade combine(List<MiniFacade> in){
  MiniFacade out=new MiniFacade();
  out.left=lp;
  out.width=rp - lp;
  out.imageFeatures=in.get(0).imageFeatures;
  double[] color=new double[]{0,0,0,1};
  int gcc=0;
  for (  MiniFacade mf : in)   for (int i=0; i < 3; i++) {
    color[i]+=color[i];
  }
  for (int i=0; i < 3; i++) {
    color[i]/=in.size();
  }
  out.app.color=Colourz.to4(color);
  Cache2<Outer,Integer,List<FRect>> corniceX=new ArrayCache2();
  Cache2<Outer,Integer,List<FRect>> sillX=new ArrayCache2();
  Cache2<Outer,Integer,List<FRect>> balX=new ArrayCache2();
  out.height=in.stream().mapToDouble(mf -> mf.height).average().getAsDouble();
  out.groundFloorHeight=in.stream().mapToDouble(mf -> mf.groundFloorHeight).average().getAsDouble();
  for (int i=0; i < ids; i++) {
    int yay=0, nay=0;
    int ii=i;
    List<FRect> found=in.stream().map(mf -> m2i2r.get(mf,ii)).filter(x -> x != null).flatMap(l -> l.stream()).collect(Collectors.toList());
    Point2d avg=found.stream().map(r -> r.getCenter()).collect(new Point2DMeanCollector());
    for (    MiniFacade mf : in) {
      List<FRect> r=m2i2r.get(mf,i);
      if (mf.contains(avg)) {
        if (r.isEmpty()) {
          if (mf.left + 3 < avg.x && mf.left + mf.width - 3 > avg.x)           nay++;
        }
 else         yay++;
      }
    }
    if (yay >= nay) {
      FRect o;
      if (dimensionSpread(found) > 1.4) {
        o=new FRect(found.get(0),true);
        for (        FRect n : found)         o.setFrom(o.union(n));
      }
 else {
        o=new FRect(average(found.toArray(new FRect[found.size()])),out);
      }
{
        FRect t=found.get(0);
        o.f=t.f;
        o.id=i;
        o.app=t.app;
        o.attached=t.attached;
        o.attachedHeight.get(Feature.SILL).d=averageAttached(o,Feature.SILL,found);
        o.attachedHeight.get(Feature.CORNICE).d=averageAttached(o,Feature.CORNICE,found);
        o.attachedHeight.get(Feature.BALCONY).d=averageAttached(o,Feature.BALCONY,found);
        if (t.f == Feature.WINDOW || t.f == Feature.SHOP) {
          for (          FRect r : found) {
            corniceX.get(r.outer,r.yi).add(o);
            sillX.get(r.outer,r.yi).add(o);
            balX.get(r.outer,r.yi).add(o);
          }
        }
      }
      out.featureGen.put(o.f,o);
    }
  }
  spreadAttachedOverGrid(Feature.SILL,sillX);
  spreadAttachedOverGrid(Feature.CORNICE,corniceX);
  spreadAttachedOverGrid(Feature.BALCONY,balX);
  fixOverlaps(out);
  mergeRemoveSmall(out);
  DRectangle mr=out.getAsRect();
  mr.width-=0.01;
  mr.x+=0.1;
  for (  Feature f : Feature.values()) {
    Iterator<FRect> rit=out.featureGen.get(f).iterator();
    while (rit.hasNext()) {
      FRect r=rit.next();
      DRectangle section=r.intersect(mr);
      if (section == null)       rit.remove();
 else       r.setFrom(section);
    }
  }
{
    Double hf=Double.valueOf(0);
    while (out.groundFloorHeight < 6 && ((hf=horizontalEmpty(out,out.groundFloorHeight)) != null))     out.groundFloorHeight=hf + 0.3;
    if (out.groundFloorHeight >= 6)     out.groundFloorHeight=0;
  }
  return out;
}

Fixed version (ground truth):
private MiniFacade combine(List<MiniFacade> in){
  MiniFacade out=new MiniFacade();
  out.left=lp;
  out.width=rp - lp;
  out.imageFeatures=in.get(0).imageFeatures;
  if (toReg.length == 0)   out.height=in.stream().mapToDouble(mf -> mf.height).average().getAsDouble();
 else   out.height=500;
  double[] color=new double[]{0,0,0,1};
  int gcc=0;
  for (  MiniFacade mf : in)   for (int i=0; i < 3; i++) {
    color[i]+=color[i];
  }
  for (int i=0; i < 3; i++) {
    color[i]/=in.size();
  }
  out.app.color=Colourz.to4(color);
  Cache2<Outer,Integer,List<FRect>> corniceX=new ArrayCache2();
  Cache2<Outer,Integer,List<FRect>> sillX=new ArrayCache2();
  Cache2<Outer,Integer,List<FRect>> balX=new ArrayCache2();
  out.groundFloorHeight=in.stream().mapToDouble(mf -> mf.groundFloorHeight).average().getAsDouble();
  for (int i=0; i < ids; i++) {
    int yay=0, nay=0;
    int ii=i;
    List<FRect> found=in.stream().map(mf -> m2i2r.get(mf,ii)).filter(x -> x != null).flatMap(l -> l.stream()).collect(Collectors.toList());
    Point2d avg=found.stream().map(r -> r.getCenter()).collect(new Point2DMeanCollector());
    for (    MiniFacade mf : in) {
      List<FRect> r=m2i2r.get(mf,i);
      if (mf.contains(avg)) {
        if (r.isEmpty()) {
          if (mf.left + 3 < avg.x && mf.left + mf.width - 3 > avg.x)           nay++;
        }
 else         yay++;
      }
    }
    if (yay >= nay) {
      FRect o;
      if (dimensionSpread(found) > 1.4) {
        o=new FRect(found.get(0),true);
        for (        FRect n : found)         o.setFrom(o.union(n));
      }
 else {
        o=new FRect(average(found.toArray(new FRect[found.size()])),out);
      }
{
        FRect t=found.get(0);
        o.f=t.f;
        o.id=i;
        o.app=t.app;
        o.attached=t.attached;
        o.attachedHeight.get(Feature.SILL).d=averageAttached(o,Feature.SILL,found);
        o.attachedHeight.get(Feature.CORNICE).d=averageAttached(o,Feature.CORNICE,found);
        o.attachedHeight.get(Feature.BALCONY).d=averageAttached(o,Feature.BALCONY,found);
        if (t.f == Feature.WINDOW || t.f == Feature.SHOP) {
          for (          FRect r : found) {
            corniceX.get(r.outer,r.yi).add(o);
            sillX.get(r.outer,r.yi).add(o);
            balX.get(r.outer,r.yi).add(o);
          }
        }
      }
      out.featureGen.put(o.f,o);
    }
  }
  spreadAttachedOverGrid(Feature.SILL,sillX);
  spreadAttachedOverGrid(Feature.CORNICE,corniceX);
  spreadAttachedOverGrid(Feature.BALCONY,balX);
  fixOverlaps(out);
  mergeRemoveSmall(out);
  DRectangle mr=out.getAsRect();
  mr.width-=0.01;
  mr.x+=0.1;
  for (  Feature f : Feature.values()) {
    Iterator<FRect> rit=out.featureGen.get(f).iterator();
    while (rit.hasNext()) {
      FRect r=rit.next();
      DRectangle section=r.intersect(mr);
      if (section == null)       rit.remove();
 else       r.setFrom(section);
    }
  }
{
    Double hf=Double.valueOf(0);
    while (out.groundFloorHeight < 6 && ((hf=horizontalEmpty(out,out.groundFloorHeight)) != null))     out.groundFloorHeight=hf + 0.3;
    if (out.groundFloorHeight >= 6)     out.groundFloorHeight=0;
  }
  return out;
}