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 <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

int tetr[131];
int dp1[1234567];
int dp2[1234567];
signed main() {
    REP(i,130) tetr[i]=(i+1)*(i+2)*(i+3)/6;
    fill(ALL(dp1),INF);
    fill(ALL(dp2),INF);

    dp1[0]=0;
    dp2[0]=0;
    REP(i,130) {
        REP(j,1000010) {
            if(dp1[j]!=INF) {
                if(j+tetr[i]<=1000010) chmin(dp1[j+tetr[i]],dp1[j]+1);
            }
            if(tetr[i]%2==0) {
                continue;
            }
            if(dp2[j]!=INF) {
                if(j+tetr[i]<=1000010) chmin(dp2[j+tetr[i]],dp2[j]+1);
            }
        }
    }
    while(1) {
        int n;
        cin>>n;
        if(n==0) break;
        cout<<dp1[n]<<" "<<dp2[n]<<endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main() {
    vector<int> dp(1000001, 1e9);
    vector<int> dpo(1000001, 1e9);

    dp[0] = dpo[0] = 0;
    for (int i = 1; i <= 200; i++)
    {
        int l = i * (i + 1) * (i + 2) / 6;
        for (int j = 0; j+l <= 1000000; j++)
        {
            dp[j+l] = min(dp[j+l], dp[j] + 1);
        }
        if(l % 2 == 1){
            for (int j = 0; j+l <= 1000000; j++)
            {
                dpo[j+l] = min(dpo[j+l], dpo[j] + 1);
            }
        }
    }

    int n;
    for(;;){
        int n;
        cin >> n;
        if(n == 0) break;
        cout << dp[n] << " " << dpo[n] << endl;
    }
}

C++: #include <stdio.h>
#include <iostream>
#include <cstring>

#define REP(i,a,b)for(long long i=(long long)a;i<(long long)b;i++)
#define min(a,b)(a<b?a:b)

using namespace std;

int mem[200]={0};
int ary[1000010]={0};
int ary_kisu[1000010]={0};

int cul(int n){
	return 	((n*(n+1)*(n+2))/6);
}

int main(void){

	REP(i,0,200) mem[i]=cul(i);
	
	REP(i,1,1000010) ary[i]=999999;
	REP(i,1,1000010) ary_kisu[i]=999999;

	REP(j,1,200){
		REP(i,mem[j],1000001){
			if(i-mem[j]>=0)
				ary[i]=min(ary[i],ary[i-mem[j]]+1);
		}
	}

	REP(j,1,200){
		if(1&mem[j]){
			REP(i,mem[j],1000001){
				if(i-mem[j]>=0)
					ary_kisu[i]=min(ary_kisu[i],ary_kisu[i-mem[j]]+1);
			}
		}
	}

	while(1){

		int n;
		cin >> n;

		if(!n)break;

		cout << ary[n]<<" "<<ary_kisu[n]<<endl;

	}


	return 0;
}