#include #include using namespace std; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; #define FAST_IO \ ios::sync_with_stdio(false); \ cin.tie(0); const i64 INF = 1001001001001001001; using Modint = atcoder::static_modint<998244353>; pair> f(int X, int Y) { for (int k = 3; k <= 20; k ++) { for (int i = 0; i < (1 << k); i++) { set> set; for (int b = 0; b < (1 << 4); b ++) { int v = 0; int prod[] = {(b >> 0) & 1, (b >> 1) & 1, (b >> 2) & 1, (b >> 3) & 1}; for (int j = 0; j < k; j++) { int u = (i >> j) & 1; v = prod[(u << 1) + v]; } int prodXY = prod[(Y << 1) + X]; set.insert({prodXY, v}); } if (set.size() == 2) { auto p = *set.begin(); auto q = *set.rbegin(); if (p.first != q.first && p.second != q.second) { int rev = p.first == p.second ? 1 : -1; vector res; for (int j = 0; j < k; j++) { res.push_back((i >> j) & 1); } return {rev, res}; } } } } return {0, {}}; } int main() { FAST_IO auto ans = 0LL; int X, Y; cin >> X >> Y; auto [rev, res] = f(X, Y); cout << res.size() << endl; if (res.size() == 0) { return 0; } for (int i = 0; i < res.size(); i++) { cout << res[i] << " "; } cout << endl; int Z; cin >> Z; if (rev == -1) { Z = 1 - Z; } cout << Z << endl; }