malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const double EPS = 1e-9;   const long long MOD = 1000000007;   const int inf = 1 << 30;   const long long linf = 1LL << 60;   const double PI = 3.14159265358979323846;   int n, k;   char s[100000];   vector<int> v[2];   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < n; i++) scanf(  %c , s + i);     for (int i = 0; i < n; i++) {       if (s[i] ==  0 )         v[0].push_back(i);       else         v[1].push_back(i);     }     if (v[0].size() == 0 || v[1].size() == 0) {       puts( tokitsukaze );       return 0;     }     if (v[0][v[0].size() - 1] - v[0][0] + 1 <= k ||         v[1][v[1].size() - 1] - v[1][0] + 1 <= k) {       puts( tokitsukaze );       return 0;     }     for (int i = 0; i < n - k + 1; i++) {       for (int j = 0; j < 2; j++) {         if (i <= v[j ^ 1][0] && v[j ^ 1][0] < i + k) {           int pos = lower_bound(v[j ^ 1].begin(), v[j ^ 1].end(), i + k) -                     v[j ^ 1].begin();           if (v[j ^ 1][v[j ^ 1].size() - 1] - v[j ^ 1][pos] + 1 > k) {             puts( once again );             return 0;           }         } else if (i <= v[j ^ 1][v[j ^ 1].size() - 1] &&                    v[j ^ 1][v[j ^ 1].size() - 1] < i + k) {           int pos =               lower_bound(v[j ^ 1].begin(), v[j ^ 1].end(), i) - v[j ^ 1].begin();           pos--;           if (v[j ^ 1][pos] - v[j ^ 1][0] + 1 > k) {             puts( once again );             return 0;           }         } else {           puts( once again );           return 0;         }       }     }     puts( quailty );   }
#include <bits/stdc++.h>   using namespace std;   void inputOutput() {}   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     inputOutput();     string yelo =  AHIMOTUVWXY ;     string s;     cin >> s;     long long int n = s.length();     for (long long int i = 0; i < n; i++) {       if (yelo.find(s[i]) == string::npos) return cout <<  NO , 0;     }     for (long long int i = 0; i < n / 2; i++) {       if (s[i] != s[n - i - 1]) return cout <<  NO , 0;     }     cout <<  YES ;     cerr <<  time elapsed :   << 1.0 * clock() / CLOCKS_PER_SEC <<   sec  n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100, V = 100;   struct bottle {     int a, b;     bool operator<(const bottle &bt) const { return b > bt.b; }   } bot[N + 1];   int dp[N + 1][N * V + 1];   int main() {     int n, shui = 0;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &bot[i].a);       shui += bot[i].a;     }     for (int j = 1; j <= n; ++j) scanf( %d , &bot[j].b);     sort(bot + 1, bot + n + 1);     int ping = 0;     for (int i = 1, w = shui; w > 0; ++i) {       w -= bot[i].b;       ++ping;     }     memset(dp, -1, sizeof dp);     dp[0][0] = 0;     for (int i = 1; i <= n; ++i)       for (int j = ping; j; --j)         for (int k = shui; k >= bot[i].a; --k)           if (~dp[j - 1][k - bot[i].a])             dp[j][k] = max(dp[j][k], dp[j - 1][k - bot[i].a] + bot[i].b);     int mx = 0;     for (int i = shui; ~i; --i)       if (dp[ping][i] >= shui) {         mx = i;         break;       }     printf( %d %d n , ping, shui - mx);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> g[300001];   bool mark[300001];   bool vis[300001];   int road_count = 0;   int main(void) {     int n, m;     cin >> n >> m;     int a, b;     for (int i = 0; i < m; i++) {       cin >> a >> b;       a--;       b--;       g[a].push_back(b);       g[b].push_back(a);     }     memset(mark, 0, sizeof(bool) * n);     queue<int> q;     for (int i = 0; i < n; i++) q.push(i);     while (!q.empty()) {       int x = q.front();       q.pop();       int count = 0;       for (int i = 0; i < g[x].size(); i++) {         if (mark[x] == mark[g[x][i]]) count++;       }       if (count > 1) {         mark[x] = !mark[x];         for (int i = 0; i < g[x].size(); i++) {           if (mark[x] == mark[g[x][i]]) q.push(g[x][i]);         }       }     }     for (int i = 0; i < n; i++) {       if (mark[i])         cout <<  1 ;       else         cout <<  0 ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100005;   struct node {     int id, next;     node() {}     node(int a, int b) {       id = a;       next = b;     }   };   struct Brige {     int x, y;   } brige[maxn];   vector<int> v[maxn], g[maxn];   vector<node> q[maxn];   int dfn[maxn], low[maxn];   int f[maxn], belong[maxn];   bool visit[maxn];   int n, m, k, cnt, t, bge;   void init() {     for (int i = 1; i <= n; i++) {       v[i].clear();       g[i].clear();     }   }   int find(int x) {     if (x != f[x]) f[x] = find(f[x]);     return f[x];   }   void merge(int a, int b) {     int x = find(a), y = find(b);     if (x == y) return;     f[y] = x;   }   void tarjan(int u, int father) {     visit[u] = true;     cnt++;     dfn[u] = low[u] = cnt;     for (int i = 0; i < (int)v[u].size(); i++) {       int x = v[u][i];       if (!visit[x]) {         tarjan(x, u);         low[u] = min(low[u], low[x]);         if (low[x] > dfn[u]) {           bge++;           brige[bge].x = u;           brige[bge].y = x;         }         if (low[x] <= dfn[u]) merge(x, u);       } else if (x != father)         low[u] = min(low[u], dfn[x]);     }   }   void rebuild() {     t = 0;     memset(belong, -1, sizeof(belong));     for (int i = 1; i <= n; i++) {       int x = find(i);       if (belong[x] == -1) {         t++;         belong[x] = t;       }       belong[i] = belong[x];     }     for (int i = 1; i <= bge; i++) {       int a = brige[i].x, b = brige[i].y;       g[belong[a]].push_back(belong[b]);       g[belong[b]].push_back(belong[a]);     }   }   void solve() {     memset(visit, false, sizeof(visit));     cnt = 0;     bge = 0;     for (int i = 1; i <= n; i++) f[i] = i;     tarjan(1, 0);     rebuild();   }   bool Solve[maxn], check[maxn];   int ans[maxn], d[maxn];   void lca(int u) {     visit[u] = true;     for (int i = 0; i < (int)g[u].size(); i++) {       int x = g[u][i];       if (!visit[x]) {         d[x] = d[u] + 1;         lca(x);         f[x] = u;       }     }     check[u] = true;     for (int i = 0; i < (int)q[u].size(); i++) {       int x = q[u][i].next;       if (check[x] == true && Solve[q[u][i].id] == false) {         int ansestor = find(x);         ans[q[u][i].id] = d[u] + d[x] - 2 * d[ansestor];         Solve[q[u][i].id] = true;       }     }   }   int main() {     int a, b;     while (scanf( %d%d , &n, &m) != EOF) {       init();       while (m--) {         scanf( %d%d , &a, &b);         v[a].push_back(b);         v[b].push_back(a);       }       solve();       scanf( %d , &k);       for (int i = 1; i <= k; i++) {         scanf( %d%d , &a, &b);         a = belong[a], b = belong[b];         q[a].push_back(node(i, b));         q[b].push_back(node(i, a));       }       memset(visit, false, sizeof(visit));       memset(Solve, false, sizeof(Solve));       memset(check, false, sizeof(check));       for (int i = 1; i <= t; i++) f[i] = i;       d[1] = 0;       lca(1);       for (int i = 1; i <= k; i++) printf( %d n , ans[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using INT = long long;   int a[200100], b[200100];   map<int, int> mp[2];   int arr[200100];   map<int, int> vst;   int main() {     int n, st;     cin >> n >> st;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     int m, ed;     cin >> m >> ed;     for (int i = 1; i <= m; i++) {       scanf( %d , &b[i]);     }     int d = 1;     int ans = 1;     for (int j = 1; j <= 30; j++) {       mp[0].clear();       mp[1].clear();       int x = (1 << j);       int nn = 0;       for (int i = 1; i <= n; i++) {         int r = a[i] % x;         mp[0][r]++;         ans = max(ans, mp[0][r]);         arr[++nn] = r;       }       for (int i = 1; i <= m; i++) {         int r = b[i] % x;         mp[1][r]++;         ans = max(ans, mp[1][r] + mp[0][(r + x / 2) % x]);         arr[++nn] = r;       }     }     for (int i = 1; i <= n; i++) vst[a[i]] = 1;     for (int i = 1; i <= m; i++)       if (vst[b[i]]) ans = max(ans, 2);     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     set<char> deputi;     vector<vector<char> > off;     int m, n;     char boss;     cin >> n >> m >> boss;     off.resize(n);     for (int i = 0; i < n; i++) off[i].resize(m);     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++) do {           cin >> off[i][j];         } while (off[i][j] ==   n );     for (int i = 0; i < n; i++)       for (int j = 0; j < m; j++)         if (off[i][j] == boss) {           if (i > 0) deputi.insert(off[i - 1][j]);           if (i < n - 1) deputi.insert(off[i + 1][j]);           if (j > 0) deputi.insert(off[i][j - 1]);           if (j < m - 1) deputi.insert(off[i][j + 1]);         }     deputi.erase( . );     deputi.erase(boss);     cout << deputi.size() << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       int a[n];       for (int i = 0; i < n; i++) {         cin >> a[i];       }       for (int num : a) {         m -= num;       }       if (m != 0)         cout <<  NO  << endl;       else         cout <<  YES  << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, res = 0, cp = 0, cn = 0, cz = 0;     cin >> n;     vector<long long> arr(n);     for (long long i = 0; i < n; i++) {       cin >> arr[i];       if (arr[i] > 0)         cp++;       else if (arr[i] < 0)         cn++;       else         cz++;     }     if (cp > (cn + cz)) {       cout <<  1 ;     } else if (cn > (cp + cz)) {       cout <<  -1 ;     } else {       if (cp == (cn + cz) && n % 2 == 0)         cout <<  1 ;       else if (cn == (cp + cz) && n % 2 == 0)         cout <<  -1 ;       else         cout <<  0 ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int inf = 1e9 + 7;   const ll longinf = 1LL << 60;   const ll mod = 1e9 + 7;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     for (int i = 0; i < t; ++i) {       int n;       cin >> n;       cout << n / 2 + 1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int mod = (int)1e9 + 7;   const int N_ = (int)1e6 + 2;   long long Hash_a[N_];   long long Hash_b[N_];   long long pow26[N_];   string a, b;   long long n;   long long get_hash_a(long long x, long long y) {     return (Hash_a[y] - Hash_a[x - 1] * pow26[y - x + 1] + 1LL * mod * mod) % mod;   }   long long get_hash_b(long long x, long long y) {     return (Hash_b[y] - Hash_b[x - 1] * pow26[y - x + 1] + 1LL * mod * mod) % mod;   }   bool F(long long L1, long long R1, long long L2, long long R2) {     int len = R1 - L1 + 1;     if (len % 2 == 1) {       return get_hash_a(L1, R1) == get_hash_b(L2, R2);     } else {       if (get_hash_a(L1, R1) == get_hash_b(L2, R2)) return true;       int R_1 = L1 + len / 2 - 1;       int L_1 = R_1 + 1;       int R_2 = L2 + len / 2 - 1;       int L_2 = R_2 + 1;       if (F(L1, R_1, L_2, R2) && F(L_1, R1, L2, R_2)) return true;       if (F(L1, R_1, L2, R_2) && F(L_1, R1, L_2, R2)) return true;       return false;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> a >> b;     n = a.size();     pow26[0] = 1;     for (int i = 1; i <= n; i++) {       Hash_a[i] = (Hash_a[i - 1] * 26 + (a[i - 1] -  a  + 1)) % mod;       Hash_b[i] = (Hash_b[i - 1] * 26 + (b[i - 1] -  a  + 1)) % mod;       pow26[i] = pow26[i - 1] * 26;       pow26[i] %= mod;     }     if (F(1, n, 1, n))       cout <<  YES ;     else       cout <<  NO ;   }
#include <bits/stdc++.h>   using namespace std;   inline void chkmax(long long &a, long long b) {     if (a < b) a = b;   }   inline void chkmin(long long &a, long long b) {     if (a > b) a = b;   }   inline long long read() {     long long a = 0, fh = 1;     char c = getchar();     while (c >  9  || c <  0 ) {       if (c ==  - ) fh = -1;       c = getchar();     }     while ( 0  <= c && c <=  9 ) {       a = a * 10 + c - 48;       c = getchar();     }     return a * fh;   }   vector<long long> edge[300005];   long long f[300005][2][2], tmp[2][2];   long long n, fa[300005];   void dfs(long long x) {     f[x][0][0] = 1;     f[x][0][1] = 1;     for (long long i = 0; i < edge[x].size(); ++i) {       if (fa[x] == edge[x][i]) continue;       fa[edge[x][i]] = x;       dfs(edge[x][i]);       long long v = edge[x][i];       for (long long j = 0; j < 2; ++j)         for (long long k = 0; k < 2; ++k) tmp[j][k] = f[x][j][k];       f[x][0][0] *= (f[v][0][0] + f[v][1][0] + f[v][1][1]) % 998244353;       f[x][0][1] *= (f[v][0][0] + f[v][1][0] + f[v][1][1]) % 998244353;       f[x][1][0] =           (f[x][1][0] *                ((f[v][0][0] * 2 + f[v][0][1] + f[v][1][1] * 2 + f[v][1][0] * 2) %                 998244353) %                998244353 +            tmp[0][0] * ((f[v][0][0] + f[v][0][1] + f[v][1][1] + f[v][1][0]) %                         998244353)) %           998244353;       f[x][1][1] = (f[x][1][1] *                         ((f[v][0][0] + f[v][1][0] * 2 + f[v][0][1] + f[v][1][1]) %                          998244353) %                         998244353 +                     tmp[0][1] * (f[v][0][0] + f[v][1][0])) %                    998244353;       for (long long j = 0; j < 2; ++j)         for (long long k = 0; k < 2; ++k) f[x][j][k] %= 998244353;     }   }   signed main() {     n = read();     for (long long i = 1; i < n; ++i) {       long long x = read(), y = read();       edge[x].push_back(y);       edge[y].push_back(x);     }     dfs(1);     printf( %lld n ,            (f[1][1][0] + f[1][1][1] + f[1][0][0] - 1 + 998244353) % 998244353);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, p, ans(0);     cin >> n;     map<string, int> mp;     string s;     while (n--) {       cin >> s;       mp[s]++;     }     for (auto x : mp) {       if (x.first ==  Tetrahedron )         p = 4;       else if (x.first ==  Cube )         p = 6;       else if (x.first ==  Octahedron )         p = 8;       else if (x.first ==  Dodecahedron )         p = 12;       else         p = 20;       ans += p * x.second;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   struct ele {     long long a, b;   };   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       struct ele arr[n];       bool issorted = true, zer0 = false, one = false;       for (long long i = 0; i < n; i++) {         cin >> arr[i].a;         if (i > 0 && arr[i].a < arr[i - 1].a) issorted = false;       }       for (long long i = 0; i < n; i++) {         cin >> arr[i].b;         if (arr[i].b == 1)           one = true;         else           zer0 = true;       }       if (issorted)         cout <<  Yes               <<   n ;       else if (one && zer0)         cout <<  Yes               <<   n ;       else         cout <<  No               <<   n ;     }     return 0;   }
#include<bits/stdc++.h>   using namespace std;   #define ll long long   #define ld long double   #define Test int T;cin>>T;while(T--)   #define PI acos(-1)   #define endl   n    #define fx(x) fixed<<setprecision(x)   #define sz(s) (int)s.size()   #define all(v) (v).begin(),(v).end()   #define allr(v) (v).rbegin(),(v).rend()   #define mem(a,n) memset((a),n,sizeof (a))   #define INF 1e9   #define ii pair<ll,ll>   ll gcd(ll x,ll y){return(!y?x:gcd(y,x%y));}   ll lcm(ll x,ll y){return x/gcd(x,y)*y;}   void file(){   #ifndef ONLINE_JUDGE       freopen( in.txt ,  r , stdin);       freopen( out.txt ,  w , stdout);   #else       //freopen( bridges.in ,  r , stdin);       //freopen( bridges.out ,  w , stdout);   #endif   }   void fast(){       ios_base::sync_with_stdio(false);       cin.tie(NULL);       file();   }   int dx[]= {-1,0,1,0};   int dy[]= {0,1,0,-1};   const double eps=1e-9;   const int mod=1e9+7;   const int N=1e5+5;   int a[N];   int ask(int i){       if(a[i])return a[i];       cout<< ?  <<i<<endl;       cout.flush();       int x;cin>>x;       return a[i]=x;   }   int main(){       fast();       int n;       cin>>n;       a[0]=a[n+1]=1e9;       int l=1,r=n;       while(l<=r){           int md=l+r>>1;           int xl=ask(md);           int xr=ask(md+1);           if(xl>=xr){               l=md+1;           }           else r=md-1;       }       cout<< !  <<l<<endl;       cout.flush();       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int qnt, time, felicity, time_to_eat, best = -999999999;     cin >> qnt >> time;     for (int i = 0; i < qnt; i++) {       cin >> felicity >> time_to_eat;       if (time_to_eat <= time && felicity > best) {         best = felicity;       } else if (time_to_eat > time) {         int aux = felicity - (time_to_eat - time);         if (aux > best) {           best = felicity - (time_to_eat - time);         }       }     }     cout << best << endl;     return 0;   }
#include <bits/stdc++.h>   int va[100000], vb[100000];   int main() {     int na, nb, k, m, i, j;     scanf( %d%d%d%d , &na, &nb, &k, &m);     for (i = 0; i < na; i++) scanf( %d , &va[i]);     for (i = 0; i < nb; i++) scanf( %d , &vb[i]);     if (va[k - 1] < vb[nb - m])       printf( YES );     else       printf( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> erat;   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long nd(long long a) {     map<long long, long long> m;     while (a != 1) {       ++m[erat[a]];       a /= erat[a];     }     long long count = 1;     for (auto e : m) count *= e.second + 1;     return count;   }   int main() {     vector<vector<vector<bool> > > count(         8, vector<vector<bool> >(8, vector<bool>(8, true)));     count[1][7][6] = false;     count[3][7][6] = false;     count[5][3][6] = false;     count[5][3][7] = false;     count[5][7][6] = false;     count[7][2][5] = false;     count[7][3][4] = false;     count[7][3][5] = false;     count[7][3][6] = false;     count[7][3][7] = false;     count[7][6][5] = false;     count[7][7][5] = false;     count[7][7][6] = false;     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     erat = vector<long long>(1e5 + 1, 1);     erat[0] = erat[1] = 1;     for (long long i = 2; i <= 1e5; ++i) {       if (erat[i] == 1) {         erat[i] = i;         for (long long j = i * i; j <= 1e5; j += i) {           if (erat[j] == 1) erat[j] = i;         }       }     }     long long t;     cin >> t;     while (t--) {       long long a, b, c;       cin >> a >> b >> c;       long long d = gcd(a, b);       long long e = gcd(a, c);       long long f = gcd(b, c);       long long g = gcd(d, c);       a = nd(a);       b = nd(b);       c = nd(c);       d = nd(d);       e = nd(e);       f = nd(f);       g = nd(g);       d -= g, e -= g, f -= g;       a -= d + e + g, b -= d + f + g, c -= e + f + g;       vector<long long> v(8);       v[1] = a, v[2] = b, v[3] = d, v[4] = c, v[5] = e, v[6] = f, v[7] = g;       long long total = 0;       for (int i = 0; i < 4; ++i) {         for (int j = 0; j < 4; ++j) {           for (int k = 0; k < 4; ++k) {             int l = 2 * i + 1;             int m = 2 + j;             if (j >= 2) m += 2;             int p = 4 + k;             if (count[l][m][p]) {               if (l == m) {                 if (m == p)                   total += v[l] * (v[m] + 1) * (v[p] + 2) / 6;                 else                   total += v[l] * (v[m] + 1) * v[p] / 2;               } else if (l == p or m == p)                 total += v[l] * v[m] * (v[p] + 1) / 2;               else                 total += v[l] * v[m] * v[p];             }           }         }       }       cout << total << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 10;   long long x[maxn], y[maxn];   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     long long n;     cin >> n;     long long s = 0, sx = 0, sy = 0;     for (int i = 0; i < n; i++) {       cin >> x[i] >> y[i];       sx += x[i];       sy += y[i];       s += (n - 1) * (x[i] * x[i]) + (n - 1) * (y[i] * y[i]);     }     for (int i = 0; i < n; i++) {       s -= ((x[i] * (sx - x[i])) + (y[i] * (sy - y[i])));     }     cout << s;     return 0;   }
#include <bits/stdc++.h>   using uint = unsigned int;   using cat = long long;   using dbl = long double;   constexpr dbl pi = 3.14159265358979323846;   using namespace std;   template <typename T>   T abs(T x) {     return (x < 0) ? (-x) : x;   }   cat pw(cat a, cat e, cat mod) {     if (e <= 0) return 1;     cat x = pw(a, e / 2, mod);     x = x * x % mod;     return (e & 1) ? x * a % mod : x;   }   struct fin {     vector<int> T;     fin(int N) { T.resize(N + 10, 0); }     int lastone(int x) { return x & (x ^ (x - 1)); }     void put(int pos, int val) {       for (int i = pos + 1; i < (int)T.size(); i += lastone(i)) T[i] += val;     }     int get(int pos) {       int ret = 0;       for (int i = pos + 1; i > 0; i -= lastone(i)) ret += T[i];       return ret;     }   };   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(10);     int N;     cat K;     cin >> N >> K;     K = 1LL * N * (N - 1) / 2 - K + 1;     vector<pair<cat, cat> > P(N);     for (int i = 0; i < N; i++) cin >> P[i].first >> P[i].second;     dbl ans_le = 0, ans_gt = 1e5;     while (ans_gt - ans_le > 1e-8) {       dbl R = (ans_le + ans_gt) / 2;       vector<pair<dbl, int> > events;       for (int i = 0; i < N; i++) {         dbl d = sqrt(P[i].first * P[i].first + P[i].second * P[i].second);         if (d < R + 1e-8) continue;         dbl ang_c = atan2(P[i].second, P[i].first);         if (ang_c < 0) ang_c = 2 * pi + ang_c;         dbl ang_d = acos(R / d);         if (ang_c - ang_d < 1e-8) {           events.push_back({ang_c + ang_d, 2 * i});           events.push_back({ang_c - ang_d, 2 * i + 1});           events.push_back({ang_c - ang_d + 2 * pi, 2 * i + 1});         } else if (ang_c + ang_d > 2 * pi - 1e-8) {           events.push_back({ang_c + ang_d - 2 * pi, 2 * i});           events.push_back({ang_c - ang_d, 2 * i + 1});           events.push_back({ang_c - ang_d - 2 * pi, 2 * i + 1});         } else {           events.push_back({ang_c + ang_d, 2 * i});           events.push_back({ang_c - ang_d, 2 * i + 1});         }       }       sort(begin(events), end(events));       vector<int> last_open(N, -1);       cat cnt = 0;       fin F(events.size());       for (int i = 0; i < (int)events.size(); i++) {         int id = events[i].second / 2;         if (events[i].second % 2 == 0) {           if (last_open[id] != -1) {             F.put(events.size() - last_open[id], -1);             cnt += F.get(events.size() - last_open[id]);             last_open[id] = -1;           }         } else {           last_open[id] = i;           F.put(events.size() - i, 1);         }       }       if (cnt >= K)         ans_le = R;       else         ans_gt = R;     }     cout << ans_le <<   n ;   }