100 atcoder#ABC106D. [ABC106D] AtCoder Express 2
[ABC106D] AtCoder Express 2
Score: points
Problem Statement
In Takahashi Kingdom, there is a east-west railroad and cities along it, numbered , , , ..., from west to east. A company called AtCoder Express possesses trains, and the train runs from City to City (it is possible that ). Takahashi the king is interested in the following matters:
- The number of the trains that runs strictly within the section from City to City , that is, the number of trains such that and .
Although he is genius, this is too much data to process by himself. Find the answer for each of these queries to help him.
Constraints
- is an integer between and (inclusive).
- is an integer between and (inclusive).
- is an integer between and (inclusive).
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the number of the trains that runs strictly within the section from City to City .
2 3 1
1 1
1 2
2 2
1 2
3
As all the trains runs within the section from City to City , the answer to the only query is .
10 3 2
1 5
2 8
7 10
1 7
3 10
1
1
The first query is on the section from City to . There is only one train that runs strictly within that section: Train . The second query is on the section from City to . There is only one train that runs strictly within that section: Train .
10 10 10
1 6
2 9
4 5
4 7
4 7
5 8
6 6
6 7
7 9
10 10
1 8
1 9
1 10
2 8
2 9
2 10
3 8
3 9
3 10
1 10
7
9
10
6
8
9
6
7
8
10