Language: C++

#include<vector>
#include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
vector<int> a[100];
bool b[100];
int fi(int p){
	int i;
	int mx=0;
	for(i=0;i<(int)a[p].size();++i){
		if(b[a[p][i]])
			continue;
		b[a[p][i]]=true;
		mx=max(mx,fi(a[p][i])+1);
		b[a[p][i]]=false;
	}
	return mx;
}
int main(){
	int i;
	int n;
	while(scanf("%d",&n),n){
		for(i=0;i<n;++i)
			a[i].clear();
		for(i=0;i<n;++i){
			int p,q;
			scanf("%d%d",&p,&q);
			--p;
			--q;
			a[p].push_back(q);
			a[q].push_back(p);
		}
		int mn,1<<30,mx=0;
		for(i=0;i<n;++i)
			mn=min(mn,a[i].size());
		for(i=0;i<n;++i){
			if(a[i].size()==mn)
				mx=max(mx,fi(i));
		}
		printf("%d\n",mx);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: expected unqualified-id before numeric constant
   34 |                 int mn,1<<30,mx=0;
      |                        ^
a.cc:36:31: error: no matching function for call to 'min(int&, std::vector<int>::size_type)'
   36 |                         mn=min(mn,a[i].size());
      |                            ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:36:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<int>::size_type' {aka 'long unsigned int'})
   36 |                         mn=min(mn,a[i].size());
      |                            ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:36:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   36 |                         mn=min(mn,a[i].size());
      |                            ~~~^~~~~~~~~~~~~~~~
a.cc:39:33: error: 'mx' was not declared in this scope; did you mean 'mn'?
   39 |                                 mx=max(mx,fi(i));
      |                                 ^~
      |                                 mn
a.cc:41:31: error: 'mx' was not declared in this scope; did you mean 'mn'?
   41 |                 printf("%d\n",mx);
      |                               ^~
      |                               mn