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 rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

int main()
{
  vector<int> dp(1e6 + 1, INT32_MAX), odd_dp(1e6 + 1, INT32_MAX);

  dp[0] = 0;
  odd_dp[0] = 0;
  rep(i, 1e6 + 1) for(int j = 200; j > 0; j--)
  {
    int regular_tetrahedron_number = j * (j + 1) * (j + 2) / 6;
    int ni = i + regular_tetrahedron_number;
    if(ni > 1e6)
      continue;

    if(dp[i] != INT32_MAX)
      dp[ni] = min(dp[ni], dp[i] + 1);

    if(regular_tetrahedron_number % 2 == 1 && odd_dp[i] != INT32_MAX)
      odd_dp[ni] = min(odd_dp[ni], odd_dp[i] + 1);
  }

  while(true)
  {
    int N;
    cin >> N;
    if(N != 0)
      cout << dp[N] << " " << odd_dp[N] << endl;
    else
      break;
  }
  return 0;
}

C++: #include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
using namespace std;


vector<int>nums;
vector<int>oddnums;

vector<vector<int>>memo(100001, vector<int>(190,-1));
vector<vector<int>>oddmemo(100001, vector<int>(50,-1));

int getans(const int num, const int used,const int atime) {
	if (memo[num][used] != -1) {
		return memo[num][used];
	}
	else {
		if (num == 0)return memo[num][used] = 0;
		if (atime > 100)return atime;
		int ans = num;
		for (int i = 0; i <= used; ++i) {
			int minusnum = nums[i];
			if (minusnum > num) {
				break;
			}
			else if (num / minusnum > 100) {
				continue;
			}
			ans = min(ans, getans(num - minusnum, i, atime + 1)+1);
		}

		return memo[num][used] = ans;
	}
}
int getoddans(const int num, const int used, const int atime) {
	if (oddmemo[num][used] != -1) {
		return  oddmemo[num][used];
	}
	else {
		if (num == 0)return oddmemo[num][used] = 0;
		if (atime > 100)return atime;
		int ans = num;
		for (int i = 0; i <= min(int(oddnums.size()),used); ++i) {
			int minusnum = oddnums[i];
			if (minusnum > num) {
				break;
			}
			else if (num / minusnum > 100) {
				continue;
			}
			ans = min(ans, getoddans(num - minusnum, i, atime + 1) + 1);
		}

		return  oddmemo[num][used] = ans;
	}
}
int main() {
	for (int i = 1; i < 190; ++i) {
		nums.push_back(i*(i + 1)*(i + 2) / 6);
		if (((i*(i + 1)*(i + 2)) / 6) % 2) {

		
			oddnums.push_back((i*(i + 1)*(i + 2)) / 6);
		}
	}

	while (1) {
		int n; cin >> n;
		if (!n)break;
		int normalans = getans(n, 189, 0);;
		int oddans = getoddans(n, 47, 0);

		cout << normalans << " " << oddans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cstring>
#define MAX 1000000
using namespace std;

int tetra[110];
int dp[MAX];
int dp2[MAX];

int main(void){
	int n;
	memset(dp,MAX,sizeof(dp));
	memset(dp2,MAX,sizeof(dp2));
	dp[0]=dp2[0]=0;
	for(int i=1;i<110;i++)
		tetra[i]=i*(i+1)*(i+2)/6;
	for(int i=1;i<110;i++){
		for(int j=0;j<MAX;j++){
			if(j+tetra[i]>=MAX)
				continue;
			dp[j+tetra[i]]=min(dp[j+tetra[i]],dp[j]+1);
			if(tetra[i]%2)
				dp2[j+tetra[i]]=min(dp2[j+tetra[i]],dp2[j]+1);
		}
	}
	while(cin >>n,n)
		cout << dp[n] <<" " << dp2[n] << endl;
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000

using namespace std;

#define MAXN 999999

int tetrahedrons[MAXN];
int triangles[MAXN];

int dp[MAXN];
int odp[MAXN];

int main(){
  rep1(i, MAXN-1){
    triangles[i] = triangles[i-1] + i;
    tetrahedrons[i] = triangles[i] + tetrahedrons[i-1];
  }

  rep(i, MAXN)dp[i]=INF;
  dp[0]=0;
  rep(i, 2000){
    rep1(j, MAXN){
      int c = tetrahedrons[i];

      if(j-c>=0)dp[j] = min<ll>(dp[j], dp[j-c]+1);
    }
  }

  rep(i, MAXN)odp[i]=INF;
  odp[0]=0;
  rep(i, 2000){
    rep1(j, MAXN){
      int c = tetrahedrons[i];
      if(c%2==0)continue;

      if(j-c>=0)odp[j] = min<ll>(odp[j], odp[j-c]+1);
    }
  }

  while(true){
    int n;cin>>n;
    if(n==0)break;

    cout<<dp[n]<<' '<<odp[n]<<endl;

  }

  return 0;
}