Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn = 100000+5;
int visit[100000+5];
int dp[100000+5];
vector<int> v[100000+5];

void dfs(int node){
	visit[node] = true;
	for(int i=0; i<v[node].size(); i++){
		if(!visit[v[node][i]]){
			dfs(v[node][i]);
		}
		dp[node] = max(dp[node], dp[v[node][i]] + 1);
	}
}

int main(int argc, char const *argv[])
{
	int N, M;
	while(cin >> N >> M) {
		for(int i=0; i<100000+5; i++){
			v[i].clear();
		}
		int big = 0;
		memset(dp, 0, sizeof(dp));
		for(int i=0; i<M; i++){
			int place1, place2;
			cin >> place1 >> place2;
 			v[place1].push_back(place2);
		}
		for(int i=1; i<=N; i++){
			memset(visit, 0, sizeof(visit));
			dfs(i);
		}
		for(int i=1; i<=N; i++){
			big = max(big, dp[i]);
		}
		cout << big << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:9:9: error: reference to 'visit' is ambiguous
    9 |         visit[node] = true;
      |         ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
                 from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100000+5];
      |     ^~~~~
a.cc:11:21: error: reference to 'visit' is ambiguous
   11 |                 if(!visit[v[node][i]]){
      |                     ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100000+5];
      |     ^~~~~
a.cc: In function 'int main(int, const char**)':
a.cc:33:32: error: reference to 'visit' is ambiguous
   33 |                         memset(visit, 0, sizeof(visit));
      |                                ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100000+5];
      |     ^~~~~
a.cc:33:49: error: reference to 'visit' is ambiguous
   33 |                         memset(visit, 0, sizeof(visit));
      |                                                 ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
 1855 |     visit(_Visitor&& __visitor, _Variants&&... __variants)
      |     ^~~~~
a.cc:4:5: note:                 'int visit [100005]'
    4 | int visit[100000+5];
      |     ^~~~~