# Escape

Simple+

There is an open jar and a fly inside it. That fly is flying from side to side frantically because it really wants to get away from there. Your task is to estimate whether it will succeed in its attempts (return True) or not (return False).

So what do we got? The jar is represented by a rectangle in the drawing above. It has width W and height H. The jar has a hole of the size d. Our fly can escape through it. The hole is always placed on the top of the jar and the jar is symmetrical. Point O is the origin, the y axis matches the jar's left side and the x axis matches the jar's bottom side. The wall thickness is negligible.

Initial position of the fly is defined by x0 and y0, which are assigned arbitrary. But it's guaranteed that the fly is inside the jar by the time we start to observe it. In the very beginning the fly is flying linearly, Vx and Vy are a horizontal and vertical components of the velocity vector respectively. When the fly hits a wall, it deflects from it and fly in the opposite direction (like a billiard ball). The drawing above illustrates how it works. Also, there's one tiny detail: after each collision the fly loses 5% of its initial stamina, getting tired (velocity remains the same though). So after 20 collisions the fly becomes completely exhausted. The fly's size is negligible.

Input:
Two lists of integers:

• the first contains jar's dims [W, H, d];
• the second contains fly's characteristics [x0, y0, vx, vy].

Output: Boolean.

Examples:

```assert escape([1000, 500, 200], [0, 0, 100, 0]) == False
assert escape([1000, 500, 200], [450, 50, 0, -100]) == True
assert escape([1000, 1000, 200], [450, 1000, 100, 0]) == False
assert escape([1000, 1000, 200], [250, 250, -10, -50]) == False
```

Preconditions:
All dimensions are given in abstract units, velocities are given in units/sec.

• W ∈ [100; 1000];
• H ∈ [W; 4W];
• d ∈ [0.1W; 0.8W];
• x0 ∈ [0; W];
• y0 ∈ [0; H];
• vx ∈ (-2W; 2W);
• vy ∈ (-2H; 2H);
• V != 0.

28
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.