func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 55;   const unsigned long long M = 1000000009LL;   const int K = 3;   const int LIT = 2500;   const int INF = 1 << 30;   const double eps = 1e-6;   const unsigned long long MOD = 1000000007LL;   const int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};   unsigned long long n, m;   unsigned long long pw2[N] = {0};   void init() {     pw2[0] = 1;     for (int i = 1; i < N; i++) {       pw2[i] = pw2[i - 1] * 2;     }   }   int getCP(int n, int m) {     if (n == 3 && m == 1) return -1;     if (n == 3 && m == 2) return -2;     unsigned long long tot = pw2[n - 2];     unsigned long long mid = pw2[n - 3];     if (m > mid) {       return getCP(n, m - mid) - 1;     } else {       return getCP(n - 1, m);     }   }   vector<unsigned long long> getP(unsigned long long n, unsigned long long m) {     vector<unsigned long long> ans;     if (n == 1) {       ans.push_back(1);       return ans;     }     if (n == 2) {       if (m == 1) {         ans.push_back(1);         ans.push_back(2);       }       if (m == 2) {         ans.push_back(2);         ans.push_back(1);       }       return ans;     }     unsigned long long tot = pw2[n - 1];     unsigned long long mid = pw2[n - 2];     if (m > mid) {       ans = getP(n, tot + 1 - m);       reverse(ans.begin(), ans.end());       return ans;     }     vector<unsigned long long> pre = getP(n - 1, (m + 1) / 2);     int cp = n + getCP(n, m);     for (int i = 0; i < cp; i++) {       ans.push_back(pre[i]);     }     ans.push_back(n);     for (int i = cp; i < n - 1; i++) {       ans.push_back(pre[i]);     }     return ans;   }   void solve() {     vector<unsigned long long> ans = getP(n, m);     for (int i = 0; i < ans.size(); i++) cout << ans[i] <<    ;     cout << endl;   }   int main() {     int T;     while (cin >> n >> m) {       init();       solve();     }   }   