Prime visits (Challenges Number Theory)

Code is working fine but showing run time error for test case 1 but i am able to run that test case successfully individually

While submitting other two test cases are working fine

hello @nischay1111

image
the question can ask u prime upto 1000 000 . but u are computing ur sieve only upto 10005
thats why ur code is failing for higher value of a,b.

to rectify it increase ur sieve and cumulative array size.