Advertisement
Guest User

Untitled

a guest
Mar 14th, 2020
7,552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     long long u,v;
  6.     scanf("%I64d%I64d",&u,&v);
  7.     if (u%2!=v%2 || u>v)
  8.     {
  9.         printf("-1");
  10.         return 0;
  11.     }
  12.     if (u==v)
  13.     {
  14.         if (!u)
  15.         printf("0");
  16.         else
  17.         printf("1\n%I64d",u);
  18.         return 0;
  19.     }
  20.     long long x=(v-u)/2;
  21.     if (u&x)
  22.     printf("3\n%I64d %I64d %I64d",u,x,x);
  23.     else
  24.     printf("2\n%I64d %I64d",(u^x),x);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement