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

#include<iostream>
using namespace std;


struct Disc{
	int x,y,r,c;
	Disc(int p_x,int p_y,int p_r,int p_c){
		x=p_x;y=p_y;r=p_r;c=p_c;
	}
	Disc(){};
};

int n;
int memo[1<<24];
bool exist[24];
Disc D[24];
int ans;

bool touch(Disc a,Disc b){
	return (a.r+b.r)*(a.r+b.r)>(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}

bool top(int k){
	for(int i=k-1;i>=0;i--){
		if(exist[i]){
			if(touch(D[k],D[i])) return false;
		}
	}
	return true;
}


int dfs(int bit,int num){
	if(memo[bit]>=0) return memo[bit];
	int res=num;

	for(int i=0;i<n;i++){
		if(exist[i] && top(i)){
			for(int j=0;j<n;j++){
				if(exist[j] && top(j) && i!=j && D[i].c==D[j].c){
					exist[i]=false;
					exist[j]=false;
					res=max(res,dfs((bit&(~1<<i))&(~1<<j),num+2));
					exist[i]=true;
					exist[j]=true;
				}
			}
		}
	}
	memo[bit]=res;
	return res;
}

int main()
{
	while(cin>>n && n!=0){
		ans=0;
		memset(memo,-1,sizeof(memo));
		memset(exist,true,sizeof(exist));
		for(int i=0;i<n;i++){
			int x,y,r,c;
			cin>>x>>y>>r>>c;
			D[i]=Disc(x,y,r,c);
		}
		cout<<dfs((1<<24)-1,0)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:17: error: 'memset' was not declared in this scope
   58 |                 memset(memo,-1,sizeof(memo));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
#define FOR(i,a,n) for(int i=a;i<n;++i)
#define REP(i,n) FOR(i,0,n)

struct disk{
	int x,y,r,c,n;
};
bool on(disk l,disk r){
	return(pow(l.r+r.r,2.0)>pow(l.x-r.x,2.0)+pow(l.y-r.y,2.0));
}
struct tree{
	disk d;
	vector<tree> children;
	int depth;
	tree(disk d,int depth):d(d),depth(depth){
	}
	tree(){d.n=-1;depth=0;}
	void add(disk &other){
		if(!add_r(other)){
			children.push_back(tree(other,depth+1));
		}
	}
	bool add_r(disk &other){
		if(children.empty()){
			if(on(d,other)){
				children.push_back(tree(other,depth+1));
				return true;
			}else{
				return false;
			}
		}
		REP(i,children.size()){
			if(children[i].add_r(other)){
				return true;
			}else{
				if(on(d,other)){
					children.push_back(tree(other,depth+1));
					return true;
				}else{
					return false;
				}
			}
		}
		return false;
	}
	void leaves(vector<tree*> &trees){
		if(children.empty()){
			trees.push_back(this);
		}else{
			REP(i,children.size()){
				children[i].leaves(trees);
			}
		}
	}
	bool dlt(disk &dd){
		if(children.empty()){
			return false;
		}
		REP(i,children.size()){
			if(children[i].d.n==dd.n){
				children.erase(children.begin()+i);
				return true;
			}else{
				if(children[i].dlt(dd))return true;
			}
		}
		return false;
	}
};
/*
int dfs(tree &t){
	vector<disk> leaves;
	t.leaves(leaves);
	int best=0;
	REP(i,leaves.size()){
		FOR(j,i+1,leaves.size()){
			if(leaves[i].c==leaves[j].c){
				tree nt(t);
				nt.dlt(leaves[i]);
				nt.dlt(leaves[j]);
				best=max(best,dfs(nt)+2);
			}
		}
	}
	return best;
}
*/

bool pred(tree *l,tree *r){
	return l->depth>r->depth;
}
int greedy(tree &t){
	vector<tree*> leaves;
	t.leaves(leaves);
	sort(leaves.begin(),leaves.end(),pred);
	REP(i,leaves.size()){
		FOR(j,i+1,leaves.size()){
			if(leaves[i]->d.c==leaves[j]->d.c){
				tree nt(t);
				nt.dlt(leaves[i]->d);
				nt.dlt(leaves[j]->d);
				return greedy(nt)+2;
			}
		}
	}
	return 0;
}

int main(){
	int n;
	while(cin>>n,n){
		tree t;
		vector<disk> disks;
		REP(i,n){
			disk d;
			cin>>d.x>>d.y>>d.r>>d.c;
			d.n=i;
			disks.push_back(d);
		}
		REP(i,n){
			t.add(disks[n-i-1]);
		}
		cout<<greedy(t)<<endl;
	}
}

Compiler output:
a.cc: In function 'bool on(disk, disk)':
a.cc:16:16: error: 'pow' was not declared in this scope
   16 |         return(pow(l.r+r.r,2.0)>pow(l.x-r.x,2.0)+pow(l.y-r.y,2.0));
      |                ^~~
Language: C++

#include <cstring>
#include <algorithm>
#include <iostream>

using namespace std;

int N, X[24], Y[24], R[24], C[24];
int no_coverd[24][1 << 26];

bool isCoverd(int i, int j)
{
  int x = abs(X[i] - X[j]), y = abs(Y[i] - Y[j]), r = R[i] + R[j];
  return ((x * x) + (y * y)) < (r * r);
}

bool noCoverd(int j, int s) {
  for (int i = 0; i < j; i++)
    if ( (s >> i & 1) && isCoverd(i, j))
      return false;

  return true;
}

char memo[1 << 26];
int dfs(int s)
{
  if (memo[s] != -1) {
    return memo[s];
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if ( C[i] == C[j] && (s >> i & 1) && (s >> j & 1) &&
           noCoverd(i, s) && noCoverd(j, s) ) {
        ans = max(ans, dfs(s & ~(1 << i) & ~(1 << j)) + 2);
      }
    }
  }
  
  return memo[s] = ans;
}


int main()
{
  while (cin >> N && N) {
    for (int i = 0; i < N; i++) 
      cin >> X[i] >> Y[i] >> R[i] >> C[i];

    memset(memo, -1, sizeof(memo));

    cout << dfs((1 << N) - 1) << endl;
    
  }
}

Compiler output:
/tmp/ccfH78sU.o: in function `dfs(int)':
a.cc:(.text+0x14a): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccfH78sU.o
a.cc:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccfH78sU.o
a.cc:(.text+0x29c): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccfH78sU.o
a.cc:(.text+0x2ab): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccfH78sU.o
/tmp/ccfH78sU.o: in function `main':
a.cc:(.text+0x389): relocation truncated to fit: R_X86_64_PC32 against symbol `memo' defined in .bss section in /tmp/ccfH78sU.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <stack>
#include <cmath>

using namespace std;

const double EPS=1e-10;
bool EQ(double a,double b){
	return abs(a-b)<EPS;
}

int n;
int xs[101];
int ys[101];
int rs[101];
int cs[101];
int dp[1<<24];
bool isNoCross(int a,int b){
	double sumR=rs[a]+rs[b];
	double dist=sqrt(1.0*(xs[a]-xs[b])*(xs[a]-xs[b])+(ys[a]-ys[b])*(ys[a]-ys[b]));
	if(EQ(sumR,dist)||sumR<dist)return true;
	return false;
}

bool isOver(int a,int b){
	if(isNoCross(a,b))return true;
	return a<b;
}

int dfs(int mask){
	if(dp[mask]>=0)return dp[mask];
	if(mask==(1<<n)-1)return 0;
	int res=0;
	int lt[30];
	int sz=0;
	for(int i=0;i<n;i++){
		bool ok=true;
		if((mask>>i)&1)continue;
		for(int j=0;j<n;j++){
			if(i==j)continue;
			if((mask>>j)&1)continue;
			if(!isOver(i,j)){
				ok=false;
				break;
			}
		}
		if(ok)
			lt[sz++]=i;
	}
	for(int i=0;i<sz;i++){
		for(int j=i+1;j<sz;j++){
			int a=lt[i];
			int b=lt[j];
			if(cs[a]==cs[b]){
				int nmask=mask;
				nmask|=(1<<a);
				nmask|=(1<<b);
				res=max(res,dfs(nmask)+2);
			}
		}
	}
	return dp[mask]=res;
}

void solve(){

	while(cin>>n&&n){
		memset(dp,-1,sizeof(dp));
		for(int i=0;i<n;i++)
			cin>>xs[i]>>ys[i]>>rs[i]>>cs[i];
		int res=dfs(0);
		cout<<res<<endl;
	}
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

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

#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pb push_back
#define sz size()
#define vi vector<int>

int n,x[25],y[25],r[25],c[25],ans;
bool v[1<<24];

int sq(int x){return x*x;}

void f(int mask){
	if(v[mask])return;
	v[mask]=1;
	vi d;
	rep(i,n)if(mask>>i&1)d.pb(i);
	ans=max(ans,n-(int)d.sz);
	bool top[25];
	rep(i,d.sz)top[i]=1;
	rep(i,d.sz)rep2(j,i+1,d.sz){
		if(sq(x[d[i]]-x[d[j]])+sq(y[d[i]]-y[d[j]])<sq(r[d[i]]+r[d[j]])){
			top[j]=0;
		}
	}
	rep(i,d.sz)rep2(j,i+1,d.sz){
		if(top[i] && top[j] && c[d[i]]==c[d[j]]){
			f(mask-(1<<d[i])-(1<<d[j]));
		}
	}
}

int main(){
	while(cin>>n && n){
		rep(i,n)cin>>x[i]>>y[i]>>r[i]>>c[i];
		ans=0;
		memset(v,0,sizeof(v));
		f((1<<n)-1);
		cout<<ans<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:17: error: 'memset' was not declared in this scope
   42 |                 memset(v,0,sizeof(v));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <vector>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

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


int dp[1<<24];
int n;
int x[24],y[24],r[24],c[24];

int square(int a){
	return a*a;
}
bool overlap(int i,int j){
	return square(x[i]-x[j])+square(y[i]-y[j]) < square(r[i]+r[j]);
}
bool top(int s,int k){
	for(int i=0;i<k;i++){
		if(s&1<<i){
			if(overlap(k,i))return false;
		}
	}
	return true;
}
int dfs(int s){
	if(dp[s]!=-1)return dp[s];
	int res=0;
	for(int i=0;i<n;i++){
		if((s&1<<i)==0 || !top(s,i))continue;
		for(int j=i+1;j<n;j++){
			if((s&1<<j)==0 || !top(s,j))continue;
			if(c[i]==c[j])res = max(res,dfs(s&~(1<<i)&~(1<<j))+2);
		}
	}
	return dp[s]=res;
}
int main(){
	while(cin>>n&&n){
		for(int i=0;i<n;i++){
			cin>>x[i]>>y[i]>>r[i]>>c[i];
		}
		memset(dp,-1,sizeof(dp));
		cout<<dfs((1<<n)-1)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:17: error: 'memset' was not declared in this scope
   43 |                 memset(dp,-1,sizeof(dp));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

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

using namespace std;

int pow2(int m){
	return m * m;
};

int n, m, c[24], d, p[24];

int bitnum(int n){
	int cnt;
	cnt = 0;
	while(n){
		if(n % 2 == 1) cnt++;
		n /= 2;
	}
	return cnt;
}

int main(void){
	int x[24], y[24], r[24], i, j, k, dp[1 << 7];
	while(1){
		scanf("%d",&n);
		if(!n)
			break;
		for(i = 0;i < n;i++)
			scanf("%d%d%d%d",&x[i],&y[i],&r[i],&c[i]);
		memset(p,0,sizeof(p));
		for(i = 0;i < n;i++){
			for(j = 0;j < i;j++)
				if(sqrt((double)pow2(x[i] - x[j]) + pow2(y[i] - y[j])) < r[i] + r[j]) p[i] += 1 << j;
		}
		memset(dp,0,sizeof(dp));
		dp[0] = 1;
		for(i = 0;i < 1 << n;i++){
			if(dp[i]){
				for(j = 0;j < n - 1;j++){
					for(k = j + 1;k < n;k++)
						if(c[j] == c[k] && ~i & (1 << j) && ~i & (1 << k) && (i & p[j]) == p[j] && (i & p[k]) == p[k]) dp[i + (1 << j) + (1 << k)] = 1;
				}
			}
		}
		m = 0;
		for(i = 0;i < 1 << n;i++){
			if(dp[i])
				m = max(m,bitnum(i))
		}
		printf("%d\n",m);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:53: error: expected ';' before '}' token
   50 |                                 m = max(m,bitnum(i))
      |                                                     ^
      |                                                     ;
   51 |                 }
      |                 ~
Language: C++

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

using namespace std;

int pow2(int m){
	return m * m;
};

int n, m, c[24], d, p[24];

int bitnum(int n){
	int cnt;
	cnt = 0;
	while(n){
		if(n % 2 == 1) cnt++;
		n /= 2;
	}
	return cnt;
}

int main(void){
	int x[24], y[24], r[24], i, j, k, dp[1 << 24];
	while(1){
		scanf("%d",&n);
		if(!n)
			break;
		for(i = 0;i < n;i++)
			scanf("%d%d%d%d",&x[i],&y[i],&r[i],&c[i]);
		memset(p,0,sizeof(p));
		for(i = 0;i < n;i++){
			for(j = 0;j < i;j++)
				if(sqrt((double)pow2(x[i] - x[j]) + pow2(y[i] - y[j])) < r[i] + r[j]) p[i] += 1 << j;
		}
		memset(dp,0,sizeof(dp));
		dp[0] = 1;
		for(i = 0;i < 1 << n;i++){
			if(dp[i]){
				for(j = 0;j < n - 1;j++){
					for(k = j + 1;k < n;k++)
						if(c[j] == c[k] && ~i & (1 << j) && ~i & (1 << k) && (i & p[j]) == p[j] && (i & p[k]) == p[k]) dp[i + (1 << j) + (1 << k)] = 1;
				}
			}
		}
		m = 0;
		for(i = 0;i < 1 << n;i++){
			if(dp[i])
				m = max(m,bitnum(i))
		}
		printf("%d\n",m);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:53: error: expected ';' before '}' token
   50 |                                 m = max(m,bitnum(i))
      |                                                     ^
      |                                                     ;
   51 |                 }
      |                 ~
Language: C++

#include <iostream>
#include <math.h>

using namespace std;

const int MAX_N = 24;

class Circle {
public:
	int x, y, r, c; // 中心のxy座標、半径、色番号
};

/* 入力 */
int n; // 円盤の枚数
Circle cir[MAX_N]; // 円の情報

/*
S:すでに取り除いた円の集合(bitで表す、右から円番号0,1,2,...,MAX_N)
dp[S]:ここから取り除ける最大枚数
漸化式
dp[全部取り除いた] = n
dp[S] = max(dp[S U 取り除いた2つの円]+2)
*/
int dp[1 << MAX_N];

/* 2点間の距離 */
double dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}

/* 円kが上に1枚でも重なっているかどうか、重なっていたらtrue */
bool ispiled(int k, int S) {
	for (int i = k - 1; i >= 0; i--) {
		if (dis(cir[i].x, cir[i].y, cir[k].x, cir[k].y) < cir[i].r + cir[k].r && !(S >> i & 1)) {
			return true;
		}
	}
	return false;
}
/*
bool ispiled(Circle c1, Circle c2) {
	if (dis(c1.x, c1.y, c2.x, c2.y) < c1.r + c2.r) {
		return true;
	}

	return false;
}
*/

/* S:すでに取り除いた円盤の集合 */
int remove(int S) {
	//cout << "S = " << S << " dp[" << S << "]: " << dp[S] << endl;
	if (dp[S] >= 0) {
		return dp[S];
	}
	
        /* 全部取り除いた */
	if (S == ((1 << n) - 1)) {
		return dp[S] = n;
	}

	int res = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			/* どちらかがすでに取り除かれているか、2つの色が違うか、2枚のうち1枚以上が下にあれば取り除けないので次の組へ */
			if (S >> i & 1 || S >> j & 1 || cir[i].c != cir[j].c || ispiled(i, S) || ispiled(j, S)) {
				continue;
			}

			if (true) {
				int tmp = S | 1 << i;
				tmp = tmp | 1 << j;
				res = max(res, remove(tmp) + 2);
			}
		}
	}
	return dp[S] = res;
}

int main() {
	// 方針: bitDP
	//const int MAX_N = 24;
	while (true) {
		cin >> n;
		if (n == 0) {
			break;
		}
		for (int i = 0; i < n; i++) {
			cin >> cir[i].x >>cir[i].y >> cir[i].r >> cir[i].c;
		}
		memset(dp, -1, sizeof(dp));
		//cout << "test" << endl;
		cout << remove(0) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:91:17: error: 'memset' was not declared in this scope
   91 |                 memset(dp, -1, sizeof(dp));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <math.h>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define x first.first
#define y first.second
#define r second.first
#define color second.second

using namespace std;

typedef pair<double,double> P;
typedef pair<P,P> C;

const double EPS = 1e-10;

double dist(C a,C b){
  return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}

bool check(C a,C b){
  return a.r+b.r>dist(a,b);
}

int main(void){

  int n;
  while(cin >> n,n){
    vector<C>c(n);
    for(int i=0;i<n;i++)
      cin >> c[i].x >> c[i].y >> c[i].r >> c[i].color;
    
    static int dp[(1<<n)];
    fill(dp,dp+(1<<n),0);

    for(int S=(1<<n)-1;S>=0;S--){
      for(int i=0;i<n;i++){
	for(int j=i+1;j<n;j++){
	  if(!(S>>i&1) || !(S>>j&1))continue;
	  if(c[i].color!=c[j].color)continue;

	  bool fg=false;
	  for(int k=0;k<n;k++){
	    if(i!=k && check(c[i],c[k]))fg=true;
	    if(j!=k && check(c[j],c[k]))fg=true;
	  }
	  //if(fg)continue;

	  int nx=S;
	  nx&=~(1<<i);
	  nx&=~(1<<j);
	  dp[nx]=max(dp[nx],dp[S]+2);
	}
      }
    }
    int ans=0;
    for(int i=0;i<(1<<n);i++)ans=max(ans,dp[i]);
    cout << ans-2 << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:16: error: storage size of 'dp' isn't constant
   33 |     static int dp[(1<<n)];
      |                ^~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
struct circle
{
    double x, y, r;
    int c;
}cc[30];
int dp[(1<<24)];
int n;
bool intersect(int i, int j)
{
    double x1, y1, x2, y2;
    double r1, r2;
    x1 = cc[i].x, y1 = cc[i].y, r1 = cc[i].r;
    x2 = cc[j].x, y2 = cc[j].y, r2 = cc[j].r;

    if( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) >=  (r1+r2)*(r1+r2))
    {
        return false;

    }//騾」蠢?キ夐聞>=蜊雁セ大柱?夂┌逶ク莠、
    else
        return true;

}
bool check(int a, int b, int state)
{
    if( ((1<<a-1)&state) == 0 || ((1<<b-1)&state) == 0 )
    {
        return false; //蟾イ邯楢「ォ諡ソ襍ー
    }

    if(cc[a].c != cc[b].c) return false; //鬘剰牡荳榊酔


    int p[2];
    p[0]=a, p[1]=b;

    for(int k=0; k<2; k++)
    {
        int x =  (1<<p[k]-1)-1;  // n-p[k]+1蛟?  p[k]-1蛟?
        if( (x&state) > 0)//state逧а[k]菴榊承驍頑怏1 ((p[k]蜿ッ閭ス陲ォ蜈カ莉也乢蟄占搭菴?        {
            for(int i=1; i<=p[k]-1; i++)
            {
                int test = 1 << i-1;
                if( (test&state) && intersect(p[k], i) )
                {
                    return false;
                }
            }
        }
    }

    return true;
}
int DP(int state)
{
    if(state==0) return 0;
    if(dp[state]!=-1) return dp[state];

    for(int i=1; i<n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            if( check(i,j, state) )
            {
                int mask = (1<<i-1) | (1<<j-1);

                dp[state^mask] = DP(state^mask);
                if(dp[state^mask]+2 > dp[state])
                    dp[state] = dp[state^mask]+2;
            }
        }
    }
    return dp[state]==-1? 0:dp[state];
}

int main()
{

    while(scanf("%d",&n) && n)
    {
        for(int i=1; i<=n; i++)
            scanf("%lf%lf%lf%d",&cc[i].x, &cc[i].y, &cc[i].r, &cc[i].c);

        int state = (1<<n)-1;
        for(int i=0; i<=state; i++)
            dp[i] = -1;

        dp[state] = DP(state);

        printf("%d\n",dp[state]);


    }

    return 0;
}

Compiler output:
a.cc:56:5: error: expected unqualified-id before 'return'
   56 |     return true;
      |     ^~~~~~
a.cc:57:1: error: expected declaration before '}' token
   57 | }
      | ^
a.cc: In function 'bool check(int, int, int)':
a.cc:54:5: warning: control reaches end of non-void function [-Wreturn-type]
   54 |     }
      |     ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#define INIT 100
using namespace std;
struct circle
{
    int x, y, r;
    int c;
}cc[24];
char dp[(1<<24)];
int n;
bool intersect(int i, int j)
{
    int x1, y1, x2, y2;
    int r1, r2;
    x1 = cc[i].x, y1 = cc[i].y, r1 = cc[i].r;
    x2 = cc[j].x, y2 = cc[j].y, r2 = cc[j].r;

    if( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) >=  (r1+r2)*(r1+r2))
    {
        return false;

    }//騾」蠢?キ夐聞>=蜊雁セ大柱?夂┌逶ク莠、
    else
        return true;

}
bool check(int a, int b, int state)
{
    if( ((1<<a-1)&state) == 0 || ((1<<b-1)&state) == 0 )
    {
        return false; //蟾イ邯楢「ォ諡ソ襍ー
    }

    if(cc[a].c != cc[b].c) return false; //鬘剰牡荳榊酔


    int p[2];
    p[0]=a, p[1]=b;

    for(int k=0; k<2; k++)
    {
        int x =  (1<<p[k]-1)-1;  // n-p[k]+1蛟?  p[k]-1蛟?
        if( (x&state) > 0)//state逧а[k]菴榊承驍頑怏1 ((p[k]蜿ッ閭ス陲ォ蜈カ莉也乢蟄占搭菴?        {
            for(int i=1; i<=p[k]-1; i++)
            {
                int test = 1 << i-1;
                if( (test&state) && intersect(p[k], i) )
                {
                    return false;
                }
            }
        }
    }

    return true;
}
int DP(int state)
{
    if(state==0) return 0;
    if(dp[state]!=INIT) return dp[state];

    for(int i=1; i<n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            if( check(i,j, state) )
            {
                int mask = (1<<i-1) | (1<<j-1);

                dp[state^mask] = DP(state^mask);
                if(dp[state^mask]+2 > dp[state] || dp[state]==INIT)
                    dp[state] = dp[state^mask]+2;
            }
        }
    }
    return dp[state]==INIT? 0:dp[state];
}

int main()
{

    while(scanf("%d",&n) && n)
    {
        for(int i=1; i<=n; i++)
            scanf("%d%d%d%d",&cc[i].x, &cc[i].y, &cc[i].r, &cc[i].c);

        int state = (1<<n)-1;
        for(int i=0; i<=state; i++)
            dp[i] = INIT;

        dp[state] = DP(state);

        printf("%d\n",dp[state]);


    }

    return 0;
}

Compiler output:
a.cc:57:5: error: expected unqualified-id before 'return'
   57 |     return true;
      |     ^~~~~~
a.cc:58:1: error: expected declaration before '}' token
   58 | }
      | ^
a.cc: In function 'bool check(int, int, int)':
a.cc:55:5: warning: control reaches end of non-void function [-Wreturn-type]
   55 |     }
      |     ^
Language: C++

#include<iostream>
#include<cmath>
const int limit=10;
int n,ans;
int num[limit],x[limit],y[limit],r[limit],v[limit];
bool visit[limit];
bool road[limit][limit];
using namespace std;

void dfs(int step)
{
	if(step-1>ans) ans=step-1;
	for(int i=1;i<=n;i++) 
	if ((!visit[i])&&(num[i]==0))
		for(int j=1;j<=n;j++) if ((v[i]==v[j])&&(i!=j)&&(!visit[j])&&(num[j]==0)) 
		{
			visit[i]=true; visit[j]=true;
			for(int k=1;k<=n;k++) 
			{
				if(road[i][k]) num[k]--;
				if(road[j][k]) num[k]--;
			}
			dfs(step+1);
			visit[i]=false; visit[j]=false;
			for(int k=1;k<=n;k++) 
			{
				if(road[i][k]) num[k]++;
				if(road[j][k]) num[k]++;
			}
		}
}
int main()
{
	//freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	cin>>n;
	while(n!=0)
	{
		ans=0;
		for(int i=1;i<=n;i++)
		{
			num[i]=0;
			for(int j=1;j<=n;j++) link[i][j]=false;
		}
		for(int i=1;i<=n;i++)
		{
			visit[i]=false;
		 	cin>>x[i]>>y[i]>>r[i]>>v[i];
		 	for(int j=1;j<i;j++) if((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<(r[i]+r[j])*(r[i]+r[j]))
		 	{
		 		road[j][i]=true;
		 		num[i]++;
		 	}
	    }
	    dfs(1);
	    cout<<ans*2<<endl;
	    cin>>n;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:47: error: 'link' was not declared in this scope
   43 |                         for(int j=1;j<=n;j++) link[i][j]=false;
      |                                               ^~~~
Language: Java

import java.io.*;
import java.util.*;

public class Main {

    private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));    
	private static StringTokenizer st;

    public static void main ( String [] args ) throws IOException
    {

	int h,w,s;

	while(true){
	
		st = new StringTokenizer(br.readLine());
		h = Integer.parseInt(st.nextToken());
		w = Integer.parseInt(st.nextToken());
		s = Integer.parseInt(st.nextToken());
		if( h == 0 && w == 0 && s == 0)	break;
	    new Main().cal(h,w,s);
	}
	
    }


int max;
int[][] area;

    private void cal(int h, int w, int s) throws IOException 
    {
	int areaSum = 0;
	area = new int[h][w];
	for(int i=0; i < h; i++){
		st = new StringTokenizer(br.readLine());
		for(int j=0; j < w; j++){
			area[i][j] = Integer.parseInt(st.nextToken());
			areaSum += area[i][j];
		}
	}
	
	//cal max
	max = areaSum - s;
	int[] out = grouping(0, 0, h, w);
	System.out.println(out[0]+" "+(out[1] - max));
	
    }


   private int[] grouping(int hs, int ws, int h, int w){
	if( hs == h || ws == w ){
	if( hs == h )
		int[] temp = {0, 0};
		return temp;
	}
	int h1, h2, h3;
	int w1, w2, w3;
	int sum1, sum2, sum3;
	int grpNum;
	int[] ret = {1, calSum(hs, ws, h, w)};
	int tmpdep = 0;
	boolean didit = false;

	for(int i = h; i >= hs; i--){
	for(int j = w; j >= ws; j--){
		didit = false;
		h1 = i;
		w1 = j;
		if( h1 == h && w1 == w ){
			continue;
		}

		if( (sum1 = calSum(hs, ws, h1, w1)) >= max ){
		if( (sum2 = calSum(h1, ws, h, w)) >= max || sum2 == 0 ){
		if( (sum3 = calSum(hs, w1, h1, w)) >= max || sum3 == 0 ){
			tmpdep = sum1;
			grpNum = 1;

			int[] tmp = grouping(h1, ws, h, w);
			grpNum += tmp[0];
			if( tmpdep > tmp[1] && tmp[1] != 0 ){
				tmpdep = tmp[1];
		 	}

			tmp = grouping(hs, w1, h1, w);
			grpNum += tmp[0];
			if( tmpdep > tmp[1] && tmp[1] != 0 ){
				tmpdep = tmp[1];
			}

			if( grpNum > ret[0] ) { ret[0] = grpNum; ret[1] = tmp[1]; }
			if( grpNum == ret[0] && tmpdep < ret[1] ) ret[1] = tmpdep;
		}
		didit = true;
		}
		}


		if( (sum1 = calSum(hs, ws, h1, w1)) >= max ){
		if( (sum2 = calSum(h1, ws, h, w1)) >= max || sum2 == 0 ){
		if( (sum3 = calSum(hs, w1, h, w)) >= max || sum3 == 0){
			tmpdep = sum1;
			grpNum =1;

			int[] tmp = grouping(h1, ws, h, w1);
			grpNum += tmp[0];
			if( tmpdep > tmp[1] && tmp[1] != 0 ){
				tmpdep = tmp[1];
			}

			tmp = grouping(hs, w1, h, w);
			grpNum += tmp[0];
			if( tmpdep > tmp[1] && tmp[1] != 0 ){
				tmpdep = tmp[1];
			}

			if( grpNum > ret[0] ) { ret[0] = grpNum; ret[1] = tmp[1]; }
			if( grpNum == ret[0] && tmpdep > ret[1] ) ret[1] = tmpdep;
		}
		didit = true;
		}
		}

		if(!didit)	break;

	}
	}
	return ret;
   }

   private int calSum(int hs, int  ws, int  h, int w){
	int tmpsum=0;
	for(int i = hs; i < h; i++){
		for(int j = ws; j < w; j++){
			tmpsum += area[i][j];
		}
	}
	return tmpsum;
   }


}

Compiler output:
Main.java:53: error: variable declaration not allowed here
		int[] temp = {0, 0};
		      ^
1 error
Language: C++

#include <iostream>
#include <utility>
using namespace std;
typedef pair<int, int> pii;

int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
const pii INIT = pii(-1,-1);
int board[33][33];
int acc[33][33];
pii memo[33][33][33][33];
int H, W, E, S;

int getsum(int p, int q, int x, int y){
  return board[x][y] - board[p][y] - board[x][q] + board[p][q];
}

pii solve(int l, int t, int r, int b){
  pii& ans = memo[l][t][r][b];
  if(ans != INIT) return ans;

  int sum = getsum(l,t,r,b);
  if(sum < E - S) return ans = pii(0, 0);
  
  ans = pii(1, S - E + sum);
  
  for(int i = l+1; i < r; ++i){
    pii ra = solve(l,t,i,b);
    pii rb = solve(i,t,r,b);
    pii temp = pii(ra.first + rb.first, min(ra.second, rb.second));
    ans = max(ans, temp);
  }

  for(int i = t+1; i < b; ++i){
    pii ra = solve(l,t,r,i);
    pii rb = solve(l,i,r,b);
    pii temp = pii(ra.first + rb.first, min(ra.second, rb.second));
    ans = max(ans, temp);
  }

  return ans;
}

int main(){
  while(cin >> H >> W >> S, H){
    memset(board, 0, sizeof(board));
    for(int i = 0; i < 33; ++i)
      for(int j = 0; j < 33; ++j)
	for(int k = 0; k < 33; ++k)
	  for(int l = 0; l < 33; ++l)
	    memo[i][j][k][l] = INIT;

    for(int i = 0; i < H; ++i)
      for(int j = 0; j < W; ++j)
	cin >> board[i+1][j+1];

    for(int i = 0; i < H; ++i)
      for(int j = 0; j < W; ++j)
	board[i+1][j+1] += board[i+1][j];

    for(int i = 0; i < H; ++i)
      for(int j = 0; j < W; ++j)
	board[i+1][j+1] += board[i][j+1];

    E = getsum(0,0,H,W);
    pii ans = solve(0,0,H,W);
    cout << ans.first << " " << ans.second << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'memset' was not declared in this scope
   46 |     memset(board, 0, sizeof(board));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <utility>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iostream>
using namespace std;

#define rep2(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) rep2(i,0,n)

struct p{
	int g,m;
	p(){}
	p(int g,int m):g(g),m(m){}
};

int h,w,s,sum[32][32];
p dp[32][32][32][32];

int main(){
	while(cin>>h>>w>>s&&h){
		memset(sum,0,sizeof(sum));
		memset(dp,0,sizeof(dp));
		rep(i,h)rep(j,w){
			int u;
			cin>>u;
			if(j==0){
				if(i==0)sum[0][0]=u;
				else sum[i][0]=sum[i-1][0]+u;
			}
			else{
				if(i==0)sum[0][j]=sum[0][j-1]+u;
				else sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+u;
			}
		}
		s=sum[h-1][w-1]-s;
		rep(i,h)rep(j,w)rep(k,h)rep(l,w){
			int S;
			if(j==0){
				if(i==0)S=sum[k][l];
				else S=sum[k][l]-sum[i-1][l];
			}
			else{
				if(i==0)S=sum[k][l]-sum[k][j-1];
				else S=sum[k][l]-sum[i-1][l]-sum[k][j-1]+sum[i-1][j-1];
			}
			if(S>=s)dp[i][j][k][l]=p(1,S);
		}
		rep2(H,1,h+1)rep2(W,1,w+1)rep(y,h-H+1)rep(x,w-W+1){
			int g=0,m=0;
			rep(i,H-1){
				p U=dp[y][x][y+i][x+W-1],D=dp[y+i+1][x][y+H-1][x+W-1];
				if(U.g&&D.g&&U.m>=s&&D.m>=s&&(U.g+D.g>g||U.g+D.g==g&&min(U.m,D.m)>m)){g=U.g+D.g,m=min(U.m,D.m);}
			}
			rep(i,W-1){
				p L=dp[y][x][y+H-1][x+i],R=dp[y][x+i+1][y+H-1][x+W-1];
				if(L.g&&R.g&&L.m>=s&&R.m>=s&&(L.g+R.g>g||L.g+R.g==g&&min(L.m,R.m)>m)){g=L.g+R.g,m=min(L.m,R.m);}
			}
			if(g)dp[y][x][y+H-1][x+W-1]=p(g,m);
		}
		cout<<dp[0][0][h-1][w-1].g<<" "<<dp[0][0][h-1][w-1].m-s<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'memset' was not declared in this scope
   18 |                 memset(sum,0,sizeof(sum));
      |                 ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

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

int h,w,s;
int cost[32][32];
int sum[33][33];
int num[32][32][32][32];
int cap[32][32][32][32];
int M;

int calc_sum(int x1,int y1,int x2,int y2){
	x1++;y1++;x2++;y2++;
	return sum[y2][x2]-sum[y2][x1-1]-sum[y1-1][x2]+sum[y1-1][x1-1];
}

typedef pair<int,int> A;

A dfs(int x1,int y1,int x2,int y2){
	if(num[y1][x1][y2][x2]>=0) return make_pair(num[y1][x1][y2][x2],cap[y1][x1][y2][x2]);
	if(calc_sum(x1,y1,x2,y2)<M) return make_pair(0,10000000);
	A res=make_pair(1,calc_sum(x1,y1,x2,y2)-M);

	for(int x=x1;x+1<=x2;x++){
		if(calc_sum(x1,y1,x,y2)<M || calc_sum(x+1,y1,x2,y2)<M) continue;
		A ans1=dfs(x1,y1,x,y2);
		A ans2=dfs(x+1,y1,x2,y2);
		A temp=make_pair(ans1.first+ans2.first,min(ans1.second,ans2.second));
		if(temp.first>res.first) res=temp;
		else if(temp.first==res.first && temp.second>res.second) res=temp;
	}

	for(int y=y1;y+1<=y2;y++){
		if(calc_sum(x1,y1,x2,y)<M || calc_sum(x1,y+1,x2,y2)<M) continue;
		A ans1=dfs(x1,y1,x2,y);
		A ans2=dfs(x1,y+1,x2,y2);
		A temp=make_pair(ans1.first+ans2.first,min(ans1.second,ans2.second));
		if(temp.first>res.first) res=temp;
		else if(temp.first==res.first && temp.second>res.second) res=temp;
	}
	num[y1][x1][y2][x2]=res.first;
	cap[y1][x1][y2][x2]=res.second;
	
	return res;
}

void solve()
{
	memset(num,-1,sizeof(num));
	memset(sum,0,sizeof(sum));
	for(int y=1;y<=h;y++){
		for(int x=1;x<=w;x++){
			int t;cin>>t; 
			cost[y-1][x-1]=t;
			sum[y][x]=sum[y][x-1];
			sum[y][x]+=cost[y-1][x-1];
		}
	}

	for(int x=1;x<=w;x++){
		for(int y=1;y<=h;y++){
			sum[y][x]+=sum[y-1][x];
		}
	}

	M=calc_sum(0,0,w-1,h-1)-s;
	cout<<M<<endl;
	A Ans=dfs(0,0,w-1,h-1);
	cout<<Ans.first<<" "<<Ans.second<<endl;
}

int main()
{
	while(cin>>h>>w>>s && !(h==0 && w==0 && s==0)){
		solve();
	}
	return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:49:9: error: 'memset' was not declared in this scope
   49 |         memset(num,-1,sizeof(num));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

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

#define INF (1<<20)
int h,w,s;
int u[32][32];
struct Group{
	int n,yobi;
}dp[32][32][32][32];

int total[32][32];
int calc(int y1,int y2,int x1,int x2){
	int a,b,c,d;
	b=c=d=0;
	a = total[y2][x2];
	if(x1)b = total[y2][x1-1];
	if(y1)c = total[y1-1][x2];
	if(y1&&x1)d = total[y1-1][x1-1];
	return a-b-c+d;
}
Group dfs(int y1,int y2,int x1,int x2){
	if(dp[y1][y2][x1][x2].n!=-1)return dp[y1][y2][x1][x2];
	Group res={-1,-1},a,b,t;
	if(s<total[h-1][w-1]-calc(y1,y2,x1,x2)){
		res.n = -INF;
		return dp[y1][y2][x1][x2]=res;
	}
	res.n = 1;
	res.yobi = s-(total[h-1][w-1]-calc(y1,y2,x1,x2));
	for(int i=x1;i<x2;i++){
		a = dfs(y1,y2,x1,i);
		b = dfs(y1,y2,i+1,x2);
		t.n = a.n+b.n;
		t.yobi = min(a.yobi,b.yobi);
		if(res.n < t.n)res = t;
		else if(res.n==t.n && res.yobi<t.yobi)res=t;
	}
	for(int i=y1;i<y2;i++){
		a = dfs(y1,i,x1,x2);
		b = dfs(i+1,y2,x1,x2);
		t.n = a.n+b.n;
		t.yobi = min(a.yobi,b.yobi);
		if(res.n < t.n)res = t;
		else if(res.n==t.n && res.yobi<t.yobi)res=t;
	}
	return dp[y1][y2][x1][x2]=res;
}
int main(){
	
	while(cin>>h>>w>>s,h|w|s){
		for(int y=0;y<h;y++)
			for(int x=0;x<w;x++){
				cin>>u[y][x];
				total[y][x] = u[y][x];
			}
		for(int y=1;y<h;y++)total[y][0] += total[y-1][0];
		for(int x=1;x<w;x++)total[0][x] += total[0][x-1];
		for(int y=1;y<h;y++)
			for(int x=1;x<w;x++)
				total[y][x] += total[y-1][x]+total[y][x-1]-total[y-1][x-1];
		memset(dp,-1,sizeof(dp));
		Group ans = dfs(0,h-1,0,w-1);
		cout<<ans.n<<' '<<ans.yobi<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:17: error: 'memset' was not declared in this scope
   64 |                 memset(dp,-1,sizeof(dp));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <cstring>
#include <string>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef pair<int,int> P;
int h,w,s,all,t[32][32];
int rec[32][32][32][32]; //長方形の合計[ly][lx][hy][hx]
P dp[32][32][32][32]; //メモ化

//全ての(lx,ly)〜(hx,hy)の長方形合計を計算
void mkRec(){
  memset(rec,0,sizeof(rec));

  rep(i,h){
    rep(j,w){
      rec[i][j][i][j] = t[i][j];

      for(int y=i-1;y>=0;y--)
        rec[y][j][i][j] = rec[y+1][j][i][j] + t[y][j];

      for(int y=i;y>=0;y--){
        int sum = 0;
        for(int x=j;x>=0;x--){
          sum += rec[y][x][i][x];
          rec[y][x][i][j] = sum;
        }
      }
    }
  }
}

//戻り型 : P. first : 最大グループ数. second : 最大予備力
P dfs(int lx,int ly,int hx,int hy){
  if(dp[ly][lx][hy][hx].first != 0) return dp[ly][lx][hy][hx];

  P res = P(1,s-(all-rec[ly][lx][hy][hx]));

  //水平分割
  for(int i=ly;i<hy;i++){
    if(all - rec[ly][lx][i][hx] > s ||
       all - rec[i+1][lx][hy][hx] > s) continue;
    P a = dfs(lx,ly,hx,i);
    P b = dfs(lx,i+1,hx,hy);
    P cal = P(a.first+b.first,min(a.second,b.second));
    res = max(res,cal);
  }

  //垂直分割
  for(int j=lx;j<hx;j++){
    if(all - rec[ly][lx][hy][j] > s ||
       all - rec[ly][j+1][hy][hx] > s) continue;
    P a = dfs(lx,ly,j,hy);
    P b = dfs(j+1,ly,hx,hy);
    P cal = P(a.first+b.first,min(a.second,b.second));
    res = max(res,cal);
  }

  return dp[ly][lx][hy][hx] = res;
}

int main(void){
  while(scanf("%d%d%d",&h,&w,&s),h||w||s){
    all = 0;
    rep(i,h){
      rep(j,w){
        scanf("%d",&t[i][j]);
        all += t[i][j];
      }
    }

    mkRec();

    memset(dp,0,sizeof(dp));
    P p = dfs(0,0,w-1,h-1);
    printf("%d %d\n",p.first,p.second);
  }
}

Compiler output:
a.cc: In function 'void mkRec()':
a.cc:18:7: error: 'i' was not declared in this scope
   18 |   rep(i,h){
      |       ^
a.cc:18:3: error: 'rep' was not declared in this scope; did you mean 'rec'?
   18 |   rep(i,h){
      |   ^~~
      |   rec
a.cc: In function 'int main()':
a.cc:68:9: error: 'i' was not declared in this scope
   68 |     rep(i,h){
      |         ^
a.cc:68:5: error: 'rep' was not declared in this scope; did you mean 'rec'?
   68 |     rep(i,h){
      |     ^~~
      |     rec
Language: C++

#include<cstdio>
#include<algorithm>

using namespace std;

int field[33][33];
int sum[33][33];
int num[33][33][33][33];
int msz[33][33][33][33];

int H,W,S;
int all;

const int inf=1<<29;

int get(int i1,int i2,int j1,int j2){
	i1--;j1--;
	return sum[i2][j2]-sum[i1][j2]-sum[i2][j1]+sum[i1][j1];
}

int main(){
	while(true){
		scanf("%d%d%d",&H,&W,&S);
		if(H==0&&W==0) return 0;
		for(int i=1;i<=H;i++)for(int j=1;j<=W;j++)scanf("%d",&field[i][j]);
		memset(sum,0,sizeof(sum));
		for(int i=1;i<=H;i++) for(int j=1;j<=W;j++){
			sum[i][j]=sum[i-1][j]+sum[i][j-1]-sum[i-1][j-1]+field[i][j];
		}
		int x=sum[H][W]-S;
		memset(num,-1,sizeof(num));
		memset(msz,-1,sizeof(msz));
		for(int i=1;i<=H;i++)for(int j=1;j<=W;j++){
			if(field[i][j]<x){
				num[i][i][j][j]=-inf;
				msz[i][i][j][j]=-inf;
			}else{
				num[i][i][j][j]=1;
				msz[i][i][j][j]=field[i][j];
			}
		}
//		printf("aa%d %d\n",get(1,2,1,2),sum[2][3]);
		for(int id=0;id<=H-1;id++) for(int jd=0;jd<=W-1;jd++){
		if(id==0&&jd==0) continue;
			for(int i=1;i+id<=H;i++){
				for(int j=1;j+jd<=W;j++){
					int i1=i,i2=i+id,j1=j,j2=j+jd;
					int cAll=get(i1,i2,j1,j2);
					if(cAll<x){
						num[i1][i2][j1][j2]=-inf;
						msz[i1][i2][j1][j2]=-inf;
						continue;
					}
					num[i1][i2][j1][j2]=1;
					msz[i1][i2][j1][j2]=cAll;
					if(id!=0){
						for(int si=i1;si<i2;si++){
							//[i][si],[si+1][i2]
							int nnum=num[i1][si][j1][j2]+num[si+1][i2][j1][j2];
							int nmsz=min(msz[i1][si][j1][j2],msz[si+1][i2][j1][j2]);
							int &cnum=num[i1][i2][j1][j2];
							int &cmsz=msz[i1][i2][j1][j2];
							if(cnum<nnum||(cnum==nnum&&cmsz<nmsz)){
								cnum=nnum;
								cmsz=nmsz;
							}
						}
					}
					if(jd!=0){
						for(int sj=j1;sj<j2;sj++){
							int nnum=num[i1][i2][j1][sj]+num[i1][i2][sj+1][j2];
							int nmsz=min(msz[i1][i2][j1][sj],msz[i1][i2][sj+1][j2]);
							int &cnum=num[i1][i2][j1][j2];
							int &cmsz=msz[i1][i2][j1][j2];
							if(cnum<nnum||(cnum==nnum&&cmsz<nmsz)){
								cnum=nnum;
								cmsz=nmsz;
							}
						}
					}
				}
			}
		}
		printf("%d %d\n",num[1][H][1][W],msz[1][H][1][W]-x);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'memset' was not declared in this scope
   26 |                 memset(sum,0,sizeof(sum));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 |
Language: Java

// 国内予選 2012 A ミレニアム
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int y = sc.nextInt();
            int m = sc.nextInt();
            int d = sc.nextInt();
            
            int ans = length(y, m, d);
            System.out.println(ans);
        }
    }
    
    public static int length(int y, int m, int d) {
        int length = 0;
        
        length += lengthOfMonth(y, m) - d a+ 1;
        
        for (int i = m + 1; i <= 10; i++) {
            length += lengthOfMonth(y, i);
        }
        
        for (int i = y + 1; i < 1000; i++) {
            length += lengthOfYear(i);
        }
        
        return length;
    }
    
    public static int lengthOfMonth(int y, int m) {
        if (y % 3 == 0 || m % 2 == 1) {
            return 20;
        } else {
            return 19;
        }
    }
    
    public static int lengthOfYear(int y) {
        int length = 0;
            for (int i = 1; i <= 10; i++) {
                length += lengthOfMonth(y, i);
            }
        
        return length;
    }
}

Compiler output:
Main.java:22: error: ';' expected
        length += lengthOfMonth(y, m) - d a+ 1;
                                         ^
Main.java:22: error: not a statement
        length += lengthOfMonth(y, m) - d a+ 1;
                                           ^
2 errors
Language: Java

#include <stdio.h>

int Days(int year, int month, int day);

int main(){
	int data;
	int year, month, day;
	int i;
	int millennium_days = Days(1000, 1, 1);
	int birthday;

	scanf("%d", &data);
	for(i=0; i<data; i++){
		scanf("%d %d %d", &year, &month, &day);
		birthday = Days(year, month, day);
		printf("%d\n", millennium_days - birthday);
	}

	return 0;
}

int Days(int year, int month, int day){
	int num;
	int leap_year_num;

	leap_year_num = (year-1)/3;
	num = leap_year_num*200+(year-1-leap_year_num)*195;
	if(year%3==0){
		num += (month-1)*20 + day;
	}else{
		num += (month-1)*20 - (month-1)/2 + day;
	}
	return num;
}

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:5: error: unnamed classes are a preview feature and are disabled by default.
int main(){
^
  (use --enable-preview to enable unnamed classes)
Main.java:12: error: illegal start of expression
	scanf("%d", &data);
	            ^
Main.java:14: error: illegal start of expression
		scanf("%d %d %d", &year, &month, &day);
		                  ^
Main.java:14: error: illegal start of expression
		scanf("%d %d %d", &year, &month, &day);
		                         ^
Main.java:14: error: illegal start of expression
		scanf("%d %d %d", &year, &month, &day);
		                                 ^
7 errors
Language: Java

import java.util.*;
class Main {
	public static void main(String[] args) {
		int big=20;
		int sml=19;
		Scanner scn=new Scanner(System.in);
		int n=scn.nextInt();
		int[][] dat=new int[n][3];
		int[] ans=new int[n];
		for (int i=0;i<dat.length;i++){
			for(int j=0;j<3;j++){
				dat[i][j]=scn.nextInt();
			}
			int cnt=dat[i][0];
			int bcnt=0;
			int scnt=0;
			int a=0;
                        if(dat[i][1]<10){
			if(dat[i][1]%2==0){
				if(dat[i][0]%3==0){a++;}
				for(int d=dat[i][2];d<=sml;d++) a++;
			}else{
				for(int d=dat[i][2];d<=big;d++) a++;
			}
			for(int m=dat[i][1]+1;m<=10;m++){
				if(m%2==0&&dat[i][0]%3!=0){scnt++;}
				else{bcnt++;}
			}
                        cnt++;
                        }else{
			if(dat[i][1]%2==0){
				for(int d=dat[i][2];d>=1;d--) a--;
			}
			while(cnt<1000){
				if(cnt%3==0){
					bcnt+=10;
				}else{
					bcnt+=5;
					scnt+=5;
				}
				cnt++;
			}
			ans[i]=bcnt*big+scnt*sml+a;
		}

		for(int i=0;i<ans.length;i++){
			System.out.println(ans[i]);
		}
	}
}

Compiler output:
Main.java:50: error: reached end of file while parsing
}
 ^
1 error
Language: Java


import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class P1179 {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int c=0;c<n;c++) {
			int y = sc.nextInt(), m = sc.nextInt(), d = sc.nextInt(), cnt = 0;
			while( !( y == 1000 && m == 1 && d == 1 ) ) {
				cnt++; d++;
				if( d == (y%3==0? 21: ( m%2==0? 20: 21 ) ) ) {
					d = 1; m++;
					if(m == 11) {
						m = 1; y++;
					}
				}
			}
			System.out.println(cnt);
			
		}
	}

	public static void main(String[] args) {
		new P1179().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

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

package Vol011;
import java.util.Scanner;

public class AOJ11_79 
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		while(n--!=0)
		{
			int all=0;
			all=333*200+666*195+1;
			int y=in.nextInt();
			int m=in.nextInt();
			int d=in.nextInt();
			int yc =0;
			int mc =0;
			int dc =d;
			for(int i=1;i<y;i++)
			{	
				if(i%3==0)
					yc+=200;
				else
					yc+=195;
			}
			for(int j=1;j<m;j++)
			{
				if(y%3==0||j%2!=0)
					mc+=20;
				else
					mc+=19;
			}
			System.out.println(all-yc-mc-dc);
		}
	}
}

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

import java.util.*;

public class 1179Millennium {
    static Scanner kbd = new Scanner(System.in);
    public static void main(String[] args) {
	
	int n = kbd.nextInt();       //データセット数
	while(n>0) {
	    solve();
	    n--;
	}
    }

    static void solve() {
	int y = kbd.nextInt();   //誕生年
	int m = kbd.nextInt();   //誕生月
	int d = kbd.nextInt();   //誕生日
	int answer;
	answer = calc(y, m, d);
	System.out.println(answer);
    }

    static int calc(int y, int m, int d) {
	int total = 0;  //ミレニアムまでの日数
	int three = 0;  //3の倍数の年数
	int notT = 0;   //3の倍数でない年数
	int D;          //誕生年1月1日から誕生日までの日数
	for(int i=y; i<1000; i++) {
	    if(i%3 == 0) three++;
	    else         notT++;
	}
	total = notT*195 + three*200;   //仮total(誕生年1月1日〜ミレニアム)
	D = days(y, m, d);
	total = total - D + 1;          //誕生日も含めた正式なtotal
	return total;
    }

    static int days(int y, int m, int d) {
	int D = 0;
	if(y%3 == 0)
	    for(int j=1; j<m; j++) D += 20;
	else {
	    for(int j=1; j<m; j++) {
		if(j%2 == 0) D += 19;
		else         D += 20;
	    }
	}
	D += d;
	return D;
    }
}

Compiler output:
Main.java:3: error: <identifier> expected
public class 1179Millennium {
            ^
1 error
Language: Java

mport java.util.*;
public class AOJ1179{
        public static boolean judge(int y){
                if(y%3==0)      return true;
                return false;
        }
        public static int days(int y,int m,int d){
                int days = 0;
                for(int i=1;i<y;i++){
                        if(i%3==0){
                                days += 200;
                        }else{
                                days += 195;
                        }
                }
                if(y%3!=0){
                        for(int i=1;i<m;i++){
                                if(i%2==0)days+=19;
                                else days += 20;
                        }
                }else{
                        for(int i=1;i<m;i++){
                                days += 20;
                        }
                }
                days += d;
                return days;
        }
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int today = days(1000,1,1);
                int n=sc.nextInt();
                for(int i=0;i<n;i++){
                        int ans = today - days(sc.nextInt(),sc.nextInt(),sc.nextInt());
                        System.out.println(ans);
                }

        }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: Java

mport java.util.*;
public class Main{
        public static boolean judge(int y){
                if(y%3==0)      return true;
                return false;
        }
        public static int days(int y,int m,int d){
                int days = 0;
                for(int i=1;i<y;i++){
                        if(i%3==0){
                                days += 200;
                        }else{
                                days += 195;
                        }
                }
                if(y%3!=0){
                        for(int i=1;i<m;i++){
                                if(i%2==0)days+=19;
                                else days += 20;
                        }
                }else{
                        for(int i=1;i<m;i++){
                                days += 20;
                        }
                }
                days += d;
                return days;
        }
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int today = days(1000,1,1);
                int n=sc.nextInt();
                for(int i=0;i<n;i++){
                        int ans = today - days(sc.nextInt(),sc.nextInt(),sc.nextInt());
                        System.out.println(ans);
                }

        }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error
Language: Java

mport java.util.*;
class AOJ1179{
        public static boolean judge(int y){
                if(y%3==0)      return true;
                return false;
        }
        public static int days(int y,int m,int d){
                int days = 0;
                for(int i=1;i<y;i++){
                        if(i%3==0){
                                days += 200;
                        }else{
                                days += 195;
                        }
                }
                if(y%3!=0){
                        for(int i=1;i<m;i++){
                                if(i%2==0)days+=19;
                                else days += 20;
                        }
                }else{
                        for(int i=1;i<m;i++){
                                days += 20;
                        }
                }
                days += d;
                return days;
        }
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int today = days(1000,1,1);
                int n=sc.nextInt();
                for(int i=0;i<n;i++){
                        int ans = today - days(sc.nextInt(),sc.nextInt(),sc.nextInt());
                        System.out.println(ans);
                }

        }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.*;
^
1 error