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

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

struct before_main{before_main(){cin.tie(0); ios::sync_with_stdio(false);}} before_main;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

typedef shared_ptr<struct tree> tree_ptr;
struct tree : public enable_shared_from_this<tree> {
  string tag;
  vector<tree_ptr> next;
  tree_ptr find(string const& query) {
    if(tag == query) { return shared_from_this(); }
    for(auto && e: next) {
      auto p = e->find(query);
      if(p) { return p; }
    }
    return nullptr;
  }
};

int main() {


  
  return 0;
}

Compiler output:
a.cc:37:9: error: 'shared_ptr' does not name a type
   37 | typedef shared_ptr<struct tree> tree_ptr;
      |         ^~~~~~~~~~
a.cc:38:45: error: expected template-name before '<' token
   38 | struct tree : public enable_shared_from_this<tree> {
      |                                             ^
a.cc:38:45: error: expected '{' before '<' token
a.cc:38:45: error: expected unqualified-id before '<' token
Language: C++

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<string,string> P;

int n,d;
int ans=0;
set<string> mp[201][18];
int cnt[201][201];
vector<P> vec;
string str[201];

void dfs(int v,string s,int nd,int uk=0){
	if(nd==0){
		mp[v][s.size()].insert(s);
		for(int i=0;i+1<s.size();i++){
			swap(s[i],s[i+1]);
			dfs(v,s,nd+1);
			swap(s[i],s[i+1]);
		}
		for(int i=0;i<s.size();i++){
			dfs(v,s.substr(0,i)+s.substr(i+1),nd+1);
			for(int j=0;j<26;j++){
				string gu="";
				gu+=('a'+j);
				dfs(v,s.substr(0,i)+gu+s.substr(i+1),nd+1,1);
				dfs(v,s.substr(0,i)+gu+s.substr(i),nd+1,1);
			}
		}
		for(int i=0;i<26;i++){
			string gu="";
			gu+=('a'+i);
			dfs(v,s+gu,nd+1);
		}
	}else if(nd==1){
		mp[v][s.size()].insert(s);
	}
}

void dfs2(int v,string s,int nd){
	if(nd==0){
		for(int i=0;i<n;i++){
			if(mp[i][s.size()].find(s)!=mp[i].end()){
				cnt[v][i]++;
				cnt[i][v]++;
			}
		}
		for(int i=0;i+1<s.size();i++){
			swap(s[i],s[i+1]);
			dfs2(v,s,nd+1);
			swap(s[i],s[i+1]);
		}
		for(int i=0;i<s.size();i++){
			dfs2(v,s.substr(0,i)+s.substr(i+1),nd+1);
			for(int j=0;j<26;j++){
				string gu="";
				gu+=('a'+j);
				dfs2(v,s.substr(0,i)+gu+s.substr(i+1),nd+1);
				dfs2(v,s.substr(0,i)+gu+s.substr(i),nd+1);
			}
		}
		for(int i=0;i<26;i++){
			string gu="";
			gu+=('a'+i);
			dfs2(v,s+gu,nd+1);
		}
	}else if(nd==1){
		if(d==2){
			for(int i=0;i<n;i++){
				if(mp[i][s.size()].find(s)!=mp[i].end()){
					cnt[v][i]++;
					cnt[i][v]++;
				}
			}
		}
	}
}

void solve(){
	vec.clear();
	for(int i=0;i<n;i++){
		for(int j=0;j<18;j++){
			mp[i][j].clear();
		}
	}
	scanf("%d",&d);
	ans=0;
	memset(cnt,0,sizeof(cnt));
	for(int i=0;i<n;i++){
		cin >> str[i];
		dfs(i,str[i],0);
	}
	for(int i=0;i<n;i++){
		dfs2(i,str[i],0);
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<i;j++){
			if(cnt[i][j]>0){
				ans++;
				vec.push_back(P(min(str[i],str[j]),max(str[i],str[j])));
			}
		}
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<vec.size();i++){
		cout << vec[i].first << "," << vec[i].second << endl;
	}
	printf("%d\n",ans);
}

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		solve();
	}
	return 0;
}


Compiler output:
a.cc: In function 'void dfs2(int, std::string, int)':
a.cc:44:59: error: request for member 'end' in 'mp[i]', which is of non-class type 'std::set<std::__cxx11::basic_string<char> > [18]'
   44 |                         if(mp[i][s.size()].find(s)!=mp[i].end()){
      |                                                           ^~~
a.cc:71:67: error: request for member 'end' in 'mp[i]', which is of non-class type 'std::set<std::__cxx11::basic_string<char> > [18]'
   71 |                                 if(mp[i][s.size()].find(s)!=mp[i].end()){
      |                                                                   ^~~
Language: C++

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

struct Point{
  int x,y;
  Point operator + (const Point p)const{
    return (Point){x+p.x,y+p.y};
  }
  Point operator - (const Point p)const{
    return (Point){x-p.x,y-p.y};
  }
};

struct Segment{
  Point p,v;
};

int dot(Point a,Point b){
  return a.x*b.x+a.y*b.y;
}

int cross(Point a,Point b){
  return a.x*b.y-b.x*a.y;
}

bool isParallel(Point a,Point b){
  return (0==cross(a,b));
}

int abs(int a){return max(a,-a);}
bool eq(Point a,Point b){
  return (a.x==b.x&&a.y==b.y);
}
bool eq(Segment a,Segment b){
  if(eq(a.v,b.v)&&eq(a.p,b.p))return true;
  if(eq(a.p,b.p+b.v)&&eq(a.p+a.v,b.p))return true;
  return false;
}

bool onSegment(Segment s,Point p){
  Point q=p-s.p;
  if(eq(s.p,p)||eq(s.p+s.v,p))return false;
  if(!isParallel(s.v,q))return false;
  if(dot(s.v,q)<=0)return false;
  Point Q=p-(s.p+s.v);
  if(dot(s.p-s.p-s.v,Q)<=0)return false;
  return true;  
}



int n;
int c;
map<string,int> mp;
vector<Segment> G[10];
int g[10][10];

bool calc(int a,int b){
  for(int i=0;i<(int)G[a].size();i++){
    Segment si=G[a][i];
    for(int j=0;j<(int)G[b].size();j++){
      Segment sj=G[b][j];
      if(!isParallel(si.v,sj.v))continue;
      if(eq(si,sj))return true;
      if(onSegment(si,sj.p))return true;
      if(onSegment(si,sj.p+sj.v))return true;
      if(onSegment(sj,si.p))return true;
      if(onSegment(sj,si.p+si.v))return true;
    }
  }
  return false;
}

void init(){
  c=0;
  mp.clear();  
  for(int i=0;i<10;i++)
    for(int j=0;j<10;j++)
      g[i][j]=0;
  for(int i=0;i<10;i++)G[i].clear();
}

int main(){
  int id;
  int px,py;
  string str;
  while(1){
    cin>>n;
    if(n==0)break;
    init();
    for(int i=0;i<n;i++){
      cin>>str;
      if(mp.count(str)==0)mp[str]=id=c++;
      else id=mp[str];
      vector<Point> t;
      while(1){
        scanf("%d",&px);
        if(px==-1)break;
        scanf("%d",&py);
        t.push_back((Point){px,py});
      }
      int size=t.size();
      for(int j=0;j<size;j++)
        G[id].push_back((Segment){t[j],t[(j+1)%size]-t[j]});
    }
    
    for(int i=0;i+1<c;i++)
      for(int j=i+1;j<c;j++)
        if(calc(i,j))g[i][j]=g[j][i]=1;
    
    vector<int> e;
    for(int i=0;i<(1<<c);i++){
      bool flg=true;
      for(int j=0;j+1<c;j++){
        if(i>>j&1){
          for(int k=j+1;k<c;k++){
            if(i>>k&1){
            if(g[j][k]){
              flg=false;
            }
          }
        }
      }
      if(flg)e.push_back(i);
    }
    
    int dp[(1<<c)];
    fill(dp,dp+(1<<c),1e8);
    dp[0]=0;
    for(int S=0;S<(1<<c);S++){
      if(dp[S]==1e8)continue;
      for(int i=0;i<(int)e.size();i++){
        int T=e[i];
        dp[S|T]=min(dp[S|T],dp[S]+1);
      }
    }
    cout<<dp[(1<<c)-1]<<endl;
    
  }
  return 0;
}

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

6
Blizid
0 0
60 0
60 60
0 60
0 50
50 50
50 10
0 10
-1
Blizid
0 10
10 10
10 50
0 50
-1
Windom
10 10
50 10
40 20
20 20
20 40
10 50
-1
Accent
50 10
50 50
35 50
35 25
-1
Pilot
35 25
35 50
10 50
-1
Blizid
20 20
40 20
20 40
-1
4
A1234567890123456789
0 0
0 100
100 100
100 0
-1
B1234567890123456789
100 100
100 200
200 200
200 100
-1
C1234567890123456789
0 100
100 100
100 200
0 200
-1
D123456789012345678
100 0
100 100
200 100
200 0
-1
0

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 6
      | ^
Language: Java

import java.io.*;
import java.util.*;
class Eratos{
    public static void main(String[] args) throws IOException{
        ArrayList<Integer> prime_list = new ArrayList<Integer>();
        for(int j = 2;j <= 10000; j++){
            for(int n = 2; n <= j;n++){
                if(j == n){
                    prime_list.add(j);
                }
                else if(j % n == 0){
                    break;
                }
            }
        }
        int x = 0;
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        for(int i = 0;;i++){
            //Scanner cin;
            //cin = new Scanner(System.in);
            //System.out.println(cin.next());
            String buf = br.readLine();
            x = Integer.parseInt(buf);
            if(x == 0){
                break;
            }
            int ans = 0;
            int initialize = 0;
            int count = 0;
            for(int j = 0;j <= 10000;j++){
                ans += prime_list.get(j);
                if(x < prime_list.get(j)){
                    System.out.println(count);
                    break;
                }
                else if(x == ans){
                    count++;
                }
                else if(x <= ans){
                    j = initialize;
                    initialize++;
                    ans = 0;
                }
            }
        }
        return 0;
    }

}

Compiler output:
Main.java:46: error: incompatible types: unexpected return value
        return 0;
               ^
1 error
Language: Java

package Vol012;
import java.util.Arrays;
import java.util.Scanner;

public class AOJ12_57 
{
	public static void main(String arg[])
	{
		Scanner sc=new Scanner(System.in);
		boolean a[] =new boolean[10001];
		Arrays.fill(a, true);
		a[0]=a[1]=false;
		for(int i=2; i*i<=10000; i++)
		{
			if(!a[i])
				continue;
			for(int j=i*2; j<=10000; j+=i)
				a[j]=false;
		}
		while(sc.hasNext())
		{
			int n=sc.nextInt();
			if(n==0)
				return;
			int sum=0;
			int ans=0;
			for(int i=2; i<=n; i++)
			{
				sum =0;
				if(a[i])
					for(int j=i; j<=n; j++)
					{
						if(a[j])
						{
							sum+=j;
							if(n==sum)
								ans++;
						}
						if(sum>=n)
							break;
					}
			}
			System.out.println(ans);
		}
	}
}

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

#include<stdio.h>

int main(){
  int num[1000],i=0,j,k,ans=0,culc;
  int a[1000];
  for(i=0;i<1000;i++){
    a[i]=1;
  }
  for(i=2;i<1000;i++){//?´???°?????????????????????0?????\??????                             
    for(j=2;(i*j)<1000;j++){//?????°???0?????\??????                                   
      a[i*j]=0;
    }
  }
  a[0]=0;
  a[1]=0;
  i=0;
  while(1){
    scanf("%d",&num[i]);
    //printf("%d?????????%d",i,num[i]);                                            
    if(num[i]==0)break;
    i++;
    }
  for(k=0;num[k]!=0;k++){
    //printf("%d?????????%d\n",k,num[k]);                                          
    for(i=1;i<=num[k];i++){//?¶?????????????????????????                                 
      if(a[i]==1){
        culc=0;
        for(j=0;culc<num[k];j++){//?´???°???1??????????¶????                            
          //printf("????¨?%d,??????????????°%d\n",culc,num[k]);                        
          if(culc>num[k])break;
          if(a[i+j]==1){
            culc+=i+j;
            //printf("%d?????????%d????????£???\n",i+j,culc);                          
          }
          }
          if(culc==num[k]){
            ans+=1;
            break;
          }
        }
      }
    }
    printf("%d\n",ans);
    ans=0;
  }
}
}

Compiler output:
main.c:46:1: error: expected identifier or '(' before '}' token
   46 | }
      | ^
main.c:47:1: error: expected identifier or '(' before '}' token
   47 | }
      | ^
Language: C

#include<stdio.h>
int main(){
  int num[1000],i=0,j,k,ans=0,culc;
  int a[1000];
  for(i=0;i<1000;i++){
    a[i]=1;
  }
  for(i=2;i<1000;i++){
    for(j=2;(i*j)<1000;j++){
      a[i*j]=0;
    }
  }
  a[0]=0;
  a[1]=0;
  i=0;
  while(1){
    scanf("%d",&num[i]);
    if(num[i]==0)break;
    i++;
    }
  for(k=0;num[k]!=0;k++){
    for(i=1;i<=num[k];i++){
      if(a[i]==1){
        culc=0;
        for(j=0;culc<num[k];j++){
          if(culc>num[k])break;
          if(a[i+j]==1){
            culc+=i+j;
          }
          if(culc==num[k]){
            ans+=1;
            break;
          }
        }
      }
    }
    printf("%d\n",ans);
    ans=0;
  }
}
}

Compiler output:
main.c:41:1: error: expected identifier or '(' before '}' token
   41 | }
      | ^
Language: C

#include<stdio.h>

int main(){
  int num[1000],i=0,j,k,ans=0,culc;
  int a[1000];
  for(i=0;i<1000;i++){
    a[i]=1;
  }
  for(i=2;i<1000;i++){//?´???°?????????????????????0?????\??????                             
    for(j=2;(i*j)<1000;j++){//?????°???0?????\??????                                   
      a[i*j]=0;
    }
  }
  a[0]=0;
  a[1]=0;
  i=0;
  while(1){
    scanf("%d",&num[i]);
    //printf("%d?????????%d",i,num[i]);                                            
    if(num[i]==0)break;
    i++;
    }
  for(k=0;num[k]!=0;k++){
    //printf("%d?????????%d\n",k,num[k]);                                          
    for(i=1;i<=num[k];i++){//?¶?????????????????????????                                 
      if(a[i]==1){
        culc=0;
        for(j=0;culc<num[k];j++){//?´???°???1??????????¶????                            
          //printf("????¨?%d,??????????????°%d\n",culc,num[k]);                        
          if(culc>num[k])break;
          if(a[i+j]==1){
            culc+=i+j; 
         if(culc==num[k]){
            ans+=1;
            break;
          }
        }
      }
    }
    printf("%d\n",ans);
    ans=0;
  }
}

Compiler output:
main.c: In function 'main':
main.c:43:1: error: expected declaration or statement at end of input
   43 | }
      | ^
Language: C

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

int a[10009];
vector<int> p;
map<int,int> m;

void sieve()
{
    int i,j,t1,t2;
    for(i=0;i<10003;i++)
        a[i]=1;
    a[0]=a[1]=0;
    for(i=2;i<=10000;i++)
    {
        if(a[i]==1)
        {
            p.push_back(i);
            for(j=2*i;j<=10000;j+=i)
            {
                a[j]=0;
            }
        }
    }
    for(i=0;i<p.size();i++)
    {
        t1=0;
        for(j=i;j<p.size();j++)
        {
            t1+=p[j];
            m[t1]++;
        }
    }
    return;
}


int main()
{
    int i,j,t1,t2,n,ans;
    sieve();
    while(1)
    {
        scanf("%d",&n);
        if(n==0)
            break;
        ans=m[n];
        printf("%d\n",ans);
    }
    return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

	#include<iostream>
using namespace std;
int a[10000]={0};	
int main(){
	a[0]=a[1]=1;
	for(int i=2;i<10000;i++){
		if(a[i]==0){
		for(int j=i*2;j<10000;j+=i)
				a[j]=1;
		}
	}
	int n=1,c=0;
	while(n!=0){
		c=0;
	cin>>n;
	if(a[n]==0)
	c++;
	for(int i=n-1;i>0;i--){
		int s=0;
		int j=i;
		if(a[j]==0){
			while(j>=0 && s<=n){
				if(a[j]==0)
					s+=j;
				j--;
				if(s==n){
					c++;
					break;
				}
			}
		}
	}
	cout<<c<<endl;
}
}
	

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

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

int prime[10004];
int A[10004], X[10004];

int main() {
    
    int N;
    
    for(int i=2; i<=10000; i++)
        for(int j=i*i; j<=10000; j+= i)
            prime[j] = 1;
    
    int k = 0;
    
    for(int i=2; i<=10000; i++)
        if(!prime[i])
            A[++k] = i;
    
    for(int i=1; i<=k; i++)
    {
        int sum = 0;
        
        for(int j=i; j<=k && sum+A[j]<=10000; j++)
        {
            sum += A[j];
            X[sum]++;
        }
    }
    
    while(1)
    {
        scanf("%d", &N);
        
        if(!N)
            break;
        
        printf("%d\n", X[N]);
    }
    
	return 0;
}

Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
//#include "windows.h"

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define nd second
#define st first
#define ll long long
#define pii pair <int, int>
#define tri pair <pii, int>
#define irt pair <int, pii>
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, n) for (int (i) = (a); (i) < (int)(n); i++)
#define FORN(i, a, n) for (int (i) = (a); (i) > (int)(n); i--)
#define pi 3.1415926535897932384626433832795028841971
//#define LOCAL

using namespace std; 

int n; 
int ans; 
int a[10005]; 

vector <int> v; 

void cp()
{
	v.pb(0); 
	FOR(i, 2, 10000)
		if (!a[i])
		{
			FOR(j, 2, 10000 / i + 1)
				a[i * j] = true; 
			v.pb(i); 
		}
	
	int lst = 0; 
	FOR(i, 1, v.size())
	{
		v[i] += lst; 
		lst = v[i]; 
	}
}

int main()
{
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	cp(); 
	
	while (cin >> n && n)
	{
		REP(i, v.size())
			FOR(j, i + 1, v.size())
				if (v[j] - v[i] == n) ans++; 
		cout << ans << endl; 
		
		ans = 0; 
	}
	
	return 0;
}



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

#include <iostream>
#include <string.h>
using namespace std;

int n;
int count;
int number[10000];
int isprime(int a)
{
    for(int i=2;i*i<=a;i++)
    {
        if(a%i==0)return 0;
    }
    return 1;
}
void prime(int k)
{
    int j=0;
    for(int i=2;i<=k;i++)
    {
        if(isprime(i))
        number[j++]=i;

    }
    count=j;
}
int main()
{
    while(cin>>n&&n)
    {

            int sum;
            int num=0;
        memset(number,0,sizeof(number));
        prime(n);
        for(int i=0;i<count;i++)
        {
             sum=0;

            for(int j=i;j<count;j++)
            {
                sum+=number[j];
                if(sum==n)
                num++;
                else
                if(sum>n)break;
            }
        }
        cout<<num<<endl;
    }
    return 0;
}

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

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

static const int maxn = 10001;

int isp[maxn];
vector<int> p;

void eratosthenes() {
	//init
	fill(isp, isp + maxn, 1);


	int i, j;
	int maxi = sqrt(maxn);
	for (i = 2; i <= maxi; i++) {
		j = i + i;
		while (j < maxn) {
			isp[j] = 0;
			j += i;
		}
	}

	for (i = 2; i < maxn; i++) {
		if (isp[i])p.push_back(i);
	}

}

int main() {
	int i, j, k;

	eratosthenes();
	/*
	for (i = p.size() - 1; i >= 0; i--) {
		cout << p[i] << endl;
	}
	*/

	while (1) {
		int n;

		cin >> n;
		if (n == 0)break;

		int a = 0, b = 0; // [a, b]
		int sum = 2;
		int ans = 0;
		while (b <= n) {
			if (sum == n) {
				ans++;
				b++;
				sum += p[b];
			} else if (sum < n) {
				b++;
				sum += p[b];
			} else if (sum > n) {
				sum -= p[a];
				a++;
			}
		}

		cout << ans << endl;
		
	}

	

	return 0;
}

Compiler output:
a.cc: In function 'void eratosthenes()':
a.cc:17:20: error: 'sqrt' was not declared in this scope
   17 |         int maxi = sqrt(maxn);
      |                    ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();t!=s.end();t++)c+=count(t,s.end(),*t+j);}}

Compiler output:
a.cc:4:66: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                  ^~~~
a.cc: In function 'int main()':
a.cc:4:221: error: expected primary-expression before 't'
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                                                                                                                                                                             ^
a.cc:4:233: error: 't' was not declared in this scope; did you mean 'tm'?
    4 | using namespace std;int p[10001],M=10001,i,j,c;vector<int>s(1,0);main(){for(i=1;++i<M;)for(j=i+i;j<M;j+=i)p[j]=1;for(i=1;++i<M;)if(!p[i])s.push_back(i+s.back());for(;cin>>j,j;cout<<c<<endl){for(c=0,vector<int>::iterator t=s.begin();t!=s.end();t++)c+=count(t,s.end(),*t+j);}}
      |                                                                                                                                                                                                                                         ^
      |                                                                                                                                                                                                                                         tm
Language: C

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <deque>
#include <queue>
#include <vector>

using namespace std;

int m, c, n;
int cost[20];
int dc[20], srn[20], sqr[20][100];
queue<int> req;
deque<int> sto[20];

void init()
{
	for (int i = 1; i <= 20; i++)
		sto[i].clear();
	while (req.size() > 0)
		req.pop();
}

int main()
{
	while (scanf("%d%d%d", &m, &c, &n) != EOF)
	{
		init();
		if (m == c && c == n && n == 0)
			break;
		for (int i = 1; i <= n; i++)
		{
			scanf("%d", &srn[i]);
			for (int j = 0; j < srn[i]; j++)
				scanf("%d", &sqr[i][j]);
		}
		int tnn[20];
		memset(tnn, 0, sizeof(tnn));
		int ttt = 0;
		for (int i = 1; i <= n; i++)
			ttt += srn[i];
		//printf("tttt = %d\n", ttt);
		while (ttt--)
		{
			for (int i = 1; i <= n; i++)
			{
				if (tnn[i] < srn[i])
					req.push(sqr[i][tnn[i]]), tnn[i]++;
			}
		}
		/*
		while (req.size() > 0)
			printf("%d\n", req.front()), req.pop();
			*/
		memset(dc, 0, sizeof(dc));
		long long ans = 0;
		while (req.size() > 0)
		{
			int ttrep = req.front();
			req.pop();
			int flag = 0;
			for (int i = 1; i <= m; i++)
				for (int j = 0; j < sto[i].size(); j++)
					if (ttrep == sto[i][j])
					{
						ans += i;
						flag = 1;
						sto[i].erase(sto[i].begin() + j , sto[i].begin() + j + 1);
						break;
					}
			if (flag == 0)
				ans += (m + 1);

			//拿回storeroom
			//not full
			if (sto[1].size() < c)
			{
				sto[1].push_back(ttrep);
				ans += 1;
				//printf("ans = %d\n", ans);
			}
			else
			{
				//printf("ans = %d\n", ans);
				int trrr, trrrj;
				flag = 0;
				for (int i = 2; i <= m; i++)
					if (sto[i].size() < c)
					{
						trrr = i, trrrj = sto[i].size();
						//printf("trrrr = %d\n", trrr);
						sto[i].push_back(ttrep);
						flag = 1;
						ans += i;
						break;
					}
				//printf("trrr  =%d , trrrj =%d\n", trrr, trrrj);
				if (flag == 0)
				{
					trrr = m + 1;
					ans += (m + 1);
				}
				int loUn = sto[1].front();
				sto[1].pop_front();
				//printf("sto.size() = %d\n", sto[1].size());
				ans += 1;
				flag = 0;
				for (int i = 2; i <= m; i++)
					if (sto[i].size() < c)
					{
						sto[i].push_back(loUn);
						flag = 1;
						ans += i;
						break;
					}
				if (flag == 0)
					ans += (m + 1);
				if (trrr == m  + 1)
				{
					ans += (trrr + 1);
					sto[1].push_back(ttrep);
				}
				else
				{
					ans += (trrr + 1);
					sto[1].push_back(ttrep);
					sto[trrr].erase(sto[trrr].begin() + trrrj, sto[trrr].begin() + trrrj + 1);
				}
			}
			//printf("lllans  = %d\n", ans);
		}
		//printf("ans = %d\n" , ans);
		printf("%d\n", ans);
	}
	return 0;
}

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

#include <cstdlib>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;
 
int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	for(int m, c, n; cin >> m >> c >> n && m;) {
		vector<unordered_map<int, int>> desks(m);
 
		queue<int> que;
		vector<int> index(n, 0);
		vector<vector<int>> books(n);
 
		for(int i = 0; i < n; ++i) {
			que.push(i);
 
			int k;
			cin >> k;

			books[i].reserve(k);
 
			for(int j = 0; j < k; ++j) {
				int b;
				cin >> b;
				books[i].emplace_back(b);
			}
		}
 
		int ans = 0;

		for(int t = 0; !que.empty(); ++t) {
			const int student = que.front();
			que.pop();
 
			const int id = books[student][index[student]];
			if(++index[student] < books[student].size()) {
				que.push(student);
			}

			int pos = m;
			for(int i = 0; i < m; ++i) {
				if(desks[i].count(id)) {
					desks[i].erase(id);
					pos = i;
					break;
				}
			}
 
			ans += pos + 1;
 
			int tmp = m;
			for(int i = 0; i < m; ++i) {
				if(desks[i].size() < c) {
					desks[i].insert({id, t});
					tmp = i;
					break;
				}
			}
 
			ans += tmp + 1;
 
			if(tmp != 0) {
				int r_id = -1;
				int r_time = INT_MAX;
 
				for(const auto &e : desks.front()) {
					if(r_time > e.second) {
						r_id = e.first;
						r_time = e.second;
					}
				}
 
				ans += 1;
				desks.front().erase(r_id);
 
				int to = m;
				for(int i = 1; i < m; ++i) {
					if(desks[i].size() < c) {
						desks[i].insert({r_id, r_time});
						to = i;
						break;
					}
				}
 
				ans += to + 1;
 
				if(tmp < m) desks[tmp].erase(id);
				ans += tmp + 1;
 
				desks.front().insert({id, t});
				ans += 1;
			}
		}
 
 
		cout << ans << endl;
	}
 
	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:46: error: 'INT_MAX' was not declared in this scope
   69 |                                 int r_time = INT_MAX;
      |                                              ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <unordered_map>
  +++ |+#include <climits>
    5 | #include <vector>
Language: C

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
#define INF 1000000000
const int mov[24][6]={
  {0,1,2,3,4,5},{0,2,4,1,3,5},{0,4,3,2,1,5},{0,3,1,4,2,5},
  {3,1,0,5,4,2},{3,0,4,1,5,2},{3,4,5,0,1,2},{3,5,1,4,0,2},
  {5,1,3,2,4,0},{5,3,4,1,2,0},{5,4,2,3,1,0},{5,2,1,4,3,0},
  {2,1,5,0,4,3},{2,5,4,1,0,3},{2,4,0,5,1,3},{2,0,1,4,5,3},
  {4,0,2,3,5,1},{4,2,5,0,3,1},{4,5,3,2,0,1},{4,3,0,5,2,1},
  {1,0,3,2,5,4},{1,3,5,0,2,4},{1,5,2,3,0,4},{1,2,0,5,3,4}
};
int n,res;
struct CUBE{
  int num[6];
}cube[4],buf[4];
map<string,int> idx;
int top;
void dfs(int dep){
  int i,j;
  if(dep==n){
    int tmp=0;
    for(i=0;i<6;i++){
      int cnt[24]={0};
      for(j=0;j<n;j++) cnt[buf[j].num[i]]++;
      int mx=0;
      for(j=0;j<top;j++) mx=max(mx,cnt[j]);
      tmp+=(n-mx);
    }
    res=min(res,tmp);
    return;
  }
  for(i=0;i<24;i++){
    for(j=0;j<6;j++)
      buf[dep].num[j]=cube[dep].num[mov[i][j]];
    dfs(dep+1);
  }
}
int main(){
  int i,j;
  while(scanf("%d",&n),n){
    idx.clear(); top=0;
    for(i=0;i<n;i++)
      for(j=0;j<6;j++){
        string str;
        cin>>str;
        if(idx.find(str)==idx.end())
          idx[str]=top++;
        cube[i].num[j]=idx[str];
      }
    if(n==1){
      printf("0\n");
      continue;
    }
    res=INF;
    buf[0]=cube[0];
    dfs(1);
    printf("%d\n",res);
  }
  return 0;
}

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

3
scarlet green blue yellow magenta cyan
blue pink green magenta cyan lemon
purple red blue yellow cyan green
2
red green blue yellow magenta cyan
cyan green blue yellow magenta red
2
red green gray gray magenta cyan
cyan green gray gray magenta red
2
red green blue yellow magenta cyan
magenta red blue yellow cyan green
3
red green blue yellow magenta cyan
cyan green blue yellow magenta red
magenta red blue yellow cyan green
3
blue green green green green blue
green blue blue green green green
green green green green green sea-green
3
red yellow red yellow red yellow
red red yellow yellow red yellow
red red red red red red
4
violet violet salmon salmon salmon salmon
violet salmon salmon salmon salmon violet
violet violet salmon salmon violet violet
violet violet violet violet salmon salmon
1
red green blue yellow magenta cyan
4
magenta pink red scarlet vermilion wine-red
aquamarine blue cyan indigo sky-blue turquoise-blue
blond cream chrome-yellow lemon olive yellow
chrome-green emerald-green green olive vilidian sky-blue
0

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

#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

pair<double, double> solve(int a, int b, vector<int>& w, vector<int>& x)
{
    if(a == b)
        return make_pair(0.0, 0.0);

    int c = min_element(x.begin()+a, x.begin()+b) - x.begin();
    int left = accumulate(w.begin()+a, w.begin()+c+1, 0);
    int right = accumulate(w.begin()+c+1, w.begin()+b+1, 0);

    pair<double, double> p = solve(a, c, w, x);
    pair<double, double> q = solve(c+1, b, w, x);
    p.first  -= right / (double)(left + right);
    p.second -= right / (double)(left + right);
    q.first  += left  / (double)(left + right);
    q.second += left  / (double)(left + right);

    return make_pair(min(p.first, q.first), max(p.second, q.second));
}

