malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, c, e;     char s[100];     scanf( %d%d%*d.%d , &n, &m, &c);     map<string, int> u;     for (int i = 0; i < n; i++) {       scanf( %s%d , s, &e);       if (e * c / 100 >= 100) u[s] = e * c / 100;     }     for (int i = 0; i < m; i++) {       scanf( %s , s);       u[s];     }     printf( %d n , int(u.size()));     for (auto& x : u) printf( %s %d n , x.first.c_str(), x.second);   }
#include <bits/stdc++.h>   using namespace std;   vector<int> a[1000100], b[1000100], ans;   stack<int> st;   int n, m;   bool del[1000100], used[1001000];   int main() {     scanf( %d%d , &n, &m);     int i;     for (i = 1; i <= m; i++) {       int u, v;       scanf( %d%d , &u, &v);       a[u].push_back(v);       b[v].push_back(u);     }     memset(del, 0, sizeof(del));     for (i = 1; i <= n; i++) {       if (del[i]) continue;       del[i] = 1;       st.push(i);       int len = a[i].size(), j;       for (j = 0; j < len; j++) del[a[i][j]] = 1;     }     memset(used, 0, sizeof(used));     while (!st.empty()) {       int u = st.top();       st.pop();       used[u] = 1;       int j, len = b[u].size();       for (j = 0; j < len; j++)         if (used[b[u][j]]) {           used[u] = 0;           break;         }       if (used[u]) ans.push_back(u);     }     int len = ans.size();     printf( %d n , ans.size());     for (i = 0; i < len; i++) printf( %d  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   long long i, j, n;   int ar[N];   int main() {     for (int i = 2; i < N; i++) {       for (int j = i + i; j < N; j += i) {         ar[j] += j / i;       }     }     cin >> n;     long long sum = 0;     for (int i = 2; i <= n; i++) sum += ar[i];     cout << 4 * sum << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   int trie[5000005][2];   int n, cnt;   inline int read() {     int t = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       t = (t << 3) + (t << 1) + (ch ^ 48);       ch = getchar();     }     return t;   }   inline void write(int t) {     if (t > 9) {       write(t / 10);     }     putchar(t % 10 +  0 );   }   inline void insert(int t) {     int pos = 0;     for (int i = 29; i >= 0; i--) {       int x = (t >> i) & 1;       if (!trie[pos][x]) {         trie[pos][x] = ++cnt;       }       pos = trie[pos][x];     }   }   inline int solve(int t, int cur) {     if (t == -1) {       return 0;     }     if (!trie[cur][0]) {       return solve(t - 1, trie[cur][1]);     } else if (!trie[cur][1]) {       return solve(t - 1, trie[cur][0]);     } else {       return (1 << t) +              min(solve(t - 1, trie[cur][0]), solve(t - 1, trie[cur][1]));     }   }   int main() {     n = read();     while (n--) {       insert(read());     }     write(solve(29, 0));     putchar(10);     return 0;   }
#include <bits/stdc++.h>   inline long long read() {     long long x = 0;     char ch = getchar(), w = 1;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * w;   }   void write(long long x) {     if (x < 0) putchar( - ), x = -x;     if (x > 9) write(x / 10);     putchar(x % 10 +  0 );   }   inline void writeln(long long x) {     write(x);     puts(  );   }   using namespace std;   const int N = 3e5 + 666;   long long a[N], n;   const long long mo = 998244353;   long long ksm(long long x, long long y) {     long long res = 1;     for (; y; y >>= 1, x = x * x % mo)       if (y & 1) res = res * x % mo;     return res;   }   int main() {     n = read();     long long inv = ksm(100, mo - 2);     for (int i = 1; i <= n; ++i) a[i] = read() * inv % mo;     long long e1 = 0, s = 1;     for (int i = 1; i <= n; ++i) {       e1 += s;       s *= a[i] % mo;       s %= mo;       e1 %= mo;     }     e1 = e1 * ksm(s, mo - 2) % mo;     long long ans = 0;     for (int i = n; i >= 1; --i) {       ans = ans * a[i] % mo + (1 - a[i] + mo) * e1 % mo;       ans += 1;       ans %= mo;     }     writeln(ans);     return 0;   }
#include <bits/stdc++.h>   #define mid (tl+tr)/2   #define mod 1000000007   #define fain(arr) for(ll i=0;i<n;i++)cin>>arr[i];   #define all(x) x.begin(),x.end()   #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);   #define bugv(n1) if(DEBUG)cout<<#n1<<  is  <<n1<<  n ;   #define buga(A) cout<<#A<<  is : <<endl ; for(auto x:A)cout<<x<<   ; cout<<endl;   #define FILE freopen( input.txt , r ,stdin);   #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))   #define endl   n    #define ll long long    #define pii pair<ll,ll>   #define pll pair<long long ,long long >   #define pi acos(-1)   #define sz(x) ((ll)x.size())   #define clr(x) memset(x, 0, sizeof(x))   #define init(x, a) memset(x, a, sizeof(x))   #define DEBUG true   using namespace std;      int main(){    // FILE;    SPEED;    ll t;    cin>>t;    while(t--){          int n,m;          cin>>n>>m;             char arr[n][m];             for(int i=0;i<n;i++){           for(int j=0;j<m;j++){            cin>>arr[i][j];           }          }                int left[n][m];          int right[n][m];          int up[n][m];             for(int i=0;i<n;i++){            for(int j=m-1;j>=0;j--){              if(j==m-1){                right[i][j]=arr[i][j]== * ?1:0;              }              else{               if(arr[i][j]== * )               right[i][j]=right[i][j+1]+1;               else               right[i][j]=0;              }            }          }              for(int i=0;i<n;i++){            for(int j=0;j<m;j++){              if(j==0){                left[i][j]=arr[i][j]== * ?1:0;              }              else{               if(arr[i][j]== * )               left[i][j]=left[i][j-1]+1;               else               left[i][j]=0;              }            }          }          int ans=0;          for(int i=0;i<n;i++){            for(int j=0;j<m;j++){              if(i==0){                up[i][j]=arr[i][j]== * ?1:0;              }              else{               up[i][j]=min({left[i][j],right[i][j],1+up[i-1][j]});              }              ans+=up[i][j];            }          }             cout<<ans<<endl;       }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 100;   int n;   int t[2][N];   vector<int> vals[N];   vector<pair<int, int>> G[N];   bool vis[N];   int color[N];   vector<int> C[2];   bool cycle;   void dfs(int v) {     vis[v] = true;     C[color[v]].push_back(v);     for (auto it : G[v]) {       if (vis[it.first] && (color[v] ^ it.second) != color[it.first])         cycle = true;       if (!vis[it.first]) {         color[it.first] = color[v] ^ it.second;         dfs(it.first);       }     }   }   void solve() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) G[i].clear(), vals[i].clear();     for (int j = 0; j <= 1; ++j)       for (int i = 1; i <= n; ++i) {         scanf( %d , &t[j][i]);         vals[t[j][i]].push_back(i);       }     for (int i = 1; i <= n; ++i) {       if ((int)vals[i].size() != 2) {         printf( -1 n );         return;       }       int u = vals[i][0], v = vals[i][1], w;       if (u == v) continue;       w = ((t[0][u] == t[0][v] && t[0][u] == i) ||            (t[1][u] == t[1][v] && t[1][u] == i));       G[u].push_back(make_pair(v, w));       G[v].push_back(make_pair(u, w));     }     cycle = false;     for (int i = 1; i <= n; ++i) vis[i] = false;     vector<int> ans;     for (int i = 1; i <= n; ++i)       if (!vis[i]) {         for (int j = 0; j <= 1; ++j) C[j].clear();         dfs(i);         if ((int)C[0].size() > (int)C[1].size()) swap(C[0], C[1]);         for (auto it : C[0]) ans.push_back(it);       }     if (cycle) printf( -1 n );     printf( %d n , (int)ans.size());     for (auto it : ans) printf( %d  , it);     printf(  n );   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:16777216 )   using namespace std;   const double PI = 2.0 * acos(0.0);   const int MAXN = 33;   int n, m;   string s;   bool d1[26];   bool d2[700];   int encode(char x, char y) { return (x -  a ) * 26 + (y -  a ); }   int main() {     memset(d1, false, sizeof(d1));     memset(d2, false, sizeof(d2));     cin >> n;     for (int i = 0, _n = (n); i < _n; i++) {       cin >> s;       m = s.length();       for (int j = 0, _n = (m); j < _n; j++) {         d1[s[j] -  a ] = true;         if (j + 1 < m) d2[encode(s[j], s[j + 1])] = true;       }     }     char r1, r2;     int x;     for (int i = 0, _n = (26); i < _n; i++) {       if (!d1[i]) {         r1 =  a  + i;         cout << r1 << endl;         return 0;       }     }     for (int i = 0, _n = (700); i < _n; i++) {       if (!d2[i]) {         r1 =  a  + (i / 26);         r2 =  a  + (i % 26);         cout << r1 << r2 << endl;         return 0;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, m, t;     scanf( %d %d %d %d , &n, &k, &m, &t);     for (int i = 1; i <= t; ++i) {       int x, y;       scanf( %d %d , &x, &y);       if (x) {         if (y <= k) {           k++;         }         n++;         printf( %d %d n , n, k);       } else {         if (y < k) {           k -= y;           n -= y;         } else {           n -= (n - y);         }         printf( %d %d n , n, k);       }     }   }
#pragma GCC optimize(2)   #include <bits/stdc++.h>   #define all(n) (n).begin(), (n).end()   #define se second   #define fi first   #define pb push_back   #define mp make_pair   #define sqr(n) (n) * (n)   #define rep(i, a, b) for (int i = (a); i <= (b); ++i)   #define per(i, a, b) for (int i = (a); i >= (b); --i)   #define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)   using namespace std;   typedef long long ll;   typedef unsigned long long ull;   typedef pair<int, int> PII;   typedef pair<ll, ll> PLL;   typedef vector<int> VI;   typedef double db;       template<class T1, class T2> bool umin(T1& a, T2 b) { return a > b ? (a = b, true) : false; }   template<class T1, class T2> bool umax(T1& a, T2 b) { return a < b ? (a = b, true) : false; }   template<class T> void clear(T& a) { T().swap(a); }       const int N = 2e5 + 5;       int n, m, _, k;   ll a[N];       int main() {    IOS;    for (cin >> _; _; --_) {     cin >> n; ll mx = -1, s = 0;           rep (i, 1, n) cin >> a[i], umax(mx, a[i]), s += a[i];           ll ans = mx * (n - 1ll) - s;           if (ans < 0) ans = (ans % (n - 1) + (n - 1)) % (n - 1);           cout << ans <<   n ;       }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9 + 7;   using namespace std;   int n, m;   string s;   int prime(int x) {     if (x == 1) return 0;     for (int i = 2; i * i <= x; i++)       if (x % i == 0) return 0;     return 1;   }   int check(int x, int y) {     if (x > n || x < 1 || y >= m || y < 0) return 0;     return 1;   }   long long gcd(long long a, long long b) {     if (b == 0) {       return a;     }     return gcd(b, a % b);   }   int main() {     cin >> s;     if (s.size() <= 0) {       string t = s;       reverse(t.begin(), t.end());       string k = s + t;       cout << k;       return 0;     }     for (int i = 0; i < s.size(); i++) {       string t =   , k =   ;       for (int j = 0; j < i; j++) t += s[j];       for (int j = i; j < s.size(); j++) k += s[j];       string t1 =   ;       if (k.size() >= t.size()) {         reverse(k.begin(), k.end());         for (int j = k.size() - t.size(); j < k.size(); j++) t1 += k[j];         if (t1 == t) {           string ans = k;           reverse(k.begin(), k.end());           ans += k;           cout << ans;           return 0;         }       } else if (t.size() >= k.size()) {         reverse(t.begin(), t.end());         for (int j = 0; j < t.size() - k.size(); j++) t1 += t[j];         if (t1 == k) {           string ans = t;           reverse(t.begin(), t.end());           ans += t;           cout << ans;           return 0;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(nullptr);     cout.tie(nullptr);     long long int n, m, i, j, x;     cin >> n >> m;     long long int a[n];     for (i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     for (i = 0; i < m; i++) {       cin >> x;       cout << upper_bound(a, a + n, x) - a <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, s = 86400;     long long t, a;     cin >> n >> t;     for (int i = 1; i <= n; i++) {       cin >> a;       if (s - a >= t) {         cout << i;         break;       } else         t -= s - a;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize  -O3    using ll = long long;   using ull = unsigned long long;   using ld = long double;   using namespace std;   const int MX = 7007;   ll f[MX];   bool better(ll x, ll y) { return ((x ^ y) & x) != 0; }   ll x[MX], y[MX];   bool ok[MX];   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     int n;     cin >> n;     vector<pair<ll, ll>> a;     map<ll, int> cnt;     map<ll, ll> sum;     for (int i = 0; i < n; i++) {       cin >> x[i];     }     for (int i = 0; i < n; i++) {       cin >> y[i];     }     for (int i = 0; i < n; i++) {       a.emplace_back(x[i], y[i]);       cnt[x[i]]++;       sum[x[i]] += y[i];     }     sort(a.begin(), a.end());     for (int i = n - 1; i >= 0; i--) {       if (cnt[a[i].first] >= 2) {         ok[i] = true;       }       for (int j = i + 1; j < n; j++) {         if (!better(a[i].first, a[j].first) && ok[j]) {           ok[i] = true;         }       }     }     ll ans = 0;     for (int i = 0; i < n; i++) {       if (ok[i]) {         ans += a[i].second;       }     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int32_t> dp(1, 0);   void solve() {     int64_t n;     cin >> n;     int64_t x3 = 0, x2 = 0;     while (n % 3 == 0 && n != 1) {       n /= 3;       x3++;     }     while (n % 2 == 0 && n != 1) {       n /= 2;       x2++;     }     if (x3 >= x2 && n == 1) {       cout << x3 + (x3 - x2) <<   n ;     } else {       cout << -1 <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t_;     cin >> t_;     while (t_--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int max_n = 20010;   int lf[max_n];   int rf[max_n];   int main() {     long long sum = 0;     int n;     int x, y;     memset(lf, 0, sizeof(lf));     memset(rf, 0, sizeof(rf));     scanf( %d , &n);     for (int i = 0; i < n; ++i) {       scanf( %d%d , &x, &y);       ++lf[y - x + 1000];       ++rf[x + y];     }     for (int i = 0; i <= 2050; ++i) {       sum += (lf[i] * (lf[i] - 1)) / 2;     }     for (int i = 0; i <= 2050; ++i) {       sum += (rf[i] * (rf[i] - 1)) / 2;     }     printf( %I64d n , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int r, j, l, x, y, m, c, n, s, f, q, i, z, p, k, d, t, u, e, g, w;   string s1, s2, s3, s4, str;   vector<long long int> v;   int main() {     cin >> n >> x;     long long int a[n];     for (long long int i = 0; i < n; i++) {       cin >> a[i];       v.push_back(a[i]);     }     k = 0;     double ans = 0.000;     for (long long int i = 0; i < n - 2; i++) {       p = a[i] + x;       l = lower_bound(v.begin(), v.end(), p) - v.begin();       if (v[l] != p) l--;       if (l <= i) continue;       double ans2 =           (((v[l] - a[i + 1]) * 1.000) / ((v[l] - a[i]) * 1.000) * 1.000);       if (ans2 - ans >= 1e-9) {         k = 1;         ans = ans2;       }     }     if (k == 0)       cout << -1;     else       printf( %.9f , ans);   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   const long long maxn = 2001;   long long h[maxn], dp[maxn][2 * maxn];   signed main() {     long long n, k;     scanf( %lld%lld , &n, &k);     for (long long i = 1; i <= n; i++) scanf( %lld , &h[i]);     dp[0][2001] = 1;     for (long long i = 1; i <= n; i++) {       for (long long j = 1; j < 2 * maxn; j++)         if (h[i] == h[i % n + 1])           dp[i][j] = k * dp[i - 1][j] % mod;         else           dp[i][j] = (dp[i - 1][j + 1] + dp[i - 1][j - 1] +                       (k - 2) * dp[i - 1][j] % mod) %                      mod;     }     long long ans = 0;     for (long long i = 1; i < maxn; i++) ans = (ans + dp[n][maxn + i]) % mod;     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 900;   struct edge {     int v, w, b;     double c;   };   vector<edge> adj[maxn];   int n, k;   int s, t;   double dis[maxn];   int bk[maxn], bki[maxn];   bool inq[maxn];   long long x[maxn], y[maxn];   inline void ae(int u, int v, int w, double c) {     edge nu, nv;     nu.v = v;     nu.w = w;     nu.c = c;     nu.b = adj[v].size();     nv.v = u;     nv.w = 0;     nv.c = -c;     nv.b = adj[u].size();     adj[u].push_back(nu);     adj[v].push_back(nv);   }   inline pair<int, double> spfa() {     for (int i = 0; i < maxn; i++) dis[i] = 1e30;     memset(inq, 0, sizeof(inq));     dis[s] = 0;     queue<int> q;     q.push(s);     while (!q.empty()) {       int u = q.front();       q.pop();       inq[u] = 0;       for (int i = adj[u].size() - 1; i >= 0; i--) {         int v = adj[u][i].v;         int w = adj[u][i].w;         double c = adj[u][i].c;         if (dis[u] + c < dis[v] && w != 0) {           dis[v] = dis[u] + c;           bk[v] = u;           bki[v] = i;           if (!inq[v]) {             q.push(v);             inq[v] = 1;           }         }       }     }     if (dis[t] > 1e20) return make_pair(-1, 0.0);     int cur = t;     int flw = 0x3f3f3f3f;     while (cur != s) {       flw = min(flw, adj[bk[cur]][bki[cur]].w);       cur = bk[cur];     }     cur = t;     double cst = 0;     while (cur != s) {       adj[bk[cur]][bki[cur]].w -= flw;       adj[cur][adj[bk[cur]][bki[cur]].b].w += flw;       cst += flw * adj[bk[cur]][bki[cur]].c;       cur = bk[cur];     }     return make_pair(flw, cst);   }   inline pair<int, double> ek() {     pair<int, double> ans = make_pair(0ll, 0.0);     while (1) {       pair<int, double> cr = spfa();       if (cr.first <= 0) return ans;       ans.first += cr.first;       ans.second += cr.second;     }   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> x[i] >> y[i];     }     s = n + n + 1;     t = n + n + 3;     for (int i = 1; i <= n; i++) {       ae(s, i, 2, 0.0);       ae(i + n, t, 1, 0.0);     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         if (i == j) continue;         if (y[i] > y[j])           ae(i, j + n, 1,              sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])));       }     }     pair<int, double> ans = ek();     if (ans.first != n - 1)       cout << -1;     else       printf( %.15lf , ans.second);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     int st = 0;     cin >> s;     int cnt[4] = {0};     for (int i = 0; i < s.size(); i++) {       if ( 1  <= s[i] && s[i] <=  3 ) {         ++cnt[s[i] -  0 ];       }     }     for (int i = 1; i <= 3; i++) {       for (int j = 0; j < cnt[i]; j++) {         if (st) {           cout <<  + ;         } else {           st = 1;         }         cout << i;       }     }     return 0;   }
#include <iostream>   #include <cstdio>   #include <algorithm>   #include <cstring>   #include <cmath>   #include <vector>   #include <map>   #include <queue>   #define int long long   #define mod 998244353   using namespace std;   int n,c[505],a[505],f[505][505],pos,ans;   char s[15];   int dfs(int now,int nowd){    if (now>n)return 1;    if (now==pos)return dfs(now+1,nowd+1);    if (f[now][nowd]!=-1)return f[now][nowd];    int ans=0;    if (now<pos)ans=dfs(now+1,nowd)+dfs(now+1,max(0ll,nowd+a[now]));    else{     ans=dfs(now+1,nowd);     if (nowd+a[now]>0)ans+=dfs(now+1,nowd+a[now]);    }    ans%=mod;    return f[now][nowd]=ans;   }   signed main(){    cin>>n;    for (int i=1;i<=n;i++){     scanf( %s ,s+1);     if (s[1]== - )c[i]=-1;     else scanf( %lld ,&c[i]);    }    for (int i=1;i<=n;i++){     if (c[i]==-1)continue;     for (int j=1;j<=n;j++){      if (c[j]==-1)a[j]=-1;      else if (c[j]<c[i]||(c[j]==c[i]&&j<i))a[j]=1;      else a[j]=0;     }     memset(f,-1,sizeof(f));     pos=i;     ans=(ans+c[i]*dfs(1,0))%mod;    }    cout<<ans<<endl;    return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long x[300009];   int main() {     long long n;     cin >> n;     for (int i = 0; i < n; i++) cin >> x[i];     sort(x, x + n);     long long a = x[0], b = 1, ans = 0;     for (int i = 1; i < n; i++) {       ans = (ans + x[i] * (2 * b - 1) - a) % 1000000007;       a = (2 * a + x[i]) % 1000000007;       b = 2 * b % 1000000007;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int N, arr[1000000];   set<int> st;   int main() {     cin >> N;     if (N % 2 == 0) {       cout <<  NO ;       return 0;     }     for (int i = 1, b = 1, e = N * 2; i <= N; b += 2, e -= 2)       arr[i] = b, i++, arr[i] = e, i++;     for (int i = N + 1; i <= N * 2;) {       arr[i] = arr[i - N] + 1;       i++;       arr[i] = arr[i - N] - 1;       i++;     }     cout <<  YES n ;     for (int i = 1; i <= 2 * N; i++) cout << arr[i] <<    ;     cout <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 5;   const double eps = 1e-8;   int N;   long long K;   double pi;   int X[maxn], Y[maxn];   struct Seg {     double radl, radr;     void correct() {       if (radl > 2 * pi) radl -= 2 * pi;       if (radr > 2 * pi) radr -= 2 * pi;       if (radl < 0) radl += 2 * pi;       if (radr < 0) radr += 2 * pi;       if (radl > radr) swap(radl, radr);     }     bool operator<(const Seg& rhs) const { return radl < rhs.radl; }   } ses[maxn];   double rads[maxn * 2];   unordered_map<double, int> mp;   int c[maxn * 2];   void add(int pos, int val) {     while (pos <= N * 2) {       c[pos] += val;       pos += (pos & (-pos));     }   }   int sum(int pos) {     int res = 0;     while (pos) {       res += c[pos];       pos -= (pos & (-pos));     }     return res;   }   int main() {     scanf( %d%lld , &N, &K);     long long ALL = 1ll * N * (N - 1) / 2;     pi = acos(-1);     for (int i = 1; i <= N; i++) scanf( %d%d , &X[i], &Y[i]);     double mxr = 1e5, mir = 0;     while (mxr - mir > eps) {       double mid = (mxr + mir) / 2.0;       int rcnt = 0, rscnt = 0;       mp.clear();       memset(c, 0, sizeof(c));       for (int i = 1; i <= N; i++) {         double dis = sqrt(X[i] * X[i] + Y[i] * Y[i]);         if (dis <= mid) continue;         double ang = atan2(Y[i], X[i]) + pi;         double dan = acos(mid / dis);         ses[++rcnt] = Seg{ang + dan, ang - dan};         ses[rcnt].correct();         rads[++rscnt] = ses[rcnt].radl;         rads[++rscnt] = ses[rcnt].radr;       }       sort(ses + 1, ses + rcnt + 1);       sort(rads + 1, rads + rscnt + 1);       for (int i = 1; i <= rscnt; i++) mp[rads[i]] = i;       long long cnt = 0;       for (int i = 1; i <= rcnt; i++) {         cnt += sum(mp[ses[i].radr] - 1) - sum(mp[ses[i].radl]);         add(mp[ses[i].radr], 1);       }       if (ALL - cnt >= K)         mxr = mid;       else         mir = mid;     }     printf( %.8lf n , mir);     return 0;   }