Language: C++

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;

const ll mod = 1e9+7;
const ll inf = 1e16;

#define loop(i,m,n) for(ll i=m;i<n;i++)
#define vloop(it,x) for(auto it=x.begin(); it!=x.begin(); it++)
#define all(x) x.begin(),x.end()
#define debug(x) cout << #x <<":"<< x <<endl	
#define showll(x) printf("%lld\n",x)
#define test(t) ll t;cin >> t;while(t--)
#define showc(x) printf("%c\n",x)
#define show(x) cout << x << endl
#define read(x) cin >> x
#define yes printf("YES\n")
#define no printf("NO\n")
#define pb push_back
#define mp make_pair

void fast()
{
ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
}

//////////////////////////////// - _ - \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

#define MAXN 60000001
int spf[MAXN]; 
  
// Calculating SPF (Smallest Prime Factor) for every 
// number till MAXN. 
// Time Complexity : O(nloglogn) 
void sieve() 
{ 
    spf[1] = 1; 
    for (int i=2; i<MAXN; i++) 
  
        // marking smallest prime factor for every 
        // number to be itself. 
        spf[i] = i; 
  
    // separately marking spf for every even 
    // number as 2 
    for (int i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
  
    for (int i=3; i*i<MAXN; i++) 
    { 
        // checking if i is prime 
        if (spf[i] == i) 
        { 
            // marking SPF for all numbers divisible by i 
            for (int j=i*i; j<MAXN; j+=i) 
  
                // marking spf[j] if it is not  
                // previously marked 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
  
ll maxi = 1e5 + 5;
ll indegree[maxi];
ll dist[maxi];
bool visited[maxi];
vector <ll> edges[maxi];

void dfs(ll a)
{
	if(visted[a]==true)
	{
		break;
	}

	visted[a]= true;
	for(ll b: edges[a])
	{
		dist[b] = max(dist[b],dist[a]+1);
		indegree[b]--;
		if(indegree[b]==0)
		{
			dfs(b);
		}
	}
}

int main()
{
	ll n,m,i,a,b;
	ll ans = 0;
	read(n);read(m);
	loop(i,0,m)
	{
		scanf("%lld %lld",&a,&b);
		edges[a].pb(b);
		indegree[b]++;
	}
	loop(i,1,n+1)
	{
		if(visted[i]==false && indegree[i]==0)
		{
			dfs(i);
		}
	}
	loop(i,1,n+1)
	{
		ans = max(ans,dist[i]);
	}
	printf("%lld\n",ans);

}

Compiler output:
a.cc:71:13: error: size of array 'indegree' is not an integral constant-expression
   71 | ll indegree[maxi];
      |             ^~~~
a.cc:72:9: error: size of array 'dist' is not an integral constant-expression
   72 | ll dist[maxi];
      |         ^~~~
a.cc:73:14: error: size of array 'visited' is not an integral constant-expression
   73 | bool visited[maxi];
      |              ^~~~
a.cc:74:19: error: size of array 'edges' is not an integral constant-expression
   74 | vector <ll> edges[maxi];
      |                   ^~~~
a.cc: In function 'void dfs(ll)':
a.cc:78:12: error: 'visted' was not declared in this scope; did you mean 'visited'?
   78 |         if(visted[a]==true)
      |            ^~~~~~
      |            visited
a.cc:80:17: error: break statement not within loop or switch
   80 |                 break;
      |                 ^~~~~
a.cc:83:9: error: 'visted' was not declared in this scope; did you mean 'visited'?
   83 |         visted[a]= true;
      |         ^~~~~~
      |         visited
a.cc: In function 'int main()':
a.cc:108:20: error: 'visted' was not declared in this scope; did you mean 'visited'?
  108 |                 if(visted[i]==false && indegree[i]==0)
      |                    ^~~~~~
      |                    visited