func_code_string: #include <bits/stdc++.h>   using namespace std;   void file() {}   void fast() {     std::ios_base::sync_with_stdio(0);     cin.tie(NULL);   }   const int N = 510 + 20;   const double PI = acos(-1.0);   bool cmp(complex<double> a, complex<double> b) {     if (a.real() == b.real()) return a.imag() < b.imag();     return a.real() < b.real();   }   bool cmp_doub(double a, double b) {     if (fabs(a - b) <= 1e-9) {       return 1;     }     return 0;   }   bool is_correct(complex<double> p1, complex<double> p2, complex<double> p3,                   complex<double> p4) {     vector<double> dists;     double dist1 = (hypot((p1 - p2).imag(), (p1 - p2).real()));     double dist2 = (hypot((p2 - p4).imag(), (p2 - p4).real()));     double dist3 = (hypot((p3 - p4).imag(), (p3 - p4).real()));     double dist4 = (hypot((p3 - p1).imag(), (p3 - p1).real()));     double dist5 = (hypot((p2 - p3).imag(), (p2 - p3).real()));     double dist6 = (hypot((p1 - p4).imag(), (p1 - p4).real()));     dists.push_back(dist1);     dists.push_back(dist2);     dists.push_back(dist3);     dists.push_back(dist4);     dists.push_back(dist5);     dists.push_back(dist6);     sort(((dists).begin()), ((dists).end()));     if (dists[0] > 0 && cmp_doub(dists[0], dists[1]) &&         cmp_doub(dists[1], dists[2]) && cmp_doub(dists[2], dists[3]) &&         cmp_doub(dists[3], dists[2])) {       if (cmp_doub(dists[4], dists[5]) && !cmp_doub(dists[5], dists[0])) {         return 1;       }     }     return 0;   }   complex<double> rotate(complex<double> a, complex<double> b, int c) {     for (int i = 0; i < c; i++) {       a = (((((a) - (b))) * exp(complex<double>(0, PI / 2.0))) + b);     }     return a;   }   int main() {     file();     fast();     int n;     cin >> n;     for (int i = 0; i < n; i++) {       vector<pair<complex<double>, complex<double>>> points;       for (int j = 0; j < 4; j++) {         int x, y, z, m;         cin >> x >> y >> z >> m;         points.push_back({complex<double>(x, y), complex<double>(z, m)});       }       int ans = 1e9;       for (int j1 = 0; j1 < 4; j1++) {         for (int j2 = 0; j2 < 4; j2++) {           for (int j3 = 0; j3 < 4; j3++) {             for (int j4 = 0; j4 < 4; j4++) {               vector<complex<double>> points1(4);               points1[0] = rotate(points[0].first, points[0].second, j1);               points1[1] = rotate(points[1].first, points[1].second, j2);               points1[2] = rotate(points[2].first, points[2].second, j3);               points1[3] = rotate(points[3].first, points[3].second, j4);               if (is_correct(points1[0], points1[1], points1[2], points1[3])) {                 ans = min(ans, j1 + j2 + j3 + j4);               }             }           }         }       }       if (ans == 1e9) ans = -1;       cout << ans << endl;     }   }   