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# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            input_iter = LazyLoadAllLines();
            //------------------------------------------------//
            //var n = Read<long>();
            //var s = Read();
            //var als = Read<long>(n);
            //var sls = Read(n);
            //List<List<long>> abls = new List<List<long>>();
            //List<long> cls = new List<long>();
            /*List<long> edgeNum = Enumerable.Repeat(0L, (int)n).ToList();
            for (int i = 0; i < n - 1; ++i)
            {
                abls.Add(Read<long>(2));
                abls[i].Add(i);
                abls[i].Add(-1);
                --abls[i][0];
                --abls[i][1];
                //cls.Add(Read<long>());
                ++edgeNum[(int)abls[i][0]];
                ++edgeNum[(int)abls[i][1]];
            }*/

            //als.Sort((l, r) => (r - l));
            //sls.Sort(StringComparer.OrdinalIgnoreCase);
            // DP?Graph?
            // int -> long
            // 単調数列(上界有)を全探索 -> ボールと仕切り、仕切りの左右のボールの数 (N^M -> N+M C N)


            var x = Read<long>();

            var max = 0L;
            while(max * max * max * max * max < x)
            {
                ++max;
            }

            var alow = max;
            var ahigh = max;
            for (int b = 0; b <= max; b++)
            {
                while(ahigh * ahigh * ahigh * ahigh * ahigh - b * b * b * b * b < x)
                {
                    ++ahigh;
                }
                if(ahigh * ahigh * ahigh * ahigh * ahigh - b * b * b * b * b == x)
                {
                    Console.WriteLine($"{ahigh} {b}");
                    return;
                }

                while (alow * alow * alow * alow * alow + b * b * b * b * b > x)
                {
                    --alow;
                }
                if (alow * alow * alow * alow * alow + b * b * b * b * b == x)
                {
                    Console.WriteLine($"{alow} {-b}");
                    return;
                }
            }

        }

        static IEnumerator<string> input_iter;
        
        static IEnumerator<string> LazyLoadAllLines(bool doSplit = true)
        {
            string line;
            if (doSplit)
            {
                do
                {
                    line = Console.ReadLine();
                    foreach (var s in line.Split(' '))
                        yield return s;
                } while (line != null);
            }
            else
            {
                do
                {
                    line = Console.ReadLine();
                    yield return line;
                } while (line != null);
            }
        }
        // single 1 elem.
        static _T Read<_T>() where _T : struct
        {
            input_iter.MoveNext();
            return (_T)Convert.ChangeType(input_iter.Current, typeof(_T));
        }
        static string Read()
        {
            input_iter.MoveNext();
            return input_iter.Current;
        }
        // single n-elems.
        static List<_T> Read<_T>(long num) where _T : struct
        {
            List<_T> res = new List<_T>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add((_T)Convert.ChangeType(input_iter.Current, typeof(_T)));
            }
            return res;
        }
        static List<string> Read(long num)
        {
            List<string> res = new List<string>();
            for (long i = 0; i < num; ++i)
            {
                input_iter.MoveNext();
                res.Add(input_iter.Current);
            }
            return res;
        }
        // multiple(single type) n-elems. (Range, Edge etc.)
        static List<List<_T>> Read<_T>(long elemNum, long typeNum, bool toSort = false) where _T : struct
        {
            List<List<_T>> res = new List<List<_T>>();
            for (int i = 0; i < elemNum; ++i)
            {
                var elem = Read<_T>(typeNum);
                if (toSort) elem.Sort();
                res.Add(elem);
            }
            return res;
        }
        // multiple(multiple type) n-elems.
        static List<(_T1, _T2)> Read<_T1, _T2>(long num) where _T1 : struct where _T2 : struct
        {
            List<(_T1, _T2)> res = new List<(_T1, _T2)>();
            for (int i = 0; i < num; ++i)
            {
                res.Add((Read<_T1>(), Read<_T2>()));
            }
            return res;
        }
        static List<(_T1, _T2, _T3)> Read<_T1, _T2, _T3>(long num) where _T1 : struct where _T2 : struct where _T3 : struct
        {
            List<(_T1, _T2, _T3)> res = new List<(_T1, _T2, _T3)>();
            for (int i = 0; i < num; ++i)
            {
                res.Add((Read<_T1>(), Read<_T2>(), Read<_T3>()));
            }
            return res;
        }

        static void Swap<_T>(ref _T l, ref _T r)
        {
            _T temp = l;
            l = r;
            r = temp;
        }

        public class PriorityQueue<T> : IEnumerable<T>
        {
            private readonly List<T> _data = new List<T>();
            private readonly IComparer<T> _comparer;
            private readonly bool _isDescending;

            public PriorityQueue(IComparer<T> comparer, bool isDescending = true)
            {
                _comparer = comparer;
                _isDescending = isDescending;
            }

            public PriorityQueue(Comparison<T> comparison, bool isDescending = true)
                : this(Comparer<T>.Create(comparison), isDescending)
            {
            }

            public PriorityQueue(bool isDescending = true)
                : this(Comparer<T>.Default, isDescending)
            {
            }

            public void Enqueue(T item)
            {
                _data.Add(item);
                var childIndex = _data.Count - 1;
                while (childIndex > 0)
                {
                    var parentIndex = (childIndex - 1) / 2;
                    if (Compare(_data[childIndex], _data[parentIndex]) >= 0)
                        break;
                    Swap(childIndex, parentIndex);
                    childIndex = parentIndex;
                }
            }

            public T Dequeue()
            {
                var lastIndex = _data.Count - 1;
                var firstItem = _data[0];
                _data[0] = _data[lastIndex];
                _data.RemoveAt(lastIndex--);
                var parentIndex = 0;
                while (true)
                {
                    var childIndex = parentIndex * 2 + 1;
                    if (childIndex > lastIndex)
                        break;
                    var rightChild = childIndex + 1;
                    if (rightChild <= lastIndex && Compare(_data[rightChild], _data[childIndex]) < 0)
                        childIndex = rightChild;
                    if (Compare(_data[parentIndex], _data[childIndex]) <= 0)
                        break;
                    Swap(parentIndex, childIndex);
                    parentIndex = childIndex;
                }
                return firstItem;
            }

            public T Peek()
            {
                return _data[0];
            }

            public void Clear()
            {
                _data.Clear();
            }

            private void Swap(int a, int b)
            {
                var tmp = _data[a];
                _data[a] = _data[b];
                _data[b] = tmp;
            }

            private int Compare(T a, T b)
            {
                return _isDescending ? _comparer.Compare(b, a) : _comparer.Compare(a, b);
            }

            public int Count => _data.Count;

            public IEnumerator<T> GetEnumerator()
            {
                return _data.GetEnumerator();
            }

            IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
        }

    }
}