import java.io.*;
import java.util.*;

public class TestGen {

	PrintWriter out;
	Random rnd = new Random(31);
	int tNumber;

	class Test {
		ArrayList<Integer> a;

		void printTest() throws IOException {
			if (tNumber < 10)
				out = new PrintWriter("../tests/0" + tNumber);
			else
				out = new PrintWriter("../tests/" + tNumber);
			tNumber++;

			out.println(a.size());
			for (int i = 0; i < a.size(); i++) {
				out.print(a.get(i));
				if (i < a.size() - 1)
					out.print(' ');
				else
					out.println();
			}
			out.close();
		}

		void genRandom(int n, int x) throws IOException {
			a = new ArrayList<Integer>();
			for (int i = 0; i < n; i++) {
				a.add(1 + rnd.nextInt(x));
			}
			printTest();
		}

		void genRandom2(int n, int x) throws IOException {
			a = new ArrayList<Integer>();
			int t = x / 2;
			for (int i = 0; i < n; i++) {
				a.add(t);
				if (rnd.nextBoolean())
					t -= rnd.nextInt(10);
				else
					t += rnd.nextInt(10);
				t = Math.min(t, x);
				t = Math.max(t, 1);
			}
			printTest();
		}
		
		void genFull(int n, int x) throws IOException {
			a = new ArrayList<Integer>();
			int t = 1;
			for (int i = 0; i < n; i++) {
				a.add(t);
				t = t + rnd.nextInt(3);
				if (t > x)
					t = x;
			}
			printTest();
		}

		void genOne(int n, int x) throws IOException {
			a = new ArrayList<Integer>();
			int t = x;
			for (int i = 0; i < n; i++) {
				a.add(t);
				t = t - rnd.nextInt(3);
				if (t < 1)
					t = 1;
			}
			printTest();
		}

		void genStrange(int n, int x) throws IOException {
			a = new ArrayList<Integer>();
			int min = x / 2;
			int max = x / 2;
			for (int i = 0; i < n; i++) {
				if (rnd.nextBoolean()) {
					a.add(min);
					min = min - rnd.nextInt(3);
					if (min < 1)
						min = 1;
				} else {
					a.add(max);
					max = max + rnd.nextInt(3);
					if (max > x)
						max = x;
				}
			}
			printTest();
		}
		
	}
	
	void genPrelim() throws FileNotFoundException {
		out = new PrintWriter("../preliminary/01");
		out.println(6);
		out.println(1 + " " + 4 + " " + 2 + " " + 2 + " " + 5 + " " + 3);
		out.close();
	}

	public void solve() throws IOException {
		tNumber = 1;
		genPrelim();
		Test t = new Test();
		//first group, n = 10, 10 tests
		t.genFull(10, 100);
		t.genOne(10, 100);
		t.genRandom(10, 100);
		t.genRandom2(10, 100);
		t.genStrange(10, 100);
		
		t.genFull(10, 100000);
		t.genOne(10, 100000);
		t.genRandom(10, 100000);
		t.genRandom2(10, 100000);
		t.genStrange(10, 100000);
		
		//second group, n = 1000, 10 tests
		t.genFull(1000, 10000);
		t.genOne(1000, 10000);
		t.genRandom(1000, 10000);
		t.genRandom2(1000, 10000);
		t.genStrange(1000, 10000);
		
		t.genFull(1000, 100000);
		t.genOne(1000, 100000);
		t.genRandom(1000, 100000);
		t.genRandom2(1000, 100000);
		t.genStrange(1000, 100000);
		
		//third group, n = 100000, 10 tests
		t.genRandom(100000, 10);
		t.genRandom(100000, 100);
		t.genRandom(100000, 100000);
		
		t.genRandom2(100000, 10);
		t.genRandom2(100000, 100);
		t.genRandom2(100000, 100000);
		
		t.genFull(100000, 100000);
		t.genOne(100000, 100000);
		t.genStrange(100000, 100000);
		t.genStrange(100000, 100000);
		
		
	}

	public void run() {
		try {

			solve();

		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		new TestGen().run();
	}
}
