Change type of v,t from long double to long long.
Taking 10^5 long double as input via cin will give TLE (personal experience ).
btw I submitted your code by just changing “ld” to “long long” and it passed:
https://www.codechef.com/submit/complete/50137193
this might also be the problem, thanks for the insight.
But changing endl → ‘\n’ also worked for me.