TLE : TEAMSEL : Unusual

Problem: http://www.codechef.com/problems/TEAMSEL

MySolution: http://www.codechef.com/viewplaintext/6822223

Unusual thing is, i tried on my machine with a file containing 100 test cases each containing 100 numbers, this solution is giving answer to this file in under 400 ms.

Am I doing any stupid mistake in i/o ? Please help.