Deepak and primes II

I am trying to solve the problem using prime sieve and I don’t know why it is giving me some error. Please help me to rectify it. Here’s my code https://ide.codingblocks.com/s/248208

@akshat_jain
You can’t create array of size 10^9. that’s why you code is giving error and unable to allocate memory.

Then what should i do??
I am unable to unlock the editorial for this problem…

@akshat_jain
Use segmented sieve here. If you haven’t learned about it. learn it once from the following link

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.