PRIME1  Prime Generator
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!
Input
The input begins with the number t of test cases in a single line (t<=10). In each of the next t lines there are two numbers m and n (1 <= m <= n <= 1000000000, nm<=100000) separated by a space.
Output
For every test case print all prime numbers p such that m <= p <= n, one number per line, test cases separated by an empty line.
Example
Input: 2 1 10 3 5 Output: 2 3 5 7 3 5Warning: large Input/Output data, be careful with certain languages (though most should be OK if the algorithm is well designed)
Information
After cluster change, please consider PRINT as a more challenging problem.hide comments
dibid:
20160522 22:07:45
I'm using Sieve of Eratosthenes algorithm but I keep getting TLE! no matter what algorithm I use. http://ideone.com/2Om20c 

pro_7:
20160521 19:52:09
i am getting TLE tell me how to overcome this problem 

arpitsharma:
20160520 19:17:50
Search Sieve of Eratosthenes 

n_r1y1t:
20160520 15:55:03
Why is my code showing wrong answer? It's working quite well in ideone. There are no test cases. We can't see the output. Nor can we see the optimized solution. Can anybody help, please? 

top_gun007:
20160517 03:29:12
f****** easy 

ajit:
20160509 18:49:04
I have issues compiling the code in SPOJ. It works in eclipse though.


hollapr:
20160506 23:37:50
Same logic doesn't work in C and runtime error is shown... Don't use scanf and printf...


boney_412:
20160506 20:29:43
AC!!!!


noxiousav:
20160504 16:51:46
My code works in my ide and also ideone.com but here it says Time limit has exceeded. 

d_griffin_101:
20160503 18:40:10
My code works. I use the ide compiler and it works. Yet when I submit it, it says that the time limit has exceeded itself. 
Added by:  Adam Dzedzej 
Date:  20040501 
Time limit:  6s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS PERL 6 