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

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

bool check(pair<char,char>* words, int num);

int main() {
  int num;
  char buf[33];
  pair<char,char> words[10000];

  while(true) {
    cin >> num;
    if(!num)
      break;

    for(int i=0; i<num; i++) {
      cin >> buf;
      words[i].first = buf[0];
      words[i].second = buf[std::strlen(buf)-1];
    }

    if(check(words,num))
      cout << "OK" << endl;
    else
      cout << "NG" << endl;
  }
  return 0;
}

bool check(pair<char,char>* words, int num) {
  stack<int> searchStack;
  bool used[10000];
  for(int i=0; i<num; i++) used[i]=false;

  searchStack.push(0);
  searchStack.pop();
  searchStack.push(0);
  used[0] = true;
  int searchPos = 0;

  while(!searchStack.empty()) {
    for(int i=searchPos; i<num; i++) {
      if(words[searchStack.top()].second == words[i].first && !used[i]) {
        searchStack.push(i);
        used[i] = true;
        searchPos = 0;
        break;
      } else if(i==num-1) {
        searchPos = searchStack.top()+1;
        used[searchStack.top()] = false;
        searchStack.pop();
        break;
      }
    }

    if(searchPos >= num) {
      searchPos = searchStack.top() + 1;
      used[searchStack.top()] = false;
      searchStack.pop();
    }

    if(searchStack.size() == num) {
      if(words[searchStack.top()].second == words[0].first) {
        return true;
      } else {
        searchPos = searchStack.top() + 1;
        used[searchStack.top()] = false;
        searchStack.pop();
      }
    }

  }
  return false;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:34: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'?
   21 |       words[i].second = buf[std::strlen(buf)-1];
      |                                  ^~~~~~
      |                                  mbrlen
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<cctype>
#include<climits>
#include<bitset>

using namespace std;

#define int long long

int N;
vector<int> e[26];
int graphSize;

int CountVertex(int v, bool isUsed[26])
{
	if (isUsed[v]) return 0;
	isUsed[v] = true;
	int ret = 1;
	for (int i = 0; i < e[v].size(); i++)
	{
		ret += CountVertex(e[v][i], isUsed);
	}
	return ret;
}

bool IsConnected()
{
	for (int i = 0; i < 26; i++)
	{
		bool isUsed[26] = {};
		if (CountVertex(i, isUsed) == graphSize) return true;
	}
	return false;
}

signed main()
{
	while (cin >> N, N)
	{
		int in[26] = {}, out[26] = {};
		bool flag[26] = {};
		graphSize = 0;
		for (int i = 0; i < 26; i++) e[i].clear();
		for (int i = 0; i < N; i++)
		{
			string s;
			cin >> s;
			int a = s[0] - 'a', b = s.[s.size() - 1] - 'a';
			out[a]++;
			in[b]++;
			e[a].push_back(b);
			e[b].push_back(a);
			graphSize += !flag[a] + !flag[b];
			flag[a] = true;
			flag[b] = true;
		}
		bool ans = true;
		for (int i = 0; i < 26; i++)
		{
			if (in[i] != out[i]) ans = false;
		}
		if (ans && IsConnected()) puts("OK");
		else puts("NG");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:51: error: expected unqualified-id before '[' token
   55 |                         int a = s[0] - 'a', b = s.[s.size() - 1] - 'a';
      |                                                   ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;
string S[10000]; int x, n; char T[10000][2];

//Class.
vector<int> list[100000];
int N, M, E, P;
int match[100000];
bool used[100000];
int x[100000], y[100000];

bool DFS(int V) {
	used[V] = true;
	for (int i = 0; i < list[V].size(); i++) {
		int u = list[V][i]; int w = match[u];
		if (w < 0 || !used[w] && DFS(w)) {
			match[V] = u;
			match[u] = V;
			return true;
		}
	}
	return false;
}

int supermatching() {
	int r = 0;
	memset(match, -1, sizeof(match));
	for (int j = 0; j < P; j++) {
		if (match[j] < 0) {
			memset(used, 0, sizeof(used));
			if (DFS(j)) { r++; }
		}
	}
	return r;
}

int main() {
	while (true) {
		for (int i = 0; i < 10000; i++) { list[i].clear(); }
		cin >> n; x = 0;
		for (int i = 0; i < n; i++) {
			cin >> S[i];
			T[i][0] = S[i][0]; T[i][1] = S[i][S[i].size() - 1];
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (T[i][0] == T[j][1] && i != j) { list[i].push_back(j + n); }
			}
		}
		if (supermatching() != n) { cout << "NG" << endl; }
		else { cout << "No" << endl; }
	}
}

Compiler output:
a.cc:12:5: error: conflicting declaration 'int x [100000]'
   12 | int x[100000], y[100000];
      |     ^
a.cc:5:22: note: previous declaration as 'int x'
    5 | string S[10000]; int x, n; char T[10000][2];
      |                      ^
a.cc: In function 'int supermatching()':
a.cc:29:9: error: 'memset' was not declared in this scope
   29 |         memset(match, -1, sizeof(match));
      |         ^~~~~~
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 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;
string S[10000]; int n; char T[10000][2];

//Class.
vector<int> list[100000];
int N, M, E, P;
int match[100000];
bool used[100000];
int x[100000], y[100000];

bool DFS(int V) {
	used[V] = true;
	for (int i = 0; i < list[V].size(); i++) {
		int u = list[V][i]; int w = match[u];
		if (w < 0 || !used[w] && DFS(w)) {
			match[V] = u;
			match[u] = V;
			return true;
		}
	}
	return false;
}

int supermatching() {
	int r = 0;
	memset(match, -1, sizeof(match));
	for (int j = 0; j < P; j++) {
		if (match[j] < 0) {
			memset(used, 0, sizeof(used));
			if (DFS(j)) { r++; }
		}
	}
	return r;
}

int main() {
	while (true) {
		for (int i = 0; i < 10000; i++) { list[i].clear(); }
		cin >> n; if (!n) { break; }
		for (int i = 0; i < n; i++) {
			cin >> S[i];
			T[i][0] = S[i][0]; T[i][1] = S[i][S[i].size() - 1];
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (T[i][0] == T[j][1] && i != j) { list[i].push_back(j + n); }
			}
		}
		if (supermatching() != n) { cout << "NG" << endl; }
		else { cout << "No" << endl; }
	}
}

Compiler output:
a.cc: In function 'int supermatching()':
a.cc:29:9: error: 'memset' was not declared in this scope
   29 |         memset(match, -1, sizeof(match));
      |         ^~~~~~
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 | using namespace std;
Language: C++

#include<iostream>
#include<string>
#include<map>
using namespace std;
int n, flag; string S, U;
map<string, int>M;
int backtruck(string T, int a) {
	if (a == n - 1) {
		if (T[1] == U[0]) { flag = 1; }
	}
	if (flag == 1) { return; }
	for (map<string, int>::iterator it = M.begin(); it != M.end(); it++) {
		if (T[1] == (*it).first[0] && (*it).second) {
			(*it).second--;
			backtruck((*it).first, a + 1);
			(*it).second++;
		}
	}
}
int main() {
	while (true) {
		cin >> n; M.clear();
		if (n == 0) { break; }
		for (int i = 0; i < n; i++) {
			cin >> S;
			S = S[0] + S[S.size() - 1];
			M[S]++;
		}
		U = S;
		backtruck(S, 0);
		if (flag == true) { cout << "OK" << endl; }
		else { cout << "NG" << endl; }
	}
}

Compiler output:
a.cc: In function 'int backtruck(std::string, int)':
a.cc:11:26: error: return-statement with no value, in function returning 'int' [-fpermissive]
   11 |         if (flag == 1) { return; }
      |                          ^~~~~~
a.cc:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)

template<int MV> class DirectedEulerPath {
public:
	vector<int> path;
	multiset<int> E[MV];
	void add_path(int x, int y) { E[x].insert(y); }

	void dfs(int cur) {
		while (E[cur].size()) {
			int tar = *E[cur].begin();
			E[cur].erase(E[cur].begin());
			dfs(tar);
		}
		path.push_back(cur);
	}

	bool GetPath(int s = 0) {
		int fo = -1, odd = 0, i, np = 0;
		vector<int> deg(MV);
		rep(i, 0, MV) {
			np += E[i].size();
			for (int e : E[i]) --deg[e];
			deg[i] += E[i].size();
		}

		int k = MV - count(deg.begin(), deg.end(), 0);
		if (k == 1 || 2 < k) return false;
		path.clear();
		if (k == 0) {
			dfs(s);	
		}
		else {
			rep(i, 0, MV) if (1 < deg[i]) return false;
			rep(i, 0, MV) if (deg[i] == 1) dfs(i), break;
		}
		reverse(path.begin(), path.end());
		// ??¨?????????????????£??????????????????????????\?????????????????????true?????????
		return path.size() == m + 1;
	}
};
//-----------------------------------------------------------------
int n;
set<int> sn;
string solve() {
	DirectedEulerPath<26> dep;
	sn.clear();

	rep(i, 0, n) {
		string s; cin >> s;
		int a = s[0] - 'a';
		int b = s[s.length() - 1] - 'a';
		dep.add_path(a, b);
		sn.insert(a);
		sn.insert(b);
	}

	bool can = dep.GetPath();
	// ???????????????????????????
	if (!can) return "NG";
	for (int i : dep.path) cout << i << " -> "; cout << endl;
	// ??????????????????????????????
	if (dep.path.front() != dep.path.back()) return "NG";

	return "OK";
}
//-----------------------------------------------------------------
int main() {
	while (cin >> n) {
		if (n == 0) break;
		cout << solve() << endl;
	}
}

Compiler output:
a.cc: In member function 'bool DirectedEulerPath<MV>::GetPath(int)':
a.cc:37:64: error: expected primary-expression before 'break'
   37 |                         rep(i, 0, MV) if (deg[i] == 1) dfs(i), break;
      |                                                                ^~~~~
a.cc:37:64: error: expected ';' before 'break'
a.cc:41:39: error: 'm' was not declared in this scope; did you mean 'tm'?
   41 |                 return path.size() == m + 1;
      |                                       ^
      |                                       tm
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef pair<char, char>P;

