Code works in local machine but gives TLE on Codechef

Hey all,

The problem : Transform the Expression
My, slightly unusual, solution : Solution: 48114558 | CodeChef

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?