func_code_string: #include <bits/stdc++.h>   using namespace std;   struct Data {     long long l, r;   } a[200100];   long long n, s, rmax, lmin;   void Docfile() {     scanf( %lld%lld , &n, &s);     rmax = 0;     lmin = 1e18;     for (int i = 1; i <= n; i++) {       scanf( %lld%lld , &a[i].l, &a[i].r);       rmax = max(rmax, a[i].r);       lmin = min(lmin, a[i].l);     }   }   bool cmp(Data &a, Data &b) {     return ((a.l < b.l) || ((a.l == b.l) && (a.r < b.r)));   }   void Xuli() {     sort(a + 1, a + 1 + n, cmp);     long long sum1, sum2, dem1, dem2, dem3, F[200100];     long long d = lmin, c = rmax, g, kq = 0;     while (d <= c) {       g = (d + c) / 2;       dem1 = dem2 = dem3 = sum1 = sum2 = 0;       F[0] = 0;       for (int i = 1; i <= n; i++) {         if (a[i].r < g) {           dem1++;           sum1 += a[i].l;         } else {           if (a[i].l > g) {             dem2++;             sum2 += a[i].l;           } else {             dem3++;             F[dem3] = F[dem3 - 1] + a[i].l;           }         }       }       if (dem1 > n / 2) {         c = g - 1;         continue;       }       if (dem2 > n / 2) {         d = g + 1;         continue;       }       if (dem1 < n / 2) sum1 += F[n / 2 - dem1];       if (dem2 < n / 2) sum2 += g * (n / 2 - dem2);       if (sum1 + sum2 + g <= s) {         kq = max(kq, g);         d = g + 1;       } else         c = g - 1;     }     printf( %lld n , kq);   }   int main() {     long t;     scanf( %d , &t);     for (int i = 1; i <= t; i++) {       Docfile();       Xuli();     }   }   