malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>      using namespace std;      #define inf          1e15   #define mod          1000000007   #define N            100001   #define ll           long long int   #define vint         vector<int>   #define vll          vector<ll>   #define vstr         vector<string>   #define vvint        vector<vector<int> >   #define vvll         vector<vector<ll> >   #define vint_pair    vector<pair<int,int> >   #define input(arr)   for(auto &x:arr) cin>>x;   #define all(x)       (x).begin(), (x).end()   #define rall(x)      (x).rbegin(), (x).rend()      int main() {       ios_base::sync_with_stdio(false);       cin.tie(0);       cout.tie(0);       int t=1;       cin>>t;       while(t--){           int n;           cin>>n;           set<int>num;           vint arr(n);           for(int i=0;i<n;++i){               cin>>arr[i];               num.insert(arr[i]);           }           int vis[n+1];           memset(vis, 0, sizeof(vis));           int l = 1;           for(int i=0;i<n;++i){               if(vis[arr[i]]){                   cout<<l<<   ;                   vis[l] = 1;               }               else{                   cout<<arr[i]<<   ;                   vis[arr[i]] = 1;               }               while(vis[l]){                   ++l;               }           }           cout<<  n ;           set<int>st;           memset(vis, 0, sizeof(vis));           for(int i=1;i<=n;++i){               if(num.find(i)==num.end()){                   st.insert(i);               }           }           for(int i=0;i<n;++i){               if(!vis[arr[i]]){                   cout<<arr[i]<<   ;                   vis[arr[i]] = 1;               }               else{                   auto it = st.lower_bound(arr[i]);                   --it;                   int tmp = *it;                   cout<<tmp<<   ;                   vis[tmp] = 1;                   st.erase(tmp);               }           }           cout<<  n ;       }   }
#include <bits/stdc++.h>   using namespace std;   int sumdigs(int x) {     int c = 0;     while (x) {       c += x % 10;       x /= 10;     }     return c;   }   int main() {     int a;     cin >> a;     if (sumdigs(a) % 4 == 0)       cout << a;     else {       for (int i = a; i < 1000000; i++) {         if (sumdigs(i) % 4 == 0) {           cout << i;           return 0;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e3 + 5;   int n, m, k;   int a[maxn], c[maxn];   int ans, tmp, cnt, rt, sum, ma;   int flag;   char s[maxn];   bool ok[maxn];   vector<int> vc[maxn], vv[maxn];   template <typename T>   inline void read(T &X) {     X = 0;     int w = 0;     char ch = 0;     while (!isdigit(ch)) {       w |= ch ==  - ;       ch = getchar();     }     while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();     if (w) X = -X;   }   pair<int, int> query(int id) {     printf( ? %d , vv[id].size());     for (int i = 0; i < vv[id].size(); i++) {       printf(  %d , vv[id][i]);     }     puts(  );     fflush(stdout);     int x, y;     read(x);     read(y);     return make_pair(x, y);   }   void dfs(int u, int fa, int dep) {     ma = max(ma, dep);     vv[dep].push_back(u);     for (int i = 0; i < vc[u].size(); i++) {       int v = vc[u][i];       if (v == fa) continue;       dfs(v, u, dep + 1);     }   }   int jud(int as) {     pair<int, int> k = query(as);     if (k.second > sum) return 1;     rt = k.first;     return 0;   }   int main() {     int T, cas = 1;     cin >> T;     while (T--) {       read(n);       ans = 0;       for (int i = (0); i <= (n + 1); i++) {         vc[i].clear();         vv[i].clear();       }       for (int i = (1); i <= (n - 1); i++) {         int x, y;         read(x);         read(y);         vc[x].push_back(y);         vc[y].push_back(x);         vv[n + 1].push_back(i);       }       vv[n + 1].push_back(n);       pair<int, int> tp = query(n + 1);       rt = tp.first;       sum = tp.second;       ma = 0;       dfs(rt, -1, 0);       ma = min(ma, sum);       int l = (sum + 1) / 2, r = ma + 1, tmp;       while (l < r) {         int mid = (l + r) >> 1;         if (jud(mid)) {           r = mid;         } else {           l = mid + 1;           tmp = mid;         }       }       for (int i = (0); i <= (n); i++) vv[i].clear();       dfs(rt, -1, 0);       tp = query(sum);       printf( ! %d %d n , rt, tp.first);       fflush(stdout);       scanf( %s , s);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void si(T &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;   }   long long bigmod(long long p, long long e, long long M) {     long long ret = 1;     for (; e > 0; e >>= 1) {       if (e & 1) ret = (ret * p) % M;       p = (p * p) % M;     }     return ret;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long modinverse(long long a, long long M) { return bigmod(a, M - 2, M); }   void io() { freopen( /Users/MyMac/Desktop/in.txt ,  r , stdin); }   const int N = 1e6 + 6;   long long nxt[N];   const long long MOD = 1e9 + 7;   bool vis[N];   void dfs(int u) {     if (vis[u]) return;     vis[u] = 1;     dfs(nxt[u]);   }   int main() {     long long p, k;     cin >> p >> k;     if (k == 0) {       long long ans = 1;       for (int i = 0; i < p - 1; i++) {         ans *= p;         ans %= MOD;       }       cout << ans << endl;       return 0;     }     if (k == 1) {       long long ans = 1;       for (int i = 0; i < p; i++) {         ans *= p;         ans %= MOD;       }       cout << ans << endl;       return 0;     }     for (long long i = 0; i < p; i++) {       nxt[i * k % p] = i;     }     long long ans = 1;     for (int i = 1; i < p; i++) {       if (vis[i] == 0) {         dfs(i);         ans *= p;         ans %= MOD;       }     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3F3F3F3F;   const long long INF_LL = 0x3F3F3F3F3F3F3F3FLL;   const int N = 4e5 + 50;   bool check(const string &s, const string &t) {     int match = 0;     for (int i = 0; i < s.size() && match < t.size(); ++i) {       if (s[i] == t[match]) ++match;     }     return match == t.size();   }   int main() {     string s, t;     cin >> s >> t;     int ans = 0;     for (int i = 0; i < int(s.size()); ++i) {       for (int j = i; j < int(s.size()); ++j) {         string tmp = s;         tmp.erase(tmp.begin() + i, tmp.begin() + j + 1);         if (check(tmp, t)) ans = max(ans, j - i + 1);       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 4e5 + 10, LOG = 20;   int n, q, F[N], T[N], P[N], D[N], Par[LOG][N];   pair<int, int> Q[N];   vector<int> Adj[N], Ap[N], V[N << 2];   void Pre(int v) {     for (int i = 1; i < LOG; i++) Par[i][v] = Par[i - 1][Par[i - 1][v]];     for (auto X : Adj[v])       if (X != Par[0][v]) Par[0][X] = v, D[X] = D[v] + 1, Pre(X);   }   int LCA(int v, int u) {     if (D[v] < D[u]) return (LCA(u, v));     for (int i = 0; i < LOG; i++)       if ((D[v] - D[u]) & (1 << i)) v = Par[i][v];     if (v == u) return (v);     for (int i = LOG - 1; ~i; i--)       if (Par[i][v] != Par[i][u]) v = Par[i][v], u = Par[i][u];     return (Par[0][v]);   }   int Dist(int v, int u) { return (D[v] + D[u] - 2 * D[LCA(v, u)]); }   int Find(int v) {     if (P[v] < 0) return (v);     return (Find(P[v]));   }   void Add(int i, int le, int ri, int id = 1, int l = 0, int r = q + 2) {     if (ri <= l || r <= le) return;     if (le <= l && r <= ri) {       V[id].push_back(i);       return;     }     Add(i, le, ri, id * 2, l, (l + r) >> 1);     Add(i, le, ri, id * 2 + 1, (l + r) >> 1, r);   }   void DFS(int id, int l = 0, int r = q + 2) {     vector<pair<int, pair<int, int> > > Op;     for (auto i : V[id])       if (Find(F[i]) != Find(T[i])) {         int v = Find(F[i]), u = Find(T[i]);         if (P[v] > P[u]) swap(v, u);         Op.push_back({u, {v, P[u]}});         P[v] += P[u];         P[u] = v;       }     if (r - l == 1)       if (Q[l].first > 0) {         if (Find(Q[l].first) == Find(Q[l].second))           printf( %d n , Dist(Q[l].first, Q[l].second));         else           puts( -1 );       }     if (r - l > 1) DFS(id * 2, l, (l + r) >> 1), DFS(id * 2 + 1, (l + r) >> 1, r);     reverse(Op.begin(), Op.end());     for (auto X : Op)       P[X.first] = X.second.second, P[X.second.first] -= P[X.first];   }   int main() {     scanf( %d , &n);     for (int i = 1; i < n; i++)       scanf( %d%d , &F[i], &T[i]), Ap[i].push_back(0), Adj[F[i]].push_back(T[i]),           Adj[T[i]].push_back(F[i]);     scanf( %d , &q);     int tp, v, u;     for (int i = 1; i <= q; i++) {       scanf( %d%d , &tp, &v);       if (tp < 3)         Ap[v].push_back(i);       else         scanf( %d , &u), Q[i] = {v, u};     }     for (int i = 1; i < n; i++) {       Ap[i].push_back(q + 1);       for (int j = 1; j < Ap[i].size(); j += 2) Add(i, Ap[i][j - 1], Ap[i][j]);     }     memset(P, -1, sizeof(P));     Pre(1);     DFS(1);     return (0);   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   template <class T>   void chkmin(T &x, const T &y) {     if (y < x) {       x = y;     }   }   template <class T>   void chkmax(T &x, const T &y) {     if (y > x) {       x = y;     }   }   template <class T>   void sort(vector<T> &a) {     sort(a.begin(), a.end());   }   template <class T, class Cmp>   void sort(vector<T> &a, Cmp cmp) {     sort(a.begin(), a.end(), cmp);   }   template <class T>   void unique(vector<T> &a) {     a.resize(unique(a.begin(), a.end()) - a.begin());   }   int readInt() {     int x = 0;     char c = getchar();     while (!isdigit(c)) {       c = getchar();     }     while (isdigit(c)) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x;   }   string readString() {     string s;     char c = getchar();     while (isspace(c)) {       c = getchar();     }     while (!isspace(c)) {       s += c;       c = getchar();     }     return s;   }   void solve_single_test(int test_id = 1) {     int a = readInt();     int b = readInt();     int n = a + b;     int ans = 0;     for (int l = 1, r; l <= n; l = r + 1) {       int t = n / l;       r = n / t;       if ((a + t) / (t + 1) > a / t || (b + t) / (t + 1) > b / t) {         continue;       }       int L = max(l, (a + t) / (t + 1) + (b + t) / (t + 1));       int R = min(r, a / t + b / t) + 1;       if (L < R) {         ans += R - L;       }     }     printf( %d n , ans);   }   void solve_multiple_tests() {     int n_tests;     scanf( %d , &n_tests);     for (int i = 1; i <= n_tests; ++i) {       solve_single_test(i);     }   }   int main() {     solve_single_test();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, i, k, u, v, cnt;   int head[300005], a[300005];   long long f[300005], ans;   struct ff {     int to, nxt;   } e[2 * 300005];   int fast() {     int res = 0, fl = 1;     char c = getchar();     while (c < 48 || c > 57) {       if (c ==  - ) fl = -1;       c = getchar();     }     while (c >= 48 && c <= 57) res = res * 10 + c - 48, c = getchar();     return res * fl;   }   void write(long long x) {     if (x > 9) write(x / 10);     putchar(x % 10 + 48);   }   void add(int u, int v) {     e[++cnt] = (ff){v, head[u]};     head[u] = cnt;   }   void dfs(int now, int fa, int fl) {     f[now] = a[now];     for (int i = head[now]; i; i = e[i].nxt) {       int v = e[i].to;       if (v == fa) continue;       dfs(v, now, fl);       if (f[v] > 0) f[now] += f[v];     }     if (fl)       ans = max(ans, f[now]);     else if (ans == f[now])       k++, f[now] = -1;   }   int main() {     n = fast();     for (i = 1; i <= n; i++) a[i] = fast();     for (i = 1; i < n; i++) {       u = fast(), v = fast();       add(u, v), add(v, u);     }     ans = -(long long)1e16;     dfs(1, 0, 1);     dfs(1, 0, 0);     printf( %lld %d n , ans * k, k);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     bool flag = true;     while (cin >> n >> m) {       for (int i = 0; i < n; i++) {         for (int j = 1; j <= m; j++) {           if (i % 2 && j < m && flag)             cout <<  . ;           else if (i % 2 && j == m && flag)             cout <<  # ;           else if (i % 2 && j == 1 && !flag)             cout <<  # ;           else if (i % 2 && j > 1 && !flag)             cout <<  . ;           else             cout <<  # ;         }         if (i % 2) flag = !flag;         cout <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int max_x = 1000, inf = 1000111222;   const int max_bal = 2222;   const int sd = max_bal / 2;   int a;   pair<int, pair<int, int>> par[max_x][max_bal];   bool dp[max_x][max_bal];   int get_sum(int x) {     int sum = 0;     while (x) {       sum += x % 10;       x /= 10;     }     return sum;   }   int main() {     cin >> a;     queue<pair<int, int>> q;     dp[0][sd] = 1;     q.push({0, sd});     while (!q.empty()) {       pair<int, int> p = q.front();       q.pop();       for (int d = 0; d <= 9; ++d) {         int y = p.first + a * d;         int to = y / 10;         int w = d - a * (y % 10);         if (p.second + w >= 0 && p.second + w < max_bal &&             !dp[to][p.second + w]) {           dp[to][p.second + w] = 1;           par[to][p.second + w] = {d, p};           q.push({to, p.second + w});         }       }     }     for (int i = 1; i < max_x; ++i) {       int need = get_sum(i) * a + sd;       if (need < max_bal && dp[i][need]) {         string ans;         int x = i, bal = need;         while (x != 0 || bal != sd) {           ans +=  0  + par[x][bal].first;           if (ans ==  0 ) {             ans =   ;           }           int nx = par[x][bal].second.first;           int nbal = par[x][bal].second.second;           x = nx;           bal = nbal;         }         cout << ans << endl;         return 0;       }     }     cout << -1 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int INF = 1000000000;   vector<vector<int> > v;   int* dist;   void bfs(int ver, int n) {     bool vis[n];     for (int i = 0; i < n; i++) vis[i] = false;     vis[ver] = true;     queue<pair<int, int> > q;     q.push(make_pair(ver, 0));     while (!q.empty()) {       pair<int, int> p = q.front();       q.pop();       int a = p.first, b = p.second;       dist[a] = b;       for (int i = 0; i < v[a].size(); i++) {         if (vis[v[a][i]] == false) {           vis[v[a][i]] = true;           q.push(make_pair(v[a][i], b + 1));         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     int n, m;     cin >> n >> m;     vector<vector<int> > vt(n);     v = vt;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       x -= 1;       y -= 1;       v[y].push_back(x);       vt[x].push_back(y);     }     int k;     cin >> k;     vector<int> path(k);     for (int i = 0; i < k; i++) {       int x;       cin >> x;       x -= 1;       path[i] = x;     }     dist = new int[n];     bfs(path[k - 1], n);     vector<pair<int, int> > pos(k, make_pair(0, 0));     for (int i = 1; i < k; i++) {       int ver = path[i - 1], pver = path[i];       vector<pair<int, int> > t;       for (int j = 0; j < vt[ver].size(); j++)         t.push_back(make_pair(dist[vt[ver][j]], vt[ver][j]));       int md = t[0].first;       for (int j = 1; j < t.size(); j++) md = min(md, t[j].first);       for (int j = 0; j < t.size(); j++) {         if (t[j].first == md and t[j].second == pver) pos[i].first = 1;         if (t[j].first == md and t[j].second != pver) pos[i].second = 1;       }     }     int mans = 0, Mans = 0;     for (int i = 1; i < k; i++) {       if (pos[i].first != 1) mans += 1;       if (pos[i].second == 1) Mans += 1;     }     cout << mans <<     << Mans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int arr[100005];   int ans[100005][3], alen;   struct node {     int n, cnt;     bool friend operator<(node a, node b) { return a.cnt < b.cnt; }   } n1, n2, n3;   priority_queue<node> qu;   int blen = 0;   int main() {     scanf( %d , &n);     int i, j;     for (i = 0; i < n; i++) scanf( %d , arr + i);     sort(arr, arr + n);     n1.n = arr[0];     n1.cnt = 1;     for (i = 1; i < n; i++) {       if (arr[i] == arr[i - 1]) {         n1.cnt++;       } else {         qu.push(n1);         n1.cnt = 1;         n1.n = arr[i];       }     }     qu.push(n1);     while (qu.size() > 2) {       n1 = qu.top();       qu.pop();       n2 = qu.top();       qu.pop();       n3 = qu.top();       qu.pop();       ans[alen][0] = n1.n;       ans[alen][1] = n2.n;       ans[alen][2] = n3.n;       sort(ans[alen], ans[alen] + 3);       alen++;       n1.cnt--;       n2.cnt--;       n3.cnt--;       if (n1.cnt != 0) qu.push(n1);       if (n2.cnt != 0) qu.push(n2);       if (n3.cnt != 0) qu.push(n3);     }     printf( %d n , alen);     for (i = 0; i < alen; i++) {       for (j = 2; j > 0; j--) {         printf( %d  , ans[i][j]);       }       printf( %d n , ans[i][0]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n = 6;     int x, f[12] = {0};     for (int i = 0; i < n; i++) {       cin >> x;       f[x]++;     }     bool res = 0;     for (int i = 0; i < 10; i++) {       if (f[i] >= 4) {         res = 1;         f[i] -= 4;         for (int j = 0; j < 10; j++) {           if (f[j] == 2) {             cout <<  Elephant n ;             return 0;           } else if (f[j]) {             cout <<  Bear n ;             return 0;           }         }       }     }     cout <<  Alien n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m = 0, m1 = 0, l, q[1000], t;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> q[i];     }     cin >> t;     sort(q, q + n);     for (int i = 0; i < n; i++) {       l = 1;       for (int j = i + 1; j < n; j++) {         if (q[j] - q[i] <= t) l++;       }       if (l > m) m = l;     }     cout << m;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void debug_out() { cerr <<   n ; }   template <typename H, typename... T>   void debug_out(H h, T... t) {     cerr <<     << (h);     debug_out(t...);   }   int n;   string a, b;   char flip(char ch) { return (char)( 0  + ( 1  - ch)); }   char ch(int i, int cnt) { return (char)( 0  + ((a[i] -  0  + cnt) % 2)); }   void solve() {     cin >> n >> a >> b;     vector<int> res;     int first = 0;     int last = n - 1;     int cnt = 0;     for (int i = n - 1; i >= 0; i--) {       if (ch(last, cnt) != b[i]) {         if (ch(first, cnt) == b[i]) {           res.push_back(1);           a[first] = flip(a[first]);         }         if (i or ch(first, cnt) != b[i]) {           res.push_back(i + 1);           cnt++;           swap(first, last);         }       }       if (cnt % 2) {         last++;       } else {         last--;       }     }     cout << res.size();     for (auto i : res) cout <<     << i;     cout <<   n ;   }   int main() {     int t;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Edge {     int u, v, w;   };   const int N = 500005;   int n, m, q;   Edge edge[N];   vector<int> sorted_edge[N];   vector<pair<int, vector<int>>> query[N];   bool npos[N];   int par[N], rnk[N];   vector<int> rnk_roll, par_roll;   void init() {     for (int i = 1; i <= n; i++) par[i] = i, rnk[i] = 1;   }   int get(int u, bool roll = false) {     if (u == par[u]) return u;     if (roll) return get(par[u], roll);     return par[u] = get(par[u], roll);   }   bool merge(int u, int v, bool roll = false) {     u = get(u, roll), v = get(v, roll);     if (u == v) return false;     if (rnk[u] < rnk[v]) swap(u, v);     if (roll) par_roll.push_back(v);     par[v] = u;     if (rnk[u] == rnk[v]) {       rnk[u]++;       rnk_roll.push_back(u);     }     return true;   }   void rollback() {     for (auto u : rnk_roll) rnk[u]--;     for (auto u : par_roll) par[u] = u;     rnk_roll.clear();     par_roll.clear();   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       scanf( %d%d%d , &edge[i].u, &edge[i].v, &edge[i].w);       sorted_edge[edge[i].w].push_back(i);     }     scanf( %d , &q);     for (int i = 0, k; i < q; i++) {       scanf( %d , &k);       vector<int> elt(k);       for (int i = 0; i < k; i++) scanf( %d , &elt[i]);       sort(elt.begin(), elt.end(),            [](int i, int j) { return edge[i].w < edge[j].w; });       int it = 0, j;       do {         vector<int> ei;         for (j = it; j < k && edge[elt[j]].w == edge[elt[it]].w; j++)           ei.push_back(elt[j]);         query[edge[elt[it]].w].push_back({i, ei});         it = j;       } while (it < k);     }     init();     for (int i = 1; i < N; i++) {       for (auto qq : query[i]) {         int qid = qq.first;         for (auto e : qq.second) {           if (!merge(edge[e].u, edge[e].v, true)) {             npos[qid] = true;             break;           }         }         rollback();       }       for (auto e : sorted_edge[i]) merge(edge[e].u, edge[e].v);     }     for (int i = 0; i < q; i++) {       printf( %s n , npos[i] ?  NO  :  YES );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long points[1002][2];   long long circle[1002][3];   vector<long long> tree[1002];   bool mark[1002];   vector<long long> paths[1002];   long long inside[1002];   long long dist2(long long a, long long b, long long c, long long d) {     return (a - c) * (a - c) + (b - d) * (b - d);   }   void dfs(long long v, long long parent) {     mark[v] = 1;     if (parent != -1) paths[v] = paths[parent];     paths[v].push_back(v);     for (long long i = 0; i < tree[v].size(); i++)       if (!mark[tree[v][i]]) dfs(tree[v][i], v);   }   int main() {     long long n, m, k, a, b, p;     cin >> n >> m >> k;     for (long long i = 0; i < n; i++) cin >> points[i][0] >> points[i][1];     for (long long i = 0; i < m; i++)       cin >> circle[i][0] >> circle[i][1] >> circle[i][2];     for (long long i = 0; i < m; i++) {       long long parent = m;       long long min_radius = 2000000000;       for (long long j = 0; j < m; j++) {         if (circle[j][0] <= circle[i][0]) continue;         if (dist2(circle[i][1], circle[i][2], circle[j][1], circle[j][2]) >             circle[j][0] * circle[j][0])           continue;         if (min_radius > circle[j][0]) {           parent = j;           min_radius = circle[j][0];         }       }       tree[parent].push_back(i);     }     for (long long i = 0; i < n; i++) {       long long parent = m;       long long min_radius = 2000000000;       for (long long j = 0; j < m; j++) {         if (dist2(points[i][0], points[i][1], circle[j][1], circle[j][2]) >             circle[j][0] * circle[j][0])           continue;         if (min_radius > circle[j][0]) {           parent = j;           min_radius = circle[j][0];         }       }       inside[i] = parent;     }     dfs(m, -1);     for (long long i = 0; i < k; i++) {       cin >> a >> b;       a = inside[a - 1];       b = inside[b - 1];       p = 0;       while (p < min(paths[a].size(), paths[b].size()) &&              paths[a][p] == paths[b][p])         p++;       cout << (long long)paths[a].size() + (long long)paths[b].size() - p - p            << endl;     }     return 0;   }