func_code_string: #include <bits/stdc++.h>   using namespace std;   long long x;   int getAdded(long long n) {     int lo = 1, hi = 10000000;     while (lo < hi) {       long long mid = (lo + hi) / 2 + (lo + hi) % 2;       long long temp = (mid * mid + mid) / 2;       if (temp == n)         return mid;       else if (temp < n)         lo = mid;       else         hi = mid - 1;     }     return lo;   }   bool isPossible(int h, int mod, long long n) {     long long temp = x + h;     return getAdded(temp) >= h * 3 + mod;   }   int main() {     long long n;     cin >> n;     int mod = (n % 3 - 3) * -1;     int lo = 0, hi = 10000000;     x = (n + mod) / 3;     while (lo < hi) {       int mid = (lo + hi) / 2 + (lo + hi) % 2;       if (isPossible(mid, mod, n))         lo = mid;       else         hi = mid - 1;     }     if (!isPossible(lo, mod, n))       cout << 0;     else       cout << lo + 1;     return 0;   }   