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>
#include <deque>


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(size_t 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 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;}

vl dd(int max) {
	vl rt;
	int n = 1;
	while (true)
	{
		ll next = n*(n + 1)*(n + 2) / 6;
		if (max  <= next) { rt.pb(next); break; }
		rt.pb(next);
		n++;
	}
	return rt;
}

vl llist;

int bfs(int target) {
	deque<ll> q;
	Foreach(i, llist) {
		if (i == target) { return 1; }
		else if (i < target) q.pb(i);
	}
	int cnt = 2;
	while (1){
		set<ll> next;
		int ss = q.size();
		FOR(i, 0, ss) {
			int x = q.front();
			q.pop_front();
			Foreach(k, llist) {
				if (k + x > target) break;
				if (k + x == target) { next.clear(); q.clear(); return cnt; }
				if (k + x < target) next.insert(k + x);
			}
		}
		cnt++;
		deque<ll> nn;
		Foreach(i, next) nn.pb(i);
		q.resize(next.size());
		q = nn;
		nn.deque::clear();
	}
}

int bfs2(int target) {
	deque<ll> q;
	vl oddlist = llist;
	removeAll(oddlist, [](ll x) {return x % 2 == 0; });
	Foreach(i, oddlist) {
		if (i == target) { return 1; }
		else if (i < target) q.pb(i);
	}
	int cnt = 2;
	while (1) {
		set<ll> next;
		int ss = q.size();
		FOR(i, 0, ss) {
			int x = q.front();
			q.pop_front();
			Foreach(k, oddlist) {
				if (k + x > target) break;
				if (k + x == target) { next.clear(); q.clear(); return cnt; }
				if (k + x < target) next.insert(k + x);
			}
		}
		cnt++;
		deque<ll> nn;
		Foreach(i, next) nn.pb(i);
		q.resize(next.size());
		q = nn;
		nn.deque::clear();
	}
}

int main() {
	vi query;
	int k;
	while (cin >> k, k)query.pb(k);
	auto mm = max_element(beginend(query));
	llist = dd(*mm);
	//ShowAll(llist);
	Foreach(q, query) {
		cout << bfs(q) << " " << bfs2(q) << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define INF 1 << 25

int dp[1500000];
int dp2[1500000];

int main()
{
  int n;
  int tetra[200];
  for(int i = 0; i < 200; i++) tetra[i] = (i+1)*(i+2)*(i+3)/6;
  for(int i = 0; i < 1500000; i++) dp[i] = dp2[i] = INF;
  dp[0] = dp2[0] = 0;
  for(int i = 0; i < 200; i++){
    dp[tetra[i]] = 1;
    if(tetra[i]%2 == 1) dp2[tetra[i]] = 1;
  }
  for(int i = 0; i < 200; i++){
    for(int j = 0; j + tetra[i] <= 1000000; j++){
      dp[j+tetra[i]] = min(dp[j+tetra[i]], dp[j] + dp[tetra[i]]);
      if(tetra[i]%2) dp2[j+tetra[i]] = min(dp2[j+tetra[i]], dp2[j] + dp2[tetra[i]]);
    }
  }
  while(cin >> n, n){
    cout << dp[n] << " " << dp2[n] << endl;
  }
  return 0;
}

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

using namespace std;

int dp1[100010]={0};
int dp2[100010]={0};
int List[100];

void setpolloc(){
	int i,j,li;
/*	for(i=1;i*(i+1)*(i+2)/6<=100000;i++){
		List[i]=i*(i+1)*(i+2)/6;
		dp1[i*(i+1)*(i+2)/6]=1;
		if((i*(i+1)*(i+2)/6)%2) dp2[i*(i+1)*(i+2)/6]=1;
	}
	List[i]=i*(i+1)*(i+2)/6;
	for(i=1;i<=100000;i++){
		if(dp2[i]) continue;
		for(j=1;List[j]<=i-1;j+=2)if(!dp2[i] || dp2[List[j]]+dp2[i-List[j]] < dp2[i]) dp2[i]=dp2[List[j]]+dp2[i-List[j]];
		if(dp1[i]) continue;
		for(j=1;List[j]<=i-1;j++) if(!dp1[i] || dp1[List[j]]+dp1[i-List[j]] < dp1[i]) dp1[i]=dp1[List[j]]+dp1[i-List[j]];
	}
*/}


int main(){
	int n;
	setpolloc();
	while(cin>>n,n){
		cout << dp1[n] << ' ' << dp2[n] << endl;
	}
	return 0;
}