Go: package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	var nums []int
	for i := 1; i < 2*100+1; i++ {
		nums = append(nums, i*(i+1)*(i+2)/6)
	}
	var ins []int
	N := 0
	for true {
		n := sc.nextInt()
		if n == 0 {
			break
		}
		ins = append(ins, n)
		N = max(N, n)
	}
	dp := make([]int, N+1)
	dp2 := make([]int, N+1)
	for i := 1; i < N+1; i++ {
		dp[i] = INF
		dp2[i] = INF
	}
	for i := 0; i < len(nums); i++ {
		n := nums[i]
		if n > N {
			break
		}
		for j := 0; j < N+1; j++ {
			if j >= n {
				dp[j] = min(dp[j], dp[j-n]+1)
				if n%2 != 0 {
					dp2[j] = min(dp2[j], dp2[j-n]+1)
				}
			}
		}
	}
	for i := 0; i < len(ins); i++ {
		fmt.Fprintln(wtr, dp[ins[i]], dp2[ins[i]])
	}
}

C++: 
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <tuple>
#include <set>
#include <stack>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using pci = pair<char, int>;
using vpci = vector<pci>;
#define out(S) cout<<(S)<<endl;
#define REP(i,b) for(int i=0;i<(b);i++)
#define rREP(i,b) for(int i=(b)-1;i>=0;i--)
#define FOR(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define Foreach(item,collection) for(auto item:collection)
#define mod(i) ((i) % (ll)(1e9 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9 + 5))))
#define Yes out("Yes")
#define No out("No")
#define NO out("NO")
#define YES out("YES")
#define INF 1e10;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define IfOut(condition,text) if((condition)){out(text);return 0;}
#define IfeOut(condition,itext,etext) if(condition){out(itext);return 0;}else{out(etext);return 0;}
#define Select(collection,condition,result) Foreach(i,collection){result+=condition;}
#define GetAuto(_N,vect) {cin>>_N;vect.resize(_N);REP(i,_N){cin>>vect[i];}}
#define beginend(vec) (vec).begin(),(vec).end()
#define pb(item) push_back(item)
#define removeAll(vec,deleg) auto itr=remove_if(beginend(vec),deleg);vec.erase(itr,vec.end());
void removeAt(string& s, int index) { s.erase(index, 1); }
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
ll manhattanDistance(ll x1, ll y1, ll x2, ll y2) { return (abs(x2 - x1) + abs(y2 - y1)); }
vector<ll> sieveOfEratosthenes(int max) { ll prime; double sqrtmax = sqrt(max); vector<ll> primeVec, searchVec; FOR(i, 2, max + 1) searchVec.push_back(i); do { prime = searchVec[0]; primeVec.push_back(prime); auto itr = remove_if(beginend(searchVec), [=](ll x)->bool {return x%prime == 0; }); searchVec.erase(itr, searchVec.end()); } while (prime < sqrtmax); primeVec.reserve(primeVec.size() + searchVec.size()); primeVec.insert(primeVec.end(), beginend(searchVec)); return primeVec; }
bool isPrime(ll x) { if (x == 2) return true; if (x < 2 || x % 2 == 0) return false; ll i = 3; while (i <= sqrt(x)) { if (x%i == 0) return false; i += 2; }return true; }


vi dp, odddp;
int main() {
	int N;
	int p = 4;
	REP(i, 1000001) {
		dp.pb(i);
		odddp.pb(i);
	}
	int n = 3;
	while (p<=1000000)
	{
		for (int i = 0; i+p <=1000000; i++)
		{
			dp[i + p] = min(dp[i + p], dp[i] + 1);
		}
		if (p % 2 == 1) {
			for (int i = 0; i + p <= 1000000; i++)
			{
				odddp[i + p] = min(odddp[i + p], odddp[i] + 1);
			}
		}

		p = n*(n + 1)*(n + 2) / 6;
		n++;
	}

	

	while (cin>>N,N)
	{
		cout << dp[N] << " " << odddp[N] << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

typedef long long ll;

const int INF = 1 << 30;
typedef pair<int,int> P;

vector<P> p;

void make_pollock (void )
{
	for (int i = 1; i <= 85; i++ ){
		ll ans = (ll)i*(i+1LL)*(i+2LL)/6LL;
		p.push_back (P ((int)ans, i )  );
	} // end rep
}

int main()
{
	p.clear();
	make_pollock();

	int n;
	while (cin >> n && n ){
		P res = P(0, 0 );
		vector <int> dp1 (n+1, INF ), dp2 (n+1, INF );
		dp1[0] = 0;
		for (int i = 0; i < p.size(); i++ ){
			int m = p[i].first;
			for (int j = m; j <= n; j++ ){
				if (dp1[j] > dp1[j - m] + 1 ){
					dp1[j] = dp1[j - m] + 1;
				} // end if
			} // end for
		} // end for
		res.first = dp1[n];
		dp2[0] = 0;
		for (int i = 0; i < p.size(); i++ ){
			if (p[i].first % 2 == 0 ) continue;
			int m = p[i].first;
			for (int j = m; j <= n; j++ ){
				if (dp2[j] > dp2[j - m] + 1 ){
					dp2[j] = dp2[j - m] + 1;
				} // end if
			} // end for
		} // end for
		res.second = dp2[n];	

		cout << res.first << ' ' << res.second << endl;
	} // end while
	
	return 0;
}

C++: #include<iostream>
#include<set>
#include<map>

using namespace std;

/*sqrt<3>(NMAX)==100*/

int Nkake[100+1];
int g[1000001]={0};
int k[1000001]={0};

int main(){

	int N;
	
	for(int i=1;i<=200;i++){
		Nkake[i]=i*(i+1)*(i+2)/6;
	}

	for(int i=0;i<=1000000;i++){
		for(int j=1;j<200;j++){
			if(i+Nkake[j]<=1000000){
				if(g[Nkake[j]+i]==0||g[Nkake[j]+i]>g[i]+1) g[Nkake[j]+i]=g[i]+1;
			}
		}
	}

	for(int i=0;i<=1000000;i++){
		for(int j=1;j<200;j++){
			if(Nkake[j]%2==1&&i+Nkake[j]<=1000000){
				if(k[Nkake[j]+i]==0||k[Nkake[j]+i]>k[i]+1) k[Nkake[j]+i]=k[i]+1;
			}
		}
	}

	while(1){
		cin>>N;
		if(N==0) break;

		cout<<g[N]<<" "<<k[N]<<endl;
	}
}