Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(s,i, n) for (int i = (int)s; i < (int)(n); i++)
#define pb push_back
typedef long long ll;



int main(){
    ll x;
    cin>>x;
    
    for(ll i=1;i*i<=x;i++){
        if(x%i==0){
            ll xx=i,yy=x/i;
            for(ll j=1;j*j<=xx;j++){
                if(xx%j==0){
                    if((j+xx/j)%2==0){
                        ll a=(j+xx/j)/2;
                        ll b=j-a;
                        if(a*a*a+a*a*b*b-b*b*b==yy){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                    }
                    if((-j+xx/j)%2==0){
                        a=(-j+xx/j)/2;
                        b=-j-a;
                        if(a*a*a+a*a*b*b-b*b*b==-yy){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                    }
                    if((-j+xx/j)%2==0){    
                        a=(j-xx/j)/2;
                        b=-j-a;
                        if(a*a*a+a*a*b*b-b*b*b==-yy){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                        a=(-j-xx/j)/2;
                        b=-j-a;
                        if(a*a*a+a*a*b*b-b*b*b==yy){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                    }

                }
            }
            for(ll j=1;j*j<=yy;j++){
                if(yy%j==0){
                    if((j+yy/j)%2==0){
                        ll a=(j+yy/j)/2;
                        ll b=j-a;
                        if(a*a*a+a*a*b*b-b*b*b==xx){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                        a=(-j+yy/j)/2;
                        b=-j-a;
                        if(a*a*a+a*a*b*b-b*b*b==-xx){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                        a=(j-yy/j)/2;
                        b=-j-a;
                        if(a*a*a+a*a*b*b-b*b*b==-xx){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                        a=(-j-yy/j)/2;
                        b=-j-a;
                        if(a*a*a+a*a*b*b-b*b*b==xx){
                            cout<<a<<" "<<b<<endl;
                            return 0;
                        }
                    }
                }
            }

            
        }
    }
    

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: 'a' was not declared in this scope
   28 |                         a=(-j+xx/j)/2;
      |                         ^
a.cc:29:25: error: 'b' was not declared in this scope
   29 |                         b=-j-a;
      |                         ^
a.cc:36:25: error: 'a' was not declared in this scope
   36 |                         a=(j-xx/j)/2;
      |                         ^
a.cc:37:25: error: 'b' was not declared in this scope
   37 |                         b=-j-a;
      |                         ^