Language: C++

//#include<bits/stdc++.h>
//#pragma gcc optimize("ofast")
using namespace std;
typedef int lli;
//#define mod 1000000007
//#define fLoop for(lli i = 0; i < N; i++)
lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
	if(visited[index]) {
		return DP[index];
	}
	visited[index] = true;
	lli output = 0;
	for(auto i : adj[index]) {
		output = max(output, 1 + DFS(adj, i, visited, DP));
	}
	DP[index] = output;
	return output;
}
main() {
//	ios_base::sync_with_stdio(false);
//    cin.tie(NULL);
//    cout.tie(NULL);
    lli N, M;
    cin >> N >> M;
    vector<vector<lli> > adj(N + 1);
    for(lli i = 0; i < M; i++) {
    	lli X, Y;
    	cin >> X >> Y;
    	adj[X].push_back(Y);
	}
	bool *visited = new bool[N + 1];
	lli *DP = new lli[N + 1];
	for(lli i = 0; i <= N; i++) {
		visited[i] = false;
		DP[i] = 0;
	}
	lli output = 0;
	for(lli i = 1; i <= N; i++) {
		if(!visited[i]) {
			output = max(output, DFS(adj, i, visited, DP));
		}
	}
	cout << output << '\n';
  	delete[] visited;
  	delete[] DP;
}



Compiler output:
a.cc:7:9: error: 'vector' was not declared in this scope
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | //#include<bits/stdc++.h>
a.cc:7:16: error: 'vector' was not declared in this scope
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                ^~~~~~
a.cc:7:16: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:7:26: error: expected primary-expression before '>' token
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                          ^
a.cc:7:28: error: expected primary-expression before '>' token
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                            ^
a.cc:7:30: error: 'adj' was not declared in this scope
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                              ^~~
a.cc:7:39: error: expected primary-expression before 'index'
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                                       ^~~~~
a.cc:7:46: error: expected primary-expression before 'bool'
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                                              ^~~~
a.cc:7:65: error: expected primary-expression before '*' token
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                                                                 ^
a.cc:7:66: error: 'DP' was not declared in this scope
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                                                                  ^~
a.cc:7:68: error: expression list treated as compound expression in initializer [-fpermissive]
    7 | lli DFS(vector<vector<lli> > adj, lli index, bool *visited, lli *DP) {
      |                                                                    ^
a.cc:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main() {
      | ^~~~
a.cc: In function 'int main()':
a.cc:24:5: error: 'cin' was not declared in this scope
   24 |     cin >> N >> M;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | //#include<bits/stdc++.h>
a.cc:25:5: error: 'vector' was not declared in this scope
   25 |     vector<vector<lli> > adj(N + 1);
      |     ^~~~~~
a.cc:25:5: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:25:22: error: expected primary-expression before '>' token
   25 |     vector<vector<lli> > adj(N + 1);
      |                      ^
a.cc:25:24: error: expected primary-expression before '>' token
   25 |     vector<vector<lli> > adj(N + 1);
      |                        ^
a.cc:25:26: error: 'adj' was not declared in this scope
   25 |     vector<vector<lli> > adj(N + 1);
      |                          ^~~
a.cc:40:49: error: 'DFS' cannot be used as a function
   40 |                         output = max(output, DFS(adj, i, visited, DP));
      |                                              ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:40:34: error: 'max' was not declared in this scope
   40 |                         output = max(output, DFS(adj, i, visited, DP));
      |                                  ^~~
a.cc:43:9: error: 'cout' was not declared in this scope
   43 |         cout << output << '\n';
      |         ^~~~
a.cc:43:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'