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

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

void saiki(vector<int> z,int ma,int nk){
if(nk==0) {
for(int i=0;i<z.size();i++) cout<<z[i]<<" ";
cout<<endl;
}
else if(ma*nk!=0){
for(int i=min(ma,nk);i>0;i--){
z.push_back(i);
	saiki(z,i,nk-i);
	z.pop_back();
}
	
	
	
	
}
}	


int main() {
	
	int n;
	while(cin>>n)
if n==0 break;	
	vector<int> z;
	
	cin>>n;
for(int i=n;i>0;i--){
z.push_back(i);
	saiki(z,i,n-i);
z.pop_back();
	
}
	
}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:4: error: expected '(' before 'n'
   28 | if n==0 break;
      |    ^
      |    (
a.cc: At global scope:
a.cc:40:9: error: expected unqualified-id before 'return'
   40 |         return 0;
      |         ^~~~~~
a.cc:41:1: error: expected declaration before '}' token
   41 | }
      | ^
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void){
	int num_data;
	int *data;
	int search_num;
	int i;
	int range_min, range_max, comp_num_array;
	int num_of_comp=0;

	while(1){	
		scanf("%d", &num_data);
		if(num_data == 0)
			return 0;
		
		data = malloc(sizeof(int) * num_data);
		for(i=0 ; i < num_data	 ; i++){
			data[i] = 0;
		}

		for(i=0 ; i < num_data ; i++){
			scanf("%d", &data[i]);
		}
		scanf("%d", &search_num);
		
		range_min = 0;
		range_max = num_data - 1;
		while(1){
			comp_num_array = (range_min + range_max) / 2;
			num_of_comp++;
			//??????????????¨????????????????????´
			if(data[comp_num_array] == search_num){
				printf("%d\n", num_of_comp);
				break;
			}
			//????????????????????????1
			else if(range_min == range_max){
				printf("%d\n", num_of_comp);
				break;
			}
			else if(data[comp_num_array] > search_num){
				range_max = comp_num_array - 1;
			}
			else if(data[comp_num_array] < search_num){
				range_min = comp_num_array + 1;
			}
		}

		num_of_comp = 0;
		free(data);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:30: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   18 |                 data = malloc(sizeof(int) * num_data);
      |                        ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              void*
Language: C++

#include <stdio.h>
#include <windows.h>
int box[30] = { 0 };

void print(){
	int j=0;
	while(box[j]>=1 && box[j]<=100){
		printf("%d ",box[j]);
		j++;
	}
	puts("");
}


void func(int m){
	int now,i,j;
	bool flg=1;
	
	while(flg){
		flg=0;
		for(i=1;i<30;i++){
			if(box[i-1]<box[i]){
				box[i+1]++;
				box[i]--;
			}
				
		}
		print();
		for(i=29;i>=1;i--){
			if(box[i]>=2){
				flg=1;
				box[i]--;
				box[i+1]++;
				break;
			}
		}
		j=0;
		if(box[0]==0)return;
	}
}

int main(void)
{
	int n,kazu,i,j,count;
	while(scanf("%d",&n),n){
		box[0]=n;
		
		for(i=2;i<n;i++){
			box[0]--;
			kazu=30/box[0];
			for(j=1;j<kazu+1;j++){
				box[j]=box[0];
			}
			count = 0;
			for(j=0;j<30;j++){
				count += box[j];
			}
			count-=n;
			
			for(j=29;j>=0;j--){
				while(box[j]!=0){
					box[j]--;
					count--;
					if(count==0)break;
				}
				if(count==0)break;
			}
			
			
			func(box[0]);
			if(i!=n-1){
				for(j=2;j<30;j++){
					box[j]=0;
				}
			}
		}
		j=0;
		while(j<n){
			printf("1 ");
			j++;
		}
		puts("");
	}
	return 0;
}

Compiler output:
a.cc:2:10: fatal error: windows.h: No such file or directory
    2 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
#include<vector>

using namespace std;

int main(void){
		vector<vector<int> > kek[31];
			vector<int> hn;
					vector<int> u;
	while(1){
		
		int n;
		scanf("%d",&n);
		if(n==0){break;}
		for(int i=0;i<31;i++){
			kik[i].clear();
		}
		
		
		for(int i=1;i<=n;i++){
			hn.clear();
			hn.push_back(i);
			kek[i].push_back(hn);
			
			for(int j=i-1;j>0;j--){
				
				for(int k=0;k<kek[i-j].size();k++){
					int flg=0;
					
					for(int p=0;p<kek[i-j][k].size();p++){
						if(kek[i-j][k][p]>j){
							flg=1;
							break;
						}
					}
					
					if(flg==1){
						continue;
					}
					
					u.clear();
					u.push_back(j);
					
					for(int p=0;p<kek[i-j][k].size();p++){
						u.push_back(kek[i-j][k][p]);
					}
					kek[i].push_back(u);
				}
			}
		}
		
		for(int j=0;j<kek[n].size();j++){
			printf("%d",kek[n][j][0]);
			for(int k=1;k<kek[n][j].size();k++){
				printf(" %d",kek[n][j][k]);
			}
			puts("");
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'kik' was not declared in this scope; did you mean 'kek'?
   16 |                         kik[i].clear();
      |                         ^~~
      |                         kek
Language: C++

#include <cstdio>
#include <string>
#include <algorithm>
int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int b[31];
		memset(b, 0, sizeof(b));
		b[0] = n;
		while (true)
		{
			int t = find(b, b+n, 0) - b;
			for (int i = 0; i < t-1; ++i)
				printf("%d ", b[i]);
			printf("%d\n", b[t-1]);

			if (t == n)
				break;

			int u;
			u = t-1;
			while (b[u] == 1)
				--u;
			--b[u];
			++u;
			fill(b+u, b+n, 0);
			int s = t - u + 1;
			while (s--)
			{
				if (b[u] == b[u-1])
					++u;
				++b[u];
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'memset' was not declared in this scope
   10 |                 memset(b, 0, sizeof(b));
      |                 ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <algorithm>
  +++ |+#include <cstring>
    4 | int main()
a.cc:14:33: error: 'find' was not declared in this scope; did you mean 'std::find'?
   14 |                         int t = find(b, b+n, 0) - b;
      |                                 ^~~~
      |                                 std::find
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: 'std::find' declared here
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
a.cc:28:25: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
   28 |                         fill(b+u, b+n, 0);
      |                         ^~~~
      |                         std::fill
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
Language: C++

#include <cstdio>
#include <cstring>
#include <algorithm>
int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		int b[31];
		memset(b, 0, sizeof(b));
		b[0] = n;
		while (true)
		{
			int t = find(b, b+n, 0) - b;
			for (int i = 0; i < t-1; ++i)
				printf("%d ", b[i]);
			printf("%d\n", b[t-1]);

			if (t == n)
				break;

			int u;
			u = t-1;
			while (b[u] == 1)
				--u;
			--b[u];
			++u;
			fill(b+u, b+n, 0);
			int s = t - u + 1;
			while (s--)
			{
				if (b[u] == b[u-1])
					++u;
				++b[u];
			}
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:33: error: 'find' was not declared in this scope; did you mean 'std::find'?
   14 |                         int t = find(b, b+n, 0) - b;
      |                                 ^~~~
      |                                 std::find
In file included from /usr/include/c++/14/algorithm:86,
                 from a.cc:3:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:60:1: note: 'std::find' declared here
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
a.cc:28:25: error: 'fill' was not declared in this scope; did you mean 'std::fill'?
   28 |                         fill(b+u, b+n, 0);
      |                         ^~~~
      |                         std::fill
/usr/include/c++/14/pstl/glue_algorithm_defs.h:191:1: note: 'std::fill' declared here
  191 | fill(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
Language: C++

#include <cstdio>
#include <algorithm>
int block[31];
void recur(int t, int b)
{
	if (b == 0)
	{
		int i;
		for (i = 0; block[i + 1]; ++i)
			printf("%d ", block[i]);
		printf("%d\n", block[i]);
		return;
	}

	for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
	{
		block[t] = i;
		recur(t + 1, b - i);
		block[t] = 0;
	}
}
int main()
{
	int n;
	while (scanf("%d", &n), n)
	{
		recur(0, n);
	}
}

Compiler output:
a.cc: In function 'void recur(int, int)':
a.cc:15:22: error: 'min' was not declared in this scope; did you mean 'std::min'?
   15 |         for (int i = min(b, t ? block[t - 1] : 99); i > 0; --i)
      |                      ^~~
      |                      std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

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

int main(void)
{
	int n;
	while (cin >> n, n){
		vector <int> v(30);
		fill(v.begin(), v.end(), 0);
		v[0] = n;
		cout << v[0] << endl;
		while ((count(v.begin(), v.end(), 1)) != n){
			int s = 0;
			for (int i = 0; i < v.size() && 0 < v[i]; i++){
				s++;
			}
			
			int i = s - 1;
			for (; 0 <= i; i--){
				if (v[i] != 1){
					break;
				}
			}
			if (v[i] == 2){
				v[i]--;
				v[s] = 1;
			}
			else {
				v[i]--;
				v[i + 1]++;
			}
			if (v[i + 1] == 1) s++;
			
			for (int i = 0; i < s; i++){
				cout << v[i];
				if (i + 1 == s) puts("");
				else cout << " ";
			}
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'count' was not declared in this scope
   14 |                 while ((count(v.begin(), v.end(), 1)) != n){
      |                         ^~~~~
Language: C++

t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}

Compiler output:
a.cc:1:1: error: 't' does not name a type
    1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
      | ^
a.cc:1:8: error: expected constructor, destructor, or type conversion before '(' token
    1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
      |        ^
a.cc:1:114: error: expected constructor, destructor, or type conversion before '(' token
    1 | t[],j;f(n,m,i){if(n)for(m>n?m=n:0;m;m--)f(n-m,t[i]=m,i+1);else for(j=3;j<i;)printf(j-i?"%d ":"%d\n",t[j++]);}main(n){for(;scanf("%d",&n)*n;)f(n,n,3);}
      |                                                                                                                  ^
Language: C++

#include<iostream>
#include<string>
#include<boost/lexical_cast.hpp>
using namespace std;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n == 0) break;
		string s;
		cin >> s;
		for(int i = 0;i < n;i++){
			string ans;
			for(int j = 0;j < s.length();j++){
				size_t k = j;
				while(s[k] == s[j] && k < s.length()) k++;
				ans += boost::lexical_cast<string>(k - j) + s[j];
				j += (k - j) - 1;
			}
			s = ans;
		}
		cout << s << endl;
	}
	
	return 0;
}

Compiler output:
a.cc:3:9: fatal error: boost/lexical_cast.hpp: No such file or directory
    3 | #include<boost/lexical_cast.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>

int saikii(int *zi,int zisu,int zan);

int main(void){
  int n=0;
  //while(1){
    scanf("%d",&n);
    if(n==0)break;
    int wat[20]={0};
    saikii(wat,0,n);
  //}
  return 0;
}

int saikii(int *zi,int zisu,int zan){
  int i=0;
  printf("%d\x0020",zan);
  for(i=zisu-1;i>-1;i--){
    printf("%d\x0020",zi[i]);
  }
  printf("\n");
  if(zan!=1){
    for(i=1;i<zan;i++){
      zi[zisu]=i;
      saikii(zi,zisu+1,zan-i);
      zi[zisu]=0;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: break statement not within loop or switch
    9 |     if(n==0)break;
      |             ^~~~~
Language: C++

#include <cstdio>

int saikii(int *zi,int zisu,int zan);

int main(void){
  int n=0;
  /*while(1){*/
    scanf("%d",&n);
    if(n==0)break;
    int wat[20]={0};
    saikii(wat,0,n);
  /*}*/
  return 0;
}

int saikii(int *zi,int zisu,int zan){
  int i=0;
  printf("%d\x0020",zan);
  for(i=zisu-1;i>-1;i--){
    printf("%d\x0020",zi[i]);
  }
  printf("\n");
  if(zan!=1){
    for(i=1;i<zan;i++){
      zi[zisu]=i;
      saikii(zi,zisu+1,zan-i);
      zi[zisu]=0;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: break statement not within loop or switch
    9 |     if(n==0)break;
      |             ^~~~~
Language: C++

#include <cstdio>

int saikii(int *zi,int zisu,int zan);

int main(void){
  int n=0;
  
    scanf("%d",&n);
    if(n==0)break;
    int wat[20]={0};
    saikii(wat,0,n);
  
  return 0;
}

int saikii(int *zi,int zisu,int zan){
  int i=0;
  printf("%d\x0020",zan);
  for(i=zisu-1;i>-1;i--){
    printf("%d\x0020",zi[i]);
  }
  printf("\n");
  if(zan!=1){
    for(i=1;i<zan;i++){
      zi[zisu]=i;
      saikii(zi,zisu+1,zan-i);
      zi[zisu]=0;
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:13: error: break statement not within loop or switch
    9 |     if(n==0)break;
      |             ^~~~~
Language: C++

#include<iostream>

int res[50];

void calc(int a, int b){
	if (a == 0){
		for (int i = 1; i < b; i++)std::cout << res[i] << " ";
		std::cout << std::endl;
		return;
	}
	for (int i = a; i >= 1; i--){
		if (res[b - 1] >= i){
			res[b] = i;
			calc(a - i, b + 1);
		}
	}
	return;
}


int main(){

	int n;
	while (std::cin >> n, n){
		memset(res, 0, sizeof(res));
		res[0] = 10000000;
		calc(n, 1);
	}

	return 0;
}

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

#include<stdio.h>
int n;
int c[100][2];

int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
  int i;
  int prol,nowl;
  prol = nowl = l;
  for(i=0;i<n;i++){
    if(c[i][0]==e && done[c[i][1]-1]==0){
      prol = chain(c[i][1],nowl+1);
      done[c[i][1]-1] = 1;
    }
    if(c[i][1]==e && done[c[i][0]-1]==0){
      prol = chain(c[i][0],nowl+1);
      done[c[i][0]-1] = 1;
    }
    if(prol>l){
      l = prol;
    }
  }
  return l;
}

main(){
  int i;
  int done;
  int ans,preans;
  while(scanf("%d",&n)!=0){
    for(i=0;i<n;i++){
      scanf("%d %d",&c[i][0],&c[i][1]);
    }
    for(i=0;i<100;i++){
      done[i]=0;
    }
    ans = 0;
    for(i=1;i<=100;i++){
      preans = chain(i,0,done);
      if(preans>ans){
        ans = preans;
      }
    }
    printf("%d\n",ans);
  }
}

Compiler output:
main.c: In function 'chain':
main.c:11:14: error: too few arguments to function 'chain'
   11 |       prol = chain(c[i][1],nowl+1);
      |              ^~~~~
main.c:5:5: note: declared here
    5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
      |     ^~~~~
main.c:15:14: error: too few arguments to function 'chain'
   15 |       prol = chain(c[i][0],nowl+1);
      |              ^~~~~
main.c:5:5: note: declared here
    5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
      |     ^~~~~
main.c: At top level:
main.c:25:1: error: return type defaults to 'int' [-Wimplicit-int]
   25 | main(){
      | ^~~~
main.c: In function 'main':
main.c:34:11: error: subscripted value is neither array nor pointer nor vector
   34 |       done[i]=0;
      |           ^
main.c:38:26: error: passing argument 3 of 'chain' makes pointer from integer without a cast [-Wint-conversion]
   38 |       preans = chain(i,0,done);
      |                          ^~~~
      |                          |
      |                          int
main.c:5:27: note: expected 'int *' but argument is of type 'int'
    5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
      |                       ~~~~^~~~~~
Language: C

#include<stdio.h>
int n;
int c[100][2];

int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
  int i;
  int prol,nowl;
  prol = nowl = l;
  for(i=0;i<n;i++){
    if(c[i][0]==e && done[c[i][1]-1]==0){
      prol = chain(c[i][1],nowl+1);
      done[c[i][1]-1] = 1;
    }
    if(c[i][1]==e && done[c[i][0]-1]==0){
      prol = chain(c[i][0],nowl+1);
      done[c[i][0]-1] = 1;
    }
    if(prol>l){
      l = prol;
    }
  }
  return l;
}

main(){
  int i;
  int done[100];
  int ans,preans;
  while(scanf("%d",&n)!=0){
    for(i=0;i<n;i++){
      scanf("%d %d",&c[i][0],&c[i][1]);
    }
    for(i=0;i<100;i++){
      done[i]=0;
    }
    ans = 0;
    for(i=1;i<=100;i++){
      preans = chain(i,0,done);
      if(preans>ans){
        ans = preans;
      }
    }
    printf("%d\n",ans);
  }
}

Compiler output:
main.c: In function 'chain':
main.c:11:14: error: too few arguments to function 'chain'
   11 |       prol = chain(c[i][1],nowl+1);
      |              ^~~~~
main.c:5:5: note: declared here
    5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
      |     ^~~~~
main.c:15:14: error: too few arguments to function 'chain'
   15 |       prol = chain(c[i][0],nowl+1);
      |              ^~~~~
main.c:5:5: note: declared here
    5 | int chain(int e,int l,int done[]){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
      |     ^~~~~
main.c: At top level:
main.c:25:1: error: return type defaults to 'int' [-Wimplicit-int]
   25 | main(){
      | ^~~~
Language: C

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

int n,G[100][100];
int D[100];

int size(int m)
{
    int r=1;
    for(int i=0;i<100;i++){
        if(G[m][i]&&!D[i]){
            D[i]=1;
            r=max(r,1+size(i));
            D[i]=0;
        }
    }
    return r;
}

int main()
{
    while(scanf("%d",&n),n){
        int r=0;
        memset(G,0,sizeof(G));
        while(n--){
            int a,b;
            scanf("%d%d",&a,&b);
            G[a-1][b-1]=G[b-1][a-1]=1;
        }
        for(int i=0;i<100;i++){
            memset(D,0,sizeof(D));
            D[i]=1;
            r=max(r,size(i));
            D[i]=0;
        } 
        printf("%d\n",r);
    }
}

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

#include<stdio.h>
#include<string.h>
#define max(x,y) ((x) > (y) ? (x) : (y))
#define min(x,y) ((x) < (y) ? (x) : (y))

int neib[101][200];
int used[101];
int onceused[101];

int dfs(int x){
  int i;
  used[x] = 1;
  onceused[x] = 1;
  int res = 1;
  for(i = 1;i <= neib[x][0];i++){
    if(used[neib[x][i]] == 0){
      int tmp = dfs(neib[x][i]);
      res = max(res, 1 + tmp);
    }
  }
  used[x] = 0;
  return res;
}


int main(){
  int i, j;
  while(1){
    int n, ans = 0;
    rings[0] = 0;
    for(i = 0;i < 101;i++)neib[i][0] = 0;
    scanf("%d", &n);
    if(n == 0)return 0;
    for(i = 0;i < n;i++){
      int a, b; 
      scanf("%d%d", &a, &b);
      rings[++rings[0]] = a;
      rings[++rings[0]] = b;
      neib[a][++neib[a][0]] = b;
      neib[b][++neib[b][0]] = a;
    }
    memset(onceused, 0, sizeof(onceused));
    memset(used, 0, sizeof(used));
    for(i = 1;i < 101;i++){
      for(j = 1;j <= rings[0];j++){
	if(neib[rings[j]][0] == i){
	  int tmp = dfs(rings[j]);
	  ans = max(ans,tmp);
	}
      }
      int fin = 1;
      for(j = 1;j <= rings[0];j++){
	if(onceused[rings[j]] == 0){
	  fin = 0;
	  break;
	}
      }
      if(fin)break;
    }
    printf("%d\n",ans);
  }
}

Compiler output:
main.c: In function 'main':
main.c:30:5: error: 'rings' undeclared (first use in this function)
   30 |     rings[0] = 0;
      |     ^~~~~
main.c:30:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#define rep(i,n) for(int (i)=0;(i) < (n);(i)++)
#define MAX 110
using namespace std;
vector<int> G[MAX];
bool flag[MAX];

int dfs(int now){
    flag[now]=1;
    int ret = 1;
    rep(i,G[now].size()){
        if(flag[G[now][i]]==0)
            ret = max(ret,dfs(G[now][i])+1);
    }
    flag[now]=0;
    return ret;
}

int main() {
    int n;
    while(scanf("%d",&n),n!=0){
        rep(i,MAX){
            G[i].clear();
            flag[i]=0;
        }
        int x,y;
        rep(i,n){
            scanf("%d %d",&x,&y);
            x--;
            y--;
            G[x].push_back(y);
            G[y].push_back(x);
        }
        rep(i,MAX){
            if(G[i].empty())
                break;
            sort(G[i].begin(),G[i].end());
            G[i].erase(unique(G[i].begin(),G[i].end()),G[i].end());
        }
        int ret = 0;
        rep(i,MAX){
            ret = max(ret,dfs(i));
        }
        printf("%d\n",ret);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   41 |             sort(G[i].begin(),G[i].end());
      |             ^~~~
      |             short
a.cc:42:24: error: 'unique' was not declared in this scope
   42 |             G[i].erase(unique(G[i].begin(),G[i].end()),G[i].end());
      |                        ^~~~~~
Language: C++

import Control.Monad (replicateM)
import Data.Array (Array,array,(!),bounds)

main = do
    n <- readLn
    if n == 0 then return () else do
        ps <- replicateM n (getLine >>= return . (\[a,b]->(a,b)) . map read . words)
        print $ maxLength $ strings ps
        main

type Strings = Array Int [Int]

strings :: [(Int,Int)] -> Strings
strings ps = array (b0,b1) [(i,otherside i)|i<-[b0..b1]]
    where
    otherside a = [b|(a',b)<-ps,a'==a] ++ [b|(b,a')<-ps,a'==a]
    b0 = min (minimum (map fst ps)) (minimum (map snd ps))
    b1 = max (maximum (map fst ps)) (maximum (map snd ps))

maxLength strings = maxLength' initChain 1
    where
    (b0,b1) = bounds strings
    initChain = [[i]|i<-[b0..b1], length (strings!i) > 0]

    maxLength' []     n = n-1
    maxLength' chains n = maxLength' (chains >>= augment strings) (n+1)

    augment strings chain = map (:chain) newRings
        where
        newRings = filter (not . (`elem` chain)) (strings ! (head chain))

Compiler output:
a.cc:7:51: error: stray '\' in program
    7 |         ps <- replicateM n (getLine >>= return . (\[a,b]->(a,b)) . map read . words)
      |                                                   ^
a.cc:16:24: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
   16 |     otherside a = [b|(a',b)<-ps,a'==a] ++ [b|(b,a')<-ps,a'==a]
      |                        ^~~~~~~~~~~
a.cc:16:50: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
   16 |     otherside a = [b|(a',b)<-ps,a'==a] ++ [b|(b,a')<-ps,a'==a]
      |                                                  ^~~~~~~~~
a.cc:20:30: warning: missing terminating ' character
   20 | maxLength strings = maxLength' initChain 1
      |                              ^
a.cc:20:30: error: missing terminating ' character
   20 | maxLength strings = maxLength' initChain 1
      |                              ^~~~~~~~~~~~~
a.cc:25:14: warning: missing terminating ' character
   25 |     maxLength' []     n = n-1
      |              ^
a.cc:25:14: error: missing terminating ' character
   25 |     maxLength' []     n = n-1
      |              ^~~~~~~~~~~~~~~~
a.cc:26:14: warning: multi-character literal with 21 characters exceeds 'int' size of 4 bytes
   26 |     maxLength' chains n = maxLength' (chains >>= augment strings) (n+1)
      |              ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:30:35: error: stray '`' in program
   30 |         newRings = filter (not . (`elem` chain)) (strings ! (head chain))
      |                                   ^
a.cc:30:40: error: stray '`' in program
   30 |         newRings = filter (not . (`elem` chain)) (strings ! (head chain))
      |                                        ^
a.cc:1:1: error: 'import' does not name a type
    1 | import Control.Monad (replicateM)
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <stdio.h>

#define		N	101

int find_length(int a, int cur_length);

int		conn[N][N];
int		used[N];

int main()
{
    int		i, j;
    int		a, b;
    int		n;
    int		max_length, length;

    while(1)
    {
	for(j = 0; j < N; j++)
	{
	    for(i = 0; i < N; i++)
	    {
		conn[j][i] = 0;
	    }
	}

	scanf("%d", &n);
	if (n == 0)
	{
	    break;
	}
	for(int i = 0; i < n; i++)
	{
	    scanf("%d %d", &a, &b);
	    conn[a][b] = 1;
	    conn[b][a] = 1;
	}

	for(a = 0; a < N; a++)
	{
	    used[a] = 0;
	}

	max_length = 0;
	for(a = 0; a < N; a++)
	{
	    length = find_length(a, 1);
	    if (length > max_length)
	    {
		max_length = length;
	    }
	}
	printf("%d\n", max_length);
    }
}

Compiler output:
/usr/bin/ld: /tmp/ccNi3rcs.o: in function `main':
a.cc:(.text+0x1a2): undefined reference to `find_length(int, int)'
collect2: error: ld returned 1 exit status
Language: C++

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

using namespace std;

vector<vector<int> > G;

vector<bool> used;

int rec(int pos)
{
    used[pos] = true; int ret = 1;
    
    for(int i = 0; i < G[pos].size(); i++)
    {
        if(!used[G[pos][i]])
        {
            ret = max(ret, rec(G[pos][i], used) + 1);
        }
    }
    
    used[pos] = false;
    
    return ret;
}

int main()
{
    int N, A, B;
    
    while(true)
    {
        scanf("%d", &N);
        
        if(N == 0) { break; }

        G = vector<vector<int> >(100, vector<int>());
    
        for(int i = 0; i < N; i++)
        {
            scanf("%d", &A); A--;
            scanf("%d", &B); B--;
        
            G[A].push_back(B);
            G[B].push_back(A);
        }
    
        int ret = 0;
    
        for(int i = 0; i < 100; i++)
        {
            if(G[i].size())
            {
                ret = max(ret));
            }
        }
        
        printf("%d\n", ret);
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int rec(int)':
a.cc:19:31: error: too many arguments to function 'int rec(int)'
   19 |             ret = max(ret, rec(G[pos][i], used) + 1);
      |                            ~~~^~~~~~~~~~~~~~~~~
a.cc:11:5: note: declared here
   11 | int rec(int pos)
      |     ^~~
a.cc: In function 'int main()':
a.cc:55:26: error: no matching function for call to 'max(int&)'
   55 |                 ret = max(ret));
      |                       ~~~^~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:55:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   55 |                 ret = max(ret));
      |                       ~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

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

using namespace std;

vector<vector<int> > G;

vector<bool> used;

int rec(int pos)
{
    used[pos] = true; int ret = 1;
    
    for(int i = 0; i < G[pos].size(); i++)
    {
        if(!used[G[pos][i]])
        {
            ret = max(ret, rec(G[pos][i]) + 1);
        }
    }
    
    used[pos] = false;
    
    return ret;
}

int main()
{
    int N, A, B;
    
    while(true)
    {
        scanf("%d", &N);
        
        if(N == 0) { break; }

        G = vector<vector<int> >(100, vector<int>());
    
        for(int i = 0; i < N; i++)
        {
            scanf("%d", &A); A--;
            scanf("%d", &B); B--;
        
            G[A].push_back(B);
            G[B].push_back(A);
        }
    
        int ret = 0;
    
        for(int i = 0; i < 100; i++)
        {
            if(G[i].size())
            {
                ret = max(ret));
            }
        }
        
        printf("%d\n", ret);
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:55:26: error: no matching function for call to 'max(int&)'
   55 |                 ret = max(ret));
      |                       ~~~^~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:55:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   55 |                 ret = max(ret));
      |                       ~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int N, A, B, v[100], r[100], G[100][199];
int rec(int pos) {
	u[pos] = 1; int ret = 0;
	for(int i = 0; i < rings[pos]; i++) {
		if(!u[G[pos][i]]) ret = max(ret, rec(G[pos][i]));
	}
	u[pos] = 0;
	return ret + 1;
}
int main() {
	while(scanf("%d%d", &N), N) {
		for(int i = 0; i < 100; i++) r[i] = 0;
		for(int i = 0; i < N; i++) {
			scanf("%d%d", &A, &B), A--, B--;
			G[A][r[A]++] = B;
			G[B][r[B]++] = A;
		}
		int ret = 0;
		for(int i = 0; i < 100; i++) {
			if(r[i]) ret = max(ret, rec(i));
		}
		printf("%d\n", ret);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int rec(int)':
a.cc:6:9: error: 'u' was not declared in this scope
    6 |         u[pos] = 1; int ret = 0;
      |         ^
a.cc:7:28: error: 'rings' was not declared in this scope
    7 |         for(int i = 0; i < rings[pos]; i++) {
      |                            ^~~~~
Language: C++

#include <stdio.h>
#include <algorithm>
using namespace std;
int N, A, B, v[100], r[100], G[100][199];
int rec(int pos) {
	v[pos] = 1; int ret = 0;
	for(int i = 0; i < rings[pos]; i++) {
		if(!v[G[pos][i]]) ret = max(ret, rec(G[pos][i]));
	}
	v[pos] = 0;
	return ret + 1;
}
int main() {
	while(scanf("%d%d", &N), N) {
		for(int i = 0; i < 100; i++) r[i] = 0;
		for(int i = 0; i < N; i++) {
			scanf("%d%d", &A, &B), A--, B--;
			G[A][r[A]++] = B;
			G[B][r[B]++] = A;
		}
		int ret = 0;
		for(int i = 0; i < 100; i++) {
			if(r[i]) ret = max(ret, rec(i));
		}
		printf("%d\n", ret);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int rec(int)':
a.cc:7:28: error: 'rings' was not declared in this scope
    7 |         for(int i = 0; i < rings[pos]; i++) {
      |                            ^~~~~
Language: C++

#include <stdio.h>
int N, A, B, v[111], r[111], G[111][222];
int rec(int pos) {
	int ret = 0; v[pos] = 1;
	for (int i = 0; i < r[pos]; i++) {
		if (!v[G[pos][i]]) {
			int w = rec(G[pos][i]);
			ret = ret > w ? ret : w;
		}
	}
	v[pos] = 0;
	return ret + 1;
}
int main() {
	while (scanf("%d", &N), N) {
		for (int i = 0; i < 100; i++) r[i] = 0;
		for (int i = 0; i < N; i++) {
			scanf("%d%d", &A, &B), A--, B--;
			G[A][r[A]++] = B, G[B][r[B]++] = A;
		}
		int ret = 0;
		for (int i = 0; i < 100; i++) ret = max(ret, rec(i));
		printf("%d\n", ret);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:53: error: 'max' was not declared in this scope
   22 |                 for (int i = 0; i < 100; i++) ret = max(ret, rec(i));
      |                                                     ^~~
Language: C++

#include <stdio.h>
int N, A, B, v[111], r[111], G[111][222];
int rec(int pos) {
	int ret = 0; v[pos] = 1;
	for (int i = 0; i < r[pos]; i++) {
		if (!v[G[pos][i]]) {
			int w = rec(G[pos][i]);
			ret = ret > w ? ret : w;
		}
	}
	v[pos] = 0;
	return ret + 1;
}
int main() {
	while (scanf("%d", &N), N) {
		for (int i = 0; i < 100; i++) r[i] = 0;
		for (int i = 0; i < N; i++) {
			scanf("%d%d", &A, &B), A--, B--;
			G[A][r[A]++] = B, G[B][r[B]++] = A;
		}
		int ret = 0;
		for (int i = 0; i < 100; i++) {
			int w = rec(i);
			ret = ret > w ? ret : w);
		}
		printf("%d\n", ret);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:48: error: expected ';' before ')' token
   24 |                         ret = ret > w ? ret : w);
      |                                                ^
      |                                                ;
Language: C++

7
1 3
3 4
1 4
2 7
5 7
6 7
1 7
6
1 2
2 3
3 4
4 5
1 5
2 6
7
1 3
2 4
3 5
4 6
6 7
2 6
4 7
0

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

#include<stdio.h>
int n;
int done[100];
int c[100][2];

main(){
  int i;
  int ans,preans;
  while(scanf("%d",&n)!=0){
    for(i=0;i<n;i++){
      scanf("%d %d",&c[i][0],&c[i][1]);
    }
    for(i=0;i<100;i++){
      done[i]=0;
    }
    ans = 0
    for(i=1;i<=100;i++){
      preans = chain(i,0);
      if(preans>ans){
        ans = preans;
      }
    }
    printf("%d\n",ans);
  }
}

int chain(int e,int l){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
  int i;
  int prol,nowl;
  prol = nowl = l;
  for(i=0;i<n;i++){
    if(c[i][0]==e && done[c[i][1]-1]==0){
      prol = chain(c[i][1],nowl+1);
      done[c[i][1]-1] = 1;
    }
    if(c[i][1]==e && done[c[i][0]-1]==0){
      prol = chain(c[i][0],nowl+1);
      done[c[i][0]-1] = 1;
    }
    if(prol>l){
      l = prol;
    }
  }
  return l;
}

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:12: error: expected ';' before 'for'
   16 |     ans = 0
      |            ^
      |            ;
   17 |     for(i=1;i<=100;i++){
      |     ~~~     
a.cc:17:23: error: expected ';' before ')' token
   17 |     for(i=1;i<=100;i++){
      |                       ^
      |                       ;
Language: C++

#include<stdio.h>
int n;
int done[100];
int c[100][2];

main(){
  int i;
  int ans,preans;
  while(scanf("%d",&n)!=0){
    for(i=0;i<n;i++){
      scanf("%d %d",&c[i][0],&c[i][1]);
    }
    for(i=0;i<100;i++){
      done[i]=0;
    }
    ans = 0;
    for(i=1;i<=100;i++){
      preans = chain(i,0);
      if(preans>ans){
        ans = preans;
      }
    }
    printf("%d\n",ans);
  }
}

int chain(int e,int l){ /*done???????????°????????¨??¶??????????????????e??????????????????l???*/
  int i;
  int prol,nowl;
  prol = nowl = l;
  for(i=0;i<n;i++){
    if(c[i][0]==e && done[c[i][1]-1]==0){
      prol = chain(c[i][1],nowl+1);
      done[c[i][1]-1] = 1;
    }
    if(c[i][1]==e && done[c[i][0]-1]==0){
      prol = chain(c[i][0],nowl+1);
      done[c[i][0]-1] = 1;
    }
    if(prol>l){
      l = prol;
    }
  }
  return l;
}

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:18:16: error: 'chain' was not declared in this scope
   18 |       preans = chain(i,0);
      |                ^~~~~
Language: C++

#include<cstdio>
#include<stack>
#include<vector>


using namespace std;

vector<int> vec[1001];
bool ch[101]={};
stack<int> st;


void DFS(int i,int val){
    if(val > maxx)maxx = val;
    //printf("%d ",i);
    for (int k=0; k<vec[i].size(); k++) {
        if(!ch[vec[i][k]]){
            ch[vec[i][k]] = true;
            DFS(vec[i][k],val+1);
            ch[vec[i][k]] = false;
        }
    }
}

int main(){
    int maxx = -1;
    int n,a,b;
    scanf("%d",&n);
    if(n == 0)return 0;
    for (int i=0; i<n; i++) {
        scanf("%d %d",&a,&b);
        vec[a].push_back(b);
        vec[b].push_back(a);
    }
    for (int i=1; i<=n; i++) {
        ch[i] = true;
        DFS(i,0);
        ch[i] = false;
    }
    printf("%d\n",maxx+1);
    vec.clear();
    main();
    
    
}

Compiler output:
a.cc: In function 'void DFS(int, int)':
a.cc:14:14: error: 'maxx' was not declared in this scope
   14 |     if(val > maxx)maxx = val;
      |              ^~~~
a.cc: In function 'int main()':
a.cc:41:9: error: request for member 'clear' in 'vec', which is of non-class type 'std::vector<int> [1001]'
   41 |     vec.clear();
      |         ^~~~~
Language: C++

from collections import defaultdict


class GraphChain():
  def __init__(self):
    self.graph = defaultdict(set)
    self.passed = defaultdict(bool)
    self.route = defaultdict(bool)
    self.ans = 0

  def dfs(self, left, count):
    '''
      depth first search
    '''
    for i in range(len(self.graph[left])):
      if self.passed[self.graph[left][i]] == False:
        # mark passed point
        self.passed[self.graph[left][i]] = True

        # if next route is more than two, this node is never become start point.
        if len(self.graph[left]) > 2:
          self.route[self.graph[left][i]] = True
        temp = self.dfs(self.graph[left][i], count + 1)
        self.ans = self.ans if self.ans > temp else temp

        # delete mark of point.
        self.passed[self.graph[left][i]] = False

    return count

  def get_string_pair(self, num):
    '''
      get string and make dictionary.
    '''
    self.graph = defaultdict(list)
    for i in range(num):
      left, righ = [int(j) for j in input().strip().split()]
      self.graph[left].append(righ)
      self.graph[righ].append(left)

    return self.graph

  def count_chain(self, num):
    '''
      main function of this problem.
    '''
    self.get_string_pair(num)
    print(self.graph)
    for key in sorted(self.graph.keys()):
      if self.route[key] == False:
        self.dfs(key, 1)

    return self.ans - 1


while 1:
  gc = GraphChain()
  x = int(input())
  if x == 0:
    break
  print(gc.count_chain(x))
  del gc

Compiler output:
a.cc:12:5: error: empty character constant
   12 |     '''
      |     ^~
a.cc:12:7: warning: missing terminating ' character
   12 |     '''
      |       ^
a.cc:12:7: error: missing terminating ' character
a.cc:14:5: error: empty character constant
   14 |     '''
      |     ^~
a.cc:14:7: warning: missing terminating ' character
   14 |     '''
      |       ^
a.cc:14:7: error: missing terminating ' character
a.cc:17:11: error: invalid preprocessing directive #mark
   17 |         # mark passed point
      |           ^~~~
a.cc:20:19: error: missing binary operator before token "route"
   20 |         # if next route is more than two, this node is never become start point.
      |                   ^~~~~
a.cc:32:7: warning: missing terminating ' character
   32 |     '''
      |       ^
a.cc:34:7: warning: missing terminating ' character
   34 |     '''
      |       ^
a.cc:44:7: warning: missing terminating ' character
   44 |     '''
      |       ^
a.cc:46:7: warning: missing terminating ' character
   46 |     '''
      |       ^
a.cc:20: error: unterminated #if
   20 |         # if next route is more than two, this node is never become start point.
a.cc:1:1: error: 'from' does not name a type
    1 | from collections import defaultdict
      | ^~~~
Language: C++

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

int solve(int idx, const vector<vector<int> >& path, vector<int>& visited, int cnt)
{
	if (visited[idx])
		return cnt;

	int ans = cnt;
	visited[idx] = 1;
	for (int i = 0; i < 100; ++i) {
		if (!visited[i] && path[idx][i])
			ans = max(ans, solve(i, path, visited, cnt+1));
	}
	return ans;
}

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

	int n;
	while (scanf("%d", &n) != EOF) {
		if (n == 0)
			break;

		vector<vector<int> > path(100, vector<int>(100, 0));
		for (int i = 0; i < n; ++i) {
			int a, b;
			scanf("%d %d", &a, &b);
			--a;
			--b;
			path[a][b] = path[b][a] = 1;
		}

		int ans = 0;
		for (int i = 0; i < 100; ++i)
			ans = max(ans, solve(i, path, vector<int>(100, 0), 1));
		printf("%d\n", ans);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:55: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
   40 |                         ans = max(ans, solve(i, path, vector<int>(100, 0), 1));
      |                                                       ^~~~~~~~~~~~~~~~~~~
a.cc:6:67: note:   initializing argument 3 of 'int solve(int, const std::vector<std::vector<int> >&, std::vector<int>&, int)'
    6 | int solve(int idx, const vector<vector<int> >& path, vector<int>& visited, int cnt)
      |                                                      ~~~~~~~~~~~~~^~~~~~~
Language: C++

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

vector<int> G[101];
bool passed[101];
int maxPath=0;


void dfs(int s,int depth){
	maxPath=max(maxPath,depth);
	if(maxPath==100)
		return;
	for(int i = 0; i<G[s].size(); i++){
		if(!passed[G[s][i]]){
			passed[G[s][i]]=true;
			dfs(G[s][i],depth+1);
			passed[G[s][i]]=false;
			if(maxPath==100)
				return;
		}
	}
}

int main(){

	int n;n
	while(cin>>n&&n!=0){
		maxPath=0;
		filnll(passed,passed+101,false);
		for(int i = 0; i < 101; i++)
			G[i].clear();
		for(int i = 0; i < n; i++){
			int a,b;
			cin>>a>>b;
			a--;
			b--;
			G[a].push_back(b);
			G[b].push_back(a);
		}
		for(int i = 0; i < 100; i++){
			passed[i]=true;
			dfs(i,1);
			if(maxPath==100)
				break;
			passed[i]=false;
		}
		cout<<maxPath<<endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: expected ';' before 'while'
   28 |         int n;n
      |                ^
      |                ;
   29 |         while(cin>>n&&n!=0){
      |         ~~~~~
Language: C++

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

vector<int> G[101];
bool passed[101];
int maxPath=0;
int maxNode;
bool isAppeared[101];

void dfs(int s,int depth){
	maxPath=max(maxPath,depth);
	if(maxPath==maxNode)
		return;
	for(int i = 0; i<G[s].size(); i++){
		if(!passed[G[s][i]]){
			passed[G[s][i]]=true;
			dfs(G[s][i],depth+1);
			passed[G[s][i]]=false;
			if(maxPath==maxNode)
				return;
		}
	}
}

int main(){
	int n;
	while(cin>>n&&n!=0){
		maxPath=0;
		fill(passed,passed+101,false);
		fill(isAppeared,isAppeared+101,false);
		for(int i = 0; i < 101; i++)
			G[i].clear();
		//set<int> s;
		for(int i = 0; i < n; i++){
			int a,b;
			cin>>a>>b;
			a--;
			b--;
			//s.insert(a);
			//s.insert(b);
			isAppeared[a]=true;
			isAppeared[b]=true;
			G[a].push_back(b);
			G[b].push_back(a);
		}
		maxNode=s.size();
		for(int i = 0; i < 101; i++){
			if(!isAppeared[i])
				continue;
			passed[i]=true;
			dfs(i,1);
			if(maxPath==maxNode)
				break;
			passed[i]=false;
		}
		cout<<maxPath<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:25: error: 's' was not declared in this scope
   49 |                 maxNode=s.size();
      |                         ^
Language: C++

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

vector<int> G[101];
bool passed[101];
int maxPath=0;
int maxNode;

void dfs(int s,int depth){
	maxPath=max(maxPath,depth);
	if(maxPath==maxNode)
		return;
	for(int i = 0; i<G[s].size(); i++){
		int to=G[s][i];
		if(!passed[to]){
			passed[to]=true;
			dfs(to,depth+1);
			passed[to]=false;
			if(maxPath==maxNode)
				return;
		}
	}
}

int main(){
	int n;
	while(scanf("%d",&n)&&n!=0){
		maxPath=0;
		memset(passed,0,sizeof(passed));
		for(int i = 0; i < 101; i++)
			G[i].clear();
		set<int> s;
		for(int i = 0; i < n; i++){
			int a,b;
			//cin>>a>>b;
			scanf("%d %d",&a,&b);
			a--;
			b--;
			s.insert(a);
			s.insert(b);
			G[a].push_back(b);
			G[b].push_back(a);
		}
		maxNode=s.size();
		for(set<int>::iterator it = s.begin(); it!=s.end(); it++){
			passed[*it]=true;
			dfs(*it,1);
			passed[*it]=false;
			if(maxPath==maxNode)
				break;
		}
		printf("%d\n",maxPath);
	}
	return 0;
}

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

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

class Chain
{
    public:
    int tail;
    int length;
    
    Chain(int b)
    {
        tail = b;
        length = 2;
    };
}

int main(){
    
    while(1)
    {
        int num;
        cin>>num;
        
        if(num==0)
        {
            break;
        }
        
        int chainB;
        int length;
        list< Chain > clist;
        
        for(int i=0;i<num;++i)
        {
            int a, b;
            cin>>a;
            cin>>b;
            
            if(clist.empty())
            {
                clist.push_back(Chain(b));
                continue;
            }
            
            list< Chain >::iterator it = clist.begin();
            bool added = false;
            while(it != clist.end())
            {
                if((*it).tail == a)
                {
                    (*it).length += 1;
                    (*it).tail = b;
                    added = true;
                }
                ++it;
            }
            if(!added)
            {
                clist.push_back(Chain(b));
            }
        }
        
        int maxLength = 0;
        list< Chain >::iterator it = clist.begin();
        while(it != clist.end())
        {
            if((*it).length>maxLength)
            {
                macLength = (*it).length;
            }
        }
        cout<<macLength<<endl;
        
    }
    
    return 0;
}

Compiler output:
a.cc:16:2: error: expected ';' after class definition
   16 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:70:17: error: 'macLength' was not declared in this scope; did you mean 'maxLength'?
   70 |                 macLength = (*it).length;
      |                 ^~~~~~~~~
      |                 maxLength
a.cc:73:15: error: 'macLength' was not declared in this scope; did you mean 'maxLength'?
   73 |         cout<<macLength<<endl;
      |               ^~~~~~~~~
      |               maxLength