/**
 * Created by GShark on 15.11.2014.
 */
import java.io.*;
import java.util.*;

public class TestsGen {
    public static void main(String[] args) throws IOException {
        new TestsGen().run();
    }

    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    int tNumber;
    Random rnd;
    final int MAXN = 100_000;
    final int MAXX = 1_000_000_000;
    ArrayList<Integer> test;

    int rand(int n) {
        return rnd.nextInt(n);
    }

    void print(ArrayList<Integer> al) throws IOException {
        System.err.println(tNumber);
        if (tNumber < 10) {
            out = new PrintWriter("../tests/0" + tNumber);
        } else {
            out = new PrintWriter("../tests/" + tNumber);
        }
        tNumber++;
        if (tNumber > 3) {
            al = shuffle(al);
        }
        out.println(al.size());
        for (int i = 0; i < al.size(); i++) {
            out.print(al.get(i));
            if (i < al.size() - 1)
                out.print(" ");
        }
        out.println();
        al.clear();
        out.close();
    }

    ArrayList<Integer> shuffle(ArrayList<Integer> al) {
        int[] a = new int[al.size()];
        for (int i = 0; i < al.size(); i++) {
            a[i] = al.get(i);
        }
        for (int i = 0; i < a.length; i++) {
            int j = rand(i + 1);
            int t = a[i];
            a[i] = a[j];
            a[j] = t;
        }
        al.clear();
        for (int i = 0; i < a.length; i++) {
            al.add(a[i]);
        }
        return al;
    }

    // here starts gens

    void genSample1() throws IOException {
        test.add(2);
        test.add(3);
        test.add(2);
        print(test);
    }

    void genSample2() throws IOException {
        test.add(4);
        test.add(4);
        test.add(4);
        test.add(4);
        print(test);
    }

    void genSample3() throws IOException {
        test.add(1);
        test.add(2);
        test.add(3);
        test.add(4);
        test.add(5);
        print(test);
    }

    void genSimple1() throws IOException {
        test.add(100);
        print(test);
    }

    void genSimple2() throws IOException {
        test.add(1);
        test.add(2);
        test.add(4);
        test.add(8);
        test.add(16);
        print(test);
    }

    void genSimple3() throws IOException {
        for (int i = 10; i >= 1; i--) {
            test.add(i);
        }
        print(test);
    }

    void genRand1(int n, int max) throws IOException {
        for (int i = 0; i < n; i++) {
            test.add(rand(max) + 1);
        }
        print(test);
    }

    //max > 1
    void genRand2(int n, int max) throws IOException {
        for (int i = 0; i < n; i++) {
            test.add(rand(max / 2) + max / 2 + 1);
        }
        print(test);
    }

    void genSpecial1(int n, int max) throws IOException {
        for (int i = 0; i < n; i++) {
            if (i < n / 2) {
                test.add(max / 2);
            } else {
                test.add(max);
            }
        }
        print(test);
    }

    void genSpecial2(int n, int max) throws IOException {
        for (int i = 0; i < n; i++) {
            if (i <= n / 2) {
                test.add(max / 2);
            } else {
                test.add(max);
            }
        }
        print(test);
    }

    void genSpecial3(int n, int max) throws IOException {
        for (int i = 0; i < n; i++) {
            if (i < n / 2) {
                test.add(1);
            } else {
                test.add(max);
            }
        }
        print(test);
    }

    void genSpecial4(int n, int max) throws IOException {
        for (int i = 0; i < n - 1; i++) {
            if (i < n / 2) {
                test.add(1);
            } else {
                test.add(max - 1);
            }
        }
        test.add(max);
        print(test);
    }

    void genSpecial5() throws IOException {
        for (int i = 0; i < MAXN; i++) {
            test.add(i + 1);
        }
        print(test);
    }

    void genSpecial6() throws IOException {
        for (int i = 0; i < MAXN; i++) {
            test.add(MAXX);
        }
        print(test);
    }

    void genSpecial8() throws IOException {
        for (int i = 0; i < MAXN -  1; i++) {
            test.add(1);
        }
        test.add(MAXX);
        print(test);
    }

    void genSpecial7() throws IOException {
        for (int i = 0; i < MAXN; i++) {
            test.add(MAXX - i % 3);
        }
        print(test);
    }


    //the end of the gens

    public void generate() throws IOException {
        new File("../tests").mkdir();
        tNumber = 1;
        rnd = new Random(388282447);
        test = new ArrayList<Integer>();
        genSample1();
        genSample2();
        genSample3();
       // genSimple1();
        genSimple2();
        genSimple3();
        genRand1(10, 10);
        genRand2(20, 20);
        genSpecial1(10, 15);
        genSpecial2(20, 20);
        genSpecial3(30, 9);
        genSpecial4(11, 11);

        for (int i = 1; i <= 10; i++) {
            int n = rand(MAXN / 2) + MAXN / 2;
            genRand1(n, MAXX);
            genRand2(n, MAXX);
        }

        genRand1(MAXN, MAXX);
        genRand2(MAXN, MAXX);
        genSpecial1(MAXN, MAXX);
        genSpecial2(MAXN, MAXX);
        genSpecial3(MAXN, MAXX);
        genSpecial4(MAXN, MAXX);
        genSpecial5();
        genSpecial6();
        genSpecial7();
        genSpecial8();
    }

    public void run() throws IOException {
        Locale.setDefault(Locale.US);
        generate();
    }
}
