Why test case 0 failed in playing with cards(in stack) problem?

@imambujsingh08
you are taking just first 40 prime numbers but the value of q can be more so you will require more prime numbers. I will suggest you to use prime sieve to precompute and store some primes till range of 10^5.

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.