How can I further optimise my code?I’ve got several TLE’S in it.I have used Rabin-Miller primality testing.Here’s my link to code:
Your function for Multiplication is taking logn time that’s why it is giving TLE…
I had also same problem when I was solving This problem . But after checking other solutions I found that we can multiply two numbers in constant time .
You can see my solution here http://www.codechef.com/viewsolution/2911366