//MRasool Kheyri
//Iran , BandarAbbas
//16/10/1404
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define el '\n'
#define lid id<<1
#define rid lid|1
#define mid (l+r)/2
const ll maxn = 1e6 + 100 ;
const ll mod = 1e9 + 7 ;
const ll oo = 1e18 + 100 ;
bool is_prime(ll x){
if(x < 2){return 0;}
for(ll i = 2 ; i*i <= x ; i++){
if(x%i == 0){
return 0 ;
}
}
return 1 ;
}
void solve(){
ll a , b ;
cin>>a>>b ;
vector<ll> vec ;
ll ok = 0 ;
if(b < a){swap(a,b);ok=1;}
if(b-a == 2){
vec.push_back(a) ;
vec.push_back(b) ;
}
else if(a == 2){
if(is_prime(b-2)){
vec.push_back(2) ;
vec.push_back(b) ;
}
else if(is_prime(b+2)){
vec.push_back(2) ;
vec.push_back(b+2) ;
vec.push_back(b) ;
}
}
if(a == 3 && b == 7){
vec.push_back(3) ;
vec.push_back(5) ;
vec.push_back(7) ;
}
if(!vec.size()){
cout<<-1<<el ;
return ;
}
if(ok){
reverse(vec.begin(),vec.end()) ;
}
cout<<vec.size()<<el ;
for(auto x : vec){
cout<<x<<" ";
}cout<<el ;
return ;
}
int main(){
//ios_base::sync_with_stdio(0) , cin.tie(nullptr) , cout.tie(nullptr) ;
ll t = 1 ;
//cin>>t ;
while(t--){
solve() ;
}
return 0 ;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |