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 com.codejam;

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

public class CodeJam1 {
	char map[];

	public static void main(String[] args) {
		Scanner fileIn = null;
		FileWriter fileOut = null;

		try {
			fileIn = new Scanner(new File("input.txt"));
			fileOut = new FileWriter(new File("output.in"));
			int noOfTestCases = Integer.parseInt(fileIn.nextLine());

			int testCase = 0;
			while (fileIn.hasNextLine()) {
				testCase++;
				//fileIn.nextLine();
				int noOfPpl = fileIn.nextInt();
				int s = fileIn.nextInt();
				int p = fileIn.nextInt();
				int input[] = new int[noOfPpl];
				int noOfSurprise=0,count=0;
				for(int i=0;i<noOfPpl;i++){
					input[i] = fileIn.nextInt();
				}
				fileIn.nextLine();
				for(int i=0;i<noOfPpl;i++){
					if(p>input[i]){
						continue;
					}					
					int remainingSum = input[i]-p;
					int q = remainingSum/2;
					if(q>=p){
						count++;
						continue;
					}					
					if((p-q)<2){
						count++;						
					}
					else if((p-q)==2 && noOfSurprise<s){
						noOfSurprise++;
						count++;
						continue;
					}										
				}				
				fileOut.write("Case #" + testCase + ": " + count
						+ "\n");
			}
			fileIn.close();
			fileOut.close();
		} catch (IOException ex) {
			System.out.println(ex.getMessage());
		}
	}

}
