func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     long long int a, b, c, r;     while (t--) {       long long int ans = 0, mx = 0, mn = 0;       cin >> a >> b >> c >> r;       if (a >= b) {         mx = a;         mn = b;       } else {         mx = b;         mn = a;       }       if (c == mx || c == mn) {         ans = mx - mn - r;         if (ans < 0) ans = 0;         cout << ans << endl;       } else if (c > mn && c < mx) {         if (abs(c - mn) < r)           ans = mx - mn - (r + abs(c - mn));         else if (abs(mx - c) < r)           ans = mx - mn - (r + abs(mx - c));         else           ans = mx - mn - 2 * r;         if (ans < 0) ans = 0;         cout << ans << endl;       } else {         if (mn > c && abs(mn - c) < r)           ans = mx - mn - (r - abs(mn - c));         else if (c > mx && abs(c - mx) < r)           ans = mx - mn - (r - abs(c - mx));         else           ans = mx - mn;         if (ans < 0) ans = 0;         cout << ans << endl;       }     }     return 0;   }   