Task: Input consists of number N - the width of the map (N<=100) and matrix NxN integers, that represent the map. One cell correspond to one square 100x100m. Obstacles are negative numbers, positive numbers denote squares, where there is some work needed of Z-10 and the rest is zero. Next, there are coordinates (R,S) of Z-10. Base is situated at (N,N). Your program should find a route for Z-10, so that it doesn't contain any obstacles in it and has as many 'work-places' as possible in it. A route is sequence of squares, beginning in (R,S) and terminating in (N,N), such that every square in sequence is to south (under) or to east (on right) from previus one. If there are more than one such route, your program will output one of them, if there is no such route, your program will output appropriate message.
Example:
Input:
N=3, R=1, S=1
Map:
0 1 1 0 -1 -1 0 3 0
Output:
The optimal route:
(1,1), (2,1), (3,1), (3,2), (3,3)
Towers of size D and grades 1 and 2 are on fig. 1 and fig. 2. A tower of grade s+1 we can construct from lower-grade towers in this manner: first, we draw vertical line (of length D), then we continue with tower of degree s and size D/2. Next to this tower, there is a grop of towers, that we could construct by turning s-grade tower upside down, and finally after another s-grade tower there is vertical line (of length D).
Task: Your program will for input S and D print a sequence of commands for Zeofine, so that she would draw a towerof grade S and of size D. Zeofine performs commands: FORWARD A (moves forward in current direction by length A), LEFT A and RIGHT A (changes current direction by angle A).
Task: Input describes the sign. It consists of several vertices, some of them connected by lines. First line consists of N and M, where N is the number of vertices and M is the number of lines. Every vertex is given a number 1,...,N. Following M lines contains pairs of numbers representing end vertices of a line. Your program should output a sequence of vertices, that gives the order in which lines can be drawn. Every line should be drawn exactly.
Example:
Input:
5 8
1 2
1 4
1 3
3 5
5 4
2 3
2 4
3 4
Output:
1 3 5 4 2 3 4 1 2
Santo turned and before him appeared a table full of food. He came to it to take some titbit and ... BZZZZZZZZZZZZZZZ. Santo's hand quickly moved to switch off the alarm clock but it was only thrown to the floor. When he finally woke up, he saw what had happened. Everywhere around him were coq-wheels from broken device. He sighed and began trying to repair it. Santo is very skillful and after some time he decided to wind it. Alarm clock was repaired, although its hands were turning counter-clockwise. Now Santo is trying to repair it again, but he is so confused because he does not know the direction of turning cog-wheels.
Task: Input for your program consists of number of cog-wheels n descriptions of all cog-wheels and direction of rotation of the first cog-wheel in a list. Desription of each cog-wheel consists of its radius and coordinates of centre. Your program should determine the speed and direction of every cog-wheel. You can assume that no two cog-wheels intersect in plane but they can touch each other. If two cog-wheels K1, K2 touch, their directions must be opposite. Further, if K1 has radius r1 and speed of turning omega1 for i=1,2, following equation holds omega1/omega2 = r2/r1. The speed of the first cog-wheel is 1 revolution per minute. If it is impossible to hold all given conditions, the alarm clock ceased (your program should write Alarm clock stopped). On the contrary some cog-wheels may stand (their speed is 0), if they have no connection to the first cog-wheel (in this case your program writes "Some cog-wheels stand.")
Coordinates and radiuses are real numbers. You should take care about round-off errors (pay attention to comparing).
Example:

Output for the left alarm clock:
Speed Direction ---------------------------------------- K1 1 counter-clockwise K2 1.828 counter-clockwise K3 1.828 clockwise K4 1.828 clockwise K5 1.828 counter-clockwise
Output for the rigth alarm clock:
Alarm clock stopped.
The hustle and bustle of Kiribati increases every minute. The chief of neighbouring archipelago is visiting his neighbours and he will be here in some hours. Natives would like to give him a tumultuous welcome. They have got somewhere a long red carpet and decided to place it from the airport to the main settlement. Soon they have found many holes in it and now they are trying to cover them. In many Kiribati households they have small red rugs which have the same width as the carpet but are only 1 meter long. Somebody got an idea to use them for covering the holes. They would like to use as small number of rugs as possible because many households will miss it.
Task: You are given the length of carpet d, number of holes n and the distances from airport to start and to end point of every hole (in meters). Write a program which outputs minimal number of rugs needed for covering the holes. Every hole must be covered and no rug can be cut (it will be returned to its owner after ceremony) although rugs can overlap. Further, your program should output the way of placing the rugs.
Important part of your solution is a proof that your algorithm work correctly, e.g. that it always covers all holes using the smallest possible number of rugs.
Example:
Input:
d=10, n=3
Damaged parts:
Start End 1.2 1.3 5.4 6.5 1.95 2.1
Output:
Minimal number of rugs is 3.
Placing of rugs:
Start End 1.15 2.15 5.4 6.4 5.5 6.5