Pythagorean Triplet

#include
using namespace std;
int main() {
int N,m,n;
cin>>N;
if(N==1||N==2)
cout<<"-1"<<endl;
else if(N%2==0){
m=N/2;
n=1;
cout<<mm-nn<<" β€œ<<mm+nn<<endl;
}
else{
m=(N+1)/2;
n=(N-1)/2;
cout<<2mn<<” "<<mm+nn<<endl;
}

return 0;

}

For this question, I was able to pass only 3 test cases out of 5. 2 were showing wrong answer. Is there any problem with my code?

hello @diganta_7777

pls share ur code by saving it here-> https://ide.codingblocks.com/

@diganta_7777

check now->

Yes it worked! But since the constraint said N<=10^9, why should I use long long? Since int can take till 10^9.

multiplication can go upto 10^18 (n*n)

thats why

So even if there is no explicit mention of type in cout, an int and int will give int only? So if there are 2 floats, their product will also be a float and not double(if I am not storing it in variable)?

yeah correct… . . . . .

OK! Thanks! .