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.renoux.gael.codejam.cj2012.qb;

import com.renoux.gael.codejam.fwk.Solver;
import com.renoux.gael.codejam.utils.ArrayUtils;
import com.renoux.gael.codejam.utils.Input;
import com.renoux.gael.codejam.utils.Output;

public class QB extends Solver {

	public static void main(String... args) throws Exception {
		new QB().run();
	}

	@Override
	protected void solveCase(Input in, Output out) {
		System.out.println();
		int[] line = ArrayUtils.parseInts(in.readLine().split(" "));
		int ctGooglers = line[0];
		int ctSurprises = line[1];
		int target = line[2];

		int ctStars = 0;

		for (int i = 3; i < line.length; i++) {
			int totalScore = line[i];

			int lowestScoreNoSurprise = Math.max(target - 1, 0);
			int lowestScoreWithSurprise = Math.max(target - 2, 0);

			int lowestTotalNoSurprise = target + 2 * lowestScoreNoSurprise;
			int lowestTotalWithSurprise = target + 2 * lowestScoreWithSurprise;

			if (lowestTotalNoSurprise <= totalScore) {
				ctStars++;
				System.out.println("Guy " + (i - 2) + " did great");
			} else if (lowestTotalWithSurprise <= totalScore && ctSurprises > 0) {
				ctStars++;
				ctSurprises--;
				System.out.println("Guy " + (i - 2) + " did ok");
			}
		}

		out.writeLine(ctStars);
	}

	@Override
	protected String getProblemName() {
		return "QB";
	}

	@Override
	protected boolean disableSmall() {
		return true;
	}

	@Override
	protected boolean disableLarge() {
		return true;
	}
}
