func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, d, ff = 1, bb = 1;   long long mx;   pair<long long, long long> f[100005];   int main() {     scanf( %d%d , &n, &d);     for (int i = 1; i <= n; i++) scanf( %d%d , &f[i].first, &f[i].second);     sort(f + 1, f + n + 1);     for (int i = 2; i <= n; i++) f[i].second += f[i - 1].second;     while (true) {       while (f[bb].first - f[ff].first < d && bb != n + 1) bb++;       mx = max(mx, f[bb - 1].second - f[ff - 1].second);       ff++;       if (ff == n + 1) break;     }     printf( %I64d , mx);     return 0;   }   