A disease has swept the nation, a zombie apocalypse is in full swing, humanity is in decline. Separate groups of survivors need to interact with each other, but the zombies are extremely intelligent and have not forgotten how to read. It was possible to find the encryption machine on the AES algorithm, but SubBytes and SubWord are irretrievably lost, and the encryption key cannot be changed.

You are a zombie freshman, but you used to work as a radio operator, and you remember exactly that the message M1 was transmitted as C1. But the key is forgotten — the brain is damaged after all.

Decrypt now C2.

M1 = «****OffZone*****»

С1 = 0xc7 0×64 0×80 0xe8 0xeb 0×77 0xb3 0×33 0×43 0×59 0xd6 0×8c 0×19 0×62 0×1a 0×89

С2 = 0xd6 0×68 0×80 0xd3 0xf0 0×77 0xc2 0×3c 0×43 0×13 0xd9 0×99 0×21 0×7c 0×14 0×89

Cyborg zombies intend to destroy the remaining survivors of the invasion. They inform each other about the place of the attack in a non-encrypted signed message.

Mankind’s last chance is to trap the zombies by modifying the message. But the cyborg zombies built RSA over the space of polynomials Z_{131} [x]. The message is encoded character by character, the ASCII code of a character is a coefficient of a polynomial element.

Public key:

(536344634025056562833986104794680133221, x^{20} + 97x^{19} + 30x^{18} + 40x^{17} + 115x^{16} + 78x^{15} + 55x^{4} + 22x^{13} + 117x^{12} + 10x^{11} + 44x^{10} + 96x^{9} + 25x^{8} + 79x^{7} + 27x^{6} + 34x^{5} + 35x^{4} + 16x^{3} + 97x^{2} + 18x + 59)

Message: «OffZone»,

79x^{6} + 102x^{5} + 102x^{4} + 90x^{3} + 111x^{2} + 110x + 101

Signature:

128x^{19} + 55x^{18} + 25x^{17} + 119x^{16} + 75x^{15} + 59x^{14} + 77x^{13} + 124x^{12} + 30x^{11} + 56x^{10} + x^{9} + 65x^{8} + 10x^{7} + 92x^{6} + 119x^{5} + 33x^{4} + 26x^{3} + 100x^{2} + 32x + 11

In the aftermath of another battle against zombies, you order the robot commander to calculate the losses in their ranks.

The zombies damaged the commander’s internal wiring and he cannot count numbers greater than 4 bits. But, following his programming, he ordered the remaining machines to form rows of 5 and saw that 1 droid was left outside the column. Then he ordered them to line up in rows of 7, but with this construction, 3 robots were left without a group. After that, he issued orders to line up in rows of 11, still, 3 robots were left without a row to fill. He reported this information to you.

**Question:** Can you determine how many robots fell in battle?

The year is 3019, the Earth suffers from extreme overpopulation. All countries of the world have agreed to impose restrictions on the birth of children. Some people had to be placed in cryocapsules until better times, waiting for colonies on other planets to finally be established.

You work as a keeper of a cryogenic laboratory. Your task is to arrange cryocapsules on cryoblocks exactly the way you were shown on the video instructions on the first day. You already know by heart the following: capsule size is 1×2 m, and the blocks width is constant — 2 m, but the length depends on the refrigerator (an example is in the figure).

… |
||||||||

This is one of the most boring jobs on Earth in 3019 years. To entertain yourself on a dull nuclear-winter evening, you have invented a task for yourself.

**Question:** In how many ways can the cryocapsules be placed on the cryoblock?

After the disaster, the peoples of the world were mixed around.

You are one of the lucky ones to have survived the disaster. After several days of wandering, you saw tents, in the proximity of which 7 people were busy working. They look different and seem to express themselves only in sign language. You would like to join this group, but you doubt that you can get along with them. To understand this, you need to resolve two questions:

1. What is the probability that there is a person in this group who speaks the same language as you?

*General assumptions:*

- There are no people in the group who speak the same language;
- Everyone speaks only one of the 10 most popular languages.

*Assumptions 1A:*

- After the catastrophe the number of native speakers of the 10 most popular languages was equal.

*Assumptions 1B:*

- After the disaster, speakers of the 10 most popular languages were weighted averagely (according to the number of native speakers before the disaster).

2. What is the probability that there is a couple (man-woman) from the same language group?

*General assumptions:*

- Assume that the group consists of 4 men and 3 women;
- There are obviously no people in the group from one language group;
- Assume that representatives of only the 100 largest nations in the world survived after the disaster.

*Assumptions 2A:*

- After the disaster each of the 100 largest nations have equal numbers of representatives.

*Assumptions 2B:*

- After the catastrophe, the representatives of the 100 largest were scattered across the world by weighted average — according to their numbers before the catastrophe.

In the vast expanses of wasteland, stalkers have come across a huge number of anomalies.

There are harmless anomalies which affect the voices, there are also hazardous ones, killing a person with a lethal dose of radiation. But there is one that stalkers in their circles love the most! The anomaly does not last long, but it has a very interesting effect: this anomaly makes the victim a virtuoso in the field of arithmetic expressions and numbers processing, but at the same time removes from memory almost all natural numbers that exceed a randomly chosen number K.

The victim can count up to 100 but using combinations of only those numbers that the victim remembers. Multiplying, adding and enclosing them in parentheses, you can get the desired value.

This is precisely what happened to a watchman in the wasteland: having fallen asleep at his post, the soldiers of the survivors clan decided to teach the irresponsible guard a lesson, and subjected him to this anomaly giving him a task: to find the value N.

Write a program which in the shortest time will help you get a result (given number N) using natural numbers not exceeding K, addition and multiplication, as well as parentheses. 1 arithmetic operation is performed per 1 unit of time.

You have in your hands a combat laser with two slots for magazines. It works only if you load both slots with magazines containing charge.

Before the battle began, the warrant officer issued you 8 magazines. You have already emptied 4 of them. A crowd of zombies is running towards you. You begin to reload the combat laser, but at that moment a bomb explodes near you. All magazines are scattered, and you have no way of telling a full magazine from an empty one just by touch and appearance.

**Question:** How to determine two charged magazines in the fewest attempts possible?

10 AIs have enslaved the world and killed almost all people. The loss seemed insignificant to the machines, but they soon realised that they could not clean their wire-contacts with alcohol themselves. They began to search for survivors and found a handful of 50 people. To the convenience of the invaders, people themselves willingly surrendered to slavery.

The question of the dividing the find between the machines was resolved democratically. The senior AI proposes how to divide the servants, and the rest vote «for» or «against» his method. If at least half of the AIs votes «for», the slaves are divided by the proposed method, if not, the older AI is disabled and the process begins anew. It is repeated until a plan is adopted.

**Question:** What distribution will the senior AI offer, knowing the consequences of their actions and the logic of their rivals?

*Assumptions / Explanations:*

- all AIs are in strict rankings;
- one slave cannot be divided;
- if 2 AIs remain, the one with the higher ranking simply takes away all the survivors.

«Dirty» bombs had almost left humanity with no drinkable water. Only 1% of reservoirs contain water safe for consumption.

Meanwhile, fresh water supplies in our country are running low, therefore the interim government announced via radio about the initiative to search for clean bodies of water. Any reliable information is awarded with 1,000 bottle-caps.

You have just completed work on your detector, which determines the suitability of drinking water. The device correctly detects clean water in 95% of cases (i.e., in 5% of cases, the detector says water is OK, even if the water has been polluted). And only 2% of cases, the detector will not detect drinking water, despite the fact that it is suitable for use.

You tell your friend about the invention and go off to explore the nearest reservoirs. A few days later your detector detects drinking water in one of the lakes. You share the exciting news with your friend and he offers to buy this information from you right now for 200 bottle-caps.

**Question:** Is the deal profitable? What price would you offer?

Our tribe is in danger of not surviving the Grey storm which is due in two days. To survive we need fresh water, and we did have it.

But one member of the tribe particularly hungry for power decided to pour Horserat poison into all of our fresh-water tanks. All in the hopes of killing half the tribe, slander the leader and take power over the survivors.

The guards quickly spotted the evildoer, so his plan failed, but he managed to poison 1 tank out of 243. Tribesmen are now afraid to drink water, because Horserat poison can easily kill a person in an hour, maybe five, but one thing for sure is that no one has ever survived longer than a day after ingesting the poison.

Out of pride the villain does not say which reservoir he poisoned — even the most horrific torture fails to get him to talk. But there are brave and honest people in the tribe who are ready to test the water from any reservoir and find out which one was lethal.

**Question:** What minimum amount of volunteers would allow leader to determine poisonous reservoir

The enemy base is located 104 kilometers from our positions. To break into the enemy command center, you need to place our computer as close as possible to the enemy lines. Our technologies allow you to teleport electronics from your own base to any distance but teleporting them back will not work.

The situation is made even more complicated by the fact that the enemy has installed a tower producing a strong electromagnetic field which can disable our equipment. But we have 2 robots that have the same electromagnetic resistance as the computer for hacking. Both robots are old, so they can only crawl towards their own base. You cannot risk a single computer, so we will use robots only to measure a safe distance. The command requires to determine as quickly as possible the line at which the electromagnetic field stops affecting our electronics.

**Question:** How many teleportations are needed to determine the boundary (in kilometers) at which electromagnetic fields do not pose a danger to our electronics? You have 2 old robots to measure the limit.