import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

public class contest_gen {

	static final Random rand = new Random(3423452384876894L);

	public static void main(String[] args) throws IOException {
		for (int test = 1; test <= 99; test++) {
			System.out.println("Generating test #"
					+ ((test < 10 ? "0" : "") + test));
			PrintWriter out = new PrintWriter((test < 10 ? "0" : "") + test);
			switch (test) {
			case 1:
				out.println("22");
				out.println("C:\\olymp\\roi2005\\aplusb\\tests\\01");
				out.println("C:\\olymp\\roi2005\\aplusb\\tests\\01.a");
				out.println("C:\\olymp\\roi2005\\aplusb\\tests\\02");
				out.println("C:\\olymp\\roi2005\\aplusb\\tests\\02.a");
				out.println("C:\\olymp\\roi2005\\aplusb\\check.exe");
				out.println("C:\\olymp\\roi2005\\gcd\\tests\\01");
				out.println("C:\\olymp\\roi2005\\gcd\\tests\\01.a");
				out.println("C:\\olymp\\roi2005\\gcd\\tests\\02");
				out.println("C:\\olymp\\roi2005\\gcd\\tests\\02.a");
				out.println("C:\\olymp\\roi2005\\gcd\\check.cpp");
				out.println("C:\\olymp\\roi2005\\gcd\\solution.exe");
				out.println("C:\\olymp\\roi2006\\aplusb\\tests\\01");
				out.println("C:\\olymp\\roi2006\\aplusb\\tests\\01.a");
				out.println("C:\\olymp\\roi2006\\aplusb\\tests\\03");
				out.println("C:\\olymp\\roi2006\\aplusb\\tests\\03.a");
				out.println("C:\\olymp\\roi2006\\aplusb\\check.exe");
				out.println("C:\\olymp\\roi2006\\gcd\\tests\\01");
				out.println("C:\\olymp\\roi2006\\gcd\\tests\\01.a");
				out.println("C:\\olymp\\roi2006\\gcd\\tests\\03");
				out.println("C:\\olymp\\roi2006\\gcd\\tests\\02.a");
				out.println("C:\\olymp\\roi2006\\gcd\\check.cpp");
				out.println("C:\\olymp\\roi2006\\gcd\\solution.exe");
				break;
			case 2:
				out.println("3");
				out.println("A:\\Contest\\Problem\\tests\\01");
				out.println("A:\\Contest\\Problem\\tests\\01.a");
				out.println("A:\\Contest\\Problem\\check.xxx");
				break;
			case 3:
				out.println("1");
				out.println("A:\\Contest\\Problem\\check.xxx");
				break;
			case 4:
				out.println("1");
				out
						.println("Z:\\"
								+ "AVeryLongFolderName\\"
								+ "WhichSurelyContainsNoTests\\"
								+ "ButItsContentStillMightHaveSomeInterest\\"
								+ "ThatIsWhyYourProgramAndYouAreReadingThisRatherLongString\\"
								+ "WithABigFileNameInTheEndOfIt\\" + "Oh\\"
								+ "HereItIs\\" + "ABigFile.aaa");
				break;
			case 5:
				out.println("1");
				out.println(process("F:\\" + generateName(200 - 5) + ".c"));
				break;
			case 6: {
				out.println("3");
				String s = generateName(200 - 3 - 2 - 6 - 4 - 1);
				out.println(process("Q:\\" + s + "\\p\\tests\\01"));
				out.println(process("Q:\\" + s + "\\p\\tests\\01.a"));
				out.println(process("Q:\\" + s + "\\p\\check.yyz"));
			}
				break;
			case 7: {
				out.println("3");
				String s = generateName(200 - 3 - 2 - 6 - 4 - 1);
				out.println(process("X:\\" + s + "\\p\\tests\\01"));
				out.println(process("Y:\\" + s + "\\p\\tests\\01.a"));
				out.println(process("Z:\\" + s + "\\p\\check.yyz"));
			}
				break;
			case 8:
			case 33:
			case 21:
			case 42:
			case 47: {
				{
					out.println("1000");
					int x = rand.nextInt(10);
					for (int i = 0; i < 1000 - 3 * x; i++) {
						StringBuilder sb = new StringBuilder();
						sb.append((char) ('A' + rand.nextInt(26)));
						sb.append(":");
						while (sb.length() + 2 < 200) {
							sb.append("\\");
							char c = '\\';
							while (c == '\\') {
								c = (char) (33 + rand.nextInt(127 - 33));
							}
							sb.append(c);
						}
						out.println(sb);
					}
					while (x-- > 0) {
						out.println((char) ('A' + x)
								+ ":\\Contest\\Problem\\tests\\01");
						out.println((char) ('A' + x)
								+ ":\\Contest\\Problem\\tests\\01.a");
						out.println((char) ('A' + x)
								+ ":\\Contest\\Problem\\check."
								+ (char) ('A' + x));
					}
				}
			}
				break;
			case 9: {
				x = 0;
				ArrayList<String> allMin = genMinWithContest("");
				out.println(allMin.size());
				for (String s : allMin) {
					out.println(process(s));
				}
			}
				break;
			case 10:
			case 48: {
				x = 0;
				ArrayList<String> rec = genRec("");
				out.println(rec.size());
				for (String s : rec) {
					out.println(process(s));
				}
			}
				break;
			case 11:
			case 12:
			case 13:
			case 14:
			case 15: {
				INode root = genContest(1000, 200 - 4);
				ArrayList<String> list = root.getAll("W:\\");
				out.println(list.size());
				for (String s : list) {
					out.println(process(s));
				}
			}
				break;
			case 16: {
				out.println("25");
				for (int i = 1; i <= 12; i++) {
					out.println(process(("A:\\ConTest\\pRobLem\\TEstS\\-"
							+ (i < 10 ? "0" : "") + i)));
					out.println(process(("A:\\ConTest\\pRobLem\\TEstS\\-"
							+ (i < 10 ? "0" : "") + i))
							+ ".a");
				}
				out.println("A:\\Contest\\Problem\\check.xxx");
			}
				break;
			case 17: {
				out.println("199");
				for (int i = 1; i <= 99; i++) {
					out.println(process(("A:\\ConTest\\pRobLem\\TEstS\\"
							+ (i < 10 ? "0" : "") + i)));
					out.println(process(("A:\\ConTest\\pRobLem\\TEstS\\"
							+ (i < 10 ? "0" : "") + i))
							+ ".a");
				}
				out.println("A:\\Contest\\Problem\\check.xxx");
			}
				break;
			case 18: {
				out.println("201");
				for (int i = 1; i <= 100; i++) {
					out.println(process(("A:\\ConTest\\pRobLem\\TEstS\\"
							+ (i < 10 ? "0" : "") + i)));
					out.println(process(("A:\\ConTest\\pRobLem\\TEstS\\"
							+ (i < 10 ? "0" : "") + i))
							+ ".a");
				}
				out.println("A:\\Contest\\Problem\\check.xxx");
			}
				break;
			case 19: {
				out.println("1000");
				int n = 1000;
				char p = 'a';
				while (n > 0) {
					out.println(process("G:\\contest\\" + p
							+ "\\check.something"));
					n--;
					for (int i = 1; i < 100; i++) {
						if (n >= 2) {
							out.println(process("G:\\contest\\" + p
									+ "\\tests\\" + ((i < 10 ? "0" : "") + i)));
							out.println(process("G:\\contest\\" + p
									+ "\\tests\\" + ((i < 10 ? "0" : "") + i)
									+ ".a"));
							n -= 2;
						}
					}
					p++;
				}
			}
				break;
			case 20: {
				out.println("1000");
				int n = 1000;
				char d = 'A';
				while (n > 0) {
					out.println(process(d
							+ ":\\contest\\problem\\check.something"));
					n--;
					for (int i = 1; i < 100; i++) {
						if (n >= 2) {
							out.println(process(d
									+ ":\\contest\\problem\\tests\\"
									+ ((i < 10 ? "0" : "") + i)));
							out.println(process(d
									+ ":\\contest\\problem\\tests\\"
									+ ((i < 10 ? "0" : "") + i) + ".a"));
							n -= 2;
						}
					}
					d++;
				}
			}
				break;
			case 23: {
				out.println("1000");
				int n = 1000;
				for (char drive = 'A'; drive <= 'Z'; drive++) {
					for (char contest = 'a'; contest <= 'z'; contest++) {
						if (n > 0) {
							out.println(process(drive + ":\\" + contest
									+ "\\contests\\check.itOut!!!"));
							n--;
						}
						if (n > 0) {
							out.println(process(drive + ":\\" + contest
									+ "\\contests\\tests\\01"));
							n--;
						}
						if (n > 0) {
							out.println(process(drive + ":\\" + contest
									+ "\\contests\\tests\\01.a"));
							n--;
						}
					}
				}
			}
				break;
			case 24:
				out.println("3");
				out.println("L:\\contest\\problem\\tsets\\01");
				out.println("L:\\contest\\problem\\tsets\\01.a");
				out.println("L:\\contest\\problem\\check.this");
				break;
			case 25:
				out.println("3");
				out.println("L:\\contest\\problem\\tests\\01");
				out.println("L:\\contest\\problem\\tests\\01.a");
				out.println("L:\\contest\\problem\\cehck.this");
				break;
			case 26:
				out.println("3");
				out.println("L:\\contest\\problem\\tests\\1");
				out.println("L:\\contest\\problem\\tests\\01.a");
				out.println("L:\\contest\\problem\\check.this");
				break;
			case 27:
				out.println("3");
				out.println("L:\\contest\\problem\\tests\\001");
				out.println("L:\\contest\\problem\\tests\\01.a");
				out.println("L:\\contest\\problem\\check.this");
				break;
			case 28:
				out.println("3");
				out.println("L:\\contest\\problem\\tests\\010");
				out.println("L:\\contest\\problem\\tests\\01.a");
				out.println("L:\\contest\\problem\\check.this");
				break;
			case 29:
				out.println("3");
				out.println("L:\\contest\\problem\\tests");
				out.println("L:\\contest\\problem\\check.this");
				out.println("L:\\contest\\problem\\check.that");
				break;
			case 30:
				out.println("3");
				out.println("L:\\contest\\problem\\tests\\01\\ha.ha");
				out.println("L:\\contest\\problem\\tests\\01.a");
				out.println("L:\\contest\\problem\\check.this");
				break;
			default:
				INode root = new INode("");
				x = 1000;
				genRand(199, root);
				ArrayList<String> list = new ArrayList<String>();
				for (INode drive : root.content.values()) {
					for (INode d : drive.content.values()) {
						list.addAll(d.getAll(drive.name + ":\\"));
					}
				}
				out.println(list.size());
				for (String s : list) {
					out.println(process(s));
				}
				break;
			}
			out.close();
		}
	}

