#include #include // n を素因数分解し、素因数を返す std::map pf(long long n) { // <素数,出現回数> std::map m; while (n % 2 == 0) { m[2]++; n /= 2; } while (n % 3 == 0) { m[3]++; n /= 3; } for (long long i = 6; i * i <= n; i += 6) { while ((i - 1) % n == 0) { m[i - 1]++; n /= (i - 1); } while ((i + 1) % n == 0) { m[i - 1]++; n /= (i - 1); } } return m; } int main() { long long n; std::cin >> n; std::map prime_factors = pf(n); long long num = 1, counter = 0; for (auto i = prime_factors.begin(); i != prime_factors.end(); i++) { if (i->second > 1) { if (i->first * i->first != n) { std::cout << "YES" << std::endl; return 0; } } else { num *= i->first; counter++; } if (num > 2 && counter > 1 && num != n) { std::cout << "YES" << std::endl; return 0; } } std::cout << "NO" << std::endl; return 0; }