| IX MaratonUSP Freshman Contest |
|---|
| Finished |
The Festival of the Moon is an anual tradition from the people of the Moon. Every waning moon, beings from all around the solar system gather to celebrate and dance around flaming craters. It is also a great oportunity to experience the great lunar cuisine, like the cheese bread made from the soil cheese in the moon.
This lunar year, May is responsible for the organization of such an important festival. With all her influence and popularity, she invited lots of planets to gather on this special date. However, May was worried that the own lunar people wouldn't appear at the meeting, since they show less and less interest over the years to participate in their own tradition, prefering to gather on the dark side and party on their own way.
Cauê, who was responsible for managing and selling the tickets, suggested an ideia: the organization could use the money they won from USP (Union of Solar Planets) through PIPA prize (Program of Incentive for Playful Activities, which aims to invest in the best parties in the Solar System), to offer tickets for half the price to the Festival of the Moon, exclusively to lunar people.
The tickets were sold and the party rocked hard. Cauê was having so much fun that he made a terrible accounting mistake: he forgot to count how many people in the party were from the Moon, and wouldn't be able to establish a good metric to check whether or not his idea was good.
Cauê then asks your help to solve this problem before he gets fired. Luckily, he was still able to write down the ammount raised, $$$a$$$, in lunar currency, and how many people, $$$p$$$, went to the festival. You may assume that everyone who bought a ticket went to the party. With this information, and with the full price of the ticket, $$$v$$$, help Cauê find out how many people at the party were from the Moon.
The input consists of 3 integers $$$a$$$, $$$p$$$, and $$$v$$$ ($$$0 \leq a, p \leq 10^6$$$, $$$1 \leq v \leq 10^6$$$, $$$v$$$ is even) — the ammount raised in the Lunic Festival, how many people went to the party, and the full price of the ticket, respectively.
A single integer $$$y$$$ corresponding to the total number of people in the party who where habitants from the Moon. It is guaranteed that the answer is a non-negative integer.
7 5 2
3
22 7 4
3
150 10 30
10
In the first test case, out of the 5 people in the festival, 3 paid half-price and 2 paid full price, adding up to 7 lunar coins. Thus, there were 3 lunar people in the festival.
| Name |
|---|


