How can I further optimise my code?I've got several TLE'S in it.I have used RabinMiller primality testing.Here's my link to code: asked 16 Apr '14, 19:53

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 answered 18 Apr '14, 18:10
