Prateek bhaiya loves candey problem

https://ide.codingblocks.com/s/47919 In my code time limit exceed error comes how can i resolve this code.

Hey Neeraj, you are getting TLE because for each case you are finding the nth prime no. using a loop, so you are supposed to use sieve of eratosthenes here to remove the TLE. If you haven’t watched yet there is a video given in the online course of sieve of eratosthenes.