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

public class TestsGen {

    static int done = 0;

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

    static final int MAX_N = 100;
    static final int MAX_VALUE = 100;

    static ArrayList<Integer> data = new ArrayList<Integer>();

    static void print() throws IOException {
	done++;
	System.err.println(done + " " + data.size());
	PrintWriter out;
	if (done < 10)
	    out = new PrintWriter("../tests/0" + String.valueOf(done));
	else
	    out = new PrintWriter("../tests/" + String.valueOf(done));
	Collections.shuffle(data, rand);
	int k = data.size();
	out.println(k);
	for (int i = 0; i < k - 1; i++)
	    out.print(data.get(i) + " ");
	out.println(data.get(k - 1));
	data.clear();
	out.close();
    }

    static int randFromTo(int from, int to) {
	return rand.nextInt(to - from + 1) + from;
    }

    static void genSimple() throws IOException {
	data.add(1);
	data.add(2);
	print();
    }

    static void genRand(int cnt, int maxValue) throws IOException {
	for (int i = 0; i < cnt; i++) {
	    data.add(randFromTo(-maxValue, maxValue));
	}
	print();
    }

    static void genNeg(int cnt, int maxValue) throws IOException {
	for (int i = 0; i < cnt; i++) {
	    data.add(randFromTo(-maxValue, -1));
	}
    }

    static void genPos(int cnt, int maxValue) throws IOException {
	for (int i = 0; i < cnt; i++) {
	    data.add(randFromTo(1, maxValue));
	}
    }

    static void genEqual(int cnt, int value) throws IOException {
	for (int i = 0; i < cnt; i++) {
	    data.add(value);
	}
    }

    public static void main(String[] args) throws IOException {
	new File("../tests").mkdir();
	done = 0;
	genSimple();
	genEqual(2, 0);
	print();
	
	genEqual(1, 23);
	print();

	genEqual(4, 1);
	print();

	genEqual(3, 1);
	data.add(2);
	print();

	genRand(10, 10);

	for (int i = 0; i < 4; i++) {
	    for (int j = 0; j < 4; j++) {
		genNeg(i, MAX_VALUE / 2);
		genEqual(j, 0);
		genPos(rand.nextInt(MAX_N - 10) + 1, MAX_VALUE);
		print();
	    }
	}

	genNeg(MAX_N, MAX_VALUE);
	print();

	genPos(MAX_N, MAX_VALUE);
	print();

	genEqual(MAX_N, 0);
	print();
	
	genEqual(MAX_N, MAX_VALUE);
	print();

	for (int i = -2; i < 3; i++)
	    for (int j = -1; j < 1; j++) {
		genEqual(MAX_N + j, i);
		print();

	    }

	for (int i = 0; i < 10; i++) {
	    genRand(randFromTo(MAX_N * 3 / 4, MAX_N), MAX_VALUE);
	}
	return;
    }
}

