malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.precision(20);     string s;     cin >> s;     double x = 10 * (s[0] -  0 ) + s[1] -  0 ;     double y = 10 * (s[3] -  0 ) + s[4] -  0 ;     if (x < 12) {       cout << fixed << x * 30 + y / 2 <<     << 6 * y << setprecision(10) <<    ;     } else {       cout << fixed << (x - 12) * 30 + y / 2 <<     << 6 * y << setprecision(10)            <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   vector<long long int> L, R, a;   stack<long long int> same;   signed main() {     long long int n;     cin >> n;     a.resize(n, -1);     for (long long int i = 0; i < n; i++) {       long long int x;       cin >> x;       L.push_back(x);     }     for (long long int i = 0; i < n; i++) {       long long int x;       cin >> x;       R.push_back(x);     }     for (long long int i = n, k = n; k > 0; i--) {       for (long long int j = 0; j < n; j++) {         if (L[j] == 0 && R[j] == 0 && a[j] == -1) {           a[j] = i;           k--;           same.push(j);         }       }       if (same.empty()) {         cout <<  NO n ;         return 0;       }       while (!same.empty()) {         for (long long int j = same.top(); j < n; j++) {           if (a[j] == -1) L[j]--;         }         for (long long int j = same.top(); j >= 0; j--) {           if (a[j] == -1) R[j]--;         }         same.pop();       }     }     cout <<  YES n ;     for (auto i : a) cout << i <<    ;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 10;   const long long M = 1e7 + 1000;   const long long mod = 1e9 + 7;   const long long INF = 1e18;   const long long inf = -1e18;   bool isprime(long long x) {     if (x == 1) return false;     long long y = sqrt(x);     for (int i = 2; i <= y; i++) {       if (x % i == 0) {         return false;       }     }     return true;   }   long long bin_pow(long long a, long long b) {     if (b == 0) return 1;     if (b == 1) return a;     if (a == 0) return 0;     if (a == 1) return a;     if (b % 2 == 0) {       long long pw = bin_pow(a, b / 2);       return pw * pw;     } else {       return bin_pow(a, b - 1) * a;     }   }   const long double pi = acos(-1);   long long n, m, x;   long long us[5 * N];   vector<long long> ans;   int main() {     cin >> n >> x;     us[0] = 1;     ans.push_back(0);     long long m = (1 << n);     for (int i = 1; i < m; i++) {       if (us[i ^ x] != 1) {         us[i] = 1;         ans.push_back(i);       }     }     cout << ans.size() - 1 <<   n ;     for (int i = 1; i < ans.size(); i++) cout << (ans[i] ^ ans[i - 1]) <<    ;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = (int)1e9 + 7;   const int INF = (int)1e9;   const long long LINF = (long long)1e18;   const long double PI = acos((long double)-1);   const long double EPS = 1e-9;   inline long long gcd(long long a, long long b) {     long long r;     while (b) {       r = a % b;       a = b;       b = r;     }     return a;   }   inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   inline long long fpow(long long n, long long k, int p = MOD) {     long long r = 1;     for (; k; k >>= 1) {       if (k & 1) r = r * n % p;       n = n * n % p;     }     return r;   }   template <class T>   inline int chkmin(T& a, const T& val) {     return a > val ? a = val, 1 : 0;   }   template <class T>   inline int chkmax(T& a, const T& val) {     return a < val ? a = val, 1 : 0;   }   inline long long isqrt(long long k) {     long long r = sqrt(k) + 1;     while (r * r > k) r--;     return r;   }   inline long long icbrt(long long k) {     long long r = cbrt(k) + 1;     while (r * r * r > k) r--;     return r;   }   inline void addmod(int& a, int val, int p = MOD) {     if ((a = (a + val)) >= p) a -= p;   }   inline void submod(int& a, int val, int p = MOD) {     if ((a = (a - val)) < 0) a += p;   }   inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }   inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }   const int maxn = 100010;   int n, m;   vector<int> adj[maxn];   int a[maxn];   int d[maxn];   int tin[maxn];   int tms;   int dfs(int u) {     tin[u] = tms++;     int res = tin[a[u]];     for (int i = (0); i < (int((adj[u]).size())); i++) {       int v = adj[u][i];       int r = dfs(v);       if (r <= tin[u] && r != tin[a[u]]) {         cout <<  -1 n ;         exit(0);       }       chkmin(res, r);     }     return res;   }   void solve() {     cin >> n >> m;     for (int i = (0); i < (m); i++) {       int u, v;       cin >> u >> v;       u--;       v--;       adj[u].push_back(v);       d[v]++;     }     for (int i = (0); i < (n); i++) cin >> a[i], a[i]--;     for (int i = (0); i < (n); i++)       if (!d[i]) {         dfs(i);       }     vector<pair<int, int> > res;     for (int i = (0); i < (n); i++) {       res.push_back(make_pair(tin[a[i]], a[i]));     }     sort((res).begin(), (res).end());     (res).erase(unique((res).begin(), (res).end()), (res).end());     cout << int((res).size()) <<   n ;     for (int i = (int((res).size())) - 1; i >= (0); i--)       cout << res[i].second + 1 <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int MOD = 1e9 + 7;   const vector<long long int> dx = {1, -1, 0, 0};   const vector<long long int> dy = {0, 0, 1, -1};   void solve() {     string s;     cin >> s;     long long int k = s.length();     long long int cnt = 1;     char cur = s[0];     long long int zer = 0;     if (s[0] ==  0 ) zer++;     long long int one = 0;     long long int prefix[1010];     prefix[0] = zer;     for (long long int i = 1; i < k; i++) {       if (cur != s[i]) {         cnt++;         cur = s[i];       }       if (s[i] ==  0 ) {         zer++;       }       prefix[i] = zer;     }     one = k - zer;     long long int least = min(zer, one);     for (long long int i = 0; i < k; i++) {       least = min(least, i + 1 - prefix[i] + (zer - prefix[i]));       least = min(least, prefix[i] + one - (i + 1 - prefix[i]));     }     cout << least <<   n ;   }   int main(void) {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     long long int t;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200100;   int n, x, y, q;   char c;   long long a[N], k[N], M[N], A[N];   set<int> s;   void update(int x, long long mul, long long val) {     while (x < n) {       M[x] += mul;       A[x] += val;       x |= (x + 1);     }   }   void add(int l, int r, long long v) {     update(l, v, -v * (l - 1));     update(r, -v, v * r);   }   long long query(int x) {     int w = x;     long long mul = 0;     long long val = 0;     while (x >= 0) {       mul += M[x];       val += A[x];       x = (x & (x + 1)) - 1;     }     return mul * w + val;   }   long long get(int x) { return query(x) - query(x - 1); }   int main() {     scanf( %d , &n);     memset(M, 0, sizeof M);     memset(A, 0, sizeof A);     for (int i = 0; i < n; i++) {       scanf( %lld , &a[i]);       add(i, i, a[i]);     }     for (int i = 0; i + 1 < n; i++) {       scanf( %lld , &k[i]);       if (a[i + 1] - a[i] != k[i]) {         s.insert(i + 1);       }     }     s.insert(n);     scanf( %d , &q);     for (int i = 0; i < q; i++) {       scanf(  %c %d %d , &c, &x, &y);       x--;       if (c ==  + ) {         while (y != 0) {           int nxt = *s.lower_bound(x + 1);           add(x, nxt - 1, y);           if (x != 0 && get(x) - get(x - 1) != k[x - 1]) {             s.insert(x);           } else if (s.count(x) != 0) {             s.erase(x);           }           if (nxt >= n) {             break;           }           if (get(nxt) - get(nxt - 1) >= k[nxt - 1]) {             break;           }           y = k[nxt - 1] - (get(nxt) - get(nxt - 1));           x = nxt;         }       } else if (c ==  s ) {         y--;         printf( %lld n , query(y) - query(x - 1));       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a, b, x, y, fen, k;   inline int gcd(int x, int y) {     if (y == 0) return x;     return gcd(y, x % y);   }   int main() {     scanf( %d%d%d%d , &a, &b, &x, &y);     k = gcd(x, y);     x /= k;     y /= k;     fen = min(a / x, b / y);     printf( %d %d n , fen * x, fen * y);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 2000000000;   const int MOD = 1000000007;   int n, m, k = 0, c = 0, q;   map<int, char> mp;   map<char, int> cnt;   int main() {     string s;     cin >> s;     bool f1 = 0, f2 = 0, f3 = 0, f4 = 0;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  G ) {         f1 = 1;         mp[i % 4] = s[i];       }       if (s[i] ==  Y ) {         f2 = 1;         mp[i % 4] = s[i];       }       if (s[i] ==  R ) {         f3 = 1;         mp[i % 4] = s[i];       }       if (s[i] ==  B ) {         f4 = 1;         mp[i % 4] = s[i];       }     }     if (!f1) {       for (int i = 0; i < 4; i++) {         if (mp.find(i) == mp.end()) {           mp[i] =  G ;           break;         }       }     }     if (!f2) {       for (int i = 0; i < 4; i++) {         if (mp.find(i) == mp.end()) {           mp[i] =  Y ;           break;         }       }     }     if (!f3) {       for (int i = 0; i < 4; i++) {         if (mp.find(i) == mp.end()) {           mp[i] =  R ;           break;         }       }     }     if (!f4) {       for (int i = 0; i < 4; i++) {         if (mp.find(i) == mp.end()) {           mp[i] =  B ;           break;         }       }     }     string s1 =   ;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  ! ) {         cnt[mp[i % 4]]++;       }     }     cout << cnt[ R ] <<     << cnt[ B ] <<     << cnt[ Y ] <<     << cnt[ G ];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, r1, r2, r3, d;   long long a[1000003];   long long dp[1000003][2];   long long f(int i, int j) {     if (i == n) return -d;     if (dp[i][j] != -1) return dp[i][j];     long long res1 = 1e18, res2 = 1e18;     if (j == 0) {       res1 = f(i + 1, 0) + a[i] * r1 + r3 + d;       res2 = f(i + 1, 1) + min(a[i] * r1 + 2 * r1, r2 + r1) + 3 * d;     }     if (j == 1) {       if (i != n - 1)         res1 = f(i + 1, 0) +                min(a[i] * r1 + r3, min(a[i] * r1 + 2 * r1, r2 + r1)) + d;       else         res1 = f(i + 1, 0) +                min(a[i] * r1 + r3, min(a[i] * r1 + 2 * r1 + d, r2 + r1 + d));     }     return dp[i][j] = min(res1, res2);   }   int main() {     cin >> n >> r1 >> r2 >> r3 >> d;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     memset(dp, -1, sizeof dp);     cout << f(0, 0) << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n, d;   int stone[30000 + 3];   int f[30000 + 3][2 * 300 + 3];   int p[30000 + 3];   int main(int argc, char* argv[]) {     scanf( %d %d , &n, &d);     for (int i = 0; i < n; i++) {       int tmp;       scanf( %d , &tmp);       stone[tmp]++;       p[i] = tmp;     }     for (int curr = 30000; curr >= 0; curr--) {       for (int add = -300; add <= 300; add++) {         int addfix = 300 + add;         if (curr == 0) {           f[curr][addfix] = f[d][addfix] + stone[d];           continue;         }         int last = d + add;         if (last <= 0) {           continue;         }         if (curr == 29889 && last == 1) {           printf(  );         }         if (curr == 19 && last == 9 || curr == 10 && last == 10) {           printf(  );         }         if (last - 1 > 0 && curr + last - 1 <= 30000 &&             f[curr][addfix] <                 f[curr + last - 1][addfix - 1] + stone[curr + last - 1]) {           f[curr][addfix] =               f[curr + last - 1][addfix - 1] + stone[curr + last - 1];         }         if (last > 0 && curr + last <= 30000 &&             f[curr][addfix] < f[curr + last][addfix] + stone[curr + last]) {           f[curr][addfix] = f[curr + last][addfix] + stone[curr + last];         }         if (curr + last + 1 <= 30000 &&             f[curr][addfix] <                 f[curr + last + 1][addfix + 1] + stone[curr + last + 1]) {           f[curr][addfix] =               f[curr + last + 1][addfix + 1] + stone[curr + last + 1];         }       }     }     printf( %d n , f[0][300 + 0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005];   int main() {     int t;     cin >> t;     while (t--) {       int k1 = 0, k2 = 0;       string s;       cin >> s;       if (s[0] ==  0 ) k2++;       if (s[0] ==  1 ) k1++;       for (int i = 1; i < s.size(); i++) {         if (s[i - 1] != s[i]) {           if (s[i] ==  1 ) k1++;           if (s[i] ==  0 ) k2++;         }       }       if (k1 > 3)         cout << 2 << endl;       else if (k1 == 0)         cout << 1 << endl;       else if (k2 == 0)         cout << 0 << endl;       else if (k2 > 2)         cout << 2 << endl;       else         cout << k2 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-10;   const double pi = 3.1415926535897932;   const double eln = 2.718281828459045;   vector<int> a[200005];   int p[200005], b[200005], od[200005];   void second(int m, int dah) {     p[m] = dah;     b[m] = 1;     for (int i = 0; i < a[m].size(); ++i) {       if (!b[a[m][i]]) {         second(a[m][i], dah + 1);       }     }   }   int main() {     ios::sync_with_stdio(false);     int n, x, y;     cin >> n;     for (int i = 0; i < n - 1; ++i) {       cin >> x >> y;       a[x].push_back(y);       a[y].push_back(x);     }     second(1, 1);     int maxx = 0;     int first = 0, st, hh;     for (int i = 0; i < n; ++i) {       cin >> x;       if (p[x] > maxx) {         hh = od[x];         maxx = p[x];         st = 1;         for (int j = 0; j < a[x].size(); ++j) {           if (!od[a[x][j]]) {             od[a[x][j]] = st;           }         }       } else if (p[x] == maxx) {         if (od[x] < hh) {           cout <<  No ;           return 0;         }         hh = max(hh, od[x]);         st++;         for (int j = 0; j < a[x].size(); ++j) {           if (!od[a[x][j]]) {             od[a[x][j]] = st;           }         }       } else if (p[x] < maxx) {         cout <<  No ;         return 0;       }     }     cout <<  Yes ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 400010;   pair<int, int> a[maxn], b[maxn];   int tot, cnt[110];   double qpow(double a, int x) {     double res = 1.0;     while (x) {       if (x & 1) res = res * a;       a = a * a;       x >>= 1;     }     return res;   }   int main() {     int N, M, i, j, A, H, L, R;     scanf( %d%d , &N, &M);     for (int i = 1; i <= N; i++) {       scanf( %d%d%d%d , &A, &H, &L, &R);       b[++tot] = make_pair(A - H, L);       b[++tot] = make_pair(A, -L);       b[++tot] = make_pair(A + 1, R);       b[++tot] = make_pair(A + H + 1, -R);     }     for (int i = 1; i <= M; i++) scanf( %d%d , &a[i].first, &a[i].second);     sort(a + 1, a + M + 1);     sort(b + 1, b + tot + 1);     double ans = 0;     int pos = 1;     for (int i = 1; i <= M; i++) {       while (pos <= tot && b[pos].first <= a[i].first) {         if (b[pos].second > 0) cnt[b[pos].second]++;         if (b[pos].second < 0) cnt[-b[pos].second]--;         pos++;       }       if (!cnt[100]) {         double p = a[i].second;         for (int j = 1; j <= 99; j++) p *= qpow(0.01 * (100 - j), cnt[j]);         ans += p;       }     }     printf( %.12lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, sum;   int s[200010];   vector<pair<int, int> > G[200010];   int fa[200010];   int vis[200010];   int ans[200010];   void dfs(int x, int fa, int id) {     vis[x] = 1;     for (int i = 0; i < G[x].size(); i++) {       int to = G[x][i].first;       int id = G[x][i].second;       if (vis[to] == 0) dfs(to, x, id);     }     if (s[x] != 0) {       if (id > 0)         ans[id] -= s[x];       else         ans[-id] += s[x];       s[fa] += s[x];       s[x] = 0;     }   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> s[i], sum += s[i], s[i] = -s[i];     if (sum) return puts( Impossible ), 0;     puts( Possible );     cin >> m;     for (int i = 1; i <= m; i++) {       int x, y;       cin >> x >> y;       G[x].push_back(make_pair(y, i));       G[y].push_back(make_pair(x, -i));     }     dfs(1, 0, 0);     for (int i = 1; i <= m; i++) cout << ans[i] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     scanf( %d , &t);     while (t--) {       int n;       scanf( %d , &n);       vector<vector<long long>> a(n);       for (int i = 0; i < n; i++) {         int m;         long long p;         scanf( %d , &m);         scanf( %lld , &p);         a[m].push_back(p);       }       vector<int> cnt(n);       cnt[0] = a[0].size();       for (int i = 1; i < n; i++) {         cnt[i] = cnt[i - 1] + a[i].size();       }       long long res = 0;       multiset<long long> s;       int ch = 0;       for (int i = n - 1; i > 0; i--) {         for (long long j : a[i]) s.insert(j);         int temp = 0;         for (int j = 0; j < i - ch - cnt[i - 1]; j++) {           long long p = *(s.begin());           s.erase(s.begin());           res += p;           temp++;         }         ch += temp;       }       printf( %lld n , res);     }   }
#include <bits/stdc++.h>   using namespace std;   int ccount[1000000 + 10];   bitset<1000000 + 100> v;   unsigned long int N;   vector<int> primes;   int cc = 0;   int primeSize;   void generatePrimes() {     N = 1000000 + 2;     cc = 0;     v.set(1);     unsigned long int i, j;     for (i = 2; i < N + 1; i++) {       if (!v[(int)i]) {         for (j = i * i; j < N + 1; j += i) {           v.set(j);         }         primes.push_back(i);         ccount[(int)i] = cc;         cc++;       }     }     primeSize = cc;   }   bool isPrime(int n) { return !v[n]; }   char a[1000][1000];   int l;   int preCalc[1000000 + 1000];   int go(int level) {     if (level == l) return 1;     int ten = 1;     for (int i = 0; i < l - 1; i++) ten *= 10;     int val = 0;     for (int i = 0; i < level; i++) {       val += ((a[level][i] -  0 ) * ten);       ten /= 10;     }     int x = preCalc[val];     int target = 1;     for (int i = 0; i < l - level; i++) target *= 10;     target += val;     int ans = 0;     while (x < primeSize && primes[x] < target) {       int m = primes[x];       for (int i = l - 1; i >= level; i--) {         a[i][level] = a[level][i] = (char)((m % 10) +  0 );         m /= 10;       }       ans += go(level + 1);       x++;     }     return ans;   }   int ans[1000000 + 100];   int main() {     int t;     scanf( %d , &t);     generatePrimes();     int last = 1 << 25;     for (int i = 1000000 - 1; i > -1; i--) {       ans[i] = -1;       if (isPrime(i)) {         last = ccount[i];       }       preCalc[i] = last;     }     while (t-- > 0) {       scanf( %s , &a[0][0]);       l = 0;       while (a[0][l] !=   0 ) l++;       int ten = 1;       int v = 0;       for (int i = l - 1; i > -1; i--) {         v += (int)(a[0][i] -  0 ) * ten;         ten *= 10;       }       for (int i = 0; i < l; i++) a[i][0] = a[0][i];       if (ans[v] == -1) ans[v] = go(1);       printf( %d n , ans[v]);     }   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long n;     cin >> n;     map<pair<long long, long long>, set<pair<long long, long long>>> mp;     for (long long i = 1; i <= n; i++) {       long long x, y, z;       cin >> x >> y >> z;       mp[{x, y}].insert({z, i});     }     map<long long, set<pair<long long, long long>>> mp2;     for (auto &k : mp) {       while (k.second.size() > 1) {         cout << (*k.second.begin()).second <<    ;         k.second.erase(k.second.begin());         cout << (*k.second.begin()).second << endl;         k.second.erase(k.second.begin());       }       if (k.second.size() == 1)         mp2[k.first.first].insert({k.first.second, (*k.second.begin()).second});     }     vector<long long> ind;     for (auto &k : mp2) {       while (k.second.size() > 1) {         cout << (*k.second.begin()).second <<    ;         k.second.erase(k.second.begin());         cout << (*k.second.begin()).second << endl;         k.second.erase(k.second.begin());       }       if (k.second.size() == 1) ind.push_back((*k.second.begin()).second);     }     for (long long i = 0; (unsigned)i < ind.size(); i += 2) {       cout << ind[i] <<     << ind[i + 1] << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 5;   long long n, p, a[N], C[N], st, End;   void in() {     cin >> n >> p;     for (long long i = 0; i <= n - 1; i++) cin >> a[i];     sort(a, a + n);   }   long long bns(long long lim) {     long long low = 0, high = n - 1, res = -1;     while (low <= high) {       long long mid = (low + high) / 2;       if (a[mid] <= lim)         low = mid + 1, res = mid;       else         high = mid - 1;     }     return res + 1;   }   long long bns_low() {     long long low = 1, high = 1e15, res = -1;     while (low <= high) {       long long mid = (low + high) / 2;       bool kq = true;       for (long long i = 0; i <= n - 1; i++)         if (mid + i >= a[i])           ;         else           kq = false;       if (kq)         high = mid - 1, res = mid;       else         low = mid + 1;     }     return res;   }   long long bns_high() {     long long low = st, high = 1e15, res = -1;     while (low <= high) {       long long mid = (low + high) / 2;       bool kq = true;       for (long long i = 0; i <= n - 1; i++) {         C[i] = bns(i + mid) - i;         if (C[i] <= 0 || C[i] >= p) kq = false;       }       if (kq)         low = mid + 1, res = mid;       else         high = mid - 1;     }     return res;   }   void process() {     st = bns_low();     End = bns_high();     if (st == -1 || End == -1) {       cout << 0;       exit(0);     }     cout << End - st + 1 <<   n ;     for (long long i = st; i <= End; i++) cout << i <<    ;   }   int main() {     if (fopen( trash.inp ,  r ))       freopen( trash.inp ,  r , stdin), freopen( trash.out ,  w , stdout);     ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);     in();     process();   }
#include <bits/stdc++.h>   using namespace std;   int n;   map<pair<pair<bool, int>, pair<int, int>>, int> dp;   int recurse(bool asc, int cx, int cy, int hm) {     if (hm < 0 || cx > n) return 0;     if (hm == 0) {       if (asc && cx == n)         return 1;       else         return 0;     }     pair<pair<bool, int>, pair<int, int>> index =         make_pair(make_pair(asc, hm), make_pair(cx, cy));     if (dp.count(index)) {       return dp[index];     } else {       int ans;       if (asc) {         if (cy == 1) {           ans = recurse(false, cx + 1, 2, hm) + recurse(false, cx + 1, 3, hm) +                 recurse(false, cx + 1, 4, hm) + recurse(false, cx + 2, 3, hm) +                 2 * recurse(false, cx + 2, 4, hm) + recurse(false, cx + 3, 4, hm);         } else if (cy == 2) {           ans = recurse(false, cx + 1, 3, hm) + recurse(false, cx + 1, 4, hm) +                 recurse(false, cx + 2, 4, hm);         } else if (cy == 3) {           ans = recurse(false, cx + 1, 4, hm);         } else           ans = 0;       } else {         if (cy == 4) {           ans = recurse(true, cx + 1, 3, hm - 1) +                 recurse(true, cx + 1, 2, hm - 1) +                 recurse(true, cx + 1, 1, hm - 1) +                 recurse(true, cx + 2, 2, hm - 1) +                 2 * recurse(true, cx + 2, 1, hm - 1) +                 recurse(true, cx + 3, 1, hm - 1);         } else if (cy == 3) {           ans = recurse(true, cx + 1, 2, hm - 1) +                 recurse(true, cx + 1, 1, hm - 1) +                 recurse(true, cx + 2, 1, hm - 1);         } else if (cy == 2) {           ans = recurse(true, cx + 1, 1, hm - 1);         } else           ans = 0;       }       dp[index] = ans;       return ans;     }   }   int main() {     int t;     cin >> n >> t;     cout << recurse(true, 1, 1, t) + recurse(true, 1, 2, t) +                 recurse(true, 1, 3, t)          << endl;   }