criyle/codenet-compile-errors huggingface dataset:
Language: C++


#include <iostream>
#include <vector>
#include <iterator>
#include <string>
#include <sstream>

using namespace std;

string GetStr()
{
	string str;
	getline(cin,str);
	return str;
}

vector<int> GetIntVector()
{
	string str;
	getline(cin,str);
	istringstream line( str );

	istream_iterator<int> iit(line);
	istream_iterator<int> iit_eof;

	vector<int> ret;

	for(;iit != iit_eof; iit++){
		ret.push_back(*iit);
	}

	return ret;
}


typedef struct _Size
{
	int w,h;

	bool IsZero(){return w == 0 || h == 0;}

	
	static struct _Size GetSize()
	{
		Size s;
		vector<int> vec = GetIntVector();
		s.w = vec[0];
		s.h = vec[1];
		return s;
	}

} Size;

void GoNextFloor(Size& s,vector<vector<int>>& vwhole,vector<vector<int>>& hwhole,vector<vector<int>>& floor,int x,int y,int step)
{
	floor[y][x] = step;
	if(y == s.h-1 && x == s.w-1) return ;

	step++;

	//ã
	if(y > 0 && hwhole[y-1][x] == 0 && floor[y-1][x] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x,y-1,step);

	//º
	if(y < s.h - 1 && hwhole[y][x] == 0 && floor[y+1][x] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x,y+1,step);

	//¶
	if(x > 0 && vwhole[y][x-1] == 0 && floor[y][x-1] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x-1,y,step);

	//E
	if(x < s.w - 1 && vwhole[y][x] == 0 && floor[y][x+1] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x+1,y,step);

	//SÄÌ×Ì°ðà¢½ÌÅAé
	return;
}

void EscapeMaze(Size& s)
{
	//cA¡ÌÇ(v,h)
	vector<vector<int>> vwhole,hwhole;

	vwhole.push_back(GetIntVector());
	for(int i = 0; i < s.h - 1; i++){
		hwhole.push_back(GetIntVector());
		vwhole.push_back(GetIntVector());
	}

	vector<vector<int>> floor(s.h);
	for(int i = 0; i < s.h; i++){
		floor[i].resize(s.w);
		for(int j = 0; j < s.w; j++){
			floor[i][j] = INT_MAX;
		}
	}

	GoNextFloor(s,vwhole,hwhole,floor,0,0,1);

	int ans = floor[s.h - 1][s.w - 1];
	ans = (ans == INT_MAX) ? 0 : ans;

	cout << ans << endl;
}

void B()
{
	Size size = Size::GetSize();
	while(!size.IsZero()){
		EscapeMaze(size);
		size = Size::GetSize();
	}
}

int main()
{
	B();

	return 0;
}

Compiler output:
a.cc: In static member function 'static _Size _Size::GetSize()':
a.cc:45:17: error: 'Size' was not declared in this scope; did you mean '_Size'?
   45 |                 Size s;
      |                 ^~~~
      |                 _Size
a.cc:47:17: error: 's' was not declared in this scope
   47 |                 s.w = vec[0];
      |                 ^
a.cc: In function 'void EscapeMaze(Size&)':
a.cc:96:39: error: 'INT_MAX' was not declared in this scope
   96 |                         floor[i][j] = INT_MAX;
      |                                       ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <sstream>
  +++ |+#include <climits>
    7 | 
a.cc:103:23: error: 'INT_MAX' was not declared in this scope
  103 |         ans = (ans == INT_MAX) ? 0 : ans;
      |                       ^~~~~~~
a.cc:103:23: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++


#include <iostream>
#include <vector>
#include <iterator>
#include <string>
#include <sstream>
#include <limits.h>

using namespace std;

string GetStr()
{
	string str;
	getline(cin,str);
	return str;
}

vector<int> GetIntVector()
{
	string str;
	getline(cin,str);
	istringstream line( str );

	istream_iterator<int> iit(line);
	istream_iterator<int> iit_eof;

	vector<int> ret;

	for(;iit != iit_eof; iit++){
		ret.push_back(*iit);
	}

	return ret;
}


typedef struct _Size
{
	int w,h;

	bool IsZero(){return w == 0 || h == 0;}

	
	static struct _Size GetSize()
	{
		Size s;
		vector<int> vec = GetIntVector();
		s.w = vec[0];
		s.h = vec[1];
		return s;
	}

} Size;

void GoNextFloor(Size& s,vector<vector<int> >& vwhole,vector<vector<int> >& hwhole,vector<vector<int> >& floor,int x,int y,int step)
{
	floor[y][x] = step;
	if(y == s.h-1 && x == s.w-1) return ;

	step++;

	//ã
	if(y > 0 && hwhole[y-1][x] == 0 && floor[y-1][x] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x,y-1,step);

	//º
	if(y < s.h - 1 && hwhole[y][x] == 0 && floor[y+1][x] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x,y+1,step);

	//¶
	if(x > 0 && vwhole[y][x-1] == 0 && floor[y][x-1] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x-1,y,step);

	//E
	if(x < s.w - 1 && vwhole[y][x] == 0 && floor[y][x+1] > step)
		GoNextFloor(s,vwhole,hwhole,floor,x+1,y,step);

	//SÄÌ×Ì°ðà¢½ÌÅAé
	return;
}

void EscapeMaze(Size& s)
{
	//cA¡ÌÇ(v,h)
	vector<vector<int> > vwhole,hwhole;

	vwhole.push_back(GetIntVector());
	for(int i = 0; i < s.h - 1; i++){
		hwhole.push_back(GetIntVector());
		vwhole.push_back(GetIntVector());
	}

	vector<vector<int> > floor(s.h);
	for(int i = 0; i < s.h; i++){
		floor[i].resize(s.w);
		for(int j = 0; j < s.w; j++){
			floor[i][j] = INT_MAX;
		}
	}

	GoNextFloor(s,vwhole,hwhole,floor,0,0,1);

	int ans = floor[s.h - 1][s.w - 1];
	ans = (ans == INT_MAX) ? 0 : ans;

	cout << ans << endl;
}

