Warning

All assignments in BE5B33PGE are handled by an assignment upload system BRUTE. Students are supposed to deliver self-contained source codes independent of other than standard libraries. The source code has to be written in Python.

The easiest way to submit an assignment is to create a .zip archive with required files and structure and upload it to the system (the system interface should be self-explanatory. All source files must reside in the root directory of the archive. The main program must reside in the file named main.py.
In case of troubles contact immediately your teacher.

# Public and private data

Each problem assignment in the upload system is associated with the set of public example input and output data. Each time a solution is submitted it is run on the public dataset and the program output to stdout and stderr is available to the student.
Public data are accessible at the bottom of the problem statement page and are intended for somewhat easier debugging and approximate program correctness checking. Public data are in no way meant to be an indicator of the quality of a particular solution. Each student is encouraged to produce a sufficient number of his/her own debug data sets if necessary.
The submitted solution is run on all private data files which remain unaccessible. The system informs the student which data file in the private set were processesed correctly and in the given time limit. The grading is based on the number (percentage) successfully processed private data files. Both correctness of the result and the code speed are taken into the account.

# Input and output

Your program should read all data from the standard input and write the data to the standard output. Your program has no access to any disk files in the system for security reasons, so do not try to read/write any files, it will produce no effect. The system runs your program as many times as there are input data files associated with the particular problem in the system. Each file contents is redirected to standard input of your code.

# Time limits

The system runs your code on each data file separately. In each run, the system executes the reference solution of the problem (written usually by a teacher) immediately before it executes your code. The execution time of the reference code is multiplied by 2 and rounded up to the closest whole second. This value is then set as a time limit of the execution of your code. If your code does not terminate within the time limit the process running your program is terminated and system evaluates this run (on particular data file) as unsuccessful.

# Environment details

Your assignments are evaluated in 64-bit Linux environment by Python, version 3.4. The memory available to your code is about 1 GB unless otherwise stated in the problem statement.