C. Pythagorean Triples ~直角三角形・ピタゴラスの定理~

f:id:peroon:20201204065235p:plain

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll n;cin>>n;

    if(n==1 or n==2){
      p(-1);return 0;
    }

    ll a,b;
    if(n%2==0){
      a = 2+n*n/2; a/=2;
      b = a-2;
    }
    else{
      a = 1+n*n; a/=2;
      b = a-1;
    }
    p2(a,b);

    VI A = {n,a,b};
    SORT(A);
    assert(A[0]*A[0] + A[1]*A[1] == A[2]*A[2]);
    
    return 0;
}