Language: C++

/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

int64_t MyPow(const int64_t a, const int64_t b) {
  if (b == 0LL) {
    return 1LL;
  } else if (b == 1LL) {
    return a;
  } else if (a == 1LL) {
    return 1LL;
  }
  int64_t result = MyPow(a * a, b / 2LL);
  if (b % 2LL == 1LL) {
    result *= a;
  }
  return result;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int64_t result = 1LL;
  int64_t N, P;
  cin >> N >> P;
  int64_t max_a = max(10LL, static_cast<int64_t>(pow(static_cast<double>(P), 1.0 / static_cast<double>(N))));
  for (int64_t a = max_a; a >= 2LL; --a) {
    if (P % a == 0LL) {
      const int64_t a_n = MyPow(a, N);
      if (P % a_n == 0LL) {
        result = a;
        break;
      }
    }
  }
  cout << result << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:22: error: no matching function for call to 'max(long long int, int64_t)'
   34 |   int64_t max_a = max(10LL, static_cast<int64_t>(pow(static_cast<double>(P), 1.0 / static_cast<double>(N))));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:34:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'})
   34 |   int64_t max_a = max(10LL, static_cast<int64_t>(pow(static_cast<double>(P), 1.0 / static_cast<double>(N))));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:34:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |   int64_t max_a = max(10LL, static_cast<int64_t>(pow(static_cast<double>(P), 1.0 / static_cast<double>(N))));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~