Help in a problem

I was trying to solve a problem on Spoj

Medium Factorization
http://www.spoj.com/problems/FACTCG2/

but I keep getting TLE
can anyone help?

http://ideone.com/tyJPoC
Topic archived. No new replies allowed.