Deepak and Primes 1

I got run-time error in 2 cases,my code is at:
https://ide.codingblocks.com/s/100703,
can this solution be used for “prateek and candy” question?

@gyrsh hey vibhor increase the size of the t pow(10,8)+5;