	private static void genRand(int l, INode root) {
		if (l <= 0 || root == null) {
			return;
		}
		if (root.name.length() == 0) {
			while (x > 0) {
				char c = (char) ('A' + rand.nextInt(26));
				if (!root.content.containsKey("" + c)) {
					INode drive = new INode("" + c);
					root.content.put(drive.name, drive);
					genRand(l - 3, drive);
				}
			}
		} else {
			while (x > 0 && l >= MINCL) {
				if (x >= 3 && l >= MINCL) {
					int y = 3 + rand.nextInt(Math.min(x - 2, 1 + rand
							.nextInt(40)));
					x -= y;
					while (true) {
						INode contest = genContest(y, l);
						if (root.content.containsKey(contest.name)) {
							continue;
						}
						root.content.put(contest.name, contest);
						if (rand.nextBoolean()) {
							INode problem = contest.content.values().iterator()
									.next();
							genRand(l - contest.name.length() - 1
									- problem.name.length() - 1
									- "tests\\".length(), problem.content
									.get("tests"));
						}
						for (INode t : contest.content.values()) {
							if (t.content.containsKey("tests")
									&& rand.nextBoolean()) {
								genRand(l - 1 - contest.name.length() - 1
										- t.name.length() - 1
										- "tests".length(), t.content
										.get("tests"));
							}
							if (rand.nextInt(10) < 7) {
								for (INode d : t.content.values()) {
									if (rand.nextBoolean() && !d.isFile) {
										genRand(l - 1 - contest.name.length()
												- 1 - t.name.length() - 1
												- d.name.length(), d);
									}
								}
							}
						}
						if (7 < rand.nextInt(10)) {
							genRand(l - 1 - contest.name.length(), contest);
						}
						break;
					}
				} else if (rand.nextBoolean()) {
					if (l >= 3 && rand.nextBoolean()) {
						String name = generateName(1 + rand.nextInt(l - 2));
						String ext = generateName(l - name.length() - 1);
						String s = name + "." + ext;
						if (!root.content.containsKey(s)) {
							INode file = new INode(s);
							file.isFile = true;
							root.content.put(file.name, file);
							x--;
						}
					} else {
						String name = generateName(1 + rand.nextInt(l));
						if (!root.content.containsKey(name)) {
							INode file = new INode(name);
							file.isFile = true;
							root.content.put(file.name, file);
							x--;
						}
					}
				} else {
					String name = generateName(1 + rand.nextInt(l));
					if (!root.content.containsKey(name)) {
						INode dir = new INode(name);
						genRand(l - name.length() - 1, dir);
					}
				}
			}
		}
	}

