func_code_string: #include <bits/stdc++.h>   using namespace std;   namespace jumpmelon {   long long divfloor(long long a, long long b) {     long long k = a / b;     if (k * b > a) k--;     return k;   }   long long divceil(long long a, long long b) {     long long k = a / b;     if (k * b < a) k++;     return k;   }   void work() {     long long n, i_l, i_r, i_k;     scanf( %lld%lld%lld%lld , &n, &i_l, &i_r, &i_k);     long long d = i_l <= i_r ? i_r - i_l + 1 : i_r + n - i_l + 1;     long long s = i_k - d, v = n - d + 1, ans = -1;     if (n <= 1000000) {       for (long long r = 0; r <= n; r++) {         long long a = max(0LL, r - v), b = min(d, r);         long long mink = max(0LL, divceil(s - b, n + r));         long long maxk = divfloor(s - a, n + r);         if (mink <= maxk) ans = max(ans, r);       }     } else {       for (long long k = 0; k * n <= s; k++) {         long long t = s - k * n;         long long minr = 0, maxr = n;         if (k) maxr = min(maxr, divfloor(t, k));         maxr = min(maxr, divfloor(t + v, k + 1));         if (k)           minr = max(minr, divceil(t - d, k));         else if (t > d)           continue;         minr = max(minr, divceil(t, k + 1));         if (minr <= maxr) ans = max(ans, maxr);       }     }     printf( %lld n , ans);   }   }  // namespace jumpmelon   int main() {     jumpmelon::work();     return 0;   }   