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"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func swap(a int64, b int64) (int64, int64) {
	return b, a
}

func GCD(a int64, b int64) int64 {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return GCD(a%b, b)
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextLong() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(),10,64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func CheckniconiLevel(s []rune) int {
	n := len(s)
	mx := 0
	tmp := 0
	fmt.Printf("%d\n", n)
	for i := 0; i < n-1; i++ {
		if s[i] == '2' && s[i+1] == '5' {
			tmp += 2
			i += 1
			mx = int(math.Max(float64(tmp), float64(mx)))
		} else {
			tmp = 0
		}
	}
	return int(mx)
}

func main() {
	sc.Split(bufio.ScanWords)
	ans := 1
	N := nextLong()
	P := nextLong()
	var times int64
	times=1
	if N==1{
		fmt.Printf("%d\n", P)
		return
	}
	for i:=2; i<=int(math.Sqrt(float64(P)));i++{
		var tmp int64
		tmp=1
		times=0
		for{
			times++
			tmp*=int64(i)
			if tmp*times>=P || times==N-1{
				break
			}
		}
		if(times<=N && P%tmp==0){
		ans = int(math.Max(float64(ans),math.Min(float64(i), float64(GCD(P/tmp,int64(i))))))
		}
	}
	fmt.Printf("%d\n", ans)
}