import java.util.*;

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T = sc.nextInt();
        B th = new B();
        for (int i = 0; i < T; i++) {
            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();
            int[] t = new int[n];
            for (int j = 0; j < n; j++) {
                t[j] = sc.nextInt();
            }
            int c = th.getAnswer(s,p,t);
            System.out.println("Case #" + (i+1) + ": " + c);
        }
    }
    public int getAnswer(int s, int p, int[] t) {
        int A1 = p + p-1+p-1;
        int A2 = p + p-2+p-2;
        if (A1 < 0)
            A1 = 0;
        if (A2 < 0)
            A2 = 1;
        int remain = s;
        int count = 0;
        int n = t.length;
        for (int i = 0; i < n; i++) {
            if (t[i] >= A1) {
                count++;
            } else if (t[i] < A1 && t[i] >= A2) {
                if (remain > 0) {
                    remain--;
                    count++;
                }
            }
        }
        return count;
    }
}


package se.round1.problem2;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import se.round1.util.JamUtil;

public class Problem2 {

	Map<Character, Character> trans = new HashMap<Character, Character>();
	
	public static void main(String[] args) throws IOException{
		new Problem2();
	}
	
	public Problem2() throws IOException{
		
		BufferedReader reader = JamUtil.getReader("problem2/B-large.in");
		
		int currCase = 0;
		String s = "";
		boolean first = true;
		BufferedWriter writer = JamUtil.getWriter("problem2/output.txt");
		while((s = reader.readLine()) != null){
			if(first){
				s = reader.readLine();
				first = false;
			}
			currCase++;
			int res = solveLine(s);
			String sol = "Case #"+currCase+": "+res+"\n";
			System.out.print(sol);
	
			writer.write(sol);
		}
		writer.close();
	}
	
	
	private int solveLine(String line){
		String[] linearr = line.split(" ");
		int dancers = Integer.parseInt(linearr[0]);
		int surprice = Integer.parseInt(linearr[1]);
		int scoreToReach = Integer.parseInt(linearr[2]);
		int success = 0;
		for(int i=0;i<dancers;++i){
			int score = Integer.parseInt(linearr[3+i]);
			int maxScore = canReachScoreWithoutSurprice(score);
			
			if(maxScore >= scoreToReach){
				success++;
			}
			else if( surprice > 0 && (maxScore+1) >= scoreToReach && score >= 2 && ( (3*maxScore) -1) <= score){
				success++;
				surprice--;
			}
		}
		
		return success;
	}
	
	private int canReachScoreWithoutSurprice(int score){
		if(score == 0)
			return 0;
		if(score == 1)
			return 1;
		if(score == 2)
			return 1;
		if(score == 3)
			return 1;
		
		int test = score / 3;
		
		while( 3*(test)+1 > score){
			test--;
		}

		if(test <=0)
			return 0;
		return test+1;
	}
	

	
}
