#include "bits/stdc++.h" using namespace std; #define DEBUG(x) cout<<#x<<": "< #define vl vector #define vii vector< vector > #define vll vector< vector > #define vs vector #define pii pair #define pis pair #define psi pair #define pll pair const int inf = 1000000001; const ll INF = 1e18; #define MOD 1000000007 #define mod 1000000009 #define pi 3.14159265358979323846 #define Sp(p) cout<> n; vi money; i = 1; while (i * (i + 1) / 2 <= n) { money.push_back(i * (i + 1) / 2); i++; } //DEBUG_VEC(money); int ans = 0; j = money.size() - 1; while (n > 0) { if (n >= money[j]) { ans += n / money[j]; n %= money[j]; } j--; } cout << ans << endl; }