malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   vector<vector<int> > g;   int n;   vector<bool> b;   vector<int> v;   stack<int> st;   bool fi;   vector<bool> dins;   void dfs(int u) {     if (fi) return;     if (b[u]) {       if (dins[u]) {         fi = true;         v.push_back(u);         while (!st.empty() and st.top() != u) {           v.push_back(st.top());           st.pop();         }         v.push_back(u);       } else         return;     }     b[u] = true;     st.push(u);     dins[u] = true;     for (int i = 0; i < g[u].size(); ++i) {       dfs(g[u][i]);     }     if (fi) return;     st.pop();     dins[u] = false;   }   bool check(int x, int y, vector<int> d) {     --d[y];     queue<int> q;     for (int i = 0; i < n; ++i) {       if (d[i] == 0) q.push(i);     }     while (!q.empty()) {       int u = q.front();       q.pop();       for (int i = 0; i < g[u].size(); ++i) {         if (u != x or g[u][i] != y) {           --d[g[u][i]];           if (d[g[u][i]] == 0) q.push(g[u][i]);         }       }     }     for (int i = 0; i < n; ++i) {       if (d[i]) {         return false;       }     }     return true;   }   int main() {     int m;     cin >> n >> m;     g = vector<vector<int> >(n);     vector<int> d(n, 0);     for (int i = 0; i < m; ++i) {       int x, y;       cin >> x >> y;       --x;       --y;       ++d[y];       g[x].push_back(y);     }     b = vector<bool>(n, false);     dins = vector<bool>(n, false);     fi = false;     for (int i = 0; i < n; ++i) {       if (!b[i] and !fi) dfs(i);     }     for (int i = 1; i < v.size(); ++i) {       if (check(v[i], v[i - 1], d)) {         cout <<  YES  << endl;         return 0;       }     }     if (v.empty())       cout <<  YES  << endl;     else       cout <<  NO  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int* degree = new int[100005];     for (int i = 1; i <= n; i++) {       degree[i] = 0;     }     while (m--) {       int a, b;       cin >> a >> b;       degree[a]++;       degree[b]++;     }     int deg1 = 0, deg2 = 0, degG = 0;     for (int i = 1; i <= n; i++) {       if (degree[i] == 0) {         continue;       } else if (degree[i] == 1) {         deg1++;       } else if (degree[i] == 2) {         deg2++;       } else if (degree[i] == n - 1) {         degG++;       }     }     if (deg1 == n - 1 && deg2 == 0 && degG == 1) {       cout <<  star topology ;       return 0;     } else if (deg1 == 2 && deg2 == n - 2 && degG == 0) {       cout <<  bus topology ;       return 0;     } else if (deg1 == 0 && deg2 == n && degG == 0) {       cout <<  ring topology ;       return 0;     } else {       cout <<  unknown topology ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long N, M, x, y, K, ml, T, ans;   long long f[1000000], s[1000000];   const long long md = 1e9 + 7;   const long long MAXN = 1e5 + 2;   string in;   int main() {     cin >> N >> K;     f[0] = 1;     for (int i = 1; i <= MAXN; i++) {       f[i] = f[i - 1];       if (i >= K) f[i] = (f[i] % md + f[i - K] % md) % md;     }     s[0] = 0;     for (int i = 1; i <= MAXN; i++) s[i] = (s[i - 1] % md + f[i] % md) % md;     for (int i = 0; i < N; i++) {       cin >> x >> y;       ans = (s[y] - s[x - 1] + md) % md;       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> vec[201], v[201];   int afis[201], scor[201], n, test[201];   bool viz[201];   void elim(int val) {     for (int i = 0; i < v[val].size(); i++) scor[v[val][i]]--;   }   bool incearca(int start) {     int i, j;     for (i = 1; i <= n; i++) {       scor[i] = vec[i].size();       viz[i] = 0;     }     afis[1] = vec[start][0];     elim(vec[start][0]);     afis[2] = vec[start][1];     elim(vec[start][1]);     viz[vec[start][0]] = viz[vec[start][1]] = 1;     for (int i = 3; i <= n; i++) {       int cnt = 0;       for (j = 1; j < n; j++)         if (scor[j] == 1) cnt++;       if (cnt >= 2 || cnt == 0) return 0;       for (j = 1; j < n; j++)         if (scor[j] == 1) {           for (int k = 0; k < vec[j].size(); k++)             if (!viz[vec[j][k]]) {               viz[vec[j][k]] = 1;               elim(vec[j][k]);               afis[i] = vec[j][k];               break;             }           cnt = 0;           for (int k = i; k >= i - vec[j].size() + 1; k--) test[++cnt] = afis[k];           sort(test + 1, test + cnt + 1);           for (int a = 1, b = 0; b < vec[j].size(); a++, b++)             if (test[a] != vec[j][b]) return 0;           break;         }       if (j == n) return 0;     }     return 1;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t, i, k, j, a;     cin >> t;     while (t--) {       cin >> n;       for (i = 1; i <= n; i++) {         vec[i].clear();         v[i].clear();       }       for (i = 1; i < n; i++) {         cin >> k;         for (j = 1; j <= k; j++) {           cin >> a;           v[a].push_back(i);           vec[i].push_back(a);         }       }       for (i = 1; i < n; i++)         if (vec[i].size() == 2) {           if (incearca(i)) break;           swap(vec[i][0], vec[i][1]);           if (incearca(i)) break;           swap(vec[i][0], vec[i][1]);         }       for (i = 1; i <= n; i++) cout << afis[i] <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 1e6 + 5;   int n, x, y, ile[4 * maxN];   long long pref[4 * maxN], mini = 1e18;   bool czy = 0;   long long spr(long long x, long long y) {     long long t;     if (__builtin_smulll_overflow(x, y, &t)) czy = 1;     return x * y;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> x >> y;     for (int i = 0, a; i < n; i++) cin >> a, ile[a]++, pref[a] += a;     for (int i = 1; i < 4 * maxN; i++)       ile[i] += ile[i - 1], pref[i] += pref[i - 1];     for (int i = 2; i < maxN; i++) {       long long temp = 0;       int f = max<double>(0, ceil(i - double(x) / y) - 1);       czy = 0;       for (int j = 0; i * j < maxN && !czy; j++) {         temp += (long long)(ile[i * j + f] - ile[i * j]) * x;         if (temp < 0) czy = 1;         temp += spr(spr(i * j + i, ile[i * j + i] - ile[i * j + f]) -                         (pref[i * j + i] - pref[i * j + f]),                     y);         if (temp < 0) czy = 1;       }       if (!czy) {         mini = min(mini, temp);       }     }     cout << mini << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long x, long long y) {     long long res = 1;     while (y--) {       res *= x;     }     return res;   }   void fast() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);   }   bool sortbysec(const pair<long long, long long>& a,                  const pair<long long, long long>& b) {     return (a.second < b.second);   }   void solve() {     long long n, a, b;     cin >> n >> a >> b;     vector<pair<long long, long long> > v;     for (long long i = 0; i < n; i++) {       long long x, y;       cin >> x >> y;       v.push_back({x, y});     }     long long g = 0;     for (long long i = 0; i < n - 1; i++) {       for (long long j = i + 1; j < n; j++) {         long long p = v[i].first, q = v[i].second, r = v[j].first,                   s = v[j].second;         if ((p + r <= a && max(q, s) <= b) || (q + s <= b && max(p, r) <= a) ||             (p + r <= b && max(q, s) <= a) || (q + s <= a && max(p, r) <= b)) {           g = max(g, ((p * q) + (r * s)));         } else {           long long t = p;           p = q;           q = t;           if ((p + r <= a && max(q, s) <= b) || (q + s <= b && max(p, r) <= a) ||               (p + r <= b && max(q, s) <= a) || (q + s <= a && max(p, r) <= b)) {             g = max(g, ((p * q) + (r * s)));           }         }       }     }     cout << g;   }   int main() {     fast();     long long t;     t = 1;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const int LIMIT = 20;   int n, dep[300001];   vector<int> adj[300001];   int dp[300001][LIMIT], dp2[300001][LIMIT];   void dfs(int x, int pre) {     vector<int> child;     for (auto y : adj[x]) {       if (y != pre) {         dfs(y, x);         child.push_back(y);         dep[x] = max(dep[x], dep[y] + 1);       }     }     dp[x][1] = dp2[x][1] = n;     for (int i = 2; i < LIMIT; ++i) {       int lo = 0, hi = n;       while (lo < hi) {         int md = lo + hi + 1 >> 1, tot = 0;         for (auto y : child) {           if (dp[y][i - 1] >= md) {             ++tot;           }         }         (tot >= md) ? lo = md : hi = md - 1;       }       dp[x][i] = dp2[x][i] = lo + hi >> 1;       for (auto y : child) {         dp2[x][i] = max(dp2[x][i], dp2[y][i]);       }     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; ++i) {       int x, y;       scanf( %d%d , &x, &y), --x, --y;       adj[x].push_back(y);       adj[y].push_back(x);     }     dfs(0, -1);     long long ans = 0LL;     for (int i = 0; i < n; ++i) {       ans += dep[i];     }     for (int u = 0; u < n; ++u) {       for (int i = 1; i < LIMIT; ++i) {         int lo = 2, hi = dp2[u][i];         if (i + 1 < LIMIT) {           lo = max(lo, dp2[u][i + 1] + 1);         }         if (lo <= hi) {           ans += (long long)(hi - lo + 1) * (i - 1);         }       }     }     ans += (long long)n * n;     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, a;     cin >> n;     long long A[n];     for (long long i = 0; i < n; i++) {       cin >> a;       A[i] = a;     }     long long sum = 0, odd = 0, small = 1000000009;     for (long long i = 0; i < n; i++) {       if (A[i] % 2 != 0) {         odd++;         if (A[i] < small) small = A[i];       }       sum = sum + A[i];     }     if (odd % 2 != 0) sum = sum - small;     cout << sum;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2005500;   struct state {     int len, link;     map<char, int> next;   };   state st[N];   int sz, last;   void sa_init() {     last = st[0].len = 0;     sz = 1;     st[0].link = -1;   }   void sa_extend(char c) {     int k = sz++, p;     st[k].len = st[last].len + 1;     for (p = last; p != -1 && !st[p].next.count(c); p = st[p].link)       st[p].next[c] = k;     if (p == -1)       st[k].link = 0;     else {       int q = st[p].next[c];       if (st[p].len + 1 == st[q].len)         st[k].link = q;       else {         int w = sz++;         st[w].len = st[p].len + 1;         st[w].next = st[q].next;         st[w].link = st[q].link;         for (; p != -1 && st[p].next[c] == q; p = st[p].link) st[p].next[c] = w;         st[q].link = st[k].link = w;       }     }     last = k;   }   string s, tt;   long long dp[N];   bool t[N];   int vis[N], q;   long long f(int i) {     if (dp[i] != -1) return dp[i];     long long &r = dp[i] = t[i];     for (auto p : st[i].next) r += f(p.second);     return r;   }   long long go(int i, int p, int len) {     long long r = 0;     if (len == ((int)(tt).size()) / 2) {       if (vis[i] == q) return 0;       vis[i] = q;       r += dp[i];       if (st[st[i].link].len + 1 == len) {         r += go(st[i].link, p + 1, len - 1);       } else {         r += go(i, p + 1, len - 1);       }     } else {       if (p >= ((int)(tt).size()) / 2) return 0;       char c = tt[p + len];       if (st[i].next.count(c)) {         r += go(st[i].next[c], p, len + 1);       } else {         if (i && st[st[i].link].len + 1 == len) {           r += go(st[i].link, p + 1, len - 1);         } else {           r += go(i, p + 1, len - 1);         }       }     }     return r;   }   void solve() {     q++;     cin >> tt;     tt += tt;     cout << go(0, 0, 0) <<   n ;   }   int main() {     cin >> s;     sa_init();     memset(dp, -1, sizeof dp);     for (int i = 0, qwerty = ((int)(s).size()); i < qwerty; i++) sa_extend(s[i]);     int x = last;     while (x) {       t[x] = 1;       x = st[x].link;     }     f(0);     int tn;     cin >> tn;     for (int i = 0, qwerty = tn; i < qwerty; i++) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long int;   using vi = vector<ll>;   using ii = pair<ll, ll>;   int main() {     ios::sync_with_stdio(false);     int n;     cin >> n;     int mini = (int)1e9;     vi v;     for (int i = 0; i < n; i++) {       int aux;       cin >> aux;       v.push_back(aux);       if (aux < mini) mini = aux;     }     int idx = mini % n;     for (int i = 0; i < n; i++)       if (v[idx % n] - mini - i > 0)         idx++;       else         break;     cout << (idx % n) + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int h, n;     cin >> n >> h;     for (int i = 1; i <= n; i++) {       if (i % 2 == 1) {         for (int j = 1; j <= h; j++) {           cout <<  # ;         }       } else {         if ((i / 2) % 2 == 1) {           for (int j = 1; j <= h - 1; j++) {             cout <<  . ;           }           cout <<  # ;         } else {           cout <<  # ;           for (int j = 1; j <= h - 1; j++) {             cout <<  . ;           }         }       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename U>   inline void smin(T &a, U b) {     if (a > b) a = b;   }   template <typename T, typename U>   inline void smax(T &a, U b) {     if (a < b) a = b;   }   template <class T>   inline void gn(T &first) {     char c, sg = 0;     while (c = getchar(), (c >  9  || c <  0 ) && c !=  - )       ;     for ((c ==  -  ? sg = 1, c = getchar() : 0), first = 0; c >=  0  && c <=  9 ;          c = getchar())       first = (first << 1) + (first << 3) + c -  0 ;     if (sg) first = -first;   }   template <class T, class T1>   inline void gn(T &first, T1 &second) {     gn(first);     gn(second);   }   template <class T, class T1, class T2>   inline void gn(T &first, T1 &second, T2 &z) {     gn(first);     gn(second);     gn(z);   }   template <class T>   inline void print(T first) {     if (first < 0) {       putchar( - );       return print(-first);     }     if (first < 10) {       putchar( 0  + first);       return;     }     print(first / 10);     putchar(first % 10 +  0 );   }   template <class T>   inline void printsp(T first) {     print(first);     putchar(   );   }   template <class T>   inline void println(T first) {     print(first);     putchar(  n );   }   template <class T, class U>   inline void print(T first, U second) {     printsp(first);     println(second);   }   template <class T, class U, class V>   inline void print(T first, U second, V z) {     printsp(first);     printsp(second);     println(z);   }   int power(int a, int b, int m, int ans = 1) {     for (; b; b >>= 1, a = 1LL * a * a % m)       if (b & 1) ans = 1LL * ans * a % m;     return ans;   }   int root[1111111], deg[1111111], edge[1111111];   int find_root(int u) {     if (u == root[u]) return u;     return root[u] = find_root(root[u]);   }   int main() {     int n, m, u, v;     int self = 0;     gn(n, m);     for (int i = 1; i <= n; i++) root[i] = i;     for (int i = 0; i < m; i++) {       gn(u, v);       if (u == v)         self++;       else         deg[u]++, deg[v]++;       u = find_root(u);       v = find_root(v);       if (u == v)         edge[u]++;       else {         root[v] = u;         edge[u] += (edge[v] + 1);       }     }     int yes = 0, cnt = 0;     for (int i = 1; i <= n; i++)       if (edge[i] == m) {         yes = 1;         break;       }     if (!yes) return puts( 0 );     long long ans = 0;     for (int i = 1; i <= n; i++) ans += (long long)deg[i] * (deg[i] - 1) / 2;     ans += (long long)self * (m - self) + (long long)self * (self - 1) / 2;     println(ans);   }
#include <bits/stdc++.h>   using namespace std;   template <typename A, typename B>   inline void chmin(A &a, B b) {     if (a > b) a = b;   }   template <typename A, typename B>   inline void chmax(A &a, B b) {     if (a < b) a = b;   }   struct Dinic {     struct edge {       long long to, cap, rev;       edge(long long to, long long cap, long long rev)           : to(to), cap(cap), rev(rev) {}     };     const long long INF = 1001001001;     vector<vector<edge>> G;     vector<long long> level, iter;     Dinic(long long v) : G(v), level(v), iter(v) {}     void addEdge(long long from, long long to, long long cap) {       G[from].push_back(edge(to, cap, G[to].size()));       G[to].push_back(edge(from, 0, G[from].size() - 1));     }     void bfs(long long s) {       fill(level.begin(), level.end(), -1);       queue<long long> que;       level[s] = 0;       que.push(s);       while (que.size()) {         long long v = que.front();         que.pop();         for (auto &e : G[v]) {           if (e.cap && level[e.to] == -1) {             level[e.to] = level[v] + 1;             que.push(e.to);           }         }       }     }     long long dfs(long long v, long long t, long long f) {       if (v == t) return f;       for (long long &i = iter[v]; i < G[v].size(); i++) {         edge &e = G[v][i];         if (e.cap > 0 && level[v] < level[e.to]) {           long long d = dfs(e.to, t, min(f, e.cap));           if (d > 0) {             e.cap -= d;             G[e.to][e.rev].cap += d;             return d;           }         }       }       return 0;     }     long long maxFlow(long long s, long long t) {       long long flow = 0;       while (true) {         bfs(s);         if (level[t] < 0) return flow;         fill(iter.begin(), iter.end(), 0);         long long f;         while ((f = dfs(s, t, INF)) > 0) flow += f;       }     }   };   long long N, M;   long long A[5555], B[5555];   bool check(long long x) {     Dinic d(N + 2);     long long src = N;     long long snk = N + 1;     vector<long long> cnt(N);     for (long long i = 0; i < (M); i++) {       cnt[A[i]]++;       d.addEdge(A[i], B[i], 1);     }     long long f = 0;     for (long long i = 0; i < (N); i++) {       if (cnt[i] > x) {         d.addEdge(src, i, cnt[i] - x);         f += cnt[i] - x;       } else if (cnt[i] < x) {         d.addEdge(i, snk, x - cnt[i]);       }     }     if (d.maxFlow(src, snk) != f) return false;     set<pair<long long, long long>> es;     for (long long i = 0; i < (N); i++)       for (auto &e : d.G[i])         if (e.cap) es.insert({i, e.to});     for (long long i = 0; i < (M); i++) {       if (es.find({A[i], B[i]}) == es.end()) swap(A[i], B[i]);     }     return true;   }   signed main() {     cin >> N >> M;     for (long long i = 0; i < (M); i++) cin >> A[i] >> B[i], A[i]--, B[i]--;     long long lb = 0, ub = M;     while (ub - lb > 1) {       long long mid = (ub + lb) / 2;       if (check(mid))         ub = mid;       else         lb = mid;     }     check(ub);     cout << ub << endl;     for (long long i = 0; i < (M); i++)       cout << A[i] + 1 <<     << B[i] + 1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     cin >> q;     for (int test = 0; test < q; test++) {       int a, b, c, d, k;       cin >> a >> b >> c >> d >> k;       int pen = (a - 1) / c + 1, pencil = (b - 1) / d + 1;       if (pen + pencil > k) {         cout << -1 <<   n ;       } else {         cout << pen <<     << pencil <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 2;   int t, n, m, U, V, sum, ans1, ans2;   bool kt[maxn], ch[maxn];   struct T {     int c, id;   };   vector<T> a[maxn];   vector<int> s[maxn];   void Enter() {     cin >> m >> n;     for (int i = 1; i <= m; i++) {       a[i].clear();       s[i].clear();       a[i].push_back({ a , 0});       s[i].push_back(0);     }     for (int i = 1; i <= m; i++)       for (int j = 1; j <= n; j++) {         char u;         cin >> u;         s[i].push_back(u -  0 );       }     for (int i = 1; i <= m; i++)       for (int j = 1; j <= n; j++) {         char c;         cin >> c;         a[i].push_back({c, -1});       }   }   void Findcir(int u, int v, int id) {     if (a[u][v].id != -1) {       U = u;       V = v;       sum = id - a[u][v].id;       return;     }     a[u][v].id = id;     char c = a[u][v].c;     if (c ==  U ) Findcir(u - 1, v, id + 1);     if (c ==  D ) Findcir(u + 1, v, id + 1);     if (c ==  L ) Findcir(u, v - 1, id + 1);     if (c ==  R ) Findcir(u, v + 1, id + 1);     a[u][v].id = -1;   }   void DFS(int u, int v, int id) {     a[u][v].id = id;     if (s[u][v] == 0) {       if (!kt[id % sum]) {         kt[id % sum] = true;         ans2++;         ans1 -= ch[id % sum];       }     } else {       if (!ch[id % sum] && !kt[id % sum]) {         ch[id % sum] = true;         ans1++;       }     }     if (u > 1 && a[u - 1][v].id == -1 && a[u - 1][v].c ==  D )       DFS(u - 1, v, id + 1);     if (u < m && a[u + 1][v].id == -1 && a[u + 1][v].c ==  U )       DFS(u + 1, v, id + 1);     if (v > 1 && a[u][v - 1].id == -1 && a[u][v - 1].c ==  R )       DFS(u, v - 1, id + 1);     if (v < n && a[u][v + 1].id == -1 && a[u][v + 1].c ==  L )       DFS(u, v + 1, id + 1);   }   void Solve() {     ans1 = ans2 = 0;     for (int i = 1; i <= m; i++)       for (int j = 1; j <= n; j++)         if (a[i][j].id == -1) {           Findcir(i, j, 0);           fill_n(kt, sum + 1, false);           fill_n(ch, sum + 1, false);           DFS(U, V, 0);         }     cout << ans1 + ans2 <<     << ans2 <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cin >> t;     while (t--) {       Enter();       Solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1000000000;   const long long INFLL = INF * INF;   long long pot2[100];   vector<long long> czek_all(long long l, long long r, long long k) {     vector<long long> wynik;     long long x = r - l + 1;     long long res = INFLL;     for (int i = (1); i <= (pot2[x] - 1); ++i) {       vector<long long> v;       long long a = i, ile = 0;       long long tmp = 0;       for (int j = (0); j <= ((x)-1); ++j) {         if (a % 2 == 1) {           v.push_back(l + j);           tmp = tmp ^ (l + j);           ile++;         }         a /= 2;       }       if (tmp < res && ile <= k) {         res = tmp;         wynik = v;       }     }     return wynik;   }   void jebaj() {     pot2[0] = 1;     for (int i = (0); i <= ((60) - 1); ++i) pot2[i + 1] = pot2[i] * 2;     long long l, r, k;     cin >> l >> r >> k;     if (k == 1) {       cout << l <<   n  << 1 <<   n  << l <<   n ;       return;     }     if (r - l < 8) {       vector<long long> v = czek_all(l, r, k);       long long kk = 0;       for (__typeof((v).begin()) it = ((v).begin()); it != (v).end(); ++it)         kk = kk ^ (*it);       cout << kk <<   n ;       cout << (int)((v).size()) <<   n ;       for (__typeof((v).begin()) it = ((v).begin()); it != (v).end(); ++it)         cout << *it <<    ;       cout <<   n ;       return;     }     long long a = l;     while (a % 4 > 0) {       a++;     }     if (k >= 4) {       cout << 0 <<   n  << 4 <<   n ;       for (int i = (0); i <= ((4) - 1); ++i) {         cout << a <<    ;         a++;       }       cout <<   n ;       return;     }     if (k == 2) {       cout << 1 <<   n  << 2 <<   n ;       cout << a <<     << a + 1 <<   n ;       return;     }     int h = 0;     while (pot2[h] <= l) h++;     long long pot = pot2[h];     if (pot >= r) {       cout << 1 <<   n  << 2 <<   n ;       cout << a <<     << a + 1 <<   n ;       return;     }     long long x = pot + pot2[h - 1];     if (x <= r) {       cout << 0 <<   n  << 3 <<   n ;       cout << pot - 1 <<     << x <<     << (x ^ (pot - 1)) <<   n ;       return;     }     cout << 1 <<   n  << 2 <<   n ;     cout << a <<     << a + 1 <<   n ;     return;     return;   }   int main() {     ios_base::sync_with_stdio(0);     int t;     t = 1;     for (int i = (0); i <= ((t)-1); ++i) {       jebaj();     }   }