Program: 157627
Project: 157627
Buggy source:
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getSourceId());
  ChooseFriendsAndFoes choice=new ChooseFriendsAndFoes();
  if (!choice.chooseFriendOrFoe(controller,source,game)) {
    return false;
  }
  Map<UUID,Card> getBackMap=new HashMap<>();
  for (  Player player : choice.getFriends()) {
    if (player == null) {
      continue;
    }
    FilterCard filter=new FilterCard("String_Node_Str");
    filter.add(new OwnerIdPredicate(player.getId()));
    TargetCardInGraveyard target=new TargetCardInGraveyard(filter);
    getBackMap.put(player.getId(),null);
    if (player.choose(Outcome.ReturnToHand,target,source.getSourceId(),game)) {
      getBackMap.put(player.getId(),game.getCard(target.getFirstTarget()));
    }
  }
  for (  Player player : choice.getFriends()) {
    if (player == null) {
      continue;
    }
    Card card=getBackMap.getOrDefault(player.getId(),null);
    if (card == null) {
      continue;
    }
    player.moveCards(card,Zone.HAND,source,game);
  }
  List<UUID> perms=new ArrayList<>();
  for (  Player player : choice.getFoes()) {
    if (player == null) {
      continue;
    }
    TargetControlledPermanent target=new TargetControlledPermanent(1,1,StaticFilters.FILTER_CONTROLLED_A_CREATURE,true);
    player.choose(Outcome.Sacrifice,target,source.getSourceId(),game);
    perms.addAll(target.getTargets());
  }
  for (  UUID permID : perms) {
    Permanent permanent=game.getPermanent(permID);
    if (permanent != null) {
      permanent.sacrifice(source.getSourceId(),game);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean apply(Game game,Ability source){
  Player controller=game.getPlayer(source.getControllerId());
  ChooseFriendsAndFoes choice=new ChooseFriendsAndFoes();
  if (!choice.chooseFriendOrFoe(controller,source,game)) {
    return false;
  }
  Map<UUID,Card> getBackMap=new HashMap<>();
  for (  Player player : choice.getFriends()) {
    if (player == null) {
      continue;
    }
    FilterCard filter=new FilterCard("String_Node_Str");
    filter.add(new OwnerIdPredicate(player.getId()));
    TargetCardInGraveyard target=new TargetCardInGraveyard(filter);
    getBackMap.put(player.getId(),null);
    if (player.choose(Outcome.ReturnToHand,target,source.getSourceId(),game)) {
      getBackMap.put(player.getId(),game.getCard(target.getFirstTarget()));
    }
  }
  for (  Player player : choice.getFriends()) {
    if (player == null) {
      continue;
    }
    Card card=getBackMap.getOrDefault(player.getId(),null);
    if (card == null) {
      continue;
    }
    player.moveCards(card,Zone.HAND,source,game);
  }
  List<UUID> perms=new ArrayList<>();
  for (  Player player : choice.getFoes()) {
    if (player == null) {
      continue;
    }
    TargetControlledPermanent target=new TargetControlledPermanent(1,1,StaticFilters.FILTER_CONTROLLED_A_CREATURE,true);
    player.choose(Outcome.Sacrifice,target,source.getSourceId(),game);
    perms.addAll(target.getTargets());
  }
  for (  UUID permID : perms) {
    Permanent permanent=game.getPermanent(permID);
    if (permanent != null) {
      permanent.sacrifice(source.getSourceId(),game);
    }
  }
  return true;
}