fun main() { val builder = StringBuilder() val mod = 1000000007L val (n, z) = readInputLine().split(" ").map { it.toLong() } val zPow = pow(z, n, mod) for (x in LongRange(1L, 10000L)) { val xPow = pow(x, n, mod) if (xPow > zPow) { break } for (y in LongRange(1L, 10000L)) { val yPow = pow(y, n, mod) if (xPow + yPow > zPow) { break } if (xPow + yPow == zPow) { println("Yes") return } } } builder.appendln("No") print(builder.toString()) } fun readInputLine(): String { return readLine()!! } fun pow(x: Long, n: Long, mod: Long): Long { var ret = 1L var base = x var nTmp = n while (nTmp != 0L) { if (nTmp % 2L != 0L) { ret = ret * base % mod } base = base * base % mod nTmp /= 2L } return ret }