	private static String process(String s) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			if (i == 0) {
				sb.append(s.charAt(i));
			} else {
				if (rand.nextBoolean()) {
					sb.append(Character.toLowerCase(s.charAt(i)));
				} else {
					sb.append(Character.toUpperCase(s.charAt(i)));
				}
			}
		}
		return sb.toString();
	}

	private static ArrayList<String> genRec(String s) {
		if (x + 3 > 1000) {
			return new ArrayList<String>();
		}
		ArrayList<String> ans = new ArrayList<String>();
		if (s.length() == 0) {
			for (char c = 'A'; c <= 'Z'; c++) {
				ArrayList<String> al = genRec(c + ":\\");
				ans.addAll(al);
			}
		} else if (s.length() + MINCL < 200) {
			for (char c = (char) 33; c < 127; c++) {
				if (c == '\\' || c == '.' || x + 3 > 1000) {
					continue;
				}
				char p = '\\';
				while (p == '\\' || p == '.') {
					p = (char) (33 + rand.nextInt(127 - 33));
				}
				ans.add(s + c + "\\" + p + "\\check.lkbd");
				ans.add(s + c + "\\" + p + "\\tests\\01");
				ans.add(s + c + "\\" + p + "\\tests\\01.a");
				x += 3;
				ArrayList<String> al = genRec(s + c + "\\" + p + "\\tests\\");
				ans.addAll(al);
			}
		}
		return ans;
	}

	private static ArrayList<String> genMinWithContest(String s) {
		if (x + 3 > 1000) {
			return new ArrayList<String>();
		}
		ArrayList<String> ans = new ArrayList<String>();
		if (s.length() == 0) {
			for (char c = 'A'; c <= 'Z'; c++) {
				ArrayList<String> al = genMinWithContest(c + ":\\");
				ans.addAll(al);
			}
		} else if (s.length() + 2 + MINPL < 200) {
			for (char c = 'a'; c <= 'z'; c++) {
				ArrayList<String> al = genMinWithContest(s + c + "\\");
				ans.addAll(al);
			}
		} else {
			ans.add(s + "tests\\01");
			ans.add(s + "tests\\01.a");
			ans.add(s + "check.wtf");
			x += 3;
		}
		return ans;
	}

	static int x = 0;

	static final int MINP = 3;
	static final int MINC = 3;
	static final int MINT = 2;
	static final int MINTL = 5 + 1 + 4;
	static final int MINPL = 1 + 1 + 5 + 1 + 4;
	static final int MINCL = 1 + 1 + 1 + 1 + 5 + 1 + 4;

	static INode genTests(int n) {
		INode d = new INode("tests");
		if (rand.nextInt(5) < 1) {
			d = new INode("tsets");
		}
		for (int i = 1; i <= n / 2; i++) {
			INode t = new INode((i < 10 ? "0" : "") + i);
			INode ta = new INode((i < 10 ? "0" : "") + i + ".a");
			t.isFile = true;
			ta.isFile = true;
			d.content.put(t.name, t);
			d.content.put(ta.name, ta);
		}
		return d;
	}

	static INode genProblem(int n, int l) {
		if (n < 3 || l < MINPL) {
			return null;
		}
		String name = generateName(l - "tests\\01.a".length() - 1);
		l--;
		INode p = new INode(name);
		INode check = new INode("check.html");
		check.isFile = true;
		INode tests = genTests(1 + rand.nextInt(n - 1));
		p.content.put(check.name, check);
		p.content.put(tests.name, tests);
		n -= 1 + tests.content.size();
		while (n-- > 0) {
			if (rand.nextBoolean()) {
				while (true) {
					int k = 1 + rand.nextInt(l - name.length());
					String file = generateName(k);
					String ext = generateName(l - name.length() - k - 1);
					String full = file + "." + ext;
					if (p.content.containsKey(full)) {
						continue;
					}
					INode trash = new INode(full);
					trash.isFile = true;
					p.content.put(trash.name, trash);
					break;
				}
			} else {
				while (true) {
					String dir = generateName(l - name.length());
					if (p.content.containsKey(dir)) {
						continue;
					}
					INode d = new INode(dir);
					p.content.put(dir, d);
					break;
				}
			}
		}
		return p;
	}

	static INode genContest(int n, int l) {
		if (n < 3 || l < MINCL) {
			return null;
		}
		String name = generateName(l - MINPL - 1);
		INode contest = new INode(name);
		l -= name.length() + 1;
		while (n > 0) {
			int x = 0;
			while (x < 3 || (n - x < 3 && n - x != 0)) {
				x = 1 + rand.nextInt(n);
			}
			n -= x;
			INode problem = genProblem(x, l);
			contest.content.put(problem.name, problem);
		}
		return contest;
	}

	static class INode {
		public INode(String s) {
			content = new HashMap<String, INode>();
			name = s;
		}

		public ArrayList<String> getAll(String s) {
			ArrayList<String> ans = new ArrayList<String>();
			if (isFile) {
				ans.add(s + name);
			} else {
				for (INode x : content.values()) {
					ans.addAll(x.getAll(s + name + "\\"));
				}
			}
			return ans;
		}

		HashMap<String, INode> content;
		String name;
		boolean isFile;
	}

	static String generateName(int l) {
		StringBuilder sb = new StringBuilder();
		while (l-- > 0) {
			char c = '\\';
			while (c == '\\' || c == '.') {
				c = (char) (33 + rand.nextInt(127 - 33));
			}
			sb.append(c);
		}
		return sb.toString().toLowerCase();
	}
}
