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

import Parser.MyReader;
import Parser.MyWriter;

public class Main {

	public static void main(String[] args) {
		MyReader myReader = new MyReader(
				"/Users/shami13/Downloads/B-small-attempt0.in");
		MyWriter myWriter = new MyWriter(
				"/Users/shami13/Downloads/B-small-attempt0.out");

		int taskLength = Integer.parseInt(myReader.read());
		for (int i = 1; i <= taskLength; i++) {
			String[] taskString = myReader.read().split(" ");
			int T = Integer.parseInt(taskString[0]);
			int S = Integer.parseInt(taskString[1]);
			int P = Integer.parseInt(taskString[2]);
			int[] googlers = new int[T];
			for(int p = 3; p < taskString.length; p++){
				googlers[p-3] = Integer.parseInt(taskString[p]);
			}
			
			Task task = new Task(T,S,P,googlers);
			String result = task.execute();
			myWriter.writeString("Case #" + i + ": " + result);
			System.out.println("Case #" + i + ": " + result);
		}
		myWriter.close();
	}
}
