Same code running in Spoj but giving TLE in codechef

this is the solution to prime1. Its getting accepted at spoj(2.7 seconds) but codechef is giving TLE!!! i have also tried fast output optimisation in codechef.can anyone please figure out the reason?

this is my codechef submission history i am getting TLE with JAVA but AC with C++4.3
but getting AC on SPOJ with JAVA why? code is same!

everything is same eg. constraints time limit etc. on SPOJ


I think the major reason is the cluster used by the two sites. By cluster I mean, the processor speed and number of calculations per second the online judge can perform. Spoj uses a much faster cluster “CUBE” than codechef which probably uses “PYRAMID”. I have also seen the difference in time limit for the AC solutions on spoj and codechef… AC solutions on spoj are always much faster than the AC solutions in codechef.