package util.graph;

import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Set;

public class DynDjikstra {
    public static State FindShortest(Node start, Node target) {
        PriorityQueue<Node> openSet = new PriorityQueue<>();
        Set<Node> closedSet = new HashSet<>();
        openSet.add(start);
        while (!openSet.isEmpty()) {
            Node current = openSet.poll();
            for (Edge edge : current.edges) {
                Node end = edge.target;
                if (closedSet.contains(end)) {
                    continue;
                }
                State newState = edge.travel(current.last);
                //if (end.equals(target)) {
                    //return newState;
                //}
                if (openSet.contains(end)) {
                    if (end.last.compareTo(newState)>0) {
                        end.last = newState;
                    }
                } else {
                    openSet.add(end);
                    end.last = newState;
                }
            }
            closedSet.add(current);
            if (closedSet.contains(target)) {
                return target.last;
            }
        }

        return target.last;
    }
}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package codejam;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 *
 * @author VISHAL
 */
public class Googlers {
    public static void main(String args[]) throws IOException{
        Scanner in=new Scanner(new File("H:\\in.txt"));
        FileWriter fout=new FileWriter("H:\\out.txt");
        PrintWriter outfile=new PrintWriter(fout);
//        Scanner in=new Scanner(System.in);
        int t;
        t=in.nextInt();
        for(int i=0;i<t;i++){
            int n,p,s;
            n=in.nextInt();
            s=in.nextInt();
            p=in.nextInt();
            int count=0;
            for(int j=0;j<n;j++){
                int s1;
                s1=in.nextInt();
                if(s1<p)
                    continue;
               if(s1>=3*p-2)
                   count++;
               else if(s!=0 && s1>=3*p-4)
               {
                   s--;
                   count++;
               }
            }
           outfile.println("Case #"+(i+1)+": "+count);
        }
  outfile.close();
    }

}
