malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int n, p, l = -1, r = 0, i, j, ans = 0;     cin >> n >> p;     cin >> s;     n--, p--;     if (p > n / 2) p = n - p;     for (i = 0; i <= n / 2; i++) {       if (s[i] != s[n - i]) {         long long int dif = abs(s[i] - s[n - i]);         ans += min(dif, 26 - dif);         if (l < 0)           l = i;         else           r = i;       }     }     ans += min(abs(p - l), abs(p - r));     ans += max((r - l), 0LL);     cout << (l < 0 ? 0 : ans) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 1e3 + 9, lg = 19, MOD = 1e9 + 7, maxV = 1e6 + 9;   pair<int, int> arr[3];   int dp[maxN][maxN];   pair<int, int> auxi[maxN][maxN];   bool vi[maxN][maxN];   int dst(pair<int, int> one, pair<int, int> two) {     return abs(one.first - two.first) + abs(two.second - one.second);   }   const int dr[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};   bool ins(int x, int y) { return x < maxN && y < maxN && y >= 0 && x >= 0; }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n = 3;     for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second;     pair<int, int> begi = pair<int, int>(min(arr[0].first, arr[1].first),                                          min(arr[0].second, arr[1].second));     pair<int, int> ende = pair<int, int>(max(arr[0].first, arr[1].first),                                          max(arr[0].second, arr[1].second));     pair<int, int> clos = begi;     for (int i = begi.first; i <= ende.first; i++) {       for (int j = begi.second; j <= ende.second; j++) {         if (dst(arr[2], clos) > dst(arr[2], pair<int, int>(i, j))) {           clos = pair<int, int>(i, j);         }       }     }     queue<pair<int, int> > q;     q.push(clos);     memset(dp, -1, sizeof dp);     dp[clos.first][clos.second] = 0;     auxi[clos.first][clos.second] = pair<int, int>(-1, -1);     while (q.size()) {       pair<int, int> cr = q.front();       q.pop();       for (int i = 0; i < 4; i++) {         int x = cr.first + dr[i][0], y = cr.second + dr[i][1];         if (!ins(x, y) || dp[x][y] != -1) continue;         dp[x][y] = dp[cr.first][cr.second] + 1;         auxi[x][y] = cr;         q.push(pair<int, int>(x, y));       }     }     for (int i = 0; i < 3; i++) {       pair<int, int> strt = arr[i];       while (strt != pair<int, int>(-1, -1)) {         vi[strt.first][strt.second] = 1;         strt = auxi[strt.first][strt.second];       }     }     vector<pair<int, int> > ans;     for (int i = 0; i < maxN; i++)       for (int j = 0; j < maxN; j++)         if (vi[i][j]) ans.push_back(pair<int, int>(i, j));     cout << ans.size() <<   n ;     for (pair<int, int> el : ans) cout << el.first <<     << el.second <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2020;   struct Slope {     long long x, y;     bool up;     Slope() {}     Slope(long long x, long long y, bool up) : x(x), y(y), up(up) {}     bool operator<(const Slope& m) const {       pair<long long, long long> p1 = {y, x};       pair<long long, long long> p2 = {m.y, m.x};       return (1LL * p1.first * p2.second < 1LL * p2.first * p1.second);     }   };   long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }   pair<long long, long long> getSlope(long long x, long long y) {     long long G = gcd(x, y);     x /= G;     y /= G;     if (x < 0) {       x = -x;       y = -y;     }     return {y, x};   }   long long C(long long n, long long k = 2) {     if (k > n) return 0;     return n * (n - 1) / 2;   }   vector<Slope> v;   vector<pair<long long, long long>> Point;   long long Sweep(int centerIdx) {     long long side1 = 0, side2 = 0, Ans = 0;     for (int i = 0; i < (int)Point.size(); i++)       if (i != centerIdx) {         long long x = Point[i].first - Point[centerIdx].first;         long long y = Point[i].second - Point[centerIdx].second;         bool up;         if (x > 0 || (x == 0 && y > 0))           up = true, side1++;         else           up = false, side2++;         pair<long long, long long> m = getSlope(x, y);         v.push_back(Slope(m.first, m.second, up));       }     sort(v.begin(), v.end());     for (int i = 0; i < v.size(); i++) {       if (v[i].up)         side1--;       else         side2--;       Ans += C(side1) * C(side2);       if (v[i].up)         side2++;       else         side1++;     }     v.clear();     return Ans;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       Point.push_back({x, y});     }     long long Ans = 0;     for (int i = 0; i < n; i++) Ans += Sweep(i);     printf( %I64d n , Ans / 2);     return 0;   }
#include <bits/stdc++.h>   const int N = 55;   const int M = 2e4 + 5;   const long long inf = 9223372036854775807ll;   int n, m, i, j, k;   long long a[N][M], sum[N][M], dp[M];   long long mx[3][M << 2];   inline void push_up(int c, int u) {     mx[c][u] = std::max(mx[c][u << 1], mx[c][u << 1 | 1]);   }   void build(int l, int r, int u) {     if (l == r) {       mx[0][u] = mx[1][u] = mx[2][u] = -inf;       return;     }     int mid = (l + r) >> 1;     build(l, mid, u << 1);     build(mid + 1, r, u << 1 | 1);     push_up(0, u);     push_up(1, u);     push_up(2, u);   }   void modify(int c, int p, int l, int r, int u, long long v) {     if (l == r) {       mx[c][u] = v;       return;     }     int mid = (l + r) >> 1;     if (p <= mid) {       modify(c, p, l, mid, u << 1, v);     } else {       modify(c, p, mid + 1, r, u << 1 | 1, v);     }     push_up(c, u);   }   long long range_max(int c, int ql, int qr, int l, int r, int u) {     if (ql <= l && r <= qr) {       return mx[c][u];     }     long long res = -inf;     int mid = (l + r) >> 1;     if (ql <= mid) {       res = std::max(res, range_max(c, ql, qr, l, mid, u << 1));     }     if (mid < qr) {       res = std::max(res, range_max(c, ql, qr, mid + 1, r, u << 1 | 1));     }     return res;   }   int main() {     scanf( %d %d %d , &n, &m, &k);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         scanf( %lld , a[i] + j);         sum[i][j] = sum[i][j - 1] + a[i][j];       }     }     build(1, m, 1);     for (int i = 1; i <= n; i++) {       auto conb = [&](int x, int y) {         long long res = 0;         res += sum[x][y + k - 1] - sum[x][y - 1];         if (x < n) {           res += sum[x + 1][y + k - 1] - sum[x + 1][y - 1];         }         return res;       };       for (int j = 1; j <= m - k + 1; j++) {         dp[j] = 0;         if (i == 1) {           dp[j] = conb(i, j);           continue;         }         if (j - k >= 1) {           dp[j] = std::max(dp[j], range_max(0, 1, j - k, 1, m, 1));         }         if (j + k <= m) {           dp[j] = std::max(dp[j], range_max(0, j + k, m, 1, m, 1));         }         dp[j] = std::max(dp[j], range_max(1, std::max(j - k + 1, 1), j, 1, m, 1) +                                     sum[i][j - 1]);         dp[j] = std::max(dp[j],                          range_max(2, j, j + k - 1, 1, m, 1) - sum[i][j + k - 1]);         dp[j] += conb(i, j);       }       for (int j = 1; j <= m - k + 1; j++) {         modify(0, j, 1, m, 1, dp[j]);         modify(1, j, 1, m, 1, dp[j] - sum[i + 1][j + k - 1]);         modify(2, j, 1, m, 1, dp[j] + sum[i + 1][j - 1]);       }     }     long long ans = 0;     for (int i = 1; i <= m; i++) {       ans = std::max(ans, dp[i]);     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k = 0;     cin >> n;     int r[n];     for (int i = 0; i < n; ++i) {       cin >> r[i];       if (r[i] % 2 == 1) ++k;     }     if (k % 2 == 0)       cout << n - k;     else       cout << k;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long int ans = 1;   int main() {     int i, j, k, l, c = 0, fuck = 0;     string s;     cin >> s;     l = s.size();     s +=  9 ;     for (i = 0; i < l; i++) {       if (fuck == 1) {         if (int(s[i] - 48) + int(s[i + 1] - 48) == 9)           c += 1;         else {           if (c % 2 != 0) ans *= (c / 2 + 1);           fuck = 0;         }       }       if (fuck == 0) {         if (int(s[i] - 48) + int(s[i + 1] - 48) == 9) {           fuck = 1;           c = 2;         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct E {     int to, nxt, d;   } b[100005 << 1];   int fst[100005], tot;   void insert(int f, int t, int d) {     b[++tot] = (E){t, fst[f], d};     fst[f] = tot;     b[++tot] = (E){f, fst[t], d};     fst[t] = tot;   }   int in[100005];   int dfn[100005];   int deep[100005];   long long dis[100005];   int fa[100005][20];   int dfs_c;   void dfs(int x) {     for (int i = 1; i <= 17; i++) fa[x][i] = fa[fa[x][i - 1]][i - 1];     dfn[++dfs_c] = x;     in[x] = dfs_c;     for (int i = fst[x]; i; i = b[i].nxt) {       int v = b[i].to;       if (!in[v]) {         fa[v][0] = x;         deep[v] = deep[x] + 1;         dis[v] = dis[x] + b[i].d;         dfs(v);       }     }   }   int lca(int u, int v) {     if (deep[u] > deep[v]) swap(u, v);     int t = deep[v] - deep[u];     for (int i = 0; i <= 17; i++)       if ((t >> i) & 1) v = fa[v][i];     if (u == v) return u;     for (int i = 17; i >= 0; i--)       if (fa[u][i] != fa[v][i]) {         u = fa[u][i];         v = fa[v][i];       }     return fa[u][0];   }   long long query(int u, int v) {     int l = lca(u, v);     return dis[u] + dis[v] - 2 * dis[l];   }   char s[5];   set<int> S;   set<int>::iterator it;   int main() {     int n;     scanf( %d , &n);     int x, y, c;     for (int i = 1; i < n; i++) {       scanf( %d%d%d , &x, &y, &c);       insert(x, y, c);     }     deep[1] = 1;     fa[1][0] = 1;     dfs(1);     long long ans = 0;     int m;     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       scanf( %s , s);       if (s[0] ==  + ) {         int y = 0, z = 0;         scanf( %d , &x);         S.insert(in[x]);         it = S.find(in[x]);         it++;         if (it != S.end()) {           y = dfn[*it];           ans += query(x, y);         }         it--;         if (it != S.begin()) {           it--;           z = dfn[*it];           if (y) ans -= query(y, z);           ans += query(x, z);         }       }       if (s[0] ==  - ) {         int y = 0, z = 0;         scanf( %d , &x);         it = S.find(in[x]);         it++;         if (it != S.end()) {           y = dfn[*it];           ans -= query(x, y);         }         it--;         if (it != S.begin()) {           it--;           z = dfn[*it];           if (y) ans += query(y, z);           ans -= query(x, z);         }         S.erase(in[x]);       }       if (s[0] ==  ? ) {         long long p = ans;         if (S.size() > 1) {           set<int>::iterator it2;           it = S.begin();           it2 = S.end();           it2--;           p += query(dfn[*it], dfn[*it2]);         }         printf( %I64d n , p / 2);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   long long f[1005][2005][4];   int main() {     f[1][1][0] = f[1][1][1] = f[1][2][2] = f[1][2][3] = 1;     cin >> n >> k;     for (int i = 1; i <= n; i++) f[i][1][0] = f[i][1][1] = 1;     for (int i = 2; i <= n; i++) {       for (int j = 2; j <= k; j++) {         f[i][j][0] = (f[i - 1][j][0] + f[i - 1][j - 1][1] + f[i - 1][j][2] +                       f[i - 1][j][3]) %                      998244353;         f[i][j][1] = (f[i - 1][j - 1][0] + f[i - 1][j][1] + f[i - 1][j][2] +                       f[i - 1][j][3]) %                      998244353;         f[i][j][2] = (f[i - 1][j - 1][0] + f[i - 1][j - 1][1] + f[i - 1][j][2] +                       f[i - 1][j - 2][3]) %                      998244353;         f[i][j][3] = (f[i - 1][j - 1][0] + f[i - 1][j - 1][1] +                       f[i - 1][j - 2][2] + f[i - 1][j][3]) %                      998244353;       }     }     long long ans = 0;     for (int i = 0; i <= 3; i++) ans = (ans + f[n][k][i]) % 998244353;     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 3000 * 100 + 5;   vector<pair<int, int> > adj[N];   pair<int, int> edge[N];   short d[N];   bool mark[N], edg[N], c[N];   int bad[N], par[N], m, n;   void findd(int a, int e, int b) {     while (a != b) {       edg[e] = 1;       if (a == edge[e].first)         a = edge[e].second;       else         a = edge[e].first;       e = par[a];     }     return;   }   void DFS2(int v, int parr) {     mark[v] = 1;     par[v] = parr;     int s = adj[v].size();     int temp = -1, temp2 = 0;     if (c[v]) temp = v;     for (int i = 0; i < s; i++) {       int u = adj[v][i].first;       int w = adj[v][i].second;       if (!mark[u]) {         DFS2(u, w);         if (bad[u] != -1) {           if (temp == -1) {             temp = bad[u];             temp2 = par[bad[u]];           } else {             findd(temp, temp2, v);             findd(bad[u], par[bad[u]], v);             temp = -1;           }         }       }     }     bad[v] = temp;     return;   }   void DFS(int v) {     mark[v] = 1;     int s = adj[v].size();     for (int i = 0; i < s; i++) {       int u = adj[v][i].first;       int w = adj[v][i].second;       if (!mark[u]) {         DFS(u);         if (c[u]) {           c[v] = 1 - c[v];           edg[w] = 1;         }       }     }     return;   }   void pp() {     int t = 0;     for (int i = 0; i < m; i++) {       if (!edg[i]) t++;     }     printf( %d n , t);     for (int i = 0; i < m; i++) {       if (!edg[i]) printf( %d n , i + 1);     }     return;   }   int main() {     int t = -1, x, y, k = 0;     scanf( %d %d , &n, &m);     for (int i = 0; i < n; i++) {       scanf( %d , &d[i]);       if (d[i] == -1) t = i;     }     for (int i = 0; i < m; i++) {       scanf( %d %d , &x, &y);       adj[--x].push_back(make_pair(--y, i));       adj[y].push_back(make_pair(x, i));       edge[i] = make_pair(x, y);     }     for (int i = 0; i < n; i++) {       int s = adj[i].size();       if (d[i] == 0 && s % 2) {         k++;         c[i] = 1;       }       if (d[i] == 1 && s % 2 == 0) {         k++;         c[i] = 1;       }     }     if (t != -1) {       DFS(t);       pp();     } else {       t = 0;       if (k % 2 == 1) {         cout <<  -1 ;         return 0;       }       DFS2(0, m);       pp();     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     multiset<string> p;     cin >> s;     for (int i = 0; i < s.size(); i++) {       if ((s[i] ==  < ) || (s[i] ==  > )) s[i] =    ;     }     istringstream sin(s);     multiset<string>::iterator it;     string f;     while (sin >> f) {       if (f[0] !=  / ) {         p.insert(f);         cout << string(2 * (p.size() - 1),    ) <<  <  << f <<  >  << endl;       } else {         cout << string(2 * (p.size() - 1),    ) <<  <  << f <<  >  << endl;         f = f.substr(1);         it = p.find(f);         if (it != p.end()) p.erase(it);       }     }   }
// Cutiepie is a hoe!   #pragma comment(linker,  /stack:200000000 )   #pragma GCC optimize ( Ofast )   #pragma GCC target ( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx )   #include <bits/stdc++.h>   using namespace std;      #define TRACE      #ifdef TRACE   #define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)   template <typename Arg1>   void __f(const char* name, Arg1&& arg1){    cerr << name <<   :   << arg1 << std::endl;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args){    const char* comma = strchr(names + 1,  , );cerr.write(names, comma - names) <<   :   << arg1<<  |  ;__f(comma+1, args...);   }   #else   #define trace(...)   #endif      #define rep(i, a) for(int i = 0; i < (a); ++i)   #define repp(i, a, b) for(int i = a; i < (b); ++i)   #define trav(a, x) for(auto& a : x)   #define all(x) x.begin(), x.end()   #define sz(x) (int)(x).size()   #define fst first   #define snd second   #define mp make_pair   #define pb push_back   typedef long long ll;   typedef long double ld;   typedef pair<int, int> pii;   typedef vector<int> vi;      int a[1005][1005];   int ee[3][1005];   ll s[1005];   ll s2[1005];      void solve()   {     int n, k;     cin>>n>>k;     rep(i, k){       s[i] = 0;       rep(j, n)       {         cin>>a[i][j];         s[i] += 1LL*a[i][j];         s2[i] += 1LL*a[i][j]*a[i][j];       }     }     fflush(stdout);     int kk = 1;     ll change, vdif;     if(2*s[1] == s[0]+s[2]){       vdif = s[1]-s[0];     }else{       vdif = s[k-1]-s[k-2];     }     repp(i, 1, k)     {       if(vdif != s[i]-s[i-1]){         change = s[i]-s[i-1]-vdif;         kk = i;         break;       }     }     ll v2;     if(kk<=2){       v2 = s2[k-1]+s2[k-3]-2LL*s2[k-2];     }else{       v2 = s2[2]+s2[0]-2LL*s2[1];     }     ll v2_ = s2[kk+1]+s2[kk-1]-2LL*s2[kk];     rep(i, n)     {       ll x = a[kk][i];       ll y = x - change;       ll v2__ = v2_ + 2LL*x*x - 2LL*y*y;       if(v2 == v2__){         cout<<kk<<   <<y<<endl;         fflush(stdout);         return;       }     }   }      int main() {     cin.sync_with_stdio(0); cin.tie(0);     cin.exceptions(cin.failbit);     solve();     return 0;   }
#include <bits/stdc++.h>   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(nullptr);     std::cout.tie(nullptr);     std::string str;     std::cin >> str;     std::uint64_t l = 0, r = str.size() - 1;     while (l < str.size() && std::isupper(str[l])) l++;     while (r && std::islower(str[r])) r--;     std::uint64_t lower_total = 0, upper_total = 0;     for (int i = l; i <= r; ++i)       if (std::isupper(str[i]))         upper_total++;       else         lower_total++;     std::uint64_t ans = std::min(lower_total, upper_total), lower_count = 0,                   upper_count = 0;     for (int i = l; i <= r; ++i) {       if (std::islower(str[i])) {         ans = std::min(ans, lower_count + upper_total - upper_count);         lower_count++;       } else         upper_count++;     }     std::cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int ans = 0;     char c = getchar();     while (!isdigit(c)) c = getchar();     while (isdigit(c)) ans = (ans << 3) + (ans << 1) + (c ^ 48), c = getchar();     return ans;   }   int fa[5005], cnt[5005], sum[5005], dep[5005], bad[5005];   int main() {     sum[1] = 1;     for (int i = 2; i < 5005; i++) sum[i] = i + sum[i / 2] + sum[i - i / 2 - 1];     for (int i = 1; i < 5005; i++) sum[i] -= i;     for (int T = read(); T; T--) {       int n, d;       n = read(), d = read();       int cur = n * (n - 1) / 2;       if (d < sum[n] || d > cur) {         puts( NO );         continue;       }       fa[1] = 0;       for (int i = 2; i <= n; i++) fa[i] = i - 1;       for (int i = 1; i < n; i++) cnt[i] = 1;       cnt[n] = 0;       for (int i = 1; i <= n; i++) bad[i] = 0, dep[i] = i - 1;       while (cur > d) {         int u;         for (u = 1; u <= n; u++)           if (!cnt[u] && !bad[u]) break;         bad[u] = 1;         for (int p = 1; p <= n; p++)           if (cnt[p] < 2 && dep[u] - dep[p] == 2) {             --cnt[fa[u]], fa[u] = p;             dep[u] = dep[p] + 1, ++cnt[p];             bad[u] = 0, --cur;             break;           }       }       puts( YES );       for (int i = 2; i <= n; i++) printf( %d%c , fa[i],    n [i == n]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename L>   bool smax(T &x, L y) {     return x < y ? (x = y, true) : false;   }   template <typename T, typename L>   bool smin(T &x, L y) {     return y < x ? (x = y, true) : false;   }   void pre_dfs(int, int);   void sack(int, int, bool);   void update(int, int, int, int, int);   const int MAXN = 1e5 + 15;   int cnt[MAXN], col[MAXN];   int st[MAXN], ft[MAXN], add[MAXN];   vector<int> adj[MAXN];   int n;   long long ans[MAXN];   pair<int, long long> tree[MAXN << 2];   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     cerr <<  HELLO WORLD :) n ;     cin >> n;     for (int i = 0; i < n; i++) cin >> col[i];     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       u--, v--;       adj[u].push_back(v);       adj[v].push_back(u);     }     pre_dfs(0, -1);     sack(0, -1, 0);     for (int i = 0; i < n; i++) cout << ans[i] <<    ;     return cout <<   n , false;   }   void pre_dfs(int v, int p) {     static int t = 0;     st[v] = t++;     add[st[v]] = v;     for (auto u : adj[v])       if (u != p) pre_dfs(u, v);     ft[v] = t;   }   void sack(int v, int p, bool keep) {     int id = -1, mx = -1061109567;     for (auto u : adj[v])       if (u != p && smax(mx, ft[u] - st[u])) id = u;     for (auto u : adj[v])       if (u != p && u != id) sack(u, v, 0);     if (id != -1) sack(id, v, 1);     update(1, 1, n + 1, col[v], 1);     for (auto u : adj[v])       if (u != p && u != id)         for (int i = st[u]; i < ft[u]; i++) update(1, 1, n + 1, col[add[i]], 1);     ans[v] = tree[1].second;     if (!keep)       for (int i = st[v]; i < ft[v]; i++) update(1, 1, n + 1, col[add[i]], -1);   }   void update(int id, int b, int e, int p, int val) {     if (b == e - 1) {       tree[id].first += val;       smax(tree[id].second, b);       return;     }     int mid = (b + e) >> 1;     if (p < mid)       update(id << 1, b, mid, p, val);     else       update(id << 1 | 1, mid, e, p, val);     tree[id].first = max(tree[id << 1].first, tree[id << 1 | 1].first);     tree[id].second = (tree[id << 1].first == tree[id << 1 | 1].first                            ? tree[id << 1].second + tree[id << 1 | 1].second                            : (tree[id << 1].first > tree[id << 1 | 1].first                                   ? tree[id << 1].second                                   : tree[id << 1 | 1].second));   }
#include <bits/stdc++.h>   using namespace std;   void FastIO() {     ios_base::sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);   }   vector<long long int> fib;   void calc(int n) {     fib.assign(n + 1, 0);     fib[0] = 1;     fib[1] = 1;     for (int i = (int)2; i <= (int)n; i++) {       fib[i] = fib[i - 1] + fib[i - 2];     }   }   int main() {     long long int n, k;     cin >> n >> k;     calc(n);     vector<long long int> ans;     for (int i = 0; i < (int)n; i++) {       if (k <= fib[n - 1 - i])         ans.push_back(i + 1);       else {         ans.push_back(i + 2);         ans.push_back(i + 1);         k -= fib[n - 1 - i];         i++;       }     }     for (int i = 0; i < (int)n; i++) {       cout << ans[i] <<    ;     }     cout <<   n ;     return 0;   }