vector<int>E[10000];
bool used[10000];
int in[10000], out[10000;

void dfs(int u) {
	used[u] = true;
	for (int v : E[u]) {
		if (!used[v])dfs(v);
	}
}
int main() {
	int n;
	while (scanf("%d", &n), n) {
		vector<P>v;
		memset(used, 0, sizeof(used));
		memset(in, 0, sizeof(in));
		memset(out, 0, sizeof(out));
		rep(i, n) {
			E[i].clear();
			string s; cin >> s;
			v.push_back(P(*s.begin(), *s.rbegin()));
		}
		rep(i, n)rep(j, n) {
			if (i == j)continue;
			if (v[i].second == v[j].first) {
				E[i].push_back(j);
				in[j]++; out[i]++;
			}
		}
		dfs(0);
		rep(i, n) {
			if (in[i] != out[i] || !used[i]) {
				puts("NG"); goto g;
			}
		}
		puts("OK");
	g:;
	}
}

Compiler output:
a.cc:8:25: error: expected ']' before ';' token
    8 | int in[10000], out[10000;
      |                         ^
      |                         ]
a.cc: In function 'int main()':
a.cc:22:24: error: 'out' was not declared in this scope
   22 |                 memset(out, 0, sizeof(out));
      |                        ^~~
Language: C++

#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	while(true) {
		int n;
		cin>>n;
		if(n == 0) break;
		vector<int> s(26, 0);
		vector<int> e(26, 0);
		REP(i, n) {
			string gomi;
			cin>>gomi;
			++c[gomi[0] - 'a'];
			++e[gomi[gomi.size() - 1] - 'a'];
		}
		bool det = true;
		REP(i, 26) {
			if(c[i] != d[i]) {
				det = false;
				break;
			}
		}
		if(det) cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:27: error: 'c' was not declared in this scope
   33 |                         ++c[gomi[0] - 'a'];
      |                           ^
a.cc:38:28: error: 'c' was not declared in this scope
   38 |                         if(c[i] != d[i]) {
      |                            ^
a.cc:38:36: error: 'd' was not declared in this scope
   38 |                         if(c[i] != d[i]) {
      |                                    ^
Language: C++

#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	while(true) {
		int n;
		cin>>n;
		if(n == 0) break;
		vector<int> s(26, 0);
		vector<int> e(26, 0);
		REP(i, n) {
			string gomi;
			cin>>gomi;
			++s[gomi[0] - 'a'];
			++e[gomi[gomi.size() - 1] - 'a'];
		}
		bool det = true;
		REP(i, 26) {
			if(s[i] != d[i]) {
				det = false;
				break;
			}
		}
		if(det) cout<<"OK"<<endl;
		else cout<<"NG"<<endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:36: error: 'd' was not declared in this scope
   38 |                         if(s[i] != d[i]) {
      |                                    ^
Language: C++

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

char str[10000][32];
int n;
char first;
bool isFst = 1;


//øÌ¶©çnÜéPêð`FbN
int isUsed[10000] = {0};

int check(char str[], int num);

using namespace std;

int main()
{
	for(;;){
		int ok = 0;
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		for(int i = 0; i < n; i++){
			scanf("%s",str[i]);
		}
		
		for(int i = 0; i < n; i++){
	//		printf("õ¶ñ >> %s\n",str[i]);
			if(check(str[i], i) == 1){
				ok = 1;
				break;
			}
		}
		
		if(ok == 1){
			printf("OK\n");
		}
		else{
			printf("NG\n");
		}
		
	}
}

int check(char s[], int num)
{
	int i;
	bool find = 0;
	bool Fin = 0;
	
	for(i = 0; i < n; i++){
		if(isUsed[i] == 0){
			Fin = 0;
			break;
		}
		else{
			Fin = 1;
		}
	}
	
	//øÌ¶ñ©ÌÍgÁÄé
	isUsed[num] = 1;
	
	//ÅãÌ¶ðchÉi[
	char ch = s[strlen(s+1)];
	
	if(Fin == 1 && ch == first){
	}
	else{
		Fin = 0;
	}
	
	//±Ì¶ªÂÈªêÎµèÆè®¬
	if(isFst == 1){
		first = s[0];
		isFst = 0;
//		printf("%cÉÂÈªêÎ¢¢æB\n",first);
	}
	
	if(Fin == 1){
		if(ch == first){
		}
		else{
			Fin = 0;
		}
	}
	else{
		//PêXgÌ©çchÅnÜéPêðõ
		for(i = 0; i < n; i++){
			if(str[i][0] == ch && i != num && isUsed[i] == 0){
//				cout << str[i] << "ÉÂÈªéÆv¤"<<endl;
				find = 1;
				break;
			}
		}
	}
	
//	printf("**********************õÊ********************\n");
//	printf("");
	
	if(Fin == 1){
		return 1;
	}
	else if(find == 1){
		return check(str[i], i);
	}
	else{
		return 0;
	}
}

Compiler output:
a.cc: In function 'int check(char*, int)':
a.cc:68:21: error: 'strlen' was not declared in this scope
   68 |         char ch = s[strlen(s+1)];
      |                     ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<vector>
  +++ |+#include <cstring>
    4 |
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<cstdlib>

char str[10000][32];
int n;
char first;
bool isFst = 1;


//øÌ¶©çnÜéPêð`FbN
int isUsed[10000] = {0};

int check(char str[], int num);

using namespace std;

int main()
{
	for(;;){
		int ok = 0;
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		for(int i = 0; i < n; i++){
			scanf("%s",str[i]);
		}
		
		for(int i = 0; i < n; i++){
	//		printf("õ¶ñ >> %s\n",str[i]);
			if(check(str[i], i) == 1){
				ok = 1;
				break;
			}
		}
		
		if(ok == 1){
			printf("OK\n");
		}
		else{
			printf("NG\n");
		}
		
	}
}

int check(char s[], int num)
{
	int i;
	bool find = 0;
	bool Fin = 0;
	
	for(i = 0; i < n; i++){
		if(isUsed[i] == 0){
			Fin = 0;
			break;
		}
		else{
			Fin = 1;
		}
	}
	
	//øÌ¶ñ©ÌÍgÁÄé
	isUsed[num] = 1;
	
	//ÅãÌ¶ðchÉi[
	char ch = s[strlen(s+1)];
	
	if(Fin == 1 && ch == first){
	}
	else{
		Fin = 0;
	}
	
	//±Ì¶ªÂÈªêÎµèÆè®¬
	if(isFst == 1){
		first = s[0];
		isFst = 0;
//		printf("%cÉÂÈªêÎ¢¢æB\n",first);
	}
	
	if(Fin == 1){
		if(ch == first){
		}
		else{
			Fin = 0;
		}
	}
	else{
		//PêXgÌ©çchÅnÜéPêðõ
		for(i = 0; i < n; i++){
			if(str[i][0] == ch && i != num && isUsed[i] == 0){
//				cout << str[i] << "ÉÂÈªéÆv¤"<<endl;
				find = 1;
				break;
			}
		}
	}
	
//	printf("**********************õÊ********************\n");
//	printf("");
	
	if(Fin == 1){
		return 1;
	}
	else if(find == 1){
		return check(str[i], i);
	}
	else{
		return 0;
	}
}

Compiler output:
a.cc: In function 'int check(char*, int)':
a.cc:69:21: error: 'strlen' was not declared in this scope
   69 |         char ch = s[strlen(s+1)];
      |                     ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<cstdlib>
  +++ |+#include <cstring>
    5 |
Language: C++

#include <iostream>
#include <string>
#include <queue>

using namespace std;

int table[26][26];

int main(){
        while(true){
                int n;
                cin >> n;
                if(n == 0){ break; }
                memset(table, 0, sizeof(table));
                for(int i = 0; i < n; ++i){
                        string word;
                        cin >> word;
                        ++(table[word[0] - 'a'][word[word.size() - 1] - 'a']);
                }
                bool isNG = false;
                bool passed[26] = { false };
                for(int i = 0; i < 26; ++i){
                        int inCount = 0, outCount = 0;
                        for(int j = 0; j < 26; ++j){
                                inCount += table[i][j];
                                outCount += table[j][i];
                        }
                        if(inCount != outCount){
                                isNG = true;
                                break;
                        }
                        if(inCount == 0){ passed[i] = true; }
                }
                if(isNG){
                        cout << "NG" << endl;
                        continue;
                }
                queue<int> q;
                for(int i = 0; i < 26; ++i){
                        if(!passed[i]){
                                passed[i] = true;
                                q.push(i);
                                break;
                        }
                }
                while(!q.empty()){
                        int front = q.front();
                        q.pop();
                        for(int i = 0; i < 26; ++i){
                                if(table[front][i] && !passed[i]){
                                        passed[i] = true;
                                        q.push(i);
                                }
                        }
                }
                for(int i = 0; i < 26; ++i){
                        if(!passed[i]){
                                isNG = true;
                                break;
                        }
                }
                if(isNG){
                        cout << "NG" << endl;
                }else{
                        cout << "OK" << endl;
                }
        }
        return 0;
}

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

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

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n;
  while(cin >> n, n) {
    vector<int> num(26);
    REP(i, n) {
      string s;
      cin >> s;
      num[s[0]-'a']++;
      num[s[s.siz()-1]-'a']--;
    }
    bool f = 1;
    REP(i, 26)
      if (num[i])
        f = 0;
    if (f)
      cout << "OK" <<endl;
    else
      cout <<"NG" <<endl;
  }

}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'siz'; did you mean 'size'?
   26 |       num[s[s.siz()-1]-'a']--;
      |               ^~~
      |               size
Language: C++

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

int n;
char** s;
bool* f;
int count1,count2;
char* a;

bool solve(){
	a = s[0];
	count = 0;
	while(true){
		count1 = 1;
		count2++;
		for(int i=1; i<n; i++){
			if(f[i]){
				count1++;
				if(count1 == n && a[1] == s[0][0])
					return true;
				continue;
			}
			if(a[1] == s[i][0]){
				count2 = 0;
				f[i] = true;
				a = s[i];
				break;
			}
		}
		if(count2 == 2)
			return false;
	}
}

int main(){
	while(true){
		std::cin >> n;
		if(!n)
			return 0;
		s = new char*[n];
		f = new bool[n];
		for(int i=0; i<n; i++){
			f[i] = false;
			s[i] = new char[33];
			std::cin >> s[i];
			s[i][1] = s[i][strlen(s[i])-1];
		}
		if(solve())
			std::cout << "OK\n";
		else
			std::cout << "NG\n";
		for(int i=0; i<n; i++)
			delete [] s[i];
		delete [] s;
	}
}

Compiler output:
a.cc: In function 'bool solve()':
a.cc:12:9: error: 'count' was not declared in this scope; did you mean 'count2'?
   12 |         count = 0;
      |         ^~~~~
      |         count2
Language: C++

#include<iostream>
//#include<map>

using namespace std;

//map<bool*,bool> memo;
int n;
char *f,*l;
string tmp;
bool *tf;

bool DFU(char s, int c){
	if(c == 0){
		if(s == f[0])
			return true;
		else
			return false;
	}
	for(int i=1; i<n; i++){
		if(tf[i])
			continue;
		if(f[i] == s){
			tf[i] = true;
//			if(memo[tf]){
//				tf[i] = false;
//				continue;
//			}
//			memo[tf] = true;
			if(DFU(l[i], c-1))
				return true;
			else
				tf[i] = false;
		}
	}
}

int main(){
	while(true){
		cin >> n;
		if(!n)
			return 0;
		f = new char[n];
		l = new char[n];
		tf = new bool[n];
		for(int i=0; i<n; i++){
			cin >> tmp;
			f[i] = tmp[0];
			l[i] = tmp[tmp.length()-1];
			tf[i] = false;
		}
		if(DFU(l[0],n-1))
			cout << "OK\n";
		else
			cout << "NG\n";
		delete[] f;
		delete[] l;
		delete[] tf;
		memo.clear();
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:17: error: 'memo' was not declared in this scope
   58 |                 memo.clear();
      |                 ^~~~
a.cc: In function 'bool DFU(char, int)':
a.cc:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
Language: C++

#include<cstdio>
using namespace std;

bool visit[26],g[26][26];

bool dfs(int v){
  visit[v] = true;
  bool f = false;
  for(int i=0;i<26;i++)
    if(g[v][i]){
      f = true;
      if(!visit[i])dfs(i);
    }
  return f;
}
 
int graph_num(void){
  int res = 0;
  for(int i=0;i<26;i++)
    if(!visit[i] && dfs(i))res++;
  return res;
}
  
int main(){
  int i,n,pre[26],suf[26],h,t;

  while(scanf("%d",&n) && n){
    for(i=0;i<26;i++){
      visit[i] = false;
      pre[i] = suf[i] = 0;
      for(int j=0;j<26;j++)g[i][j] = false;
    }
    
    for(i=0;i<n;i++){
      char s[40];
      scanf("%s",s);
      int len = strlen(s);
      h = s[0]-'a', t = s[len-1]-'a';
      
      pre[h]++;
      suf[t]++;
      g[h][t] = g[t][h] = true;
    }
  
    if(graph_num() != 1)printf("NG\n");
    else{
      for(i=0;i<26;i++)if(pre[i] != suf[i])break;
      
      if(i==26)printf("OK\n");
      else printf("NG\n");
    }
  }
}

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

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

int t[26][26];

//m[hid©ç¢­ÂÌm[hÉÚ®Â\©
//·ÅÉTõÏÝÌm[hÍÊçÈ¢
int reachableNode(int id,bool *used){
  int res = 1;

  used[id] = true;
  for(int i=0;i<26;i++){
    if(t[id][i] > 0 && !used[i]){
      res += reachableNode(i,used);
    }
  }

  return res;
}

int main(void){
  int n;

  while(cin>>n && n){
    string s;
    int from,to;
    set<int> ap;

    memset(t,0,sizeof(t));

    for(int i=0;i<n;i++){
      cin>>s;
      from = s[0] - 'a';
      to = s[s.length()-1] - 'a';

      //©È[vÈOÌÓÍJEg
      if(from != to){
        t[from][to]++;
      }
      ap.insert(from);
      ap.insert(to);
    }

    //XªêÂ¾¯Å é©ÌmF
    bool used[26];
    memset(used,0,sizeof(used));
    int count = reachableNode(from,used);
    if(count != ap.size()){
      cout<<"NG\n";
      continue;
    }

    //üÆoª¯¶©Ç¤©ÌmF
    set<int>::iterator i = ap.begin();
    for(;i!=ap.end();i++){
      int in=0,out=0;
      for(int j=0;j<26;j++){
        in += t[j][*i];
        out += t[*i][j];
      }

      if(in != out) break;
    }

    if(i == ap.end())
      cout<<"OK\n";
    else
      cout<<"NG\n";
  }

  return 0;
}

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

#include <iostream>
#include <cstdlib>
#include <set>
#include <string>
using namespace std;

int t[26][26];

//m[hid©ç¢­ÂÌm[hÉÚ®Â\©
//·ÅÉTõÏÝÌm[hÍÊçÈ¢
int reachableNode(int id,bool *used){
  int res = 1;

  used[id] = true;
  for(int i=0;i<26;i++){
    if(t[id][i] > 0 && !used[i]){
      res += reachableNode(i,used);
    }
  }

  return res;
}

int main(void){
  int n;

  while(cin>>n && n){
    string s;
    int from,to;
    set<int> ap;

    memset(t,0,sizeof(t));

    for(int i=0;i<n;i++){
      cin>>s;
      from = s[0] - 'a';
      to = s[s.length()-1] - 'a';

      //©È[vÈOÌÓÍJEg
      if(from != to){
        t[from][to]++;
      }
      ap.insert(from);
      ap.insert(to);
    }

    //XªêÂ¾¯Å é©ÌmF
    bool used[26];
    memset(used,0,sizeof(used));
    int count = reachableNode(from,used);
    if(count != ap.size()){
      cout<<"NG\n";
      continue;
    }

    //üÆoª¯¶©Ç¤©ÌmF
    set<int>::iterator i = ap.begin();
    for(;i!=ap.end();i++){
      int in=0,out=0;
      for(int j=0;j<26;j++){
        in += t[j][*i];
        out += t[*i][j];
      }

      if(in != out) break;
    }

    if(i == ap.end())
      cout<<"OK\n";
    else
      cout<<"NG\n";
  }

  return 0;
}

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

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

int t[26][26];

//ノードidからいくつのノードに移動可能か
//すでに探索済みのノードは通らない
int reachableNode(int id,bool *used){
  int res = 1;

  used[id] = true;
  for(int i=0;i<26;i++){
    if(t[id][i] > 0 && !used[i]){
      res += reachableNode(i,used);
    }
  }

  return res;
}

int main(void){
  int n;

  while(cin>>n && n){
    string s;
    int from,to;
    set<int> ap;

    memset(t,0,sizeof(t));

    for(int i=0;i<n;i++){
      cin>>s;
      from = s[0] - 'a';
      to = s[s.size()-1] - 'a';

      //自己ループ以外の辺はカウント
      if(from != to){
        t[from][to]++;
      }
      ap.insert(from);
      ap.insert(to);
    }

    //森が一つだけであるかの確認
    bool used[26];
    memset(used,0,sizeof(used));
    int count = reachableNode(from,used);
    if(count != ap.size()){
      cout<<"NG\n";
      continue;
    }

    //入次数と出次数が同じかどうかの確認
    set<int>::iterator i = ap.begin();
    for(;i!=ap.end();i++){
      int in=0,out=0;
      for(int j=0;j<26;j++){
        in += t[j][*i];
        out += t[*i][j];
      }
      if(in != out) break;
    }

    if(i == ap.end())cout<<"OK\n";
    else cout<<"NG\n";
  }

  return 0;
}

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

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

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		label:for(;;){
			int N=cin.nextInt();
			if(N==0)break;
			int[] node=new int[27];
			int[][] edge=new int[27][27];
			boolean[] already=new boolean[27];
			Arrays.fill(already, true);
			for(int i=0;i<N;i++){
				String s  =cin.next();
				char a = s.charAt(0);
				char b = s.charAt(s.length()-1);
				int aa=a-'a';
				int bb=b-'a';
				node[aa]++;
				node[bb]++;
				already[aa]=already[bb]=false;
				edge[aa][bb]++;
				edge[bb][aa]++;
			}
			for(int i=0;i<27;i++){
//				System.out.println(node[i]);
				if(node[i]%2!=0){
					System.out.println("NG");
					continue label;
				}
			}
			Stack<Integer>stack=new Stack<Integer>();
			for(int i=0;i<27;i++){
				if(!already[i]){
					stack.add(i);
					break;
				}
			}
			while(!stack.isEmpty()){
				int a = stack.pop();
				if(already[a])continue;
				already[a]=true;
				for(int i=0;i<27;i++){
					//					if(edge[a][i]>=1){
					//						int c=edge[a][i];
					//						edge[a][i]=edge[i][a]=c-1;
					if(edge[a][i]>0){
						edge[a][i]--;
						edge[i][a]--;
						stack.push(i);	
					}
					
				}
			}
			for(int i=0;i<27;i++){
				if(!already[i]){
					System.out.println("NG");
					continue label;
				}
			}
			System.out.println("OK");
		}
	}

}

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

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<sstream>


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

using namespace std;

int in[32];
int out[32];

int main(void){
	int n;
	char s[128];
	
	while(scanf("%d", &n),n){
		rep(i,32) in[i] = out[i] = 0;
		vector<int> x[32];
		
		rep(i,n){
			scanf("%s", s);
			in[s[0]-'a']++;
			out[s[strlen(s)-1]-'a']++;
			x[s[0]-'a'].push_back(s[strlen(s)-1]-'a');
		}
		
		int d = 0;
		
		rep(i,26){
			if(in[i] != out[i]){
				d++;
				printf("%c\n", i+'a');
			}
		}
		
		if(d == 0){
			int use[32];
			rep(i,32)use[i] = -1;
			queue<char>q;
			
			rep(i,26){
				if(x[i].size() > 0){
					rep(j, x[i].size()){
						use[i] = 0;
						q.push(x[i][j]);
					}
				}
			}
			
			while(!q.empty()){
				int f = q.front();q.pop();
				if(use[f] != -1)continue;
				use[f] = 0;
				rep(i, x[f].size()){
					q.push(x[f][i]);
				}
			}
			bool flg = true;
			rep(i,26){
				if(use[i] == -1 && x[i].size())
					flg = false;
			}
			if(flg){
				puts("OK");
			}else{
				puts("NG");
			}
		}
		else{
			puts("NG");
		}
		x.clear();
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:19: error: request for member 'clear' in 'x', which is of non-class type 'std::vector<int> [32]'
   83 |                 x.clear();
      |                   ^~~~~
Language: C

#include<iostream>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
        int c[50]={},z=0,x=0;
        for(int i=0;i<4;i++){
            if(a%10==b%10)z++;
            c[a%10] |= 1;c[b%10] |= 2;
            a/=10; b/=10;
        }
        for(int i=0;i<10;i++){
            if(c[i]==3)x++;
        }
        x-=z;
        cout<<z<<' '<<x<<endl;
    }
    return 0;
}

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

#include<iostream>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
        int c[10]={},z=0,x=0;
        for(int i=0;i<4;i++){
            if(a%10==b%10)z++;
            c[a%10] |= 1;c[b%10] |= 2;
            a/=10; b/=10;
        }
        for(int i=0;i<10;i++){
            if(c[i]==3)x++;
        }
        x-=z;
        cout<<z<<' '<<x<<endl;
    }
    return 0;
}

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

#include<iostream>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
        int c[10]={},z=0,x=0;
        for(int i=0;i<4;i++){
            if(a%10==b%10)z++;
            c[a%10]/= 1;c[b%10] |= 2;
            a/=10;b/=10;
        }
        for(int i=0;i<10;i++){
            if(c[i]==3)x++;
        }
        x-=z;
        cout<<z<<' '<<x<<endl;
    }
    return 0;
}

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

#include<iostream>
using namespace std;
 
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
        int c[10]={},d=0,f=0;
        for(int i=0;i<4;i++){
            if(a%10==b%10)d++;
            c[a%10] |=1;
            c[b%10] |=2;
            a/=10;
            b/=10;
        }
        for(int i=0;i<10;i++){if(c[i]==3)f++;}f-=d;
        cout<<d<<' '<<f<<endl;
    }
    return 0;
}

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

#include<iostream>
using namespace std;
 
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
        int c[10]={},d=0,f=0;
        for(int i=0;i<4;i++){
            if(a%10==b%10)d++;
            c[a%10] |=1;
            c[b%10] |=2;
            a/=10;
            b/=10;
        }
        for(int i=0;i<10;i++){
            if(c[i]==3)f++;
        }
        f-=d;
        cout<<d<<' '<<f<<endl;
    }
    return 0;
}

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

#include<iostream>
using namespace std;
 
 
int main(){
    int a,b;
    while(cin>>a>>b,a|b){
        int c[10]={},d=0,f=0;
        for(int i=0;i<4;i++){
            if(a%10==b%10)d++;
            c[a%10] |= 1;
            c[b%10] |= 2;
            a/=10;
            b/=10;
        }
        for(int i=0;i<10;i++){
            if(c[i]==3)f++;
        }
        f-=d;
        cout<<d<<' '<<f<<endl;
    }
    return 0;
}

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

#include<stdio.h> #include<string.h> int main(){char x[6],a[6];int h,b,i,j;while(scanf("%s%s",x,a)!=EOF){if(strcmp(x,"0")==0 && strcmp(a,"0")==0)break;h=b=0;for(i=0;i<4;i++){if(x[i]==a[i])h++;for(j=0;j<4;j++){if(j!=i && x[i]==a[j])b++;}}printf("%d %d\n",h,b);}return 0;}

Compiler output:
main.c:1:19: warning: extra tokens at end of #include directive
    1 | #include<stdio.h> #include<string.h> int main(){char x[6],a[6];int h,b,i,j;while(scanf("%s%s",x,a)!=EOF){if(strcmp(x,"0")==0 && strcmp(a,"0")==0)break;h=b=0;for(i=0;i<4;i++){if(x[i]==a[i])h++;for(j=0;j<4;j++){if(j!=i && x[i]==a[j])b++;}}printf("%d %d\n",h,b);}return 0;}
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
while(;;){
int a,b;
cin >> a >> b;
if(a==0&&b==0)return 0;
int x[4],y[4];
for(int i=0;i<4;i++){
x[i]=a%10;
a/=10;
y[i]=b%10;
b/=10;
}

int hit=0,blow=0;
for(int i=0;i<4;i++)if(x[i]==y[i])hit++;
}
for(int i=0;i<4;i++){
for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
}
blow-=hit;

