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 Kotlin (1.3.71) (judge verdict: Wrong Answer)

//package abc166.D

import java.io.*
import java.math.*
import java.util.*
import kotlin.math.*

var reader: BufferedReader = System.`in`.bufferedReader()
var writer: PrintWriter = PrintWriter(System.`out`)

fun next() = reader.readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextStrings() = next().split(" ")
fun nextInts() = nextStrings().map { it.toInt() }
fun nextLongs() = nextStrings().map { it.toLong() }
fun nextDoubles() = nextStrings().map { it.toDouble() }

fun put(v: Any?) = writer.print(v)
fun puts() = writer.println()
fun puts(v: Any?) = writer.println(v)

var debug = false
fun dp(v: Any?) {
    if (debug) println(v)
}
fun dp() {
    if (debug) println()
}

fun test(case: Int, input: String, expected: String) {
    reader = input.trimIndent().reader().buffered()

    val stringWriter = StringWriter()
    writer = PrintWriter(stringWriter)

    solve()
    writer.flush()

    val actual = stringWriter.toString()

    println("[test $case]")
    if ("${expected}" == actual) {
        println("OK")
    } else {
        println("NG")
        println()
        println("expected: \"${expected}\"")
        println("actual:   \"${actual}\"")
    }
    println()
}

@Suppress("UNUSED_PARAMETER")
fun xtest(case: Int, input: String, expected: String) {}

fun main(args: Array<String>) {
    if ((args.size == 1) && (args[0] == "test")) {
        testAll()
    } else {
        solve()
        writer.flush()
    }
}

///////////////////////////////////////////////////////////

fun testAll() {
    debug = true

    test(1,
    """
    33
    """,
    "2 -1"
    )
    test(2,
    """
    1
    """,
    "0 -1")
}

fun pow5(value: Int): Int {
    var v = value
    var vv = v*v
    return vv * vv * v
}

fun doSolve(): Pair<Int, Int> {
    val X = nextInt()

    for (a in 0..100) {
        val a5 = pow5(a)
        val b5 = a5 - X
        //dp("$a $a5 $b5")

        var l = -100
        var u = 100
        while (l <= u) {
            var m = (l+u)/2
            var m5 = pow5(m)

            //dp("[$l, $u]: $m5($m) <==> $b5")

            if (b5 == m5) {
                return Pair(a, m)
            } else if (b5 < m5) {
                u = m - 1
            } else {
                l = m + 1
            }
        }
    }

    return Pair(0,0)
}

fun solve() {
    val (a, b) = doSolve()
    put("$a $b")
}