malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n;     cin >> n;     long long int h1[n + 1], h[n + 1];     for (int i = 1; i <= n; i++) cin >> h[i];     for (int i = 1; i <= n; i++) cin >> h1[i];     long long int dp[n + 1][2];     dp[1][0] = h[1];     dp[1][1] = h1[1];     dp[0][0] = 0;     dp[0][1] = 0;     for (int i = 2; i <= n; i++) {       long long int q = max(dp[i - 1][1], dp[i - 2][0]);       q = max(q, dp[i - 2][1]);       dp[i][0] = q + h[i];       q = max(dp[i - 1][0], dp[i - 2][0]);       q = max(q, dp[i - 2][1]);       dp[i][1] = q + h1[i];     }     long long int q = max(dp[n][0], dp[n][1]);     q = max(q, dp[n - 1][0]);     q = max(q, dp[n - 1][1]);     cout << q;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = int64_t;   using ull = uint64_t;   using ld = long double;   using uint = uint32_t;   const double EPS = 1e-8;   const int INF = 0x3F3F3F3F;   const ll LINF = 4611686018427387903;   const int MOD = 1e9 + 7;   const int mod = 1e6 + 3;   vector<vector<ll>> mat(11, vector<ll>(12));   ll mpow(ll a, int b) {     ll res = 1;     for (; b; b >>= 1, a = a * a % mod)       if (b & 1) res = res * a % mod;     return res;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(NULL);     for (int i = 0; i < 11; i++) {       cout <<  ?   << i + 1 << endl;       int w;       cin >> w;       for (int j = 0; j <= 10; j++) mat[i][j] = mpow(i + 1, j);       mat[i][11] = w;     }     for (int i = 0; i < 11; i++) {       for (int j = i; j < 11; j++) {         if (mat[j][i]) {           swap(mat[j], mat[i]);           break;         }       }       for (int j = 0; j < 11; j++) {         if (j == i || !mat[j][i]) continue;         ll c = mat[i][i] * mpow(mat[j][i], mod - 2) % mod;         for (int k = 0; k < 12; k++) mat[j][k] = mat[j][k] * c % mod;         for (int k = 0; k < 12; k++)           mat[j][k] = (mat[j][k] - mat[i][k] + mod) % mod;       }     }     vector<ll> xx(11);     for (int i = 0; i < 11; i++)       xx[i] = mat[i][11] * mpow(mat[i][i], mod - 2) % mod;     for (int i = 0; i < mod; i++) {       ll res = 0;       for (int j = 0; j < 11; j++) {         res = (res + xx[j] * mpow(i, j)) % mod;       }       if (res == 0) {         cout <<  !   << i <<   n ;         return 0;       }     }     cout <<  !   << -1 <<   n ;   }
#include <bits/stdc++.h>   char chars[200005];   int main() {     int n;     scanf( %d , &n);     scanf( %s , chars);     int sum = 0;     for (int i = 0; i < n; i++) {       if (chars[i] ==  < ) {         sum++;       } else {         break;       }     }     for (int i = n - 1; i >= 0 && sum < n; i--) {       if (chars[i] ==  > ) {         sum++;       } else {         break;       }     }     printf( %d n , sum);   }
#include <bits/stdc++.h>   using namespace std;   int q;   char dirs[100000];   int l, r, u, d;   int main() {     cin >> q;     for (int i = 0; i < q + 1; ++i) {       char c;       int ind = 0;       l = r = u = d = 0;       while ((c = getchar()) !=   n ) {         dirs[ind] = c;         ++ind;       }       for (int j = 0; j < ind; ++j) {         if (dirs[j] ==  L )           ++l;         else if (dirs[j] ==  R )           ++r;         else if (dirs[j] ==  U )           ++u;         else           ++d;       }       int min_lr = (l < r) ? l : r;       int min_ud = (u < d) ? u : d;       if (i != 0) {         if (min_lr == 0 && min_ud != 0) {           min_ud = 1;         }         if (min_ud == 0 && min_lr != 0) {           min_lr = 1;         }         cout << (2 * min_lr + 2 * min_ud) << endl;         for (int k = 0; k < min_lr; ++k) {           cout <<  L ;         }         for (int k = 0; k < min_ud; ++k) {           cout <<  U ;         }         for (int k = 0; k < min_lr; ++k) {           cout <<  R ;         }         for (int k = 0; k < min_ud; ++k) {           cout <<  D ;         }         cout << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     while (cin >> n >> m) {       int str[550][550], cnt[550], ans[550];       memset(str, 0, sizeof(str));       memset(cnt, 0, sizeof(cnt));       memset(ans, 0, sizeof(ans));       for (int i = 0; i < m; i++) {         int u, v;         cin >> u >> v;         str[u][v] = str[v][u] = 1;         cnt[u]++;         cnt[v]++;       }       for (int i = 1; i <= n; i++)         if (cnt[i] == n - 1) ans[i] = 1;       for (int i = 1; i <= n; i++)         if (ans[i] == 0)           for (int j = i + 1; j <= n; j++)             if (str[i][j] == 0) ans[j] = 2;       bool flag = 1;       for (int i = 1; i <= n; i++) {         for (int j = i + 1; j <= n; j++) {           if ((abs(ans[i] - ans[j]) == 2 && str[i][j]) ||               (abs(ans[i] - ans[j]) < 2 && !str[i][j])) {             cout <<  No  << endl;             flag = false;             break;           }         }         if (!flag) break;       }       if (!flag) continue;       cout <<  Yes  << endl;       for (int i = 1; i <= n; i++) printf( %c , ans[i] +  a );       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> f(21);   long long fact(long long x) { return f[x]; }   long long solve(long long k) {     vector<long long> cnt(21), less(21);     long long d = 1, den = 1, num = 1, den1 = 1, num1 = 0;     while (k > 0) {       d += 1;       cnt[k % d] += 1;       k /= d;     }     less[d + 1] = d - 1;     den = fact(cnt[0]) * fact(cnt[1]);     for (long long i = d; i > 1LL; i--) {       den *= fact(cnt[i]);       less[i] = less[i + 1] - cnt[i];       num *= (less[i] - (i - 2LL));       if (num % den == 0) {         num /= den;         den = 1;       }     }     if (cnt[0] > 0) {       num1 = 1;       cnt[0]--;       less[d] -= 1;       den1 = fact(cnt[0]) * fact(cnt[1]);       for (long long i = d - 1; i > 1; i--) {         den1 *= fact(cnt[i]);         less[i] = less[i + 1] - cnt[i];         num1 *= (less[i] - (i - 2LL));         if (num1 % den1 == 0) {           num1 /= den1;           den1 = 1;         }       }     }     long long res = (num / den) - (num1 / den1) - 1LL;     return res;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     f[0] = f[1] = 1;     for (long long i = 2; i < 21; i++) f[i] = i * f[i - 1];     long long t;     cin >> t;     while (t--) {       long long k;       cin >> k;       cout << solve(k) <<   n ;     }   }
// #pragma GCC optimize( Ofast )   #pragma GCC target ( sse4 )   #include <iostream>   #include <cstring>   #include <algorithm>   #include <cmath>   #include <map>   #include <queue>   using namespace std;      const int N = 2e5 + 10, M = N * 2, INT = 0x3f3f3f3f, mod = 1e9 + 7;      //#define int long long   #define pi 3.1415926   #define x first   #define y second   typedef long long ll;   typedef pair<int,int> pii;    //ios::sync_with_stdio(false);   ll gcd(ll a,ll b) {return b ? gcd(b, a % b) : a;}   // int gcd(int a,int b) {return b ? gcd(b, a % b) : a;}   ll qmi(ll a,ll b) {ll res = 1 % mod;while (b){if (b & 1) res = (res * a) % mod;a = a * a % mod;b >>= 1;}return res;}      int t, n, m, k;   int x;   deque<int> q1, q2, s1, s2;   int s[M];      int get(deque<int> &a,deque<int> &b)   {    if (a.size() == 0 || b.size() == 0) return 0;    s[b.size()] = 0;    // for (auto x : a) printf( %d  , x);    //  puts(  );    // for (auto x : b) printf( %d  , x);    //  puts(  );    for (int i = b.size() - 1, j = a.size() - 1; i >= 0; i -- )    {     while (a[j] > b[i] && j > 0) j --;     if (a[j] == b[i]) s[i] = 1;     else s[i] = 0;     s[i] += s[i + 1];    }    // for (int i = 0; i < b.size(); i ++ ) printf( %d  , s[i]);    //  puts(  );    int ans = 0;    for (int i = 0; i < b.size(); i ++ )    {     int p = upper_bound(a.begin(), a.end(), b[i]) - a.begin();     int l = lower_bound(b.begin(), b.end(), b[i] - p + 1) - b.begin();     ans = max(ans, s[i + 1] + i - l + 1);     // printf( b_i=%d p = %d  b_i-p=%d l = %d n , b[i], p, b[i] - p + 1, l);    }    // cout << ans <<  ------------------------- ;    return ans;   }      void solve()   {    q1.clear(), q2.clear(), s1.clear(), s2.clear();    cin >> n >> m;    for (int i = 1; i <= n; i ++ )    {     scanf( %d , &x);     if (x > 0)     {      q1.push_back(x);     }     else q2.push_front(-x);    }    for (int i = 1; i <= m; i ++ )    {     scanf( %d , &x);     if (x > 0)     {      s1.push_back(x);     }     else s2.push_front(-x);    }       int ans = get(q1, s1) + get(q2, s2);    // puts(  );    printf( %d n , ans);   }      signed main()   {       cin >> t;while (t -- )        solve();   }
#include <bits/stdc++.h>   using namespace std;   const int N = 400 + 5;   const int INF = 1e9;   int R, n, m;   pair<int, int> H[N], T[N];   int vis[N][N];   vector<pair<int, int> > adj[N][N];   queue<pair<int, int> > Q;   int dis[N][N];   int bfs(int h, int t) {     memset(dis, 0x3c, sizeof dis);     dis[h][t] = 0;     Q.push(make_pair(h, t));     while (Q.size()) {       int x = Q.front().first, y = Q.front().second;       Q.pop();       if (x + y == 0) return dis[x][y];       for (auto it : adj[x][y]) {         if (dis[x][y] + 1 < dis[it.first][it.second]) {           dis[it.first][it.second] = dis[x][y] + 1;           Q.push(it);         }       }     }     return INF;   }   bool isCycle(int h, int t) {     vis[h][t] = 1;     for (auto it : adj[h][t]) {       int x = it.first, y = it.second;       if (vis[x][y] == 1) return 1;       if (vis[x][y] == 2) continue;       if (isCycle(x, y)) return 1;     }     vis[h][t] = 2;     return 0;   }   int dp[N][N];   int fun(int x, int y) {     int &memo = dp[x][y];     if (memo != -1) return memo;     if (x + y > R) return memo = 0;     int ans = 0;     for (auto it : adj[x][y]) {       ans = max(ans, fun(it.first, it.second));     }     return memo = ans + 1;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int h, t;     cin >> h >> t >> R;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> H[i].first >> H[i].second;     }     cin >> m;     for (int i = 1; i <= m; i++) {       cin >> T[i].first >> T[i].second;     }     for (int i = 0; i < N; i++) {       for (int j = 0; j < N; j++) {         if (i + j == 0)           ;         else if (i + j > R)           ;         else {           for (int k = 1; k <= n and k <= i; k++) {             adj[i][j].push_back(make_pair(i - k + H[k].first, j + H[k].second));           }           for (int k = 1; k <= m and k <= j; k++) {             adj[i][j].push_back(make_pair(i + T[k].first, j - k + T[k].second));           }         }       }     }     int ans = bfs(h, t);     if (ans != INF) {       cout <<  Ivan n ;       cout << ans <<   n ;       exit(0);     }     if (isCycle(h, t)) {       cout <<  Draw n ;       exit(0);     }     memset(dp, -1, sizeof dp);     cout <<  Zmey n ;     cout << fun(h, t) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     bool o00, o01, o10, o11;     a = b = c = 0;     string s;     cin >> s;     string::iterator its;     its = s.begin();     for (; its != s.end(); ++its) {       if (*its ==  1 )         ++a;       else if (*its ==  0 )         ++b;       else if (*its ==  ? )         ++c;     }     o00 = (a < b + c);     o11 = (a + c > b + 1);     --its;     o01 = o10 = false;     int x1, x2;     x1 = (b + c - a + (a + b + c) % 2) / 2;     x2 = c - x1;     if (x1 >= 0 && x1 <= c) {       if (*its ==  0  || (*its ==  ?  && x2)) o10 = true;       if (*its ==  1  || (*its ==  ?  && x1)) o01 = true;     }     if (o00) cout <<  00 n ;     if (o01) cout <<  01 n ;     if (o10) cout <<  10 n ;     if (o11) cout <<  11 n ;     return 0;   }
#include <bits/stdc++.h>   const int maxn = 10000050;   using namespace std;   char a[1005][6];   void solve() {     memset(a, 0, sizeof(a));     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     int flag = 0;     for (int i = 0; i < n; i++) {       if (a[i][0] ==  O  && a[i][1] ==  O ) {         a[i][0] =  + , a[i][1] =  + ;         flag = 1;         break;       }       if (a[i][3] ==  O  && a[i][4] ==  O ) {         a[i][3] =  + , a[i][4] =  + ;         flag = 1;         break;       }     }     if (flag) {       cout <<  YES  << endl;       for (int i = 0; i < n; i++) cout << a[i] << endl;     } else       cout <<  NO  << endl;   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   bool isIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4,                    int y4) {     double t1 = (y3 - y4) * (x1 - x3) + (x4 - x3) * (y1 - y3);     double t2 = (x4 - x3) * (y1 - y2) - (x1 - x2) * (y4 - y3);     double r1 = t1 / t2;     double f1 = (y1 - y2) * (x1 - x3) + (x2 - x1) * (y1 - y3);     double f2 = (x4 - x3) * (y1 - y2) - (x1 - x2) * (y4 - y3);     double r2 = f1 / f2;     if (r1 >= 0 && r1 <= 1 && r2 >= 0 && r2 <= 1) {       return true;     }     return false;   }   double isInside(int x0, int y0, int x1, int y1, int x2, int y2) {     double num = (y2 - y1) * x0 - (x2 - x1) * y0 + x2 * y1 - y2 * x1;     num = abs(num);     double den = sqrt(pow(y2 - y1, 2) + pow(x2 - x1, 2));     return num / den;   }   int main() {     int first[4][2];     int second[4][2];     int minX = 200;     int maxY = -200;     int minY = 200;     int maxX = -200;     int min1X = 200;     int max1X = -200;     int min2Y = 200;     int max2Y = -200;     for (int i = 0; i < 4; i++) {       for (int j = 0; j < 2; j++) {         cin >> first[i][j];         if (j == 0) {           minX = min(minX, first[i][j]);           maxX = max(maxX, first[i][j]);         } else {           minY = min(minY, first[i][j]);           maxY = max(maxY, first[i][j]);         }       }     }     for (int i = 0; i < 4; i++) {       for (int j = 0; j < 2; j++) {         cin >> second[i][j];         if (j == 0) {           min1X = min(min1X, second[i][j]);           max1X = max(max1X, second[i][j]);         } else {           min2Y = min(min2Y, second[i][j]);           max2Y = max(max2Y, second[i][j]);         }       }     }     for (int i = 0; i < 4; i++) {       if (second[i][0] >= minX && second[i][0] <= maxX && second[i][1] >= minY &&           second[i][1] <= maxY) {         cout <<  YES ;         return 0;       }       if (isInside(first[i][0], first[i][1], second[0][0], second[0][1],                    second[2][0], second[2][1]) +               isInside(first[i][0], first[i][1], second[1][0], second[1][1],                        second[3][0], second[3][1]) <=           (max2Y - min2Y) / 2) {         cout <<  YES ;         return 0;       }     }     for (int i = 0; i < 4; i++) {       int j = (i + 1) % 4;       for (int ii = 0; ii < 4; ii++) {         int jj = (ii + 1) % 4;         if (isIntersect(first[i][0], first[i][1], first[j][0], first[j][1],                         second[ii][0], second[ii][1], second[jj][0],                         second[jj][1])) {           cout <<  YES ;           return 0;         }       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int NMAX = 1e5;   int n, x, k;   int a[NMAX + 2];   long long ans;   int ndiv(int f, int l) { return l / x - (f - 1) / x; }   pair<int, int> bs(int arg) {     pair<int, int> last;     int st = arg, dr = n;     last.first = last.second = -1;     while (st <= dr) {       int med = (st + dr) / 2;       if (ndiv(a[arg], a[med]) >= k) {         dr = med - 1;         last.first = med;       } else         st = med + 1;     }     st = arg, dr = n;     while (st <= dr) {       int med = (st + dr) / 2;       if (ndiv(a[arg], a[med]) > k)         dr = med - 1;       else {         st = med + 1;         last.second = med;       }     }     return last;   }   int main() {     cin >> n >> x >> k;     for (int i = 1; i <= n; i++) cin >> a[i];     sort(a + 1, a + n + 1);     int nr;     for (int i = 1; i <= n; i++) {       if (a[i] != a[i - 1]) {         pair<int, int> pos = bs(i);         if (pos.first != -1 && pos.second != -1)           nr = pos.second - pos.first + 1;         else           nr = 0;       }       ans += 1LL * nr;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[500010], x, sz;   long long ans;   int main() {     scanf( %d , &n);     for (int step = 1; step <= n; step++) {       scanf( %d , &x);       while (a[sz - 1] >= a[sz] && a[sz] <= x && sz >= 2) {         ans += min(a[sz - 1], x);         sz--;       }       a[++sz] = x;     }     sort(a + 1, a + sz + 1);     for (int i = 1; i <= sz - 2; i++) ans += a[i];     printf( %I64d , ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, x, a, b, in[100], on[100], i = 0, r, y;     cin >> n >> x;     int t = n;     while (t--) {       cin >> a >> b;       r = min(a, b);       y = max(a, b);       in[i] = r;       on[i] = y;       i++;     }     sort(in, in + n);     sort(on, on + n);     if (in[n - 1] < on[0]) {       if (x <= in[n - 1])         cout << in[n - 1] - x;       else if (x >= on[0])         cout << x - on[0];       else if (x > in[n - 1] && x < on[0])         cout << 0;     } else if (in[n - 1] == on[0])       cout << abs(x - on[0]);     else       cout << -1;   }
#include <bits/stdc++.h>   struct Mat {     double a[253][253];   } A[53];   int Sta[25][25], d[25], n, m, a, b, tot;   double p[25], tp[253][253];   std::vector<int> v[25];   void sq(int x, int y) {     register int i, ii, iii;     for (i = 0; i < tot; i++)       for (ii = 0; ii < tot; ii++)         for (iii = 0; iii < tot; iii++)           tp[i][iii] += A[y].a[i][ii] * A[y].a[ii][iii];     for (i = 0; i < tot; i++)       for (ii = 0; ii < tot; ii++) A[x].a[i][ii] = tp[i][ii], tp[i][ii] = 0;   }   int main() {     scanf( %d%d%d%d , &n, &m, &a, &b);     register int i, ii;     for (i = 1; i <= n; i++)       for (ii = i; ii <= n; ii++) Sta[i][ii] = Sta[ii][i] = tot++;     for (i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y), d[x]++, d[y]++;       v[x].push_back(y), v[y].push_back(x);     }     for (i = 1; i <= n; i++)       scanf( %lf , p + i), A[0].a[Sta[i][i]][Sta[i][i]] = 1;     for (i = 1; i <= n; i++)       for (ii = i + 1; ii <= n; ii++) {         int Id1 = Sta[i][ii], Id2 = Id1;         double P = p[i], Q = p[ii] * P;         A[0].a[Id1][Id2] += Q;         for (int u : v[ii]) {           Q = (1 - p[ii]) / d[ii] * P, Id2 = Sta[i][u], A[0].a[Id1][Id2] += Q;         }         for (int t : v[i]) {           P = (1 - p[i]) / d[i], Q = p[ii] * P, Id2 = Sta[t][ii],           A[0].a[Id1][Id2] += Q;           for (int u : v[ii]) {             Q = (1 - p[ii]) / d[ii] * P, Id2 = Sta[t][u], A[0].a[Id1][Id2] += Q;           }         }       }     for (i = 1; i <= 50; i++) sq(i, i - 1);     for (i = 1; i <= n; i++) printf( %.12lf  , A[50].a[Sta[a][b]][Sta[i][i]]);     puts(  );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int m, n, k, i, j, t, x;     int c[200];     cin >> n;     int a[n];     for (i = 0; i < n; i++) {       cin >> a[i];       c[i] = a[i];     }     cin >> m;     int b[m];     for (j = 0; j < m; j++) {       cin >> b[j];       c[i + j] = b[j];     }     x = m + n;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         t = 0;         for (k = 0; k < x; k++) {           if (a[i] + b[j] == c[k]) {             t = 1;             break;           }         }         if (t == 0) {           cout << a[i] <<     << b[j] << endl;           goto here;         }       }     }   here:     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     double x, y;     point(double x, double y) : x(x), y(y) {}     point() {}     inline void read() { scanf( %lf%lf , &x, &y); }     inline double len() const { return sqrt(x * x + y * y); }     inline double len2() const { return x * x + y * y; }     inline point rot() { return point(-y, x); }   };   inline int sgn(double a) {     if (a > 1e-7)       return 1;     else if (a < -1e-7)       return -1;     return 0;   }   inline point operator-(const point &a, const point &b) {     return point(a.x - b.x, a.y - b.y);   }   inline point operator+(const point &a, const point &b) {     return point(a.x + b.x, a.y + b.y);   }   inline point operator*(const point &a, double b) {     return point(b * a.x, b * a.y);   }   inline point operator*(double b, const point &a) {     return point(b * a.x, b * a.y);   }   inline double operator*(const point &a, const point &b) {     return a.x * b.x + a.y * b.y;   }   inline double operator%(const point &a, const point &b) {     return a.x * b.y - a.y * b.x;   }   inline bool operator==(const point &a, const point &b) {     return sgn(a.x - b.x) == 0 && sgn(a.y - b.y) == 0;   }   inline bool operator!=(const point &a, const point &b) { return !(a == b); }   inline double dist(const point &a, const point &b) { return (a - b).len(); }   struct line {     point a, b, v;     line() {}     line(const point &a, const point &b) : a(a), b(b), v(b - a) {}   };   double sqr(double a) { return a * a; }   inline double dist(const point &a, const line &b) {     return abs((a - b.a) % b.v) / b.v.len();   }   point operator*(const line &a, const line &b) {     return b.a + (((a.a - b.a) % a.v) / (b.v % a.v)) * b.v;   }   bool operator*(const point &a, const line &b) {     return ((a - b.a) * b.v) * ((a - b.b) * b.v) < -1e-7;   }   bool Solve(point a, point b, point c) {     if (a == b || b == c || c == a) return false;     if (sgn((a - b) % (c - b)) == 0) return false;     line l0((a + b) * 0.5, (a + b) * 0.5 + (b - a).rot()),         l1(1.5 * b - 0.5 * c, 1.5 * b - 0.5 * c + (c - b).rot());     point p[4];     p[0] = l0 * l1;     p[1] = 2 * b - p[0];     p[3] = 2 * a - p[0];     p[2] = 2 * c - p[1];     if (sgn((p[1] - p[0]) % (p[2] - p[1])) == 1) reverse(p, p + 4);     for (int i = 0; i < 4; i++) {       if (sgn((p[(i + 1) % 4] - p[i]) % (p[(i + 2) % 4] - p[(i + 1) % 4])) >= 0)         return false;     }     printf( YES n );     for (int i = 0; i < 4; i++) printf( %.9lf %.9lf  , p[i].x, p[i].y);     printf(  n );     return true;   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       point a, b, c;       a.read(), b.read(), c.read();       if (Solve(a, b, c)) continue;       if (Solve(a, c, b)) continue;       if (Solve(b, a, c)) continue;       if (Solve(b, c, a)) continue;       if (Solve(c, a, b)) continue;       if (Solve(c, b, a)) continue;       printf( NO n n );     }     return 0;   }