My code showing run error

what is the probleam with my code,can you debug it .
it shows run error.

hello @firstrankforall
pls save ur code here-> https://ide.codingblocks.com/
and share the link with me

here is the link -> https://ide.codingblocks.com/s/270624

it is because amount*amount can be a very big number and we cannot declare a very largesieve.

do one thing.
first store all ur prime numbers upto 10^6 in some array (say prime).
and then use that array to print nth prime.

this will not consume much memory and also answer query efficiently

Now it working for all test cases except test case 0.

here is the link -> https://ide.codingblocks.com/s/270624

increase value of n (check constraints )

also inside sieve declare all variable as long long

all variable are already in long long in sieve, and when i raise one more zero the there is run error in all cases. can you debug my code ?

pls check this -> https://ide.codingblocks.com/s/281828

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.

Now it working for all test cases .

when i make size constant and defien size and p flobal then it is working fine , csan you explain why is it so ?

global scope has some higher memory capacity than function scope thats why.

ok thanks , i got the point.