malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const int N = 2e5 + 10;   struct node {     int l, r, id;     friend bool operator<(node A, node B) {       return A.r == B.r ? A.l < B.l : A.r < B.r;     }   };   node a[N];   bool add[N];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ll n, m;     ;     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       cin >> a[i].l >> a[i].r;       a[i].id = i;     }     sort(a + 1, a + 1 + n);     multiset<int> b;     for (int i = 0; i < m; ++i) b.insert(0);     for (int i = 1; i <= n; ++i) {       auto p = b.lower_bound(a[i].l);       if (p != b.begin()) {         add[a[i].id] = 1;         --p;         b.erase(p);         b.insert(a[i].r);       }     }     vector<int> ans;     for (int i = 1; i <= n; ++i)       if (!add[i]) ans.emplace_back(i);     cout << ans.size() << endl;     for (auto i : ans) cout << i <<    ;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long maxn = 3e3 + 100;   const long long inf = 0x3f3f3f3f;   const long long iinf = 1 << 30;   const long long linf = 2e18;   const long long mod = 998244353;   const double eps = 1e-7;   template <class T = long long>   T chmin(T &a, T b) {     return a = min(a, b);   }   template <class T = long long>   T chmax(T &a, T b) {     return a = max(a, b);   }   template <class T = long long>   inline void red(T &x) {     x -= mod, x += x >> 31 & mod;   }   template <class T = long long>   T read() {     T f = 1, a = 0;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       a = (a << 3) + (a << 1) + ch -  0 ;       ch = getchar();     }     return a * f;   }   long long n, m, ans;   char s[maxn], t[maxn];   long long f[maxn][maxn];   signed main() {     scanf( %s %s , s + 1, t + 1);     long long n = strlen(s + 1), m = strlen(t + 1);     for (long long i = (1); i <= (n); ++i) f[i][i] = 2 * (i > m || s[1] == t[i]);     for (long long i = (2); i <= (n); ++i)       for (long long l = (1); l <= (n - i + 1); ++l) {         long long r = l + i - 1;         if (l > m || s[i] == t[l]) red(f[l][r] += f[l + 1][r]);         if (r > m || s[i] == t[r]) red(f[l][r] += f[l][r - 1]);       }     for (long long i = (m); i <= (n); ++i) red(ans += f[1][i]);     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( no-stack-protector )   #pragma GCC optimize( -funroll-loops )   #pragma GCC target( avx,sse4 )   using namespace std;   const int P = 1e9 + 7, i2 = P / 2 + 1, i6 = P / 6 + 1, N = 1e6 + 5;   long long n, m;   int r, f1[N], f2[N], f3[N];   int main() {     scanf( %lld , &n);     long long g1 = (n + 1) % P, g3 = (long long)g1 * g1 % P * g1 % P;     while ((long long)m * m <= n) m++;     m--;     for (register int i = 1, _lim_ = m; i <= _lim_; i++) {       long long v1 = (long long)i * i % P, v2 = (long long)v1 * v1 % P,                 v3 = (long long)v1 * v2 % P;       f1[i] = (f1[i - 1] + v1) % P;       f2[i] = (f2[i - 1] + v2) % P;       f3[i] = (f3[i - 1] + v3) % P;     }     for (register int x = 0, _lim_ = m; x <= _lim_; x++) {       long long s = 0, v1 = (long long)x * x % P, v2 = (long long)v1 * v1 % P,                 v3 = (long long)v1 * v2 % P;       while ((long long)x * x + (long long)m * m > n) m--;       s = ((g3 + g1 * (3 * v1 - 3 * v2 - 1) + v1 - v2 * 3 + v3 * 2) % P *                (m + 1) % P +            (3 * g1 + 1 - (3 * g1 + 3) * v1 * 2 + v2 * 6) % P * f1[m] % P +            3 * (v1 * 2 - g1 - 1) * f2[m] + 2 * f3[m]) %           P;       s = (s * 2 - g3 + g1 - v1 * (3 * g1 + 1) + v2 * (3 * g1 + 3) - v3 * 2) % P;       r = (r + s * (1 << (x > 0))) % P;     }     r = (long long)r * i6 % P;     if (r < 0) r += P;     printf( %d n , r);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, co[200010], to[200010];   int cnt = 0;   int dfn[200010], low[200010];   int scc_cnt;   int sccno[200010];   int nt[200010], va[200010];   stack<int> S;   void dfs(int u) {     dfn[u] = low[u] = ++cnt;     S.push(u);     int v = to[u];     if (dfn[v] == 0) {       dfs(v);       low[u] = min(low[u], low[v]);     } else if (!sccno[v]) {       low[u] = min(low[u], dfn[v]);     }     int MMM = 0x3f3f3f3f;     if (low[u] == dfn[u]) {       ++scc_cnt;       while (true) {         int x = S.top();         S.pop();         sccno[x] = scc_cnt;         MMM = min(MMM, co[x]);         if (x == u) {           break;         }       }       va[scc_cnt] = MMM;     }   }   int num[200010];   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> co[i];     for (int i = 1; i <= n; i++) cin >> to[i];     memset(dfn, 0, sizeof(dfn));     cnt = scc_cnt = 0;     for (int i = 1; i <= n; ++i) {       if (!dfn[i]) {         dfs(i);       }     }     for (int u = 1; u <= n; ++u) {       int v = to[u];       if (sccno[u] != sccno[v]) {         nt[sccno[u]] = sccno[v];         num[sccno[u]]++;       }     }     queue<int> q;     int ans = 0;     for (int i = 1; i <= scc_cnt; i++) {       if (num[i] == 0) {         ans += va[i];       }     }     cout << ans << endl;     ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 10;   char s[N], t[N];   int n, m;   int ch[N][26];   int lps[N];   void calcLps() {     memset(lps, 0, sizeof(lps));     int i = 1;     int len = 0;     lps[0] = 0;     while (i < m) {       if (t[i + 1] == t[len + 1]) {         len++;         lps[i] = len;         i++;       } else {         if (len == 0) {           lps[i] = 0;           i++;         } else {           len = lps[len - 1];         }       }     }   }   int main() {     scanf( %s , s + 1);     scanf( %s , t + 1);     n = strlen(s + 1), m = strlen(t + 1);     for (int i = 1; i <= m; i++) ch[i - 1][t[i] -  a ] = i;     calcLps();     for (int i = 1; i <= m; i++) {       for (int j = 0; j < 26; j++) {         if (!ch[i][j]) {           ch[i][j] = ch[lps[i - 1]][j];         }       }     }     vector<vector<int> > dp(n + 1, vector<int>(m + 1, -1));     dp[0][0] = 0;     for (int i = 0; i < n; i++) {       for (int j = 0; j <= m; j++) {         if (dp[i][j] == -1) continue;         if (s[i + 1] ==  ? ) {           for (int c = 0; c < 26; c++) {             dp[i + 1][ch[j][c]] =                 max(dp[i + 1][ch[j][c]], dp[i][j] + (ch[j][c] == m));           }         } else {           int c = s[i + 1] -  a ;           dp[i + 1][ch[j][c]] =               max(dp[i + 1][ch[j][c]], dp[i][j] + (ch[j][c] == m));         }       }     }     int ans = 0;     for (int i = 0; i <= m; i++) {       ans = max(ans, dp[n][i]);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 107;   int n, k;   int f[N][N];   int main() {     int i, j, tmp;     bool ok = 0;     cin >> k;     f[1][2] = f[2][1] = 1;     tmp = 0;     for (i = 3; i <= 100; i++) {       f[1][i] = f[i][1] = 1;       for (j = 2; j < i; j++) {         if (tmp + j - 1 > k) break;         tmp += j - 1;         f[i][j] = f[j][i] = 1;         if (tmp == k) {           ok = 1;           break;         }       }       if (ok) break;     }     cout << i << endl;     k = i;     for (i = 1; i <= k; i++) {       for (j = 1; j < k; j++) {         cout << f[i][j];       }       cout << f[i][k] << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 100500;   int n, m;   int a[30];   string s, t;   char ans[5500];   void po_poryadky(int x) {     for (int i = x; i < n; i++) {       for (int j = 0; j < 30; j++)         if (a[j]) {           ans[i] = (char)( a  + j);           a[j]--;           break;         }     }   }   void ubiraem(int x) {     for (int i = x; i >= 0; i--) {       int num = ans[i] -  a ;       a[num]++;       for (int j = num + 1; j < 30; j++)         if (a[j]) {           ans[i] = (char)( a  + j);           a[j]--;           po_poryadky(i + 1);           return;         }     }     cout << -1;     exit(0);   }   void v_roven() {     for (int i = 0; i < m; i++) {       int num = t[i] -  a ;       if (a[num] != 0) {         ans[i] = t[i];         a[num]--;         continue;       }       for (int j = num + 1; j < 30; j++)         if (a[j]) {           a[j]--;           ans[i] = (char)( a  + j);           po_poryadky(i + 1);           return;         }       ubiraem(i - 1);       return;     }     if (n == m)       ubiraem(m - 1);     else       po_poryadky(m);   }   int main() {     cin >> s >> t;     n = s.size();     m = t.size();     for (int i = 0; i < n; i++) a[(int)(s[i] -  a )]++;     v_roven();     ans[n] =   0 ;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   const int MAXN = 2e5 + 5;   int n, a[MAXN];   long long sm[MAXN];   int ans = 0;   int pc[MAXN];   inline bool check(int l, int r) { return (a[l] ^ a[r]) == sm[r - 1] - sm[l]; }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , a + i), sm[i] = sm[i - 1] + a[i];     for (int i = 1; i <= n; ++i) {       int x = a[i];       while (x) x >>= 1, ++pc[i];     }     for (int l = 1; l <= n - 2; ++l) {       int r = l + 2;       while (r <= n && sm[r - 1] - sm[l] < (1ll << pc[l])) {         if (pc[l] >= pc[r]) ans += check(l, r);         ++r;       }     }     std::reverse(a + 1, a + n + 1);     std::reverse(pc + 1, pc + n + 1);     for (int i = 1; i <= n; ++i) sm[i] = sm[i - 1] + a[i];     for (int l = 1; l <= n - 2; ++l) {       int r = l + 2;       while (r <= n && sm[r - 1] - sm[l] < (1ll << pc[l])) {         if (pc[l] > pc[r]) ans += check(l, r);         ++r;       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 2e5 + 10;   int n, m, l, r, x, a[MAX_N], left_ancestor[MAX_N];   int main() {     scanf( %d %d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , a + i);     for (int i = 2; i <= n; i++)       if (a[i] == a[i - 1])         left_ancestor[i] = left_ancestor[i - 1];       else         left_ancestor[i] = i - 1;     while (m--) {       scanf( %d %d %d , &l, &r, &x);       if (a[r] != x)         printf( %d n , r);       else if (left_ancestor[r] and l <= left_ancestor[r])         printf( %d n , left_ancestor[r]);       else         puts( -1 );     }     return (0);   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 5 * 1e5;   long long s[maxn], del[maxn], mark[maxn];   void build(int u, int l, int r) {     if (l < r) {       int mid = (l + r) / 2;       build(u * 2, l, mid), build(u * 2 + 1, mid + 1, r);     } else       mark[u] = l;   }   long long query(int u, int l, int r, int x, int y) {     if (y < l || x > r) return 0;     if (x <= l && r <= y) return s[u];     int mid = (l + r) / 2;     long long L = query(u * 2, l, mid, x, y);     long long R = query(u * 2 + 1, mid + 1, r, x, y);     return L + R + max(0, min(r, y) - max(l, x) + 1) * del[u];   }   void clear(int u, int l, int r, int z) {     if (mark[u]) {       del[u] += abs(mark[u] - z);       s[u] += 1LL * (r - l + 1) * abs(mark[u] - z);       mark[u] = 0;     } else {       if (l == r) return;       int mid = (l + r) / 2, lc = u * 2, rc = u * 2 + 1;       clear(lc, l, mid, z);       clear(rc, mid + 1, r, z);       s[u] = s[lc] + s[rc] + 1LL * (r - l + 1) * del[u];     }   }   void modify(int u, int l, int r, int x, int y, int z) {     if (y < l || x > r) return;     if (x <= l && r <= y) {       clear(u, l, r, z);       mark[u] = z;       return;     }     int mid = (l + r) / 2, lc = u * 2, rc = u * 2 + 1;     if (mark[u]) mark[lc] = mark[rc] = mark[u], mark[u] = 0;     modify(lc, l, mid, x, y, z);     modify(rc, mid + 1, r, x, y, z);     s[u] = s[lc] + s[rc] + 1LL * (r - l + 1) * del[u];   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     build(1, 1, n);     int type, x, y, z;     ;     for (int i = 0; i < m; i++) {       scanf( %d%d%d , &type, &x, &y);       if (type == 1) {         scanf( %d , &z);         modify(1, 1, n, x, y, z);       } else         (cout << query(1, 1, n, x, y) << endl);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100001;   int n, m, ind[N], dpth[N], s[N], e[N], t, seg[4 * N], lazy[4 * N], a[N];   vector<vector<int> > g, gift;   vector<pair<int, int> > anc;   vector<int> ans, root;   void dfs(int u) {     s[u] = t++;     for (int i = 0; i < g[u].size(); i++) {       dpth[g[u][i]] = dpth[u] + 1;       dfs(g[u][i]);     }     e[u] = t - 1;   }   void dfs2(int u) {     if (gift[a[u]].empty()) {       anc.push_back(make_pair(-dpth[a[u]], a[u]));     }     gift[a[u]].push_back(u);     for (int i = 0; i < g[u].size(); i++) dfs2(g[u][i]);   }   void checkLazy(int p, int s, int e) {     if (lazy[p] != 0) {       seg[p] += (e - s + 1) * lazy[p];       if (s != e) lazy[2 * p] += lazy[p], lazy[2 * p + 1] += lazy[p];       lazy[p] = 0;     }   }   void build(int p, int s, int e) {     if (s == e) {       seg[p] = 1;       lazy[p] = 0;       return;     }     build(2 * p, s, (s + e) / 2);     build(2 * p + 1, (s + e) / 2 + 1, e);     seg[p] = seg[2 * p] + seg[2 * p + 1];     lazy[p] = lazy[2 * p] + lazy[2 * p + 1];   }   void update(int p, int s, int e, int a, int b, int v) {     checkLazy(p, s, e);     if (s >= a && e <= b) {       seg[p] += (e - s + 1) * v;       if (s != e) lazy[2 * p] += v, lazy[2 * p + 1] += v;       return;     }     if (s > b || e < a) return;     update(2 * p, s, (s + e) / 2, a, b, v);     update(2 * p + 1, (s + e) / 2 + 1, e, a, b, v);     seg[p] = seg[2 * p] + seg[2 * p + 1];   }   int get(int p, int s, int e, int a) {     checkLazy(p, s, e);     if (s == e) return seg[p];     if (a <= (s + e) / 2) return get(2 * p, s, (s + e) / 2, a);     return get(2 * p + 1, (s + e) / 2 + 1, e, a);   }   int main() {     std::ios::sync_with_stdio(false);     scanf( %d%d , &n, &m);     g.resize(n);     memset(ind, 0, sizeof(ind));     build(1, 0, n - 1);     for (int i = 0, a, b; i < m; i++) {       scanf( %d%d , &a, &b);       a--, b--;       g[a].push_back(b);       ind[b]++;     }     for (int i = 0; i < n; i++)       if (ind[i] == 0) root.push_back(i);     for (int i = 0; i < n; i++) {       scanf( %d , a + i);       a[i]--;     }     t = 0;     gift.resize(n);     for (int i = 0; i < root.size(); i++) {       int r = root[i];       dpth[r] = 0;       dfs(r);       anc.clear();       dfs2(r);       sort(anc.begin(), anc.end());       for (int j = 0; j < anc.size(); j++) {         for (int k = 0; k < gift[anc[j].second].size(); k++)           if (get(1, 0, n - 1, s[gift[anc[j].second][k]]) <= 0) {             puts( -1 );             return 0;           }         ans.push_back(anc[j].second + 1);         update(1, 0, n - 1, s[anc[j].second], e[anc[j].second], -1);       }     }     printf( %d n , ans.size());     for (int i = 0; i < ans.size(); i++) printf( %d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void matches(vector<int> arr) {     int i;     for (i = 0; i < arr.size(); i++) {       if (arr[i] == 2)         cout << 2 << endl;       else if (arr[i] % 2 == 0 && arr[i] != 2)         cout << 0 << endl;       else         cout << 1 << endl;     }   }   int main() {     int i, n;     cin >> n;     vector<int> arr(n);     for (i = 0; i < n; i++) {       cin >> arr[i];     }     matches(arr);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int INF = 1000000001;   const long long LINF = 1000000000000000001LL;   struct ConvexHullTrick {     struct line {       int a;       long long b;       long long eval(int x) { return (long long)a * x + b; }     };     bool incrSlope, incrQueries, queryMax;     ConvexHullTrick(bool incrSlope, bool incrQueries, bool queryMax)         : incrSlope(incrSlope), incrQueries(incrQueries), queryMax(queryMax) {       assert(incrSlope xor incrQueries xor queryMax);     }     deque<line> lines;     long long overtakes(const line &p, const line &q) {       long long x = p.b - q.b;       int y = p.a - q.a;       return (x >= 0 ? x : x - y + 1) / y;     }     bool redundantTop(const line &l) {       int s = lines.size();       if (l.a == lines[s - 1].a) {         return true;       } else {         return overtakes(l, lines[s - 1]) >=                overtakes(lines[s - 1], lines[s - 2]);       }     }     void add(int a, long long b) {       if (!(incrSlope xor incrQueries xor queryMax)) a *= -1;       if (queryMax) b *= -1;       if (!lines.empty() && a == lines.back().a && b >= lines.back().b) {         return;       }       line l = {a, b};       while (lines.size() >= 2 && redundantTop(l)) {         lines.pop_back();       }       lines.push_back(l);     }     long long query(int x) {       if (!(incrSlope xor incrQueries)) x *= -1;       while (lines.size() >= 2 && lines[0].eval(x) > lines[1].eval(x)) {         lines.pop_front();       }       return lines.front().eval(x) * (queryMax ? -1 : 1);     }   };   int main() {     ios_base::sync_with_stdio(false);     ConvexHullTrick hull(false, false, true);     auto add = [&](long long dpValue, int x) { hull.add(-x, dpValue); };     int n;     cin >> n;     struct rect {       int x, y;       long long a;     };     vector<rect> rects(n);     for (auto &e : rects) {       cin >> e.x >> e.y >> e.a;     }     sort(rects.begin(), rects.end(),          [&](const rect &a, const rect &b) { return a.x < b.x; });     vector<long long> dp(n + 1, 0);     add(0, 0);     for (int i = (1); i <= (n); i++) {       auto r = rects[i - 1];       dp[i] = (long long)r.x * r.y - r.a + hull.query(r.y);       add(dp[i], r.x);     }     long long ans = *max_element(dp.begin(), dp.end());     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, M;   long long tblX[1001001];   int minp[1001001];   long long gs[1001001];   long long bsum[1001001];   long long bsums0[1001001];   long long bsums1[1001001];   long long bsums2[1001001];   long long linsum(long long K) {     long long P = K, Q = K + 1;     if (P % 2 == 0)       P /= 2;     else       Q /= 2;     return (P * Q) % 1000000007;   }   long long sqrsum(long long K) {     long long ret = K;     ret = ret * (K + 1) % 1000000007;     ret = ret * ((2 * K + 1) % 1000000007) % 1000000007;     return ret * ((1000000007 + 1) / 6) % 1000000007;   }   void erat() {     for (int i = 0; i <= 1000000; i++) minp[i] = -1;     for (int i = 2; i <= 1000000; i++)       if (minp[i] == -1) {         for (int j = i; j <= 1000000; j += i)           if (minp[j] == -1) minp[j] = i;       }   }   long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }   long long count(long long a, long long b) {     if (min(N, M) <= a + b - 1) return 0;     long long pat = (long long)(N - (a + b - 1)) * (M - (a + b - 1)) % 1000000007;     long long ec = a * a + b * b - 2 * (a + b) + 2 * gcd(a, b);     ec %= 1000000007;     return pat * ec % 1000000007;   }   void calc_gs() {     gs[1] = 1;     for (int i = 2; i <= 1000000; i++) {       int p = i, q = i;       long long aux = 0;       int ord = 0;       while (q % minp[i] == 0) {         ++ord;         q /= minp[i];       }       long long pow = 1;       for (int j = 0; j < ord - 1; j++) pow = (pow * minp[i]);       aux += pow * minp[i];       aux += pow * (minp[i] - 1) * ord;       aux %= 1000000007;       aux = aux * gs[q] % 1000000007;       gs[i] = aux;     }   }   void calc_bsum() {     bsum[0] = 0;     for (int i = 1; i <= 1000000; i++) {       long long tmp = sqrsum(i) + sqrsum(i - 1) + 2 * 1000000007 -                       (2 * i * (long long)i % 1000000007) + 2 * gs[i];       bsum[i] = tmp % 1000000007;     }   }   void totalize() {     bsums0[0] = bsums1[0] = bsums2[0] = 0;     for (int i = 1; i <= 1000000; i++) {       bsums0[i] = (bsums0[i - 1] + bsum[i]) % 1000000007;       bsums1[i] = (bsums1[i - 1] + bsum[i] * i % 1000000007) % 1000000007;       bsums2[i] = (bsums2[i - 1] + bsum[i] * i % 1000000007 * i % 1000000007) %                   1000000007;     }   }   int main() {     erat();     calc_gs();     calc_bsum();     totalize();     int T;     scanf( %d , &T);     for (int i = 0; i < T; i++) {       scanf( %d%d , &N, &M);       if (N > M) swap(N, M);       long long ret = (long long)(N + 1) * (M + 1) % 1000000007 * bsums0[N];       ret += 1000000007 - ((long long)(N + M + 2) * bsums1[N] % 1000000007);       ret += bsums2[N];       ret %= 1000000007;       printf( %d n , (int)ret);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n1;   int i, j;   int main() {     int a[10] = {4, 7, 47, 74, 447, 474, 477, 774, 747, 744};     string n;     cin >> n;     int z = n.length();     stringstream stoi(n);     stoi >> n1;     for (i = 0; i < 10; i++) {       if (n1 % a[i] == 0) {         cout <<  YES ;         return 0;       }     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-6;   const double pi = acos(-1);   int sign(double k) {     if (k > eps)       return 1;     else if (k < -eps)       return -1;     return 0;   }   int cmp(double k1, double k2) { return sign(k1 - k2); }   int inmid(double k1, double k2, double k3) {     return sign(k1 - k3) * sign(k2 - k3) <= 0;   }   struct point {     double x, y;     point operator+(const point &k1) const { return (point){k1.x + x, k1.y + y}; }     point operator-(const point &k1) const { return (point){x - k1.x, x - k1.y}; }     point operator*(double &k1) const { return (point){x * k1, y * k1}; }     point operator/(double &k1) const { return (point){x / k1, y / k1}; }     int operator==(const point &k1) const {       return cmp(x, k1.x) == 0 && cmp(y, k1.y) == 0;     }     double abs() { return sqrt(x * x + y * y); }     double abs2() { return x * x + y * y; }     double dis(point k1) { return ((*this) - k1).abs(); }   };   struct osc {     double ang;     int v;   };   bool osccmp(osc a, osc b) {     int res = cmp(a.ang, b.ang);     if (res == -1) return 1;     if (res == 0 && a.v > b.v) return 1;     return 0;   }   int n, K;   int sz;   osc angle[400050];   point a[100050];   bool check(double R) {     sz = 0;     int now = 0;     for (int i = 1; i <= n; i++) {       double d = a[i].abs() / 2;       if (cmp(d, R) == 1) continue;       double t = atan2(a[i].y, a[i].x);       if (t < 0) t += 2 * pi;       double dt = acos(d / R);       double f = t - dt, s = t + dt;       if (cmp(f, 0.0) == -1) f += 2 * pi;       if (cmp(s, 2 * pi) == 1) s -= 2 * pi;       if (cmp(f, s) == 1 || cmp(f, 0.0) == 0) now++;       angle[++sz] = (osc){f, 1};       angle[++sz] = (osc){s, -1};     }     sort(angle + 1, angle + sz + 1, osccmp);     for (int i = 1; i <= sz; i++) {       now += angle[i].v;       if (now >= K) return 1;     }     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> K;     for (int i = 1; i <= n; i++) {       int x, y;       cin >> x >> y;       if (x == 0 && y == 0) {         K--;         i--;         n--;         continue;       }       a[i] = (point){(double)x, (double)y};     }     if (K <= 0) {       cout << fixed << setprecision(10) << 0.0 <<   n ;       return 0;     }     double l = 0, r = 200000;     for (int round = 1; round <= 100; round++) {       double mid = (l + r) / 2;       if (check(mid))         r = mid;       else         l = mid;     }     cout << fixed << setprecision(10) << l <<   n ;     return 0;   }