Code works in local machine but gives TLE on Codechef

Hey all,

The problem : Transform the Expression
My, slightly unusual, solution : CodeChef: Practical coding for everyone

Sample testcases passes correctly on my local machine ( Clang compiler ) but compiling the same code with sample testcases give me TLE. Can anyone tell me why this is happening?