malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   namespace io {   template <typename T>   inline void read(T& a) {     int c = getchar(), sign = 0;     a = 0;     while (c <  0  || c >  9 ) sign += (c ==  - ), c = getchar();     while (c >=  0  && c <=  9 ) a = (a << 1) + (a << 3) + c - 48, c = getchar();     if (sign & 1) a = -a;   }   template <typename T, typename... _T>   inline void read(T& a, _T&... argc) {     read(a);     read(argc...);   }   template <typename T>   inline void Write(T a) {     if (a > 9) Write(a / 10);     putchar(a % 10 +  0 );   }   template <typename T>   inline void write(T a, char ch =    ) {     if (a < 0) putchar( - ), a = -a;     Write(a);     putchar(ch);   }   }  // namespace io   using namespace io;   using namespace std;   const int maxn = 2e3;   const int mod = 1e9 + 7;   int n, d, m, a[maxn + 3], b[maxn + 3];   int dem[maxn + 3], id[maxn + 3];   int k, h;   int res = 2e9;   long long dp[maxn + 5], t[maxn + 3];   string second;   bool kt[maxn + 3];   map<int, int> maps;   vector<int> edge[maxn + 3];   map<int, int>::iterator it;   template <typename T>   void answer(T x) {     cout << x;     exit(0);   }   void putstring(string x, char ch =    ) {     for (char c : x) putchar(c);     putchar(ch);   }   struct T {     long long x, y;     T operator-(const T& other) const { return {x - other.x, y - other.y}; }     long long operator*(const T& other) const {       return x * other.y - y * other.x;     }     int direct_vector(const T& a, const T& b) const {       long long ans = (a - *this) * (b - *this);       return ans > 0;     }   } v[maxn + 3];   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL);     cin >> n;     for (int i = 1; i <= n; ++i) cin >> v[i].x >> v[i].y;     cin >> second;     int chot = min_element(v + 1, v + n + 1,                            [](const T& a, const T& b) {                              return a.x != b.x ? a.x < b.x : a.y < b.y;                            }) -                v;     kt[chot] = true;     write(chot);     for (int i = 0; i < second.size(); i++) {       int cc = -1, p = (second[i] ==  L );       for (int j = 1; j <= n; ++j) {         if (kt[j]) continue;         if (cc == -1) {           cc = j;           continue;         }         if (p == v[chot].direct_vector(v[j], v[cc])) {           cc = j;         }       }       kt[cc] = true;       chot = cc;       write(chot);     }     for (int i = 1; i <= n; ++i)       if (!kt[i]) write(i);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long i = 1, n;     string s[] = { Sheldon ,  Leonard ,  Penny ,  Rajesh ,  Howard };     cin >> n;     if (n <= 5) {       cout << s[n - 1];       return 0;     }     while (((1 << i) - 1) * 5 <= n) i++;     i--;     i = (1 << i);     n -= (i - 1) * 5;     n--;     cout << s[n / i];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k;   struct ff {     int value, order;   } a[100010];   bool cmp(ff a, ff b) { return a.value < b.value; }   long long sum1[100010], sum2[100010];   void add(long long s[], int i, int x) {     while (i <= n) {       s[i] += x;       i += i & -i;     }   }   long long getsum(long long s[], int i) {     long long res = 0;     while (i > 0) {       res += s[i];       i -= i & -i;     }     return res;   }   int b[100010];   int main() {     while (~scanf( %I64d%I64d , &n, &k)) {       for (int i = 1; i <= n; i++) {         scanf( %d , &a[i].value);         a[i].order = i;         b[i - 1] = a[i].value;       }       sort(b, b + n);       int m = unique(b, b + n) - b;       for (int i = 1; i <= n; i++) {         a[i].order = lower_bound(b, b + m, a[i].value) - b + 1;       }       memset(sum1, 0, sizeof sum1);       memset(sum2, 0, sizeof sum2);       long long res = 0;       long long ans = 0;       for (int i = 1; i <= n; i++) {         add(sum1, a[i].order, 1);         res += i - getsum(sum1, a[i].order);       }       if (res <= k) {         printf( %I64d n , n * (long long)(n - 1) / 2);         continue;       }       add(sum1, a[n].order, -1);       add(sum2, a[n].order, 1);       for (int l = n - 1, r = n - 1; r > 0; r--) {         while (l > 0 && res > k) {           res -= l - getsum(sum1, a[l].order);           res -= getsum(sum2, a[l].order - 1);           add(sum1, a[l].order, -1);           l--;         }         if (l == 0) break;         ans += l;         res += getsum(sum2, a[r].order - 1);         res += l - getsum(sum1, a[r].order);         add(sum2, a[r].order, 1);       }       cout << ans << endl;     }     return 0;   }
#include<bits/stdc++.h>   using namespace std;   #define ll long long int   #define v vector<ll>   #define pb push_back   #define fr(i,a,n) for(ll i=a;i<n;i++)   #define Fast ios::sync_with_stdio(false);cin.tie(NULL);   #define in(a) ll a;cin>>a   #define ip(a) string a;cin>>a   #define R(a,n) for(int i=0;i<n;i++)cin>>a[i];   #define all(a) sort(a.begin(),a.end())   #define e endl   #define MOD (int)1e9 + 7   inline ll powe(ll a,ll b , ll p = MOD){ ll ans=1;for(;b;b>>=1){if(b&1) ans=ans*a%p;a=a*a%p;} return ans;}   void solve(){      in(n);      if(n==2)cout<< -1 <<e;      else{           ll pp=1;           ll size=n*n;           fr(i,0,n){             fr(j,0,n){               cout<<pp<<   ;               if(pp+2>size){                pp=2;         }         else{          pp+=2;         }       }       cout<<e;        }      }      }   int main()   {       Fast       ll t;cin>>t;       while(t--){           solve();       }   }
#include <bits/stdc++.h>   using namespace std;   int a[8];   int main() {     int n, m;     cin >> n >> m;     int xx = n;     int kk = m;     int ans = 0;     int len1 = 1, len2 = 1;     for (int b = 7; b < n; b *= 7) len1++;     for (int b = 7; b < m; b *= 7) len2++;     if (len2 + len1 > 7) {       cout << 0;       return 0;     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         for (int z = i, f = 0; f != len1; f++, z /= 7) {           int x = z % 7;           a[x]++;         }         for (int z = j, f = 0; f != len2; f++, z /= 7) {           int x = z % 7;           a[x]++;         }         bool ok = false;         for (int d = 0; d < 8; d++)           if (a[d] > 1) ok = true;         if (ok == false) ans++;         for (int d = 0; d < 8; d++) a[d] = 0;       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int x, y, time;   };   char str[120][120];   int vis[102][102][102], n, m, ck = 0;   void train(int p, int q, int cnt) {     int time = 0, d = 0;     for (int j = q; (j + cnt - 1) >= 0; j -= 2) {       d = 0;       int lim = cnt;       if (j < 0) lim = cnt + j;       for (int k = max(j, 0); d < lim; k++, d++) {         vis[p][k][time] = 1;       }       time++;     }   }   int level[102][102][102];   void bfs(int i, int j) {     int v, w, t, a, b, c;     level[i][j][0] = 1;     queue<node> q;     node gr;     gr.x = i;     gr.y = j;     gr.time = 0;     q.push(gr);     while (!q.empty()) {       gr = q.front();       q.pop();       v = gr.x;       w = gr.y;       if (w == m - 1) {         ck = 1;         return;       }       for (i = 0; i < 1; i++) {         a = v + 0;         b = w + 1;         t = gr.time + 1;         if (a >= 0 && a < n && b >= 0 && b < m && vis[a][b][t - 1] == 1) continue;         if (a >= 0 && a < n && b >= 0 && b < m && vis[a][b][t] == 0 &&             vis[a][b][t - 1] == 0 && level[a][b][t] == 0) {           node pr;           pr.x = a;           pr.y = b;           pr.time = t;           level[a][b][t] = 1;           q.push(pr);         }         c = a - 1;         if (c >= 0 && c < n && b >= 0 && b < m && vis[c][b][t] == 0 &&             vis[c][b][t - 1] == 0 && level[c][b][t] == 0) {           node pr;           pr.x = c;           pr.y = b;           pr.time = t;           level[c][b][t] = 1;           q.push(pr);         }         c = a + 1;         if (c >= 0 && c < n && b >= 0 && b < m && vis[c][b][t] == 0 &&             vis[c][b][t - 1] == 0 && level[c][b][t] == 0) {           node pr;           pr.x = c;           pr.y = b;           pr.time = t;           level[c][b][t] = 1;           q.push(pr);         }       }     }   }   int main() {     int i, j, k, l, test;     scanf( %d , &test);     while (test--) {       cin >> m >> k;       n = 3;       ck = 0;       memset(level, 0, sizeof level);       memset(vis, 0, sizeof vis);       for (i = 0; i < 3; i++) {         scanf( %s , str[i]);       }       for (i = 0; i < 3; i++) {         for (j = 0; j < m; j++) {           if (str[i][j] !=  s  && str[i][j] !=  . ) {             int cnt = 0;             for (k = j; str[i][k]; k++) {               if (str[i][j] != str[i][k]) break;               cnt++;             }             train(i, j, cnt);           }         }       }       for (i = 0; i < n; i++) {         for (j = 0; j < m; j++) {           if (str[i][j] ==  s ) {             bfs(i, j);           }         }       }       if (ck == 0)         printf( NO n );       else         printf( YES n );     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x, y, n, tx, ty, m;     scanf( %d %d , &n, &m);     double res = 0;     for (int i = 0; i < n; i++) {       scanf( %d %d , &x, &y);       if (i == 0) {         tx = x, ty = y;         continue;       }       res = res + sqrt(((x - tx) * (x - tx)) + ((y - ty) * (y - ty)));       tx = x, ty = y;     }     if (n == 1) {       res = res + abs(x - y);       printf( %.9f n , res);     } else {       printf( %.9f n , (res / 50.0) * m);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100][100];   int main() {     string x;     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x;       for (int j = 0; j < n; j++) {         if (x[j] ==  E ) a[i][j] = 1;       }     }     int k = 0;     int s;     for (int i = 0; i < n; i++) {       s = 1;       for (int j = 0; j < n; j++) s *= a[i][j];       k += (1 - s);     }     if (k == n) {       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++)           if (a[i][j] == 0) {             cout << i + 1 <<     << j + 1 << endl;             break;           }       return 0;     }     k = 0;     for (int i = 0; i < n; i++) {       s = 1;       for (int j = 0; j < n; j++) s *= a[j][i];       k += (1 - s);     }     if (k == n) {       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++)           if (a[j][i] == 0) {             cout << j + 1 <<     << i + 1 << endl;             break;           }       return 0;     }     cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int cons;   long long int check(long long int a) {     if (a >= cons) a %= cons;     return a;   }   long long int check2(long long int a) {     a %= cons;     if (a < 0) a += cons;     return a;   }   long long int GCD(long long int a, long long int b) {     if (b == 0) return a;     return GCD(b, a % b);   }   long long int exp(long long int a, long long int n) {     if (n == 0) return 1;     if (n == 1) return check(a);     long long int b = exp(a, n / 2);     if (n % 2 == 0) return check(b * b);     return check(b * check(b * a));   }   const int N = 200010;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cons = 1e9 + 7;     int n, a, b;     cin >> n >> a >> b;     int ans = 0;     while (true) {       ans++;       int c1 = a / ans;       int c2 = b / ans;       if (c1 > 0 && c2 > 0 && (c1 + c2 >= n))         continue;       else         break;     }     cout << ans - 1;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200005;   int n, a[N], place[N], BIT[N];   long long inverse, res[N];   set<int> firstHalf, secondHalf;   long long sumFirst = 0, sumSecond = 0;   long long fenwickGet(int x) {     long long res = 0;     for (; x <= n; x += x & -x) res += BIT[x];     return res;   }   void stable(set<int>& f, set<int>& s) {     while (f.size() > s.size()) {       int leftLarge = *f.rbegin();       f.erase(leftLarge);       s.insert(leftLarge);       sumFirst -= leftLarge;       sumSecond += leftLarge;     }     while (f.size() < s.size()) {       int rightSmall = *s.begin();       s.erase(rightSmall);       f.insert(rightSmall);       sumFirst += rightSmall;       sumSecond -= rightSmall;     }   }   void fenwickUpdate(int x) {     for (; x; x -= x & -x) BIT[x] += 1;   }   long long sol(int cur) {     inverse += fenwickGet(cur);     fenwickUpdate(cur);     if (firstHalf.size() > 0) {       if (cur > *firstHalf.rbegin()) {         secondHalf.insert(cur);         sumSecond += cur;       } else {         firstHalf.insert(cur);         sumFirst += cur;       }     } else {       firstHalf.insert(cur);       sumFirst += cur;     }     stable(firstHalf, secondHalf);     long long middle = *firstHalf.rbegin();     long long n = firstHalf.size(), m = secondHalf.size();     return inverse + middle * n - sumFirst - n * (n - 1) / 2 + sumSecond -            middle * m - m * (m + 1) / 2;   }   void solve() {     inverse = 0;     for (int i = 1; i <= n; ++i) {       char c = (i == n ?   n  :    );       cout << sol(place[i]) << c;     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       place[a[i]] = i;     }     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b, p;     string s, x, y;     cin >> n;     cin.ignore();     while (n--) {       getline(cin, s);       a = 0;       b = 0;       p = s.length();       if (s[0] ==  m  && s[1] ==  i  && s[2] ==  a  && s[3] ==  o  &&           s[4] ==  . ) {         a = 1;       }       if (s[p - 1] ==  .  && s[p - 2] ==  a  && s[p - 3] ==  l  &&           s[p - 4] ==  a  && s[p - 5] ==  l ) {         b = 1;       }       if (a == 1 && b == 1) {         cout <<  OMG>.< I don t know!  << endl;         continue;       }       if (a == 1) {         cout <<  Rainbow s  << endl;         continue;       }       if (b == 1) {         cout <<  Freda s  << endl;         continue;       }       cout <<  OMG>.< I don t know!  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char **argv) {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) {       int n, ok = 1, i = 0, cnt;       cin >> n;       cnt = n;       vector<int> v(n), ans(n, -1), temp;       vector<pair<int, int> > mat;       for (int i = 0; i < n; i++) cin >> v[i], v[i]--;       temp.emplace_back(n);       while (i < n && ok) {         if (temp.back() == i) temp.pop_back();         if (v[i] == -2)           v[i] = temp.back();         else if (v[i] > temp.back())           ok = 0;         else if (v[i] < temp.back())           temp.emplace_back(v[i]);         mat.emplace_back(v[i], i), i++;       }       if (!ok) {         cout << -1 <<   n ;         continue;       }       sort(mat.begin(), mat.end(), [](pair<int, int> l, pair<int, int> r) {         if (l.first == r.first) return l.second < r.second;         return l.first > r.first;       });       for (auto x : mat) ans[x.second] = cnt--;       for (auto x : ans) cout << x <<    ;       cout <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int INIT_SIZE_MAX = (1 << 29) + 10;   const int INIT_SIZE_MIN = -(1 << 29) - 10;   const int INIT_SIZE = 0;   const int MAX = 8;   const int DIR_SIZE = 12;   const double PI = 3.1415926535897932384;   template <class T, class U>   void convert(T &t, U &u) {     stringstream ss;     ss << t;     ss >> u;   }   int dfs(int pos, vector<vector<int> > &tb) {     if (pos % 2) return pos;     int half = pos / 2;     int res = 0;     for (int(i) = 0; (i) < (half); ++(i)) {       bool f = true;       for (int(j) = 0; (j) < (tb[0].size()); ++(j)) {         if (tb[0 + i][j] != tb[(pos - 1) - i][j]) {           f = false;           break;         }       }       if (f) {         res = dfs(pos / 2, tb);       } else {         return pos;       }     }     return res;   }   int main() {     int h, w;     cin >> h >> w;     vector<vector<int> > tb(h, vector<int>(w, 0));     for (int(i) = 0; (i) < (h); ++(i))       for (int(j) = 0; (j) < (w); ++(j)) cin >> tb[i][j];     if (h % 2) {       cout << h << endl;       return 0;     }     int ans = 1 << 29;     ans = min(ans, dfs(h, tb));     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int iinf = 1 << 29;   const long long inf = 1ll << 60;   const long long mod = 1e9 + 7;   void GG() {     cout <<  -1 n ;     exit(0);   }   long long mpow(long long a, long long n, long long mo = mod) {     long long re = 1;     while (n > 0) {       if (n & 1) re = re * a % mo;       a = a * a % mo;       n >>= 1;     }     return re;   }   long long inv(long long b) {     return b == 1 ? 1 : (mod - mod / b) * inv(mod % b) % mod;   }   const int maxn = 2e5 + 5;   int p[maxn][26];   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     string second;     cin >> second;     int n = second.length();     for (int i = (0); i < (n); ++i) {       for (int j = (0); j < (26); ++j) p[i + 1][j] += p[i][j];       p[i + 1][second[i] -  a ]++;     }     int q;     cin >> q;     while (q--) {       int l, r;       cin >> l >> r;       --l;       --r;       if (l == r) {         cout <<  Yes  <<   n ;       } else {         if (second[l] != second[r]) {           cout <<  Yes  <<   n ;         } else {           int tp = 0;           for (int j = (0); j < (26); ++j) {             if (p[r + 1][j] - p[l][j] > 0) tp++;           };           if (tp > 2)             cout <<  Yes  <<   n ;           else             cout <<  No  <<   n ;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     bool check = 1;     vector<pair<int, int>> v;     int a, b, c;     cin >> a;     for (int i = 0; i < a; i++) {       cin >> b >> c;       v.push_back({b, c});     }     for (int i = 0; i < a; i++) {       if (v[i].second != v[i].first) {         cout <<  Happy Alex ;         return 0;       } else {         check = 0;       }     }     if (check == 0) cout <<  Poor Alex ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 110;   int a[N], c[N][N];   int main() {     int n, k;     scanf( %d %d , &n, &k);     for (int i = 0; i < n; ++i) {       scanf( %d , a + i);     }     int mn = a[0], mx = a[0];     for (int i = 0; i < n; ++i) {       if (a[i] < mn) mn = a[i];       if (a[i] > mx) mx = a[i];     }     int d = mx - mn;     if (d > k) {       puts( NO );       return 0;     }     puts( YES );     for (int i = 0; i < n; ++i) {       for (int j = 0; j <= mn; ++j) {         c[i][j] = 1;       }       int t = 2;       for (int j = mn + 1; j < a[i]; ++j) {         c[i][j] = t;         ++t;       }     }     for (int i = 0; i < n; ++i) {       for (int j = 0; j < a[i]; ++j) {         if (j > 0) putchar(   );         printf( %d , c[i][j]);       }       putchar(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char board[500][500];   int n, m, k;   int w = 0, e = 0;   int t;   bool used[500][500];   bool inBound(int a, int b) { return (a >= 0 && a < n && b >= 0 && b < m); }   bool dfs(int a, int b) {     if (t == 0) return false;     bool check = true;     used[a][b] = true;     for (int i = -1; i < 2; i++) {       for (int j = -1; j < 2; j++) {         if (abs(i) + abs(j) == 1 && inBound(a + i, b + j) &&             board[a + i][b + j] ==  . ) {           if (!used[a + i][b + j]) {             check = dfs(a + i, b + j);           }         }       }     }     if (t == 0) {       return false;     }     if (check) {       board[a][b] =  X ;       t--;     }     return check;   }   int main() {     for (int i = 0; i < 500; i++) {       for (int j = 0; j < 500; j++) {         used[i][j] = false;       }     }     cin >> n >> m >> k;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cin >> board[i][j];         if (board[i][j] ==  . )           e++;         else           w++;       }     }     t = k;     bool bla = false;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (board[i][j] ==  . ) {           dfs(i, j);           bla = true;           break;         }       }       if (bla) break;     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         cout << board[i][j];       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long sum[100010 << 2], tag[100010 << 2];   int num[100010 << 2], n, m;   bool is[100010 << 2], Tag[100010 << 2];   void build(int p, int l, int r) {     if (l == r) {       is[p] = true, num[p] = l;       return;     }     build(p << 1, l, (l + r) >> 1), build(p << 1 | 1, ((l + r) >> 1) + 1, r);     sum[p] = sum[p << 1] + sum[p << 1 | 1];     if (is[p << 1] && is[p << 1 | 1] && num[p << 1] == num[p << 1 | 1])       num[p] = num[p << 1], is[p] = true;     else       num[p] = 0, is[p] = false;   }   void pushdown(int p, int l, int r) {     if (l == r) return;     int mid = (l + r) >> 1;     if (tag[p]) {       tag[p << 1] += tag[p], sum[p << 1] += 1ll * (mid - l + 1) * tag[p];       tag[p << 1 | 1] += tag[p], sum[p << 1 | 1] += 1ll * (r - mid) * tag[p],           tag[p] = 0;     }     if (Tag[p])       num[p << 1] = num[p], num[p << 1 | 1] = num[p],                Tag[p << 1] = Tag[p << 1 | 1] = true, Tag[p] = false;   }   void change(int p, int l, int r, int x, int y, int z) {     if (x <= l && r <= y && is[p] && num[p]) {       sum[p] += 1ll * abs(z - num[p]) * (r - l + 1);       tag[p] += abs(z - num[p]), Tag[p] = true, num[p] = z;       return;     }     int mid = (l + r) >> 1;     pushdown(p, l, r);     if (x <= mid) change(p << 1, l, mid, x, y, z);     if (y > mid) change(p << 1 | 1, mid + 1, r, x, y, z);     sum[p] = sum[p << 1] + sum[p << 1 | 1];     if (is[p << 1] && is[p << 1 | 1] && num[p << 1] == num[p << 1 | 1])       num[p] = num[p << 1], is[p] = true;     else       num[p] = 0, is[p] = false;   }   long long find(int p, int l, int r, int x, int y) {     if (x <= l && r <= y) return sum[p];     int mid = (l + r) >> 1;     long long tmp = 0;     pushdown(p, l, r);     if (x <= mid) tmp += find(p << 1, l, mid, x, y);     if (y > mid) tmp += find(p << 1 | 1, mid + 1, r, x, y);     return tmp;   }   int main() {     scanf( %d%d , &n, &m), build(1, 1, n);     for (int i = 1, kind, l, r, col; i <= m; i++) {       scanf( %d%d%d , &kind, &l, &r);       if (kind == 1)         scanf( %d , &col), change(1, 1, n, l, r, col);       else         printf( %I64d n , find(1, 1, n, l, r));     }   }
#include <bits/stdc++.h>   using namespace std;   const int M = 1000000007;   int n, f[405][405];   int main() {     scanf( %d , &n);     f[1][0] = f[1][1] = 1;     for (int i = 2; i <= n; i++) {       for (int j = 0; j <= n; j++)         for (int k = 0; k <= n; k++) {           int t = 1ll * f[i - 1][j] * f[i - 1][k] % M;           if (j + k + 1 <= n) (f[i][j + k + 1] += t) %= M;           if (j + k <= n) {             (f[i][j + k] += t) %= M;             (f[i][j + k] += 2ll * t * j % M) %= M;             (f[i][j + k] += 2ll * t * k % M) %= M;           }           if (j + k - 1 <= n) {             (f[i][j + k - 1] += 1ll * t * (j + k) * (j + k - 1) % M) %= M;           }         }     }     printf( %d n , f[n][1]);     return 0;   }