Codeshow TLE

codeshow
comparison
difference
tle

#1

Ac solution - http://www.codechef.com/viewsolution/6351130
TLE solution - http://www.codechef.com/viewsolution/6352489
Problem Statement - http://www.codechef.com/problems/CDSW154

Why 1st solution is accepted while 2nd is giving TLE , though both are same ???