2 Test Cases are not working. (Pythagoras Triplet)

I have written the code for Pythagoras Triplet. It seems correct to me, and the given test cases are running. However, when I’m submitting the code,2 out of 5 test cases are showing incorrect answer. Can you please tell me what is the problem with my code? The link for code is-


I am also posting my code below-

#include
#include<math.h>
using namespace std;
int main()
{
int n,a,b,c1,c2;
cin>>n;
if(n%2==0)
{
a=n/2;
b=1;
c1=pow(a,2)-1;
c2=pow(a,2)+1;
if((c1==0)||((pow(c1,2)+pow(n,2))!=pow(c2,2)))
cout<<"-1";
else
cout<<pow(a,2)-1<<" “<<pow(a,2)+1;
}
else
{
a=(n+1)/2;
if(a<0)
a=-a;
b=(n-1)/2;
if(b<0)
b=-b;
c1=2ab;
c2=pow(a,2)+pow(b,2);
if((c1==0)||((pow(c1,2)+pow(n,2))!=pow(c2,2)))
cout<<”-1";
else
cout<<2ab<<" "<<pow(a,2)+pow(b,2);
}
}

Firstly Keshav, no need to calculate so many conditions, simply calculate c1 and c2, and then print them. Secondly, in your code, you havent used any condition for n=1, or n=2, try to use their condition as well.

This is the corrected code, which is working on sample input, try to work more on your approach of this code and then try to submit it

I edited my code but still when I’m submitting it, 2 test cases are wrong. Please help.
This is my new code-

I have corrected your code a little bit, try to submit it now

I submitted this code as well. But, still 2 test cases are now working (it’s showing wrong answer).