Two squares or not two squares - constant time optimization
llu root = sqrtl(n); is not safe.  The precision of a long double is not specified by C to give the exact correct answer for all unsigned long long.
Not sure yet why you get TLE (Time Limit Exceeded).  As the page you point to only has 10 small integers to test, there must be horribly wrong with your compilation or yu have an unstated interesting input.
Spent 30 minutes tracking down a bug because I forgot to a braces when extending the following.  Instead, highly reccomend to add breaces in all for(), if(), etc. except maybe in the the most trivial circumstance.

for(i=0;i*i&lt;n/2+1;++i)
  if(isSquare(n-i*i)) 
    return 1;

// Better
for(i=0;i*i&lt;n/2+1;++i) {
  if(isSquare(n-i*i)) {
    return 1;
  }
}