PROGRAMMING:Little h and W love magic
That day, Xiao h and Xiao w decided to go to the forest to watch the sunrise. They came to the forest. Walking, they found a stone with mysterious light. They are very confused, so they open Taobao to take pictures, ah, sister, ah!, This is actually a magic stone. He knows that this stone always appears in piles, so there should be more nearby. Then he went deeper. As expected, he found many magic stones. The stones are in a row. Just as they were ready to pick it up, a magical circle was triggered. They stay where they are and the stone begins to move.
As mentioned above, the stones are in a row. Now, some stones move to one end of the line, while others move to the other end. They don't change direction unless they collide with other stones. Collision means that the two stones move to the same location, and then the direction of both stones will change. The velocity is always 1 m / s regardless of collision. The stone disappears when it reaches one end.
They know the magic ring will disappear in T seconds. This means that after T seconds, he can move and the stone will return to its static state. It also means that they will get the stones. He wanted to know how many magic stones he could get, including the first one he got when he came to the forest.
###Input format:
The first line contains three integers $$n, l, t (0 / Le n / Le 10 ^ 6,2 / Le L / Le 10 ^ 9,0 / le t / Le 10 ^ 6) $- the number of gems on the line is $$n $, the length of the line is $$l $, and the magic circle will disappear in $$t $$seconds.
The next $$n $$line contains a description of the magic stone in the line. The $$I $$line of these lines contains two spaces separated integers $$x [i] $$and $$d [i] $. For $$I / Le n, 0 < x [i] < L, d [i] \ \ in {1,2} $$, it represents the initial position and direction of motion ($$1 $$means from 0 to $$l $$, $$2 $$means from $$l $$to 0).
###Output format:
Output a number indicating the number of magic stones that small h and small w will eventually get.
###Input example:
Here is a set of inputs. For example:
```in
4 10 6
1 1
5 2
6 1
9 2
```
###Output example:
The corresponding output is given here. For example:
```out
three
```
###Exemplar explanation
The stones are a (1,1), B (5,2), C (6,1), D (9,2).
After 1 s, they become a (2,1), B (4,2), C (7,1), D (8,2);
After 2 s, they become a (3,2), B (3,1), C (7,2), D (8,1);
After 3S, they become a (2,2), B (4,1), C (6,2), D (9,1);
After 4 S, they become a (1,2), B (5,2), C (5,1), D reach L and disappear;
After 5 seconds, they become a, a, B (4,2), C (6,1), D disappear;
After 6S, a disappeared, B (3,2), C (7,1), D disappeared.
Small w and small h finally get the first B and C.
###Note
1. Input to ensure that there will not be two magic stones in one position.
2, if gem a and gem B are located at 4 and 5 respectively, and the direction of a is 1, the direction of B is 2. So the next second, the position of the two gems does not change, but the direction is opposite< br>
answer:If there is no answer, please comment
As mentioned above, the stones are in a row. Now, some stones move to one end of the line, while others move to the other end. They don't change direction unless they collide with other stones. Collision means that the two stones move to the same location, and then the direction of both stones will change. The velocity is always 1 m / s regardless of collision. The stone disappears when it reaches one end.
They know the magic ring will disappear in T seconds. This means that after T seconds, he can move and the stone will return to its static state. It also means that they will get the stones. He wanted to know how many magic stones he could get, including the first one he got when he came to the forest.
###Input format:
The first line contains three integers $$n, l, t (0 / Le n / Le 10 ^ 6,2 / Le L / Le 10 ^ 9,0 / le t / Le 10 ^ 6) $- the number of gems on the line is $$n $, the length of the line is $$l $, and the magic circle will disappear in $$t $$seconds.
The next $$n $$line contains a description of the magic stone in the line. The $$I $$line of these lines contains two spaces separated integers $$x [i] $$and $$d [i] $. For $$I / Le n, 0 < x [i] < L, d [i] \ \ in {1,2} $$, it represents the initial position and direction of motion ($$1 $$means from 0 to $$l $$, $$2 $$means from $$l $$to 0).
###Output format:
Output a number indicating the number of magic stones that small h and small w will eventually get.
###Input example:
Here is a set of inputs. For example:
```in
4 10 6
1 1
5 2
6 1
9 2
```
###Output example:
The corresponding output is given here. For example:
```out
three
```
###Exemplar explanation
The stones are a (1,1), B (5,2), C (6,1), D (9,2).
After 1 s, they become a (2,1), B (4,2), C (7,1), D (8,2);
After 2 s, they become a (3,2), B (3,1), C (7,2), D (8,1);
After 3S, they become a (2,2), B (4,1), C (6,2), D (9,1);
After 4 S, they become a (1,2), B (5,2), C (5,1), D reach L and disappear;
After 5 seconds, they become a, a, B (4,2), C (6,1), D disappear;
After 6S, a disappeared, B (3,2), C (7,1), D disappeared.
Small w and small h finally get the first B and C.
###Note
1. Input to ensure that there will not be two magic stones in one position.
2, if gem a and gem B are located at 4 and 5 respectively, and the direction of a is 1, the direction of B is 2. So the next second, the position of the two gems does not change, but the direction is opposite< br>
answer:If there is no answer, please comment