Program: 163514
Project: 163514
Buggy source:
public static Set<GeoHashQuery> queriesAtLocation(GeoLocation location,double radius){
  int queryBits=Math.max(1,Utils.bitsForBoundingBox(location,radius));
  int geoHashPrecision=(int)(Math.ceil(queryBits / Base32Utils.BITS_PER_BASE32_CHAR));
  double latitude=location.latitude;
  double longitude=location.longitude;
  double latitudeDegrees=radius / Constants.METERS_PER_DEGREE_LATITUDE;
  double latitudeNorth=Math.min(90,latitude + latitudeDegrees);
  double latitudeSouth=Math.max(-90,latitude - latitudeDegrees);
  double longitudeDeltaNorth=GeoUtils.distanceToLongitudeDegrees(radius,latitudeNorth);
  double longitudeDeltaSouth=GeoUtils.distanceToLongitudeDegrees(radius,latitudeSouth);
  double longitudeDelta=Math.max(longitudeDeltaNorth,longitudeDeltaSouth);
  Set<GeoHashQuery> queries=new HashSet<GeoHashQuery>();
  GeoHash geoHash=new GeoHash(latitude,longitude,geoHashPrecision);
  GeoHash geoHashW=new GeoHash(latitude,GeoUtils.wrapLongitude(longitude - longitudeDelta),geoHashPrecision);
  GeoHash geoHashE=new GeoHash(latitude,GeoUtils.wrapLongitude(longitude + longitudeDelta),geoHashPrecision);
  GeoHash geoHashN=new GeoHash(latitudeNorth,longitude,geoHashPrecision);
  GeoHash geoHashNW=new GeoHash(latitudeNorth,GeoUtils.wrapLongitude(longitude - longitudeDelta),geoHashPrecision);
  GeoHash geoHashNE=new GeoHash(latitudeNorth,GeoUtils.wrapLongitude(longitude + longitudeDelta),geoHashPrecision);
  GeoHash geoHashS=new GeoHash(latitudeSouth,longitude,geoHashPrecision);
  GeoHash geoHashSW=new GeoHash(latitudeSouth,GeoUtils.wrapLongitude(longitude - longitudeDelta),geoHashPrecision);
  GeoHash geoHashSE=new GeoHash(latitudeSouth,GeoUtils.wrapLongitude(longitude + longitudeDelta),geoHashPrecision);
  queries.add(queryForGeoHash(geoHash,queryBits));
  queries.add(queryForGeoHash(geoHashE,queryBits));
  queries.add(queryForGeoHash(geoHashW,queryBits));
  queries.add(queryForGeoHash(geoHashN,queryBits));
  queries.add(queryForGeoHash(geoHashNE,queryBits));
  queries.add(queryForGeoHash(geoHashNW,queryBits));
  queries.add(queryForGeoHash(geoHashS,queryBits));
  queries.add(queryForGeoHash(geoHashSE,queryBits));
  queries.add(queryForGeoHash(geoHashSW,queryBits));
  boolean didJoin;
  do {
    GeoHashQuery query1=null;
    GeoHashQuery query2=null;
    for (    GeoHashQuery query : queries) {
      for (      GeoHashQuery other : queries) {
        if (query != other && query.canJoinWith(other)) {
          query1=query;
          query2=other;
          break;
        }
      }
    }
    if (query1 != null && query2 != null) {
      queries.remove(query1);
      queries.remove(query2);
      queries.add(query1.joinWith(query2));
      didJoin=true;
    }
 else {
      didJoin=false;
    }
  }
 while (didJoin);
  return queries;
}

Fixed version (ground truth):
public static Set<GeoHashQuery> queriesAtLocation(GeoLocation location,double radius){
  int queryBits=Math.max(1,Utils.bitsForBoundingBox(location,radius));
  int geoHashPrecision=(int)(Math.ceil(((float)queryBits) / Base32Utils.BITS_PER_BASE32_CHAR));
  double latitude=location.latitude;
  double longitude=location.longitude;
  double latitudeDegrees=radius / Constants.METERS_PER_DEGREE_LATITUDE;
  double latitudeNorth=Math.min(90,latitude + latitudeDegrees);
  double latitudeSouth=Math.max(-90,latitude - latitudeDegrees);
  double longitudeDeltaNorth=GeoUtils.distanceToLongitudeDegrees(radius,latitudeNorth);
  double longitudeDeltaSouth=GeoUtils.distanceToLongitudeDegrees(radius,latitudeSouth);
  double longitudeDelta=Math.max(longitudeDeltaNorth,longitudeDeltaSouth);
  Set<GeoHashQuery> queries=new HashSet<GeoHashQuery>();
  GeoHash geoHash=new GeoHash(latitude,longitude,geoHashPrecision);
  GeoHash geoHashW=new GeoHash(latitude,GeoUtils.wrapLongitude(longitude - longitudeDelta),geoHashPrecision);
  GeoHash geoHashE=new GeoHash(latitude,GeoUtils.wrapLongitude(longitude + longitudeDelta),geoHashPrecision);
  GeoHash geoHashN=new GeoHash(latitudeNorth,longitude,geoHashPrecision);
  GeoHash geoHashNW=new GeoHash(latitudeNorth,GeoUtils.wrapLongitude(longitude - longitudeDelta),geoHashPrecision);
  GeoHash geoHashNE=new GeoHash(latitudeNorth,GeoUtils.wrapLongitude(longitude + longitudeDelta),geoHashPrecision);
  GeoHash geoHashS=new GeoHash(latitudeSouth,longitude,geoHashPrecision);
  GeoHash geoHashSW=new GeoHash(latitudeSouth,GeoUtils.wrapLongitude(longitude - longitudeDelta),geoHashPrecision);
  GeoHash geoHashSE=new GeoHash(latitudeSouth,GeoUtils.wrapLongitude(longitude + longitudeDelta),geoHashPrecision);
  queries.add(queryForGeoHash(geoHash,queryBits));
  queries.add(queryForGeoHash(geoHashE,queryBits));
  queries.add(queryForGeoHash(geoHashW,queryBits));
  queries.add(queryForGeoHash(geoHashN,queryBits));
  queries.add(queryForGeoHash(geoHashNE,queryBits));
  queries.add(queryForGeoHash(geoHashNW,queryBits));
  queries.add(queryForGeoHash(geoHashS,queryBits));
  queries.add(queryForGeoHash(geoHashSE,queryBits));
  queries.add(queryForGeoHash(geoHashSW,queryBits));
  boolean didJoin;
  do {
    GeoHashQuery query1=null;
    GeoHashQuery query2=null;
    for (    GeoHashQuery query : queries) {
      for (      GeoHashQuery other : queries) {
        if (query != other && query.canJoinWith(other)) {
          query1=query;
          query2=other;
          break;
        }
      }
    }
    if (query1 != null && query2 != null) {
      queries.remove(query1);
      queries.remove(query2);
      queries.add(query1.joinWith(query2));
      didJoin=true;
    }
 else {
      didJoin=false;
    }
  }
 while (didJoin);
  return queries;
}