A square triple (a,b,c) is a triple where a, b, and c are integers and a2 + b2 = c2.

Given an integer n, return the number of square triples such that 1 &lt;= a, b, c &lt;= n.

&nbsp;
Example 1:

Input: n = 5
Output: 2
Explanation: The square triples are (3,4,5) and (4,3,5).


Example 2:

Input: n = 10
Output: 4
Explanation: The square triples are (3,4,5), (4,3,5), (6,8,10), and (8,6,10).


&nbsp;
Constraints:


	1 &lt;= n &lt;= 250


class Solution:
    def countTriples(self, n: int) -> int:
        c = 0
        for i in range(1, n+1):
            for j in range(i+1, n+1):
                sq = i*i + j*j
                r = int(sq ** 0.5)
                if ( r*r == sq and r <= n ):
                    c +=2
        return c
class Solution {
    public int countTriples(int n) {
        int c = 0;
        for(int i=1 ; i<=n ; i++){
            for(int j=i+1 ; j<=n ; j++){
                int sq = ( i * i) + ( j * j);
                int r = (int) Math.sqrt(sq);
                if( r*r == sq && r <= n )
                    c += 2;
            }
        }
        return c;
    }
}
class Solution {
public:
    int countTriples(int n) {
        int res = 0;
        for (int a = 3, sqa; a < n; a++) {
            sqa = a * a;
            for (int b = 3, sqc, c; b < n; b++) {
                sqc = sqa + b * b;
                c = sqrt(sqc);
                if (c > n) break;
                res += c * c == sqc;
            }
        }
        return res;
    }
};
var countTriples = function(n) {
    let count = 0;
    for (let i=1; i < n; i++) {
        for (let j=1; j < n; j++) {
            let root = Math.sqrt(j*j + i*i)
            if (Number.isInteger(root) && root <= n) {
                count++
            }
        }
    }

    return count
};
Count Square Sum Triples