foo.cc: In function 'int work(int, int, int, int, int)':
foo.cc:7:121: warning: no return statement in function returning non-void [-Wreturn-type]
ii=i-1;while (ii>=k) {for (jj=k;((z+jj*jj*ii+f[k-1]<=n)&&(jj<j));jj++) work(k-1,ii,jj,y+2*ii*jj,z+ii*jj*jj);ii--;}}}}
^
foo.cc: In function 'int main()':
foo.cc:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);f[0]=0;t[0]=0;for (i=1;i<=m;i++) {f[i]=f[i-1]+i*i*i;t[i]=t[i-1]+2*i*i;}if (f[m]>n) return 0;
~~~~~^~~~~~~~~~~~~~