malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   const long long maxn = 2e5 + 5;   struct range {     long long a, b, c, id;     range(long long A, long long B, long long C, long long ID) {       a = A;       b = B;       c = C;       id = ID;     }   };   bool compare(const range &i, const range &j) {     if (i.a < j.a) return 1;     if (i.a == j.a) return i.c < j.c;     return 0;   }   long long ans[maxn];   void finish() {     cout <<  NO  <<   n ;     ;     exit(0);   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n;     cin >> n;     long long a[n + 1], b[n + 1];     set<pair<long long, long long> > s;     vector<range> v;     for (long long i = 1; i <= n; ++i) {       cin >> a[i] >> b[i];       v.emplace_back(range(a[i], b[i], 1, i));     }     long long m;     cin >> m;     long long c[m + 1], d[m + 1], k[m + 1];     for (long long i = 1; i <= m; ++i) {       cin >> c[i] >> d[i] >> k[i];       v.emplace_back(range(c[i], d[i], 0, i));     }     sort(v.begin(), v.end(), compare);     for (const auto &it : v) {       if (it.c == 0) {         s.insert({d[it.id], it.id});       } else {         auto j = s.lower_bound({b[it.id], -1});         if (j == s.end()) finish();         long long id = (*j).second;         ans[it.id] = id;         k[id]--;         if (k[id] == 0) s.erase(j);       }     }     cout <<  YES  <<   n ;     ;     for (long long i = 1; i <= n; ++i) {       cout << ans[i] <<    ;     }     cout <<   n ;     ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n;     int a[n][2];     for (int i = 0; i < n; ++i) cin >> a[i][0] >> a[i][1];     cin >> k;     for (int i = 0; i < n; ++i) {       if (a[i][0] <= k && k <= a[i][1]) {         cout << n - i;         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long a, b;     cin >> a >> b;     long long steps = 0;     while (b != 0) {       steps += (a / b);       a %= b;       swap(a, b);     }     cout << steps << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[105], a2[105], n;   int getabs() {     int e = 0, s = 0, i;     for (i = 1; i <= n; i++) {       if (a[i] == 1) e++;       if (a[i] == -1) s++;     }     return abs(e - s);   }   int main() {     int k, i, c, b, ans = 0;     scanf( %d%d , &n, &k);     for (i = 1; i <= n; i++) {       scanf( %d , &a[i]);       a2[i] = a[i];     }     for (b = 1; b <= n; b++) {       i = 1;       while (b + i * k > 0) i--;       for (i++; b + i * k <= n; i++) {         a[b + i * k] = 0;       }       ans = getabs() > ans ? getabs() : ans;       for (i = 1; i <= n; i++) a[i] = a2[i];     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int ans = 0;     int n, m;     cin >> n >> m;     map<int, int> type;     vector<int> a(m);     for (int i = 0; i < m; i++) {       cin >> a[i];       type[a[i]] += 1;     }     int sum = accumulate(a.begin(), a.end(), 0);     int mel = 0;     for (auto p : type) {       mel = max(mel, p.second);     }     for (int i = 1; i <= mel; i++) {       int curr = 0;       for (auto p : type) {         curr += p.second / i;       }       if (curr >= n) {         ans = max(ans, i);       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int T, n, k;   int main() {     cin >> T;     for (int i = 0; i < T; i++) {       cin >> n >> k;       if (n % 3 != 0 && k % 3 != 0) {         cout <<  Alice  << endl;       } else if (n % 3 == 0 && k % 3 != 0) {         cout <<  Bob  << endl;       } else {         n %= (k + 1);         if (n % 3 == 0 && n != k)           cout <<  Bob  << endl;         else           cout <<  Alice  << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     char s;     int rock[4][2];     int k = 0;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         cin >> s;         if (s ==  * ) {           rock[k][0] = i;           rock[k][1] = j;           k++;         }       }     if (rock[0][0] == rock[1][0]) rock[3][0] = rock[2][0];     if (rock[0][0] == rock[2][0]) rock[3][0] = rock[1][0];     if (rock[2][0] == rock[1][0]) rock[3][0] = rock[0][0];     if (rock[0][1] == rock[1][1]) rock[3][1] = rock[2][1];     if (rock[0][1] == rock[2][1]) rock[3][1] = rock[1][1];     if (rock[2][1] == rock[1][1]) rock[3][1] = rock[0][1];     cout << rock[3][0] + 1 <<     << rock[3][1] + 1;     cin >> n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000 + 10;   int n, m, cnt, counter, b[maxn * maxn], par[maxn][maxn];   char a[maxn][maxn];   vector<pair<int, int> > adj[maxn][maxn];   bool mark[maxn][maxn];   void dfs(int x, int y) {     mark[x][y] = true;     par[x][y] = cnt;     counter++;     for (int i = 0; i < adj[x][y].size(); i++) {       int x1 = adj[x][y][i].first;       int y1 = adj[x][y][i].second;       if (!mark[x1][y1]) dfs(x1, y1);     }   }   int f(int x, int y) {     int A[4] = {0};     if (x != 0 && a[x - 1][y] ==  . ) A[0] = par[x - 1][y];     if (x != n - 1 && a[x + 1][y] ==  . ) A[1] = par[x + 1][y];     if (y != 0 && a[x][y - 1] ==  . ) A[2] = par[x][y - 1];     if (y != m - 1 && a[x][y + 1] ==  . ) A[3] = par[x][y + 1];     for (int i = 0; i < 4; i++)       for (int j = i + 1; j < 4; j++)         if (A[i] == A[j]) A[j] = 0;     int ans = 0;     if (x != 0) ans += b[A[0]];     if (x != n - 1) ans += b[A[1]];     if (y != 0) ans += b[A[2]];     if (y != m - 1) ans += b[A[3]];     ans++;     ans %= 10;     return ans;   }   int main() {     cin >> n >> m;     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) cin >> a[i][j];     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         if (a[i][j] ==  . ) {           if (i != 0)             if (a[i - 1][j] ==  . ) adj[i][j].push_back(pair<int, int>(i - 1, j));           if (i != n - 1)             if (a[i + 1][j] ==  . ) adj[i][j].push_back(pair<int, int>(i + 1, j));           if (j != 0)             if (a[i][j - 1] ==  . ) adj[i][j].push_back(pair<int, int>(i, j - 1));           if (j != m - 1)             if (a[i][j + 1] ==  . ) adj[i][j].push_back(pair<int, int>(i, j + 1));         }       }     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) {         if (!mark[i][j]) {           counter = 0;           cnt++;           dfs(i, j);           b[cnt] = counter;         }       }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (a[i][j] ==  . )           printf( . );         else {           printf( %d , f(i, j));         }       }       printf(  n );     }   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0;     bool flag = 0;     int ch = getchar();     while ( 0  > ch || ch >  9 ) {       if (ch ==  - ) flag = 1;       ch = getchar();     }     while ( 0  <= ch && ch <=  9 ) {       x = (x << 1) + (x << 3) + (ch ^ 48);       ch = getchar();     }     return flag ? -x : x;   }   const int maxn = 1e5 + 10;   int n, out[maxn];   bool vis[maxn];   int main() {     n = read();     if (n % 2)       printf( -1 );     else {       for (register int i = n; i >= 1; i--) {         if (vis[(out[i + 1] + n) / 2]) {           if (vis[out[i + 1] / 2]) {             printf( -1 );             return 0;           } else {             vis[out[i + 1] / 2] = 1;             out[i] = out[i + 1] / 2;           }         } else {           vis[(out[i + 1] + n) / 2] = 1;           out[i] = (out[i + 1] + n) / 2;         }       }       for (register int i = 1; i <= n + 1; i++) printf( %d  , out[i]);     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 ,  unroll-loops )   using namespace std;   template <typename T1, typename T2>   inline void checkmin(T1 &x, T2 y) {     if (x > y) x = y;   }   template <typename T1, typename T2>   inline void checkmax(T1 &x, T2 y) {     if (x < y) x = y;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, k;     cin >> n >> k;     vector<string> arr(n);     vector<vector<long long>> cnt(n, vector<long long>(n));     for (auto &i : arr) cin >> i;     for (int i = 0; i <= n - k; ++i)       for (int j = 0; j < n; ++j) {         bool flag = true;         for (int p = i; p < i + k; ++p) flag = flag && (arr[p][j] ==  . );         if (flag)           for (int p = i; p < i + k; ++p) ++cnt[p][j];       }     if (k > 1) {       for (int j = 0; j <= n - k; ++j)         for (int i = 0; i < n; ++i) {           bool flag = true;           for (int p = j; p < j + k; ++p) flag = flag && (arr[i][p] ==  . );           if (flag)             for (int p = j; p < j + k; ++p) ++cnt[i][p];         }     }     long long x = 0, y = 0;     for (int i = 0; i < n; ++i)       for (int j = 0; j < n; ++j) {         if (cnt[i][j] > cnt[x][y]) {           x = i;           y = j;         }       }     cout << x + 1 <<     << y + 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<string> posn(8);   int ans[8][8][8];   int movex[9] = {-1, -1, -1, 0, 1, 1, 1, -1, 0};   int movey[9] = {-1, 0, 1, 1, 1, 0, -1, -1, 0};   int dp(int x, int y, int t) {     if (t > 7) return 1;     if (ans[x][y][t] != -1) return ans[x][y][t];     for (int i = 0; i < 9; i++) {       int tx, ty;       tx = x + movex[i];       ty = y + movey[i];       if (tx >= 0 && tx < 8 && ty >= 0 && ty < 8) {         if (tx - t - 1 >= 0)           if (posn[tx - t - 1][ty] ==  S ) continue;         if (tx - t >= 0)           if (posn[tx - t][ty] ==  S ) continue;         if (dp(tx, ty, t + 1)) {           return ans[x][y][t] = 1;         }       }     }     return ans[x][y][t] = 0;   }   int main() {     for (int i = 0; i < 8; i++) {       cin >> posn[i];       for (int j = 0; j < 8; j++) {         for (int k = 0; k < 8; k++) ans[i][j][k] = -1;       }     }     if (dp(7, 0, 0))       cout <<  WIN ;     else       cout <<  LOSE ;     return 0;   }
#include<bits/stdc++.h>      using namespace std;   typedef long long ll;   typedef unsigned long long ull;   typedef unsigned int uint;   typedef pair<int, int> pii;      int n, k;   char s[300005];      void solve() {       while (~scanf( %d%d , &n, &k)) {           memset(s, 0, sizeof(s));           s[n + 1] =   0 ;           int top = 0;           s[++top] =  a ;           for (int i = 1; i <= k; ++i) {               char cur =  a  + i - 1;               s[++top] = cur;               for (int j = k; j >= i + 1; --j) {                   char tcur =  a  + j - 1;                   s[++top] = tcur;                   if (j != i + 1)                       s[++top] = cur;               }           }           for (int i = k - 1; i >= 1; --i) {               char cur =  a  + i - 1;               s[++top] = cur;           }   //        puts(s + 1);           int len = top;           int sumlen = len;           while (top <= n) {               for (int i = 2; i <= len; ++i)                   s[++top] = s[i];           }           s[n + 1] =   0 ;           puts(s + 1);       }   }      int main() {       int T = 1;   //    scanf( %d , &T);       for (int i = 1; i <= T; ++i) {   //        printf( Case #%d:  , i);           solve();       }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100010;   int n, d, b;   long long sum[N];   inline int gi() {     int x = 0, o = 1;     char ch = getchar();     while (ch !=  -  && (ch <  0  || ch >  9 )) ch = getchar();     if (ch ==  - ) o = -1, ch = getchar();     while (ch >=  0  && ch <=  9 ) x = x * 10 + ch -  0 , ch = getchar();     return x * o;   }   inline int check(int mid) {     int g = (n + 1) / 2, s1 = 0, s2 = 0;     for (int i = 1; i <= g; i++) {       int f1, f2;       f1 = sum[min(i + 1LL * d * i, (long long)n)] - 1LL * s1 * b;       f2 = sum[n] - sum[max(0LL, n - i - 1LL * d * i)] - 1LL * s2 * b;       if (i == n - i + 1)         s1 += (f1 >= b);       else {         if (s1 < mid + n % 2) s1 += (f1 >= b);         if (s2 < mid) s2 += (f2 >= b);       }     }     if (s1 >= mid + n % 2 && s2 >= mid) return 1;     return 0;   }   int main() {     cin >> n >> d >> b;     for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + gi();     int l = 0, r = n / 2, ans = (n + 1) / 2;     while (l <= r) {       int mid = (l + r) >> 1;       if (check(mid))         l = mid + 1, ans = n / 2 - mid;       else         r = mid - 1;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 50010;   string g[N];   int q, n, m, ro[N], co[N];   int main() {     cin.tie(0);     ios_base::sync_with_stdio(0);     cin >> q;     while (q--) {       cin >> n >> m;       for (int i = 0; i < n; ++i) cin >> g[i];       for (int i = 0; i < n; ++i) {         ro[i] = 0;         for (int j = 0; j < m; ++j) ro[i] += g[i][j] ==  . ;       }       for (int i = 0; i < m; ++i) {         co[i] = 0;         for (int j = 0; j < n; ++j) co[i] += g[j][i] ==  . ;       }       int ans = n * m;       for (int i = 0; i < n; ++i) {         for (int j = 0; j < m; ++j) {           int here = ro[i] + co[j] - (g[i][j] ==  . );           ans = min(ans, here);         }       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1.2e5 + 7;   int n, m, a[N];   int flag[N << 2], times[N << 2];   long long sum[N << 2], Ans[N];   struct PII {     int minn, cnt;   } f[N << 2];   PII operator+(PII aa, PII bb) {     PII res;     res.minn = min(aa.minn, bb.minn), res.cnt = 0;     if (aa.minn == res.minn) res.cnt += aa.cnt;     if (bb.minn == res.minn) res.cnt += bb.cnt;     return res;   }   void ad(int id, int first) { flag[id] += first, f[id].minn += first; }   void adt(int id, int first) {     times[id] += first, sum[id] += 1ll * first * f[id].cnt;   }   void upd(int id) {     sum[id] = sum[id << 1] + sum[id << 1 | 1];     f[id] = f[id << 1] + f[id << 1 | 1];   }   void pushdown(int id) {     if (flag[id]) ad(id << 1, flag[id]), ad(id << 1 | 1, flag[id]), flag[id] = 0;     if (times[id]) {       if (f[id].minn == f[id << 1].minn) adt(id << 1, times[id]);       if (f[id].minn == f[id << 1 | 1].minn) adt(id << 1 | 1, times[id]);       times[id] = 0;     }   }   void build(int id, int L, int R) {     if (L == R) return f[id].cnt = 1, f[id].minn = 0, void();     int mid = (L + R) / 2;     build(id << 1, L, mid), build(id << 1 | 1, mid + 1, R);   }   void add(int id, int L, int R, int l, int r, int val) {     if (l <= L && R <= r) return ad(id, val), void();     int mid = (L + R) / 2;     pushdown(id);     if (l <= mid) add(id << 1, L, mid, l, r, val);     if (r > mid) add(id << 1 | 1, mid + 1, R, l, r, val);     upd(id);   }   void fadd(int id, int L, int R, int l, int r) {     if (l <= L && R <= r) return adt(id, 1), void();     int mid = (L + R) / 2;     pushdown(id);     if (l <= mid && f[id].minn == f[id << 1].minn) fadd(id << 1, L, mid, l, r);     if (r > mid && f[id].minn == f[id << 1 | 1].minn)       fadd(id << 1 | 1, mid + 1, R, l, r);     upd(id);   }   long long query(int id, int L, int R, int l, int r) {     if (l <= L && R <= r) return sum[id];     int mid = (L + R) / 2;     long long res = 0;     pushdown(id);     if (l <= mid) res += query(id << 1, L, mid, l, r);     if (r > mid) res += query(id << 1 | 1, mid + 1, R, l, r);     return res;   }   int Gmax[N], tota, Gmin[N], totb;   int l[N], r[N];   vector<int> ve[N];   int main() {     scanf( %d , &n);     for (int i = 1, iE = n; i <= iE; i++) scanf( %d , &a[i]);     build(1, 1, n);     scanf( %d , &m);     for (int i = 1, iE = m; i <= iE; i++)       scanf( %d%d , &l[i], &r[i]), ve[r[i]].push_back(i);     for (int i = 1, iE = n; i <= iE; i++) {       if (i != 1) add(1, 1, n, 1, i - 1, -1);       while (tota && a[i] > a[Gmax[tota]])         add(1, 1, n, Gmax[tota - 1] + 1, Gmax[tota], a[i] - a[Gmax[tota]]),             --tota;       while (totb && a[i] < a[Gmin[totb]])         add(1, 1, n, Gmin[totb - 1] + 1, Gmin[totb], a[Gmin[totb]] - a[i]),             --totb;       Gmax[++tota] = i, Gmin[++totb] = i;       fadd(1, 1, n, 1, i);       for (int v : ve[i]) Ans[v] = query(1, 1, n, l[v], r[v]);     }     for (int i = 1, iE = m; i <= iE; i++) printf( %lld n , Ans[i]);     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize( Ofast,no-stack-protector )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #pragma GCC optimize( unroll-loops )   const int MAX = 2e3 + 10;   const int MOD = 1e9 + 7;   using namespace std;   int n, m;   char s[MAX][MAX];   int vis[30], x[30], y[30];   int sum1[MAX][MAX], sum2[MAX][MAX];   bool f(int a, int b) {     if (a < 1 || b < 1 || a > n || b > m) return false;     return true;   }   int main() {     ios::sync_with_stdio(false), cout.tie(NULL);     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> (s[i] + 1);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         sum1[i][j] = sum1[i - 1][j];         sum2[i][j] = sum2[i][j - 1];         if (s[i][j] ==  # ) {           sum1[i][j]++;           sum2[i][j]++;         } else if (s[i][j] !=  . ) {           vis[s[i][j] -  A ] = 1;           x[s[i][j] -  A ] = i;           y[s[i][j] -  A ] = j;         }       }     }     int k;     cin >> k;     while (k--) {       char dir[2];       int len;       cin >> dir >> len;       if (dir[0] ==  N ) {         for (int i = 0; i < 27; i++) {           if (vis[i]) {             int xx = x[i] - len;             if (!f(xx, y[i]) || sum1[x[i]][y[i]] != sum1[xx - 1][y[i]])               vis[i] = 0;             x[i] = xx;           }         }       } else if (dir[0] ==  S ) {         for (int i = 0; i < 27; i++) {           if (vis[i]) {             int xx = x[i] + len;             if (!f(xx, y[i]) || sum1[x[i]][y[i]] != sum1[xx][y[i]]) vis[i] = 0;             x[i] = xx;           }         }       } else if (dir[0] ==  W ) {         for (int i = 0; i < 27; i++) {           if (vis[i]) {             int yy = y[i] - len;             if (!f(x[i], yy) || sum2[x[i]][y[i]] != sum2[x[i]][yy - 1])               vis[i] = 0;             y[i] = yy;           }         }       } else {         for (int i = 0; i < 27; i++) {           if (vis[i]) {             int yy = y[i] + len;             if (!f(x[i], yy) || sum2[x[i]][y[i]] != sum2[x[i]][yy]) {               vis[i] = 0;             }             y[i] = yy;           }         }       }     }     int fg = 0;     for (int i = 0; i < 27; i++) {       if (vis[i]) {         fg = 1;         cout << char(i +  A );       }     }     if (!fg) cout <<  no solution ;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     int y, x, kind;   };   int main() {     int n, m, k, s;     cin >> n >> m >> k >> s;     vector<vector<int>> a(n, vector<int>(m));     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         cin >> a[i][j];         a[i][j]--;       }     }     vector<int> q(s);     for (int i = 0; i < s; ++i) {       cin >> q[i];       q[i]--;     }     vector<point> ps;     for (int ki = 0; ki < k; ++ki) {       auto search = [&](int y, int x) {         int cy = -1, cx = -1;         for (int i = 0; i < n; ++i) {           for (int j = 0; j < m; ++j) {             if (a[i][j] != ki) continue;             if (cy == -1 || abs(cy - y) + abs(cx - x) > abs(i - y) + abs(j - x)) {               cy = i, cx = j;             }           }         }         if (cy != -1) {           ps.push_back(point{cy, cx, ki});         }       };       search(0, 0);       search(n - 1, 0);       search(0, m - 1);       search(n - 1, m - 1);     }     vector<vector<int>> dist(k, vector<int>(k));     for (const auto& p1 : ps) {       for (const auto& p2 : ps) {         dist[p1.kind][p2.kind] =             max(dist[p1.kind][p2.kind], abs(p1.x - p2.x) + abs(p1.y - p2.y));       }     }     int ans = 0;     for (int i = 0; i + 1 < s; ++i) {       ans = max(ans, dist[q[i]][q[i + 1]]);     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int P = 998244353;   vector<int> L, R;   pair<long long, long long> f[25][1500];   long long l, r, dx[25];   int k;   pair<long long, long long> dfs(vector<int> w, int pos, int mask, int cnt,                                  int op) {     if (pos < 0) return make_pair(0, 0);     if (!op && ~f[pos][mask].first) return f[pos][mask];     long long mx = (op ? w[pos] : 9), res = 0, num = 0;     if (!pos) {       for (int i = 0; i <= mx; i++)         if (mask & (1 << i))           res += i, num++;         else if (cnt < k)           res += i, num++;       if (!op) f[pos][mask] = make_pair(res, num);       return make_pair(res, num);     }     for (int i = 0; i <= mx; i++)       if (mask & (1 << i) || cnt < k) {         pair<long long, long long> p;         if (mask & (1 << i) || !mask && !i)           p = dfs(w, pos - 1, mask, cnt, op & (i == mx));         else           p = dfs(w, pos - 1, mask | (1 << i), cnt + 1, op & (i == mx));         res = ((long long)i * dx[pos] % P * p.second % P + res + p.first) % P;         num = (num + p.second) % P;       }     if (!op) f[pos][mask] = make_pair(res, num);     return make_pair(res, num);   }   int main() {     dx[0] = 1;     for (int i = 1; i <= 18; i++) dx[i] = (dx[i - 1] * 10) % P;     scanf( %lld%lld%d , &l, &r, &k);     l--;     while (l) L.push_back(l % 10), l /= 10;     while (r) R.push_back(r % 10), r /= 10;     memset(f, -1, sizeof(f));     pair<long long, long long> ansL = dfs(L, L.size() - 1, 0, 0, 1);     pair<long long, long long> ansR = dfs(R, R.size() - 1, 0, 0, 1);     printf( %lld n , (ansR.first - ansL.first + P) % P);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int solve() {     int n;     cin >> n;     if (n == 1)       cout << 1 << endl;     else {       cout << n <<    ;       for (int i = 1; i <= n - 1; ++i) cout << i <<    ;       cout <<   n ;     }     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     t = 1;     while (t-- != 0) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200500;   long long a[N];   long long p[N], s[N];   int n, k, x;   long long get(int i) {     long long res = 0;     if (i) res |= p[i - 1];     if (i != n - 1) res |= s[i + 1];     return res | (a[i] * x);   }   int main() {     cin >> n >> k >> x;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (i == 0)         p[i] = a[i];       else         p[i] = p[i - 1] | a[i];     }     long long tmp = 1;     for (int i = 0; i < k; i++) tmp *= x;     x = tmp;     long long res = 0;     s[n - 1] = a[n - 1];     for (int i = n - 2; i >= 0; i--) s[i] = s[i + 1] | a[i];     int id = -1;     for (int j = 0; j < n; j++)       if (res <= get(j)) res = get(j), id = j;     a[id] *= x;     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ld = long double;   void run();   signed main() {     ios::sync_with_stdio(0);     cin.tie();     cout << fixed << setprecision(13);     run();   }   void print(vector<long long> a) {     for (long long i : a) {       cout << i <<    ;     }     cout << endl;   }   void run() {     long long n, k;     cin >> n >> k;     vector<long long> cnt = {1, 1, 2};     for (long long i = 3; i <= n; ++i) {       cnt.push_back(cnt.back() + cnt[cnt.size() - 2]);     }     --k;     vector<long long> ans;     for (long long i = 1; i <= n; ++i) {       if (cnt[n - i] <= k) {         k -= cnt[n - i];         ans.push_back(i + 1);         ans.push_back(i);         ++i;       } else {         ans.push_back(i);       }     }     for (long long i : ans) {       cout << i <<    ;     }   }