Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

bool used[N_MAX];
for(int i=0;i<N_MAX;i++){
  used[i]=false;
}

void dfs(int s){
  if(used[N_MAX]) return dp[s];
  used[t]=true;
  int ret=0;
  for(auto t:g[s]){
    ret=max(ret,dfs(t)+1);
  }
  return dp[s]=ret;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  cin >> N >> M;
  int N_MAX=100100;
  int x[N_MAX],y[N_MAX];

  /*for(int i=0;i<N_MAX;i++){
    for(int j=0;j<N_MAX;j++){
      x[i][j]=0;
      //if(i==j)x[i][j]==1;
    }
  }*/
  vector<pair<int,int>> g;
  int dp[N_MAX];
  for(int i=0;i<N_MAX;i++){
    dp[i]=0;
  }

  for(int i=0;i<M;i++){
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
    g[x[i]].push_back(y[i]);
  }

  int ans=0;
  for(int i=0;i<N;i++){
    ans=max(dp[i],dfs(i));
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:38:11: error: 'N_MAX' was not declared in this scope; did you mean 'NL_NMAX'?
   38 | bool used[N_MAX];
      |           ^~~~~
      |           NL_NMAX
a.cc:39:1: error: expected unqualified-id before 'for'
   39 | for(int i=0;i<N_MAX;i++){
      | ^~~
a.cc:39:13: error: 'i' does not name a type
   39 | for(int i=0;i<N_MAX;i++){
      |             ^
a.cc:39:21: error: 'i' does not name a type
   39 | for(int i=0;i<N_MAX;i++){
      |                     ^
a.cc: In function 'void dfs(int)':
a.cc:44:6: error: 'used' was not declared in this scope
   44 |   if(used[N_MAX]) return dp[s];
      |      ^~~~
a.cc:44:11: error: 'N_MAX' was not declared in this scope; did you mean 'NL_NMAX'?
   44 |   if(used[N_MAX]) return dp[s];
      |           ^~~~~
      |           NL_NMAX
a.cc:44:26: error: 'dp' was not declared in this scope; did you mean 'dup'?
   44 |   if(used[N_MAX]) return dp[s];
      |                          ^~
      |                          dup
a.cc:45:3: error: 'used' was not declared in this scope
   45 |   used[t]=true;
      |   ^~~~
a.cc:45:8: error: 't' was not declared in this scope
   45 |   used[t]=true;
      |        ^
a.cc:47:14: error: 'g' was not declared in this scope
   47 |   for(auto t:g[s]){
      |              ^
a.cc:50:10: error: 'dp' was not declared in this scope; did you mean 'dup'?
   50 |   return dp[s]=ret;
      |          ^~
      |          dup
a.cc: In function 'int main()':
a.cc:78:13: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'struct std::pair<int, int>'} has no member named 'push_back'
   78 |     g[x[i]].push_back(y[i]);
      |             ^~~~~~~~~
a.cc:83:22: error: invalid use of void expression
   83 |     ans=max(dp[i],dfs(i));
      |                   ~~~^~~