Language: C++

#include "bits/stdc++.h"
/* Properties of modulo:
	(a/b)%m ,where m is prime  = (a%m) * (b^(m-2))%m
*/
    /*ROLLING HASH
    Rabin-Karp algorithm for pattern matching in a string in O(n) time
    Calculating the number of different substrings of a string in O(n2logn)
    Calculating the number of palindromic substrings in a string.
    */
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define pb push_back
#define gcd __gcd
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
//template<typename T>
//#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
// o_set(ll) name ; -- defining ordered set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set - returns iterator
bool compare(ll a, ll b){
    return a > b;
}
ll power(ll x, ll ex ) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x);
        ex >>= 1ll;
        x = (x * x) ;
    }
    return ans;
}
void solve(){
    ll x;
    cin >> x;
    bool flag = true;
    ll a1 = LLONG_MIN , b1 =LLONG_MIN , a2 = LLONG_MIN , b2 =LLONG_MIN;
    for(ll i = 1 ; i <= sqrt(x) ; i++){
        a1 = LLONG_MIN , b1 =LLONG_MIN , a2 = LLONG_MIN , b2 =LLONG_MIN;
        if(i != sqrt(x)){
            if(x%i ==0 ){
                flag = true;
                ll k = i;
                ll y = x/i;
                ll a = (power(k,4) + 4*y)/5;
                if(a >= 0 && ((power(k,5) + 4*y)%5 != 0)) flag = false;
                if(flag){
                    ll dis = sqrt(a);
                    if(dis * dis != a) flag = false;
                    if(flag){
                        ll p12 = -(k*k) - dis;
                        ll p22 = -(k*k) + dis;
                        if(p12%2 != 0 && p22%2!=0 ) flag = false;
                    }
                    if(flag){
                        ll p1 = p12/2;
                        ll p2 = p22/2;
                        if(p1*2 == p12){
                            ll dif1 = k;
                            ll sum1 = 0;
                            ll sum1sq = dif1*dif1 + 4*p1;
                            sum1 = sqrt(sum1sq);
                            if(sum1*sum1 == sum1sq){
                                a1 = (sum1 + dif1);
                                b1 = (sum1 - dif1);
                                if(a1%2 ==0 && b1%2 ==0 ){
                                    a1 = a1/2;
                                    b1 = b1/2;
                                    break;
                                }
                            }
                        }
                        if(p2*2 == p22){
                            ll dif2 = k;
                            ll sum2 = 0;
                            ll sum2sq = dif2*dif2 + 4*p2;
                            sum2 = sqrt(sum2sq);
                            if(sum2*sum2 == sum2sq){
                                a2 = (sum2 + dif2);
                                b2 = (sum2 - dif2);
                                if(a2%2 == 0 && b2%2 ==0 ){
                                    a2 = a2/2;
                                    b2 = b2/2;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            if(x%i ==0 ){
                flag = true;
                ll k = x/i;
                ll y = i;
                ll a = (power(k,4) + 4*y)/5;
                if(a >= 0 && ((power(k,5) + 4*y)%5 != 0)) flag = false;
                if(flag){
                    ll dis = sqrt(a);
                    if(dis * dis != a) flag = false;
                    if(flag){
                        ll p12 = -(k*k) - dis;
                        ll p22 = -(k*k) + dis;
                        if(p12%2 != 0 && p22%2!=0 ) flag = false;
                    }
                    if(flag){
                        ll p1 = p12/2;
                        ll p2 = p22/2;
                        if(p1*2 == p12){
                            ll dif1 = k;
                            ll sum1 = 0;
                            ll sum1sq = dif1*dif1 + 4*p1;
                            sum1 = sqrt(sum1sq);
                            if(sum1*sum1 == sum1sq){
                                a1 = (sum1 + dif1);
                                b1 = (sum1 - dif1);
                                if(a1%2 ==0 && b1%2 ==0 ){
                                    a1 = a1/2;
                                    b1 = b1/2;
                                    break;
                                }
                            }
                        }
                        if(p2*2 == p22){
                            ll dif2 = k;
                            ll sum2 = 0;
                            ll sum2sq = dif2*dif2 + 4*p2;
                            sum2 = sqrt(sum2sq);
                            if(sum2*sum2 == sum2sq){
                                a2 = (sum2 + dif2);
                                b2 = (sum2 - dif2);
                                if(a2%2 == 0 && b2%2 ==0 ){
                                    a2 = a2/2;
                                    b2 = b2/2;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
        else if((i == sqrt(x)) && (sqrt(x)*sqrt(x) == x)){
             if(x%i ==0 ){
                flag = true;
                ll k = x/i;
                ll y = i;
                ll a = (power(k,4) + 4*y)/5;
                if(a >= 0 && ((power(k,5) + 4*y)%5 != 0)) flag = false;
                if(flag){
                    ll dis = sqrt(a);
                    if(dis * dis != a) flag = false;
                    if(flag){
                        ll p12 = -(k*k) - dis;
                        ll p22 = -(k*k) + dis;
                        if(p12%2 != 0 && p22%2!=0 ) flag = false;
                    }
                    if(flag){
                       ll p1 = p12/2;
                        ll p2 = p22/2;
                        if(p1*2 == p12){
                            ll dif1 = k;
                            ll sum1 = 0;
                            ll sum1sq = dif1*dif1 + 4*p1;
                            sum1 = sqrt(sum1sq);
                            if(sum1*sum1 == sum1sq){
                                a1 = (sum1 + dif1);
                                b1 = (sum1 - dif1);
                                if(a1%2 ==0 && b1%2 ==0 ){
                                    a1 = a1/2;
                                    b1 = b1/2;
                                    break;
                                }
                            }
                        }
                        if(p2*2 == p22){
                            ll dif2 = k;
                            ll sum2 = 0;
                            ll sum2sq = dif2*dif2 + 4*p2;
                            sum2 = sqrt(sum2sq);
                            if(sum2*sum2 == sum2sq){
                                a2 = (sum2 + dif2);
                                b2 = (sum2 - dif2);
                                if(a2%2 == 0 && b2%2 ==0 ){
                                    a2 = a2/2;
                                    b2 = b2/2;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if(a1 != LLONG_MIN && b1 != LLONG_MIN) cout << a1 << " " << b1 << endl;
    else  cout << a2 << " " << b2 << endl;
}
int main(){
    IOS;
    ll T=1;
    //cin>>T;
    ll t=0;
    while(t++<T){
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:67:33: error: 'p12' was not declared in this scope; did you mean 'p1'?
   67 |                         ll p1 = p12/2;
      |                                 ^~~
      |                                 p1
a.cc:68:33: error: 'p22' was not declared in this scope; did you mean 'p2'?
   68 |                         ll p2 = p22/2;
      |                                 ^~~
      |                                 p2
a.cc:117:33: error: 'p12' was not declared in this scope; did you mean 'p1'?
  117 |                         ll p1 = p12/2;
      |                                 ^~~
      |                                 p1
a.cc:118:33: error: 'p22' was not declared in this scope; did you mean 'p2'?
  118 |                         ll p2 = p22/2;
      |                                 ^~~
      |                                 p2
a.cc:169:32: error: 'p12' was not declared in this scope; did you mean 'p1'?
  169 |                        ll p1 = p12/2;
      |                                ^~~
      |                                p1
a.cc:170:33: error: 'p22' was not declared in this scope; did you mean 'p2'?
  170 |                         ll p2 = p22/2;
      |                                 ^~~
      |                                 p2