注意素数判别时的特殊情况:if (n<=1) return 0;
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define LL long long
using namespace std;
int isPrime(LL n) {
if (n<=1) return 0;
for (LL i=2;i<=(int)sqrt((double)n);++i) {
if (n%i==0) return 0;
}
return 1;
}
int judge(LL n) {
LL x=n-6;
if (isPrime(n) && isPrime(x)) return x;
x=n+6;
if (isPrime(n) && isPrime(x)) return x;
return -1;
}
int main()
{
LL n;
scanf("%lld",&n);
LL x=judge(n);
if (x!=-1) {
printf("Yes\n%lld",x);
}
else {
printf("No\n");
LL x=n+1;
while (1) {
if (judge(x)!=-1) {
printf("%lld",x);
break;
}
x++;
}
}
return 0;
}