malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int const N = 1010;   int const M = 1001000;   int n, m;   struct Graph {     struct edges {       int u, next;       long long c;     } e[M];     int p[N], idx;     void addedge(int u, int v, long long c) {       e[idx].u = v, e[idx].next = p[u], e[idx].c = c, p[u] = idx++;     }     void init() {       idx = 0;       memset(p, (0xff), sizeof p);     }     queue<int> q;     long long dis[N];     bool used[N];     void spfa(int s) {       int t, u;       long long w;       while (!q.empty()) q.pop();       memset(used, 0, sizeof used);       for (int i = 1; i <= (n); ++i) dis[i] = 0x3FFFFFFFFFFFFFFFLL;       dis[s] = 0;       q.push(s);       while (!q.empty()) {         t = q.front();         q.pop();         used[t] = false;         for (int i = p[t]; ~i; i = e[i].next) {           u = e[i].u, w = e[i].c;           if (dis[t] + w < dis[u]) {             dis[u] = dis[t] + w;             if (!used[u]) {               used[u] = true;               q.push(u);             }           }         }       }     }   } g1, g2;   long long ti[N], ci[N];   int main() {     scanf( %d%d , &n, &m);     g1.init();     int s, t;     scanf( %d%d , &s, &t);     for (int i = 0; i < (m); ++i) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       g1.addedge(x, y, z);       g1.addedge(y, x, z);     }     for (int i = 1; i <= (n); ++i) scanf( %I64d %I64d , &ti[i], &ci[i]);     g2.init();     for (int i = 1; i <= (n); ++i) {       g1.spfa(i);       for (int j = 1; j <= (n); ++j)         if (i != j) {           if (g1.dis[j] <= ti[i]) {             g2.addedge(i, j, ci[i]);           }         }     }     g2.spfa(s);     if (g2.dis[t] == 0x3FFFFFFFFFFFFFFFLL)       puts( -1 );     else       printf( %I64d n , g2.dis[t]);     return 0;   }
#include <bits/stdc++.h>   int main() {     int num, i, j, k, p;     double prob[110], temp, tot, high, temp2;     scanf( %d , &num);     i = 0;     while (i < num) {       scanf( %lf , &prob[i]);       i++;     }     i = 0;     while (i < num) {       p = i + 1;       while (p < num) {         if (prob[p] > prob[i]) {           temp2 = prob[p];           prob[p] = prob[i];           prob[i] = temp2;         }         p++;       }       i++;     }     high = 0;     i = 1;     while (i <= num) {       tot = 0;       for (j = 0; j < i; j++) {         temp = prob[j];         for (k = 0; k < i; k++) {           if (j != k) temp *= 1 - prob[k];         }         tot += temp;       }       if (tot > high) high = tot;       i++;     }     printf( %.12f n , high);   }
#include <bits/stdc++.h>   using namespace std;   long long min_val(long long a, long long b) {     if (a <= b)       return a;     else       return b;   }   long long max_val(long long a, long long b) {     if (a >= b)       return a;     else       return b;   }   long long abs(long long a, long long b) {     long long tmp = min_val(a, b);     if (tmp == a) {       return b - a;     } else       return a - b;   }   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int a[n];       for (int i = 0; i < n; i++) {         cin >> a[i];       }       sort(a, a + n, greater<int>());       for (int i = 0; i < n; i++) {         cout << a[i] <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   pair<pair<bool, long double>, string> a[13];   bool comp(pair<pair<bool, long double>, string> a,             pair<pair<bool, long double>, string> b) {     auto t1 = a.first, t2 = b.first;     if (t1.first != t2.first) return t1.first;     if (abs(t1.second - t2.second) <= 1e-6) return false;     return (t1.second < t2.second) ^ t1.first;   }   int main() {     long double x, y, z;     cin >> x >> y >> z;     a[1] = {{x < 1, z * log10(y) + (x < 1 ? log10(-log10(x)) : log10(log10(x)))},              x^y^z };     a[2] = {{x < 1, y * log10(z) + (x < 1 ? log10(-log10(x)) : log10(log10(x)))},              x^z^y };     a[3] = {{x < 1, log10(y * z) + (x < 1 ? log10(-log10(x)) : log10(log10(x)))},              (x^y)^z };     a[4] = {{x < 1, log10(y * z) + (x < 1 ? log10(-log10(x)) : log10(log10(x)))},              (x^z)^y };     a[5] = {{y < 1, z * log10(x) + (y < 1 ? log10(-log10(y)) : log10(log10(y)))},              y^x^z };     a[6] = {{y < 1, x * log10(z) + (y < 1 ? log10(-log10(y)) : log10(log10(y)))},              y^z^x };     a[7] = {{y < 1, log10(z * x) + (y < 1 ? log10(-log10(y)) : log10(log10(y)))},              (y^x)^z };     a[8] = {{y < 1, log10(z * x) + (y < 1 ? log10(-log10(y)) : log10(log10(y)))},              (y^z)^x };     a[9] = {{z < 1, y * log10(x) + (z < 1 ? log10(-log10(z)) : log10(log10(z)))},              z^x^y };     a[10] = {{z < 1, x * log10(y) + (z < 1 ? log10(-log10(z)) : log10(log10(z)))},               z^y^x };     a[11] = {{z < 1, log10(y * x) + (z < 1 ? log10(-log10(z)) : log10(log10(z)))},               (z^x)^y };     a[12] = {{z < 1, log10(y * x) + (z < 1 ? log10(-log10(z)) : log10(log10(z)))},               (z^y)^x };     int ind = 1;     for (int i = 2; i <= 12; i++) ind = (comp(a[ind], a[i]) ? i : ind);     cout << a[ind].second << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   int n;   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> s;     for (long long i = 0; i < n; i++) {       if (s[i] ==  * )         for (long long t = 1; t <= n - 1; t++) {           bool check = true;           for (long long j = 0; j < 5; j++)             if (i + j * t >= n || s[i + j * t] ==  . ) check = false;           if (check == 1) {             cout <<  yes ;             return 0;           }         }     }     cout <<  no  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, a, m, cur;   set<int> S;   int main() {     cin >> n >> k >> a;     cin >> m;     S.insert(0);     S.insert(n + 1);     cur = (n + 1) / (a + 1);     for (int i = 0; i < m; i++) {       int x;       cin >> x;       auto prv = S.lower_bound(x);       auto nxt = prv;       prv--;       cur -= (*nxt - *prv) / (a + 1);       cur += (x - *prv) / (a + 1);       cur += (*nxt - x) / (a + 1);       S.insert(x);       if (cur < k) return cout << i + 1, 0;     }     cout << -1;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   vector<int> G[maxn], a, b;   int n, m, flag;   int col[maxn];   bool bfs(int s) {     queue<int> p;     p.push(s);     col[s] = 1;     while (!p.empty()) {       int from = p.front();       p.pop();       int len = G[from].size();       for (int i = 0; i < len; ++i) {         int v = G[from][i];         if (col[v] == -1) {           p.push(v);           col[v] = !col[from];         }         if (col[from] == col[v]) return false;       }     }     return true;   }   int main() {     scanf( %d%d , &n, &m);     a.clear();     b.clear();     for (int i = 0; i <= n; ++i) G[i].clear();     for (int i = 0; i < m; ++i) {       int u, v;       scanf( %d%d , &u, &v);       G[u].push_back(v);       G[v].push_back(u);     }     flag = 0;     memset(col, -1, sizeof(col));     for (int i = 1; i <= n; i++)       if (col[i] == -1 && !bfs(i)) {         flag = true;         break;       }     if (flag) {       puts( -1 );     } else {       for (int i = 1; i <= n; ++i) {         if (G[i].size() == 0) col[i] = -1;         if (col[i] == 0) {           a.push_back(i);         } else if (col[i] == 1) {           b.push_back(i);         }       }       int len = a.size();       printf( %d n , len);       for (int i = 0; i < len; ++i) {         if (i) printf(   );         printf( %d , a[i]);       }       len = b.size();       printf(  n%d n , len);       for (int i = 0; i < len; ++i) {         if (i) printf(   );         printf( %d , b[i]);       }       puts(  );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[2000010], b[1000010], n;   int solve(int s) {     int cnt = 0, cur = s;     bool flag = 0;     while (1) {       cur = b[cur];       cnt++;       if (cur >= s && flag) return cnt;       if (cur >= n) {         cur -= n;         flag = 1;       }       if (cur >= s && flag) return cnt;     }   }   int main() {     int q;     scanf( %d%d , &n, &q);     int i;     long long sum = 0;     for (i = 0; i < n; i++) {       scanf( %d , &a[i]);       sum += a[i];       a[n + i] = a[i];     }     for (i = 0; i < q; i++) {       long long x, cur = 0;       int r = 0, j;       scanf( %lld , &x);       if (x >= sum) {         printf( 1 n );         continue;       }       for (j = 0; j < n; j++) {         while (cur + a[r] <= x) cur += a[r++];         b[j] = r;         cur -= a[j];       }       int min_ = 998244353, pos, ans = 998244353;       for (j = 0; j < n; j++) {         if (b[j] - j < min_) {           min_ = b[j] - j;           pos = j;         }       }       for (j = pos; j <= b[pos]; j++) {         ans = min(ans, solve(j % n));       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long UNDEF = -1;   const long long INF = 1e18;   template <typename T>   inline bool chkmax(T& aa, T bb) {     return aa < bb ? aa = bb, true : false;   }   template <typename T>   inline bool chkmin(T& aa, T bb) {     return aa > bb ? aa = bb, true : false;   }   static char stdinBuffer[1024];   static char* stdinDataEnd = stdinBuffer + sizeof(stdinBuffer);   static const char* stdinPos = stdinDataEnd;   void readAhead(size_t amount) {     size_t remaining = stdinDataEnd - stdinPos;     if (remaining < amount) {       memmove(stdinBuffer, stdinPos, remaining);       size_t sz = fread(stdinBuffer + remaining, 1,                         sizeof(stdinBuffer) - remaining, stdin);       stdinPos = stdinBuffer;       stdinDataEnd = stdinBuffer + remaining + sz;       if (stdinDataEnd != stdinBuffer + sizeof(stdinBuffer)) *stdinDataEnd = 0;     }   }   int rint() {     readAhead(16);     int x = 0;     bool neg = false;     while (*stdinPos ==     || *stdinPos ==   n ) ++stdinPos;     if (*stdinPos ==  - ) {       ++stdinPos;       neg = true;     }     while (*stdinPos >=  0  && *stdinPos <=  9 ) {       x *= 10;       x += *stdinPos -  0 ;       ++stdinPos;     }     return neg ? -x : x;   }   char rch() {     readAhead(16);     while (*stdinPos ==     || *stdinPos ==   n ) ++stdinPos;     char ans = *stdinPos;     ++stdinPos;     return ans;   }   long long rlong() {     readAhead(32);     long long x = 0;     bool neg = false;     while (*stdinPos ==     || *stdinPos ==   n ) ++stdinPos;     if (*stdinPos ==  - ) {       ++stdinPos;       neg = true;     }     while (*stdinPos >=  0  && *stdinPos <=  9 ) {       x *= 10;       x += *stdinPos -  0 ;       ++stdinPos;     }     return neg ? -x : x;   }   const int mc = 26, mn = 1e6 + 4;   char s[mn], t[mn];   int sc[mc + 1], tc[mc + 1], wc[mc + 1];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     scanf( %s n%s n , s, t);     int sl = strlen(s), tl = strlen(t);     int q = 0;     for (int i = 0; i < sl; i++) {       if (s[i] !=  ? )         sc[s[i] -  a ]++;       else         q++;     }     for (int i = 0; i < tl; i++) {       tc[t[i] -  a ]++;     }     int imin = 0, imax = mn;     while (imin < imax) {       int imid = (imin + imax) >> 1;       long long need = 0;       for (int c = 0; c < 26; c++) {         long long want = (tc[c] * (long long)imid) - sc[c];         if (want >= 0) need += want;       }       if (need <= q)         imin = imid + 1;       else         imax = imid;     }     imin--;     for (int c = 0; c < 26; c++) {       wc[c] = tc[c] * imin - sc[c];     }     int cidx = 0;     for (int i = 0; i < sl; i++) {       if (s[i] ==  ? ) {         while (cidx < mc && wc[cidx] <= 0) cidx++;         if (cidx < mc) {           s[i] =  a  + cidx;           wc[cidx]--;         } else {           s[i] =  a ;         }       }     }     printf( %s n , s);   }
#include <bits/stdc++.h>   using namespace std;   int arr[100005];   int reduce(int n) {     while (n % 2 == 0) n /= 2;     while (n % 3 == 0) n /= 3;     return n;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &arr[i]);     }     int r = reduce(arr[0]);     bool ok = true;     for (int i = 1; i < n; i++) {       if (reduce(arr[i]) != r) {         ok = false;         break;       }     }     if (ok)       printf( Yes n );     else       printf( No n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   void err() { cout <<   033[39;0m  << endl; }   template <class T, class... Ts>   void err(const T& arg, const Ts&... args) {     cout << arg <<    ;     err(args...);   }   const int N = 100000 + 5;   int n, h, m, k;   int H[N];   pair<int, int> M[N];   int main() {     scanf( %d%d%d%d , &n, &h, &m, &k);     m /= 2;     for (int i = 1; i <= n; i++) {       scanf( %d%d , &H[i], &M[i].first);       M[i].second = i;       M[i].first %= m;       M[i].first++;     }     sort(M + 1, M + 1 + n);     int res = 0, t = 0;     for (int i = 1; i <= n; i++) {       int num = 0;       if (M[i].first < k) {         int l = lower_bound(M + 1, M + 1 + n, make_pair(M[i].first, 0)) - M;         int r =             upper_bound(M + 1, M + 1 + n, make_pair(m - k + M[i].first, inf)) -             M - 1;         num = r - l + 1;       } else {         num +=             upper_bound(M + 1, M + 1 + n, make_pair(M[i].first - k, inf)) - M - 1;         num +=             n - (lower_bound(M + 1, M + 1 + n, make_pair(M[i].first, 0)) - M) + 1;       }       if (res < num) {         res = num;         t = M[i].first;       }     }     vector<int> kk;     for (int i = 1; i <= n; i++) {       int num = 0;       if (M[i].first < k) {         int l = lower_bound(M + 1, M + 1 + n, make_pair(M[i].first, 0)) - M;         int r =             upper_bound(M + 1, M + 1 + n, make_pair(m - k + M[i].first, inf)) -             M - 1;         num = r - l + 1;         if (num == res) {           for (int i = 1; i < l; i++) kk.push_back(M[i].second);           for (int i = r + 1; i <= n; i++) kk.push_back(M[i].second);           break;         }       } else {         int l =             upper_bound(M + 1, M + 1 + n, make_pair(M[i].first - k, inf)) - M - 1;         num += l;         int r = lower_bound(M + 1, M + 1 + n, make_pair(M[i].first, 0)) - M;         num += n - r + 1;         if (num == res) {           for (int i = l + 1; i < r; i++) kk.push_back(M[i].second);           break;         }       }     }     cout << (n - res) <<     << t - 1 << endl;     sort(kk.begin(), kk.end());     for (int i = 0; i < kk.size(); i++) {       printf( %d  , kk[i]);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     if (n % 2) {       cout <<  black ;     } else {       cout <<  white  << endl;       cout <<  1 2 ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   long long int n, m, c, ans = 0;   string x;   void count() {     int v = 0;     for (long long int i = 0; i < n; i++) {       if (s[i] ==  . ) {         v++;       } else {         if (v > 0) {           ans += (v - 1);           v = 0;         }       }     }     if (s[n - 1] ==  . ) ans += v - 1;   }   int main() {     cin >> n >> m;     cin >> s;     count();     for (long long int i = 1; i <= m; i++) {       cin >> c >> x;       if ((s[c - 1] ==  .  && x[0] ==  . ) || (s[c - 1] !=  .  && x[0] !=  . )) {       } else if (s[c - 1] !=  .  && x[0] ==  . ) {         if (s[c - 2] ==  .  && s[c] ==  . ) {           ans += 2;         } else if (s[c] ==  .  || s[c - 2] ==  . ) {           ans += 1;         }       } else if (s[c - 1] ==  .  && x[0] !=  . ) {         if (s[c - 2] ==  .  && s[c] ==  . ) {           ans -= 2;         } else if (s[c] ==  .  || s[c - 2] ==  . ) {           ans -= 1;         }       }       cout << ans << endl;       s[c - 1] = x[0];     }   }
#include <bits/stdc++.h>   int s, i, e;   int main() {     int t;     scanf( %d , &t);     while (t--) {       int ans = 0;       scanf( %d%d%d , &s, &i, &e);       if (s > i + e) {         printf( %d n , e + 1);       } else if (s + e <= i) {         printf( %d n , 0);       } else {         int k = e - (i + e - s) / 2;         printf( %d n , k);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   const double eps = 1e-11;   template <class T>   inline void ckmin(T &a, T b) {     if (b < a) a = b;   }   template <class T>   inline void ckmax(T &a, T b) {     if (b > a) a = b;   }   template <class T>   inline T sqr(T x) {     return x * x;   }   using VI = vector<int>;   int main() {     std::ios::sync_with_stdio(false);     int n, k;     while (cin >> n >> k) {       vector<int> a(n, -1);       vector<int> b(n, -1);       for (int i = 0; i < (k); ++i) {         int p;         cin >> p;         --p;         if (a[p] < 0) a[p] = i;         b[p] = i;       }       int ret = 0;       for (int x = 0; x < (n); ++x)         for (int d = -1; d <= 1; d++) {           int y = x + d;           if (y < 0 || y >= n) continue;           if (a[x] < 0)             ++ret;           else if (b[y] < a[x])             ++ret;         }       printf( %d n , ret);       break;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000000 + 20;   int xor_n[maxn];   int p[maxn];   int n;   int q;   void init() {     xor_n[0] = 0;     for (int i = 1; i < maxn; i++) {       xor_n[i] = i ^ xor_n[i - 1];     }   }   int main() {     init();     while (~scanf( %d , &n)) {       q = 0;       for (int i = 1; i <= n; i++) {         scanf( %d , &p[i]);         q = q ^ p[i];       }       for (int i = 1; i <= n; i++) {         int tmp = n / i;         if (n % i == 0) {           if (tmp & 1) q = q ^ xor_n[i - 1];         } else {           if (tmp & 1)             q = q ^ xor_n[i - 1] ^ xor_n[n % i];           else             q = q ^ xor_n[n % i];         }       }       printf( %d n , q);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, k, n, x, y, a, ans = 0;     cin >> n;     int arr[n];     for (i = 0; i < n; i++) {       cin >> arr[i];       if (arr[i] > ans) ans = arr[i];     }     for (i = 2; i <= n; i++) {       for (j = 0; j < n - i + 1; j++) {         int a = arr[j];         for (k = 1; k < i; k++) {           a = a ^ arr[j + k];         }         if (a > ans) ans = a;       }     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     string s;     cin >> s;     int p = s.find( . );     if (s[p - 1] ==  9 ) {       cout <<  GOTO Vasilisa.  <<   n ;     } else if (s[p + 1] <  5 ) {       cout << s.substr(0, p) <<   n ;     } else {       string z = s.substr(0, p);       z[p - 1]++;       cout << z <<   n ;     }   }   void t(int t) {     if (!t) {       cin >> t;     }     while (t--) {       solve();     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     t(1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[1000007];   int main() {     int n;     scanf( %d , &n);     dp[1] = dp[2] = 1;     for (int i = 3; i <= n; i++) {       int im = (i - 1) / 2;       if (2 * im == (i - 1) && im % 2 == 0)         dp[i] = dp[im];       else if ((2 * im + 1) == (i - 1))         dp[i] = dp[im] && dp[im + 1];     }     printf( %d n , dp[n]);   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 5500;   const int INF = 1E9;   int a[MAXN], b[MAXN], c[MAXN], d[MAXN];   int f[MAXN][MAXN];   vector<int> g[MAXN];   inline bool cmp(int a, int b) { return c[a] > c[b]; }   int main() {     int n, m, k, s;     scanf( %d%d%d , &n, &m, &k);     s = k;     for (int i = 1; i <= n; i++) {       scanf( %d%d%d , &a[i], &b[i], &c[i]);       s += b[i];       d[i] = i;     }     for (int i = 1; i <= m; i++) {       int u, v;       scanf( %d%d , &u, &v);       d[v] = max(d[v], u);     }     for (int i = 1; i <= n; i++) g[d[i]].push_back(i);     for (int i = 1; i <= n; i++) sort(g[i].begin(), g[i].end(), cmp);     for (int i = 0; i <= n; i++)       for (int j = 0; j <= s; j++) f[i][j] = -INF;     for (int i = n; i >= 0; i--)       for (int j = 0; j <= s - b[i]; j++) {         if (j + b[i] >= a[i + 1]) f[i][j] = max(f[i][j], f[i + 1][j + b[i]]);         for (int l = 0, t = 0; l < g[i].size() && j + b[i] - (l + 1) >= a[i + 1];              l++) {           t += c[g[i][l]];           f[i][j] = max(f[i][j], f[i + 1][j + b[i] - (l + 1)] + t);         }       }     printf( %d n , f[0][k] < 0 ? -1 : f[0][k]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> a;   int main() {     int n;     cin >> n;     for (long long x, y, z, i = 1; i <= n; i++) {       cin >> x >> y >> z;       long long l = 0;       if (x % 2 == 1) {         l = y;         x--;         long long h = min(x * y, x / 2 * z);         l = l + h;       } else {         l = min(x / 2 * z, x * y);       }       a.push_back(l);     }     for (long long i = 0; i < a.size(); i++) {       cout << a[i] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, a, b;     cin >> n >> a >> b;     int cnt = 0;     for (int i = 1; i < n + 1; i++) {       if (i <= b + 1 && (n - i) >= a) cnt++;     }     cout << cnt << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-9;   const long double pi = acos(-1.0);   int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }   int xabs(int a) { return a > 0 ? a : -a; }   struct spoint {     double x;     double y;     int id;     spoint();     spoint(double x, double y) : x(x), y(y){};   };   struct svector {     double x;     double y;     svector();     svector(double x, double y) : x(x), y(y) {}     svector(spoint a, spoint b) {       x = b.x - a.x;       y = b.y - a.y;     }     double len() const { return sqrt((x * x) + (y * y)); }     friend svector operator+(const svector a, const svector b) {       return svector(a.x + b.x, a.y + b.y);     }     friend bool operator==(const svector a, const svector b) {       return (a.x == b.x && a.y == b.y);     }     friend double operator*(const svector a, const svector b) {       return a.x * b.x + a.y * b.y;     }   };   int main() {     vector<spoint> mas;     for (int i = 0; i < 8; i++) {       double a, b;       cin >> a >> b;       mas.push_back(spoint(a, b));     }     for (int i = 0; i < 5; i++) {       for (int k = i + 1; k < 6; k++) {         for (int j = k + 1; j < 7; j++) {           for (int z = j + 1; z < 8; z++) {             svector a1(mas[i], mas[k]);             svector b1(mas[i], mas[j]);             svector c1(mas[i], mas[z]);             if ((a1 + b1 == c1 && fabs(a1.len() - b1.len()) < eps &&                  a1 * b1 == 0) ||                 (a1 + c1 == b1 && fabs(a1.len() - c1.len()) < eps &&                  a1 * c1 == 0) ||                 (b1 + c1 == a1 && fabs(c1.len() - b1.len()) < eps &&                  b1 * c1 == 0)) {               vector<spoint> mm;               vector<int> qw;               for (int q = 0; q < 8; q++) {                 if (q != i && q != k && q != j && q != z) {                   mm.push_back(mas[q]);                   qw.push_back(q);                 }               }               svector a2(mm[0], mm[1]);               svector b2(mm[0], mm[2]);               svector c2(mm[0], mm[3]);               if ((a2 + b2 == c2 && a2 * b2 == 0) ||                   (a2 + c2 == b2 && a2 * c2 == 0) ||                   (b2 + c2 == a2 && b2 * c2 == 0)) {                 cout <<  YES  << endl;                 cout << i + 1 <<     << k + 1 <<     << j + 1 <<     << z + 1                      << endl;                 cout << qw[0] + 1 <<     << qw[1] + 1 <<     << qw[2] + 1 <<                          << qw[3] + 1 << endl;                 return 0;               }             }           }         }       }     }     cout <<  NO ;     return 0;   }