#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back;
using namespace std;
bool prost(ll n)
{
if(n==1) return false;
for(ll i=2;i*i<=n;i++)
{
if(n%i==0) return false;
}
return true;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll a,b;
cin>>a>>b;
if(a==2)
{
if(prost(b-2))
{
cout<<2<<endl;
cout<<2<<" "<<b<<endl;
}
else if(prost(b+2))
{
cout<<3<<endl;
cout<<2<<" "<<b+2<<" "<<b<<endl;
}
else
{
cout<<-1<<endl;
}
}
else if(a==3)
{
if(b==5)
{
cout<<2<<endl;
cout<<3<<" "<<5<<endl;
}
else if(b==7)
{
cout<<3<<endl;
cout<<3<<" "<<5<<" "<<7<<endl;
}
else
{
cout<<-1<<endl;
}
}
else
{
if(abs(a-b)==2)
{
cout<<2<<endl;
cout<<a<<" "<<b<<endl;
}
else
{
cout<<-1<<endl;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |