I can’t figure out where my code fails… have used segmented sieve :\
http://www.codechef.com/viewsolution/4178405