Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Quarantine!!!

By rashedul_riad · Limits 1s, 512 MB

China is one of the strongest countries in the world in the sense of economy and military technology. Tom is from the United States. Professionally he is a tourist. He has recently come to china. Unfortunately, a virus called the “Corona” outbreak in china. So, he is in trouble. If he wants to leave china then he must go to Beijing. The main problem is that he has to cross some provinces to reach Beijing. Some of them are affected by “Coronavirus-19” and it’s too dangerous. But he is very smart as well. He calculated that the provinces which are primes are safe for him. As you are a talented programmer so he asks you to do this task. Note: A quarantine is a restriction on the movement of people and goods which is intended to prevent the spread of disease or pests.

Input

Input starts with an integer N which denotes the number of test cases. Each case contains a line containing two integers X and Y which denotes the provinces.

Constraints

1 ≤ X ≤ Y ≤ 1000000000
≝(X,Y)≤100000
1 ≤  N ≤ 200

Output

For each case print the number of provinces which are safe.

Sample

InputOutput
3
2 3                          
5 11
1 100
2
3
25

Discussion

Statistics


44% Solution Ratio

Fazlerabbi.Earliest, 3w ago

Big_PappaFastest, 0.0s

Big_PappaLightest, 131 kB

rakibulhasanShortest, 950B

Submit

Login to submit

Related Contests

5th CPU CSE Programming Contest Ended at 2020-03-16 09:00:00 +0000 UTC