/**
 * 
 */
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.util.ArrayList;
import java.util.List;

public class ProblemSample implements Problem {

    private int solution;

    private int googlers;

    private int surprises;

    private int note;

    private List<Integer> sums = new ArrayList<Integer>();

    @Override
    public void solve() {

        int resultat = 0;

        for (int i = 0; i < sums.size(); i++) {

            if (note == 0) {
                // Ils ont tous eu au moins 0...
                resultat = this.googlers;
            } else if (note == 1) {
                // Tous ceux qui ont eu au moins 1 ont eu au moins la note de 1.
                if (sums.get(i) >= 1) {
                    resultat++;
                }
            } else {
                if ((sums.get(i) == 3 * note - 4 || sums.get(i) == 3 * note - 3) && sums.get(i) > note) {
                    // S'ils sont tout juste, ils ont utilisÃ© une surprise.
                    surprises--;
                    // Et on les compte que si il restait des surprises Ã  consommer
                    if (surprises >= 0) {
                        resultat++;
                    }
                }
                if (sums.get(i) >= 3 * note - 2 && sums.get(i) > note) {
                    // Ok sans surprise.
                    resultat++;
                }
            }
        }
        this.setSolution(resultat);
    }

    @Override
    public void print() {
        System.out.println(googlers + " " + surprises + " " + note + " " + sums.toString());
    }

    @Override
    public Object getSolution() {
        return solution;
    }

    public void setSolution(int solution) {
        this.solution = solution;
    }

    public int getGooglers() {
        return googlers;
    }

    public int getSurprises() {
        return surprises;
    }

    public int getNote() {
        return note;
    }

    public List<Integer> getSums() {
        return sums;
    }

    public void setGooglers(int googlers) {
        this.googlers = googlers;
    }

    public void setSurprises(int surprises) {
        this.surprises = surprises;
    }

    public void setNote(int note) {
        this.note = note;
    }

    public void setSums(List<Integer> sums) {
        this.sums = sums;
    }

}