// My library: https://firiexp.github.io/library/ // template with fastio: https://firiexp.github.io/library/snippets/template.cpp #ifdef LOCAL #undef NDEBUG #elif !defined(NDEBUG) #define NDEBUG #endif #include using namespace std; static const int MOD = 998244353; template constexpr T INF=numeric_limits::max()/32*15+208; using ll = long long; using uint = unsigned; using ull = unsigned long long; constexpr int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1},dx8[8]={1,1,0,-1,-1,-1,0,1},dy8[8]={0,1,1,1,0,-1,-1,-1}; template T ifloor(T x,T y){return x/y-(x%y?(x<0)^(y<0):0);} template T iceil(T x,T y){return x/y+(x%y?(x>=0)^(y<0):0);} template bool chmax(T&a,T b){return a bool chmin(T&a,T b){return a>b?(a=b,1):0;} extern "C" int fileno(FILE *); extern "C" int isatty(int); template struct has_fio_r:false_type{}; template struct has_fio_r().begin()),decltype(declval().end())>>:true_type{}; template struct has_fio_v:false_type{}; template struct has_fio_v().value())>>:true_type{}; template struct has_fio_a:false_type{}; template struct has_fio_a().assign(declval()))>>:true_type{}; template struct has_fio_s:false_type{}; template struct has_fio_s().to_string())>>:true_type{}; template using en_if_t=enable_if_t; template constexpr bool is_rng_v=has_fio_r::value&&!is_same_v,string>; template constexpr bool has_val_v=!is_integral_v&&!is_rng_v&&!is_same_v,string>&&has_fio_v::value; template constexpr bool has_asn_v=!is_integral_v&&!is_rng_v&&!is_same_v,string>&&!has_fio_v::value&&has_fio_a::value; template constexpr bool has_str_v=!is_integral_v&&!is_rng_v&&!is_same_v,string>&&!has_fio_v::value&&has_fio_s::value; struct FastIOTb{char n[40000]{};constexpr FastIOTb(){for(int i=0;i<10000;++i){int x=i;for(int j=3;j>=0;--j)n[i*4+j]=char('0'+x%10),x/=10;}}}; struct Scanner{ static constexpr int B=1<<17,O=64,Q=1024,D=16; char b[B+1]; int I=0,S=0;unsigned char M=isatty(fileno(stdin))?2:0;string nt; __attribute__((always_inline)) static inline uint p8(const char*p){ull x;memcpy(&x,p,8); #if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ x=__builtin_bswap64(x); #endif x-=0x3030303030303030ULL;x=(x*10+(x>>8))&0x00ff00ff00ff00ffULL;x=(x*100+(x>>16))&0x0000ffff0000ffffULL;x=(x*10000+(x>>32))&0xffffffffULL;return (uint)x;} __attribute__((always_inline)) static inline bool d8(const char*p){ull x;memcpy(&x,p,8);return (((x+0x4646464646464646ULL)|(x-0x3030303030303030ULL))&0x8080808080808080ULL)==0;} template __attribute__((noinline)) U lng(char c){const char*p=b+I-1,*e=b+S;U y=0;if(c>='0'&&e-p>=16&&p[15]>='0'&&d8(p)&&d8(p+8)){ y=U(p8(p))*100000000+p8(p+8);p+=16;while(*p>='0')y=U(y*10+(*p&15)),++p;I=(int)(p-b)+1;return y;}while(c>='0')y=U(y*10+(c&15)),c=b[I++];return y;} inline void ld(){int l=S-I;memmove(b,b+I,l);if(M==2)S=l+(fgets(b+l,B+1-l,stdin)?(int)strlen(b+l):0);else{S=l+(int)fread(b+l,1,B-l,stdin);int n=min(S,Q),s=0,m=0; for(int i=0;iS) ld();} inline void bk(){nd();while(b[I]&&b[I]<=' '){++I;nd();}} inline char skip(){bk(); return b[I++];} template,int> = 0> void read(T&x){using V=conditional_t,uint,T>;using U=make_unsigned_t; char c=skip();bool g=0;if constexpr(is_signed_v)if(c=='-'){g=1;if(M==2)nd();c=b[I++];}U y=0; if(__builtin_expect(M,0)){if(M==1)y=lng(c);else while(c>='0')y=U(y*10+(c&15)),nd(),c=b[I++];}else while(c>='0')y=U(y*10+(c&15)),c=b[I++]; if constexpr(is_signed_v){if(g&&y){x=-static_cast(y-1);--x;return;}}x=static_cast(y);} void read(double&x){read(nt);const char*f=nt.data(),*l=f+nt.size();auto r=from_chars(f,l,x);if(r.ec!=errc{}||r.ptr!=l)__builtin_trap();} template,int> = 0> void read(T&x){ll v; read(v); x=T(v);} template,int> = 0> void read(T&x){string s;read(s);if(!x.assign(s))__builtin_trap();} template void read(H&h,N&n,T&...t){read(h); read(n,t...);} template void read(pair&p){read(p.first,p.second);} template,int> = 0> void read(T&a){for(auto&x:a) read(x);} void read(char &c){c=skip();} void read(string &s){s.clear();bk();for(;;){int l=I;while(I' ')++I;s.append(b+l,I-l);if(I Scanner& operator>>(Scanner&in,T&x){ in.read(x); return in; } struct Printer{ static constexpr int B=1<<17,O=64,P=15;char b[B];int I=0;bool o=isatty(fileno(stdout));string nb;inline static constexpr FastIOTb Tb{}; ~Printer(){flush();} inline void flush(){if(I) fwrite(b,1,I,stdout),I=0; } inline void pc(char c){if(I>B-O) flush(); b[I++]=c; if(o&&c=='\n') flush(); } inline void pr(const char*s,size_t n){if(o){for(size_t i=0;i=1000)return memcpy(q,Tb.n+(x<<2),4),(q+4);if(x>=100)return memcpy(q,Tb.n+(x<<2)+1,3),(q+3); if(x>=10){uint y=(x*205)>>11;*q++=char('0'+y);*q++=char('0'+x-y*10);return q;}*q=char('0'+x);return q+1;} inline void w4(char*q,uint x){memcpy(q,Tb.n+(x<<2),4);}inline void w8(char*q,uint x){uint y=x/10000;w4(q,y);w4(q+4,x-y*10000);} inline char* w32(char*q,uint x){if(x>=100000000){uint y=x/100000000,z=x-y*100000000;q=wt(q,y);w8(q,z);return q+8;} if(x>=10000){uint y=x/10000,z=x-y*10000;q=wt(q,y);w4(q,z);return q+4;}return wt(q,x);} __attribute__((noinline)) inline char* w64(char*q,ull x){if(x<=0xffffffffULL)return w32(q,(uint)x);ull y=x/100000000;uint z=(uint)(x-y*100000000); if(y<=0xffffffffULL){q=w32(q,(uint)y);w8(q,z);return q+8;}uint t=(uint)(y/100000000),m=(uint)(y-(ull)t*100000000);q=w32(q,t);w8(q,m);w8(q+8,z);return q+16;} template&& !is_same_v,int> = 0> void print(T x){ if(I>B-100) flush(); using U=make_unsigned_t; U y; if constexpr(is_signed_v){ if(x<0) b[I++]='-',y=U(0)-(U)x; else y=(U)x; } else y=x; if(!y){b[I++]='0';return;}char*q; if constexpr(sizeof(U)<=4)q=w32(b+I,(uint)y);else if constexpr(sizeof(U)<=8)q=w64(b+I,(ull)y); else{char W[3*sizeof(U)];int p=sizeof(W);while(y>=10000)p-=4,memcpy(W+p,Tb.n+(y%10000)*4,4),y/=10000;q=wt(b+I,(uint)y);memcpy(q,W+p,sizeof(W)-p);q+=sizeof(W)-p;}I=(int)(q-b); } void print_fixed(double x,int p=P){if(p<0)__builtin_trap();size_t z=(size_t)p+512;if(nb.size(),int> = 0> void print(const T&x){ print(x.value()); } template,int> = 0> void print(const T&x){ print(x.to_string()); } template,int> = 0> void print(const T&a){ bool f=0; for(auto&&x:a){ if(f) pc(' '); f=1; print(x); } } void puts(){ pc('\n'); } template void puts(const T&x){ print(x); pc('\n'); } template void puts(const H&h,const T&...t){ print(h); ((pc(' '),print(t)),...); pc('\n'); } void puts_fixed(double x,int p=P){print_fixed(x,p);pc('\n');} } dout; template Printer& operator<<(Printer&out,const T&x){ out.print(x); return out; } using u128 = __uint128_t; struct mod64 { unsigned long long n; static unsigned long long mod, inv, r2; mod64() : n(0) {} mod64(unsigned long long x) : n(init(x)) {} static unsigned long long init(unsigned long long w) { return reduce(u128(w) * r2); } static void set_mod(unsigned long long m) { assert((m & 1) && m < (1ULL << 63)); mod = inv = m; for (int i = 0; i < 5; ++i) inv *= 2 - inv * m; r2 = -u128(m) % m; } static unsigned long long reduce(u128 x) { unsigned long long y = static_cast(x >> 64) - static_cast((u128(static_cast(x) * inv) * mod) >> 64); return (long long)y < 0 ? y + mod : y; } mod64& operator*=(mod64 x) { n = reduce(u128(n) * x.n); return *this; } mod64 operator*(mod64 x) const { return mod64(*this) *= x; } mod64& operator+=(mod64 x) { n += x.n - mod; if((long long)n < 0) n += mod; return *this; } mod64 operator+(mod64 x) const { return mod64(*this) += x; } unsigned long long val() const { return reduce(n); } }; unsigned long long mod64::mod, mod64::inv, mod64::r2; bool suspect(unsigned long long a, unsigned long long s, unsigned long long d, unsigned long long n){ if(mod64::mod != n) mod64::set_mod(n); mod64 x(1), xx(a), one(1), minusone(n - 1); while(d > 0){ if(d & 1) x *= xx; xx *= xx; d >>= 1; } if (x.n == one.n) return true; for (unsigned long long r = 0; r < s; ++r) { if(x.n == minusone.n) return true; x *= x; } return false; } template bool miller_rabin(T m){ if (m <= 1) return false; unsigned long long n = m; assert(n < (1ULL << 63)); if (n > 2 && n % 2 == 0) return false; if (n == 2 || n == 3 || n == 5 || n == 7) return true; if (n % 3 == 0 || n % 5 == 0 || n % 7 == 0) return false; unsigned long long d = n - 1, s = 0; while (!(d & 1)) { ++s; d >>= 1; } static constexpr unsigned long long small[] = {2, 7, 61}; static constexpr unsigned long long large[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022}; if(n < 4759123141ULL) { for (auto p : small) { if(p >= n) break; if(!suspect(p, s, d, n)) return false; } } else { for (auto p : large) { if(p >= n) break; if(!suspect(p, s, d, n)) return false; } } return true; } /** * @brief Miller-Rabin素数判定 */ namespace primefactor_ll_detail { template struct ExactDiv { T t, i, val; ExactDiv() {} ExactDiv(T n) : t(T(-1) / n), i(mul_inv(n)) , val(n) {}; T mul_inv(T n) { T x = n; for (int i = 0; i < 5; ++i) x *= 2 - n * x; return x; } bool divide(T n) const { if(val == 2) return !(n & 1); return n * this->i <= this->t; } }; vector> get_prime(int n){ if(n <= 1) return vector>(); vector is_prime(n+1, true); vector> prime; is_prime[0] = is_prime[1] = false; for (int i = 2; i <= n; ++i) { if(is_prime[i]) prime.emplace_back(i); for (auto &&j : prime){ ull v = (ull)i * j.val; if(v > (ull)n) break; is_prime[v] = false; if(j.divide(i)) break; } } return prime; } constexpr int pollard_pm1_bound = 3000; const auto primes = get_prime(pollard_pm1_bound); constexpr ull pollard_batch_size = 208; constexpr ull pollard_pm1_trigger = 2048; constexpr ull pollard_pm1_mod_threshold = 500000000000000000ULL; constexpr ull pollard_lazy_mod_limit = 1ULL << 61; // REDC の結果を正規化しない。mod < 2^61 なら rho 内の値は 4 * mod 未満に収まる。 struct mod64_lazy { ull n; static ull mod, inv, r2; mod64_lazy() : n(0) {} mod64_lazy(ull x) : n(init(x)) {} static void set_mod(ull m) { mod = inv = m; for (int i = 0; i < 5; ++i) inv *= 2 - inv * m; inv = -inv; r2 = -u128(m) % m; } static ull reduce(u128 x) { ull q = (ull)x * inv; return (x + u128(q) * mod) >> 64; } static ull init(ull x) { ull y = reduce(u128(x) * r2); return y >= mod ? y - mod : y; } mod64_lazy& operator*=(mod64_lazy x) { n = reduce(u128(n) * x.n); return *this; } mod64_lazy& operator+=(mod64_lazy x) { n += x.n; return *this; } }; ull mod64_lazy::mod, mod64_lazy::inv, mod64_lazy::r2; vector get_pollard_pm1_exponents() { vector res; ull product = 1; for (auto &&p : primes) { if (p.val > pollard_pm1_bound) break; ull power = p.val; while (power <= pollard_pm1_bound / p.val) power *= p.val; if (product > ull(-1) / power) { res.emplace_back(product); product = 1; } product *= power; } res.emplace_back(product); return res; } const auto pollard_pm1_exponents = get_pollard_pm1_exponents(); mt19937_64 rng(0x8a5cd789635d2dffULL); mod64_lazy pow_mod64_lazy(mod64_lazy x, ull exponent) { mod64_lazy res = x; for (int bit = 62 - __builtin_clzll(exponent); bit >= 0; --bit) { res *= res; if ((exponent >> bit) & 1) res *= x; } return res; } ull pollard_pm1(ull n) { mod64_lazy::set_mod(n); mod64_lazy x(2), one(1); for (ull exponent : pollard_pm1_exponents) { x = pow_mod64_lazy(x, exponent); } ull diff = x.n > one.n ? x.n - one.n : one.n - x.n; ull g = gcd(diff, n); return g != 1 && g != n ? g : 0; } template ull pollard_rho_impl(ull nn, bool use_pm1) { uniform_int_distribution ra(1, nn - 1); Mint::set_mod(nn); bool pm1_done = !use_pm1; while(true){ ull c_ = ra(rng), g = 1, r = 1; while(c_ == nn - 2) c_ = ra(rng); Mint y(ra(rng)), xx(0), c(c_), ys(0), q(1); while(g == 1){ xx.n = y.n; for (ull i = 0; i < r; ++i) { y *= y; y += c; } ull k = 0; g = 1; while(k < r && g == 1){ ull lim = min(pollard_batch_size, r - k); for (ull i = 0; i < lim; ++i) { ys.n = y.n; y *= y; y += c; Mint diff; diff.n = xx.n > y.n ? xx.n - y.n : y.n - xx.n; q *= diff; } g = gcd(q.n, nn); k += pollard_batch_size; } r *= 2; if (!pm1_done && r == pollard_pm1_trigger) { ull factor = pollard_pm1(nn); if (factor != 0) return factor; pm1_done = true; } } if(g == nn) g = 1; while (g == 1){ ys *= ys; ys += c; ull diff = xx.n > ys.n ? xx.n - ys.n : ys.n - xx.n; g = gcd(diff, nn); } if (g != nn) return g; } } } template T pollard_rho2(T n) { assert(n >= 4 && static_cast(n) < (1ULL << 63)); ull nn = n; if ((nn & 1) == 0) return 2; if (nn < primefactor_ll_detail::pollard_lazy_mod_limit) { return (T)primefactor_ll_detail::pollard_rho_impl( nn, nn >= primefactor_ll_detail::pollard_pm1_mod_threshold); } return (T)primefactor_ll_detail::pollard_rho_impl(nn, false); } namespace primefactor_ll_detail { template void prime_factor_impl(T n, vector &res, bool trial){ if(trial) { for (auto &&i : primes) { while (i.divide(n)){ res.emplace_back(i.val); n /= i.val; } } } if(n == 1) return; if(miller_rabin(n)) { res.emplace_back(n); return; } ull root = __builtin_sqrtl((long double)n); while ((u128)(root + 1) * (root + 1) <= (ull)n) ++root; while ((u128)root * root > (ull)n) --root; if ((u128)root * root == (ull)n) { size_t first = res.size(); prime_factor_impl((T)root, res, false); size_t last = res.size(); res.reserve(last + last - first); for (size_t i = first; i < last; ++i) res.push_back(res[i]); return; } T x = pollard_rho2(n); prime_factor_impl(x, res, false); prime_factor_impl(n / x, res, false); } } template vector prime_factor(T n){ assert(n >= 1 && static_cast(n) < (1ULL << 63)); vector res; primefactor_ll_detail::prime_factor_impl(n, res, true); sort(res.begin(),res.end()); return res; } int main(){ ll x; din >> x; auto t = prime_factor(x); ll ans = 1; for (int i = 0; i < t.size(); ++i) { if(i+1 < t.size() && t[i] == t[i+1]){ i++; }else { ans *= t[i]; } } dout.puts(ans); return 0; }