/**
 * 
 */
package pandit.codejam;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;

/**
 * @author Manu Ram Pandit
 * 
 */
public class DancingWithGooglersUpload {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		FileInputStream fStream = new FileInputStream(
				"input.txt");

		Scanner scanner = new Scanner(new BufferedInputStream(fStream));
		Writer out = new OutputStreamWriter(new FileOutputStream("output.txt"));

		int T = scanner.nextInt();
		int N,S,P,ti;
		int counter = 0;
		for (int count = 1; count <= T; count++) {
			N=scanner.nextInt();
			S = scanner.nextInt();
			counter = 0;
			P = scanner.nextInt();
			for(int i=1;i<=N;i++){
				ti=scanner.nextInt();
				if(ti>=(3*P-2)){
					counter++;
					continue;
				}
				else if(S>0){
					if(P>=2 && ((ti==(3*P-3)) ||(ti==(3*P-4)))) {
					S--;
					counter++;
					continue;
					}
				}
				
			}
			// System.out.println("Case #" + count + ": " + counter);
			out.write("Case #" + count + ": " + counter + "\n");
		}
		fStream.close();
		out.close();

	}

}

import java.io.*;
public class googleJam2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		BufferedReader reader = null;
		PrintWriter writer = null;
		try{
			reader = new BufferedReader(new FileReader("B-small-attempt1.in"));
			int numInputs = Integer.parseInt(reader.readLine());
			writer = new PrintWriter(new BufferedWriter(new FileWriter("B-small-attempt1.out")));
			for(int i = 0; i < numInputs; i++)
			{
				System.out.println(i);
				String temp = reader.readLine();
				System.out.println(temp);
				int index = temp.indexOf(" ");
				int numGooglers = Integer.parseInt(temp.substring(0, index));
				temp = temp.substring(index+1);
				index = temp.indexOf(" ");
				System.out.println(temp);
				int numSurprising = Integer.parseInt(temp.substring(0,index));
				temp = temp.substring(index+1);
				index = temp.indexOf(" ");
				int p = Integer.parseInt(temp.substring(0,index));
				temp = temp.substring(index+1);
				int withoutSurprise = 0;
				int withSurprise = 0;
				for(int k = 0; k < numGooglers-1; k++)
				{
					index = temp.indexOf(" ");
					int totalScore = Integer.parseInt(temp.substring(0, index));
					temp = temp.substring(index+1);
					if(totalScore >= 3*p -2)
						withoutSurprise++;
					else if(totalScore >= 3*p-4 && totalScore >= p)
						withSurprise++;
				}
				int totalScore = Integer.parseInt(temp);
				if(totalScore >= 3*p -2)
					withoutSurprise++;
				else if(totalScore >= 3*p-4 &&totalScore >= p)
					withSurprise++;
				int numWinners;
				if(withSurprise >= numSurprising)
					numWinners = numSurprising + withoutSurprise;
				else
					numWinners = withSurprise + withoutSurprise;
				writer.print("Case #" + (i+1) + ": " + numWinners + "\n");
				
				
			}
			writer.close();
		}
		catch(Exception e)
		{
			throw(e);
		}
	}

}
