func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 5e5 + 5;   int n, k, a[maxn], b[maxn];   void work(long long g);   long long as, ct;   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , a + i);     for (int i = 1; i <= n; i++) scanf( %d , b + i);     long long l = 0, r = 1e12, mid, ot;     while (l < r) {       work(mid = l + r >> 1);       if (ct >= k)         r = mid, ot = mid;       else         l = mid + 1;     }     work(ot), printf( %lld n , as + 2 * k * ot);     return 0;   }   void work(long long g) {     priority_queue<pair<long long, int> > q;     as = ct = 0;     long long tp;     for (int i = 1; i <= n; i++) {       q.push({g - a[i], 1});       if ((tp = b[i] - q.top().first - g) <= 0) {         as += tp, ct += q.top().second, q.pop(), q.push({b[i] - g, 0});       }     }   }   