printf("%d %d\n",hit,blow);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected primary-expression before ';' token
    6 | while(;;){
      |       ^
a.cc:6:7: error: expected ')' before ';' token
    6 | while(;;){
      |      ~^
      |       )
a.cc:6:9: error: expected primary-expression before ')' token
    6 | while(;;){
      |         ^
a.cc:22:24: error: 'x' was not declared in this scope
   22 | for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
      |                        ^
a.cc:22:30: error: 'y' was not declared in this scope
   22 | for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
      |                              ^
a.cc:22:35: error: 'blow' was not declared in this scope
   22 | for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
      |                                   ^~~~
a.cc:24:1: error: 'blow' was not declared in this scope
   24 | blow-=hit;
      | ^~~~
a.cc:24:7: error: 'hit' was not declared in this scope
   24 | blow-=hit;
      |       ^~~
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
while(;;){
int a,b;
cin >> a >> b;
if(a==0&&b==0)return 0;
int x[4],y[4];
for(int i=0;i<4;i++){
x[i]=a%10;
a/=10;
y[i]=b%10;
b/=10;
}

int hit=0,blow=0;
for(int i=0;i<4;i++)if(x[i]==y[i])hit++;

for(int i=0;i<4;i++){
for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
}
blow-=hit;

printf("%d %d\n",hit,blow);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected primary-expression before ';' token
    6 | while(;;){
      |       ^
a.cc:6:7: error: expected ')' before ';' token
    6 | while(;;){
      |      ~^
      |       )
a.cc:6:9: error: expected primary-expression before ')' token
    6 | while(;;){
      |         ^
a.cc:27:2: error: expected '}' at end of input
   27 | }
      |  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
while(;;){
int a,b;
cin >> a >> b;
if(a==0&&b==0)return 0;
int x[4],y[4];
for(int i=0;i<4;i++){
x[i]=a%10;
a/=10;
y[i]=b%10;
b/=10;
}

int hit=0,blow=0;
for(int i=0;i<4;i++)if(x[i]==y[i])hit++;

for(int i=0;i<4;i++){
for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
}
blow-=hit;

printf("%d %d\n",hit,blow);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected primary-expression before ';' token
    6 | while(;;){
      |       ^
a.cc:6:7: error: expected ')' before ';' token
    6 | while(;;){
      |      ~^
      |       )
a.cc:6:9: error: expected primary-expression before ')' token
    6 | while(;;){
      |         ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
while(){
int a,b;
cin >> a >> b;
if(a==0&&b==0)return 0;
int x[4],y[4];
for(int i=0;i<4;i++){
x[i]=a%10;
a/=10;
y[i]=b%10;
b/=10;
}

int hit=0,blow=0;
for(int i=0;i<4;i++)if(x[i]==y[i])hit++;

for(int i=0;i<4;i++){
for(int j=0;j<4;j++)if(x[i]==y[j])blow++;
}
blow-=hit;

printf("%d %d\n",hit,blow);
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:7: error: expected primary-expression before ')' token
    6 | while(){
      |       ^
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int hit,brow;
    char a[5],b[5];
    for(;;){
        hit=0,brow=0;
        cin>>a>>b;
        if(a[0]=='0'&&b[0]=='0')break;
        for(int i=0;i<3;i++){
            for(int j=i+1;j<4;j++){
                if(a[i]==b[j]||b[i]==a[j])brow++;
            }
        }
        for(int i=0;i<4;i++){
            if(a[i]==b[i])hit++;
        }
        cout<<hit<<" "<<brow<<endl;
    }

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

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int hit,brow;
    char a[5],b[5];
    for(;;){
        hit=0,brow=0;
        cin>>a>>b;
        if(a[0]=='0'&&a[1]=='\0')break;
        for(int i=0;i<3;i++){
            for(int j=i+1;j<4;j++){
                if(a[i]==b[j]||b[i]==a[j])brow++;
            }
        }
        for(int i=0;i<4;i++){
            if(a[i]==b[i])hit++;
        }
        cout<<hit<<" "<<brow<<endl;
    }

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

#include<iostream>
#include<string>
using namespace std;
string S, T, U; int a[4], b[4], h, v;
int main() {
	while (cin >> S >> T) {
		h = 0; b = 0;
		if (S == "0") { break; }
		for (int i = 0; i < 4; i++) {
			U = S[i] + '0';
			a[i] = stoi(U) / 10;
		}
		for (int i = 0; i < 4; i++) {
			U = T[i] + '0';
			b[i] = stoi(U) / 10;
		}
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				if (a[i] == b[j]) {
					if (i == j) { h++; }
					else { v++; }
				}
			}
		}
		cout << h << ' ' << v << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: error: incompatible types in assignment of 'int' to 'int [4]'
    7 |                 h = 0; b = 0;
      |                        ~~^~~
Language: C++

#include <stdio.h>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
char a[4], b[4]; int  hit, blow;
int main() {
	while (true) {
		scanf("%s %s", a, b);
		if (strlen(a) == 1 && strlen(b) == 1) break;
		hit = 0; blow = 0;
		for (int i = 0; i < 4; i++) {
			if (a[i] == b[i]) hit++;
			for (int j = 0; j < 4; j++) {
				if (i != j && a[i] == b[j]) {
					blow++; break;
				}
			}
		}
		printf("%d %d\n", hit, blow);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: 'strlen' was not declared in this scope
    9 |                 if (strlen(a) == 1 && strlen(b) == 1) break;
      |                     ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 | #pragma warning(disable : 4996)
Language: C++

#include<iostream>
using namespace std;

int main(){
 
 char qwe[6],ans[6];

 int hit,blow,count;

 cin >> qwe >> ans;
 
 while(hit == 4){
    hit = 0 ;
    blow = 0;

   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;
   count++
 }

  while(hit == 4 || count == 0){
    hit = 0 ;
    blow = 0;

   for(int i=0; i<4; i++){
      
       for(int g=0; g<4; g++){

           if(qwe[i] == ans[g]){
               
                if(i == g)
                      hit++;
                else
                      blow++;
            }
       }
    }
   
   cout << hit << " " << blow << endl;
   
   count--;
 }

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:11: error: expected ';' before '}' token
   31 |    count++
      |           ^
      |           ;
   32 |  }
      |  ~
Language: C++

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

int main(){
	int length = 4
	char[length+1] taroNomber;
	char[length+1] hanakoNomber;
	int hitCount = 0;
	int blowCount = 0;
	while(true){
		cin >> taroNomber;
		cin >> hanakoNomber;
		hitCount = 0;
		blowCount = 0;
		if(strlen(taroNomber)==1){
			break;
		}
		for(int i=0;i<length;i++){
			for(int j=0;j<length;j++){
				if(taroNomber[i]==hanakoNomber[j]){
					if(i==j){
						hitCount++;
						break;
					}else{
						blowCount++;
						break;
					}
				}
			}
		}
		cout << hitCount << ' ' << blowCount << '\n';
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: expected ',' or ';' before 'char'
    7 |         char[length+1] taroNomber;
      |         ^~~~
a.cc:8:20: error: expected ']' before '+' token
    8 |         char[length+1] hanakoNomber;
      |                    ^
      |                    ]
a.cc:8:13: error: structured binding declaration cannot have type 'char'
    8 |         char[length+1] hanakoNomber;
      |             ^
a.cc:8:13: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:8:14: error: conflicting declaration 'auto length'
    8 |         char[length+1] hanakoNomber;
      |              ^~~~~~
a.cc:6:13: note: previous declaration as 'int length'
    6 |         int length = 4
      |             ^~~~~~
a.cc:8:24: error: expected initializer before 'hanakoNomber'
    8 |         char[length+1] hanakoNomber;
      |                        ^~~~~~~~~~~~
a.cc:12:24: error: 'taroNomber' was not declared in this scope
   12 |                 cin >> taroNomber;
      |                        ^~~~~~~~~~
a.cc:13:24: error: 'hanakoNomber' was not declared in this scope
   13 |                 cin >> hanakoNomber;
      |                        ^~~~~~~~~~~~
Language: C++

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

int hit(char* s1,char* s2){
	int n=0;
	for(int i=0;i<4);i++){
		if(s1[i]==s2[i]){
			n++:
		}
	}
	return n;
}

int blow(char* s1,char* s2){
	int n=0;
	for(int i=0;i<4;i++){
	if(s1[i]==s2[0]){
		n++:
		}
	if(s1[i]==s2[1]){
		n++:
		}
	if(s1[i]==s2[2]){
		n++:
		}
	if(s1[i]==s2[3]){
		n++:
		}
	}
	return n;
}

int main{
	char r[5],a[5];
	for(int i=0;i<100;i++){
		cin>>r;cin>>a;
		if(r==0&&a==0){
		i=101;
		}
		else{
		cout<<<hit(r,a)<<' '<<blow(r,a)<<endl;
		}
	}
return 0;
}

Compiler output:
a.cc: In function 'int hit(char*, char*)':
a.cc:7:24: error: expected ';' before ')' token
    7 |         for(int i=0;i<4);i++){
      |                        ^
      |                        ;
a.cc:7:26: error: 'i' was not declared in this scope
    7 |         for(int i=0;i<4);i++){
      |                          ^
a.cc: In function 'int blow(char*, char*)':
a.cc:19:20: error: expected ';' before ':' token
   19 |                 n++:
      |                    ^
      |                    ;
a.cc:22:20: error: expected ';' before ':' token
   22 |                 n++:
      |                    ^
      |                    ;
a.cc:25:20: error: expected ';' before ':' token
   25 |                 n++:
      |                    ^
      |                    ;
a.cc:28:20: error: expected ';' before ':' token
   28 |                 n++:
      |                    ^
      |                    ;
a.cc: At global scope:
a.cc:34:5: error: cannot declare '::main' to be a global variable
   34 | int main{
      |     ^~~~
a.cc:35:9: error: expected primary-expression before 'char'
   35 |         char r[5],a[5];
      |         ^~~~
a.cc:35:9: error: expected '}' before 'char'
a.cc:34:9: note: to match this '{'
   34 | int main{
      |         ^
a.cc:36:9: error: expected unqualified-id before 'for'
   36 |         for(int i=0;i<100;i++){
      |         ^~~
a.cc:36:21: error: 'i' does not name a type
   36 |         for(int i=0;i<100;i++){
      |                     ^
a.cc:36:27: error: 'i' does not name a type
   36 |         for(int i=0;i<100;i++){
      |                           ^
a.cc:45:1: error: expected unqualified-id before 'return'
   45 | return 0;
      | ^~~~~~
a.cc:46:1: error: expected declaration before '}' token
   46 | }
      | ^