#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 5;
long long indian_multiplication(long long a, long long b, long long mod)
{
if (b == 0)
return 0LL;
long long half = indian_multiplication(a, b / 2LL, mod) % mod;
if (b & 1)
return (half + half + a) % mod;
else
return (half + half) % mod;
}
long long modular_exponentiation(long long a, long long b, long long mod)
{
if (b == 0)
return 1LL;
long long half = modular_exponentiation(a, b / 2LL, mod) % mod;
long long product = indian_multiplication(half, half, mod);
if (b & 1)
return indian_multiplication(product, a, mod);
else
return product;
}
bool fermat_checking(long long n, int k = 50)
{
if (n < 4)
return n == 2 || n == 3;
if (n != 2 && n % 2 == 0)
return false;
for (int i = 1; i <= k; ++i)
{
long long a = 2 + rand() % (n - 3);
if (modular_exponentiation(a, n - 1, n) != 1)
return false;
}
return true;
}
vector < int > eratosthenes_sieve(int max_value)
{
vector < bool > is_prime(max_value + 1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= max_value; ++i)
if (is_prime[i])
for (int j = i * i; j <= max_value; j += i)
is_prime[j] = false;
vector < int > primes;
for (int i = 2; i <= max_value; ++i)
if (is_prime[i])
primes.push_back(i);
return primes;
}
int solution(int n)
{
vector < int > primes = eratosthenes_sieve(1000000);
long long res = 1;
for (int p : primes)
{
if (p * p * p > n)
break;
int cnt = 0;
while (n % p == 0)
{
n /= p;
++cnt;
}
res *= (cnt + 1);
}
if (fermat_checking(n))
res *= 2LL;
else
{
int squaroot = sqrt(n);
if (squaroot * squaroot == n && fermat_checking(squaroot))
res *= 3;
else if (n != 1)
res *= 4;
}
return res;
}
main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n;
cin >> n;
if (n <= 1e8) {
int k = sqrt(n);
if (k * k == n) {
cout << "WA";
return 0;
}
for (int i = 2; i <= k; ++i) {
if (n % i == 0) {
cout << "WA";
return 0;
}
}
cout << "AC";
return 0;
}
if (solution(n) > 2) {
cout << "WA";
}
else {
cout << "AC";
}
}
I2luY2x1ZGU8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YmIG4gJSAyID09IDApCiAgICAgICAgcmV0dXJuIGZhbHNlOwoKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IGs7ICsraSkKICAgIHsKICAgICAgICBsb25nIGxvbmcgYSA9IDIgKyByYW5kKCkgJSAobiAtIDMpOwogICAgICAgIGlmIChtb2R1bGFyX2V4cG9uZW50aWF0aW9uKGEsIG4gLSAxLCBuKSAhPSAxKQogICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICB9CgogICAgcmV0dXJuIHRydWU7Cn0KdmVjdG9yIDwgaW50ID4gZXJhdG9zdGhlbmVzX3NpZXZlKGludCBtYXhfdmFsdWUpCnsKICAgIHZlY3RvciA8IGJvb2wgPiBpc19wcmltZShtYXhfdmFsdWUgKyAxLCB0cnVlKTsKICAgIGlzX3ByaW1lWzBdID0gaXNfcHJpbWVbMV0gPSBmYWxzZTsKCiAgICBmb3IgKGludCBpID0gMjsgaSAqIGkgPD0gbWF4X3ZhbHVlOyArK2kpCiAgICAgICAgaWYgKGlzX3ByaW1lW2ldKQogICAgICAgICAgICBmb3IgKGludCBqID0gaSAqIGk7IGogPD0gbWF4X3ZhbHVlOyBqICs9IGkpCiAgICAgICAgICAgICAgICBpc19wcmltZVtqXSA9IGZhbHNlOwoKICAgIHZlY3RvciA8IGludCA+IHByaW1lczsKICAgIGZvciAoaW50IGkgPSAyOyBpIDw9IG1heF92YWx1ZTsgKytpKQogICAgICAgIGlmIChpc19wcmltZVtpXSkKICAgICAgICAgICAgcHJpbWVzLnB1c2hfYmFjayhpKTsKCiAgICByZXR1cm4gcHJpbWVzOwp9CgppbnQgc29sdXRpb24oaW50IG4pCnsKICAgIHZlY3RvciA8IGludCA+IHByaW1lcyA9IGVyYXRvc3RoZW5lc19zaWV2ZSgxMDAwMDAwKTsKCWxvbmcgbG9uZyByZXMgPSAxOwogICAgZm9yIChpbnQgcCA6IHByaW1lcykKICAgIHsKICAgICAgICBpZiAocCAqIHAgKiBwID4gbikKICAgICAgICAgICAgYnJlYWs7CgogICAgICAgIGludCBjbnQgPSAwOwogICAgICAgIHdoaWxlIChuICUgcCA9PSAwKQogICAgICAgIHsKICAgICAgICAgICAgbiAvPSBwOwogICAgICAgICAgICArK2NudDsKICAgICAgICB9CgogICAgICAgIHJlcyAqPSAoY250ICsgMSk7CiAgICB9CiAgICBpZiAoZmVybWF0X2NoZWNraW5nKG4pKQogICAgICAgIHJlcyAqPSAyTEw7CiAgICBlbHNlCiAgICB7CiAgICAgICAgaW50IHNxdWFyb290ID0gc3FydChuKTsKICAgICAgICBpZiAoc3F1YXJvb3QgKiBzcXVhcm9vdCA9PSBuICYmIGZlcm1hdF9jaGVja2luZyhzcXVhcm9vdCkpCiAgICAgICAgICAgIHJlcyAqPSAzOwogICAgICAgIGVsc2UgaWYgKG4gIT0gMSkKICAgICAgICAgICAgcmVzICo9IDQ7CiAgICB9CiAgICByZXR1cm4gcmVzOwp9Cm1haW4oKSB7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoTlVMTCk7IGNvdXQudGllKE5VTEwpOwogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIGlmIChuIDw9IDFlOCkgewogICAgICAgIGludCBrID0gc3FydChuKTsKICAgICAgICBpZiAoayAqIGsgPT0gbikgewogICAgICAgICAgICBjb3V0IDw8ICJXQSI7CiAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICBmb3IgKGludCBpID0gMjsgaSA8PSBrOyArK2kpIHsKICAgICAgICAgICAgaWYgKG4gJSBpID09IDApIHsKICAgICAgICAgICAgICAgIGNvdXQgPDwgIldBIjsKICAgICAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgIkFDIjsKICAgICAgICByZXR1cm4gMDsKICAgIH0KICAgIGlmIChzb2x1dGlvbihuKSA+IDIpIHsKICAgICAgICBjb3V0IDw8ICJXQSI7CiAgICB9CiAgICBlbHNlIHsKICAgICAgICBjb3V0IDw8ICJBQyI7CiAgICB9Cgp9Cg==