# Divide Gold: Rates Are Rising

Undefined
The mission is in Blocked Mode. Access to the solutions is blocked for a day or two (even after you share your own), until we'll have enough solutions for you to check. All users who've solved the mission will get the notifications about their opening.

Captain Red Eye and his sailors luckily found another chest containing a large number of identical gold coins. To divide up the coins, the crew tried to use their previous rules:

• each sailor, except the Captain, should receive exactly the same number of coins;
• the Captain should receive twice as many coins as a sailor.

In case the coins cannot be divided evenly using this method, the Captain, being the only person with a gun on board, decided to use his weapon effectively and mercifully - to minimally decrease the number of sailors to get an integer result of shares.

However, the sailors were not happy with such a prospect and secretly decided that if the given number of coins could be evenly divided without the Captain's share, they would pounce and remove him from leadership.

So, the priority of checking cases should be the following:

• Captain's double share, no kills;
• The crew makes a riot against Captain;
• Captain starts to kill sailors;
• Captain kills all and take all gold.

Given the number of coins in the chest and the number of sailors, write a program to determine the best share Captain or sailor (depending on suitable case) can receive.

Input: Two integers (int).

Output: Integer.

Examples:

```assert winner_share(15, 4) == 6
assert winner_share(16, 4) == 4
assert winner_share(100, 11) == 20
assert winner_share(15, 1) == 10
```
Settings
Code:
Other:
Invalid hot key. Each hot key should be unique and valid
Hot keys:
•  to Run Code: to Check Solution: to Stop:
CheckiO Extensions

CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.

In order to install CheckiO client you'll need installed Python (version at least 3.8)

Install CheckiO Client first:

`pip3 install checkio_client`

`checkio --domain=py config --key=`

Sync solutions into your local folder

`checkio sync`

(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)

`checkio serv -d`

Alternatevly, you can install Chrome extension or FF addon

`checkio install-plugin`
`checkio install-plugin --ff`
`checkio install-plugin --chromium`

Read more here about other functionality that the checkio client provides. Feel free to submit an issue in case of any difficulties.

Pair Programming (Beta-version)

Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!

Waiting for Pair Programming to start...

You are trying to join a pair programming session that has not started yet.

Please wait for the session creator to join.

Waiting for Pair Programming to reconnect...

It looks like the creator of the pair programming session closed the editor window.

It might happen accidentally, so that you can wait for reconnection.