Greetings to everybody.
Today is an unusual day on Codeforces: two contests a day with quite small gap between them. The reason is that today the IX Regional team school programming contest is held in Saratov, and it was decided to use the tasks from it for Codeforces rounds.
That's why there are many authors of today's tasks. I would like to thank the whole jury of the school contest for their excellent job. The following people are on the jury: Artem Rakhov, Nickolay Kuznetsov, Natalia Bondarenko, Gerald Agapov, Polina Bondarenko, Ivan Fefer, Edvard Davtyan, Igor Kudryashov, Pavel Kholkin and me. I believe that you know all these people as Codeforces problemsetters.
Let me draw your attention to the fact that today all problems have file IO. But generators for the hacks should output to stdout as usual.
Special thanks to Maria Belova and Julia Satushina for translating problem statements into English.
Good luck at the contests!
UPD: Results of the 35th round. We congratulate the winner, Naginchik, on his impressive debut!
UPD: Results of the 36th round.
So, for exaple, in C++ you should have something like
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
at the beginning of your solution.
And usually you should not.
For those who are not familiar with file IO, there are several solutions of "A*B" problem in some popular programming languages: