Primality test code doubt

giving tle cant figure out where the code is going wrong

@rohit_1906
for(ll r=0;r<=s-1;i++) this loop goes into infinite line. Line 47 in your code.
Also, Rabin miller won’t fetch you 100 points in this problem. Since
these test are only based on probability. And they can create false negatives. i.e miller rabin may say that the number is prime, but it may be prime. These are probabilistic test.
If you need 100 score. Fermat primality test gives accurate result in these test cases, but these are just based on luck I guess. There will be cases where these tests may give false negatives.

can you please provide the code of fermats primality test

The link that i have attached in the previous comment is of fermat primality test.
If you want to read about it you can refer here. https://cp-algorithms.com/algebra/primality_tests.html#toc-tgt-1