#include<bits/stdc++.h>
using namespace std;
bool check(long long x){
if(x<2)return 0;
long long s=sqrt(x);
for(long long i=2;i<=s;i++){
if(x%i==0)return 0;
}
return 1;
}
int main(){
long long a,b;cin>>a>>b;
if(check(abs(b-a)))cout<<2<<"\n"<<a<<" "<<b;
else if(a==2&&check(b+2))cout<<3<<"\n"<<a<<" "<<b+2<<" "<<b;
else if(b==2&&check(a+2))cout<<3<<"\n"<<a<<" "<<a+2<<" "<<b;
else if(check(a+2)&&check(b-2))cout<<4<<"\n"<<a<<" "<<a+2<<" "<<2<<" "<<b;
else if(check(a-2)&&check(b+2))cout<<4<<"\n"<<a<<" "<<2<<" "<<b+2<<" "<<b;
else cout<<-1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
60 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
64 ms |
408 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
408 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |