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

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int w = sc.nextInt();
			if(n+w==0)break;
			int[] cnt = new int[100];
			for (int i = 0; i < n; i++) {
				cnt[sc.nextInt()/w]++;
			}
			double high=0;
			double max = 0;
			for (int i = 0; i < cnt.length; i++) {
				high=Math.max(high, cnt[i]);
				if(cnt[i]>0){
					max=i;
				}
			}
			double ans = 0.01;
			for (int i = 0; i < cnt.length; i++) {
				if(cnt[i]==0)continue;
				ans += (cnt[i]/high) * ((int)max-i)/(max);
			}
			System.out.println(ans);
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Scanner;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include<iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <set>
#include <functional>

using namespace std;
int v[102];
int m[102];
int main()
{
    while(true){
        int n,w;
        cin>>n>>w;
        if(n==0)
            break;
        int ma=0;
        int ma2=0;
        memset(m,0,sizeof(m));
        for(int i=0;i<n;i++){
            cin>>v[i];
            m[v[i]/w]++;
            ma=max(ma,v[i]/w);
            ma2=max(ma2,m[v[i]/w]);
        }
        double ans=0;
        for(int i=0;i<=ma;i++){
            ans+=(double)(ma-i)*m[i]/ma/ma2;
            //cout<<(double)(ma-i)*m[i]/ma/ma2<<endl;
        }
        ans+=0.01;
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'memset' was not declared in this scope
   24 |         memset(m,0,sizeof(m));
      |         ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <functional>
  +++ |+#include <cstring>
   11 |
Language: C++

#include <iostream>
#include <fstream>

using namespace std;

int main(){
	int n, w, h[11];
	while(cin >> n >> w, n){
		memset(h, 0, sizeof(h));
		int mx = 0, tmp;
		for(int i=0;i<n;i++){
			cin >> tmp;
			mx = max(mx, tmp);
			h[tmp/w]++;
		}
		int size = mx/w, hist = 0;
		for(int i=0;i<=size;i++)
			hist = max(hist, h[i]);
		double ans = 0.01;
		for(int i=0;i<size;i++)
			ans += ((double)(size-i)*h[i])/(hist*size);
		printf("%.6lf\n", ans);
	}
}

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

#include <iostream>
#include <string>
#include <cctype>
#include <memory>
#include <vector>
#include <array>
#include <algorithm>

//auto in = freopen("input", "r", stdin);

using namespace std;

int main(){
	cout << setprecision(20);
	while(true){
		int n, w;
		cin >> n >> w;
		if(n==0 && w==0) break;

		vector<int> list;
		for(int i=0; i<n; ++i){
			int v;
			cin >> v;
			int index = v/w;
			while(list.size()<=index) list.push_back(0);
			++list[index];
		}

		int max_height = 0;
		for(int i=0; i<list.size(); ++i){
			max_height = max(max_height, list[i]);
		}

		double sum = 0;
		for(auto i=0; i<list.size(); ++i){
			double kosa = (list.size()-(i+1))/((double)list.size() - 1);
			sum += kosa * list[i];
		}

		cout << sum/max_height + 0.01 << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:17: error: 'setprecision' was not declared in this scope
   14 |         cout << setprecision(20);
      |                 ^~~~~~~~~~~~
a.cc:8:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    7 | #include <algorithm>
  +++ |+#include <iomanip>
    8 |
Language: C

#include<cstdio>
#include<cmath>
using namespace std;

typedef long double D;

int n,m,k,N;

D rec(int d,int sum){
  if(d==n){
    sum -= k;
    if(sum<1)sum = 1;
    return (D)sum/N;
  }

  D res = 0;
  for(int i=1;i<=m;i++)res += rec(d+1,sum+i);
  return res;
}

int main(){
  while(scanf("%d%d%d",&n,&m,&k),n+m+k){
    N = pow(m,n);
    printf("%.9Lf\n",rec(0,0));
  }
}
    

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C++

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int hist[2][500000];

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M, K;
  while(cin>>N>>M>>K,N){
	fill((int*)hist, (int*)hist+2*500000, 0);
	int crt=0, nxt=1;
	for(int i=1;i<=M;++i)
	  hist[crt][i] = 1;

	REP(i,N-1){
	  fill(hist[nxt], hist[nxt]+500000, 0);
	  REP(j,500000){
		if(hist[crt][j] == 0) continue;
		for(int k=1;k<=M;++k)
		  else hist[nxt][j+k] += hist[crt][j];
	  }
	  swap(crt, nxt);
	}

	double ans = 0., tot = pow(M, N);
	FOR(i,N,500000){
	  if(hist[crt][i] == 0) break;
	  if(i <= K)
		ans += hist[crt][i];
	  else
		ans += hist[crt][i] * (i - K);
	}
	cout << fixed << setprecision(8) << ans / tot << endl;
  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:76:19: error: expected primary-expression before 'else'
   76 |                   else hist[nxt][j+k] += hist[crt][j];
      |                   ^~~~
Language: C++

#include <iostream> #include <iomanip> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <string> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> using namespace std; #define rep(i,j) REP((i), 0, (j)) #define REP(i,j,k) for(int i=(j);(i)<(k);++i) #define BW(a,x,b) ((a)<=(x)&&(x)<=(b)) #define ALL(v) (v).begin(), (v).end() #define LENGTHOF(x) (sizeof(x) / sizeof(*(x))) #define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b) #define SQ(x) ((x)*(x)) #define Mod(x, mod) (((x)+(mod)%(mod)) #define MP make_pair #define PB push_back #define Fi first #define Se second #define INF (1<<29) #define EPS 1e-10 #define MOD 1000000007 typedef pair<int, int> pi; typedef pair<int, pi> pii; typedef vector<int> vi; typedef queue<int> qi; typedef long long ll; int N,M,K; ll dfs(int n, int s){ if(n==N) return max(1, s); ll res = 0; for(int i=1;i<=M;i++){ res += dfs(n+1, s+i); } return res; } int main(){ while(cin >> N >> M >> K && N+M+K){ cout << fixed << setprecision(12) << dfs(0, -K)/(double)pow(M, N) << endl; } return 0; }


Compiler output:
a.cc:1:21: warning: extra tokens at end of #include directive
    1 | #include <iostream> #include <iomanip> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <string> #include <map> #include <set> #include <queue> #include <stack> #include <algorithm> using namespace std; #define rep(i,j) REP((i), 0, (j)) #define REP(i,j,k) for(int i=(j);(i)<(k);++i) #define BW(a,x,b) ((a)<=(x)&&(x)<=(b)) #define ALL(v) (v).begin(), (v).end() #define LENGTHOF(x) (sizeof(x) / sizeof(*(x))) #define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b) #define SQ(x) ((x)*(x)) #define Mod(x, mod) (((x)+(mod)%(mod)) #define MP make_pair #define PB push_back #define Fi first #define Se second #define INF (1<<29) #define EPS 1e-10 #define MOD 1000000007 typedef pair<int, int> pi; typedef pair<int, pi> pii; typedef vector<int> vi; typedef queue<int> qi; typedef long long ll; int N,M,K; ll dfs(int n, int s){ if(n==N) return max(1, s); ll res = 0; for(int i=1;i<=M;i++){ res += dfs(n+1, s+i); } return res; } int main(){ while(cin >> N >> M >> K && N+M+K){ cout << fixed << setprecision(12) << dfs(0, -K)/(double)pow(M, N) << endl; } return 0; }
      |                     ^
/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 <fstream>
#include <vector>

using namespace std;

int main(){
	int n, m ,k;
	while(cin >> n >> m >> k, n){
		vector<double> cur(n*m+1, 0.0);
		cur[0] = 1.0;
		for(int i=0;i<n;i++){
			vector<double> next(n*m+1, 0.0);
			for(int j=0;j+m<=n*m;j++)
				for(int l=1;l<=m;l++)
					next[j+l] += cur[j]/m;
			cur = next;
		}
		double ans = 0.0;
		for(int i=1;i<=n*m;i++)
			ans += cur[i]*max(1,i-k);
		printf("%.8lf\n", ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'cin' was not declared in this scope
    8 |         while(cin >> n >> m >> k, n){
      |               ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 |
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cstring>
#include <queue>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define rev(v) (v).rbegin(), (v).rend()
#define MP make_pair
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> P;
typedef long long ll;

int main(){
	//freopen("test.txt", "r", stdin);

	cout.setf(ios::fixed);
	cout.precision(8);

	int n, m, k;
	while(cin >> n >> m >> k, n|m|k){
		int size = n*m+1;
		vector<vi> v(2, vi(size, 0));
		v[0][0] = 1;
		int next = 1;
		rep(j, n){
			v[next] = vi(size, 0);
			for(int k = j; k <= j*m; k++){
				if(v[!next][k] == 0)continue;
				for(int i = 1; i <= m; i++){
					v[next][k+i] += v[!next][k];
				}
			}
			next = !next;
		}

		double ans = 0;
		double d = pow((double)m, n);

		for(int i = n; i < size; i++){
//			printf("%d/%d*%d+", v[!next][i], (int)d, max(i-k, 1));
			ans += v[!next][i]*(max(i-k, 1))/d;
		}

		cout << ans << endl;

	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:28: error: 'pow' was not declared in this scope
   42 |                 double d = pow((double)m, n);
      |                            ^~~
Language: C++

#include <iostream>
#include <string>
#include <cctype>
#include <memory>
#include <vector>
#include <array>
#include <algorithm>
#include <iomanip>
#include <stack>

//auto in = freopen("input", "r", stdin);

using namespace std;

struct Value{
	Value(long long v, long long count=1) : count(count), v(v){};
	int count;
	long long v;
};

int main(){
	cout << setprecision(20);
	while(true){
		long long n, m, k, sum = 0;
		cin >> n >> m >> k;
		if(n==0 && m==0 && k==0) break;
		stack<Value> s;
		
		s.push(Value(0,0));

		while(!s.empty()){
			auto v = s.top(); s.pop();
			if(v.count==n){
				sum += v.v-k>0 ? v.v-k : 1;
				continue;
			}
			for(int i=1; i<=m; ++i){
				auto nv = v.v + i;
				s.push(Value(nv, v.count+1));
			}
		}
		cout << sum/std::powf((long double)m,n) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:34: error: 'powf' is not a member of 'std'
   42 |                 cout << sum/std::powf((long double)m,n) << endl;
      |                                  ^~~~
Language: C++

#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

void printAns(int t1, int t2){
	int h1 = t1/3600, m1 = (t1%3600)/60, s1 = t1%60;
	int h2 = t2/3600, m2 = (t2%3600)/60, s2 = t2%60;
	printf("%02d:%02d:%02d %02d:%02d:%02d\n", h1, m1, s1, h2, m2, s2);
}

int main(){
	int n;
	while(cin >> n, n){
		vector< pair<int,int> > v;
		for(int i=0;i<n;i++){
			int t[3];
			cin >> t[0] >> t[1] >> t[2];
			sort(t, t+3);
			do{
				for(int j=0;j<60;j++){
					if(t[0]%5 == t[1]/12)
						v.push_back(make_pair((t[0]/5)*3600 + t[1]*60 + t[2],i));
					for(int k=0;k<3;k++) t[k] = (t[k]+1)%60;
				}
			}while(next_permutation(t,t+3));
		}
		sort(v.begin(), v.end());
		int start = 0, end = 12*60*60;
		for(int i=0;i<v.size();i++){
			int s = v[i].first, e = -1;
			bool see[10] = {}; see[v[i].second] = true;
			int count = 1;
			for(int j=i+1;j<v.size();j++){
				if(see[v[j].second]) continue;
				see[v[j].second] = true;
				count++;
				if(count == n) {
					e = v[j].first;
					break;
				}
			}
			if(e == -1) break;
			if(end-start > e-s) start = s, end = e;
		}
		printAns(start, end);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: 'cin' was not declared in this scope
   15 |         while(cin >> n, n){
      |               ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <algorithm>
  +++ |+#include <iostream>
    4 |
Language: C++

#include <bits/stdc++.h>
#define double long double
using namespace std;
const double EPS = 1e-8;
const double INF = 1e9;

struct p3{
  double x,y,z,r;
  p3(){x=y=z=r=0;}
  p3(double x,double y,double z):x(x),y(y),z(z){};
  p3(double x,double y,double z,double r):x(x),y(y),z(z),r(r){};
  p3 operator + (const p3 a)const {return p3(x+a.x,y+a.y,z+a.z,r);}
  p3 operator - (const p3 a)const {return p3(x-a.x,y-a.y,z-a.z,r);}
  p3 operator * (const double a)const{return p3(x*a,y*a,z*a,r);}
  p3 operator / (const double a)const{return p3(x/a,y/a,z/a,r);}
  bool operator == (const p3 a)const {return abs(x-a.x)<EPS&&abs(y-a.y)<EPS&&abs(z-a.z)<EPS;}
  double Abs()const{return sqrt(x*x+y*y+z*z);}
  double dis(const p3 a)const{return sqrt((a.x-x)*(a.x-x)+(a.y-y)*(a.y-y)+(a.z-z)*(a.z-z));}
  P xz()const{return P(x,z);}
  P xy()const{return P(x,y);}
  P yz()const{return P(y,z);};
};

double dot(p3 a,p3 b){return a.x*b.x+a.y*b.y+a.z*b.z;}

struct L3{
  p3 s,t;
  L3(){s=t=p3();}
  L3(p3 s,p3 t):s(s),t(t){};
  bool operator == (const L3 a)const{return s==a.s&&t==a.t;}
};

L3 getRay(L3 a,p3 b){//???b??¨????????????a??????????°????????????????????????????
  a.t = a.t-a.s;
  b = b-a.s;
  p3 e = a.t / a.t.Abs();
  p3 s = e*dot(e,b);
  
  double d = s.dis(b);
  if(dot(e,b)<EPS||d>b.r+EPS)return L3();
  s = e * (s.Abs()-sqrt(b.r*b.r-d*d));
  
  
  p3 n = (b-s)/(b-s).Abs(); //??????????????????
  n = n*dot(a.t*(-1),n)*2;
  p3 t = a.t+n+s;
  return L3(s+a.s,t+a.s);
}


int n;
vector<p3> A;
p3 calc(L3 ray){
  while(1){
    double mn = INF;
    L3 nray;
    for(int i=0;i<n;i++){
      L3 res = getRay(ray,A[i]);
      if(res==L3())continue;
      if(mn>ray.s.dis(res.s)) mn=ray.s.dis(res.s),nray = res;
    }
    if(mn==INF) return ray.s;
    ray = nray;
    
  }
}

int main(){
  while(cin>>n,n){
    L3 start;
    cin>>start.t.x>>start.t.y>>start.t.z;
  
    A.resize(n);  
    for(int i=0;i<n;i++)cin>>A[i].x>>A[i].y>>A[i].z>>A[i].r;

    p3 ans = calc(start);
    printf("%Lf %Lf %Lf\n",ans.x,ans.y,ans.z);
  }
  return 0;
}

Compiler output:
a.cc:19:3: error: 'P' does not name a type
   19 |   P xz()const{return P(x,z);}
      |   ^
a.cc:20:3: error: 'P' does not name a type
   20 |   P xy()const{return P(x,y);}
      |   ^
a.cc:21:3: error: 'P' does not name a type
   21 |   P yz()const{return P(y,z);};
      |   ^
Language: C++

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

#define REP(i, N) for(int i = 0; i < (int)(N); ++i)

enum {migi, hidari, mae, ushiro, ccw, cw};
int dx[] = {0,0,1,-1,0,0};
int dy[] = {1,-1,0,0,0,0};
int op[6][6] = {
	{4,1,0,3,5,2},
	{2,1,5,3,0,4},
	{3,0,2,5,4,1},
	{1,5,2,0,4,3},
	{0,4,1,2,3,5},
	{0,2,3,4,1,5},
};

void roll(vector<int> &v, int dir){
	vector<int> temp = v;
	for(int i = 0; i < 6; i++){
		temp[i] = v[op[dir][i]];
	}
	v = temp;
}

vector<int> dice[24];

void init_dice(){
	for(int i=1; i < 24; i++){
		dice[i] = dice[i-1];
		roll(dice[i], ccw);
		if( i % 8 == 0 ) roll(dice[i], hidari);
		else if(i % 4 == 0) roll(dice[i], mae);
	}
}

int R,C;
string table[32];
string order;

bool valid(int x, int y) {
	return 0 <= x && x < R && 0 <= y && y < C;
}

string color = "rgbmyc";
int memo[30][30][7][6][6];
struct State {
	int x, y, m;
	vector<int> v;
	int &ref() {
		return memo[x][y][m][color.find(v[0])][color.find(v[1])];
	}
};

int bfs(int x, int y, vector<int> v) {
	queue<State> up;
	State s = (State){ x, y, 0, v};
	up.push( s );
	s.ref() = 0;
	while( !up.empty() ) {
		s = up.front();
		up.pop();
		if( s.m == 6 ) return s.ref();
		REP(k, 4) {
			int nx = s.x + dx[k];
			int ny = s.y + dy[k];
			if( !valid(nx, ny) || table[nx][ny] == 'k' ) continue;
			if( table[nx][ny] != 'w' ) {
				if( order[s.m] != table[nx][ny] ) continue;
				vector<int> next_v = s.v;
				roll(next_v, k);
				if( next_v[0] != table[nx][ny] ) continue;
				
				State next = s;
				next.x = nx;
				next.y = ny;
				next.m = next.m + 1;
				next.v = next_v;
				if( next.ref() == -1 ) {
					next.ref() = s.ref() + 1;
					up.push(next);
				}
			} else {
				vector<int> next_v = s.v;
				roll(next_v, k);
				State next = s;
				next.x = nx;
				next.y = ny;
				next.v = next_v;
				if( next.ref() == -1 ) {
					next.ref() = s.ref() + 1;
					up.push(next);
				}
			}
		}
	}
	return -1;
}

int main() {
	for(;;) {
		cin >> C >> R; if( R == 0 && C == 0 ) break;
		REP(r, R) {
			cin >> table[r];
		}
		cin >> order;
		
		int sx, sy;
		REP(r, R) REP(c, C) {
			if( table[r][c] == '#' ) {
				sx = r; sy = c;
				table[r][c] = 'w';
			}
		}
		
		dice[0].push_back('r');
		dice[0].push_back('m');
		dice[0].push_back('b');
		dice[0].push_back('g');
		dice[0].push_back('y');
		dice[0].push_back('c');
		memset(memo, -1, sizeof(memo));
		int res = bfs(sx, sy, dice[0]);
		if( res == -1 )
			cout << "unreachable" << endl;
		else
			cout << res << endl;
	}
}

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

// 2008AWAnæ\IF : Traveling Cube
#include <iostream>
#include <queue>
#include <string>

using namespace std;

class Node{
public:
	int x, y, p, d0, d1, c;
	Node(int x, int y, int p, int d0, int d1, int c) : x(x), y(y), p(p), d0(d0), d1(d1), c(c) {}
};

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
// TCRÌÊÌJÚsñ
char dice[6][4] = {
	{5,2,1,4}, {1,1,3,0}, {0,3,2,2},
	{2,5,4,1}, {4,4,0,3}, {3,0,5,5}
};
char side[] = {1,2,4,5};
// ÊÔÍCãC¶C³ÊCºCECwÊÌ
char dice_color[6] = {'r','y','m','c','b','g'};

char getUpper(int a, int b){
	// a(úóÔÅã)ÊªãÉ éD
	if(a == 0) return dice_color[0];
	// b(úóÔÅ¶)ÊªãÉ éD
	if(b == 0) return dice_color[1];
	// aÊªºÉ é
	if(a == 3) return dice_color[3];
	// bÊªºÉ é
	if(b == 3) return dice_color[4];
	return dice_color[(side[(i+1)%4]-side[i]+6)%6 < 3 ? 2 : 5];
}

int main(){
	int w, d;
	string path;
	string mp[30];
	while(cin >> w >> d, w){
		for(int i=0;i<d;i++) cin >> mp[i];
		cin >> path;
		int sx, sy = -1;
		for(int i=0;i<d&&sy<0;i++)
			sx = i, sy = mp[i].find('#');
		// `FbNÏÝÌóÔÌÇp
		bool visit[30][30][6][6][6];
		memset(visit, false, sizeof(visit));
		queue<Node> qu; qu.push(Node(sx,sy,0,0,1,0));
		int ans = -1;
		while(!qu.empty()){
			Node nd = qu.front(); qu.pop();
			int x = nd.x, y = nd.y, p = nd.p, d0 = nd.d0, d1 = nd.d1, c = nd.c;
			// Ft«}Xð·×ÄÊsµ½
			if(p == 6){ ans = c; break; }
			if(visit[x][y][p][d0][d1]) continue;
			visit[x][y][p][d0][d1] = true;
			for(int i=0;i<4;i++){
				int nx = x+dx[i], ny = y+dy[i], nd0 = dice[d0][i], nd1 = dice[d1][i];
				// tB[hOÉoé©C}XÉÚ®µÄµÜ¤Æ«
				if(nx<0||d<=nx||ny<0||w<=ny||mp[nx][ny]=='k') continue;
				// FÂ«}XÉæÁ½Æ«
				if(mp[nx][ny]!='w'&&mp[nx][ny]!='#'){
					// ãÊÌFÆêvµC©Â¡ÚwµÄ¢éFÅ éÆ«
					if(mp[nx][ny]==getUpper(nd0,nd1)&&mp[nx][ny]==path[p])
						qu.push(Node(nx,ny,p+1,nd0,nd1,c+1));
				}
				// }XÖÌÚ®
				else
					qu.push(Node(nx,ny,p,nd0,nd1,c+1));
			}
		}
		// ans = -1ÌÜÜÈçBÍ³
		ans==-1 ? puts("unreachable") : printf("%d\n", ans);
	}
}

Compiler output:
a.cc: In function 'char getUpper(int, int)':
a.cc:34:34: error: 'i' was not declared in this scope
   34 |         return dice_color[(side[(i+1)%4]-side[i]+6)%6 < 3 ? 2 : 5];
      |                                  ^
a.cc: In function 'int main()':
a.cc:49:17: error: 'memset' was not declared in this scope
   49 |                 memset(visit, false, sizeof(visit));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 | #include <string>
Language: C++

// 2008AWAnæ\IF : Traveling Cube
#include <iostream>
#include <queue>
#include <string>

using namespace std;

class Node{
public:
	int x, y, p, d0, d1, c;
	Node(int x, int y, int p, int d0, int d1, int c) : x(x), y(y), p(p), d0(d0), d1(d1), c(c) {}
};

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
// TCRÌÊÌJÚsñ
char dice[6][4] = {
	{5,2,1,4}, {1,1,3,0}, {0,3,2,2},
	{2,5,4,1}, {4,4,0,3}, {3,0,5,5}
};
char side[] = {1,2,4,5};
// ÊÔÍCãC¶C³ÊCºCECwÊÌ
char dice_color[6] = {'r','y','m','c','b','g'};

char getUpper(int a, int b){
	// a(úóÔÅã)ÊªãÉ éD
	if(a == 0) return dice_color[0];
	// b(úóÔÅ¶)ÊªãÉ éD
	if(b == 0) return dice_color[1];
	// aÊªºÉ é
	if(a == 3) return dice_color[3];
	// bÊªºÉ é
	if(b == 3) return dice_color[4];
	return dice_color[(side[(b-a+6)%6 < 3 ? 2 : 5];
}

int main(){
	int w, d;
	string path;
	string mp[30];
	while(cin >> w >> d, w){
		for(int i=0;i<d;i++) cin >> mp[i];
		cin >> path;
		int sx, sy = -1;
		for(int i=0;i<d&&sy<0;i++)
			sx = i, sy = mp[i].find('#');
		// `FbNÏÝÌóÔÌÇp
		bool visit[30][30][6][6][6];
		memset(visit, false, sizeof(visit));
		queue<Node> qu; qu.push(Node(sx,sy,0,0,1,0));
		int ans = -1;
		while(!qu.empty()){
			Node nd = qu.front(); qu.pop();
			int x = nd.x, y = nd.y, p = nd.p, d0 = nd.d0, d1 = nd.d1, c = nd.c;
			// Ft«}Xð·×ÄÊsµ½
			if(p == 6){ ans = c; break; }
			if(visit[x][y][p][d0][d1]) continue;
			visit[x][y][p][d0][d1] = true;
			for(int i=0;i<4;i++){
				int nx = x+dx[i], ny = y+dy[i], nd0 = dice[d0][i], nd1 = dice[d1][i];
				// tB[hOÉoé©C}XÉÚ®µÄµÜ¤Æ«
				if(nx<0||d<=nx||ny<0||w<=ny||mp[nx][ny]=='k') continue;
				// FÂ«}XÉæÁ½Æ«
				if(mp[nx][ny]!='w'&&mp[nx][ny]!='#'){
					// ãÊÌFÆêvµC©Â¡ÚwµÄ¢éFÅ éÆ«
					if(mp[nx][ny]==getUpper(nd0,nd1)&&mp[nx][ny]==path[p])
						qu.push(Node(nx,ny,p+1,nd0,nd1,c+1));
				}
				// }XÖÌÚ®
				else
					qu.push(Node(nx,ny,p,nd0,nd1,c+1));
			}
		}
		// ans = -1ÌÜÜÈçBÍ³
		ans==-1 ? puts("unreachable") : printf("%d\n", ans);
	}
}

Compiler output:
a.cc: In function 'char getUpper(int, int)':
a.cc:34:55: error: expected ')' before ';' token
   34 |         return dice_color[(side[(b-a+6)%6 < 3 ? 2 : 5];
      |                           ~                           ^
      |                                                       )
a.cc:34:55: error: expected ']' before ';' token
   34 |         return dice_color[(side[(b-a+6)%6 < 3 ? 2 : 5];
      |                                                       ^
      |                                                       ]
a.cc: In function 'int main()':
a.cc:49:17: error: 'memset' was not declared in this scope
   49 |                 memset(visit, false, sizeof(visit));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <queue>
  +++ |+#include <cstring>
    4 | #include <string>
Language: C++

#include <bits/stdc++.h>
using namespace std;

int n;
int m;
string t;
char buf[114514];
string des[114514];
char cs[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
bool dp[1 << 12][5001];

int main() {
  while (1) {
    scanf("%d%d", &n, &m);
    if (n == 0 && m == 0) return 0;

    sum = 0;
    for (int i=0; i<n; i++) {
      scanf(" %s", buf);
      des[i] = buf;
    }

    t = "";
    for (int i=0; i<m; i++) { 
      scanf(" %s", buf);
      t += buf;
    }

    int lim = 1 << n;
    fill(dp[0], dp[lim], false);
    for (int i=0; i<t.size(); i++) {
      for (int g=0; g<n; g++) {
        int prev = i+1-des[g].size();
        if (t.substr(prev, des[g].size()) != des[g]) continue;

        for (int st=0; st<lim; st++) {
          if (st >> g & 1) continue;
          dp[st|(1<<g)][i+1] |= dp[st][prev];
        }
        dp[1<<g][i+1] = true;
      }
    }

    int ans = 0;
    for (int i=0; i<=t.size(); i++) {
      if (dp[lim-1][i]) ans++;
    }
    printf("%d\n", ans);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sum' was not declared in this scope
   17 |     sum = 0;
      |     ^~~
Language: C++

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

#define REP(i, N) for(int i = 0; i < (int)(N); i++)
bool dp[32][1 << 12];

int main() {
	for(int N, M; cin >> N >> M, (N || M); ) {
		string str;
		string word[12];
		REP(i, N) cin >> word[i];
		REP(i, M) {
			string s;
			cin >> s;
			str += s;
		}
		int len = str.size();

		memset(dp, 0, sizeof(dp));
		REP(j, 32) dp[j][0] = true;
		
		int mask = (1 << N) - 1;
		int sum = 0;
		REP(pos, len + 1) {
			int j = pos & 31;
			REP(i, N) if( word[i] == str.substr(pos, word[i].size()) ) {
				int am = (pos + word[i].size()) & 31;
				REP(state, mask) if( (state & (1 << i) ) == 0){
					dp[am][state | (1 << i)] |= dp[j][state];
				}
			}
			sum += dp[j][mask];
			for(int state = 1; state < 1 << N; state++)
				dp[j][state] = 0; 
		}
		cout << sum << endl;
	}
}

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

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


int l;
int n,m;

char c[12][21];
char s[5001];
int A[128],B[128];
bool D[12];


int check(){

	int remain = false;
	for(int i = 'a' ; i <= 'z' ; i++){
		if( B[i] != A[i] ){
			return false;
		}else{
			remain |= B[i];
		}
	}

	
	if( !remain ) return true;

	for(int i = 0 ; i < n ; i++){
		if( !D[i] ){
			D[i] = true;
			for(int j = 0 ; c[i][j] ; j++) B[c[i][j]]-- , A[c[i][j]]--;
			int res = check();
			D[i] = false;	
			for(int j = 0 ; c[i][j] ; j++) B[c[i][j]]++ , A[c[i][j]]++; 
			if( res ) return true;
		}
	}
	return false;
	
}

int main(){
	while(scanf("%d%d",&n,&m) && n){
		for(int i = 'a' ; i <= 'z' ; i++) B[i] = 0;
		l = 0;
		for(int i = 0 ; i < n ; i++){
			scanf("%s",c[i]);
			int L = strlen(c[i]);
			for(int j = 0 ; j < L ; j++)
				B[c[i][j]]++;
			l += L;
		}
		int ans = 0;
		int len = 0;
		
		for(int i = 0 ; i < m ; i++){
			scanf("%s",s+len);
			len += strlen(s);
		}
		if( len >= l ){
			for(int j = 'a' ; j <= 'z' ; j++) A[j]=0;
			for(int j = 0 ; j < l ; j++) A[s[j]]++;
			for(int j = l ; j <= len ; j++){
				if( check() ){
					ans++;
				}
				A[s[j-l]]--;
				A[s[j]]++;
			}
		}
		printf("%d\n",ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:33: error: 'strlen' was not declared in this scope
   49 |                         int L = strlen(c[i]);
      |                                 ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <cstdio>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:59:32: error: 'strlen' was not declared in this scope
   59 |                         len += strlen(s);
      |                                ^~~~~~
a.cc:59:32: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;


int l;
int n,m;

char c[12][21];
char s[5001];
int A[128],B[128];
bool D[12];


int check(){

	int remain = false;
	for(int i = 'a' ; i <= 'z' ; i++){
		if( B[i] != A[i] ){
			return false;
		}else{
			remain |= B[i];
		}
	}

	
	if( !remain ) return true;

	for(int i = 0 ; i < n ; i++){
		if( !D[i] ){
			D[i] = true;
			for(int j = 0 ; c[i][j] ; j++) B[c[i][j]]-- , A[c[i][j]]--;
			int res = check();
			D[i] = false;	
			for(int j = 0 ; c[i][j] ; j++) B[c[i][j]]++ , A[c[i][j]]++; 
			if( res ) return true;
		}
	}
	return false;
	
}

int main(){
	while(scanf("%d%d",&n,&m) && n){
		for(int i = 'a' ; i <= 'z' ; i++) B[i] = 0;
		l = 0;
		for(int i = 0 ; i < n ; i++){
			scanf("%s",c[i]);
			int L = strlen(c[i]);
			for(int j = 0 ; j < L ; j++)
				B[c[i][j]]++;
			l += L;
		}
		int ans = 0;
		int len = 0;
		
		for(int i = 0 ; i < m ; i++){
			scanf("%s",s+len);
			len += strlen(s);
		}
		if( len >= l ){
			for(int j = 'a' ; j <= 'z' ; j++) A[j]=0;
			for(int j = 0 ; j < l ; j++) A[s[j]]++;
			for(int j = l ; j <= len ; j++){
				if( check() ){
					ans++;
				}
				A[s[j-l]]--;
				A[s[j]]++;
			}
		}
		printf("%d\n",ans);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:33: error: 'strlen' was not declared in this scope
   50 |                         int L = strlen(c[i]);
      |                                 ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <cstdlib>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc:60:32: error: 'strlen' was not declared in this scope
   60 |                         len += strlen(s);
      |                                ^~~~~~
a.cc:60:32: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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


int l;
int n,m;

string c[20];
string s;
int A[128],B[128];
bool D[20];


int check(){
	int remain = false;
	for(int i = 'a' ; i <= 'z' ; i++){
		if( B[i] != A[i] ){
			return false;
		}else{
			remain |= B[i];
		}
	}

	
	if( !remain ) return true;

	for(int i = 0 ; i < n ; i++){
		if( !D[i] ){
			D[i] = true;
			for(int j = 0 ; c[i][j] ; j++) B[c[i][j]]-- , A[c[i][j]]--;
			int res = check();
			D[i] = false;	
			for(int j = 0 ; c[i][j] ; j++) B[c[i][j]]++ , A[c[i][j]]++; 
			if( res ) return true;
		}
	}
	return false;
	
}

int main(){
	while(cin >> n >> m && n){
		for(int i = 'a' ; i <= 'z' ; i++) B[i] = 0;
		l = 0;
		for(int i = 0 ; i < n ; i++){
			cin >> c[i];
			for(int j = 0 ; j < c[i].size() ; j++)
				B[c[i][j]]++;
			l += c[i].size();
		}
		s = "";
		int ans = 0;
		for(int i = 0 ; i < m ; i++){
			string t;cin >> t;
			s += t;
		}
		int len = s.size();
		if( len > 5000 ) assert(0);
		if( len >= l ){
			for(int j = 'a' ; j <= 'z' ; j++) A[j]=0;
			for(int j = 0 ; j < l ; j++) A[s[j]]++;
			for(int j = l ; j <= len ; j++){
				if( check() ){
					ans++;
				}
				A[s[j-l]]--;
				A[s[j]]++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:34: error: 'assert' was not declared in this scope
   60 |                 if( len > 5000 ) assert(0);
      |                                  ^~~~~~
a.cc:4:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    3 | #include <cstring>
  +++ |+#include <cassert>
    4 | using namespace std;
Language: C++

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

#define MAXSTACK 300000
#define MAXSIZE 5010
#define MAXN 12

struct obj {
   short int p, m;
} tmpobj, s[MAXSTACK];

bool starts[MAXSIZE][MAXN], ins[MAXSIZE][1<<MAXN];

int main() {

int N, M, i, j, k, l[MAXN], RES, FULL, E;
string n[MAXN], input, tmp;

cin >> N; FULL = (1<<N)-1;
cin >> M;

do {

for (i=0; i<N; i++) {cin >> n[i]; l[i] = n[i].size();}

input = "";
for (i=0; i<M; i++) {cin >> tmp; input += tmp;}

memset(starts, false, sizeof(starts));
for (i=0; i<input.size(); i++) {
   for (j=1; j<=20; j++) {
		tmp = input.substr(i, j);
		for (k=0; k<N; k++) {
			if (tmp == n[k]) starts[i][k] = true;
		}
	}
}

memset(ins, false, sizeof(ins)); E = 0;
for (i=0; i<input.size(); i++) {
	tmpobj.p = i;
	tmpobj.m = 0;
	s[E++] = tmpobj;
	ins[i][0] = true;
}

RES = 0;
while (E > 0) {
	tmpobj = s[--E];
	if (tmpobj.m == FULL) RES++;
	else {
      for (i=0; i<N; i++) if (starts[tmpobj.p][i] == true && ((tmpobj.m>>i)&1) == 0 && ins[tmpobj.p+l[i]][tmpobj.m^(1<<i)] == false) {
   		s[E].p = tmpobj.p+l[i];
   		s[E].m = tmpobj.m^(1<<i);
	   	ins[s[E].p][s[E].m] = true;
			E++;
			if (E == MAXSTACK) E = 0;
   	}
	}
}

cout << RES << endl;

cin >> N; FULL = (1<<N)-1;
cin >> M;

} while (N!=0 || M!=0);

return 0;
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Problem A: Cubist Artwork
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;
		String[] words;

		P1295 main = new P1295();

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int w, d;
			w = parseInt(line.substring(0, line.indexOf(' ')));
			d = parseInt(line.substring(line.indexOf(' ') + 1));
			if ((w | d) == 0) break;

			int[][] h = new int[21][2];
			StringTokenizer st;

			st = new StringTokenizer(br.readLine());
			for (int i = 0; i < w; i++) {
				h[parseInt(st.nextToken())][0]++;
			}
			st = new StringTokenizer(br.readLine());
			for (int i = 0; i < d; i++) {
				h[parseInt(st.nextToken())][1]++;
			}

			int ans = 0;

			for (int i = 1; i <= 20; i++) {
				ans += i * Math.max(h[i][0], h[i][1]);
			}
			System.out.println(ans);
		}
	}
}

Compiler output:
Main.java:18: error: cannot find symbol
		P1295 main = new P1295();
		^
  symbol:   class P1295
  location: class Main
Main.java:18: error: cannot find symbol
		P1295 main = new P1295();
		                 ^
  symbol:   class P1295
  location: class Main
2 errors
Language: Java

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

public class Main{
	public static void main(String[] args){
		new Main().solve();
	}

	void solve(){

		Scanner cin = new Scanner(System.in);
		while()
		{
			int h = cin.nextInt();
			int d = cin.nextInt();
			if(h==0) return;
			int[] a = new int[h];
			int[] b = new int[d];
			for(int i=0;i<h;i++){
				a[i] = cin.nextInt();
			}
			for(int i=0;i<d;i++){
				b[i] = cin.nextInt();
			}
			int ret = 0;
			boolean[] acheck = new boolean[h];
			boolean[] bcheck = new boolean[d];
			for(int i = 20;i >= 1; i--){
				boolean flag = false;
				do{
					flag = false;
					for(int j=0;j<h;j++){
						if(!acheck[j] && a[j] == i){
							acheck[j] = true;
							flag = true;
							break;
						}
					}
					for(int j=0;j<d;j++){
						if(!bcheck[j] && b[j] == i){
							bcheck[j] = true;
							flag = true;
							break;
						}
					}
					
					if(flag) ret += i;
				}while(flag);
			}
			System.out.println(ret);
			
		}
	}
}

Compiler output:
Main.java:12: error: illegal start of expression
		while()
		      ^
1 error
Language: C

main(w,d,c,i,q,r[21],s[21]){while(1){scanf("%d%d",&w,&d);if(!w&&!d){return 0;}for(;w--;){scanf("%d",&c);r[c]++;}for(;d--;){scanf("%d",&c);s[c]++;}for(;i<21;i++){ret+=(r[i]>s[i]?r[i]:s[i])*i;}printf("%d\n",q);}}

Compiler output:
main.c:1:17: error: expected ')' before '[' token
    1 | main(w,d,c,i,q,r[21],s[21]){while(1){scanf("%d%d",&w,&d);if(!w&&!d){return 0;}for(;w--;){scanf("%d",&c);r[c]++;}for(;d--;){scanf("%d",&c);s[c]++;}for(;i<21;i++){ret+=(r[i]>s[i]?r[i]:s[i])*i;}printf("%d\n",q);}}
      |                 ^
      |                 )
Language: C++

5 5
1 2 3 4 5
1 2 3 4 5
5 5
2 5 4 1 3
4 1 5 3 2
5 5
1 2 3 4 5
3 3 3 4 5
3 3
7 7 7
7 7 7
3 3
4 4 4
4 3 4
4 3
4 2 2 4
4 2 1
4 4
2 8 8 8
2 3 8 3
10 10
9 9 9 9 9 9 9 9 9 9
9 9 9 9 9 9 9 9 9 9
10 9
20 1 20 20 20 20 20 18 20 20
20 20 20 20 7 20 20 20 20
0 0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 5 5
      | ^
Language: C++

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int w = sc.nextInt();
			int d = sc.nextInt();
			if (w == 0 && d == 0)
				break;
			int[] h1 = new int[w];
			int[] h2 = new int[d];
			int[] count1 = new int[21];
			int ans = 0;
			for (int i = 0; i < h1.length; ++i) {
				h1[i] = sc.nextInt();
				++count1[h1[i]];
				ans += h1[i];
			}
			for (int i = 0; i < h2.length; ++i) {
				h2[i] = sc.nextInt();
				ans += h2[i];
				if (count1[h2[i]] > 0) {
					ans -= h2[i];
					--count1[h2[i]];
				}
			}
			System.out.println(ans);
		}
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main {
      | ^~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<iterator>

using namespace std;

int main(){
  int i, n, m, x, sum;
  vector<int> data;
  vector<int>::iterator j;

  while(1){
    cin >> n >> m;
    if(n == 0 && m == 0) break;

    sum = 0;
    for(i=0; i<n; ++i){
      cin >> x;
      data.push_back(x);
    }

    for(i=0; i<m; ++i){
      cin >> x;
      sum += x;
      j = find(data.begin(), data.end(), x);
      if(j != data.end()) data.erase(j);
    }

    for(i=0; i<data.size(); ++i) sum += data[i];
    cout << sum << endl;
    data.clear();
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:15: error: no matching function for call to 'find(std::vector<int>::iterator, std::vector<int>::iterator, int&)'
   25 |       j = find(data.begin(), data.end(), x);
      |           ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:25:15: note:   '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   25 |       j = find(data.begin(), data.end(), x);
      |           ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

using namespace std;

int main (int argc, char const* argv[])
{
	int w,d;
	cin >> w >> d;
	while(w||d)
	{
		int s = 0;
		auto count = vector<int>(21,0);
		for (unsigned int i = 0; i < w; i += 1)
		{
			int n;
			cin >> n;
			s += n;
			if(n > max)
			count[n]++;
		}
		for (unsigned int i = 0; i < d; i += 1)
		{
			int n;
			cin >> n;
			if(count[n] <= 0)
			{
				s += n;
			}
			count[n]--;
		}
		cout << s << endl;
		cin >> w >> d;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:20:30: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator>'
   20 |                         if(n > max)
      |                            ~~^~~~~
Language: Java

import java.util.*;

public class Asia2009B_Ito{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		while(true){
			int n = sc.nextInt();
			if(n == 0) break;

			String a[] = new String[n], b[] = new String[n];
			for(int i=0;i<n;i++){
				a[i] = sc.next();
				b[i] = sc.next();
			}
			String from=sc.next(), to=sc.next();

			HashMap<String,Integer> open = new HashMap<String,Integer>();
			HashMap<String,Integer> next = new HashMap<String,Integer>();
			HashMap<String,Integer> end = new HashMap<String,Integer>();

			open.put(from,0);
			while(!open.isEmpty()){
				for(String s : open.keySet()){
					int cost = open.get(s);
					for(int i=0;i<n;i++){
						String ns = s.replaceAll(a[i],b[i]);
						if(s.equals(ns)) continue;
						if(ns.length() >= 6){
							if(end.containsKey(ns)) continue;
							end.put(ns,cost+1);
							continue;
						}
						if(next.containsKey(ns)) continue;
						next.put(ns,cost+1);
					}
				}
				open = next;
				next = new HashMap<String,Integer>();
			}

			int min = Integer.MAX_VALUE;
			open.put(to,0);
			while(!open.isEmpty()){
				for(String s : open.keySet()){
					int cost = open.get(s);

					if(end.containsKey(s)){
						min = Math.min(min,cost+end.get(s));
						continue;
					}
					for(int i=0;i<n;i++){
						String ns = s.replaceAll(b[i],a[i]);
						if(s.equals(ns)) continue;
						if(next.containsKey(ns)) continue;
						next.put(ns,cost+1);
					}
				}
				open = next;
				next = new HashMap<String,Integer>();
			}

			System.out.println(min==Integer.MAX_VALUE ? -1 : min);
		}

	}
}

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

#include<bits/stdc++.h>
using namespace std;

string sed(string s, string a, string b){

    string res;
    int S = (int)s.size();
    int A = (int)a.size();
    int B = (int)b.size();

    for(int i = 0; i < S; i++){
        if(i + A > S){
            res += s[i];
            continue;
        }
        bool flag = true;
        for(int j = i; j < i + A; j++){
            if(s[j] != a[j - i]){
                flag = false;
                break;
            }
        }
        if(flag){
            res += b;
            i += A - 1;
        }else{
            res += s[i];
        }
    }
    return res;
}

int main(){

    while(1){

        int n; cin >> n;
        if(!n) break;
        vector<string> a(n);
        vector<string> b(n);
        for(int i = 0; i < n; i++){
            cin >> a[i] >> b[i];
        }
        string s, t; cin >> s >> t;

        set<string> Set;
        Set.insert(s);
        queue<pair<string, int> > q;
        q.push({s, 0});
        
        bool flag = false;

        while(!q.empty()){

            string tmp = q.front().first;
            int cost = q.front().second;
            //cout << tmp << endl;
            q.pop();

            if(tmp == t){
                cout << cost << endl;
                flag = true;
                break;
            }else if(tmp.size() >= t.size()) continue;

            for(int i = 0; i < n; i++){
                string next = sed(tmp, a[i], b[i]);
               // cout << i << " " << next << endl;
                if(Set.find(next) == Set.end() && next.size() <= t.size()){
                    Srt.insert(next);
                    q.push({next, cost + 1});
                }
            }
        }
        
        if(!flag){
            cout << -1 << endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:21: error: 'Srt' was not declared in this scope; did you mean 'Set'?
   70 |                     Srt.insert(next);
      |                     ^~~
      |                     Set
Language: C++

#include<iostream>
#include<set>
#include<algorithm>
#include<queue>
#include<string>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
string edge[10][2];

string substitute(string tar,string &from,string &to){
  string ret;
  for(int i=0;i<tar.size();i++){
    bool flag=true;
    rep(j,from.size() && i+j <tar.size()
      if ( from[j]!=tar[i+j]){flag=false;break;}
    }
    if ( flag == false)ret+=tar[i];
    else {
      ret+=to;
      i+=from.size()-1;
    }
  }
  return ret;
}

int bfs(string &start,string &goal,int n){
  queue<pair<string,int> > Q;
  set<string>S;
  Q.push(make_pair(start,0));
  S.insert(start);
  while(!Q.empty()){
    pair<string,int> now =Q.front();
    Q.pop();
    if ( now.first == goal)return now.second;
    rep(i,n){
      string next = substitute(now.first,edge[i][0],edge[i][1]);
      if ( S.find(next) == S.end() && next.size()<= goal.size()){
	S.insert(next);
	Q.push(make_pair(next,now.second+1));
      }
    }
    
  }
  return -1;
}


main(){

  int n;
  while(cin>>n && n){
    string start,goal;
    rep(i,n)cin>>edge[i][0]>>edge[i][1];
    cin>>start>>goal;
    cout << bfs(start,goal,n) <<endl;
  }
}

Compiler output:
a.cc:58:2: error: unterminated argument list invoking macro "rep"
   58 | }
      |  ^
a.cc: In function 'std::string substitute(std::string, std::string&, std::string&)':
a.cc:15:5: error: 'rep' was not declared in this scope
   15 |     rep(j,from.size() && i+j <tar.size()
      |     ^~~
a.cc:15:8: error: expected '}' at end of input
   15 |     rep(j,from.size() && i+j <tar.size()
      |        ^
a.cc:13:32: note: to match this '{'
   13 |   for(int i=0;i<tar.size();i++){
      |                                ^
a.cc:15:8: error: expected '}' at end of input
   15 |     rep(j,from.size() && i+j <tar.size()
      |        ^
a.cc:11:54: note: to match this '{'
   11 | string substitute(string tar,string &from,string &to){
      |                                                      ^
a.cc:15:8: warning: no return statement in function returning non-void [-Wreturn-type]
   15 |     rep(j,from.size() && i+j <tar.size()
      |        ^