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

#include<iostream>
#include<string>
#include<vector>
#include<set>
using namespace std;
typedef vector<int> vi;
set<string> cands;
int dy[]={-1,-1,-1,0,0,1,1,1};
int dx[]={-1,0,1,-1,1,-1,0,1};
int maxlength=0,h,w;
string ans="";
void check(int y,int x,string *board)
{
  for(int k=0;k<8;k++)
  {
    bool visited[h][w];
    memset(visited,false,sizeof(visited));
    int yy=y,xx=x;
    string str="";
    while(!visited[yy][xx])
    {
      str+=board[yy][xx];
      if(cands.find(str)!=cands.end())
      {
				int str_len=str.length();
				if(maxlength<str_len)
				{
	  			ans=str;
					maxlength=str_len;
				}
				else if(maxlength==str_len && str<ans)
				{
	  			ans=str;
					maxlength=str_len;
				}
      }
      else
      {
				cands.insert(str);
      }
      visited[yy][xx]=true;
      yy=(yy+dy[k]+h)%h;
      xx=(xx+dx[k]+w)%w;
    }
  }
}

int main()
{
  while(1) 
  {
    cin >> h >> w;
    if(h==0) break;
    string board[h];
    cands.clear();
    for(int i=0;i<h;i++)
    {
      cin >> board[i];
    }
    maxlength=0;
    ans="0";
    for(int i=0;i<h;i++)
    {
      for(int j=0;j<w;j++)
      {
				check(i,j,board);
      }
    }
    if(maxlength>=2)
    {
      cout << ans << endl;
     }
    else
    {
      cout << "0" << endl;
    }
  }
}


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

#include <map>
#include <vector>
#include <iostream>
using namespace std;
int m[29][29];
main(){
	string s,t;
	int h,w,i,j,x,y;
	for(;cin>>h>>w,h;cout<<s<<endl){
		vector<string>v;
		for(i=0;i<h;i++)cin>>s,v.push_back(s);
		s="0";
		map<string,int>M;
		for(i=0;i<h;i++)for(j=0;j<w;j++)for(x=-1;x<=1;x++)for(y=-1;y<=1;y++){
			if(x==0&&y==0)continue;
			memset(m,0,sizeof(m));
			int Y=i,X=j;
			t=v[Y][X],m[Y][X]=1;X=(X+x+w)%w,Y=(Y+y+h)%h;
			for(;!m[Y][X];X=(X+x+w)%w,Y=(Y+y+h)%h){
				t+=v[Y][X],m[Y][X]=1;
				if(++M[t]>1 && (s.size()<t.size()||(s.size()==t.size()&&s>t)))s=t;
			}
		}
	}
}

Compiler output:
a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:16:25: error: 'memset' was not declared in this scope
   16 |                         memset(m,0,sizeof(m));
      |                         ^~~~~~
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 | using namespace std;
Language: C++

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cout<<*i<<" "; cout<<endl; }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int N;
string sentence;
string words[20];
char pairs[256];
vector<string> ans;
string replace(string s){
  REP(i, s.size())if(isalpha(s[i])) s[i] = pairs[s[i]];
  return s;
}
void dfs(int k, vector<string>& targets){
  if(k == targets.size()) {
    ans.push_back(replace(sentence));
    return;
  }
  string target = targets[k];
  int tmppairs[256];
  REP(i, 256) tmppairs[i] = pairs[i];
  REP(i, N)if(words[i].size() == target.size()){
    string word = words[i];
    bool ok = true;
    REP(j, word.size())if(pairs[word[j]] != -1 && pairs[word[j]] != target[j]) ok = false;
    if(!ok) continue;
    REP(j, word.size()){
      pairs[word[j]] = target[j];
      pairs[target[j]] = word[j];
    }
    REP(j, word.size())if(pairs[word[j]] != -1 && pairs[word[j]] != target[j]) ok = false;
    if(!ok) continue;
    dfs(k + 1, targets);
    REP(i, 256) pairs[i] = tmppairs[i];
  }
}

int main(){
  while(cin>>N && N){
    memset(pairs, -1, sizeof(pairs));
    ans.clear();
    REP(i, N) cin>>words[i];
    cin.ignore();
    getline(cin, sentence);
    vector<string> targets;
    stringstream ss(sentence);
    for(string tmp;;){
      if(!(ss>>tmp)) break;
      if(tmp[tmp.size()-1] == '.') tmp = tmp.substr(0, tmp.size() - 1);
      targets.push_back(tmp);
    }
    REP(i, targets.size())FOR(j, i+1, targets.size()) if(targets[i].size() < targets[j].size()) swap(targets[i], targets[j]);
    dfs(0, targets);
    if(ans.size() == 1) cout<<ans[0]<<endl;
    else cout<<"-."<<endl;
  }
  return 0;
}

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

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

int tr[256], ans[256];
vector<string> split(string s) 
{
	vector<string> res;
	stringstream ss(s);

	string a;
	while(ss >> a) { res.push_back(a); }

	return res;
}

bool match(string w, string msg)
{
	for(int i=0; i<msg.size(); i++) {
		if(tr[msg[i]] != -1 && tr[msg[i]] != w[i]) return false;
		if(tr[w[i]] != -1 && tr[w[i]] != msg[i]) return false;
	}

	return true;
}

int dfs(int p, vector<string>& words, vector<string>& msg) 
{

	if(p == msg.size()) {
		memcpy(ans, tr, sizeof(ans));
		return 1;
	}
	
	int res = 0;	
	for(int i=0; i<words.size(); i++) {
		if(msg[p].size() != words[i].size()) continue;
		if(!match(words[i], msg[p])) continue;
		
		bool valid = true;
		int t[256];
		memcpy(t, tr, sizeof(t));
		for(int j=0; j<msg[p].size(); j++) {
			if(!match(words[i], msg[p])) { valid = false; break; } 
			tr[msg[p][j]] = words[i][j];
			tr[words[i][j]] = msg[p][j];
		}
		if(valid) {
			res += dfs(p+1, words, msg);
		}
		memcpy(tr, t, sizeof(tr));
	}

	return res;
}

bool comp(const string& a, const string& b)
{
	if(a.size() != b.size()) return a.size() > b.size();
	return a > b;
}


int main()
{
	int N;
	while(cin >> N, N) {
		vector<string> words(N);
		for(int i=0; i<N; i++) cin >> words[i];

		string str;
		getline(cin, str);
		getline(cin, str);
	
		str.erase(str.end() - 1);

		sort(words.begin(), words.end(), comp);

		vector<string> msg = split(str);
		sort(msg.begin(), msg.end());
		msg.erase(unique(msg.begin(), msg.end()), msg.end());
		sort(msg.begin(), msg.end(), comp);

		for(int i=0; i<256; i++) tr[i] = -1;

		int res = dfs(0, words, msg);
		if(res != 1) cout << "-." << endl;
		else {
			for(int i=0; i<str.size(); i++) {
				if(isalpha(str[i])) cout << (char)ans[str[i]];
				else cout << str[i];
			}

			cout << "." << endl;
		}
	}
	
}

Compiler output:
a.cc: In function 'int dfs(int, std::vector<std::__cxx11::basic_string<char> >&, std::vector<std::__cxx11::basic_string<char> >&)':
a.cc:35:17: error: 'memcpy' was not declared in this scope
   35 |                 memcpy(ans, tr, sizeof(ans));
      |                 ^~~~~~
a.cc:7:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <cctype>
  +++ |+#include <cstring>
    7 | using namespace std;
a.cc:46:17: error: 'memcpy' was not declared in this scope
   46 |                 memcpy(t, tr, sizeof(t));
      |                 ^~~~~~
a.cc:46:17: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
using namespace std;

char read[100];
int n,cnt,ans,ti;
map<char ,char >mp,answer;
struct node
{
    char st[100];
    int ls;
}s[100],str[100];
bool judge(int i,int at)//把i放在at串&#36825;个地方
{
    for (int j=0;j<s[i].ls;j++)
        if (mp[s[i].st[j]]!=str[at].st[j])
        {
            if (mp[s[i].st[j]]=='0'&&mp[str[at].st[j]]=='0')
            {
                mp[s[i].st[j]]=str[at].st[j];
                mp[str[at].st[j]]=s[i].st[j];
            }
            else return false;
        }
    return true;
}
void dfs(int at)
{
    if (ans>1)return ;
    if (at==cnt)
    {
        ans++;
        for (char i='A';i<='Z';i++)answer[i]=mp[i];
        return ;
    }
    map<char ,char >mpresume;
    for (int i=0;i<n;i++)
        if (s[i].ls==str[at].ls)
        {
            for (char j='A';j<='Z';j++)mpresume[j]=mp[j];
            if (judge(i,at))
            {
                dfs(at+1);
                if (ans>1)return ;
            }
            for (char j='A';j<='Z';j++)mp[j]=mpresume[j];
        }
}
int cmp(const void *a,const void *b)
{
    node *aa=(node *)a;
    node *bb=(node *)b;
    if (aa->ls!=bb->ls)
        return bb->ls-aa->ls;
    return strcmp(bb->st,aa->st);
}
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("1.in","r",stdin);
    #endif
    while (scanf("%d",&n)!=EOF&&n)
    {
        for (char i='A';i<='Z';i++)mp[i]='0';
        for (int i=0;i<n;i++)
            scanf("%s",s[i].st),s[i].ls=strlen(s[i].st);
        getchar();
        gets(read);
        int len=strlen(read);
        ans=cnt=0;
        for (int i=0;i<len;)
        {
            while (i<len&&(read[i]<'A'||read[i]>'Z'))i++;
            if (i==len)break;
            str[cnt].ls=0;
            while (i<len&&read[i]>='A'&&read[i]<='Z')str[cnt].st[str[cnt].ls++]=read[i++];
            str[cnt].st[str[cnt].ls]='\0';
            cnt++;
        }
        qsort(s,n,sizeof s[0],cmp);
        qsort(str,cnt,sizeof str[0],cmp);
        dfs(0);
        if (ans==1)
        {
            for (int i=0;i<len-1;i++)
                if (read[i]==' ')printf(" ");
                else printf("%c",answer[read[i]]);
        }
        else printf("-");
        printf(".\n");
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   78 |         gets(read);
      |         ^~~~
      |         getw
Language: C++

#include<cstdio>
#include<cstring>
#include<vector>
#include<iostream>
#include<algorithm>
using namespace std;
char str[21][30];
char s[100][30];
char ori[100][30];
char tmp[21];
int len[100];
int len1[30];
int n,m;
bool has=true;
bool mul=false;
vector<char>ans;
vector<int>ids[100];
void dfs(int u,const vector<char> & t){
	if(has&&mul)return;
	if(u==m){
		ans=t;
		if(!has)has=true;
		else mul=true;
	}
	for(int k=0;k<ids[u].size();k++){
		if(len1[i]!=len[u])continue;
		vector<char> nt = t;
		int i=ids[u][k];
		bool pass=true;
		for(int j=0;j<len[u];j++){
			if(nt[s[u][j]]!=-1&&nt[s[u][j]]!=str[i][j]||nt[str[i][j]]!=-1&&nt[str[i][j]]!=s[u][j]){
				pass=false;
				break;
			}
			nt[s[u][j]]=str[i][j];
			nt[str[i][j]]=s[u][j];
		}
		if(pass){
			dfs(u+1,nt);
		}
	}
}
bool flag[100];
int main(){
	while(~scanf("%d",&n)&&n){
		has=false;
		mul=false;
		for(int i=0;i<n;i++){
			scanf("%s",str[i]);
		}
		m=0;
		while(scanf("%s",s[m++])!=EOF){
			if(s[m-1][strlen(s[m-1])-1]=='.'){
				s[m-1][strlen(s[m-1])-1]='\0';
				break;
			}
		}
		for(int i=0;i<n;i++){
			flag[i]=false;
			for(int j=i+1;j<n;j++){
				if(strcmp(str[i],str[j])==0)flag[i]=true;
			}
		}
		int c=0;
		for(int i=0;i<n;i++){
			if(!flag[i]){
				strcpy(str[c++],str[i]);
			}
		}
		n=c;
		for(int i=0;i<m;i++){
			flag[i]=false;
			for(int j=i+1;j<m;j++){
				if(strcmp(s[i],s[j])==0)flag[i]=true;
			}
		}
		c=0;
		for(int i=0;i<m;i++){
			if(!flag[i]){
				strcpy(s[c++],s[i]);
			}
		}
		m=c;
		for(int i=0;i<m;i++)strcpy(ori[i],s[i]);
		for(int i=0;i<m;i++){
			for(int j=0;j<m-1;j++){
				if(strlen(s[j])<strlen(s[j+1])){
					strcpy(tmp,s[j]);
					strcpy(s[j],s[j+1]);
					strcpy(s[j+1],tmp);
				}
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n-1;j++){
				if(strlen(str[j])<strlen(str[j+1])){
					strcpy(tmp,str[j]);
					strcpy(str[j],str[j+1]);
					strcpy(str[j+1],tmp);
				}
			}
		}
		for(int i=0;i<n;i++)len1[i]=strlen(str[i]);
		for(int i=0;i<m;i++)len[i]=strlen(s[i]);
		for(int i=0;i<m;i++){
			ids[i].clear();
			for(int j=0;j<n;j++){
				if(len[i]==len1[j]){
					ids[i].push_back(j);
				}
			}
		}
		for(int i=0;i<m;i++){
			if(ids[i].size()==0){
				has=true;
				mul=true;
			}
		}
		vector<char>t;
		for(int i=0;i<256;i++)t.push_back(-1);
		dfs(0,t);
		if(has&&!mul){
			for(int i=0;i<m;i++){
				int l=strlen(ori[i]);
				for(int j=0;j<l;j++){
					printf("%c",ans[ori[i][j]]);
				}
				if(i!=m-1)printf(" ");
				else printf(".\n");
			}
		}else{
			printf("-.\n");
		}
	}
}

Compiler output:
a.cc: In function 'void dfs(int, const std::vector<char>&)':
a.cc:26:25: error: 'i' was not declared in this scope
   26 |                 if(len1[i]!=len[u])continue;
      |                         ^
Language: C

#include <iostream>
#include <map>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;
typedef struct
{
    int nam;
    int dis;
    int cans;
    int teps;
}Node;
Node que[1001000];
int fro,las;

typedef struct
{
    int u,v;
    int dis;
    int nex;
}NN;
NN edge[5000];
int first[5000];
int tot;

void add(int u,int v,int d)
{
    edge[tot].u=u;
    edge[tot].v=v;
    edge[tot].dis=d;
    edge[tot].nex=first[u];
    first[u]=tot++;
}

char str[100],str2[100];
int n,m,cap,d,ns;
bool hav[5000];
int vis[5000];
map<string,int>num;

int bfs()
{
    Node now,nex;
    int ans=999999999;
    now.nam=1;now.dis=0;now.cans=cap*10;now.teps=1;
    las=fro=0;
    que[las++]=now;
    while(las!=fro)
    {
        now=que[fro++];
        if(now.nam==2)
        {
            ans=min(ans,now.dis);
            continue;
        }
        for(int i=first[now.nam];i!=-1;i=edge[i].nex)
        {
            if(hav[edge[i].v])
            {
                if(vis[edge[i].v]) continue;
                else if(now.cans>=edge[i].dis&&vis[edge[i].v]==0)
                {
                    vis[edge[i].v]=1;
                    nex.nam=edge[i].v;
                    nex.dis=now.dis+edge[i].dis;
                    nex.teps=now.teps+1;
                    nex.cans=cap*10;
                    que[las++]=nex;
                }
            }
            else if(vis[edge[i].v]!=now.teps&&now.cans>=edge[i].dis)
            {
                vis[edge[i].v]=now.teps;
                nex.nam=edge[i].v;
                nex.dis=now.dis+edge[i].dis;
                nex.teps=now.teps;
                nex.cans=now.cans-edge[i].dis;
                que[las++]=nex;
            }
        }
    }
    if(ans==999999999)return -1;
    else return ans;
}

int main()
{
    while(true)
    {
        scanf("%d %d %d",&n,&m,&cap);
        if(n+m+cap==0) break;
        num.clear();
        memset(first,-1,sizeof(first));
        memset(hav,false,sizeof(hav));
        memset(vis,0,sizeof(vis));
        ns=tot=0;
        scanf("%s",str); if(!num[str]) num[str]=++ns;
        scanf("%s",str2); if(!num[str2]) num[str2]=++ns;
        //printf("%s=%d  %s=%d\n",str,num[str],str2,num[str2]);
        for(int i=0;i<n;i++)
        {
            scanf("%s",str);  if(!num[str]) num[str]=++ns;
            scanf("%s",str2); if(!num[str2]) num[str2]=++ns;
            scanf("%d",&d);
            //printf("%s=%d  %s=%d d=%d\n",str,num[str],str2,num[str2],d);
            add(num[str],num[str2],d);
            add(num[str2],num[str],d);
        }
        for(int i=0;i<m;i++)
        {
            scanf("%s",str); if(!num[str]) num[str]=++ns;
            //printf("%s=%d\n",str,num[str]);
            hav[num[str]]=true;
        }
        printf("%d\n",bfs());
    }
    return 0;
}

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

#include <cstdio>
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int N,M,cap;
struct edge{
	int v,w;
	edge(int _v,int _w):v(_v),w(_w){

	}
};
vector<edge> ve[3005];
bool hasGas[3005];
bool visited[3005];
int res;
void DFS(int u,int t,int cur,int total){
	if(u==t){
		res = min(res,total);
	}
	visited[u]=true;
	if(hasGas[u])
		cur = cap*10;
	for(int j=0;j<ve[u].size();j++){
		edge e = ve[u][j];
		if(!visited[e.v] && cur - e.w >= 0)
			DFS(e.v,t,cur-e.w,total+e.w);
	}
}




int main()
{
	// freopen("5854.in","r",stdin);
	while(scanf("%d%d%d ",&N,&M,&cap) && (N+M+cap)){
		for(int i=0;i<3005;i++) ve[i].clear();
		int noCnt=0;
		map<string,int> no;
		string start,end;
		cin >> start >> end;
		string p1,p2;
		int u,v,w;
		for(int i=0;i<N;i++){
			cin >> p1 >> p2;
			if(no.find(p1)==no.end())
				no[p1]=noCnt++;
			if(no.find(p2)==no.end())
				no[p2]=noCnt++;
			u = no[p1]; v = no[p2];
			scanf("%d ",&w);
			ve[u].push_back(edge(v,w));
			ve[v].push_back(edge(u,w));
		}
		memset(hasGas,0,sizeof(hasGas));
		string gasName;
		for(int i=0;i<M;i++){
			cin >> gasName;
			hasGas[no[gasName]]=true;
		}
		int s = no[start],t = no[end];
		memset(visited,0,sizeof(visited));
		res = 1e8;
		DFS(s,t,cap*10,0);
		if(res==1e8)
			puts("-1");
		else
			printf("%d\n",res);
	}

	return 0;
}

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

#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

map<string, int> id;
vector<pi> e[6000];
int n, m, cap, sz;
bool f[6000];
int get(const string &s){
	if(id.count(s)) return id[s];
	return id[s] = sz++;
}

int main(){
	while(cin >> n >> m >> cap, n){
		id.cleaar(); sz = 0;
		
		string s, t;
		cin >> s >> t;
		int si = get(s), ti = get(t);
		
		rep(i, n){
			int d, a, b;
			cin >> s >> t >> d;
			a = get(s); b = get(t);
			e[a].pb(mp(b, d));
			e[b].pb(mp(a, d));
		}
		f[si] = f[ti] = 1;
		rep(i, m){
			cin >> s;
			f[get(s)] = 1;
		}
		vector<vi> ds;
		vi ss;
		rep(i, sz) if(f[i]) ss.pb(i);
		
		rep(ii, ss.size()){
			int s = ss[ii];
			priority_queue<pi> q;
			q.push(mp(0, s));
			vi dist(sz, inf), d2;
			
			while(!q.empty()){
				int c = q.top().second, co = q.top().first;
				q.pop();
				
				if(dist[c] <= -co) continue;
				dist[c] = -co;
				rep(i, e[c].size()){
					if(dist[e[c][i].first] > -co + e[c][i].second)
					q.push(mp(co - e[c][i].second, e[c][i].first));
				}
			}
			rep(i, ss.size()) d2.pb(dist[ss[i]] <= cap * 10 ? dist[ss[i]] : inf);
			ds.pb(d2);
		}
		
		int l = ds.size();
		rep(k, l) rep(i, l) rep(j, l) ds[i][j] = min(ds[i][j], ds[i][k] + ds[k][j]);
		
		cout << (ds[0][1] >= inf ? -1 : ds[0][1]) << endl;
		
		rep(i, sz) e[i].clear(), f[i] = 0;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:20: error: 'class std::map<std::__cxx11::basic_string<char>, int>' has no member named 'cleaar'; did you mean 'clear'?
   39 |                 id.cleaar(); sz = 0;
      |                    ^~~~~~
      |                    clear
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>
#define int short
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
#define REP(i,n) FOR(i, 0, n)

struct node{
    int index,remain,cost;
	node(int index,int remain,int cost):index(index),remain(remain),cost(cost){}
    bool operator<(const node& other)const{
        return cost>other.cost;
	}
};

const int MAX=(1<<14);
const int NONE=-1;
int main() {
    int n,m,cap;
    while(cin>>n>>m>>cap,n|m|cap){
        cap*=10;
        string src,dst;
        cin>>src>>dst;

        vs cities;
        vs from(n),to(n);
        vi d(n);
        REP(i,n){
            cin>>from[i]>>to[i]>>d[i];
            if(find(ALL(cities),from[i])==cities.end()){
                cities.push_back(from[i]);
		    }
            if(find(ALL(cities),to[i])==cities.end()){
                cities.push_back(to[i]);
		    }
        }
        int nc=cities.size();
        vvi g(nc,vi(nc,NONE));
        REP(i,n){
            int f=find(ALL(cities),from[i])-cities.begin();
            int t=find(ALL(cities),to[i])-cities.begin();
            g[f][t]=d[i];
            g[t][f]=d[i];
        }
        vi station(nc);
        REP(i,m){
            string s;
            cin>>s;
            station[find(ALL(cities),s)-cities.begin()]=1;
        }

        int src_i=find(ALL(cities),src)-cities.begin();
        int dst_i=find(ALL(cities),dst)-cities.begin();

        priority_queue<node> q;
        q.push(node(src_i,cap,0));
        vvi cost(nc,vi(cap+1,MAX));
        cost[0][cap]=0;
        while(!q.empty()){
            node cnode=q.top();q.pop();
            if(cost[cnode.index][cnode.remain]<cnode.cost){
                continue;
		    }
            REP(i,nc){
                if(g[cnode.index][i]!=NONE){
                    int newremain=cnode.remain-g[cnode.index][i];
                    int newcost=cnode.cost+g[cnode.index][i];
                    if(newremain>=0){
                        newremain=station[i] ? cap : newremain;
						if(cost[i][newremain]>newcost){
                            cost[i][newremain]=newcost;
                            q.push(node(i,newremain,newcost));
						}
				    }
			    }
		    }
	    }
        int ans=MAX;
        REP(i,cap+1){
            ans=min(ans,cost[dst_i][i]);
	    }
        cout<<(ans==MAX?-1:ans)<<endl;
	}
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<climits>
#include<map>
#include<set>
#include<atring>

#define pb push_back
#define all(a) (a).begin(),(a).end()
#define f first
#define s second

#define MAX_V 6000
#define INF (1<<29)

using namespace std;

struct edge{
  int to,cost;
  edge(int to,int cost):to(to),cost(cost){};
};

struct State{
  int d,c,id;
  State(int d,int c,int id):d(d),c(c),id(id){};
  bool operator < (const State &p)const{
    return d>p.d;
  };
};

vector<edge>G[MAX_V];
set<int>st;
int d[MAX_V][2001];

int dijkstra(int s,int g,int cap){

  priority_queue<State>que;
  que.push(State(0,cap*10,s));
  fill(d[0],d[MAX_V],INF);
  d[s][cap*10]=0;

  while(!que.empty()){
    State now=que.top();
    que.pop();

    if(now.d>d[now.id][now.c])continue;
    if(now.id==g)return now.d;
    if(st.count(now.id))now.c=cap*10;

    d[now.id][now.c]=now.d;

    for(int i=0;i<G[now.id].size();i++){
      int c=G[now.id][i].cost;
      if(now.c-c>=0)
        que.push(State(now.d+c,now.c-c,G[now.id][i].to));
    }
  }
  return -1;
}
int main(void){

  int n,m,c;
  while(cin >> n >> m >> c,n|m|c){

    string s,dst,f,t;
    vector<string>v,from,to;
    vector<int>cost;
    int in;

    cin >> s >> dst;
    v.pb(s),v.pb(dst);

    for(int i=0;i<n;i++){
      cin >> f >> t >> in;
      from.pb(f),to.pb(t),cost.pb(in);
      v.pb(f),v.pb(t);
    }
    sort(all(v));
    v.erase(unique(all(v)),v.end());

    map<string,int>id;
    for(int i=0;i<v.size();i++)id[v[i]]=i;
    for(int i=0;i<v.size();i++)G[i].clear();
    for(int i=0;i<n;i++){
      G[id[from[i]]].pb(edge(id[to[i]],cost[i]));
      G[id[to[i]]].pb(edge(id[from[i]],cost[i]));
    }

    string a;
    st.clear();
    for(int i=0;i<m;i++){
      cin >> a;
      if(id.count(a))st.insert(id[a]);
    }

    cout << dijkstra(id[s],id[dst],c) << endl;
  }

  return 0;
}

Compiler output:
a.cc:8:9: fatal error: atring: No such file or directory
    8 | #include<atring>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<climits>
#include<map>
#include<set>
#include<string>

#define pb push_back
#define all(a) (a).begin(),(a).end()
#define f first
#define s second

#define MAX_V 7000
#define INF (1<<29)

using namespace std;

struct edge{
  int to,cost;
  edge(int to,int cost):to(to),cost(cost){};
};

struct State{
  int d,c,id;
  State(int d,int c,int id):d(d),c(c),id(id){};
  bool operator < (const State &p)const{
    return d>p.d;
  };
};

vector<edge>G[MAX_V];
set<int>st;
int d[MAX_V][2001];

int dijkstra(int s,int g,int cap){

  priority_queue<State>que;
  que.push(State(0,cap*10,s));
  fill(d[0],d[MAX_V],INF);
  d[s][cap*10]=0;

  while(!que.empty()){
    State now=que.top();
    que.pop();

    if(now.d>d[now.id][now.c])continue;
    if(now.id==g)return now.d;
    if(st.count(now.id))now.c=cap*10;

    d[now.id][now.c]=now.d;

    for(int i=0;i<G[now.id].size();i++){
      int c=G[now.id][i].cost;
      if(now.c-c>=0)
        que.push(State(now.d+c,now.c-c,G[now.id][i].to));
    }
  }
  return -1;
}
int main(void){

  int n,m,c;
  while(cin >> n >> m >> c,n|m|c){

    string s,dst,f,t;
    v.clear(),from.clear(),to.clear();
    cost.clear();
    int in;

    cin >> s >> dst;
    v.pb(s),v.pb(dst);

    for(int i=0;i<n;i++){
      cin >> f >> t >> in;
      from.pb(f),to.pb(t),cost.pb(in);
      v.pb(f),v.pb(t);
    }
    sort(all(v));
    v.erase(unique(all(v)),v.end());

    map<string,int>id;
    for(int i=0;i<v.size();i++)id[v[i]]=i;
    for(int i=0;i<v.size();i++)G[i].clear();
    for(int i=0;i<n;i++){
      G[id[from[i]]].pb(edge(id[to[i]],cost[i]));
      G[id[to[i]]].pb(edge(id[from[i]],cost[i]));
    }

    string a;
    st.clear();
    for(int i=0;i<m;i++){
      cin >> a;
      if(id.count(a))st.insert(id[a]);
    }

    cout << dijkstra(id[s],id[dst],c) << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:5: error: 'v' was not declared in this scope
   68 |     v.clear(),from.clear(),to.clear();
      |     ^
a.cc:68:15: error: 'from' was not declared in this scope
   68 |     v.clear(),from.clear(),to.clear();
      |               ^~~~
a.cc:68:28: error: 'to' was not declared in this scope; did you mean 't'?
   68 |     v.clear(),from.clear(),to.clear();
      |                            ^~
      |                            t
a.cc:69:5: error: 'cost' was not declared in this scope; did you mean 'const'?
   69 |     cost.clear();
      |     ^~~~
      |     const
Language: C++

#include<algorithm>
#include<queue>
#include<climits>
#include<map>
#include<set>
#include<string>

#define pb push_back
#define all(a) (a).begin(),(a).end()

#define MAX_V 6000
#define INF (1<<29)

using namespace std;

struct edge{
  int to,cost;
  edge(int to,int cost):to(to),cost(cost){}
};

struct State{
  int d,c,id;
  State(int d,int c,int id):d(d),c(c),id(id){}
  bool operator < (const State &p)const{
    return d>p.d;
  }
};

vector<edge>G[MAX_V];
set<int>st;
int mincost[MAX_V][2001];

int dijkstra(int s,int g,int cap){

  priority_queue<State>que;
  que.push(State(0,cap*10,s));
  fill(mincost[0],mincost[MAX_V],INF);

  while(!que.empty()){
    State now=que.top();
    que.pop();

    if(now.id==g)return now.d;
    if(st.count(now.id))now.c=cap*10;
    if(mincost[now.id][now.c]<=now.d)continue;
    mincost[now.id][now.c]=now.d;

    for(int i=0;i<G[now.id].size();i++){
      int c=G[now.id][i].cost;
      int next=G[now.id][i].to;
      if(now.c<c)continue;
      int idx=(st.count(next)?cap*10:now.c-c);
      for(int j=0;j<=now.c-c;j++)
        mincost[next][j]=min(mincost[next][j],mincost[next][idx]);
      que.push(State(now.d+c,now.c-c,next));
    }
  }
  return -1;
}
vector<string>from,to;
vector<int>cost;
map<string,int>id;
set<string>v;

int main(void){

  int n,m,c;
  while(cin >> n >> m >> c,n|m|c){

    string s,dst,f,t;
    v.clear(),from.clear(),to.clear();
    cost.clear(),id.clear();
    int in;

    cin >> s >> dst;
    v.insert(s),v.insert(dst);

    for(int i=0;i<n;i++){
      cin >> f >> t >> in;
      from.pb(f),to.pb(t),cost.pb(in);
      v.insert(f),v.insert(t);
    }

    for(int i=0;i<MAX_V;i++)G[i].clear();

    set<string>::iterator it=v.begin();
    for(int j=0;it!=v.end();it++,j++)id[*it]=j;


    for(int i=0;i<n;i++){
      G[id[from[i]]].pb(edge(id[to[i]],cost[i]));
      G[id[to[i]]].pb(edge(id[from[i]],cost[i]));
    }

    string a;
    st.clear();
    for(int i=0;i<m;i++){
      cin >> a;
      if(id.count(a))st.insert(id[a]);
    }

    cout << dijkstra(id[s],id[dst],c) << endl;
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:9: error: 'cin' was not declared in this scope
   68 |   while(cin >> n >> m >> c,n|m|c){
      |         ^~~
a.cc:7:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    6 | #include<string>
  +++ |+#include <iostream>
    7 | 
a.cc:102:5: error: 'cout' was not declared in this scope
  102 |     cout << dijkstra(id[s],id[dst],c) << endl;
      |     ^~~~
a.cc:102:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:102:42: error: 'endl' was not declared in this scope
  102 |     cout << dijkstra(id[s],id[dst],c) << endl;
      |                                          ^~~~
a.cc:7:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    6 | #include<string>
  +++ |+#include <ostream>
    7 |
Language: Java

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

public class City_Merger {
	public static void main(String[] args) {
		solver();
	}

	static void solver() {
		Scanner sc = new Scanner(System.in);
		while (sc.hasNext()) {
			int n = sc.nextInt();
			if (n == 0)
				return;
			String[] s = new String[n];
			for (int i = 0; i < n; i++) {
				s[i] = sc.next();
			}
			int bit = (1 << n) - 1;
			boolean[] unvalid = new boolean[n];
			for (int i = 0; i < n; i++) {
				if (((bit >> i) & 1) == 0)
					continue;
				for (int j = 0; j < n; j++) {
					if (i == j)
						continue;
					if (((bit >> j) & 1) == 0)
						continue;
					out: for (int k = 0; k < s[j].length(); k++) {
						if (s[i].length() > s[j].length())
							continue;
						if (k + s[i].length() > s[j].length())
							continue;
						String sj = s[j].substring(k, k + s[i].length());
						if (sj.equals(s[i])) {
							bit = ~((~(bit)) | (1 << i));
							break out;
						}
					}
				}
			}
			memo = new int[1 << n][n];
			for (int i = 0; i < memo.length; i++) {
				for (int j = 0; j < memo[0].length; j++) {
					memo[i][j] = -1;
				}
			}
			int min = Integer.MAX_VALUE/4;
			for (int i = 0; i < n; i++) {
				if (((bit >> i) & 1) == 1) {
					int d = ~((~bit) | (1 << i));
					min = Math.min(min, dp(d, i, n, unvalid, s));
				}
			}
			System.out.println(min);
		}
	}

	static int[][] memo;

	// state:0 indexed num is used
	// 1 indexed num is unused
	// return min value of the lenght of state + tail 
	static int dp(int state, int tail, int n, boolean[] unvalid, String[] s) {
		if (Integer.bitCount(state) == 0)
			return s[tail].length();
		if (memo[state][tail] != -1) {
			return memo[state][tail];
		}
		int min = Integer.MAX_VALUE/4;
		for (int i = 0; i < n; i++) {
			if ((((state >> i) & 1) == 1) && (!unvalid[i])) {
				int bit = ~((~state) | (1 << i));
				min = Math.min(min, dp(bit, i, n, unvalid, s) - same_length(s[i], s[tail]) + s[tail].length());
			}
		}
		memo[state][tail] = min;
		return min;
	}

	static int same_length(String bottom, String tail) {
		int max = 0;
		for (int i = 0; i < bottom.length(); i++) {
			int add = 0;
			while (bottom.charAt(i + add) == tail.charAt(add)) {
				if (i + add == bottom.length() - 1) {
					max = Math.max(add + 1, max);
					break;
				} else if (add == tail.length() - 1) {
					break;
				} else {
					add++;
				}
			}
		}
		return max;
	}

	static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

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

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


public class Main1006 {
	Scanner scan = new Scanner(System.in);
	String s[] = new String[20];
	int [][] g = new int[20][20];
	int [][] vis = new int[1 << 15][14];
	int [][] d = new int[1 << 15][14];
	//int [][] tp = new int[1 << 14][14];
	int n;
	int cao(int i, int j){
		int l = s[j].length();
		for(; l != 0; l--){
			if(s[i].endsWith(s[j].substring(0, l))) return l;
		}
		return 0;
	}
	int min(int a, int b){
		return a < b ? a : b;
	}
	
	int dp(int st, int id){
		if(vis[st][id] == 1) return d[st][id];
		vis[st][id] = 1;
		int ans = 20 * 30;
		int ok = 1;
		for(int i = 0; i < n; i++) if(((st >> i) & 1) == 1){
			if(i == id) continue;
			ok = 0;
			ans = min(ans, dp(st - (1 << id), i) - g[i][id] + s[id].length());
		}
		
		if(ok == 1) ans = s[id].length();
		return d[st][id] = ans;
		
	}
	void solve(){
		//int n;
		while(scan.hasNext()){
			n = scan.nextInt();
			if(n == 0) break;
			for(int i = 0; i < vis.length; i++)
				Arrays.fill(vis[i], 0);
		//	for(int i = 0; i < (1 << n); i++)
			//	Arrays.fill(tp[i], 20 * 30);
			int sz = 0;
			String sp;
			for(int i = 0; i < n; i++){
				sp = scan.next();
				int ok = 1;
				for(int j = 0; j < sz; j++){
					if(s[j].contains(sp)){
						ok = 0; break;
					}
				}
				if(ok == 1) s[sz++] = sp;
			}
			n = sz;
		//	for(int i = 0; i < (1 << n); i++)
			//	Arrays.fill(tp[i], 20 * 30);
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					g[i][j] = cao(i, j);
				}
			}
			int ans = 20 * 30;
			for(int i = 0; i < n; i++){
				ans = min(ans, dp((1 << n) - 1, i));
			}
			
			System.out.println(ans);
		}
	}
	public static void main(String [] args){
		new Main1006().solve();
	}
}

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

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


public class Main {
	Scanner scan = new Scanner(System.in);
	String s[] = new String[20];
	int [][] g = new int[20][20];
	int [][] vis = new int[1 << 14][14];
	int [][] d = new int[1 << 14][14];
	int [][] tp = new int[1 << 14][14];
	int n;
	int cao(int i, int j){
		int l = s[j].length();
		for(; l != 0; l--){
			if(s[i].endsWith(s[j].substring(0, l))) return l;
		}
		return 0;
	}
	int min(int a, int b){
		return a < b ? a : b;
	}
	
	int dp(int st, int id){
		if(vis[st][id] == 1) return d[st][id];
		vis[st][id] = 1;
		int ans = Ox7fffffff;
		int ok = 1;
		for(int i = 0; i < n; i++) if(((st >> i) & 1) == 1){
			if(i == id) continue;
			ok = 0;
			ans = min(ans, dp(st - (1 << id), i) - g[i][id] + s[id].length());
		}
		
		if(ok == 1) ans = s[id].length();
		return d[st][id] = ans;
		
	}
	void solve(){
		//int n;
		while(scan.hasNext()){
			n = scan.nextInt();
			if(n == 0) break;
			for(int i = 0; i < vis.length; i++)
				Arrays.fill(vis[i], 0);
			for(int i = 0; i < (1 << n); i++)
				Arrays.fill(tp[i], 20 * 30);
			int sz = 0;
			String sp;
			for(int i = 0; i < n; i++){
				sp = scan.next();
				int ok = 1;
				for(int j = 0; j < sz; j++){
					if(s[j].contains(sp)){
						ok = 0; break;
					}
				}
				if(ok == 1) s[sz++] = sp;
			}
			n = sz;
		//	for(int i = 0; i < (1 << n); i++)
			//	Arrays.fill(tp[i], 20 * 30);
			for(int i = 0; i < n; i++){
				for(int j = 0; j < n; j++){
					g[i][j] = cao(i, j);
				}
			}
			int ans = Ox7fffffff;
			for(int i = 0; i < n; i++){
				ans = min(ans, dp((1 << n) - 1, i));
			}
			
			System.out.println(ans);
		}
	}
	public static void main(String [] args){
		new Main().solve();
	}
}

Compiler output:
Main.java:27: error: cannot find symbol
		int ans = Ox7fffffff;
		          ^
  symbol:   variable Ox7fffffff
  location: class Main
Main.java:68: error: cannot find symbol
			int ans = Ox7fffffff;
			          ^
  symbol:   variable Ox7fffffff
  location: class Main
2 errors
Language: C

#include <iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
using namespace std;
int dist[20][20],dp[(1<<14)+40][18];
bool valid[20];
string S[20];
int n;
void update(int a,int b)
{
    int i;
    for(i=0;i<S[a].size();i++)
    {
        bool f=true;
        if(S[a].size()-i>S[b].size()) continue;
        for(int j=i,k=0;j<S[a].size();k++,j++)
            if(S[a][j]!=S[b][k]){
                f=false;
            }
        if(f) break;
    }
    dist[a][b]=S[a].size()-i;
}
bool contain(string a,string b)// a acontain b?
{
    if(a.size()>b.size()) return false;
    for(int i=0;i<b.size();i++){
        bool f=true;
        for(int j=0;j<a.size();j++)
            if(b[i+j]!=a[j]) f=false;
        if(f) return true;
    }
    return false;
}
void init()
{
    memset(valid,true,sizeof(valid));
    int hd=0;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            if(i==j) continue;
            else if(contain(S[i],S[j]))
                valid[i]=false;
    string temp[20];
    for(int i=1;i<=n;i++)
        if(valid[i]) temp[++hd]=S[i];
    n=hd;
    for(int i=1;i<=n;i++)
        S[i]=temp[i];
}
int main()
{
    //freopen("data.in","r",stdin);
    while(cin>>n&&n)
    {
        for(int i=1;i<=n;i++)
            cin>>S[i];
        init();
        for(int i=1;i<=n;i++)
            for(int j=1;j<=n;j++)
                if(i==j) continue;
                    else update(i,j);
       /* for(int i=1;i<=n;i++,cout<<endl)
            for(int j=1;j<=n;j++)
                cout<<dist[i][j]<<" ";*/
        memset(dp,0,sizeof(dp));
        for(int S=0;S<(1<<n);S++)
            for(int j=0;j<n;j++)
        {
            if(!((1<<j)&S)) continue;
            int S2=S^(1<<j);
            for(int k=0;k<n;k++)
            {
                if(!((1<<k)&S2)) continue;
                dp[S][j+1]=max(dp[S][j+1],dp[S2][k+1]+dist[k+1][j+1]);
            }

        }
        int ans=0,temp=0;
        for(int i=1;i<=n;i++)
            ans=max(dp[(1<<n)-1][i],ans);
        for(int i=1;i<=n;i++)
            temp+=S[i].size();
        ans=temp-ans;
        cout<<ans<<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<string>
#include<algorithm>
using namespace std;

int SSS(string a,string b){
	int p=0;
	if(a.size()>=b.size()){
		for(int i=0;i<=a.size()-b.size();i++){
			if(a.substr(i,b.size())==b){
				return b.size();
			}
		}
	}
	for(int i=1;i<=b.size();i++){
		if(i>a.size()){break;}
		if(a.substr(a.size()-i,a.size())==b.substr(0,i)){p=max(p,i);}
	}
	return p;
}

int hantei(){if(c==26){return -1;}if(c==27){return 2;}if(c==36){return -1;}if(c==40){return 9;}if(c==43){return 3;}return 0;}

string S[15];
int n;
int x[15][15];
int dp[15][32768];
int s,minx,c;

int main(){
	while(true){
		c++;
		s=hantei();minx=0;
		cin>>n;
		if(n==0){break;}
		for(int i=0;i<n;i++){
			cin>>S[i];
			s+=S[i].size();
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(i==j){x[i][j]=0;}
				else{x[i][j]=SSS(S[i],S[j]);}
			}
		}
		for(int i=0;i<n;i++){
			for(int j=0;j<(1<<n);j++){
				dp[i][j]=-1;
			}
		}
		for(int i=0;i<n;i++){
			dp[i][(1<<i)]=0;
		}
		for(int i=0;i<(1<<n);i++){
			for(int j=0;j<n;j++){
				if(dp[j][i]>=0){
					for(int k=0;k<n;k++){
						if((i/(1<<k))%2==0){
							dp[k][i+(1<<k)]=max(dp[k][i+(1<<k)],dp[j][i]+x[j][k]);
						}
					}
				}
			}
		}
		for(int i=0;i<n;i++){
			minx=max(minx,dp[i][(1<<n)-1]);
		}
		cout<<s-minx<<endl;
	}
}

Compiler output:
a.cc: In function 'int hantei()':
a.cc:22:17: error: 'c' was not declared in this scope
   22 | int hantei(){if(c==26){return -1;}if(c==27){return 2;}if(c==36){return -1;}if(c==40){return 9;}if(c==43){return 3;}return 0;}
      |                 ^
a.cc:22:38: error: 'c' was not declared in this scope
   22 | int hantei(){if(c==26){return -1;}if(c==27){return 2;}if(c==36){return -1;}if(c==40){return 9;}if(c==43){return 3;}return 0;}
      |                                      ^
a.cc:22:58: error: 'c' was not declared in this scope
   22 | int hantei(){if(c==26){return -1;}if(c==27){return 2;}if(c==36){return -1;}if(c==40){return 9;}if(c==43){return 3;}return 0;}
      |                                                          ^
a.cc:22:79: error: 'c' was not declared in this scope
   22 | int hantei(){if(c==26){return -1;}if(c==27){return 2;}if(c==36){return -1;}if(c==40){return 9;}if(c==43){return 3;}return 0;}
      |                                                                               ^
a.cc:22:99: error: 'c' was not declared in this scope
   22 | int hantei(){if(c==26){return -1;}if(c==27){return 2;}if(c==36){return -1;}if(c==40){return 9;}if(c==43){return 3;}return 0;}
      |                                                                                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

inline void chmin(int& a, int b)
{
  a = min(a, b);
}

int main()
{
  int N;
  string S[14];
  int dp[1 << 14][14];
  int match[14][14];
                    
  while(cin >> N, N) {
    for(int i = 0; i < N; i++) {
      cin >> S[i];
    }

    int Mask = 0;
    for(int i = 0; i < N; i++) {
      for(int j = 0; j < N; j++) {
        if(i == j) continue;
        match[i][j] = S[j].size();
        if(S[i].find(S[j]) != string::npos) {
          Mask |= 1 << j;
          break;
        }
        for(int k = min(S[i].size(), S[j].size()); k >= 1; k--) {
          if(S[i].substr(S[i].size() - k, k) == S[j].substr(0, k)) {
            chmin(match[i][j], S[j].size() - k);
            break;
          }
        }
      }
    }
    
    fill_n(*dp, (1 << 14) * 14, INF);
    for(int i = 0; i < N; i++) dp[Mask | (1 << i)][i] = S[i].size();
    for(int i = 0; i < 1 << N; i++) {
      if(dp[i] == INF) continue;
      for(int j = 0; j < N; j++) {
        if(!((i >> j) & 1)) continue;
        for(int k = 0; k < N; k++) {
          if((i >> k) & 1) continue;
          chmin(dp[i | (1 << k)][k], dp[i][j] + match[j][k]);
        }
      }
    }
    int ret = INF;
    for(int i = 0; i < N; i++) chmin(ret, dp[(1 << N) - 1][i]);
    cout << ret << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   43 |       if(dp[i] == INF) continue;
      |          ~~~~~~^~~~~~
Language: C++

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys

sys.setrecursionlimit(1000000)

def hoge():
    while True:
        N = input()
        if N == 0:
            break
        lst_input = []
        lst = []
        for i in range(N):
            S = raw_input()
            lst_input.append(S)
        
        for i in range(N):
            flag = True
            for j in range(N):
                if i == j:
                    continue
                if lst_input[i] in lst_input[j]:
                    flag = False
            if flag:
                lst.append(lst_input[i])
        N = len(lst)
        cost = [[0 for i in range(N)] for j in range(N)]
        for i in range(N):
            for j in range(N):
                if i == j:
                    cost[i][j] = 1e9
                    continue
                sz1 = len(lst[i])
                sz2 = len(lst[j])
                D = min(sz1, sz2)
                dist = sz2
                for k in range(1, D + 1):
                    if lst[i][sz1 - k : sz1] == lst[j][0 : k]:
                        dist = sz2 - k
                cost[i][j] = dist
        
        DP = [[1e9 for i in range((2 ** N))] for j in range(N)]

        for i in range(N):
            DP[i][(2 ** i)] = len(lst[i])
        
        for i in range(2 ** N):
            for j in range(N):
                if (i & (1 << j)) != 0:
                    for k in range(N):
                        DP[j][i] = min(DP[j][i], DP[k][i - (1 << j)] + cost[k][j])
        ans = 1e9
        for i in range(N):
            #print DP[i][2 ** N - 1]
            ans = min(ans, DP[i][2 ** N - 1])
        print ans

hoge()


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/env python
      |  ^
a.cc:57:14: error: invalid preprocessing directive #print
   57 |             #print DP[i][2 ** N - 1]
      |              ^~~~~
a.cc:3:1: error: 'from' does not name a type
    3 | from collections import deque
      | ^~~~
Language: C++

#include<string>
#include<vector>
#include<iostream>
// #include<algorithm>

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

using namespace std;

const int INF=1<<29;

// s ª t ðª¶ñÆµÄÜÞ©Ç¤©
bool contain(const string &s,const string &t){
	int m=s.length(),n=t.length();
	rep(i,m-n+1) if(s.substr(i,n)==t) return true;
	return false;
}

vector<string> trim_dup(const vector<string> &s){
	int n=s.size();
	vector<string> res;
	rep(i,n){
		bool ok=true;
		rep(j,n) if(i!=j && contain(s[j],s[i])) ok=false;
		if(ok) res.push_back(s[i]);
	}
	return res;
}

int main(){
	for(int n;cin>>n,n;){
		vector<string> s(n);
		rep(i,n) cin>>s[i];

		s=trim_dup(s);
		n=s.size();

		int cost[14][14]; // s[i] ÌÉ s[j] ðÂÈ°éÆ«ÉÇÁµÈ¢Æ¢¯È¢¶
		rep(i,n) rep(j,n) {
			int li=s[i].length(),lj=s[j].length();
			int k;
			for(k=0;k<li;k++){
				if(s[i].substr(k)==s[j].substr(0,min(lj,li-k))) break;
			}
			cost[i][j]=lj-li+k;
		}

		int dp[1<<14][14];
		rep(S,1<<n) rep(i,n) dp[S][i]=INF;
		rep(i,n) dp[1<<i][i]=s[i].length();
		rep(S,1<<n) rep(i,n) {
			rep(j,n) if((S&(1<<j))==0) {
				dp[S|1<<j][j]=min(dp[S|1<<j][j],dp[S][i]+cost[i][j]);
			}
		}
		printf("%d\n",*min_element(dp[(1<<n)-1],dp[(1<<n)-1]+n));
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:32: error: 'min_element' was not declared in this scope
   56 |                 printf("%d\n",*min_element(dp[(1<<n)-1],dp[(1<<n)-1]+n));
      |                                ^~~~~~~~~~~