malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   inline int toInt(string s) {     int v;     istringstream sin(s);     sin >> v;     return v;   }   template <class T>   inline string toString(T x) {     ostringstream sout;     sout << x;     return sout.str();   }   const long long MOD = 1000000007;   long long inv[105];   vector<vector<long long>> matmul(vector<vector<long long>> a,                                    vector<vector<long long>> b) {     int n = a.size();     vector<vector<long long>> ret =         vector<vector<long long>>(n, vector<long long>(n, 0));     for (int i = 0; i < (int)n; ++i)       for (int j = 0; j < (int)n; ++j)         for (int k = 0; k < (int)n; ++k)           ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % MOD;     return ret;   }   vector<long long> matvecmul(vector<vector<long long>> a, vector<long long> b) {     int n = a.size();     auto ret = vector<long long>(n, 0);     for (int i = 0; i < (int)n; ++i)       for (int k = 0; k < (int)n; ++k) ret[i] = (ret[i] + a[i][k] * b[k]) % MOD;     return ret;   }   vector<vector<long long>> matpow(vector<vector<long long>> a, long long p) {     vector<vector<long long>> tmp = a;     int n = a.size();     vector<vector<long long>> ret =         vector<vector<long long>>(n, vector<long long>(n, 0LL));     for (int i = 0; i < (int)n; ++i) ret[i][i] = 1LL;     while (p) {       if (p & 1) ret = matmul(ret, tmp);       tmp = matmul(tmp, tmp);       p >>= 1;     }     return ret;   }   vector<pair<long long, int>> f(long long n) {     vector<pair<long long, int>> ret;     for (long long i = 2; i * i <= n; i++) {       int cnt = 0;       while (n % i == 0) {         cnt++;         n /= i;       }       if (cnt != 0) ret.push_back(make_pair(i, cnt));     }     if (n != 1) ret.push_back(make_pair(n, 1));     return ret;   }   void init() {     inv[1] = 1LL;     for (int i = 2; i < 100; i++) {       inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;     }   }   int main() {     long long n, k;     init();     cin >> n >> k;     vector<vector<long long>> mat(51, vector<long long>(51, 0));     for (int i = 0; i < (int)51; ++i) {       for (int j = i; j < (int)51; ++j) {         mat[i][j] = inv[j + 1];       }     }     mat = matpow(mat, k);     auto ff = f(n);     long long ret = 1;     for (auto fc : ff) {       long long ex = 0;       long long p = 1;       vector<long long> vec(51, 0);       vec[fc.second] = 1LL;       vec = matvecmul(mat, vec);       for (int i = 0; i < (int)fc.second + 1; ++i) {         ex = (ex + (p * vec[i]) % MOD) % MOD;         p = (p * fc.first) % MOD;       }       ret = (ret * ex) % MOD;     }     cout << ret << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int nax = 2e5 + 10;   int first[nax], last[nax], a[nax];   int reach[nax];   int main() {     fill_n(first, nax, 1e9);     fill_n(last, nax, -1e9);     ios::sync_with_stdio(0);     cin.tie(0);     int n, q;     cin >> n >> q;     for (int i = 0; i < n; i++) {       cin >> a[i];       first[a[i]] = min(first[a[i]], i);       last[a[i]] = max(last[a[i]], i);       reach[i] = i;     }     for (int v = 0; v < nax; v++) {       if (last[v] == -1e9) continue;       reach[first[v]] = max(reach[first[v]], last[v]);     }     int ans = 0, r = 0;     map<int, int> count;     for (int i = 0; i <= n; i++) {       if (i >= r) {         int ma = 0, sum = 0;         for (auto p : count) {           ma = max(ma, p.second);           sum += p.second;         }         ans += sum - ma;         count.clear();       }       if (i == n) break;       count[a[i]]++;       r = max(r, reach[i] + 1);     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<long long> a(n);     long long s = 0;     long long l = 0;     long long r = 1000000000000000;     for (int i = 0; i < n; i++) {       cin >> a[i];       s += a[i];       l = max(a[i], l);     }     long long is = r;     while (l <= r) {       long long mid = (l + r) / 2;       if (n * mid - s > s) {         is = min(is, mid);         r = mid - 1;       } else         l = mid + 1;     }     cout << is <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5;   long long n, a[N], sum;   vector<long long> v;   void fact() {     if (sum % 2 == 0) {       v.push_back(2);       while (sum % 2 == 0) sum /= 2;     }     for (long long i = 3; i * i <= sum; i += 2) {       if (sum % i == 0) {         v.push_back(i);         while (sum % i == 0) sum /= i;       }     }     if (sum > 2) v.push_back(sum);   }   long long solve(long long p) {     long long tmp, tmp2, res = 0;     for (int i = 1; i < n; i++) {       tmp = a[i] % p, tmp2 = p - tmp;       if (tmp < tmp2)         res += tmp;       else         res += tmp2;     }     return res;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];       sum += a[i];       a[i] = a[i - 1] + a[i];     }     fact();     if (!v.size()) return cout <<  -1 n , 0;     long long ans = 1e18;     for (int i = 0; i < v.size(); i++) {       long long p = v[i];       ans = min(ans, solve(p));     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline bool cmin(int &x, int y) { return x > y ? x = y, 1 : 0; }   inline bool cmax(int &x, int y) { return x < y ? x = y, 1 : 0; }   const int _ = 1e5 + 55;   int N, x;   long long ans(0);   priority_queue<int> A, B;   int main() {     scanf( %d , &N);     for (int i(1), I(N); i <= I; ++i) scanf( %d , &x), A.push(x);     for (int i(1), I(N); i <= I; ++i) scanf( %d , &x), B.push(x);     for (int i(1), I(N); i <= I; ++i) {       if (!A.size())         B.pop();       else if (!B.size())         ans += A.top(), A.pop();       else if (A.top() > B.top())         ans += A.top(), A.pop();       else         B.pop();       if (!A.size())         ans -= B.top(), B.pop();       else if (!B.size())         A.pop();       else if (A.top() > B.top())         A.pop();       else         ans -= B.top(), B.pop();     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int out = 0, fh = 1;     char jp = getchar();     while ((jp >  9  || jp <  0 ) && jp !=  - ) jp = getchar();     if (jp ==  - ) fh = -1, jp = getchar();     while (jp >=  0  && jp <=  9 ) out = out * 10 + jp -  0 , jp = getchar();     return out * fh;   }   const int P = 998244353;   int add(int a, int b) { return (a + b >= P) ? (a + b - P) : (a + b); }   void inc(int &a, int b) { a = add(a, b); }   int mul(int a, int b) { return 1LL * a * b % P; }   int fpow(int a, int b) {     int res = 1;     while (b) {       if (b & 1) res = mul(res, a);       a = mul(a, a);       b >>= 1;     }     return res;   }   const int N = 2019;   char buf[N];   int n, f[N][N], s[N];   int sum(int L, int R) {     if (L > R) return 0;     return add(s[R], P - s[L - 1]);   }   int main() {     scanf( %s , buf + 1);     n = strlen(buf + 1);     for (int i = 1; i <= n; ++i) s[i] = s[i - 1] + (buf[i] ==  ? );     for (int len = 2; len <= n; ++len)       for (int i = 1; i + len - 1 <= n; ++i) {         int j = i + len - 1;         if (buf[i] !=  ( ) inc(f[i][j], f[i + 1][j]);         if (buf[j] !=  ) ) inc(f[i][j], f[i][j - 1]);         if (buf[i] !=  (  && buf[j] !=  ) ) inc(f[i][j], P - f[i + 1][j - 1]);         if (buf[i] !=  )  && buf[j] !=  ( )           inc(f[i][j], add(f[i + 1][j - 1], fpow(2, sum(i + 1, j - 1))));       }     cout << f[1][n] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long q;     cin >> q;     while (q--) {       long long n;       cin >> n;       vector<long long> vec(n, 0);       vector<bool> vis(n, false);       vector<pair<long long, long long>> p(n);       for (long long i = 0; i < n; i++) cin >> vec[i];       for (long long i = 0; i < n; i++) {         if (!vis[i]) {           vis[i] = true;           long long j = vec[i] - 1;           long long days = 1;           while (j != i) {             p[j] = make_pair(1, i);             vis[j] = true;             j = vec[j] - 1;             days++;           }           p[i] = make_pair(0, days);         }       }       for (long long i = 0; i < n; i++) {         if (p[i].first == 0)           cout << p[i].second <<    ;         else           cout << p[p[i].second].second <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0);     int n, a, b;     cin >> n >> a >> b;     int ans = 0;     int c[n];     for (int i = 0; i < n; i++) cin >> c[i];     int st = 0;     int en = n - 1;     while (st <= en) {       if (st == en) {         if (c[st] == 2) {           if (a < b) {             c[st] = 0;             ans += a;           } else             ans += b;         }       } else if (c[st] == c[en] && c[st] != 2) {         st++, en--;         continue;       } else {         if (c[st] == 2) {           if (c[en] == 1)             ans += b, c[st] = 1;           else if (c[en] == 0)             ans += a, c[st] = 0;           else {             if (a < b) {               c[en] = 0;               c[st] = 0;               ans += 2 * a;             } else {               c[en] = 1;               c[st] = 1;               ans += 2 * b;             }           }         } else if (c[en] == 2) {           if (c[st] == 1)             ans += b, c[en] = 1;           else if (c[st] == 0)             ans += a, c[en] = 0;           else {             if (a < b) {               c[en] = 0;               c[st] = 0;               ans += 2 * a;             } else {               c[en] = 1;               c[st] = 1;               ans += 2 * b;             }           }         }       }       st++;       en--;     }     st = 0;     en = n - 1;     while (st <= en) {       if (c[st] != c[en]) {         cout << -1;         return 0;       }       st++;       en--;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   inline void write(int x) {     if (x > 9) write(x / 10);     putchar(x % 10 +  0 );   }   inline void writeln(int x) {     write(x);     putchar(  n );   }   const int N = 1000005;   struct node {     int l, r;   } b[N];   struct que {     int l, r, id;   } c[N];   int now;   int Ans[N];   int n, k, q;   int Mx[N * 4], pos[N * 4];   int Mxdis[N];   int stkc[N], topc;   int Pos, ans;   inline bool cmp2(node a, node b) {     return a.r < b.r || (a.r == b.r && a.l > b.l);   }   inline bool cmp3(que a, que b) {     return a.r < b.r || (a.r == b.r && a.l > b.l);   }   inline void change(int x, int y) {     int l = 1, r = n, num = 1;     while (1) {       int mid = (l + r) >> 1;       if (Mx[num] < y) pos[num] = x, Mx[num] = y;       if (l == r) break;       if (x <= mid)         r = mid, num = (num << 1);       else         l = mid + 1, num = (num << 1 | 1);     }   }   inline void query(int num, int l, int r, int x, int y) {     if (x <= l && r <= y) {       if (Mx[num] > ans) {         Pos = pos[num];         ans = Mx[num];       }       return;     }     int mid = (l + r) >> 1;     if (x <= mid) query(num << 1, l, mid, x, y);     if (y > mid) query(num << 1 | 1, mid + 1, r, x, y);   }   int main() {     n = read();     k = read();     for (int i = 1; i <= k; ++i) b[i].l = read(), b[i].r = read();     q = read();     for (int i = 1; i <= q; ++i) c[i].l = read(), c[i].r = read(), c[i].id = i;     sort(b + 1, b + k + 1, cmp2);     sort(c + 1, c + q + 1, cmp3);     now = 1;     for (int i = 1; i <= n; ++i) Mxdis[i] = i;     for (int i = 1; i <= q; ++i) {       while (now <= k && b[now].r <= c[i].r) {         if (Mxdis[b[now].l] < b[now].r) {           change(b[now].l, b[now].r);           Mxdis[b[now].l] = b[now].r;         }         ++now;       }       topc = 0;       stkc[++topc] = c[i].l;       int last = c[i].l;       while (1) {         int x = stkc[topc];         Pos = 0, ans = 0;         query(1, 1, n, last, Mxdis[x]);         if (ans > Mxdis[x])           stkc[++topc] = Pos, last = Mxdis[x];         else           break;       }       int mm = Mxdis[stkc[topc--]];       while (topc > 0) {         change(stkc[topc], mm);         Mxdis[stkc[topc--]] = mm;       }       Ans[c[i].id] = mm;     }     for (int i = 1; i <= q; ++i) writeln(Ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 10, inf = 0x3f3f3f3f, mod = 1000000007;   const long long INF = 0x3f3f3f3f3f3f3f3f;   const double eps = 1e-9;   void read() {}   template <typename T, typename... T2>   inline void read(T &x, T2 &...oth) {     x = 0;     int ch = getchar(), f = 0;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = 1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + (ch ^ 48);       ch = getchar();     }     if (f) x = -x;     read(oth...);   }   int pre[maxn][2], ok = 0, tar = 0, vv[maxn];   bool vis[maxn][2];   list<int> ans;   vector<int> G[maxn];   void dfs(int x, bool sta) {     if (vis[x][sta] || ok == 2) return;     ans.push_back(x);     vv[x] = 1;     vis[x][sta] = 1;     for (int &v : G[x]) {       if (vv[v] == 1) ok = max(ok, 1);       if (vis[v][!sta]) continue;       if (G[v].size() == 0 && !sta && ok != 2) {         ok = 2;         ans.push_back(v);       }       dfs(v, !sta);     }     if (ok != 2) ans.pop_back();     vv[x] = 2;   }   signed main(signed argc, char const *argv[]) {     std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     int n, m, s;     cin >> n >> m;     for (int i = 1, c, v; i <= n; i++) {       cin >> c;       for (int j = 1; j <= c; j++) {         cin >> v;         G[i].push_back(v);       }     }     cin >> s;     dfs(s, 0);     if (ok == 2) {       cout <<  Win  << endl;       for (int &i : ans) cout << i <<    ;     } else if (ok == 1)       cout <<  Draw  << endl;     else if (ok == 0)       cout <<  Lose  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class TH>   void _dbg(const char *sdbg, TH h) {     cout << sdbg <<   =   << h << endl;   }   template <class TH, class... TA>   void _dbg(const char *sdbg, TH h, TA... a) {     while (*sdbg !=  , ) cout << *sdbg++;     cout <<   =   << h <<  ,  ;     _dbg(sdbg + 1, a...);   }   const long long mod = 1e9 + 7;   const long long M = 1e6 + 5;   const double pi = acos(-1.);   const long long dx[] = {1, 0, -1, 0, -1, -1, 1, 1};   const long long dy[] = {0, 1, 0, -1, 1, -1, 1, -1};   long long x, y, z, maxi, mini, ans, mid, low, high, m, n, a, b;   string s1, s2;   bool check(long long p) {     p = abs(p);     while (p) {       int k = p % 10;       if (k == 8) return true;       p /= 10;     }     return false;   }   void solve() {     cin >> n;     x = n;     x++;     while (!check(x)) x++;     cout << abs(x - n);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void umax(T &a, T b) {     if (a < b) a = b;   }   template <class T>   inline void umin(T &a, T b) {     if (a > b) a = b;   }   const int N = 2e5;   long long X, Y, x[N], y[N];   long long nx, bx;   long long ny, by;   long long basx, basy;   int main() {     cin >> nx >> bx;     for (int i = 1; i <= nx; i++) cin >> x[i];     cin >> ny >> by;     for (int i = 1; i <= ny; i++) cin >> y[i];     basx = basy = 1;     for (int i = nx; i >= 1; i--) {       X += basx * x[i];       basx *= bx;     }     for (int i = ny; i >= 1; i--) {       Y += basy * y[i];       basy *= by;     }     if (X < Y)       cout <<  < ;     else if (X > Y)       cout <<  > ;     else       cout <<  = ;     return !1;   }
#include <bits/stdc++.h>   const int SZ = 2e5 + 5;   using namespace std;   int n, p[SZ];   string s, t;   bool valid(int idx) {     string tmp = s;     for (int i = 0; i < idx; i++) {       tmp[p[i]] =  . ;     }     string tmp2 =   ;     for (int i = 0; i < n; i++) {       if (tmp[i] !=  . ) tmp2 += tmp[i];     }     int i, j;     int m = tmp2.size();     int k = t.size();     for (i = 0, j = 0; i < m && j < k; i++) {       if (t[j] == tmp2[i]) j++;     }     return (j == k);   }   int binarySearch() {     int f = 0, e = n;     while (f <= e) {       int m = f + e >> 1;       if (valid(m))         f = m + 1;       else         e = m - 1;     }     return f - 1;   }   int main() {     cin >> s >> t;     n = s.size();     for (int i = 0; i < n; i++) {       cin >> p[i];       p[i]--;     }     cout << binarySearch();   }
#include <bits/stdc++.h>   using namespace std;   int v[100005];   stack<pair<int, int> > S;   vector<pair<int, int> > Q;   int main() {     int N;     scanf( %d , &N);     for (int i = 0; i < N; i++) scanf( %d , &v[i]);     ++N;     v[N] = 0;     for (int i = 0; i < N; i++) {       int a = v[i];       if (S.empty() && !a) continue;       if (S.empty() || a > S.top().first) {         int l = (S.empty() ? 0 : S.top().first);         for (int j = l + 1; j <= a; j++) S.push(pair<int, int>(j, i));       }       if (a < S.top().first) {         int l = S.top().first;         for (int j = l; j > a; j--) {           Q.push_back(pair<int, int>(S.top().second, i));           S.pop();         }       }     }     cout << Q.size() << endl;     for (int i = 0; i < (int)Q.size(); i++)       printf( %d %d n , Q[i].first + 1, Q[i].second);   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 200100;   int N, M;   vector<int> edge[MAXN];   int dep[MAXN];   int croute[MAXN];   int par[MAXN];   pair<int, int> cover[MAXN];   bool seen[MAXN];   void run(int cloc, int last, int cdep) {     seen[cloc] = true;     croute[cdep] = cloc;     dep[cloc] = cdep;     par[cloc] = last;     for (int i = 0; i < edge[cloc].size(); i++) {       int neigh = edge[cloc][i];       if (neigh == last) continue;       if (!seen[neigh])         run(neigh, cloc, cdep + 1);       else {         int s = dep[neigh];         for (int j = s + 1; j <= cdep; j++) {           int k = croute[j];           if (cover[k].first != -1) {             int a = cover[k].first, b = cover[k].second;             int c = neigh, d = cloc;             if (dep[a] > dep[c]) {               swap(a, c);               swap(b, d);             }             vector<int> x, y, z;             int goalx = b, goaly = d;             while (dep[goalx] > dep[goaly]) goalx = par[goalx];             while (dep[goaly] > dep[goalx]) goaly = par[goaly];             while (goalx != goaly) {               goalx = par[goalx];               goaly = par[goaly];             }             int goal = goalx;             int n = c;             x.push_back(n);             while (n != a) {               n = par[n];               x.push_back(n);             }             x.push_back(b);             n = b;             while (n != goal) {               n = par[n];               x.push_back(n);             }             y.push_back(c);             y.push_back(d);             n = d;             while (n != goal) {               n = par[n];               y.push_back(n);             }             n = goal;             z.push_back(n);             while (n != c) {               n = par[n];               z.push_back(n);             }             cout <<  YES n ;             cout << x.size();             for (int m = 0; m < x.size(); m++) cout <<     << x[m] + 1;             cout <<   n ;             cout << y.size();             for (int m = 0; m < y.size(); m++) cout <<     << y[m] + 1;             cout <<   n ;             cout << z.size();             for (int m = z.size() - 1; m >= 0; m--) cout <<     << z[m] + 1;             cout <<   n ;             exit(0);           } else             cover[k] = make_pair(neigh, cloc);         }       }     }   }   int main() {     for (int i = 0; i < MAXN; i++) {       cover[i] = make_pair(-1, -1);       seen[i] = false;     }     cin >> N >> M;     for (int i = 0; i < M; i++) {       int a, b;       cin >> a >> b;       a--, b--;       edge[a].push_back(b);       edge[b].push_back(a);     }     for (int i = 0; i < N; i++) {       if (!seen[i]) {         run(i, -1, 0);       }     }     cout <<  NO n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1000000 + 10;   const int INF = 10000000;   int n;   struct Number {     int L, R, num;   } a[N];   const bool comp(const Number &A, const Number &B) { return A.num > B.num; }   int main() {     scanf( %d , &n);     int pos;     for (int i = 1; i <= N; ++i)       a[i - 1].L = INF, a[i - 1].R = -INF, a[i - 1].num = 0;     for (int i = 1; i <= n; ++i) {       scanf( %d , &pos);       ++a[pos].num;       a[pos].L = min(i, a[pos].L);       a[pos].R = max(i, a[pos].R);     }     sort(a + 1, a + N, comp);     int Max = a[1].num, tmp = 1;     int ans1, ans2, ans3 = INF;     while (a[tmp].num == Max) {       if (a[tmp].R - a[tmp].L + 1 < ans3) {         ans3 = a[tmp].R - a[tmp].L + 1;         ans1 = a[tmp].L, ans2 = a[tmp].R;       }       ++tmp;     }     printf( %d %d n , ans1, ans2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = (int)1e5 + 5;   int n;   pair<long long, int> t[N];   long long tree[4 * N], dp[N], v[N];   int rnk[N];   inline void update(int idx, long long val, int st, int en, int root) {     if (idx < st || idx > en) return;     if (st == en) {       tree[root] = max(tree[root], val);       return;     }     int mid = (st + en) >> 1;     update(idx, val, st, mid, root * 2);     update(idx, val, mid + 1, en, root * 2 + 1);     tree[root] = max(tree[root * 2], tree[root * 2 + 1]);   }   inline long long query(int L, int R, int st, int en, int root) {     if (L > en || R < st) return 0;     if (st >= L && en <= R) return tree[root];     int mid = (st + en) >> 1;     return max(query(L, R, st, mid, root * 2),                query(L, R, mid + 1, en, root * 2 + 1));   }   map<long long, int> m;   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       int h, r;       scanf( %d %d , &r, &h);       v[i] = 1LL * r * r * h;       m[v[i]];     }     int id = 0;     for (auto &x : m) x.second = id++;     for (int i = 0; i < n; i++) {       int rnk = m[v[i]];       dp[i] = v[i];       long long best = query(0, rnk - 1, 0, n - 1, 1);       dp[i] += best;       update(rnk, dp[i], 0, n - 1, 1);     }     long long ret = 0;     for (int i = 0; i < n; i++) ret = max(ret, dp[i]);     cout << fixed << setprecision(12) << acos(-1) * ret <<   n ;   }