Expedition SPOJ

The code in this video gives wrong answer on spoj.