The question was very simple and most of the people must have figured it out within a minute but got TLE due to not using fast IO or using endl instead of ‘\n’.
Such tasks are given on CodeForces, Atcoder too but they explicitly mention to use fast IO, however there is no such instruction on CodeChef contests. This is not the first time it has happened. I have faced the same issue in the following problem from April Cook Off 21.
I request codechef admin to look into it.