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"
#include <string>
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const double PI = acos(-1.0);
const int MOD = (int)pow(10, 9) + 7;

#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define all(v) v.begin(), v.end()
#define Ini(a) ll a; cin >> a;
#define Ind(a) double a; cin >> a;
#define Ins(a) string a; cin >> a;

ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

inline void finish() {
	cout << -1 << endl;
	exit(0);
}

template <typename T>
inline void debug(vector<T> v) {
	if (v.size() == 0) {
		cout << "[]" << endl;
		return;
	}
	cout << "[";
	for (size_t i = 0; i < v.size() - 1; ++i) {
		cout << v[i] << ", ";
	}
	cout << v[v.size() - 1] << "]" << endl;
}

class Pos {
public:
	double x, y;
	Pos(double x, double y) {
		this->x = x;
		this->y = y;
	}
	Pos() {
		x = 0.0;
		y = 0.0;
	}

	bool isSamePos(Pos pos1, Pos pos2) {
		if (pos1.x == pos2.x && pos1.y == pos2.y) {
			return true;
		}
		return false;
	}
};

class Mod {
public:
	static inline ll Add(ll a, ll b) {
		return (a + b) % MOD;
	}

	static inline ll Sub(ll a, ll b) {
		ll ans = (a - b) % MOD;
		return (ans < 0) ? (ans + MOD) : ans;
	}

	static inline ll Mul(ll a, ll b) {
		return (a * b) % MOD;
	}
	
	static inline ll Div(ll a, ll b) {
		return (a % MOD) * modinv(b, MOD) % MOD;
	}
};

inline double distance(Pos p1, Pos p2) {
	return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
}

inline ull Kaijo(int n) {
	ull ans = 1;
	for (int i = 2; i <= n; ++i) {
		ans *= i;
	}
	return ans;
}

template <typename T>
inline int GetKeta(T num) {
	return to_string(num).length();
}

void Main();
inline void DebugMain() {
	while (true) {
		Main();
		cout << endl;
	}
}

int main() {
	bool debug = false;
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	if (debug) {
		cout << "\x1b[41m" << "Debug Mode このまま提出すると死" << endl;
	}
	try {
		(debug) ? DebugMain() : Main();
	}
	catch (exception& e) {
		cout << e.what() << endl;
	}
	return 0;
}

template <typename T>
inline bool isExistArray(vector<T>& v, T& str) {
	if (v.size() == 0) {
		return false;
	}
	for (string& s : v) {
		if (s == str) {
			return true;
		}
	}
	return false;
}

inline int ctoi(char c) {
	return (int)c - 48;
}

inline int find(vector<int>& v, int n) {
	for (int i = 0; i < v.size(); ++i) {
		if (v[i] == n) {
			return i;
		}
	}
	return -1;
}

inline bool isSameArray(vector<int>& v1, vector<int>& v2) {
	for (int i = 0; i < v1.size(); ++i) {
		if (v1[i] != v2[i]) {
			return false;
		}
	}
	return true;
}

inline bool isSeisu(double n) {

	if (std::floor(n) == n) {
		return true;
	}
	return false;
}

int gcd(int a, int b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

int lcm(int a, int b)
{
	return a * b / gcd(a, b);
}

inline ll Kiriage(ll a, ll b) {
	return (a + (b - 1)) / b;
}

template<class T>
inline void container_sort(std::vector<T>& v) {
	std::sort(v.begin(), v.end());
}
template<class T>
inline void container_sort(std::list<T>& v) {
	v.sort();
}


template<class T>
void VecUnique(T& v) {

	container_sort(v);
	v.erase(
		std::unique(
			v.begin(),
			v.end()),
		v.end()
	);
}

inline void Main() {
	//Ini(N);
	//Ini(M);

	//vector<pair<ll, vector<int>>> H(N);
	//for (int i = 0; i < N; ++i) {
	//	Ini(h);
	//	H[i].first = h;
	//}

	//for (int i = 0; i < M; ++i) {
	//	Ini(A);
	//	Ini(B);
	//	A--;
	//	B--;

	//	H[A].second.push_back(B);
	//	H[B].second.push_back(A);

	//	for (int j = 0; j < H[A].second.size(); ++j) {
	//		auto result = std::find(H[B].second.begin(), H[B].second.end(), H[A].second[j]);
	//		if (result != H[B].second.end() && H[B].second[j] != A) {
	//			H[B].second.push_back(H[A].second[j]);
	//		}
	//	}

	//	for (int j = 0; j < H[B].second.size(); ++j) {
	//		auto result = std::find(H[A].second.begin(), H[A].second.end(), H[B].second[j]);
	//		if (result != H[A].second.end() && H[A].second[j] != B) {
	//			H[A].second.push_back(H[B].second[j]);
	//		}
	//	}
	//}



	//int count = 0;
	//for (int i = 0; i < H.size(); ++i) {
	//	bool good = true;
	//	for (int j = 0; j < H[i].second.size(); ++j) {
	//		if (H[i].first <= H[i].second[j]) {
	//			good = false;
	//			break;
	//		}
	//	}
	//	if (good == true) {
	//		count++;
	//	}
	//}

	//cout << count;

	Ini(X);
	for (ll i = 0; i < 100; ++i) {
		for (int k = 0; k < 10000; ++k) {
			ll a = i;
			ll b = i + k;
			if ((ll)pow(a, 5) - (ll)pow(b, 5) == X) {
				cout << a << " " << b;
				return;
			}
		}
		for (int k = 0; k < 10000; ++k) {
			ll a = i;
			ll b = i - k;
			if ((ll)pow(a, 5) - (ll)pow(b, 5) == X) {
				cout << a << " " << b;
				return;
			}
		}
		ll a = i;
		ll b = -i;
		if ((ll)pow(a, 5) - (ll)pow(b, 5) == X) {
			cout << a << " " << b;
			return;
		}
	}

	for (ll i = -100; i < 0; ++i) {
		for (int k = 0; k < 10000; ++k) {
			ll a = i;
			ll b = i + k;
			if ((ll)pow(a, 5) - (ll)pow(b, 5) == X) {
				cout << a << " " << b;
				return;
			}
		}
		for (int k = 0; k < 10000; ++k) {
			ll a = i;
			ll b = i - k;
			if ((ll)pow(a, 5) - (ll)pow(b, 5) == X) {
				cout << a << " " << b;
				return;
			}
		}
		ll a = i;
		ll b = -i;
		if ((ll)pow(a, 5) - (ll)pow(b, 5) == X) {
			cout << a << " " << b;
			return;
		}
	}

}