About the challenge

bro. Are you there?
correct or update my code bro

Working on it … Keep patience :slight_smile:

ok bro
after that i send my previous doubt to you

#include <iostream>
#include<cmath>
using namespace std;
int main() {
    long long x; //made long long because n^2 can overflow
    long long y;
    long long z;
    cin>>x;
	if(x < 3){ cout<<-1; } //base case
    else if(x%2!=0) //else
    {
        y=((long double)x*x*0.5)+0.5; //typecasted to long double for proper caluclations
        z=((long double)x*x*0.5)-0.5;
        cout<<z<<" "<<y;
    }
    else
    {
    y=pow(x*0.5,2)+1;
    z=pow(x*0.5,2)-1;
    cout<<z<<" "<<y;
}

}
```

Can u help me in understanding this

Bro what are you not able to understand in above code(written by you)
I just changed the datatyoes

Bro you are saying we are using long long because x^2 can be overflow but how?

x can be max 10^9 so X^2 can be 10^18 and integer can hold at max 2147483647

((long double)xx0.5)+0.5;
Isme long double kese help karega proper calculation me

Here x was long long but 0.5 is float so multiplying them will result in float
So it will again overflow so hence we typecast x to long double so that their product remains long double

Bro i said u to change the logic because i want output of 9 as 12 and 15 not 40 amd 41

Bro 9^2+40^2 =41^2…

This question was based on the formula (2m,m^2-1,m^2+1) ,I dont think its possible to print 9 12 15 without exhaustive search .

bro we can store 10 ^9 values in integer ryt

Yes u can but when u do x*x it will become 10^18 in this case and type remains int so hence it overflows.