Program: 101079
Project: 101079
Buggy source:
private void build(Node node,int nodeIndex){
  char[] letters=node.getLetters();
  if (letters != null) {
    for (int i=1; i < letters.length; i++) {
      char c=letters[i];
      int cid=getCharId(c);
      int empty=findFirstEmptyCheck();
      setCheck(empty,nodeIndex);
      base[nodeIndex]=empty - cid;
      nodeIndex=empty;
    }
    if (node.isTerminated()) {
      term.set(nodeIndex);
    }
  }
  Node[] children=node.getChildren();
  if (children == null || children.length == 0)   return;
  int[] heads=new int[children.length];
  int maxHead=0;
  for (int i=0; i < children.length; i++) {
    heads[i]=getCharId(children[i].getLetters()[0]);
    maxHead=Math.max(maxHead,heads[i]);
  }
  int empty=findFirstEmptyCheck();
  int offset=empty - heads[0];
  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 - heads[0];
  }
  base[nodeIndex]=offset;
  for (  int cid : heads) {
    setCheck(offset + cid,nodeIndex);
  }
  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);
    }
  }
}

Fixed version (ground truth):
private void build(Node node,int nodeIndex){
  char[] letters=node.getLetters();
  if (letters != null) {
    for (int i=1; i < letters.length; i++) {
      char c=letters[i];
      int cid=getCharId(c);
      int empty=findFirstEmptyCheck();
      setCheck(empty,nodeIndex);
      base[nodeIndex]=empty - cid;
      nodeIndex=empty;
    }
    if (node.isTerminated()) {
      term.set(nodeIndex);
    }
  }
  Node[] children=node.getChildren();
  if (children == null || children.length == 0)   return;
  int[] heads=new int[children.length];
  int maxHead=0;
  for (int i=0; i < children.length; i++) {
    heads[i]=getCharId(children[i].getLetters()[0]);
    maxHead=Math.max(maxHead,heads[i]);
  }
  int empty=findFirstEmptyCheck();
  int offset=empty - heads[0];
  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 - heads[0];
  }
  base[nodeIndex]=offset;
  for (  int cid : heads) {
    setCheck(offset + cid,nodeIndex);
  }
  for (int i=0; i < children.length; i++) {
    build(children[i],offset + heads[i]);
  }
}