malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 7;   map<long long, int> cnt;   bool vis[N];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     long long a[n];     memset(vis, 0, sizeof(vis));     for (int i = 0; i < n; i++) {       long long x;       cin >> x;       while (1) {         auto it = cnt.find(x);         if (it == cnt.end()) {           cnt[x] = i;           break;         } else {           vis[cnt[x]] = true;           cnt.erase(it);           x *= 2LL;         }       }       a[i] = x;     }     vector<long long> vec;     for (int i = 0; i < n; i++) {       if (vis[i]) continue;       vec.push_back(a[i]);     }     cout << vec.size() << endl;     for (long long x : vec) cout << x <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000 * 1000 * 1000 + 7;   long long n, m;   map<long long, long long> mp;   long long get(long long x) {     if (x < 0) return 0;     if (mp.find(x) != mp.end()) return mp[x];     long long y = x / 2, z = x - x / 2;     mp[x] += get(y) * get(z);     mp[x] %= mod;     for (int i = 1; i < m; i++) {       mp[x] += get(y - i) * get(z - m + i);       mp[x] %= mod;     }     return mp[x];   }   int main() {     cin >> n >> m;     mp[0] = 1;     mp[1] = 1;     long long ans = get(n);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, i;   long long a[2019];   int b[2100], ok[2100];   const int MAXN = 2000;   long long C[MAXN + 1][MAXN + 1];   void init() {     int i, j;     for (i = 0; i <= MAXN; ++i) {       C[0][i] = 0;       C[i][0] = 1;     }     for (i = 1; i <= MAXN; ++i) {       for (j = 1; j <= MAXN; ++j)         C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007;     }   }   int main() {     init();     int T, j;     a[1] = 0;     a[2] = 1;     for (i = 3; i <= 2001; i++)       a[i] = (i - 1) * ((a[i - 1] + a[i - 2])) % 1000000007;     cin >> n;     int p = 0;     int flag = 1;     for (i = 1; i <= n; i++) {       int x;       cin >> x;       if (x != -1) {         p++;         ok[i] = 1;       }       if (x != -1) b[x] = 1;     }     if (n == 2) {       cout << 1 << endl;       return 0;     }     long long ans = 1;     for (i = 2; i <= n - p; i++) ans = ans * i % 1000000007;     long long t = 0, r = n - p;     for (i = 1; i <= n; i++)       if (ok[i] == 0 && b[i] == 0) t++;     int f = 1;     for (i = 1; i <= t; i++) {       long long tmp = C[t][i] % 1000000007;       for (j = 2; j <= n - p - i; j++) tmp = tmp * j % 1000000007;       ans -= f * tmp % 1000000007;       ans %= 1000000007;       ans += 1000000007;       ans %= 1000000007;       f = -f;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1 << 19;   double pw2[8 * N];   struct mynum {     double v;     int sh;     mynum(double _v, int _sh) {       v = _v;       sh = _sh;     }     mynum() {}     mynum shift(int x) { return mynum(v, sh + x); }     friend mynum operator+(mynum a, mynum b) {       if (a.sh < b.sh) swap(a, b);       if (b.v == 0) return a;       if (a.v == 0) return b;       b.v *= pw2[b.sh - a.sh + 4 * N];       return mynum(a.v + b.v, a.sh);     }   };   struct tree {     int sh[2 * N];     mynum T[2 * N];     void push(int v) {       if (v >= N) {         T[v].sh += sh[v];         sh[v] = 0;       } else {         sh[2 * v] += sh[v];         sh[2 * v + 1] += sh[v];         T[v].sh += sh[v];         sh[v] = 0;       }     }     mynum get(int l, int r, int L = 1, int R = N, int v = 1) {       if (r < L || l > R)         return mynum(0, 0);       else if (l <= L && R <= r)         return T[v].shift(sh[v]);       else {         push(v);         return get(l, r, L, (L + R) / 2, 2 * v) +                get(l, r, (L + R) / 2 + 1, R, 2 * v + 1);       }     }     inline int getsh(int x) {       int L = 1, R = N, v = 1;       while (v < N) {         push(v);         if ((L + R) / 2 >= x)           v = 2 * v, R = (L + R) / 2;         else           v = 2 * v + 1, L = (L + R) / 2 + 1;       }       return sh[v] + T[v].sh;     }     void ch(int l, int r, int x, int L = 1, int R = N, int v = 1) {       if (r < L || l > R)         return;       else if (l <= L && R <= r)         sh[v] += x;       else {         push(v);         ch(l, r, x, L, (L + R) / 2, 2 * v);         ch(l, r, x, (L + R) / 2 + 1, R, 2 * v + 1);         T[v] = T[2 * v].shift(sh[2 * v]) + T[2 * v + 1].shift(sh[2 * v + 1]);       }     }     tree() {}     void init() {       for (int i = N; i < 2 * N; i++) sh[i] = 0, T[i] = mynum(1, 0);       for (int i = N - 1; i > 0; i--) sh[i] = 0, T[i] = T[2 * i] + T[2 * i + 1];     }   };   tree TL, TR;   int main() {     pw2[4 * N] = 1;     for (int i = 1; i < 4 * N - 10; i++)       pw2[4 * N + i] = pw2[4 * N + i - 1] * 2.0,                   pw2[4 * N - i] = pw2[4 * N - i + 1] / 2.0;     int n;     scanf( %d , &n);     vector<pair<int, int> > V;     TL.init();     TR.init();     for (int i = 1; i <= n; i++) {       int t;       scanf( %d , &t);       V.push_back(make_pair(-t, i));     }     sort(V.begin(), V.end());     double ans = 0;     for (int i = 0; i < V.size(); i++) {       int v = -V[i].first;       int p = V[i].second;       mynum a = TL.get(1, p);       int sa = TL.getsh(p);       mynum b = TR.get(p, n);       int sb = TR.getsh(p);       a = a.shift(-sa);       b = b.shift(-sb);       assert(a.v == a.v);       assert(b.v == b.v);       assert(v == v);       int tp = a.sh + b.sh;       double res = v * a.v * b.v * pw2[4 * N + tp];       assert(pw2[4 * N + tp] == pw2[4 * N + tp]);       assert(res == res);       ans += res;       TL.ch(1, p, -1);       TR.ch(p, n, -1);     }     ans /= 2 * (double)n * (double)n;     printf( %.10lf n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const long long MN = 505, MOD = 1000 * 1000 * 1000 + 7;   long long a[MN], dp[MN][MN];   int32_t main() {     long long n;     cin >> n;     for (long long i = 0; i < n; i++) cin >> a[i], dp[i + 1][i + 1] = 1;     for (long long s = 1; s < n; s++)       for (long long l = 1; l <= n - s; l++) {         long long r = l + s;         dp[l][r] = dp[l + 1][r];         for (long long i = l + 1; i < r; i++)           if (a[i] > a[l]) (dp[l][r] += dp[l + 1][i] * dp[i][r] % MOD) %= MOD;       }     cout << dp[1][n];   }
#include <bits/stdc++.h>   using namespace std;   struct node {     long long a, sum;   } t, tt;   vector<node> vec[300005];   long long cost[300005], in[300005], dp[300005][2], vis[300005];   queue<node> que;   int main(void) {     long long i, j, n, m, a, b, c;     long long ans;     scanf( %lld , &n);     ans = 0;     for (i = 1; i <= n; i++) {       scanf( %lld , &cost[i]);       ans = max(ans, cost[i]);     }     for (i = 1; i < n; i++) {       scanf( %lld %lld %lld , &a, &b, &c);       in[a]++;       in[b]++;       t.sum = c;       t.a = b;       vec[a].push_back(t);       t.a = a;       vec[b].push_back(t);     }     for (i = 1; i <= n; i++) {       if (in[i] == 1) {         t.a = i;         t.sum = cost[i];         que.push(t);         in[i]--;       }     }     while (que.size()) {       t = que.front();       ans = max(ans, t.sum);       vis[t.a] = 1;       que.pop();       for (auto x : vec[t.a]) {         if (vis[x.a] == 1) {           continue;         } else {           if (dp[x.a][0] < t.sum - x.sum) {             dp[x.a][1] = dp[x.a][0];             dp[x.a][0] = t.sum - x.sum;           } else if (dp[x.a][1] < t.sum - x.sum) {             dp[x.a][1] = t.sum - x.sum;           }           ans = max(ans, dp[x.a][0] + dp[x.a][1] + cost[x.a]);           in[x.a]--;           if (in[x.a] == 1) {             tt.a = x.a;             tt.sum = dp[x.a][0] + cost[x.a];             que.push(tt);           }         }       }     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e6 + 9;   long long n, k;   long long a[N];   long long ans;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cerr <<  ‌ ;     cin >> n >> k;     for (int i = 0; i < (n); i++) cin >> a[i], a[i]--;     sort(a, a + n, greater<long long>());     long long i = 0;     while (i < n) ans += a[i] * 2, i += k;     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     for (cin >> (t); (t)--;) {       int n, d;       cin >> n >> d;       int a[n];       for (int i = 0; i < n; i++) cin >> a[i];       int ans = a[0];       for (int i = 1; i < n; i++) {         int q = min(d / i, a[i]);         ans += q;         if (q == d / i)           break;         else           d -= a[i] * i;       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   using ppi = pair<int, pii>;   using vpi = vector<pii>;   const int kMod = 1e9 + 7;   struct ModInt {     long long n;     ModInt(long long n = 0) : n(n % kMod) {}     ModInt operator+(const ModInt& oth) { return n + oth.n; }     ModInt operator-(const ModInt& oth) { return n - oth.n; }     ModInt operator*(const ModInt& oth) { return n * oth.n; }     long long get() { return n < 0 ? n + kMod : n; }   };   using vi = vector<ModInt>;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ll R, G, val = 0, n = 0;     cin >> R >> G;     while (val <= R + G) val += ++n;     n--;     cerr << (int)(1000 * ((double)clock()) / CLOCKS_PER_SEC) << endl;     vector<ll> dp(R + 1, 0);     dp[0] = 1;     ll ans = 0;     for (int i = 1; i <= n; i++) {       vector<ll> newdp(R + 1, 0);       int tmp = (1LL * i * (i + 1)) / 2;       for (int r = 0; r <= R; r++) {         int g = tmp - r;         if (r >= i) newdp[r] = dp[r - i];         if (g <= G) newdp[r] = (newdp[r] + dp[r]) % kMod;       }       dp.swap(newdp);     }     for (int r = 0; r <= R; r++) ans = (ans + dp[r]) % kMod;     cerr << (int)(1000 * ((double)clock()) / CLOCKS_PER_SEC) << endl;     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s, ans;     cin >> s;     ans =   ;     for (int i = 0; i < s.size(); i++) {       ans = ans + s[i];       if (s[i] ==  a  || s[i] ==  e  || s[i] ==  i  || s[i] ==  o  ||           s[i] ==  u  || s[i] ==  y ) {         for (int j = i; j < s.size(); j++) {           if (s[j] ==  a  || s[j] ==  e  || s[j] ==  i  || s[j] ==  o  ||               s[j] ==  u  || s[j] ==  y ) {             i = j;           } else {             break;           }         }       }     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1000000007, maxn = 110;   int n, k, mat[maxn], fact[maxn], dp[maxn][maxn * maxn], stup[maxn][maxn];   long long m;   int pot(int a, long long b) {     if (!b) {       return 1;     }     if (b == 1) {       return a;     }     int rek, ost;     rek = pot(a, b >> 1);     ost = pot(a, b & 1);     return ((((long long)rek * rek) % mod) * (long long)ost) % mod;   }   int rek(int cur, int ost) {     if (!ost) {       return dp[cur][ost] = 1;     }     if (cur >= n || ost < 0) {       return 0;     }     if (dp[cur][ost] != -1) {       return dp[cur][ost];     }     dp[cur][ost] = 0;     for (int i = 0; i <= min(n, ost); i++) {       dp[cur][ost] += ((long long)stup[cur][i] * rek(cur + 1, ost - i)) % mod;       if (dp[cur][ost] >= mod) {         dp[cur][ost] -= mod;       }     }     return dp[cur][ost];   }   int main(void) {     scanf( %d , &n);     cin >> m;     scanf( %d , &k);     fact[0] = 1;     for (int i = 1; i <= n; i++) {       fact[i] = ((long long)fact[i - 1] * i) % mod;     }     for (int i = 0; i < n; i++) {       for (int j = 0; j <= n; j++) {         stup[i][j] =             pot(((long long)fact[n] *                  pot(((long long)fact[j] * fact[n - j]) % mod, mod - 2)) %                     mod,                 (m - i - 1) / n + 1);       }     }     memset(dp, -1, sizeof dp);     printf( %d n , rek(0, k));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename Tp>   inline void read(Tp& x) {     x = 0;     int f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     x *= f;   }   int buf[22];   template <typename Tp>   inline void write(Tp x) {     int p = 0;     if (x < 0) {       putchar( - );       x = -x;     }     if (x == 0)       buf[++p] = 0;     else       while (x) {         buf[++p] = x % 10;         x /= 10;       }     for (int i = p; i; i--) putchar( 0  + buf[i]);   }   int m, b;   int main() {     scanf( %d%d , &m, &b);     long long int ans = 0;     for (int y = 0; y <= b; y++) {       int x = m * (b - y);       ans = max(ans, 1ll * (1 + x) * (1 + y) * (x + y) / 2);     }     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline T bigmod(T p, T e, T M) {     if (e == 0) return 1;     if (e % 2 == 0) {       T t = bigmod(p, e / 2, M);       return (t * t) % M;     }     return (bigmod(p, e - 1, M) * p) % M;   }   template <class T>   inline T gcd(T a, T b) {     if (b == 0) return a;     return gcd(b, a % b);   }   template <class T>   inline T modinverse(T a, T M) {     return bigmod(a, M - 2, M);   }   template <class T>   inline T multimod(T a, T b, T m) {     T ans = 0ll;     a %= m, b %= m;     while (b) {       if (b & 1ll) ans = m - ans > a ? (ans + a) : (ans + a - m);       b >>= 1ll;       a = (m - a) > a ? a + a : a + a - m;     }     return (T)ans;   }   long long dp[102][2688];   char str[102];   long long solve(long long a, long long b) {     if (a < b) swap(a, b);     if (a == 0ll || b == 0ll) return false;     if (!solve(b, a % b)) return true;     long long x = a / b;     return (x % (b + 1) % 2 == 0);   }   int main() {     int i, j, x, y, k;     int u, v, m, q, t, n, w;     memset(dp, -1ll, sizeof dp);     scanf( %d , &t);     while (t--) {       long long a, b;       cin >> a >> b;       if (solve(a, b))         cout <<  First  << endl;       else         cout <<  Second  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int unibit[60] = {0};   long long a[200005];   long long unia[200005] = {0};   int main() {     int n, k, x;     cin >> n >> k >> x;     long long orr = 0;     for (int i = 1; i <= n; i++) {       cin >> a[i];       orr |= a[i];       long long b = a[i];       for (int j = 0; b > 0; j++) {         if (b % 2 == 1) {           if (unibit[j] == 0)             unibit[j] = i;           else             unibit[j] = -1;         }         b /= 2;       }     }     long long pow = 1;     for (int i = 0; i < 35; i++) {       if (unibit[i] > 0) {         int j = unibit[i];         unia[j] += pow;       }       pow *= 2;     }     long long ans = 0;     long long xx = 1;     for (int i = 0; i < k; i++) xx *= (long long)x;     for (int i = 1; i <= n; i++) {       long long or2 = orr;       or2 ^= unia[i];       a[i] *= xx;       or2 |= a[i];       if (ans < or2) ans = or2;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char a[105][105], s[105], res[105], letter, letter2, help[105];   int i, j, k, N, lens, lena[105];   int main() {     scanf( %d , &N);     gets(a[103]);     for (i = 0; i < N; i++) {       gets(a[i]);       lena[i] = strlen(a[i]);       for (j = 0; j < lena[i]; j++)         if (a[i][j] >=  a  && a[i][j] <=  z ) a[i][j] -= 32;     }     gets(s);     lens = strlen(s);     for (i = 0; i < lens; i++) {       if (s[i] >=  a  && s[i] <=  z )         help[i] = s[i] - 32;       else         help[i] = s[i];     }     scanf( %c , &letter);     if (letter >=  A  && letter <=  Z )       letter2 = letter + 32;     else       letter2 = letter - 32;     if (letter < letter2) swap(letter, letter2);     for (i = 0; i < lens; i++) {       for (j = 0; j < N; j++) {         if (memcmp(help + i, a[j], lena[j]) == 0) {           for (k = i; k < i + lena[j]; k++) {             if (s[k] != letter && s[k] != letter2) {               if (s[k] >=  a  && s[k] <=  z )                 res[k] = letter;               else                 res[k] = letter2;             } else {               if (s[k] >=  a  && s[k] <=  z )                 res[k] = letter ==  a  ?  b  :  a ;               else                 res[k] = letter2 ==  A  ?  B  :  A ;             }           }         }       }     }     for (i = 0; i < lens; i++)       if (res[i] == 0) res[i] = s[i];     puts(res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());   const int MOD = 998244353;   void add(int &x, int y) {     x += y;     if (x >= MOD) x -= MOD;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     vector<int> x(n), y(n), s(n);     for (int i = 0; i < (int)(n); i++) cin >> x[i] >> y[i] >> s[i];     vector<int> cost(n + 1);     for (int i = 0; i < (int)(n); i++) {       int j = lower_bound((x).begin(), (x).end(), y[i]) - x.begin();       cost[i + 1] = (x[i] - y[i]) % MOD;       add(cost[i + 1], cost[i]);       add(cost[i + 1], MOD - cost[j]);       add(cost[i + 1], cost[i]);     }     for (int i = (int)(n)-1; i >= ((int)0); i--) add(cost[i + 1], MOD - cost[i]);     int ans = (x.back() + 1) % MOD;     for (int i = 0; i < (int)(n); i++)       if (s[i]) add(ans, cost[i + 1]);     cout << ans % MOD << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool checkbitt(long long int num, int pos);   long long int setbitt(long long int num, long long int pos);   long long int resetbitt(long long int num, int pos);   const long long int mod = 1e9 + 7;   const long long int N = 1e6 + 10;   long long int count(long long int x) {     x--;     return (x * (x + 1)) / 2;   }   int solve() {     int n;     cin >> n;     pair<int, int> arr[n];     map<int, int> a;     map<int, int> b;     map<pair<int, int>, int> c;     long long int bad = 0;     for (int i = 0; i < n; i++) {       cin >> arr[i].first >> arr[i].second;       a[arr[i].first]++;       b[arr[i].second]++;       c[arr[i]]++;       bad += c[arr[i]] - 1;     }     long long int res = 0;     for (auto x : a) {       res += count(x.second);     }     for (auto x : b) {       res += count(x.second);     }     cout << res - bad << endl;     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int cs = 1;     int cn = 1;     while (cs--) {       solve();     }   }   bool checkbitt(long long int num, int pos) { return (num >> pos) & 1; }   long long int setbitt(long long int num, long long int pos) {     return (1 << pos) | num;   }   long long int resetbitt(long long int num, int pos) {     if (!checkbitt(num, pos))       return num;     else       return (1 << pos) ^ num;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   const int N = 2e5 + 5;   const double pi = acos(-1);   int t;   int main() {     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       if (n % m == 0)         cout <<  YES  <<   n ;       else         cout <<  NO  <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, ans = 1e9;   vector<vector<int> > cnt(65);   vector<set<int> > ed;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n;     ed.resize(n + 1);     bool tw = false;     for (int i = 0; i < n; i++) {       long long a;       cin >> a;       int d = 0;       while (a && !(tw)) {         if (a & 1) {           for (int k : cnt[d]) {             if (ed[k].find(i) == ed[k].end()) {               ed[k].insert(i);               ed[i].insert(k);             }           }           cnt[d].push_back(i);           if (cnt[d].size() > 2) tw = true;         }         a >>= 1, d++;       }     }     if (tw) {       cout << 3 <<   n ;       return 0;     }     for (int j = 0; j < 64; j++) {       unordered_set<int> vis;       if (cnt[j].size() == 2) {         queue<pair<int, int> > q;         for (int k : ed[cnt[j][0]])           if (k != cnt[j][1]) q.push(make_pair(k, 1));         vis.insert(cnt[j][0]);         while (!q.empty()) {           pair<int, int> cur = q.front();           q.pop();           if (vis.find(cur.first) != vis.end()) continue;           vis.insert(cur.first);           if (cur.first == cnt[j][1]) {             ans = min(ans, cur.second);             break;           }           for (int k : ed[cur.first]) q.push(make_pair(k, cur.second + 1));         }       }     }     if (ans == 1e9)       cout << -1 <<   n ;     else       cout << ans + 1 <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF64 = 1e18 + 1337;   const int INF32 = 1e9 + 228;   const int MOD = 1e9 + 7;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, s;     cin >> n >> s;     vector<long long> a(n);     long long sum = 0;     for (int i = 0; i < n; i++) {       cin >> a[i];       sum += a[i];     }     if (sum < s) {       cout << -1;       return 0;     }     sort(a.begin(), a.end(), greater<int>());     for (int i = 0; i < n - 1; i++) s -= (a[i] - a[n - 1]);     while (s > 0 && a[n - 1] > 0) {       s -= n;       a[n - 1]--;     }     cout << a[n - 1];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   pair<long long, long long> P, d[100000];   double rm, rM;   int main() {     scanf( %d%I64d%I64d , &n, &P.first, &P.second);     for (int i = 0; i < n; i++) {       pair<long long, long long> Q;       scanf( %I64d%I64d , &Q.first, &Q.second);       double t = (P.first - Q.first) * (P.first - Q.first) +                  (P.second - Q.second) * (P.second - Q.second);       if (i == 0)         rm = rM = t;       else {         if (rm > t) rm = t;         if (rM < t) rM = t;       }       d[i] = Q;     }     for (int i = 0; i < n; i++) {       int j = (i + 1) % n;       pair<long long, long long> Q =           make_pair(d[j].first - d[i].first, d[j].second - d[i].second);       double t =           Q.first * (P.first - d[i].first) + Q.second * (P.second - d[i].second);       t /= (Q.first * Q.first + Q.second * Q.second);       if (0 <= t && t <= 1) {         long long a = d[j].second - d[i].second;         long long b = -(d[j].first - d[i].first);         long long c = -(a * d[i].first + b * d[i].second);         double t = (a * P.first + b * P.second + c);         t = t * t / (a * a + b * b);         if (t < rm) rm = t;       }     }     double r = rM - rm;     printf( %.9f n , r * 3.1415926535897932384626433832795);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   int i, j, k, n, m, vis[maxn], cnt, Q[maxn], top;   void dfs(int now) {     vis[now]++;     if (!vis[now * 2 % n]) dfs(now * 2 % n);     if (!vis[(now * 2 + 1) % n]) dfs((now * 2 + 1) % n);     Q[++top] = now;   }   int main() {     cin >> n;     if (n & 1)       cout << -1 << endl;     else {       dfs(0);       while (top) cout << Q[top--] <<    ;       cout << 0 << endl;     }     return 0;   }