void B()
{
	Size size = Size::GetSize();
	while(!size.IsZero()){
		EscapeMaze(size);
		size = Size::GetSize();
	}
}

int main()
{
	B();

	return 0;
}

Compiler output:
a.cc: In static member function 'static _Size _Size::GetSize()':
a.cc:46:17: error: 'Size' was not declared in this scope; did you mean '_Size'?
   46 |                 Size s;
      |                 ^~~~
      |                 _Size
a.cc:48:17: error: 's' was not declared in this scope
   48 |                 s.w = vec[0];
      |                 ^
Language: C++

#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#define L 2
#define U 3
#define R 0
#define D 1

using namespace std;
   
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
   
int cost[30][30];
bool wall[4][30][30];
bool visited[30][30];
int w, h;
   
int bfs(int sx, int sy, int gx, int gy) {
  fill(cost[0], cost[32], 0);
  fill(visited[0], visited[32], false);
  cost[0][0] = 1;
     
  queue<pair<int, int> > Q;
  Q.push(make_pair(0, 0));
  visited[0][0] = true;
  while(!Q.empty()) {
    pair<int, int> st = Q.front(); Q.pop();
       
    if(st.first == gx && st.second == gy) {
      return cost[gy][gx];
    }
       
    for(int i=0; i<4; i++) {
      int nx = st.first + dx[i]
	int ny = st.second + dy[i];
      if(0<= nx && nx < w && 0<= ny && ny < h) {
	if(!visited[ny][nx] && !wall[i][st.second][st.first]) {
	  visited[ny][nx] = true;
	  cost[ny][nx] = cost[st.second][st.first] + 1;
	  Q.push(make_pair(nx, ny));
	}
      }
    }
  }
  return 0;
}

int main(void) {
  while(cin >> w >> h && w+h) {
    fill(wall[0][0], wall[4][30], 0);
    
    for(int i=0; i<h; i++) {
      wall[R][i][0] = wall[L][i][w-1] = 1;
    }
    for(int i=0; i<w; i++) {
      wall[D][0][i] = wall[U][h-1][i] = 1;
    }
    
    for(int i=0; i<h; i++) {
      
      for(int j=0; j<w-1; j++) {
	cin >> wall[L][i][j];
	wall[R][i][j+1] = wall[L][i][j];
      }
      
      if(i < h-1) {
	for(int j=0; j<w; j++) {
	  cin >> wall[U][i][j];
	  wall[D][i+1][j] = wall[U][i][j];
	}
      }
    }
    cout << bfs(0, 0, w-1, h-1) << endl;
  }
   return 0;
}

Compiler output:
a.cc: In function 'int bfs(int, int, int, int)':
a.cc:37:9: error: expected ',' or ';' before 'int'
   37 |         int ny = st.second + dy[i];
      |         ^~~
