Deepak and primes problem

How can we take a large size array to overcome the problem of tle.

hello @Alfred

a) use long long here->

b)
ur sieve size is not big enough to find 500 000 th prime number.
first check value of 500 000 th prime number and prepare a sieve upto that

Can you tell me some optimisation in this program.

follow above instructions , it will work.
u r getting tle becuase of interger overflow .