Problem:
Score : 300 points

Problem Statement

There are N integers a_1, a_2, ..., a_N not less than 1.
The values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \times a_2 \times ... \times a_N = P.

Find the maximum possible greatest common divisor of a_1, a_2, ..., a_N.

Constraints

1 \leq N \leq 10^{12}

1 \leq P \leq 10^{12}

Input

Input is given from Standard Input in the following format:

N P

Output

Print the answer.

Sample Input 1

3 24

Sample Output 1

2

The greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.

Sample Input 2

5 1

Sample Output 2

1

As a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.

Sample Input 3

1 111

Sample Output 3

111

Sample Input 4

4 972439611840

Sample Output 4

206

Solution in Go (1.6) (judge verdict: Wrong Answer)

package main

import (
	"bufio"
	"math"
	"os"
	"strconv"
)

type Point struct {
	T int
	X int
	Y int
}

func main() {
	s := IOInitialize()
	N := Int(s)
	P := Int(s)
	if N == 1 {
		print(P)
		return
	}
	n := int(math.Sqrt(float64(P)))
	for i := n; i > 0; i-- {
		_num := P
		cnt := 0
		for {
			if _num%i == 0 {
				_num = _num / i
				cnt++
			} else {
				break
			}
			if cnt >= N {
				print(i)
				return
			}
		}
	}

	/*
		n := sqrt(P)
		points := scanNums(s, N)
		currentPoint := Point{T: 0, X: 0, Y: 0}
		for _, point := range points {
			dis := abs(abs(currentPoint.X-point.X) + abs(currentPoint.Y-point.Y))
			tDiff := point.T - currentPoint.T
			if dis > tDiff || tDiff%2 != dis%2 {
				fmt.Println("No")
				return
			}
		}
		fmt.Println("Yes")
	*/
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func scanNums(s *bufio.Scanner, len int) (points []Point) {
	points = []Point{}
	for i := 0; i < len; i++ {
		t := Int(s)
		x := Int(s)
		y := Int(s)
		points = append(points, Point{T: t, X: x, Y: y})
	}
	return
}

/*
import math

N, P = map(int, input().split())
if N == 1:
    print(P)
    exit()

n = int(math.sqrt(P))
for i in range(n)[::-1]:
    if i == 0:
        break
    _num = P
    cnt = 0
    while True:
        if _num % i == 0:
            _num = _num / i
            cnt += 1
        else:
            break
        if cnt >= N:
            print(i)
            exit()
print(1)
*/