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 qualification.q2;

import qualification.common.InputReader;
import qualification.common.OutputWriter;
import qualification.q1.Q1Solver;

/**
 * Created by IntelliJ IDEA.
 * User: ofer
 * Date: 14/04/12
 * Time: 18:55
 * To change this template use File | Settings | File Templates.
 */
public class Q2Sim {

    public static void main(String[] args){
        String inputFile = "input.txt";
        String outPutFile = "output.txt";
        String[] lines = InputReader.getInputLines(inputFile);
        Q2Solver solver = new Q2Solver();
        int numOfTests = Integer.parseInt(lines[0]);
        String[] output = new String[numOfTests];
        for (int i = 0 ; i < numOfTests ; i++){
            String[] splited = lines[i+1].split(" ");
            int n = Integer.parseInt(splited[0]);
            int s =  Integer.parseInt(splited[1]);
            int p = Integer.parseInt(splited[2]);
            int[] sums = new int[n];
            for (int j = 0 ; j < n ; j++){
                int sum = Integer.parseInt(splited[j+3]);
                sums[j] = sum;
            }
            int res = solver.solve(n,s,p,sums);
            output[i] = "Case #" + (i+1) + ": " + res;
        }
        OutputWriter.writeOutput(outPutFile, output);
    }
}
