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 com.cuteants.problems.codejam.y2012.qualification;

import java.io.*;
import java.util.InputMismatchException;

public class DancingWithTheGooglers {

    public static void main(String[] args) throws Exception {
        InputReader sc = new StreamInputReader(new FileInputStream("C:\\Users\\aurel\\Downloads\\B-large.in"));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("C:\\Users\\aurel\\Downloads\\B_large_out.txt"), 10000), false);

        int tests = sc.nextInt();
        for (int i = 1; i <= tests; i++) {
            int n = sc.nextInt();
            int s = sc.nextInt();
            int p = sc.nextInt();

            int sum = 0;
            for (int j = 0; j < n; j++) {
                int t = sc.nextInt();
                int a = t / 3;
                switch (t % 3) {
                    case 0:
                        if (a >= p) {
                            // a + a + a
                            sum++;
                        } else if (s > 0 && a + 1 >= p && a >= 1 && a <= 9) {
                            // (a - 1) + a + (a + 1)
                            sum++;
                            s--;
                        }
                        break;
                    case 1:
                        if (a + 1 >= p) {
                            // a + a + (a + 1)
                            sum++;
                        }
                        break;
                    case 2:
                        if (a + 1 >= p) {
                            // a + (a + 1) + (a + 1)
                            sum++;
                        } else if (s > 0 && a + 2 >= p && a <= 8) {
                            // a + a + (a + 2)
                            sum++;
                            s--;
                        }
                        break;
                }
            }
            out.println("Case #" + i + ": " + sum);
        }
        out.close();
    }

    abstract static class InputReader {

        public abstract int read();

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }

    static class StreamInputReader extends InputReader {

        private InputStream stream;
        private byte[] buf = new byte[2048];
        private int curChar, numChars;

        public StreamInputReader(InputStream stream) {
            this.stream = stream;
        }

        @Override
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
    }

}
