Problem:
Score : 400 points

Problem Statement

Give a pair of integers (A, B) such that A^5-B^5 = X.
It is guaranteed that there exists such a pair for the given integer X.

Constraints

1 \leq X \leq 10^9

X is an integer.

There exists a pair of integers (A, B) satisfying the condition in Problem Statement.

Input

Input is given from Standard Input in the following format:

X

Output

Print A and B, with space in between.
If there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.

A B

Sample Input 1

33

Sample Output 1

2 -1

For A=2 and B=-1, A^5-B^5 = 33.

Sample Input 2

1

Sample Output 2

0 -1

Solution in C++ (GCC 9.2.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;
template<typename T>
map<T, ll> prime_factorize(T x){
  map<T, ll> res;
  while(x%2==0){
    x/=2;
    res[2]++;
  }
  for(ll i=3;i*i<=x;i+=2){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}

int main(){
  cout << setprecision(10);
  ll X;
  cin >> X;
  
  ll A,B;
  ll ans_a;
  for(B = -100; B <= 100; B++){
    A = X + B*B*B*B*B;
    ans_a = 1;
    // cerr << "A: " << A << " B: " << B  << endl;

    if(A == 0){
      ans_a = 0;
      break;
    } else if(A==1){
      ans_a = 1;
      break;
    } else { 
      auto a = prime_factorize(A);
      bool flg = true;
      for(auto x: a){
        if(x.second % 5 != 0){
          flg = false;
          break;
        } else { 
          ll tmp = x.second / 5;
          ans_a *= x.first * tmp;
        }
      }
      if(flg){
        break;
      } 

    }
  }
  cout << ans_a << " " << B << endl;
}