Deepak and primes ii

result:
1.submission not judged on coding blocks
2.on code blocks it is showing bad alloc
my submission:

question:
After learning sieve of Eratosthenes, Deepak wants to play more with the primes. This time he is trying to print primes between two integers. Help him in this task.

Input Format
First line contains a single integer ‘T’ denoting number of test cases. Then ‘T’ lines follow each containing two integers ‘m’ and ‘n’.

Constraints
1<=T<=10 1<=m<=n<=1000000000, n-m<=100000

Output Format
Print the prime numbers from ‘m’ till ‘n’ (both inclusive), one number per line and each test case is separated by an empty line.

Sample Input
2
5 10
11 20
Sample Output
5
7

11
13
17
19

since the constraints are large u are not allowed to make a array that big a size, of 1000000000 size, that is why u get bad alloc.

U`ll have to use the concept of segmented sieve, please read about it and then the question would pass the test cases.
in case of doubt ask me.

is there any other way of dealing a vector of that large size?.. i need to create a vector of size 10^9 in order to solve this question

ya so c++ doesnt gives u a provision to create an array of 10^9 size
so inorder to solve this question the only way out is using segmented sieve

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.