The program compiles otherwise you'd see a compilation error as a status.
I think the problem is the size of an integer in free pascal. I don't use free pascal myself, so can't really comment, but when I submitted your program as GPC Pascal, it got TLE. In other words, it ran fine, but took too long.
So I changed integers to longints, and re-submitted as free pascal, and got TLE again.
If possible, it's a good idea to use the same compiler at home as you use on SPOJ. I don't, but then I've also been caught out by similar differences between what I use at home (Delphi) and the Pascal I use on SPOJ (GPC).
So now all you've got to do is figure out how to speed it up!
Good luck!