#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define int long long
#define pii pair<int,int>
#define vi vector<int>
#define ff first
#define ss second
#define sp << " " <<
#define all(x) x.begin(),x.end()
#define big(x) ((int)(x.size()))
using namespace std;
const int MOD = 1e9+7, LIM = 1e6+1, inf = 2e9;
const int N = 1e5+1;
void solve() {
    int L;
    cin >> L;
    int limbo = 18;
    int q;
    cin >> q;
    while (q--) {
        string s;
        cin >> s;
        if (s == "alojzije") {
            int a;
            cin >> a;
            int x = 1;
            vi v;
            for (int j = limbo;j>=0;j--) {
                x<<=1;
                if (a&(1<<j)) x|=1;
                v.push_back(x);
            }
            sort(all(v));
            cout << big(v) << ' ';
            for (auto it : v) cout << it << ' ';
            cout << endl;
        }
        else if (s=="benjamin"){
            int x;
            cin>>x;
            vector<int> ans;
            x+=(1<<19);
            for (int i=0;i<19;i++){
                if (x%2==0) ans.push_back(x+1);
                x=(x>>1);
            }
            cout<<big(ans)<<" ";
            for (int d:ans) cout<<d<<" ";
            cout<<endl<<flush;
        }
        else {
            int lc;
            cin >> lc;
            vi v(lc);
            for (auto& it : v) cin >> it;
            if (v.back() == 2) cout << "A" << endl;
            else cout << "B" << endl;
        }
    }
} 
signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifdef Dodi
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    #endif
    int t = 1;
    //cin >> t;
    while (t --> 0) solve();
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |