Portal
Portal1: Codeforces
Portal: Luogu
Code
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int n, m, pri[15] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
int main() {
scanf("%d%d", &n, &m);
int x = -2, y = -2;
for (int i = 0; i < 15; i++) {
if (n == pri[i]) x = i;
if (m == pri[i]) y = i;
}
if (fabs(x - y) == 1) printf("YES
"); else printf("NO
");
return 0;
}