import java.util.Scanner;
import java.io.*;
class dance
{
  public static void main (String[] args) throws IOException
  { 
    File    inputData = new File("B-small-attempt0.in");
	File 	outputData= new File("Boutput.txt");
    Scanner scan = new Scanner( inputData );
	PrintStream print= new PrintStream(outputData);
    
	int t;
	int n,s,p,pi;
	t= scan.nextInt();
	for(int i=1;i<=t;i++)
	{
	n=scan.nextInt();	s=scan.nextInt();	p=scan.nextInt();
	int supTrip=0, notsupTrip=0;
	
	for(int j=0;j<n;j++)
	{
		pi=scan.nextInt();
		if(pi>(3*p-3))
		notsupTrip++;
		else if((pi>=(3*p-4))&&(pi<=(3*p-3))&&(pi>p))
		supTrip++;
	}
	
	if(s<=supTrip)
	notsupTrip=notsupTrip+s;
	else if(s>supTrip)
	notsupTrip= notsupTrip+supTrip;
	print.println("Case #"+i+": "+notsupTrip);
	}
  }
}
package codezam.exercise.WR1B2012;

import java.util.ArrayList;
import java.util.List;

public class TripletSet {
	List<Triplet> tripletList = new ArrayList<Triplet>();
	
	//SumÀ» ³ÖÀ¸¸é °¡´ÉÇÑ Valid Triplet Á¶ÇÕÀ» »ý¼ºÇÑ´Ù.
	public TripletSet(long numberSum) {
		double numberSumDouble = (double) numberSum;
		long minValue = (long)Math.round(numberSumDouble/3-1);
		if (minValue < 0) {
			minValue = 0;
		}
		
		if (minValue + (minValue) + (minValue) == numberSum) {
			tripletList.add(new Triplet(minValue, minValue, minValue));
		} 
		
		if (minValue + (minValue) + (minValue+1) == numberSum) {
			tripletList.add(new Triplet(minValue, minValue, minValue+1));
		} 
		
		if (minValue + (minValue) + (minValue+2) == numberSum) {
			tripletList.add(new Triplet(minValue, minValue, minValue+2));
		} 
		
		if (minValue + (minValue+1) + (minValue+1) == numberSum) {
			tripletList.add(new Triplet(minValue, minValue+1, minValue+1));
		} 

		if (minValue + (minValue+1) + (minValue+2) == numberSum) {
			tripletList.add(new Triplet(minValue, minValue+1, minValue+2));
		} 

		if (minValue + (minValue+2) + (minValue+2) == numberSum) {
			tripletList.add(new Triplet(minValue, minValue+2, minValue+2));
		} 

		if ((minValue+1) + (minValue+1) + (minValue+1) == numberSum) {
			tripletList.add(new Triplet(minValue+1, minValue+1, minValue+1));
		}
		
		if ((minValue+1) + (minValue+1) + (minValue+2) == numberSum) {
			tripletList.add(new Triplet(minValue+1, minValue+1, minValue+2));
		}
		
		if ((minValue+1) + (minValue+2) + (minValue+2) == numberSum) {
			tripletList.add(new Triplet(minValue+1, minValue+2, minValue+2));
		}
	}
	
	public boolean isSurprising(int index) {
		Triplet triplet = (Triplet)tripletList.get(index);
		boolean result = (triplet).isSurprising();
		return result;
	}
	
	public long maxValue(int index) {
		Triplet triplet = (Triplet)tripletList.get(index);
		return triplet.getNumberMax();
	}
	
	public int size() {
		return tripletList.size();
	}
	
	public static final void main(String[] args) {
		System.out.println(Math.round(1.3));
		System.out.println(Math.round(1.8));
		System.out.println(Math.round(-1.3));
		System.out.println(Math.round(-1.8));
	}
}