package com.gcj.parser;

public class MaxPoints {

	public static int normal(int value){
		int toReturn = 0;
		switch (value) {
		case 0 : toReturn = 0 ; break;
		case 1 : toReturn = 1 ; break;
		case 2 : toReturn = 1 ; break;
		case 3 : toReturn = 1 ; break;
		case 4 : toReturn = 2 ; break;
		case 5 : toReturn = 2 ; break;
		case 6 : toReturn = 2 ; break;
		case 7 : toReturn = 3 ; break;
		case 8 : toReturn = 3 ; break;
		case 9 : toReturn = 3 ; break;
		case 10 : toReturn = 4 ; break;
		case 11 : toReturn = 4 ; break;
		case 12 : toReturn = 4 ; break;
		case 13 : toReturn = 5 ; break;
		case 14 : toReturn = 5 ; break;
		case 15 : toReturn = 5 ; break;
		case 16 : toReturn = 6 ; break;
		case 17 : toReturn = 6 ; break;
		case 18 : toReturn = 6 ; break;
		case 19 : toReturn = 7 ; break;
		case 20 : toReturn = 7 ; break;
		case 21 : toReturn = 7 ; break;
		case 22 : toReturn = 8 ; break;
		case 23 : toReturn = 8 ; break;
		case 24 : toReturn = 8 ; break;
		case 25 : toReturn = 9 ; break;
		case 26 : toReturn = 9 ; break;
		case 27 : toReturn = 9 ; break;
		case 28 : toReturn = 10 ; break;
		case 29 : toReturn = 10 ; break;
		case 30 : toReturn = 10 ; break;

		}

		return toReturn;
	}

	public static int surprising(int value){
		int toReturn = 0;
		switch (value) {
		case 0 : toReturn = 0 ; break;
		case 1 : toReturn = 1 ; break;
		case 2 : toReturn = 2 ; break;
		case 3 : toReturn = 2 ; break;
		case 4 : toReturn = 2 ; break;
		case 5 : toReturn = 3 ; break;
		case 6 : toReturn = 3 ; break;
		case 7 : toReturn = 3 ; break;
		case 8 : toReturn = 4 ; break;
		case 9 : toReturn = 4 ; break;
		case 10 : toReturn = 4 ; break;
		case 11 : toReturn = 5 ; break;
		case 12 : toReturn = 5 ; break;
		case 13 : toReturn = 5 ; break;
		case 14 : toReturn = 6 ; break;
		case 15 : toReturn = 6 ; break;
		case 16 : toReturn = 6 ; break;
		case 17 : toReturn = 7 ; break;
		case 18 : toReturn = 7 ; break;
		case 19 : toReturn = 7 ; break;
		case 20 : toReturn = 8 ; break;
		case 21 : toReturn = 8 ; break;
		case 22 : toReturn = 8 ; break;
		case 23 : toReturn = 9 ; break;
		case 24 : toReturn = 9 ; break;
		case 25 : toReturn = 9 ; break;
		case 26 : toReturn = 10 ; break;
		case 27 : toReturn = 10 ; break;
		case 28 : toReturn = 10 ; break;
		case 29 : toReturn = 10 ; break;
		case 30 : toReturn = 10 ; break;

		}
		return toReturn;
	}

}

package com.keysbuy.codejam12.GDance;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.StringTokenizer;

public class GDance {
	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		try{
	          File rFile = new File("E:/GDance/B-large.in");
	          File wFile = new File("E:/GDance/B-large.out"); 
	          BufferedReader br = new BufferedReader(new FileReader(rFile));
	          BufferedWriter bw = new BufferedWriter(new FileWriter(wFile,true));
	          
	          int caseNum = 1;
	          String str = br.readLine();
	          str = br.readLine();
	          
	          while(str != null) {
	        	  StringTokenizer tokenizer = new StringTokenizer(str);
	        	  int numGoogler = Integer.parseInt(tokenizer.nextToken());
	        	  int numSuper = Integer.parseInt(tokenizer.nextToken());
	        	  int maxPoint = Integer.parseInt(tokenizer.nextToken());
	        	  
	        	  int highBound = 3 * maxPoint - 2;
	        	  if(highBound < maxPoint) {
	        		  highBound = maxPoint; 
	        	  }
	        	  int lowBound = 3 * maxPoint - 4;
	        	  if(lowBound < maxPoint) {
	        		  lowBound = maxPoint;
	        	  }
	        	  
	        	  int validDancer = 0;
	        	  
	        	  while(tokenizer.hasMoreTokens()) {
	        		  int points = Integer.parseInt(tokenizer.nextToken());
	        		  if(points >= highBound) {
	        			  validDancer++;
	        		  }
	        		  else if(numSuper !=0 && points >= lowBound) {
	        			  validDancer++;
	        			  numSuper--;
	        		  }
	        		  
	        	  }
	              bw.append("Case #" + caseNum + ": " + validDancer);
	              bw.newLine();
	              bw.flush();
	              str = br.readLine();
	              caseNum++;
	          }
	          bw.close();
	          br.close();
	          System.out.println("DONE!");
	        }catch(Exception e){
	            System.out.println(e.getMessage());
	        }
		
	}
}
