Not passing all test cases what is the error
Pythagorean triplets
This is because your implementation is incorrect. Think this way
If m>n>0 are integers, then (m^2-n^2, 2mn, m^2+n^2) is a Pythagorean triple!
now if given number is even
then 2mn = N
else m^2-n^2 = N
find any integral m and n (m>n) which satisfies above relation, once you get m and n, you also get required triplet