Language: Java


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main2 {

	public static void main(String[] args) throws IOException {

		// ????????????????????°???????????????
		// ???
		int[] seat = new int[17];
		// ????????????
		List<Integer> waitGuest = new ArrayList<Integer>();

		// ?¨??????\???
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input = null;

		// ??\???????????????????????????????????§????????????
		while (true) {
			input = br.readLine();
			if (input == null || input.isEmpty()) {
				break;
			}
			// int??????????????????
			int inputNum = Integer.parseInt(input);

			// ????????????????????°???????????????
			// ??????
			int time = 0;

			// ?????????
			while (true) {
				// ?£????????????£?????¢????????????????????????
				exitFukushimaken(seat, time);

				// ??¢????????????????????????????????????????????????
				if (time % 5 == 0) {
					waitGuest.add(time / 5);
				}

				// ?????????????????¢?????????????????????
				if (isWaitGuest(waitGuest)) {
					// ??\?????¢????????°????????????
					int guest = guestOfNumber(waitGuest.get(0));
					// ?????????????????????????????????
					int seatNum = confirmEmptySeat(seat, guest);

					if (seatNum != 99) {
						enterFukushimaken(waitGuest.get(0), guest, seatNum, seat, time);
						// ??\??????????????°??????????????´?????????????????????????????????
						if (inputNum == waitGuest.get(0)) {
							System.out.println(time - waitGuest.get(0) * 5);
							break;
						}
						waitGuest.remove(0);
					}
				}
				++time;
			}
		}
	}

	// ????????????????????????????????????

	//
	private static boolean isWaitGuest(List<Integer> waitGuest){

		if (waitGuest.size() != 0) {
			return true;
		}
		return false;
	}

	// i???????????°?????????????????°?????????
	private static int guestOfNumber(int number) {
		if (number % 5 == 1) {
			return 5;
		} else {
			return 2;
		}
	}

	// ??§??????????????????????????????
	// i = ??§????????´????????????????????????99?????§?????????
	private static int confirmEmptySeat(int[] seat, int guest) {
		int count = 0;
		for (int i = 0; i < seat.length - guest; ++i) {
			for (int j = 0; j < guest; ++j) {
				if (seat[i + j] != 0) {
					break;
				} else {
					++count;
					if (guest == count) {
						return i;
					}
				}
			}
		}
		return 99;
	}

	// ????????????
	private static void enterFukushimaken(int groupNum, int guest, int seatNum,
			int[] seat, int time) {
		int ateTime = time + ateFoodTime(groupNum);
		for (int i = 0; i < guest; ++i) {
			seat[seatNum + i] = ateTime;
		}
	}

	// ?£????????????£?????¢?????????????¢??????????
	private static void exitFukushimaken(int[] seat, int time) {
		for (int i = 0; i < seat.length; ++i) {
			if (time == seat[i]) {
				seat[i] = 0;
			}
		}
	}

	// i???????????°?????????????£?????????????
	private static int ateFoodTime(int number) {
		int a = (number % 2) * 17;
		int b = (number % 3) * 3;
		return a + b + 19;
	}

}

Compiler output:
Main.java:8: error: class Main2 is public, should be declared in a file named Main2.java
public class Main2 {
       ^
1 error