A visualizer is provided to help you develop your solution. To use this, you must adapt your solution to read from standard in and write to standard out. Your program should first read the parameters, starting with K, followed by N, the number of gears, and then N integer giving the gear sizes. You should output an integer S, the number of gears you use, followed by the S elements corresponding to the S gears you place. In pseudocode:

        K = nextInt()
        N = nextInt()
        for(i = 0; i<N; i++)
            teeth[i] = sc.nextInt()
        r = place(K,teeth)
        for(i = 0; i<r.length; i++)
To run the visualizer with your solution, you should run:
java -jar Visualizer.jar -exec "<command>" -seed <seed>
Here, <command> is the command to execute your program, and <seed> is seed for test case generation.

Additionally you can use "-vis <name>" option to generate a file <name>.png
The display will use a different color for each plane.

If you set <name> to "-" (quotes for clarity only) for, the image will be displayed in a window instead of written to the file. You may also add parameters -size for the display size, -speed for the animation speed, and -noanimate if you don't want the display to be animated.

To debug your code with the visualizer, you can print to standard error, and this output will be formatted to the console.