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

public class TestsGen {
	static int testcount = 0;

	static Random random = new Random(945346);

	static void write(int[] arr) throws IOException {
		PrintWriter out = new PrintWriter(String.format("%02d", ++testcount));
		System.out.println("Generating test #" + testcount);
		out.println(arr.length);
		for (int i = 0; i < arr.length; i++) {
			if (i > 0) {
				out.print(" ");
			}
			out.print(arr[i]);
		}
		out.println();
		out.close();
	}
	
	static void writeRand(int n, double p) throws IOException {
		System.err.println((testcount + 1) + " " + p);
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			if (random.nextDouble() < p) {
				a[i] = 0;
			} else {
				a[i] = random.nextInt(100) + 1;
			}
		}
		write(a);
	}

	public static void main(String[] args) throws IOException {
		while (new File(String.format("%02d.t", testcount + 1)).exists()) {
			testcount++;
		}
		for (double d = 0.1; d <= 0.9; d += 0.1) {
			writeRand(random.nextInt(20) + 1, d);
		}
		for (double d = 0; d <= 1; d += 0.15) {
			writeRand(random.nextInt(1000) + 1, d);
		}
		writeRand(random.nextInt(1000) + 1, 1.0);
		for (double d = 0; d <= 1; d += 0.1) {
			writeRand(100000 + random.nextInt(900000), d);
		}
		for (int i = 0; i < 19; i++) {
			writeRand(500000 + random.nextInt(500000), random.nextDouble() * 0.2 + 0.6);
		}
	}

}
