Deepak and primes run error

giving run time error for test case 5,6
code: https://ide.codingblocks.com/s/60128
how to optimise the solution further

Mention problem link

https://hack.codingblocks.com/contests/c/537/700

Constraints:
1<=n<=5000000
5000000th prime is 86,028,121
and you are using array prime of size 10^7 which will not iterate till 86,028,121 , So, increase the size of prime array.
Refer my code
https://ide.codingblocks.com/s/60131
Hit like if u get it :slight_smile: