https://codeforces.com/problemset/problem/1345/B
1*2=2
1*2+2*2+1=7
1*2+2*2+3*2+1+2=15
#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
LL f(LL x)
{
LL cnt=0;
for(LL i=1;i<=1e9;i++)
{
LL sum=0;
sum=i*(i+1)+(i-1)*i/2;
if(sum<=x) cnt=i;
else break;
}
return cnt;
}
int main(void)
{
LL n; cin>>n;
while(n--)
{
LL x; cin>>x;
int cnt=0;
while(x)
{
LL temp=f(x);
if(temp==0) break;
else x-=temp*(temp+1)+(temp-1)*temp/2,cnt++;
}
cout<<cnt<<endl;
}
return 0;
}