<p>Given a non-negative integer <code>c</code>, decide whether there&#39;re two integers <code>a</code> and <code>b</code> such that <code>a<sup>2</sup> + b<sup>2</sup> = c</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> c = 5
<strong>Output:</strong> true
<strong>Explanation:</strong> 1 * 1 + 2 * 2 = 5
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> c = 3
<strong>Output:</strong> false
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>0 &lt;= c &lt;= 2<sup>31</sup> - 1</code></li>
</ul>

typedef long long int ll;

unordered_set<ll> ms;

class Solution {


public:

    Solution() {
        ll v = 1L<<31;
        v = v-1;
        for( ll i=0; i*i<=v; i++) {
            ms.insert(i*i);
        }
    }


    bool judgeSquareSum(int c) {
        for( ll i=0; i*i<=c; i++) {
            if(ms.find(c-i*i)!=ms.end()) {
                return true;
            }
        }
        return false;
    }   
};
12400