int main()
{
    int d;
    cin >> d;

    while(--d >= 0){
        double r;
        int s;
        cin >> r >> s;
        vector<int> w(s);
        for(int i=0; i<s; ++i)
            cin >> w[i];

        sort(w.begin(), w.end());
        
        double ret = -1.0;
        do{
            vector<int> x(s-1);
            for(int i=0; i<s-1; ++i)
                x[i] = i;

            do{
                pair<double, double> p = solve(0, s-1, w, x);
                double len = p.second - p.first;
                if(len < r)
                    ret = max(ret, len);
            }while(next_permutation(x.begin(), x.end()));
        }while(next_permutation(w.begin(), w.end()));

        if(ret < -0.5)
            cout << -1 << endl;
        else
            printf("%.10f\n", ret);
    }

    return 0;
}

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

#include<vector>
#include<algorithm>
#include<string>
#include<cctype>
#include<cmath>
#include<cstdio>

#define all(c) (c).begin(),(c).end()
#define D(x) cout << #x " is " << x << endl
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define F first
#define S second

using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<double,int> P;

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

double EPS=1e-10;

vector<double>w;
double r;
int s,sum[10];
double memo[10];

double rec(int v,double L){
  if(v>=s)return L;
  if(memo[v]>=0)return memo[v];
  double res=0;
  double tmp1=rec(v+2,L+w[v]/(w[v]+w[v+1]));
  double tmp2=rec(v+2,L+w[v+1]/(w[v]+w[v+1]));
  if(tmp1<r+EPS)res=max(res,tmp1);
  if(tmp2<r+EPS)res=max(res,tmp2);
  return memo[10]=res;
}

int main(void){
  int T;

  cin >> T;

  while(T--){
    cin >> r >> s;
    w.resize(s);
    rep(i,s)cin >> w[i];

    double ans=-1;
    sort(all(w));
    do{
      fill(memo,memo+10,-1);
      double res=rec(0,1);
      if(res<r+EPS)ans=max(ans,res);
    }while(next_permutation(all(w)));
    if(ans<EPS)cout << -1 << endl;
    else printf("%.16f\n",ans);
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:3: error: 'cin' was not declared in this scope
   45 |   cin >> T;
      |   ^~~
a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #include<cstdio>
  +++ |+#include <iostream>
    7 | 
a.cc:59:16: error: 'cout' was not declared in this scope
   59 |     if(ans<EPS)cout << -1 << endl;
      |                ^~~~
a.cc:59:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:59:30: error: 'endl' was not declared in this scope
   59 |     if(ans<EPS)cout << -1 << endl;
      |                              ^~~~
a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    6 | #include<cstdio>
  +++ |+#include <ostream>
    7 |
Language: C++

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

template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
 
inline double calc(int x, int r, double v, double e, double f) {
	if(x >= r) return 1.0 / (v - e * (x - r));
	return 1.0 / (v - f * (r - x));
}
 
int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout.setf(ios::fixed);
	cout.precision(10);
 
	for(int n; cin >> n && n;) {
		vector<int> a(n + 1, 0);
		for(int i = 1; i <= n; ++i) {
			cin >> a[i];
		}
 
		double b;
		cin >> b;
 
		int r;
		double v, e, f;
		cin >> r >> v >> e >> f;
 
		vector<vector<double>> dp(n + 1, vector<double>(n + 1, INT_MAX));
		dp[0][0] = 0.0;
 
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j <= i; ++j) {
				chmin(dp[i][i], dp[i][j] + b);
 
				double next_cost = 0.0;
				for(int x = a[i]; x < a[i + 1]; ++x) {
					next_cost += calc(x - a[j], r, v, e, f);
				}

				chmin(dp[i + 1][j], dp[i][j] + next_cost);
			}
		}
 
		cout << *min_element(dp[n].begin(), dp[n].end()) << endl;
	}
 
	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:72: error: 'INT_MAX' was not declared in this scope
   33 |                 vector<vector<double>> dp(n + 1, vector<double>(n + 1, INT_MAX));
      |                                                                        ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <vector>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include<cstdio>
using namespace std;
  
typedef double D;
  
int n,a[110],r;
D b,v,e,f;
D dp[10100][110];
const D EPS = 1e-8;
  
int main(){
  while(scanf("%d",&n),n){
    a[0] = 0;
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    scanf("%lf%d%lf%lf%lf",&b,&r,&v,&e,&f);
  
    for(int i=0;i<=a[n];i++)
      for(int j=0;j<=n;j++)dp[i][j] = 1e15;
    dp[0][0] = 0;
  
    int pos = 1;
    for(int i=0;i<a[n];i++){
      if(i==a[pos]){
    for(int j=0;j<pos;j++){
      if(dp[i][pos] > dp[i][j] + b + EPS){
        dp[i][pos] = dp[i][j] + b;
      }
    }
    pos++;
      }
  
      for(int j=0;j<=n;j++){
    if(dp[i][j] + ESP >= 1e15)continue;
    int x = i-a[j];
    D cost = (x<r)?(1.0/(v-f*(r-x))):(1.0/(v-e*(x-r)));
    if(dp[i+1][j] > dp[i][j] + cost + EPS){
      dp[i+1][j] = dp[i][j] + cost;
    }
      }
    }
      
    D res = 1e15;
    for(int i=0;i<=n;i++){
      if(res > dp[a[n]][i] + EPS)res = dp[a[n]][i];
    }
    printf("%.10lf\n",res);
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:19: error: 'ESP' was not declared in this scope; did you mean 'EPS'?
   33 |     if(dp[i][j] + ESP >= 1e15)continue;
      |                   ^~~
      |                   EPS
Language: C++

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

constexpr int MAX_N = 30;

int dist[MAX_N][MAX_N];

int base_dist[MAX_N];
vector<int> ans;

bool rec(const vector<int> &nodes) {
	if(nodes.size() == 1) {
		for(int i = 0; i < base_dist[nodes.front()] - 1; ++i) {
			ans.emplace_back(2);
		}
		return false;
	}

	int end_point;
	int max_base_dist = 0;
	for(const auto &v : nodes) {
		if(max_base_dist < base_dist[v]) {
			end_point = v;
			max_base_dist = base_dist[v];
		}
	}

	int longest_point = -1;
	int longest = max_base_dist;
	for(const auto &v : nodes) {
		const int d = (dist[v][end_point] + base_dist[end_point] - base_dist[v]) / 2;
		if(longest < d + 1) {
			longest = d + 1;
			longest_point = v;
		}
	}

	vector<vector<int>> pos(longest - 1);
	for(const auto &v : nodes) {
		if(v == end_point || v == longest_point) continue;

		const int d = (dist[v][end_point] + base_dist[end_point] - base_dist[v]) / 2;
		pos[d - 1].emplace_back(v);
		base_dist[v] = dist[v][end_point] - d;
	}

	for(int i = 0; i < longest - 1; ++i) {
		if(i + 1 == max_base_dist) continue;

		if(pos[i].empty()) {
			ans.emplace_back(2);
		}
		else if(rec(pos[i])) {
			ans.emplace_back(4);
		}
		else {
			ans.emplace_back(3);
		}
	}

	return max_base_dist < longest;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	for(int n; cin >> n && n;) {
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				cin >> dist[i][j];
			}
		}

		int base;
		int max_dist = 0;

		for(int i = 0; i < n - 1; ++i) {
			for(int j = i + 1; j < n; ++j) {
				if(max_dist < dist[i][j]) {
					base = i;
					max_dist = dist[i][j];
				}
			}
		}

		vector<int> nodes;
		nodes.reserve(n);

		for(int v = 0; v < n; ++v) {
			if(v == base) continue;

			base_dist[v] = dist[base][v];
			nodes.emplace_back(v);
		}

		ans.clear();

		rec(nodes);

		sort(ans.begin(), ans.end());
		for(unsigned i = 0; i < ans.size(); ++i) {
			cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' ');
		}
	}

	return EXIT_SUCCESS;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:104:17: error: 'sort' was not declared in this scope; did you mean 'short'?
  104 |                 sort(ans.begin(), ans.end());
      |                 ^~~~
      |                 short