a.cc:38:34: error: 'ny' was not declared in this scope; did you mean 'nx'?
   38 |       if(0<= nx && nx < w && 0<= ny && ny < h) {
      |                                  ^~
      |                                  nx
Language: C++

#include<iostream>
using namesapce std;

int main(){
cout << "Hello World" << endl;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namesapce'
    2 | using namesapce std;
      |       ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    5 | cout << "Hello World" << endl;
      | ^~~~
      | std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:5:26: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    5 | cout << "Hello World" << endl;
      |                          ^~~~
      |                          std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main2010C {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		int[] pol = new int[1000000];
		ArrayList<Integer> p1 = new ArrayList<>();
		int[] pol_odd = new int[1000000];
		ArrayList<Integer> p1_odd = new ArrayList<>();
		
		int num = 1;
		for(int i=1;num<1000000;i++){
			p1.add(num);
			if((num&1)==1){
				p1_odd.add(num);
			}
			num = num * (i+3) / i;
		}
		
		for(int i=1;i<1000000;i++){
			int min = Integer.MAX_VALUE;
			for(int j=0;j<p1.size();j++){
				if(i-p1.get(j)<0) break;
				min = Math.min(min,pol[i-p1.get(j)]);
			}
			pol[i] = min + 1;
			
			min = Integer.MAX_VALUE;
			for(int j=0;j<p1_odd.size();j++){
				if(i-p1_odd.get(j)<0) break;
				min = Math.min(min,pol_odd[i-p1_odd.get(j)]);
			}
			pol_odd[i] = min + 1;
		}
		
		while(true){
			int x = in.nextInt();
			if(x==0) break;
			else{
				System.out.println(pol[x]+" "+pol_odd[x]);
			}
		}
	}	
}

Compiler output:
Main.java:4: error: class Main2010C is public, should be declared in a file named Main2010C.java
public class Main2010C {
       ^
1 error
Language: Java

#include <stdio.h>
#include <stdlib.h>
#define num 100000
#define true 1
#define false 0

void pollock();
int min(int f1,int f2);
int *dp_ki;
int *dp;
int N;

int main(){
  dp_ki = (int *)malloc(num * sizeof(int));
  dp = (int *)malloc(num * sizeof(int));
  for(int i=0;i<num;i++){
    dp[i]=i;
    dp_ki[i]=i;
  }
  pollock();

  while(scanf("%d",&N),N){
    printf("%d %d\n",dp[N],dp_ki[N] );
  }

  free(dp_ki);
  free(dp);
  exit(0);
}

int min(int f1,int f2){
  if(f1>f2){
    return f2;
  }else{
    return f1;
  }
}

void pollock(){
  for(int n=3,p=4;p<num;n++){
    for(int i=0;i+p<num;i++){
      dp[i+p] = min(dp[i+p],dp[i]+1);
    }
    if(p%2){
      for(int i=0;i+p<num;i++){
        dp_ki[i+p] = min(dp_ki[i+p],dp_ki[i]+1);
      }
    }
    p= n*(n+1)*(n+2)/6;
  }
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include <stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <stdio.h>
         ^
Main.java:2: error: illegal character: '#'
#include <stdlib.h>
^
Main.java:3: error: illegal character: '#'
#define num 100000
^
Main.java:4: error: illegal character: '#'
#define true 1
^
Main.java:5: error: illegal character: '#'
#define false 0
^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
int min(int f1,int f2);
^
  (use --enable-preview to enable unnamed classes)
Main.java:9: error: class, interface, enum, or record expected
int *dp_ki;
^
Main.java:10: error: class, interface, enum, or record expected
int *dp;
^
Main.java:22: error: not a statement
  while(scanf("%d",&N),N){
                       ^
Main.java:14: error: '.class' expected
  dp_ki = (int *)malloc(num * sizeof(int));
               ^
Main.java:14: error: illegal start of expression
  dp_ki = (int *)malloc(num * sizeof(int));
                ^
Main.java:14: error: ';' expected
  dp_ki = (int *)malloc(num * sizeof(int));
                 ^
Main.java:14: error: '.class' expected
  dp_ki = (int *)malloc(num * sizeof(int));
                                        ^
Main.java:15: error: '.class' expected
  dp = (int *)malloc(num * sizeof(int));
            ^
Main.java:15: error: illegal start of expression
  dp = (int *)malloc(num * sizeof(int));
             ^
Main.java:15: error: ';' expected
  dp = (int *)malloc(num * sizeof(int));
              ^
Main.java:15: error: '.class' expected
  dp = (int *)malloc(num * sizeof(int));
                                     ^
Main.java:22: error: illegal start of expression
  while(scanf("%d",&N),N){
                   ^
Main.java:22: error: ')' expected
  while(scanf("%d",&N),N){
                      ^
Main.java:22: error: ';' expected
  while(scanf("%d",&N),N){
                        ^
21 errors
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class Main3 {

	static int N,min,cnt;
	static int[] a =new int[180];
	static int[] b =new int[45];
	static int[] alreadyA;
	static int[] alreadyB;
	static{
		int cnt=0;
		for(int i = 1;tetrahedral(i)<=1000000;i++){
			int t = tetrahedral(i);
			a[cnt++]=t;
		}
		for(int i = 0;i<a.length;i++){
			//System.out.println(a[i]);
		}		
		alreadyA=new int[1000000];
		alreadyB=new int[1000000];
		cnt=0;
		for(int i = 1;tetrahedral(i)<=1000000;i++){
			int t = tetrahedral(i);
			if(t%2==1){
				b[cnt++]=t;
			}
		}

	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		Arrays.fill(alreadyA, 0);
		Arrays.fill(alreadyB, 0);
		a();
		while(true){
			N =cin.nextInt();
			if(N==0){
				break;
			}
			cnt=0;min=Integer.MAX_VALUE;
			
			System.out.print(alreadyA[N]);
			System.out.println(" "+alreadyB[N]);
		}

	}
	static void a(){
		for(int i= 1;i<1000000;i++){
			int mina=Integer.MAX_VALUE;
			int minb=Integer.MAX_VALUE;
			int x=0,y=0;
			for(int j=0;j<180&&a[j]<=i;j++){
				mina=Math.min(1+alreadyA[i-a[j]],mina);
				if(a[j]%2==1){
					minb=Math.min(1+alreadyB[i-a[j]],minb);
				}
			}
			//System.out.println(i+" " +x+" " +y + " " +min);
			alreadyA[i]=mina;
			alreadyB[i]=minb;
		}
	}
	static int tetrahedral(int a){
		return (a*(a+1)*(a+2))/6;
	}
}

Compiler output:
Main.java:4: error: class Main3 is public, should be declared in a file named Main3.java
public class Main3 {
       ^
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class PollockConjecture {
	Scanner in = new Scanner(System.in);
	int n;
	int[] pollock = new int[180];
	int[] cnt = new int[1000001];
	int[] cnt2 = new int[1000001];
	
	void initPollock() {
		for (int i = 1; i <= pollock.length; i++) {
			pollock[i-1] = (i * (i+1) * (i+2)) / 6;
		}
	}
	
	public PollockConjecture() {
		initPollock();
		Arrays.fill(cnt, 1000000);
		Arrays.fill(cnt2, 1000000);
		cnt[0] = 0; cnt2[0] = 0;
		for (int i = 0; i < pollock.length; i++) {
			int pol = pollock[i];
			if (pol % 2 == 0) {
				for (int j = pol; j <= 1000000; j++) {
					cnt[j] = Math.min(cnt[j], cnt[j - pol] + 1);
				}
			} else {
				for (int j = pol; j <= 1000000; j++) {
					cnt[j] = Math.min(cnt[j], cnt[j - pol] + 1);
					cnt2[j] = Math.min(cnt2[j], cnt2[j - pol] + 1);
				}
			}
		}
		while (true) {
			n = in.nextInt();
			if (n == 0) break;
			System.out.println(cnt[n] + " " + cnt2[n]);
		}
	}
	
	public static void main(String args[]) {
		new PollockConjecture();
	}
}

Compiler output:
Main.java:4: error: class PollockConjecture is public, should be declared in a file named PollockConjecture.java
public class PollockConjecture {
       ^
1 error
Language: C

#include<stdio.h>

int min(int b,int c)
{
	int M;
	if(b!=0 && c!=0)
	{
	   M=b;
	   if(M>c) M=c;
	}
	else
	{
		if(b==0)
		{
			return c;
		}
		else
		{
			return b;
		}
	}
	return M;
}

int main(void)
{
	int i,j,k,l,z,n,a[1000],e[1000],dp[1000][1000001],dp2[1000][1000001];
	while(1)
	{
		scanf("%d",&n);
		if(n==0) break;
		a[0]=0;
		e[0]=0;
		j=1;
		z=0;
		for(i=1;z==0;i++)
		{
			a[i]=(i*(i+1)*(i+2))/6;
			if(a[i]>n) z=-1;
			if(a[i]%2==1)
			{
				b[j]=a[i];
				j++;
			}
		}
		k=i;
		l=j-1;
		for(i=0;i<=n;i++)
		{
			dp[0][i]=0;
		}
		for(i=1;i<=k;i++)
		{
			for(j=0;j<=n;j++)
			{
				if(a[i]<=j)
				{
					dp[i][j]=min(dp[i][j-a[i]]+1,dp[i-1][j]);
				}
				else
				{
					dp[i][j]=dp[i-1][j];
				}
			}
		}
		for(i=0;i<=n;i++)
		{
			dp2[0][i]=0;
		}
		for(i=1;i<=l;i++)
		{
			for(j=0;j<=n;j++)
			{
				if(e[i]<=j)
				{
					dp2[i][j]=min(dp2[i][j-e[i]]+1,dp2[i-1][j]);
				}
				else
				{
					dp2[i][j]=dp2[i-1][j];
				}
			}
		}
		printf("%d %d\n",dp[k][n],dp2[l][n]);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:42:33: error: 'b' undeclared (first use in this function)
   42 |                                 b[j]=a[i];
      |                                 ^
main.c:42:33: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#define min(a,b) a<b?a:b

int main(){
	int n;
	int i;
	int c;
	int a[1000001];
	int b[1000001];
 
	for(i = 0;i < 1000001;i++){
		a[i] = i;
		b[i] = i;
	}

	for(i = 3,c = 4;i < 1000001;i++){
		for(j = a;j < 1000001;j++){
			a[i] = min(a[i],a[i-c]+1);
		}
		if(a % 2){
			for(j = a;j < 1000001;j++){
				b[i] = min(b[i],b[i-c]+1);
			}
		}
		c = i * (i+1) * (i+2) / 6;
	}

	while(scanf("%d",&n),n){
		printf("%d %d\n",a[n],b[n]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:21: error: 'j' undeclared (first use in this function)
   17 |                 for(j = a;j < 1000001;j++){
      |                     ^
main.c:17:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:20:22: error: invalid operands to binary % (have 'int *' and 'int')
   20 |                 if(a % 2){
      |                    ~ ^
      |                    |
      |                    int *
Language: C

#include <stdio.h>
#define min(a,b) a<b?a:b

int main(){
	int n;
	int i,j;
	int c;
	int a[1000001];
	int b[1000001];
 
	for(i = 0;i < 1000001;i++){
		a[i] = i;
		b[i] = i;
	}

	for(i = 3,c = 4;i < 1000001;i++){
		for(j = a;j < 1000001;j++){
			a[i] = min(a[i],a[i-c]+1);
		}
		if(a % 2){
			for(j = a;j < 1000001;j++){
				b[i] = min(b[i],b[i-c]+1);
			}
		}
		c = i * (i+1) * (i+2) / 6;
	}

	while(scanf("%d",&n),n){
		printf("%d %d\n",a[n],b[n]);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:23: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   17 |                 for(j = a;j < 1000001;j++){
      |                       ^
main.c:20:22: error: invalid operands to binary % (have 'int *' and 'int')
   20 |                 if(a % 2){
      |                    ~ ^
      |                    |
      |                    int *
main.c:21:31: error: assignment to 'int' from 'int *' makes integer from pointer without a cast [-Wint-conversion]
   21 |                         for(j = a;j < 1000001;j++){
      |                               ^
Language: C

#include <stdio.h>
#include <string.h>

const int PMAX = 180;
const int OMAX = 45;

const int MAX = 1000000;
int tp[MAX];
int to[MAX];

int main(void)
{
    int i, j, n;
    int p[PMAX], o[OMAX];

    for (i = j = 1; (n = i * (i + 1) * (i + 2) / 6) < MAX; ++i) {
        p[i] = n;
        if (n % 2 == 1)
            o[j++] = n;
    }

    memset(tp, MAX, sizeof(tp));
    memset(to, MAX, sizeof(to));
    tp[0] = to[0] = 0;
    for (i = 0; i < MAX; ++i)
        for (j = 1; j < PMAX; ++j)
            if (i + p[j] < MAX && tp[i + p[j]] > tp[i] + 1)
                tp[i + p[j]] = tp[i] + 1;
    for (i = 0; i < MAX; ++i)
        for (j = 1; j < OMAX; ++j)
            if (i + o[j] < MAX && to[i + o[j]] > to[i] + 1)
                to[i + o[j]] = to[i] + 1;

    for (;;) {
        int n;

        scanf("%d", &n);
        if (n == 0)
            break;

        printf("%d %d\n", tp[n], to[n]);
    }

    return 0;
}

Compiler output:
main.c:8:5: error: variably modified 'tp' at file scope
    8 | int tp[MAX];
      |     ^~
main.c:9:5: error: variably modified 'to' at file scope
    9 | int to[MAX];
      |     ^~
Language: C++

//
//  main.cpp
//  AOJ1167
//
//  Created by aki33524 on 2014/07/09.
//  Copyright (c) 2014年 aki33524. All rights reserved.
//

#include <iostream>
#include <vector>
using namespace std;

const int MAX_N = 1000000;
const int MAX_T = 200;

vector<int> tetras;
vector<int> oddtetras;
int dp1[MAX_T + 1][MAX_N];
int dp2[MAX_T + 1][MAX_N];

void init(){
    memset(dp1, 0x3f, sizeof(dp1));
    memset(dp2, 0x3f, sizeof(dp2));
    
    for(int i=0; i<MAX_T; i++){
        int t = i*(i+1)*(i+2)/6;
        tetras.push_back(t);
        if(t%2)
            oddtetras.push_back(t);
    }
    
    for(int i=0; i<tetras.size(); i++)
        dp1[0][tetras[i]] = 1;
    for(int i=0; i<tetras.size(); i++){
        int t = tetras[i];
        for(int j=0; j<MAX_N; j++){
            if(j < t){
                dp1[i+1][j] = dp1[i][j];
            }else{
                dp1[i+1][j] = min(dp1[i][j], dp1[i+1][j-t]+1);
            }
        }
    }
    
    for(int i=0; i<oddtetras.size(); i++)
        dp2[0][oddtetras[i]] = 1;
    for(int i=0; i<oddtetras.size(); i++){
        int t = oddtetras[i];
        for(int j=0; j<MAX_N; j++){
            if(j < t){
                dp2[i+1][j] = dp2[i][j];
            }else{
                dp2[i+1][j] = min(dp2[i][j], dp2[i+1][j-t]+1);
            }
        }
    }
}

int main(int argc, const char * argv[])
{
    init();
    
    int N;
    while(cin>>N, N){
        cout << dp1[tetras.size()][N] << " " << dp2[oddtetras.size()][N] << endl;;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:22:5: error: 'memset' was not declared in this scope
   22 |     memset(dp1, 0x3f, sizeof(dp1));
      |     ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <vector>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C++

using namespace std;
int main(){
  int n,cpn,data[N],i,cnt,minv,cal,l;
  for(i=1;i<=N;i++) data[i]=(i*(i+1)*(i+2))/6;
  while(1){
    cin >> n;
    if(n==0) break;
    cnt=n;
    cpn=n;
    minv=INFINITY;
    l=0;
    while(cnt){
      n=cpn;
      cal=0;
      for(i=n-l;i>=1;i--){
	cal+=n/data[i];
	n%=data[i];
      }
      minv=min(minv,cal);
      cnt--;
      l++;
    }
    cout << minv;
    n=cpn;
    cnt=n;
    minv=INFINITY;
    l=0;
    while(cnt){
      n=cpn;
      cal=0;
      for(i=n-l;i>=1;i--){
	if(data[i]%2==1){
	  cal+=n/data[i];
	  n%=data[i];
	}
      }
      minv=min(minv,cal);
      cnt--;
      l++;
    }
    cout << ' ' << minv << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:18: error: 'N' was not declared in this scope
    3 |   int n,cpn,data[N],i,cnt,minv,cal,l;
      |                  ^
a.cc:4:21: error: 'data' was not declared in this scope
    4 |   for(i=1;i<=N;i++) data[i]=(i*(i+1)*(i+2))/6;
      |                     ^~~~
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin >> n;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:10:10: error: 'INFINITY' was not declared in this scope
   10 |     minv=INFINITY;
      |          ^~~~~~~~
a.cc:16:16: error: 'data' was not declared in this scope
   16 |         cal+=n/data[i];
      |                ^~~~
a.cc:19:12: error: 'min' was not declared in this scope; did you mean 'minv'?
   19 |       minv=min(minv,cal);
      |            ^~~
      |            minv
a.cc:23:5: error: 'cout' was not declared in this scope
   23 |     cout << minv;
      |     ^~~~
a.cc:23:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:12: error: 'data' was not declared in this scope
   32 |         if(data[i]%2==1){
      |            ^~~~
a.cc:37:12: error: 'min' was not declared in this scope; did you mean 'minv'?
   37 |       minv=min(minv,cal);
      |            ^~~
      |            minv
a.cc:41:28: error: 'endl' was not declared in this scope
   41 |     cout << ' ' << minv << endl;
      |                            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
  
using namespace std;

#define pi 3.141592653589793

int main()
{
	int result[1000001] = {};
	int odd_result[1000001] = {};
	fill(result, result + 1000000, 1000000);
	fill(odd_result, odd_result + 1000000, 1000000);
	int trangular_sum = 0, tetrahedral_sum = 0;
	result[0] = 0;
	odd_result[0] = 0;
	for(int i = 1; tetrahedral_sum < 1000000; i++){
		trangular_sum += i;
		tetrahedral_sum += trangular_sum;
		// result[trangular_sum] = 1;
		result[tetrahedral_sum] = 1;
		if(tetrahedral_sum % 2 == 1) odd_result[tetrahedral_sum] = 1;
	}
	for(int i = 1; i < 1000000; i++){
		for(int j = 1; j < i; j++){
			result[i] = min(result[i], result[i - j] + result[j]);
			if(j % 2 == 1) odd_result[i] = min(odd_result[i], odd_result[i - j] + odd_result[j]);
		}
		// cout << i  << " " << result[i] << " " << odd_result[i] << endl;
	}
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		cout << result[n] << " " odd_result[n] << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:41: error: expected ';' before 'odd_result'
   49 |                 cout << result[n] << " " odd_result[n] << endl;
      |                                         ^~~~~~~~~~~
      |                                         ;
Language: C++

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
using namespace std;
int n;
int dp[5000001];
int dp2[5000001];

int func(int v){
	if(dp[v]!=INF)return dp[v];
	if(v==0)return 0;
	int cnt=INF;
	int j=1;
	while(j*(j+1)*(j+2)/6<=v)j++;
	j--;
	for(int i=j;i>=1;i--){
		cnt=min(cnt,func(v-i*(i+1)*(i+2)/6));
	}
	return (dp[v]=cnt+1);
}

int func2(int v){
	if(dp2[v]!=INF)return dp2[v];
	if(v==0)return 0;
	int cnt=INF;
	int j=1,i;
	while(j*(j+1)*(j+2)/6<=v)j++;
	j--;
	for(i=j;i>=1;i--){
		if((i*(i+1)*(i+2)/6)%2!=1)continue;
		cnt=min(cnt,func2(v-i*(i+1)*(i+2)/6));
	}
	return (dp2[v]=cnt+1);
}

int main(void){
	for(int i=1;i<=2000000;i++)dp[i]=dp2[i]=INF;
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		printf("%d %d\n",func(n),func2(n));
	}
	return 0;
}

Compiler output:
a.cc: In function 'int func(int)':
a.cc:11:19: error: 'INF' was not declared in this scope
   11 |         if(dp[v]!=INF)return dp[v];
      |                   ^~~
a.cc:13:17: error: 'INF' was not declared in this scope
   13 |         int cnt=INF;
      |                 ^~~
a.cc: In function 'int func2(int)':
a.cc:24:20: error: 'INF' was not declared in this scope
   24 |         if(dp2[v]!=INF)return dp2[v];
      |                    ^~~
a.cc:26:17: error: 'INF' was not declared in this scope
   26 |         int cnt=INF;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:38:49: error: 'INF' was not declared in this scope
   38 |         for(int i=1;i<=2000000;i++)dp[i]=dp2[i]=INF;
      |                                                 ^~~
Language: C++

#include <cstdio>
#include <vector>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);++i)
#define SET(a,c) memset(a,c,sizeof(a))
#define PB push_back
using namespace std;

const int MAX_N = 1e6;
const int INF = 0x3f3f3f3f;

void solve(int n)
{
	vector<int> m;
	int dp[MAX_N], dp_odd[MAX_N];
	SET(dp, INF);
	SET(dp_odd, INF);
	
	REP(i, MAX_N) {
		m.PB( (i+1)*(i+2)*(i+3)/6 );
		if (m.back() > n) break;
	}

	dp[0] = 0;
	dp_odd[0] = 0;
	REP(i, m.size()) {
		REP(j, n + 1) {
			if (j < m[i]) continue;
			dp[j] = min(dp[j], dp[j - m[i]] + 1);
			if (m[i] % 2) dp_odd[j] = min(dp_odd[j], dp_odd[j - m[i]] + 1);
		}
	}	
	printf("%d %d\n", dp[n], dp_odd[n]);
}

int main()
{
	int n;
	while (1) {
		scanf("%d", &n);
		if (!n) break;
		solve(n);
	}

	return 0;
}

Compiler output:
a.cc: In function 'void solve(int)':
a.cc:5:18: error: 'memset' was not declared in this scope
    5 | #define SET(a,c) memset(a,c,sizeof(a))
      |                  ^~~~~~
a.cc:16:9: note: in expansion of macro 'SET'
   16 |         SET(dp, INF);
      |         ^~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | #define REP(i,n) for(int i=0;i<(n);++i)
Language: C++

#include <iostream>
using namespace std;
int main(){
  int a[190]={0},b[50]={0},c[1000001]={0,1,2,3},d[1000001],k=0,i,j,n;

  for(i=1;i<190;i++)a[k++]=i*(i+1)*(i+2)/6;

  for(j=k=0;j<i;j++)if(a[j]%2)b[k++]=a[j];

  for(i=1;i<189;i++)for(j=a[i];j<a[i+1];j++)c[j]=c[j-a[i]]+1;

  for(i=0;i<36;i++)d[i]=i;
  for(i=1;i<k-1;i++)for(j=b[i];j<b[i+1];j++)d[j]=d[j-b[i]]+1;

  while(cin>>n,n){
    cout<<c[n]<<' ';
    for(i=0;i<36;i++)d[i]=i;
  for(i=1;i<k-1;i++)for(j=b[i];j<b[i+1];j++)d[j]=d[j-b[i]]+1;
cout<<d[n]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:2: error: expected '}' at end of input
   20 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int i,j,k,t=0,a[200]={},b[200]={},c[1000005]={1000000},d[1000005]={1000000};
  for(i=1;i<201;i++) {
    a[i-1]=i*(i+1)*(i+2)/6;
    if(m[i-1]%2==1)b[t++]=m[i-1];
  }
  for(i=c[0]=d[0]=0;i<200;i++) {
    for(j=a[i];j<1000005;j++){
      c[j]=min(c[j],c[j-a[i]]+1);
    }
  }
  for(i=0;i<t;i++) {
    for(j=b[i];j<1000005;j++){
      d[j]=min(d[j],d[j-b[i]]+1);
    }
  }
  while(cin>>n,n)cout<<c[n]<<" "<<b[n]<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'm' was not declared in this scope
    7 |     if(m[i-1]%2==1)b[t++]=m[i-1];
      |        ^
a.cc:19:14: error: 'n' was not declared in this scope
   19 |   while(cin>>n,n)cout<<c[n]<<" "<<b[n]<<endl;
      |              ^
Language: C++

#include<iostream>
using namespace std;
int main(){
  int n,i,j,k,t=0,a[200]={},b[200]={},c[1000005]={1000000},d[1000005]={1000000};
  for(i=1;i<201;i++) {
    a[i-1]=i*(i+1)*(i+2)/6;
    if(a[i-1]%2==1)b[t++]=m[i-1];
  }
  for(i=c[0]=d[0]=0;i<200;i++) {
    for(j=a[i];j<1000005;j++){
      c[j]=min(c[j],c[j-a[i]]+1);
    }
  }
  for(i=0;i<t;i++) {
    for(j=b[i];j<1000005;j++){
      d[j]=min(d[j],d[j-b[i]]+1);
    }
  }
  while(cin>>n,n)cout<<c[n]<<" "<<b[n]<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:27: error: 'm' was not declared in this scope
    7 |     if(a[i-1]%2==1)b[t++]=m[i-1];
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,j,k,b[1000001],c[1000001],a[200],n;
  for(i=0;n[i-1]<1000000;i++)a[i]=i*(i+1)*(i+2)/6;
  for(j=0;j<=1000000;j++)ki[j]=all[j]=j;
  for(j=2;j<i;j++){
    for(k=n[j];k<=1000000;k++){
      b[k]=min(b[k],b[k-a[j]]+1);
      if(n[j]%2){
        c[k]=min(c[k],c[k-a[j]]+1);
      }
    }
  }
while(cin>>n,n){
cout<<all[a]<<" "<<ki[a]<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: invalid types 'int[int]' for array subscript
    5 |   for(i=0;n[i-1]<1000000;i++)a[i]=i*(i+1)*(i+2)/6;
      |            ^
a.cc:6:26: error: 'ki' was not declared in this scope; did you mean 'k'?
    6 |   for(j=0;j<=1000000;j++)ki[j]=all[j]=j;
      |                          ^~
      |                          k
a.cc:6:32: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
    6 |   for(j=0;j<=1000000;j++)ki[j]=all[j]=j;
      |                                ^~~
      |                                std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:8:12: error: invalid types 'int[int]' for array subscript
    8 |     for(k=n[j];k<=1000000;k++){
      |            ^
a.cc:10:11: error: invalid types 'int[int]' for array subscript
   10 |       if(n[j]%2){
      |           ^
a.cc:16:7: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   16 | cout<<all[a]<<" "<<ki[a]<<endl;
      |       ^~~
      |       std::filesystem::perms::all
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:16:20: error: 'ki' was not declared in this scope; did you mean 'k'?
   16 | cout<<all[a]<<" "<<ki[a]<<endl;
      |                    ^~
      |                    k
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,j,k,b[1000001],c[1000001],a[200],n;
  for(i=0;n[i-1]<1000000;i++)a[i]=i*(i+1)*(i+2)/6;
  for(j=0;j<=1000000;j++)ki[j]=all[j]=j;
  for(j=2;j<i;j++){
    for(k=n[j];k<=1000000;k++){
      b[k]=min(b[k],b[k-a[j]]+1);
      if(n[j]%2){
        c[k]=min(c[k],c[k-a[j]]+1);
      }
    }
  }
while(cin>>n,n){
cout<<b[a]<<' '<<c[a]<<endl;
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: invalid types 'int[int]' for array subscript
    5 |   for(i=0;n[i-1]<1000000;i++)a[i]=i*(i+1)*(i+2)/6;
      |            ^
a.cc:6:26: error: 'ki' was not declared in this scope; did you mean 'k'?
    6 |   for(j=0;j<=1000000;j++)ki[j]=all[j]=j;
      |                          ^~
      |                          k
a.cc:6:32: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
    6 |   for(j=0;j<=1000000;j++)ki[j]=all[j]=j;
      |                                ^~~
      |                                std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~
a.cc:8:12: error: invalid types 'int[int]' for array subscript
    8 |     for(k=n[j];k<=1000000;k++){
      |            ^
a.cc:10:11: error: invalid types 'int[int]' for array subscript
   10 |       if(n[j]%2){
      |           ^
a.cc:16:8: error: invalid types 'int [1000001][int [200]]' for array subscript
   16 | cout<<b[a]<<' '<<c[a]<<endl;
      |        ^
a.cc:16:19: error: invalid types 'int [1000001][int [200]]' for array subscript
   16 | cout<<b[a]<<' '<<c[a]<<endl;
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,j,k,b[1e6],c[1e6],a[190],n;
  for(i=0;a[i-1]<1e6;i++)a[i]=i*(i+1)*(i+2)/6;
  for(j=0;j<=1e6;j++)b[j]=c[j]=j;
  for(j=2;j<i;j++)for(k=a[j];k<=1e6;k++){
    b[k]=min(b[k],b[k-a[j]]+1);
    if(a[j]%2)c[k]=min(c[k],c[k-a[j]]+1);
  }
while(cin>>n,n)cout<<b[n]<<' '<<c[n]<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 |   int i,j,k,b[1e6],c[1e6],a[190],n;
      |               ^~~
a.cc:4:15: error: could not convert '1.0e+6' from 'double' to 'long unsigned int'
    4 |   int i,j,k,b[1e6],c[1e6],a[190],n;
      |               ^~~
      |               |
      |               double
a.cc:4:15: error: size of array 'b' has non-integral type 'double'
a.cc:4:22: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    4 |   int i,j,k,b[1e6],c[1e6],a[190],n;
      |                      ^~~
a.cc:4:22: error: could not convert '1.0e+6' from 'double' to 'long unsigned int'
    4 |   int i,j,k,b[1e6],c[1e6],a[190],n;
      |                      ^~~
      |                      |
      |                      double
a.cc:4:22: error: size of array 'c' has non-integral type 'double'
Language: C++

#include "stdafx.h"

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


map<int, int> dp, odddp;
int main() {
	int N;
	int p = 4;
	REP(i, 1000000) {
		dp[i] = i;
		odddp[i] = 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 - 1] << " " << odddp[N - 1] << endl;
	}

	return 0;
}

Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++


#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int v[200];
  FOR(i,0,200) v[i] = i * (i + 1) * (i + 2) / 6;

  int dp[1000006];
  FOR(i,0,1000006) dp[i] = 1e9;
  dp[0] = 0;
  FOR(i,0,1000006) {
    FOR(j,0,v.size()) {
      if(i - v[j] >= 0) dp[i] = min(dp[i], dp[i - v[j]] + 1);
    }
  }

  int dp_even[1000006];
  FOR(i,0,1000006) dp_even[i] = 1e9;
  dp_even[0] = 0;
  FOR(i,0,1000006) {
    FOR(j,0,v.size()) {
      if(v[j]%2 == 0) continue;
      if(i - v[j] >= 0) dp_even[i] = min(dp_even[i], dp_even[i - v[j]] + 1);
    }
  }
  while(cin>>n,n) {
    cout << dp[n] << " " << dp_even[n] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:15: error: request for member 'size' in 'v', which is of non-class type 'int [200]'
   33 |     FOR(j,0,v.size()) {
      |               ^~~~
a.cc:18:42: note: in definition of macro 'FOR'
   18 | #define FOR(I,A,B) for(int I = (A); I < (B); ++I)
      |                                          ^
a.cc:42:15: error: request for member 'size' in 'v', which is of non-class type 'int [200]'
   42 |     FOR(j,0,v.size()) {
      |               ^~~~
a.cc:18:42: note: in definition of macro 'FOR'
   18 | #define FOR(I,A,B) for(int I = (A); I < (B); ++I)
      |                                          ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int tetrahedron(int);

int index_direct_match(int);
int index_direct_match_odd(int);
int index_number(int);
int index_number_odd(int);

int main(int argc, char const *argv[]) {

  int n;
  int cnt_min;
  int cnt_only_odd;

  for(cin >> n;n != 0;cin >> n){
:
    cout << index_number(n) << " " <<  index_number_odd(n) << endl;

  }

  //

  return 0;
}

int tetrahedron(int k){

  return k*(k+1)*(k+2)/6;

}

int index_number(int index){
  static int memo[1000]={};
  if(index>=1 && index<=3) return index;
  else if(index_direct_match(index)) return 1;
  else if(memo[index] != 0) return memo[index];
  else{
    vector<int> comp_array;
    for(int i=1;index > tetrahedron(i);i++){
      //cout << "index:" << index << endl;
      //cout << "tetra:" << tetrahedron(i) << endl;
      comp_array.push_back(1+index_number( index - tetrahedron(i) ));
    }
    memo[index]=(int)*min_element(comp_array.begin(),comp_array.end());
    return *min_element(comp_array.begin(),comp_array.end());
  }

}

int index_direct_match(int index){

  for(int i=1;i<200;i++){
    if(index == tetrahedron(i)){
      return 1;
    }
  }
  return 0;
}

int index_direct_match_odd(int index){

  for(int i=1;i<200;i+=4){
    if(index == tetrahedron(i)){
      return 1;
    }
  }
  return 0;
}

int index_number_odd(int index){
  static int memo2[1000]={};
  if(index>=1 && index<=34) return index;
  else if(index_direct_match_odd(index)) return 1;
  else if(memo2[index] != 0) return memo2[index];
  else{
    vector<int> comp_array;
    for(int i=1;index > tetrahedron(i);i+=4){
      //cout << "index:" << index << endl;
      //cout << "tetra:" << tetrahedron(i) << endl;
      comp_array.push_back(1+index_number_odd( index - tetrahedron(i) ));
    }
    memo2[index]=(int)*min_element(comp_array.begin(),comp_array.end());
    return *min_element(comp_array.begin(),comp_array.end());
  }
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:21:1: error: expected primary-expression before ':' token
   21 | :
      | ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 1e9
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int dp[1000010]={};
  int dp2[1000010]={};
  for(int i=1;i<=1000000;i++){dp[i]=INF;dp2[i]=INF;}
  vector<ll> gu;
  vector<ll> ki;
  ll cnt=1;
  while(1){
    if((cnt*(cnt+1)*(cnt+2)/6)>1000000)break;
    if(((cnt*(cnt+1)*(cnt+2))/6)%2){ki.pb(cnt*(cnt+1)*(cnt+2)/6);dp[ki[ki.size()-1]]=1;dp2[gu[su.size()-1]]=1;}
    else {gu.pb(cnt*(cnt+1)*(cnt+2)/6);dp[gu[gu.size()-1]]=1;}
    cnt++;
  }
  dp[1]=1;
  dp2[1]=1;
  for(int i=1;i<1000000;i++){
    for(int j=0;j<gu.size();j++){
      if(i+gu[j]>1000000)break;
      dp[i+gu[j]]=min(dp[i+gu[j]],(dp[i]+1));
    }
    for(int j=0;j<ki.size();j++){
      if(i+ki[j]>1000000)break;
      dp[i+ki[j]]=min(dp[i+ki[j]],(dp[i]+1));
      dp2[i+ki[j]]=min(dp2[i+ki[j]],(dp2[i]+1));
    }
  }
  int n;
  while(cin>>n,n){
    cout<<dp[n]<<" "<<dp2[n]<<endl;
  }
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:30:95: error: 'su' was not declared in this scope; did you mean 'gu'?
   30 |     if(((cnt*(cnt+1)*(cnt+2))/6)%2){ki.pb(cnt*(cnt+1)*(cnt+2)/6);dp[ki[ki.size()-1]]=1;dp2[gu[su.size()-1]]=1;}
      |                                                                                               ^~
      |                                                                                               gu
Language: C++

#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
const ll mod = ll(1e9) + 7;
const int INF = int(1e9);

int dp[1000000] = {};
int dp_o[1000000] = {};
map<int, int>mp, mp_o;
int DP(int num) {
	if (dp[num] != 0)return dp[num];
	if (num == 0)return 0;
	int rec = INF;
	int cnt = 1;
	while (1) {
		rec = min(DP(mp[cnt]) + DP(num - mp[cnt]), rec);
		cnt++;
		if (mp[cnt] > num)break;
	}
	dp[num] = rec;
	return rec;

}
int DP_o(int num) {
	if (dp_o[num] != 0)return dp_o[num];
	if (num == 0)return 0;
	int rec = INF;
	int cnt = 1;
	while (1) {
		rec = min(DP(mp_o[cnt]) + DP(num - mp_o[cnt]), rec);
		cnt++;
		if (mp_o[cnt] > num)break;
	}
	dp_o[num] = rec;
	return rec;

}

int main() {
	cin.sync_with_stdio(false);
	ll cnt1 = 1, cnt2 = 1;
	dp[1] = 1, dp[1] = 1;
	mp[1] = 1, mp_o[1] = 1;
	int cnt_o = 2;
	reps(i, 2, 1000001) {
		cnt1 += i;
		cnt2 += cnt1;
		dp[cnt2] = 1;
		mp[i] = cnt2;
		if (cnt2 % 2 == 1) {
			dp_o[cnt2] = 1;
			mp[cnt_o] = cnt2;
			cnt_o++;
		}
	}
	while (1) {
		int Q;
		cin >> Q;
		if (Q == 0)break;
		cout << DP(Q) << " ";
		cou << DP_o(Q) << endl;
	}


	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:65:17: error: 'cou' was not declared in this scope; did you mean 'cos'?
   65 |                 cou << DP_o(Q) << endl;
      |                 ^~~
      |                 cos
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <utility>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF INT_MAX
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

int main(){
    vector<int> v,oddv;
    for(ll i=1;;i++){
        if(i*(i+1)*(i+2)/6<=2000000){
            v.pb(i*(i+1)*(i+2)/6);
        }
        else break;
    }
    int ans1[1000010],ans2[1000010];
    rep(i,0,1000010) ans1[i]=ans2[i]=INF;
    ans1[0]=0; ans2[0]=0;
    rep(i,0,1000000){
        ans1[i]=i; ans2[i]=i;
        for(int j=0;i>=v[j];j++){
            ans1[i]=min(ans1[i-v[j]]+1,ans1[i]);
            if(v[j]%2==1)ans2[i]=min(ans2[i],ans2[i-v[j]]+1);
        }
    }

    int n;
    while(cin>>n&&n){
        cout<<ans1[n]<<" "<<ans2[n]<<endl;
    }
    
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'INT_MAX' was not declared in this scope
   20 | #define INF INT_MAX
      |             ^~~~~~~
a.cc:42:38: note: in expansion of macro 'INF'
   42 |     rep(i,0,1000010) ans1[i]=ans2[i]=INF;
      |                                      ^~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <cmath>
  +++ |+#include <climits>
   12 |