malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <typename _Tp, typename _Up>   bool maximize(_Tp &__a, _Up __b) {     if (__a < __b) {       __a = __b;       return true;     }     return false;   }   template <typename _Tp, typename _Up>   bool minimize(_Tp &__a, _Up __b) {     if (__a > __b) {       __a = __b;       return true;     }     return false;   }   const long long siz = 2e5 + 2;   const long long SIZ = 1e6 + 2;   const long long mod = 1e9 + 7;   const long long maxx = 2e9;   const long long MAXX = 1e18;   const string file =  3 ;   struct fenwick_tree {     long long n;     vector<long long> fwt;     fenwick_tree(long long n) : n(n) { fwt.assign(n + 1, 0); }     void pos_update(long long pos, long long val) {       assert(1 <= pos && pos <= n);       for (long long i = pos; i <= n; i += i & (-i)) {         fwt[i] += val;       }     }     long long pre_sum(long long pos) {       assert(0 <= pos && pos <= n + 1);       long long res = 0;       for (long long i = pos; i > 0; i -= i & (-i)) {         res += fwt[i];       }       return res;     }     long long suf_sum(long long pos) { return (pre_sum(n) - pre_sum(pos - 1)); }     long long range_sum(long long lt, long long rt) {       if (lt > rt) {         return 0;       }       return (pre_sum(rt) - pre_sum(lt - 1));     }   };   long long ans[siz];   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     vector<pair<pair<long long, long long>, long long> > hold;     for (long long i = 1; i <= n; i++) {       long long l, r;       cin >> l >> r;       hold.push_back(pair<pair<long long, long long>, long long>(           pair<long long, long long>(l, r), i));     }     vector<long long> rar;     for (auto x : hold) {       rar.push_back(x.first.first);       rar.push_back(x.first.second);     }     sort((rar).begin(), (rar).end());     rar.resize(unique((rar).begin(), (rar).end()) - rar.begin());     for (auto &x : hold) {       long long &l = x.first.first, &r = x.first.second;       l = lower_bound((rar).begin(), (rar).end(), l) - rar.begin() + 1;       r = lower_bound((rar).begin(), (rar).end(), r) - rar.begin() + 1;     }     sort((hold).begin(), (hold).end(),          [](const pair<pair<long long, long long>, long long> &x,             const pair<pair<long long, long long>, long long> &y) {            return (x.first.first > y.first.first);          });     fenwick_tree fen(2 * n);     for (auto x : hold) {       long long l = x.first.first, r = x.first.second, i = x.second;       ans[i] = fen.pre_sum(r);       fen.pos_update(r, 1);     }     for (long long i = 1; i <= n; i++) {       cout << ans[i] <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long first, second, cycle_s, cycle_len, l;   int n, m, d, cnt[2][1000005][26];   string A, B;   int gcd(int first, int second) {     if (!second) return first;     return gcd(second, first % second);   }   int main() {     cin >> first >> second >> A >> B;     n = A.size();     m = B.size();     d = gcd(n, m);     int i, j;     for (i = 0; i < n; i += d)       for (j = 0; j < d; j++) cnt[0][j][A[i + j] -  a ]++;     for (i = 0; i < m; i += d)       for (j = 0; j < d; j++) cnt[1][j][B[i + j] -  a ]++;     for (j = 0; j < d; j++)       for (i = 0; i < 26; i++) cycle_s += (long long)cnt[0][j][i] * cnt[1][j][i];     cycle_len = (long long)m * n / d;     l = n * first;     cout << l - l / cycle_len * cycle_s <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int64_t MOD = 1e9 + 7;   void add(int64_t& a, int64_t b) { a = (a + b) % MOD; }   int nth_bit(int64_t num, int n) { return (num >> n) & 1; }   const int SZ = 14 * 16;   void matmul(int64_t A[SZ][SZ], int64_t B[SZ][SZ]) {     int64_t ret[SZ][SZ] = {0};     for (int i = 0; i < SZ; i++)       for (int j = 0; j < SZ; j++)         for (int k = 0; k < SZ; k++) add(ret[i][j], A[i][k] * B[k][j]);     for (int i = 0; i < SZ; i++)       for (int j = 0; j < SZ; j++) A[i][j] = ret[i][j];   }   int main() {     int N, K, M;     cin >> N >> K >> M;     static int64_t A[SZ][SZ];     for (int j = 0; j <= K; j++)       for (int bits = 0; bits < 16; bits++) {         int pos = 1;         for (int k = 0; k < M; k++)           if (nth_bit(bits, k)) pos++;         add(A[(j + 1) * 16 + (bits << 1) % 16 + 1][j * 16 + bits], pos);         add(A[j * 16 + (bits << 1) % 16][j * 16 + bits], 1);       }     static int64_t B[SZ][SZ];     for (int i = 0; i < SZ; i++) B[i][i] = 1;     while (N > 0) {       if (N % 2) matmul(B, A);       matmul(A, A);       N /= 2;     }     int64_t ans = 0;     for (int bits = 0; bits < 16; bits++) add(ans, B[K * 16 + bits][0]);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 10;   map<pair<int, int>, int> weight;   vector<int> edges[MAXN];   bool visited[MAXN];   long long int maximum;   void dfs(int v, long long int sum) {     visited[v] = true;     maximum = max(maximum, sum);     for (int i : edges[v]) {       if (!visited[i]) dfs(i, sum + weight[make_pair(v, i)]);     }     return;   }   int main() {     long long int n, a, b, c, sum_of_edges = 0;     cin >> n;     for (int i = 0; i < n - 1; i++) {       cin >> a >> b >> c;       sum_of_edges += c;       a--;       b--;       edges[a].push_back(b);       edges[b].push_back(a);       weight[make_pair(a, b)] = c;       weight[make_pair(b, a)] = c;     }     dfs(0, 0);     sum_of_edges *= 2;     sum_of_edges -= maximum;     cout << sum_of_edges << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 5;   int c[maxn];   int p[64], q[64];   int l[maxn];   int ans[maxn];   vector<int> g[maxn];   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> c[i];     int Q;     cin >> Q;     for (int i = 1; i <= Q; i++) {       int r;       cin >> l[i] >> r;       g[r].push_back(i);     }     for (int i = 1; i <= n; i++) {       int r = i, x = c[i];       for (int j = 30; j >= 0; j--) {         if (x >> j & 1) {           if (!p[j]) {             p[j] = x;             q[j] = r;             break;           }           if (q[j] < r) {             swap(p[j], x);             swap(q[j], r);           }           x ^= p[j];         }       }       for (int k = 0; k < g[i].size(); k++) {         int now = g[i][k];         for (int j = 30; j >= 0; j--) {           if (q[j] >= l[now]) ans[now] = max(ans[now], ans[now] ^ p[j]);         }       }     }     for (int i = 1; i <= Q; i++) cout << ans[i] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     char puzzel[600];     vector<string> Puz;     int m, n;     int stp;     int len = 0, judge = 0;     int prevstp;     int prevlen;     int minv = 1000;     int maxv = -9;     int flag = 0;     scanf( %d%d , &m, &n);     for (int i = 0; i < m; i++) {       scanf( %s , puzzel);       Puz.push_back(puzzel);     }     for (int i = 0; i < m; i++) {       for (int j = 0; j < n; j++) {         if (Puz[i][j] ==  X ) {           stp = j;           len++;           for (int k = j; k < n - 1; k++) {             if (Puz[i][k + 1] ==  X ) {               len++;             } else {               break;             }           }           if (flag == 0) {             flag = 1;             prevlen = len;             prevstp = stp;             len = 0;           } else {             if (prevstp == stp && prevlen == len) {               prevstp = stp;               prevlen = len;               len = 0;             } else {               judge = 1;             }           }           break;         }       }     }     if (judge == 1) {       printf( NO n );     } else if (flag == 1) {       printf( YES n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double const eps = 1e-6;   double const pi = 3.1415926535;   long long const mod = 1e9 + 7;   int a[20];   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < (1 << n); i++) {       int x = 0;       for (int j = 0; j < n; j++) {         if (i & (1 << j))           x += a[j];         else           x -= a[j];       }       if (x % 360 == 0) {         cout <<  YES  << endl;         return 0;       }     }     cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> res;   int main() {     cin.tie(0);     cout.tie(0);     ios::sync_with_stdio(0);     long long n, f = 0, m;     cin >> n;     m = n;     for (int i = 2; i <= sqrt(m); i++) {       if (n % i == 0) {         while (n % i == 0) {           res.push_back(i);           n /= i;           if (res.size() == 3) {             f = 1;             break;           }         }       }     }     if (res.size() == 2) {       if (m == res[0] * res[1])         cout << 2;       else         cout << 1 << endl << res[0] * res[1];       return 0;     }     if (f) {       cout << 1 << endl << (res[0] * res[1]);       return 0;     }     if (res.empty())       cout << 1 << endl << 0;     else       cout << 2;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   const int _inf = 0xc0c0c0c0;   const long long INF = 0x3f3f3f3f3f3f3f3f;   const long long _INF = 0xc0c0c0c0c0c0c0c0;   const long long mod = (int)1e9 + 7;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long ksm(long long a, long long b, long long mod) {     int ans = 1;     while (b) {       if (b & 1) ans = (ans * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return ans;   }   long long inv2(long long a, long long mod) { return ksm(a, mod - 2, mod); }   void exgcd(long long a, long long b, long long &x, long long &y, long long &d) {     if (!b) {       d = a;       x = 1;       y = 0;     } else {       exgcd(b, a % b, y, x, d);       y -= x * (a / b);     }   }   int arr[55], num[55];   int main() {     int n;     long long d, tmp = 0;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &arr[i]);       num[arr[i]]++;     }     sort(arr + 1, arr + 1 + n);     if (num[arr[1]] <= n / 2)       printf( Alice n );     else       printf( Bob n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   short k, r, m = 10;   int main() {     cin >> k >> r;     for (int i = 10; i > 0; --i) {       if ((i * k) % 10 == 0 || (i * k - r) % 10 == 0) {         m = i;       }     }     cout << m;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int num[10];   char s[100010];   int main() {     scanf( %d , &n);     scanf( %s , s);     for (int i = 0; i < n; i++) {       if (s[i] ==  L ) {         for (int j = 0; j < 10; j++) {           if (num[j] == 0) {             num[j] = 1;             break;           }         }       } else if (s[i] ==  R ) {         for (int j = 9; j >= 0; j--) {           if (num[j] == 0) {             num[j] = 1;             break;           }         }       } else if (s[i] >=  0  && s[i] <=  9 ) {         num[s[i] -  0 ] = 0;       }     }     for (int i = 0; i < 10; i++) {       printf( %d , num[i]);     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int a, b, n, s;       cin >> a >> b >> n >> s;       if ((min(s / n, a) * n + b) >= s) {         cout <<  YES  << endl;       } else {         cout <<  NO  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     scanf( %d %d , &n, &m);     int l[m], r[m];     for (int i = 1; i <= m; i++) {       scanf( %d %d , &l[i], &r[i]);     }     for (int i = 1; i <= n; i++) {       if (i % 2 == 1)         printf( 1 );       else         printf( 0 );     }     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> numeros;     string str4 =  2 * 3 = 6 n6 * 4 = 24 n24 * 1 = 24 ;     string str5 =  3 - 1 = 2 n2 + 2 = 4 n4 * 5 = 20 n20 + 4 = 24 ;     int n;     scanf( %d , &n);     if (n < 4)       printf( NO );     else {       printf( YES n );       if (n % 2 != 0) {         cout << str5;         for (int i = 6; i <= n; i += 2) {           printf(  n%d - %d = 1 , (i + 1), i);         }         for (int i = 0; i < ((n - 5) / 2) - 1; i++) {           printf(  n1 * 1 = 1 );         }         if (n > 5) printf(  n24 * 1 = 24 );       } else if (n % 2 == 0) {         cout << str4;         for (int i = 5; i <= n; i += 2) {           printf(  n%d - %d = 1 , (i + 1), i);         }         for (int i = 0; i < ((n - 4) / 2) - 1; i++) {           printf(  n1 * 1 = 1 );         }         if (n > 4) printf(  n24 * 1 = 24 );       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void scanint(int &x) {     register int c = getchar();     x = 0;     int neg = 0;     for (; ((c < 48 || c > 57) && c !=  - ); c = getchar())       ;     if (c ==  - ) {       neg = 1;       c = getchar();     }     for (; c > 47 && c < 58; c = getchar()) {       x = (x << 1) + (x << 3) + c - 48;     }     if (neg) x = -x;   }   int cmp(int a, int b) {     if (a > b)       return a;     else       return b;   }   int main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     int n, m, i, j, k;     cin >> n >> m;     int a[n][3];     for (i = 0; i < n; i++) {       for (j = 0; j < 3; j++) {         a[i][j] = 55;       }     }     for (i = 0; i < n; i++) {       string s;       cin >> s;       for (j = 0; j < m; j++) {         int ctr = 2;         if (s[j] ==  #  || s[j] ==  *  || s[j] ==  & )           ctr = 0;         else if (s[j] >=  0  && s[j] <=  9 )           ctr = 1;         if (a[i][ctr] > min(j, m - j)) a[i][ctr] = min(j, m - j);       }     }     int ans = 200;     for (i = 0; i < n; i++) {       for (j = 0; j < n; j++) {         if (i == j) continue;         for (k = 0; k < n; k++) {           if (i == k || k == j) continue;           ans = min(ans, a[i][0] + a[j][1] + a[k][2]);         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   template <typename T>   inline void read(T &x) {     char c;     bool nega = 0;     while ((!isdigit(c = getchar())) && (c !=  - ))       ;     if (c ==  - ) {       nega = 1;       c = getchar();     }     x = c - 48;     while (isdigit(c = getchar())) x = x * 10 + c - 48;     if (nega) x = -x;   }   template <typename T>   inline void writep(T x) {     if (x > 9) writep(x / 10);     putchar(x % 10 + 48);   }   template <typename T>   inline void write(T x) {     if (x < 0) {       putchar( - );       x = -x;     }     writep(x);     putchar(   );   }   template <typename T>   inline void writeln(T x) {     write(x);     putchar(  n );   }   using namespace std;   int u, v, l, r;   vector<pair<int, int> > ans;   map<pair<int, int>, bool> dd;   int main() {     ios_base::sync_with_stdio(NULL);     cin.tie(NULL);     cout.tie(NULL);     cin >> u >> v;     int up = 1, down = u;     l = 1, r = v;     while (up <= down) {       if (l == 1) {         for (int i = (1); i <= (v); ++i) {           ans.push_back(make_pair(up, l));           ++l;           ans.push_back(make_pair(down, r));           --r;         }         ++up;         --down;         --l;         ++r;       } else {         for (int i = (1); i <= (v); ++i) {           ans.push_back(make_pair(up, l));           --l;           ans.push_back(make_pair(down, r));           ++r;         }         ++up;         --down;         ++l;         --r;       }     }     for (auto v : ans) {       if (dd[v]) continue;       dd[v] = 1;       cout << v.first <<     << v.second <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long modulo(long long base, long long exp, long long m);   int main() {     int x;     cin >> x;     if (x <= 1)       cout <<  -1 ;     else {       cout << x <<     << x;     }     return 0;   }   long long modulo(long long base, long long exp, long long m) {     long long answer = 1;     while (exp > 0) {       if (exp % 2 == 1) answer = (answer * base) % m;       exp = exp / 2;       base = (base * base) % m;     }     return answer;   }
#include <bits/stdc++.h>   using namespace std;   int n, i, last[28], tmp[28];   long long ans[28];   char s[300005];   int main() {     scanf( %s , s);     for (i = 0; i <= 26; i++) last[i] = -1;     int length = strlen(s);     for (i = 0; i < length; i++) {       last[s[i] -  a ] = i;       for (int j = 0; j <= 26; j++) tmp[j] = last[j];       sort(tmp, tmp + 27);       for (int j = 26; j; j--) ans[26 - j + 1] += tmp[j] - tmp[j - 1];     }     for (i = 1; i <= 26; i++)       if (!ans[i]) break;     printf( %d n , i - 1);     for (int j = 1; j < i; j++) printf( %I64d n , ans[j]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n = 5, sum = 0;     while (n--) {       int a;       cin >> a;       sum += a;     }     if (sum == 0) {       cout << -1 << endl;       return 0;     }     cout << (sum % 5 == 0 ? sum / 5 : -1) << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<    ;       return *this;     }   } dbg;   char b[100][100];   int n;   bool in(int x) { return x >= 0 && x < n; }   bool in(int x, int y) { return in(x) && in(y); }   char a[200][200];   int main() {     scanf( %d , &n);     for (int i = 0; i < (n); i++) scanf( %s , b[i]);     vector<pair<int, int> > ans;     for (int dx = (-n + 1); dx <= (n - 1); dx++) {       for (int dy = (-n + 1); dy <= (n - 1); dy++) {         if (dx == 0 && dy == 0) {           continue;         }         bool fail = false;         for (int i = 0; i < (n); i++) {           for (int j = 0; j < (n); j++) {             if (b[i][j] ==  o  && in(i + dx, j + dy) &&                 b[i + dx][j + dy] ==  . ) {               fail = true;             }           }         }         if (!fail) {           ans.emplace_back(dx, dy);         }       }     }     for (int i = 0; i < (n); i++)       for (int j = 0; j < (n); j++) {         if (b[i][j] ==  x ) {           bool success = false;           for (auto& p : ans) {             if (in(i - p.first, j - p.second) &&                 b[i - p.first][j - p.second] ==  o ) {               success = true;             }           }           if (!success) {             puts( NO );             return 0;           }         }       }     puts( YES );     for (int i = 0; i < (2 * n - 1); i++) {       for (int j = 0; j < (2 * n - 1); j++) {         a[i][j] =  . ;       }     }     a[n - 1][n - 1] =  o ;     for (auto& p : ans) {       a[n - 1 + p.first][n - 1 + p.second] =  x ;     }     for (int i = 0; i < (2 * n - 1); i++) {       puts(a[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e6 + 10, maxm = 2e6 + 10;   const long long INF = 0x3f3f3f3f, mod = 1e9 + 7;   int casn, n, m, k;   namespace graph {   vector<int> g[maxn];   int all, sz[maxn], root, maxt;   bool vis[maxn];   int dfs_root(int now, int fa) {     int cnt = 1;     for (auto to : g[now]) {       if (to == fa || vis[to]) continue;       cnt += dfs_root(to, now);     }     int tmp = max(cnt - 1, all - cnt);     if (maxt > tmp) maxt = tmp, root = now;     return sz[now] = cnt;   }   int ans[maxn];   void dfs_col(int now, int fa, int c) {     ans[now] = c;     for (auto to : g[now])       if (to != fa && !vis[to]) dfs_col(to, now, c);   }   void dfs_dv(int now, int d = 0) {     vis[now] = 1;     dfs_col(now, now, d);     for (auto to : g[now]) {       if (vis[to]) continue;       maxt = root = n + 1;       all = sz[to];       dfs_root(to, now);       dfs_dv(root, d + 1);     }   }   void solve(int n) {     all = maxt = root = n + 1;     dfs_root(1, 1);     all -= maxt;     dfs_dv(root);   }   }  // namespace graph   using namespace graph;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 2; i <= n; ++i) {       int a, b;       cin >> a >> b;       g[a].push_back(b);       g[b].push_back(a);     }     solve(n);     for (int i = 1; i <= n; ++i) cout << char(ans[i] +  A ) <<    ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = (int)1e5 + 113;   const double eps = 1e-7;   struct pt {     long double x, y;     int ind;     pt(long double x = 0, long double y = 0, int ind = 0)         : x(x), y(y), ind(ind) {}   };   long double dist(pt a, pt b) {     return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   }   int n;   pt a, b, t, rat[N];   pt mnA[2], mnB[2];   int used[N];   long double ans = 1000000000000, newAns;   bool cnt1(pt x, pt y) {     long double toX = sqrt(dist(a, x)) + sqrt(dist(t, y));     long double toY = sqrt(dist(a, y)) + sqrt(dist(t, x));     return (toX - toY < eps);   }   bool cnt2(pt x, pt y) {     long double toX = sqrt(dist(b, x)) + sqrt(dist(t, y));     long double toY = sqrt(dist(b, y)) + sqrt(dist(t, x));     return (toX - toY < eps);   }   int main() {     cout.precision(30);     cin >> a.x >> a.y >> b.x >> b.y >> t.x >> t.y;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> rat[i].x >> rat[i].y;       rat[i].ind = i;     }     sort(rat + 1, rat + n + 1, cnt1);     mnA[0] = rat[1];     mnA[1] = rat[2];     sort(rat + 1, rat + n + 1, cnt2);     mnB[0] = rat[1];     mnB[1] = rat[2];     if (n == 1) {       ans = min(sqrt(dist(a, rat[1])), sqrt(dist(b, rat[1]))) +             sqrt(dist(rat[1], t));       cout << ans;       return 0;     }     ans = sqrt(dist(a, mnA[0])) + sqrt(dist(mnA[0], t));     used[mnA[0].ind] = 1;     for (int i = 1; i <= n; i++) {       if (used[rat[i].ind]) continue;       ans += 2 * sqrt(dist(t, rat[i]));     }     memset(used, 0, sizeof(used));     newAns = sqrt(dist(b, mnB[0])) + sqrt(dist(mnB[0], t));     used[mnB[0].ind] = 1;     for (int i = 1; i <= n; i++) {       if (used[rat[i].ind]) continue;       newAns += 2 * sqrt(dist(t, rat[i]));     }     ans = min(ans, newAns);     memset(used, 0, sizeof(used));     newAns = sqrt(dist(a, mnA[0])) + sqrt(dist(mnA[0], t));     used[mnA[0].ind] = 1;     if (used[mnB[0].ind]) {       newAns += sqrt(dist(b, mnB[1])) + sqrt(dist(mnB[1], t));       used[mnB[1].ind] = 1;     } else {       newAns += sqrt(dist(b, mnB[0])) + sqrt(dist(mnB[0], t));       used[mnB[0].ind] = 1;     }     for (int i = 1; i <= n; i++) {       if (used[rat[i].ind]) continue;       newAns += 2 * sqrt(dist(t, rat[i]));     }     ans = min(ans, newAns);     memset(used, 0, sizeof(used));     newAns = sqrt(dist(b, mnB[0])) + sqrt(dist(mnB[0], t));     used[mnB[0].ind] = 1;     if (used[mnA[0].ind]) {       newAns += sqrt(dist(a, mnA[1])) + sqrt(dist(mnA[1], t));       used[mnA[1].ind] = 1;     } else {       newAns += sqrt(dist(a, mnA[0])) + sqrt(dist(mnA[0], t));       used[mnA[0].ind] = 1;     }     for (int i = 1; i <= n; i++) {       if (used[rat[i].ind]) continue;       newAns += 2 * sqrt(dist(t, rat[i]));     }     ans = min(ans, newAns);     cout << ans;   }