Language: C++

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define ll int
#define pb push_back
#define fi first
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fit(x) for(auto it=x.begin();it!=x.end();++it)
#define se second
#define mp make_pair
#define ALL(x) x.begin(),x.end()
#define ALP "abcdefghijklmnopqrstuvwxyz"
#define nline cout<<"\n"
#define rep(i,x) for(i=0;i<x;++i)
#define repr(i,a,b) for(i=a;i<=b;++i)
#define PLL pair<ll,ll>
#define VLL vector<ll>
#define W(t) while(t--)
#define modsum(a,b,M) (a%M + b%M)%M
#define modsub(a,b,M) (a%M - b%M + M)%M
#define modmul(a,b,M) (a%M * b%M)%M
#define moddiv(a,b,M) (a%M * modinv(b,M)%M)%M
#define seperate cout<<"*****************\n";
const long long mi2= 500000004;
const long long mi3= 333333336;
const long long MOD= 1000000007;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_pset tree<PLL, null_type,less<PLL>, rb_tree_tag,tree_order_statistics_node_update>
int xcod[4]={-1,0,1,0};
int ycod[4]={0,1,0,-1};
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
struct HASH{
  size_t operator()(const pair<ll,ll>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
// unordered_map<pair<int,int>,int,HASH>mp;
// unordered_map<ll, ll, custom_hash> safe_map;
ll powermod(ll x,ll n,ll M)
{
    ll result=1;
    while(n>0)
    {
      if(n % 2 ==1)
        result=(result * x)%M;
      x=(x*x)%M;
      n=n/2;
    }
    return result;
}
vector<ll> readll() {
    cin>>ws;
    vector<ll> v;
    string input;
    getline(cin, input);
    cout<<input;
    istringstream is(input);
    ll num;
    while(is>>num) v.pb(num);
    return v;
}
/*
int BLOCK_SIZE;
inline bool mo_cmp(const pair< pair<int, int>, int> &x,const pair< pair<int, int>, int> &y)
{
    if ( (x.fi.fi/BLOCK_SIZE) != (y.fi.fi/BLOCK_SIZE) )
        return x < y ;
    return ((x.fi.fi/BLOCK_SIZE)&1)^(x.fi.se<y.fi.se) ;
}
*/
ll modinv(ll n,ll p) {
    return powermod(n,p-2,p);
}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll fact[1000005],invf[1000005];
void facmod(ll n,ll M) {
    ll i;
    fact[0]=fact[1]=1;
    for(i=2;i<=n;++i) {
        fact[i]=((fact[i-1])%M * (i%M))%M;
    }
    invf[n]=modinv(fact[n],M);
    for (i=n-1;i>=0;--i){
        invf[i]=invf[i+1]*(i+1);
        invf[i]%=M;
    }
}

const ll nax= 1e5+5;
// ll T=0;
// ll p[200005], d[200005];
// ll tin[200005], tout[200005];
vector<ll> d(nax,0);
vector<ll> g(nax,vector<ll>());
vector<ll> in_vertex(nax,0);
// bool vis[nax];
void dfs(ll s) {
    for(auto t:g[s]) {
        --in_vertex[t];
        d[t]=max(d[t],d[s]+1);
        if(in_vertex[t]==0) {
            dfs(t);
        }
    }
}

// ll treeSet() {
//     ordered_set o_set;
//     o_set.insert(1); //for duplicate elements use pair and use second element unique
//     // find by order returns iterator of ith largest element;
//     cout<<*(o_set.find_by_order(1)) //second smallest element;
//     // Finding the number of elements 
//     // strictly less than k=4 
//     cout << o_set.order_of_key(4) ;
//     // Deleting 2 from the set if it exists 
//     if (o_set.find(2) != o_set.end()) 
//         o_set.erase(o_set.find(2));
// }


void solve() {
    ll i,n,m;
    cin>>n>>m;
    ll u,v;
    rep(i,m) {
        cin>>u>>v;
        g[u].pb(v);
        in_vertex[v]++;
    }
    repr(i,1,n) {
        if(in_vertex[i]==0)dfs(i);
    }
    ll ans=0;
    repr(i,1,n) ans=max(ans,d[i]);
    cout<<ans;
}
int main() {
    fastio;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // //freopen("output.txt","w",stdout);
    // #endif
    ll t=1;
    // cin>>t;
    W(t) {
        solve();
    }
    return 0;
}

Compiler output:
a.cc:113:30: error: no matching function for call to 'std::vector<int>::vector(const int&, std::vector<int>)'
  113 | vector<ll> g(nax,vector<ll>());
      |                              ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]'
  707 |         vector(_InputIterator __first, _InputIterator __last,
      |         ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note:   template argument deduction/substitution failed:
a.cc:113:30: note:   deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>')
  113 | vector<ll> g(nax,vector<ll>());
      |                              ^
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  678 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note:   no known conversion for argument 1 from 'const int' to 'std::initializer_list<int>'
  678 |       vector(initializer_list<value_type> __l,
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]'
  659 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note:   no known conversion for argument 1 from 'const int' to 'std::vector<int>&&'
  659 |       vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
      |              ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>; std::false_type = std::false_type]'
  640 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>; std::true_type = std::true_type]'
  635 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]'
  624 |       vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note:   no known conversion for argument 1 from 'const int' to 'const std::vector<int>&'
  624 |       vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
      |              ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  620 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  601 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; value_type = int; allocator_type = std::allocator<int>]'
  569 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
  569 |       vector(size_type __n, const value_type& __value,
      |                             ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; allocator_type = std::allocator<int>]'
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note:   no known conversion for argument 2 from 'std::vector<int>' to 'const std::vector<int>::allocator_type&' {aka 'const std::allocator<int>&'}
  556 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |                             ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]'
  542 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]'
  531 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note:   candidate expects 0 arguments, 2 provided
a.cc: In function 'void dfs(int)':
a.cc:117:19: error: 'begin' was not declared in this scope
  117 |     for(auto t:g[s]) {
      |                   ^
a.cc:117:19: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1238:5: note:   'std::begin'
 1238 |     begin(const valarray<_Tp>& __va) noexcept
      |     ^~~~~
In file included from /usr/include/c++/14/filesystem:53,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_dir.h:608:3: note:   'std::filesystem::__cxx11::begin'
  608 |   begin(recursive_directory_iterator __iter) noexcept
      |   ^~~~~
a.cc:117:19: error: 'end' was not declared in this scope
  117 |     for(auto t:g[s]) {
      |                   ^
a.cc:117:19: note: suggested alternatives:
/usr/include/c++/14/valarray:1265:5: note:   'std::end'
 1265 |     end(const valarray<_Tp>& __va) noexcept
      |     ^~~
/usr/include/c++/14/bits/fs_dir.h:613:3: note:   'std::filesystem::__cxx11::end'
  613 |   end(recursive_directory_iterator) noexcept
      |   ^~~
a.cc: In function 'void solve()':
a.cc:7:12: error: request for member 'push_back' in 'g.std::vector<int>::operator[](((std::vector<int>::size_type)u))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    7 | #define pb push_back
      |            ^~~~~~~~~
a.cc:146:14: note: in expansion of macro 'pb'
  146 |         g[u].pb(v);
      |              ^~