Language: C

//2006年アジアA How I Wonder What You Are!
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-10

typedef struct{
	double x,y,z;
}Position;

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

double dist(P a){
	return sqrt(a.x*a.x + a.y*a.y + a.z*a.z);
}

double getTheta(P a,P b){
	return acos(dot(a,b) / (dist(a) * dist(b)));
}

int main(){
	int i,j;
	int n,m,ans;
	double phi[50];
	Position s[500],t[50];

	while(scanf("%d",&n) && n){
		for(i=0;i<n;i++) scanf("%lf %lf %lf",&s[i].x,&s[i].y,&s[i].z);
		scanf("%d",&m);
		for(i=0;i<m;i++) scanf("%lf %lf %lf %lf",&t[i].x,&t[i].y,&t[i].z,&phi[i]);

		ans = 0;
		for(i=0;i<n;i++){
      for(j=0;j<n;j++){
        if(getTheta(s[i],t[j]) < phi[j] + EPS){
  				ans++;
  				break;
  			}
      }
    }
		printf("%d\n",ans);
	}
	return 0;
}



Compiler output:
main.c:12:12: error: unknown type name 'P'
   12 | double dot(P a,P b){
      |            ^
main.c:12:16: error: unknown type name 'P'
   12 | double dot(P a,P b){
      |                ^
main.c:16:13: error: unknown type name 'P'
   16 | double dist(P a){
      |             ^
main.c:20:17: error: unknown type name 'P'
   20 | double getTheta(P a,P b){
      |                 ^
main.c:20:21: error: unknown type name 'P'
   20 | double getTheta(P a,P b){
      |                     ^
main.c: In function 'main':
main.c:38:12: error: implicit declaration of function 'getTheta' [-Wimplicit-function-declaration]
   38 |         if(getTheta(s[i],t[j]) < phi[j] + EPS){
      |            ^~~~~~~~
Language: C++

#include<iostream>
#include<set>
#include<array>

using namespace std;

typedef array<array<signed char,3>,3> Die;

int main(){
  for(int x,y;cin>>x>>y,x;){
    char g[3][3];
    for(int i=0;i<3;i++){
      for(int j=0;j<3;j++){
	cin>>g[i][j];
      }
    }
    set<Die> s[32],u;
    Die d{};
    d[y-1][x-1]=-1;
    s[0].insert(d);
    u.insert(d);
    for(int i=0;i<=30;i++){
      for(auto e:s[i]){
	bool f=false;
	int ey,ex;
	int c=0;
	for(int j=0;j<3;j++){
	  for(int k=0;k<3;k++){
	    if(e[j][k]==-1){
	      f|=g[j][k]!='E';
	      ey=j;
	      ex=k;
	    }else{
	      f|=g[j][k]!="WBRWBR"[e[j][k]];
	    }
	    c+=g[j][k]!='E'&&(e[j][k]==-1||g[j][k]!="WBRWBR"[e[j][k]]);
	  }
	}
	if(!f){
	  cout<<i<<endl;
	  goto next;
	}
	if(c+i>30)continue;
	if(i<30){
	  static int dy[]={-1,0,1,0};
	  static int dx[]={0,1,0,-1};
	  for(int j=0;j<4;j++){
	    int ny=ey+dy[j];
	    int nx=ex+dx[j];
	    if(0<=ny&&ny<3&&0<=nx&&nx<3){
	      auto n=e;
	      n[ny][nx]=-1;
	      n[ey][ex]=(e[ny][nx]+((e[ny][nx]%2^j%2)?1:5))%6;
	      if(u.insert(n).second){
		s[i+1].insert(n);
	      }
	    }
	  }
	}
      }
      e[i].clear();
    }
    cout<<-1<<endl;
  next:
    ;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:7: error: 'e' was not declared in this scope
   61 |       e[i].clear();
      |       ^
Language: C++

// 2006ツ年ツアツジツアツ地ツ凝ヲツ予ツ選C : Cubic Eight Puzzle
#include <iostream>
#include <vector>

using namespace std;

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
char dice[6][2] = {
  {4,2}, {3,5}, {5,0}, {1,4}, {0,3}, {2,1}
};
int board[9], goal[9];

inline int compress(int space){
  int res = space;
  for(int i=0;i<9;i++){
    if(board[i]!=6) { res = 6*res+board[i]; }
  }
  return res;
}

inline int decode(int state){
  for(int i=8;i>=1;i--) { board[i] = state%6; state /= 6; }
  for(int i=0;i<state;i++) board[i] = board[i+1];
  board[state] = 6;
  return state;
}

inline void initialize(int p){
  memset(board,0,sizeof(board));
  board[p] = 6;
}

inline int err(){
  int res = 0;
  for(int i=0;i<9;i++) res += (goal[i]!=board[i]/2);
  return res;
}

int main(){
  int x, y;
  static bool visit[9*6*6*6*6*6*6*6*6];
  while(cin >> x >> y, x){
    memset(visit,false,sizeof(visit));
    char c;
    for(int i=0;i<9;i++) {
      cin >> c;
      if(c=='W') goal[i] = 0;
      if(c=='B') goal[i] = 1;
      if(c=='R') goal[i] = 2;
      if(c=='E') goal[i] = 3;
    }
    vector<int> cur, next;
    int start = 3*(y-1)+x-1;
    initialize(start);
    visit[compress(start)] = true;
    cur.push_back(compress(start));
    int ans = (err()==0) ? 0 : -1;
    for(int st=1;st<=30&&ans==-1;st++){
      next.clear();
      for(int pos=0;pos<cur.size();pos++){
	int space = decode(cur[pos]);
	int copy[9];
	memcpy(copy, board, sizeof(copy));
	x = space/3, y = space%3;
	for(int i=0;i<4;i++){;
	  int nx = x + dx[i], ny = y + dy[i];
	  if(nx<0||3<=nx||ny<0||3<=ny) continue;
	  int mv = 3*nx+ny;
	  board[space] = dice[board[mv]][i/2];
	  board[mv] = 6;
	  int state = compress(mv);
	  if(!visit[state]){
	    visit[state] = true;
	    int dist = err();
	    if(dist==0) ans = st;
	    if(!(st+dist-1>30)) next.push_back(state);
	  }
	  board[space] = copy[space];
	  board[mv] = copy[mv];
	}
      }
      swap(cur,next);
    }
    cout << ans << endl;
  }
}

Compiler output:
a.cc: In function 'void initialize(int)':
a.cc:30:3: error: 'memset' was not declared in this scope
   30 |   memset(board,0,sizeof(board));
      |   ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | 
a.cc: In function 'int main()':
a.cc:44:5: error: 'memset' was not declared in this scope
   44 |     memset(visit,false,sizeof(visit));
      |     ^~~~~~
a.cc:44:5: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:64:9: error: 'memcpy' was not declared in this scope
   64 |         memcpy(copy, board, sizeof(copy));
      |         ^~~~~~
a.cc:64:9: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

// 2006ツアツジツアツ地ツ凝ヲツ予ツ選C : Cubic Eight Puzzle

#include <iostream>

using namespace std;

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
char dice[6][2] = {
	{4,2}, {3,5}, {5,0}, {1,4}, {0,3}, {2,1}
};

int board[9], goal[9];

void dfs(int x, int y, int px, int py, int step, int &res){
	if(step >= res) return;
	int space = 3*x+y;
	for(int i=0;i<4;i++){
		int nx = x + dx[i], ny = y + dy[i];
		if(nx<0||3<=nx||ny<0||3<=ny) continue;
		if(nx==px&&ny==py) continue;
		int mv = 3*nx+ny;
		int tmp = board[mv];
		board[space] = dice[board[mv]][i/2];
		board[mv] = 6;
		int dif = 0;
		for(int j=0;j<9;j++) dif += (goal[j]!=board[j]/2);
		if(dif==0) res = step;
		if(step+dif-1<ans) dfs(nx, ny, x, y, step+1, ans);
		board[space] = 6;
		board[mv] = tmp;
	}
}

int main(){
	int x, y;
	while(cin >> y >> x, y){
		char c;
		for(int i=0;i<9;i++) {
			cin >> c;
			if(c=='W') goal[i] = 0;
			if(c=='B') goal[i] = 1;
			if(c=='R') goal[i] = 2;
			if(c=='E') goal[i] = 3;
		}
		memset(board,0,sizeof(board));
		board[3*(x-1)+y-1] = 6;
		int dif = 0;
		for(int i=0;i<9;i++) dif += (goal[i]!=board[i]/2);
		int res = dif ? 31 : 0;
		dfs(x-1,y-1,-1,-1,1,res);
		cout << (res==31?-1:res) << endl;
	}
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int, int&)':
a.cc:29:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |                 if(step+dif-1<ans) dfs(nx, ny, x, y, step+1, ans);
      |                               ^~~
      |                               abs
a.cc: In function 'int main()':
a.cc:46:17: error: 'memset' was not declared in this scope
   46 |                 memset(board,0,sizeof(board));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <iostream>
  +++ |+#include <cstring>
    4 |
Language: C++

#include <iostream>
#include <cstring>

using namespace std;

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
char dice[6][2] = {
	{4,2}, {3,5}, {5,0}, {1,4}, {0,3}, {2,1}
};

int board[9], goal[9];

void dfs(int x, int y, int px, int py, int step, int &res){
	if(step >= res) return;
	int space = 3*x+y;
	for(int i=0;i<4;i++){
		int nx = x + dx[i], ny = y + dy[i];
		if(nx<0||3<=nx||ny<0||3<=ny) continue;
		if(nx==px&&ny==py) continue;
		int mv = 3*nx+ny;
		int tmp = board[mv];
		board[space] = dice[board[mv]][i/2];
		board[mv] = 6;
		int dif = 0;
		for(int j=0;j<9;j++) dif += (goal[j]!=board[j]/2);
		if(dif==0) res = step;
		if(step+dif-1<ans) dfs(nx, ny, x, y, step+1, ans);
		board[space] = 6;
		board[mv] = tmp;
	}
}

int main(){
	int x, y;
	while(cin >> y >> x, y){
		char c;
		for(int i=0;i<9;i++) {
			cin >> c;
			if(c=='W') goal[i] = 0;
			if(c=='B') goal[i] = 1;
			if(c=='R') goal[i] = 2;
			if(c=='E') goal[i] = 3;
		}
		memset(board,0,sizeof(board));
		board[3*(x-1)+y-1] = 6;
		int dif = 0;
		for(int i=0;i<9;i++) dif += (goal[i]!=board[i]/2);
		int res = dif ? 31 : 0;
		dfs(x-1,y-1,-1,-1,1,res);
		cout << (res==31?-1:res) << endl;
	}
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int, int&)':
a.cc:28:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |                 if(step+dif-1<ans) dfs(nx, ny, x, y, step+1, ans);
      |                               ^~~
      |                               abs