```
class Solution{
public:
bool judgeSquareSum(int c){
for(int i = 0; i <= sqrt(c); i++){
int sum_left = (c - i*i);
if(sqrt(sum_left) == floor(sqrt(sum_left))){
for(int j = i; j <= sqrt(sum_left); j++){
if(i*i + j*j > c)
break;
if(i*i + j*j == c)
return true;
}
}
}
return false;
}
};
```