```
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int test;
scanf("%d",&test);
while(test--)
{
int n,m;
cin>>m>>n;
bool arr[n+1];
for(int i=0;i<n;i++)
arr[i]=true;
int p=2;
for(int i=2;(p*i)<=n;i++)
{
while((p*i)<=n)
{
if((p*i)>n)
break;
arr[(p*i)-1]=false;
p++;
}
p=2;
}
for(int i=m-1;i<n;i++)
{
if(arr[i]==true&&i!=0)
cout<<i+1<<endl;
}
}
return 0;
}
```

**i am trying to generate prime numbers using sieve of erasothness between given range but again and again it's giving run time error(SIGSEGV) in SPOJ but it's working perfectly fine on my system **