malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int INF = (int)1e8;   const int N = 500;   int n;   int ans;   int a[N];   set<int> p;   int m;   int b[N][2];   struct Edge {     int to, cap, flow;     Edge() : to(), cap(), flow() {}     Edge(int _to, int _cap) : to(_to), cap(_cap), flow(0) {}   };   int sz;   Edge ed[2 * N];   vector<int> g[N];   int S, T;   void fact(int x) {     for (int i = 2; i * i <= x; i++) {       if (x % i != 0) continue;       p.insert(i);       while (x % i == 0) x /= i;     }     if (x != 1) p.insert(x);     return;   }   void addEdge(int v, int to, int cap) {     ed[sz] = Edge(to, cap);     g[v].push_back(sz++);     ed[sz] = Edge(v, 0);     g[to].push_back(sz++);     return;   }   int q[N];   int qSz;   int d[N];   bool bfs(int S, int T, int n) {     for (int i = 0; i < n; i++) d[i] = INF;     d[S] = 0;     qSz = 1;     q[0] = S;     for (int k = 0; k < qSz; k++) {       int v = q[k];       for (int i = 0; i < (int)g[v].size(); i++) {         Edge e = ed[g[v][i]];         if (e.flow == e.cap) continue;         int to = e.to;         if (d[to] <= d[v] + 1) continue;         d[to] = d[v] + 1;         q[qSz++] = to;       }     }     return (d[T] < INF);   }   int idx[N];   int dfs(int v, int T, int pushFlow) {     int res = 0;     if (v == T || pushFlow == 0) return pushFlow;     for (; idx[v] < (int)g[v].size(); idx[v]++) {       int id = g[v][idx[v]];       Edge e = ed[id];       int to = e.to;       if (d[to] != d[v] + 1) continue;       int deltaFlow = dfs(to, T, min(pushFlow, e.cap - e.flow));       pushFlow -= deltaFlow;       res += deltaFlow;       ed[id].flow += deltaFlow;       ed[id ^ 1].flow -= deltaFlow;       if (pushFlow == 0) break;     }     return res;   }   int flow(int S, int T, int n) {     int res = 0;     while (bfs(S, T, n)) {       for (int i = 0; i < n; i++) idx[i] = 0;       res += dfs(S, T, INF);     }     return res;   }   int solve(int q) {     for (int i = 0; i < n + 2; i++) g[i].clear();     sz = 0;     for (int i = 0; i < n; i++) {       int c = 0;       int t = a[i];       while (t % q == 0) {         t /= q;         c++;       }       if (i % 2 == 0)         addEdge(S, i, c);       else         addEdge(i, T, c);     }     for (int i = 0; i < m; i++) addEdge(b[i][0], b[i][1], INF);     return flow(S, T, n + 2);   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     for (int i = 0; i < n; i++) fact(a[i]);     for (int i = 0; i < m; i++)       for (int j = 0; j < 2; j++) {         scanf( %d , &b[i][j]);         b[i][j]--;       }     for (int i = 0; i < m; i++) {       if (b[i][0] % 2 == 1) swap(b[i][0], b[i][1]);     }     S = n;     T = n + 1;     for (auto it = p.begin(); it != p.end(); it++) ans += solve(*it);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int p[200007];   int c1[200007];   int c2[200007];   bool used[200007];   int main() {     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       scanf( %d , &p[i]);     }     for (int i = 0; i < n; ++i) {       scanf( %d , &c1[i]);       c1[i]--;     }     for (int i = 0; i < n; ++i) {       scanf( %d , &c2[i]);       c2[i]--;     }     priority_queue<pair<int, int>> q[3];     for (int i = 0; i < n; ++i) {       if (c1[i] == c2[i]) {         q[c1[i]].push(make_pair(-p[i], i));       } else {         q[c1[i]].push(make_pair(-p[i], i));         q[c2[i]].push(make_pair(-p[i], i));       }     }     int m, x;     cin >> m;     for (int i = 0; i < m; ++i) {       scanf( %d , &x);       x--;       while (!q[x].empty() && used[q[x].top().second]) q[x].pop();       if (q[x].empty())         printf( -1  );       else {         printf( %d  , -q[x].top().first);         used[q[x].top().second] = 1;         q[x].pop();       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long dp[64][64][64][64];   double fact[64];   int main() {     int n, a[64], p, s = 0;     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> a[i];       s += a[i];     }     cin >> p;     if (s <= p) {       printf( %.9f n , (double)n);       return 0;     }     fact[0] = 1;     for (int i = 1; i < 64; ++i) {       fact[i] = fact[i - 1] * i;     }     for (int ignore = 0; ignore < n; ++ignore) {       dp[ignore][0][0][0] = 1;       for (int i = 0; i < n; ++i) {         for (int j = 0; j <= i; ++j) {           for (int k = 0; k <= p; ++k) {             if (i != ignore && k + a[i] <= p) {               dp[ignore][i + 1][j + 1][k + a[i]] += dp[ignore][i][j][k];             }             dp[ignore][i + 1][j][k] += dp[ignore][i][j][k];           }         }       }     }     double res = 0;     for (int cnt = 1; cnt < n; ++cnt) {       long long pats = 0;       for (int last = 0; last < n; ++last) {         for (int w = max(0, p - a[last] + 1); w <= p; ++w) {           pats += dp[last][n][cnt][w];         }       }       res += cnt * (double)pats * fact[cnt] * fact[n - cnt - 1] / fact[n];     }     printf( %.9f n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     cin.sync_with_stdio(false);     long long int n;     cin >> n;     vector<long long int> a(n), start(n), end(n);     for (long long int i = 0; i < n; i++) {       cin >> a[i];       start[i] = i;       end[i] = i + 1;     }     for (long long int i = 0; i < n; i++) {       while (start[i] > 0 && (a[i] | a[start[i] - 1]) == a[i]) {         start[i] = start[start[i] - 1];       }     }     for (long long int i = n - 1; i >= 0; i--) {       while (end[i] < n && (a[i] | a[end[i]]) == a[i]) {         end[i] = end[end[i]];       }     }     map<long long int, long long int> last;     long long int good = (n * (n - 1)) / 2;     for (long long int i = 0; i < n; i++) {       if (last.count(a[i]) && last[a[i]] >= start[i]) {         good -= (i - last[a[i]]) * (end[i] - i) - 1;         last[a[i]] = i;         continue;       }       last[a[i]] = i;       good -= (i - start[i] + 1) * (end[i] - i) - 1;     }     cout << good << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int T, a, b, c, d, k;   int main() {     cin >> T;     for (; T--;) {       cin >> a >> b >> c >> d >> k;       int sol1 = 0;       int sol2 = 0;       if (a % c == 0)         sol1 = a / c;       else         sol1 = a / c + 1;       if (b % d == 0)         sol2 = b / d;       else         sol2 = b / d + 1;       if (sol1 + sol2 <= k)         cout << sol1 <<     << sol2 <<   n ;       else         cout << -1 <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1005;   const int mod1 = 998244353;   const int mod2 = 1e9 + 7;   const int b1 = 337;   const int b2 = 421;   const int inf = 2147483647;   struct Pair {     int x[2] = {};     bool operator<(const Pair a) const {       return x[0] < a.x[0] || x[0] == a.x[0] && x[1] < a.x[1];     }   };   struct BitSet {     unsigned long long b[16] = {};     inline void reset() { memset(b, 0, sizeof(b)); }     inline void set(int x) { b[x / 64] |= (1ull << (x % 64)); }     inline void operator^=(const BitSet &a) {       for (int i = 0; i < 16; ++i) b[i] ^= a.b[i];     }     inline Pair getHashVal() {       Pair ans;       for (int i = 0; i < 16; ++i) {         ans.x[0] = (1ll * ans.x[0] * b1 % mod1 + b[i] % mod1) % mod1;         ans.x[1] = (1ll * ans.x[1] * b2 % mod2 + b[i] % mod2) % mod2;       }       return ans;     }   };   int n, s, d;   BitSet bs[31], sta[1 << 20], cur;   int cnt[1 << 20], m;   map<Pair, int> mp;   void init() {     m = min(s, 20);     for (int i = 0; i < m; ++i) {       cnt[1 << i] = 1;       sta[1 << i] = bs[i];     }     for (int i = 0; i < (1 << m); ++i) {       if (i != (i & -i)) {         cnt[i] = cnt[i - (i & -i)] + 1;         sta[i] = sta[i - (i & -i)];         sta[i] ^= sta[i & -i];       }       Pair x = sta[i].getHashVal();       if (!mp.count(x) || mp[x] > cnt[i]) {         mp[x] = cnt[i];       }     }     for (int i = 0; i < (s - m); ++i) {       sta[1 << i] = bs[i + m];     }     for (int i = 1; i < (1 << (s - m)); ++i) {       if (i == (i & -i)) continue;       sta[i] = sta[i - (i & -i)];       sta[i] ^= sta[i & -i];     }   }   int getans() {     BitSet now;     int ans = inf;     for (int i = 0; i < (1 << (s - m)); ++i) {       if (cnt[i] >= ans) continue;       now = cur, now ^= sta[i];       Pair x = now.getHashVal();       if (mp.count(x) && mp[x] + cnt[i] < ans) {         ans = mp[x] + cnt[i];       }     }     return ans == inf ? -1 : ans;   }   int main() {     scanf( %d%d%d , &n, &s, &d);     for (int i = 0; i < s; ++i) {       int c;       scanf( %d , &c);       for (int j = 0; j < c; ++j) {         int u;         scanf( %d , &u);         u--;         bs[i].set(u);       }     }     init();     vector<int> ans;     for (int i = 0; i < d; ++i) {       int t;       scanf( %d , &t);       cur.reset();       while (t--) {         int u;         scanf( %d , &u);         u--;         cur.set(u);       }       ans.push_back(getans());     }     for (int i = 0; i < ans.size(); ++i) printf( %d n , ans[i]);     puts(  );   }
#include <bits/stdc++.h>   using namespace std;   const int N = 400010;   const int P = 10000007;   int m, n;   char str[N];   char ans[N];   int l[N], r[N];   int p[N];   bool ok(int i, int m) {     if (++i < m) return 0;     return (r[i] - r[i - m]) == ((l[i] - l[i - m] * p[m]) * p[i - m]);   }   int dfs(int i, int ismax) {     if (i == n) {       puts(ans);       return 1;     }     for (ans[i] = ismax ? str[i] :  a ; ans[i] <=  z ; ans[i]++) {       l[i + 1] = l[i] * P + ans[i];       r[i + 1] = r[i] + ans[i] * p[i];       if (!ok(i, m) && !ok(i, m + 1) && dfs(i + 1, ans[i] == str[i] && ismax))         return 1;     }     return 0;   }   int main() {     scanf( %d%s , &m, str);     n = strlen(str);     int i = n - 1;     for (; i >= 0 && str[i] ==  z ; i--) str[i] =  a ;     if (i < 0) {       puts( Impossible );       return 0;     }     str[i]++;     p[0] = 1;     for (int i = 1; i <= n; i++) p[i] = p[i - 1] * P;     if (!dfs(0, 1)) puts( Impossible );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   enum STATE { IN, OUT, BOUNDRY };   const double PI = acos(-1.0);   void fast_in_out() {     std::ios_base::sync_with_stdio(NULL);     cin.tie(NULL);     cout.tie(NULL);   }   int dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};   int dy[] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};   int lx[] = {2, 2, -1, 1, -2, -2, -1, 1};   int ly[] = {-1, 1, 2, 2, 1, -1, -2, -2};   const int N = 19, M = 200 + 10, mod = 998244353;   const double eps = 1e-9;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   int n;   double ar[N][N];   double dp[N][(1 << N)];   int main() {     fast_in_out();     cout << fixed << setprecision(9);     cin >> n;     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) cin >> ar[i][j];       dp[i][1 << i] = 1;     }     for (int mask = 3; mask < (1 << n); mask++) {       int cnt = __builtin_popcount(mask);       if (cnt == 1) continue;       cnt = cnt * (cnt - 1) / 2;       double lose[N]{0};       for (int i = 0; i < n; i++) {         for (int j = i + 1; j < n && (mask & (1 << i)); j++) {           if (mask & (1 << j)) {             lose[j] += ar[i][j] / cnt;             lose[i] += ar[j][i] / cnt;           }         }       }       for (int i = 0; i < n; i++) {         for (int j = i + 1; j < n && (mask & (1 << i)); j++) {           if (mask & (1 << j)) {             dp[j][mask] += dp[j][mask - (1 << i)] * lose[i];             dp[i][mask] += dp[i][mask - (1 << j)] * lose[j];           }         }       }     }     for (int i = 0; i < n; i++) cout << dp[i][(1 << n) - 1] <<    ;     return 0;   }
#include <bits/stdc++.h>   const int MOD = 1000000007;   int64_t dp[2001][2001];   int main() {     int n, m, k;     std::cin >> n >> m >> k;     dp[0][0] = 1;     for (int i = 1; i <= 2000; ++i) {       dp[i][0] = 1;       for (int j = 1; j < i; ++j) {         dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD;       }       dp[i][i] = 1;     }     std::cout << (dp[n - 1][2 * k] * dp[m - 1][2 * k]) % MOD <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct __timestamper {};   vector<vector<int>> g;   vector<vector<int>> id;   vector<int> used;   vector<int> ts;   void dfs(int v, int x) {     if (used[v]) return;     used[v] = 1;     for (int i = 0; i < (int)g[v].size(); i++) {       if (id[v][i] < x) {         dfs(g[v][i], x);       }     }     ts.push_back(v);   }   bool check(int x) {     ts.clear();     used = vector<int>(g.size());     for (int i = 0; i < (int)g.size(); i++) {       dfs(i, x);     }     reverse(ts.begin(), ts.end());     for (int i = 0; i + 1 < (int)ts.size(); i++) {       int v = ts[i];       bool ok = false;       for (int j = 0; j < (int)g[v].size(); j++)         if (g[v][j] == ts[i + 1] && id[v][j] < x) {           ok = true;         }       if (!ok) return false;     }     return true;   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     g = vector<vector<int>>(n);     id = vector<vector<int>>(n);     for (int i = 0; i < m; i++) {       int a, b;       scanf( %d%d , &a, &b);       --a, --b;       g[a].push_back(b);       id[a].push_back(i);     }     if (!check(m)) {       printf( -1 n );       return 0;     }     int l = 0;     int r = m;     while (r - l > 1) {       int mid = (l + r) / 2;       if (check(mid))         r = mid;       else         l = mid;     }     printf( %d n , r);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 5;   char str1[maxn], str2[maxn];   int a[maxn], len1, len2;   bool book[maxn];   bool judge(int x) {     for (int i = 1; i <= x; i++) book[a[i] - 1] = 1;     int j = 0, cnt = 0;     for (int i = 0; i < len2; i++) {       for (; j < len1; j++) {         if (str2[i] == str1[j] && !book[j]) {           j++;           cnt++;           break;         }       }     }     return cnt == len2;   }   int main(void) {     while (~scanf(  %s %s , str1, str2)) {       len1 = strlen(str1);       len2 = strlen(str2);       for (int i = 1; i <= len1; i++) scanf( %d , &a[i]);       int l = 0, r = len1, ans;       while (l <= r) {         memset(book, 0, sizeof(book));         int mid = (l + r) / 2;         if (judge(mid))           l = mid + 1, ans = mid;         else           r = mid - 1;       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     scanf( %d , &q);     while (q--) {       int l, r, d;       scanf( %d %d %d , &l, &r, &d);       if (d < l)         printf( %d n , d);       else if (d > r)         printf( %d n , d);       else {         int res = r - d;         res = res % d;         printf( %d n , r + d - res);       }     }   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> mp;   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       int a;       scanf( %d , &a);       mp[a]++;     }     int res = n;     while (!mp.empty()) {       for (auto itr = mp.begin(); itr != mp.end();) {         if (--itr->second == 0)           mp.erase(itr++);         else           itr++;       }       res--;     }     printf( %d n , res);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 200001;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, k;     cin >> n >> k;     string s;     cin >> s;     int ans = 2e9;     vector<int> can;     vector<string> cand;     for (int i = 0; i < 10; i++) {       priority_queue<int> pq;       int t = 0;       for (int j = 0; j < s.length(); j++) {         int alpha = s[j] -  0 ;         int cost = abs(alpha - i);         pq.push(-cost);       }       for (int j = 0; j < k; j++) {         int cst = -pq.top();         pq.pop();         t += cst;       }       if (ans > t) {         can.clear();         can.push_back(i);         ans = t;       } else if (ans == t) {         can.push_back(i);       }     }     for (int d = 0; d < can.size(); d++) {       string temp = s;       int num = can[d];       int need = k;       vector<pair<int, int> > big;       vector<pair<int, int> > small;       vector<pair<int, int> > ord;       int cnt[10];       memset(cnt, 0, sizeof(cnt));       priority_queue<int> pq;       for (int j = 0; j < s.size(); j++) {         int cst = abs(num - (s[j] -  0 ));         if (cst) pq.push(-cst);         if (s[j] -  0  == num) need--;         if (s[j] -  0  > num) big.push_back({s[j] -  0 , j});         if (s[j] -  0  < num) small.push_back({s[j] -  0 , j});       }       reverse(small.begin(), small.end());       for (int i = 0; i < big.size(); i++) {         int cost = abs(big[i].first - num);         ord.push_back({cost, big[i].second});       }       for (int i = 0; i < small.size(); i++) {         int cost = abs(small[i].first - num);         ord.push_back({cost, small[i].second});       }       if (need <= 0) {         cout << 0 << endl << s;         exit(0);       }       for (int i = 0; i < need; i++) {         int cst = -pq.top();         pq.pop();         cnt[cst]++;       }       for (int i = 0; i < ord.size(); i++) {         int cst = ord[i].first;         int idx = ord[i].second;         if (cnt[cst]) {           cnt[cst]--;           temp[idx] = (char)(num +  0 );         }       }       cand.push_back(temp);     }     cout << ans <<   n ;     sort(cand.begin(), cand.end());     cout << cand[0];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> aa;   char s[100005];   int n;   void doit() {     scanf( %s , s + 1);     n = strlen(s + 1);     int last = 0, ans = 0;     for (int i = 1; i <= n; i++)       if (s[i] ==  1 ) {         if (last > 0) ans += i - last - 1;         last = i;       }     printf( %d n , ans);   }   int main() {     int cas;     scanf( %d , &cas);     while (cas--) doit();   }
#include <bits/stdc++.h>   using namespace std;   inline long long labs(long long a) { return a < 0 ? (-a) : a; }   template <typename T>   inline T sqr(T x) {     return x * x;   }   struct Node {     int deep;     int p;     vector<int> to;     int tin, tout;   };   const int MAXN = 100005;   vector<pair<int, int> > mas[MAXN];   vector<Node> g;   int n;   int t = 0;   void DFS(int i, int deep = 0) {     g[i].deep = deep;     g[i].tin = t++;     mas[deep].push_back(make_pair(g[i].tin, i));     for (int(j) = 0; (j) < (g[i].to.size()); (j)++) {       int to = g[i].to[j];       DFS(to, deep + 1);     }     g[i].tout = t++;   }   int main() {     cin >> n;     n++;     g.resize(n);     for (int(i) = 0; (i) < (n - 1); (i)++) {       cin >> g[i + 1].p;       g[g[i + 1].p].to.push_back(i + 1);     }     DFS(0);     int m;     cin >> m;     for (int(qqq) = 0; (qqq) < (m); (qqq)++) {       int i, ppp;       cin >> i >> ppp;       int pd = g[i].deep - ppp;       if (pd <= 0) {         cout << 0 <<    ;         continue;       }       int pit = upper_bound((mas[pd]).begin(), (mas[pd]).end(),                             make_pair(g[i].tin, 0)) -                 mas[pd].begin() - 1;       int p = mas[pd][pit].second;       int ubl = upper_bound((mas[g[i].deep]).begin(), (mas[g[i].deep]).end(),                             make_pair(g[p].tin, 0)) -                 mas[g[i].deep].begin();       int ubr = upper_bound((mas[g[i].deep]).begin(), (mas[g[i].deep]).end(),                             make_pair(g[p].tout, 0)) -                 mas[g[i].deep].begin() - 1;       cout << ubr - ubl <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1005];   int b[2005];   int main() {     int p, q, l, r;     cin >> p >> q >> l >> r;     while (p--) {       int val1, val2;       cin >> val1 >> val2;       for (int i = val1; i <= val2; i++) a[i] = 1;     }     while (q--) {       int val1, val2;       cin >> val1 >> val2;       for (int i = val1; i <= val2; i++) b[i + 1000] = 1;     }     int count = 0;     for (int t = l; t <= r; t++)       for (int i = 0; i <= 1000; i++)         if (a[i] && b[i + 1000 - t]) {           count++;           break;         }     cout << count;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m = 100000, a, b, c, cnt;   struct Point {     int x, y;     Point() {}     Point(int a, int b) { x = a, y = b; }     bool operator==(Point b) const { return x == b.x && y == b.y; }     Point operator+(Point b) { return Point(x + b.x, y + b.y); }     Point operator-(Point b) { return Point(x - b.x, y - b.y); }   } A[5000005], Q[5000005], P[5000005];   long long Cross(Point a, Point b) {     return (long long)a.x * b.y - (long long)a.y * b.x;   }   long double Length(Point p) { return sqrt(1.0 * p.x * p.x + 1.0 * p.y * p.y); }   void Add(int x, int y) { A[++cnt] = Point(x, y); }   bool cmp(Point a, Point b) { return a.x == b.x ? a.y < b.y : a.x < b.x; }   long double Abs(long double x) { return x > 0 ? x : -x; }   long double Getr(Point a, Point b, Point c) {     long double p = Length(a - b), q = Length(b - c), r = Length(c - a);     long double s = Abs(2.0 * (long double)Cross(b - a, c - a));     if (s <= 1e-10) return 0;     return p * q * r / s;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d%d , &a, &b, &c);       if (a - c >= 0)         Add(a - c, b);       else {         Add(0, min(m, b + c - a));         Add(0, max(0, b - c + a));       }       if (a + c <= m)         Add(a + c, b);       else {         Add(m, min(m, b + c - (m - a)));         Add(m, max(0, b - c + (m - a)));       }       if (b - c >= 0)         Add(a, b - c);       else {         Add(min(m, a + c - b), 0);         Add(max(0, a - c + b), 0);       }       if (b + c <= m)         Add(a, b + c);       else {         Add(min(m, a + c - (m - b)), m);         Add(max(0, a - c + (m - b)), m);       }     }     sort(A + 1, A + cnt + 1, cmp);     cnt = unique(A + 1, A + cnt + 1) - A - 1;     int lst = 0;     for (int i = 1; i <= cnt; i++) {       while (lst > 1 && Cross(A[i] - Q[lst], Q[lst] - Q[lst - 1]) >= 0) lst--;       Q[++lst] = A[i];     }     int fir = 0;     for (int i = cnt; i >= 1; i--) {       while (fir > 1 && Cross(A[i] - P[fir], P[fir] - P[fir - 1]) >= 0) fir--;       P[++fir] = A[i];     }     for (int i = 2; i < fir; i++) Q[++lst] = P[i];     long double mx = Getr(Q[lst], Q[1], Q[2]), tmp;     int a1 = lst, a2 = 1, a3 = 2;     if ((tmp = Getr(Q[lst - 1], Q[lst], Q[1])) > mx)       a1 = lst - 1, a2 = lst, a3 = 1, mx = tmp;     for (int i = 3; i <= lst; i++)       if ((tmp = Getr(Q[i - 2], Q[i - 1], Q[i])) > mx) a3 = i, mx = tmp;     if (a3 >= 3) a1 = a3 - 2, a2 = a3 - 1;     printf( %d %d n%d %d n%d %d n , Q[a1].x, Q[a1].y, Q[a2].x, Q[a2].y, Q[a3].x,            Q[a3].y);   }