Program: 101050
Project: 101050
Buggy source:
private void build(Node node,int nodeIndex,TailBuilder tb){
  char[] letters=node.getLetters();
  if (letters != null) {
    if (letters.length > 1) {
      int tailIndex=tb.insert(letters,1,letters.length - 1);
      tail[nodeIndex]=tailIndex;
    }
    if (node.isTerminate()) {
      term.set(nodeIndex);
    }
  }
  Node[] children=node.getChildren();
  if (children == null || children.length == 0)   return;
  int[] heads=new int[children.length];
  int maxHead=0;
  int minHead=Integer.MAX_VALUE;
  for (int i=0; i < children.length; i++) {
    heads[i]=getCharId(children[i].getLetters()[0]);
    maxHead=Math.max(maxHead,heads[i]);
    minHead=Math.min(minHead,heads[i]);
  }
  int empty=findFirstEmptyCheck();
  int offset=empty - minHead;
  while (true) {
    if (check.length <= (offset + maxHead)) {
      extend(offset + maxHead);
    }
    boolean found=true;
    for (    int cid : heads) {
      if (check[offset + cid] >= 0) {
        found=false;
        break;
      }
    }
    if (found)     break;
    empty=findNextEmptyCheck(empty);
    offset=empty - minHead;
  }
  base[nodeIndex]=offset;
  for (  int cid : heads) {
    if (cid > Short.MAX_VALUE) {
      throw new RuntimeException("String_Node_Str");
    }
    setCheck(offset + cid,(short)cid);
  }
  Map<Integer,List<Pair<Node,Integer>>> nodes=new TreeMap<Integer,List<Pair<Node,Integer>>>(new Comparator<Integer>(){
    @Override public int compare(    Integer arg0,    Integer arg1){
      return arg1 - arg0;
    }
  }
);
  for (int i=0; i < children.length; i++) {
    Node[] c=children[i].getChildren();
    int n=0;
    if (c != null) {
      n=c.length;
    }
    List<Pair<Node,Integer>> p=nodes.get(n);
    if (p == null) {
      p=new ArrayList<Pair<Node,Integer>>();
      nodes.put(n,p);
    }
    p.add(Pair.create(children[i],heads[i]));
  }
  for (  Map.Entry<Integer,List<Pair<Node,Integer>>> e : nodes.entrySet()) {
    for (    Pair<Node,Integer> e2 : e.getValue()) {
      build(e2.getFirst(),e2.getSecond() + offset,tb);
    }
  }
}

Fixed version (ground truth):
private void build(Node node,int nodeIndex,TailBuilder tb){
  char[] letters=node.getLetters();
  if (letters != null) {
    if (letters.length > 1) {
      int tailIndex=tb.insert(letters,1,letters.length - 1);
      tail[nodeIndex]=tailIndex;
    }
    if (node.isTerminate()) {
      term.set(nodeIndex);
    }
  }
  Node[] children=node.getChildren();
  if (children == null || children.length == 0)   return;
  int[] heads=new int[children.length];
  int maxHead=0;
  int minHead=Integer.MAX_VALUE;
  for (int i=0; i < children.length; i++) {
    heads[i]=getCharId(children[i].getLetters()[0]);
    maxHead=Math.max(maxHead,heads[i]);
    minHead=Math.min(minHead,heads[i]);
  }
  int empty=findFirstEmptyCheck();
  int offset=empty - minHead;
  while (true) {
    if (check.length <= (offset + maxHead)) {
      extend(offset + maxHead);
    }
    boolean found=true;
    for (    int cid : heads) {
      if (check[offset + cid] >= 0) {
        found=false;
        break;
      }
    }
    if (found)     break;
    empty=findNextEmptyCheck(empty);
    offset=empty - minHead;
  }
  base[nodeIndex]=offset;
  for (  int cid : heads) {
    if (cid > Short.MAX_VALUE) {
      throw new RuntimeException("String_Node_Str");
    }
    setCheck(offset + cid,(short)(nodeIndex - (offset + cid)));
  }
  Map<Integer,List<Pair<Node,Integer>>> nodes=new TreeMap<Integer,List<Pair<Node,Integer>>>(new Comparator<Integer>(){
    @Override public int compare(    Integer arg0,    Integer arg1){
      return arg1 - arg0;
    }
  }
);
  for (int i=0; i < children.length; i++) {
    Node[] c=children[i].getChildren();
    int n=0;
    if (c != null) {
      n=c.length;
    }
    List<Pair<Node,Integer>> p=nodes.get(n);
    if (p == null) {
      p=new ArrayList<Pair<Node,Integer>>();
      nodes.put(n,p);
    }
    p.add(Pair.create(children[i],heads[i]));
  }
  for (  Map.Entry<Integer,List<Pair<Node,Integer>>> e : nodes.entrySet()) {
    for (    Pair<Node,Integer> e2 : e.getValue()) {
      build(e2.getFirst(),e2.getSecond() + offset,tb);
    }
  }
}