import java.util.Scanner;
import java.io.*;
class dance
{
  public static void main (String[] args) throws IOException
  { 
    File    inputData = new File("B-small-attempt0.in");
	File 	outputData= new File("Boutput.txt");
    Scanner scan = new Scanner( inputData );
	PrintStream print= new PrintStream(outputData);
    
	int t;
	int n,s,p,pi;
	t= scan.nextInt();
	for(int i=1;i<=t;i++)
	{
	n=scan.nextInt();	s=scan.nextInt();	p=scan.nextInt();
	int supTrip=0, notsupTrip=0;
	
	for(int j=0;j<n;j++)
	{
		pi=scan.nextInt();
		if(pi>(3*p-3))
		notsupTrip++;
		else if((pi>=(3*p-4))&&(pi<=(3*p-3))&&(pi>p))
		supTrip++;
	}
	
	if(s<=supTrip)
	notsupTrip=notsupTrip+s;
	else if(s>supTrip)
	notsupTrip= notsupTrip+supTrip;
	print.println("Case #"+i+": "+notsupTrip);
	}
  }
}
package Problem2;


	import java.io.BufferedReader;
	import java.io.BufferedWriter;
	import java.io.FileInputStream;
	import java.io.FileWriter;
	import java.io.InputStream;
	import java.io.InputStreamReader;
	import java.io.PrintWriter;
	import java.util.ArrayList;



		class FileReader{
				
			public static ArrayList<String> Parsefile(String filename){
				String chaine="";
				String fichier =filename; 

				try{
					InputStream ips=new FileInputStream(fichier); 
					InputStreamReader ipsr=new InputStreamReader(ips);
					BufferedReader br=new BufferedReader(ipsr);
					String ligne;
					int j=0;
					ArrayList<String> ArS_lines = new ArrayList<String>();
					
					while ((ligne=br.readLine())!=null){
						System.out.println(ligne);
						if (j>=1)
						ArS_lines.add(ligne);
						j++;
					}		
					br.close(); 
					
					return ArS_lines;
					
				}		
				catch (Exception e){
					return null;
				}
				
			}
			
			public static void writeconfig(String destinationfilename , ArrayList<String> ArS) {
				try {
					
					FileWriter fw = new FileWriter (destinationfilename);
					BufferedWriter bw = new BufferedWriter (fw);
					PrintWriter fichierSortie = new PrintWriter (bw); 
					int i;
					int n = ArS.size();
					
					for (i=0;i<n;i++){	
					fichierSortie.println("Case #"+(i+1)+":" + " "+ ArS.get(i)); 
					}
					
					fichierSortie.close();
					
				}
				
				catch (Exception e){
					System.out.println(e.toString());

				}	
			}
			
			public static void writeconfig(String destinationfilename , int[] ArS) {
				try {
					
					FileWriter fw = new FileWriter (destinationfilename);
					BufferedWriter bw = new BufferedWriter (fw);
					PrintWriter fichierSortie = new PrintWriter (bw); 
					int i;
					int n = ArS.length;
					
					for (i=0;i<n;i++){	
					fichierSortie.println("Case #"+(i+1)+":" + " "+ ArS[i]); 
					}
					
					fichierSortie.close();
					
				}
				
				catch (Exception e){
					System.out.println(e.toString());

				}	
			}
			

		}

