Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<string.h>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };


long int dp[190][1000010] = { 0 };
long int dpodd[190][1000010] = { 0 };


long int N = 0;
long int C[191];
long int Codd[51];

void input(void) {
	CI N;

	return;
}


int main(void) {
	long int C_N;
	for (int i = 1; i <= 190;i++) {
		C[i - 1] = i * (i + 1) * (i + 2) / 6;
	}
	long int ii = 1, jj = 0;
	while (true) {
		if (ii * (ii + 1) * (ii + 2) / 6 > 1000000) {
			break;
		}
		if ((ii * (ii + 1) * (ii + 2) / 6) % 2 == 1) {
			Codd[jj] = ii * (ii + 1) * (ii + 2) / 6;
			jj++;
		}
		ii++;
	}

	for (long int i = 1; i <= N; i++) {
		dp[0][i] = 1001000;
	}
	for (long int i = 1; i <= N; i++) {
		dpodd[0][i] = 1001000;
	}

	for (long int j = 1; j <= 189; j++) {
		for ( long int i = 1; i <= 100002; i++) {
			if (i < C[j - 1]) {
				dp[j][i] = dp[j - 1][i];
			}
			else {
				dp[j][i] = min(dp[j - 1][i], dp[j][i - C[j - 1]] + 1);
			}
		}
	}

	for (long int j = 1; j <= 189; j++) {
		for ( long int i = 1; i <= 100002; i++) {
			if (i < Codd[j - 1]) {
				dpodd[j][i] = dpodd[j - 1][i];
			}
			else {
				dpodd[j][i] = min(dpodd[j - 1][i], dpodd[j][i - Codd[j - 1]] + 1);
			}
		}
	}

	while (true) {
		input();
		if (N == 0) {
			break;
		}
		for (int i = 0; i < 190; i++) {
			if (C[i] > N) {
				C_N = i;
				break;
			}
		}
	

		

		CO dp[C_N][N] << " ";

		
		for (int i = 0; i < 50; i++) {
			if (Codd[i] > N) {
				C_N = i;
				break;
			}
		}
		

		CO dpodd[C_N][N] E
		
		
	}
	
	
	return 0;
}

Compiler output:
/tmp/ccGaCcoN.o: in function `input()':
a.cc:(.text+0x7): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccGaCcoN.o
/tmp/ccGaCcoN.o: in function `main':
a.cc:(.text+0x70): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x155): relocation truncated to fit: R_X86_64_PC32 against symbol `Codd' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x19a): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x1d1): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x27c): relocation truncated to fit: R_X86_64_PC32 against symbol `C' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x366): relocation truncated to fit: R_X86_64_PC32 against symbol `Codd' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x3da): relocation truncated to fit: R_X86_64_PC32 against symbol `Codd' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x49f): relocation truncated to fit: R_X86_64_PC32 against symbol `N' defined in .bss section in /tmp/ccGaCcoN.o
a.cc:(.text+0x4c5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status