criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
void dfs(vector <int> adj[],int vis[],int u,int dp[])
{
  vis[u]=1;
  
  for(int i=0;i<adj[u].size();i++)
  {
  	if(vis[adj[u][i]]==0)
    {
      dfs(adj,vis,adj[u][i],dp);
    }
    dp[u]=max(dp[u],1+dp[adj[u][i]]);
  }
  
}
int main()
{
  int n;
  cin>>n;
  int e;
  cin>>e;
  
	vector <int> adj[n+1];
  for(int i=1;i<=e;i++)
  {
  	int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  int vis[n+1];
  int dp[n+1];
  memset(vis,0,sizeof(vis));
  memset(dis,0,sizeof(dis));
  for(int i=1;i<=n;i++)
  {
    if(vis[i]==0)
      dfs(adj,vis,i,dp);
  }
  int mx=INT_MIN;
  for(int i=1;i<=n;i++)
  {
    if(dp[i]>mx)
      mx=dp[i];
  }
  cout<<mx<<endl;
  return 0;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:10: error: 'dis' was not declared in this scope; did you mean 'vis'?
   35 |   memset(dis,0,sizeof(dis));
      |          ^~~
      |          vis
Language: C++

kk#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define endl "\n"

const ll INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

const int N = 1e5 + 5;

ll n, m, dp[N];
vector<ll> G[N];

ll solve(int i) {
    ll& ret = dp[i];
    if (~ret)
        return ret;

    ret = 0;
    for (auto to : G[i]) 
        ret = max(ret, solve(to) + 1);

    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);

    cin >> n >> m;

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

    memset(dp, -1, sizeof(dp));

    ll ans = 0;
    for (int i = 0; i < n; ++i)
        ans = max(ans, solve(i));

    cout << ans << endl;
}

Compiler output:
a.cc:1:3: error: stray '#' in program
    1 | kk#include <bits/stdc++.h>
      |   ^
a.cc:1:1: error: 'kk' does not name a type
    1 | kk#include <bits/stdc++.h>
      | ^~
a.cc:6:9: error: 'pair' does not name a type
    6 | typedef pair<ll, ll> pll;
      |         ^~~~
a.cc:7:9: error: 'pair' does not name a type
    7 | typedef pair<int, int> pii;
      |         ^~~~
a.cc:14:19: error: 'acos' was not declared in this scope
   14 | const double PI = acos(-1.0);
      |                   ^~~~
a.cc:16:1: error: 'mt19937' does not name a type
   16 | mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
      | ^~~~~~~
a.cc:21:1: error: 'vector' does not name a type
   21 | vector<ll> G[N];
      | ^~~~~~
a.cc: In function 'll solve(int)':
a.cc:29:20: error: 'G' was not declared in this scope
   29 |     for (auto to : G[i])
      |                    ^
a.cc:30:15: error: 'max' was not declared in this scope
   30 |         ret = max(ret, solve(to) + 1);
      |               ^~~
a.cc: In function 'int main()':
a.cc:36:5: error: 'ios' has not been declared
   36 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:37:5: error: 'cin' was not declared in this scope
   37 |     cin.tie(NULL), cout.tie(NULL);
      |     ^~~
a.cc:37:13: error: 'NULL' was not declared in this scope
   37 |     cin.tie(NULL), cout.tie(NULL);
      |             ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | kk#include <bits/stdc++.h>
a.cc:37:20: error: 'cout' was not declared in this scope
   37 |     cin.tie(NULL), cout.tie(NULL);
      |                    ^~~~
a.cc:44:9: error: 'G' was not declared in this scope
   44 |         G[x].push_back(y);
      |         ^
a.cc:47:5: error: 'memset' was not declared in this scope
   47 |     memset(dp, -1, sizeof(dp));
      |     ^~~~~~
a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
  +++ |+#include <cstring>
    1 | kk#include <bits/stdc++.h>
a.cc:51:15: error: 'max' was not declared in this scope
   51 |         ans = max(ans, solve(i));
      |               ^~~
Language: C++


import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Math.max;

public class Main {

    final int nax = ((int) 1e5) + 5;
    List<Integer>[] edges = new List[nax];
    int[] in_degree = new int[nax]; // the number of edges going to 'b'
    int[] dist = new int[nax];
    boolean[] visited = new boolean[nax];

    void go() {
        Scanner sc = new Scanner(new InputStreamReader(System.in));
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];
        int[] y = new int[m];
        for (int i = 0; i <= n; i++) {
            edges[i] = new ArrayList<>();
        }
        for (int i = 0; i < m; i++) {
            int a, b;
            a = sc.nextInt();
            b = sc.nextInt();

            if (edges[a] == null) {
                edges[a] = new ArrayList<>();
            }
            edges[a].add(b);
            in_degree[b]++;
        }
        for (int i = 1; i <= n; ++i) {
            if (!visited[i] && in_degree[i] == 0) {
                dfs(i);
            }
        }
        int answer = 0;
        for (int i = 1; i <= n; ++i) {
            answer = max(answer, dist[i]);
        }
        System.out.printf("%d\n", answer);
    }

    void dfs(int a) {
        assert (!visited[a]);
        visited[a] = true;
        for (int b : edges[a]) {
            dist[b] = max(dist[b], dist[a] + 1);
            --in_degree[b];
            if (in_degree[b] == 0) dfs(b);
        }
    }

    public static void main(String[] args) {
        Main main = new Main();
        main.go();
    }
/*
4 5
1 2
1 3
3 2
2 4
3 4
 */

}


Compiler output:
a.cc:2:1: error: 'import' does not name a type
    2 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import static java.lang.Math.max;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: expected unqualified-id before 'public'
    7 | public class Main {
      | ^~~~~~
Language: C++

package DynamicProgramming.AtCoder2;

import java.io.InputStreamReader;
import java.util.*;

import static java.lang.Math.max;

public class Main {

    final int nax = ((int) 1e5) + 5;
    List<Integer>[] edges = new List[nax];
    int[] in_degree = new int[nax]; // the number of edges going to 'b'
    int[] dist = new int[nax];
    boolean[] visited = new boolean[nax];

    void go() {
        Scanner sc = new Scanner(new InputStreamReader(System.in));
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];
        int[] y = new int[m];
        for (int i = 0; i <= n; i++) {
            edges[i] = new ArrayList<>();
        }
        for (int i = 0; i < m; i++) {
            int a, b;
            a = sc.nextInt();
            b = sc.nextInt();

            if (edges[a] == null) {
                edges[a] = new ArrayList<>();
            }
            edges[a].add(b);
            in_degree[b]++;
        }
        for (int i = 1; i <= n; ++i) {
            if (!visited[i] && in_degree[i] == 0) {
                dfs(i);
            }
        }
        int answer = 0;
        for (int i = 1; i <= n; ++i) {
            answer = max(answer, dist[i]);
        }
        System.out.printf("%d\n", answer);
    }

    void dfs(int a) {
        assert (!visited[a]);
        visited[a] = true;
        for (int b : edges[a]) {
            dist[b] = max(dist[b], dist[a] + 1);
            --in_degree[b];
            if (in_degree[b] == 0) dfs(b);
        }
    }

    public static void main(String[] args) {
        Main main = new Main();
        main.go();
    }
/*
4 5
1 2
1 3
3 2
2 4
3 4
 */

}


Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package DynamicProgramming.AtCoder2;
      | ^~~~~~~
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.InputStreamReader;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import static java.lang.Math.max;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: expected unqualified-id before 'public'
    8 | public class Main {
      | ^~~~~~
Language: C++

/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

VecVec tree;
Vec dp;

void dfs(ll node){
	if(dp[node]) return;
	ll max = -1;
	for(ll i : tree[node]) chmax(max, dfs(i));
	dp[node] = max+1;
}

int main(void){
	ll n, m;
	cin >> n >> m;
	tree.resize(n);
	dp.resize(n);
	rep(i, m){
		ll x, y;
		cin >> x >> y;
		tree[--x].pb(--y);
	}

	rep(i, n) dfs(i);
	ll ans = 0;
	rep(i, n) chmax(ans, dp[i]);
	co(ans);

	return 0;
}


Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:55:46: error: invalid use of void expression
   55 |         for(ll i : tree[node]) chmax(max, dfs(i));
      |                                           ~~~^~~
Language: C++

/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

VecVec tree;
Vec dp;

void dfs(ll node){
	if(dp[node]) return dp[node];
	ll max = -1;
	for(ll i : tree[node]) chmax(max, dfs(i));
	dp[node] = max+1;
}

int main(void){
	ll n, m;
	cin >> n >> m;
	tree.resize(n);
	dp.resize(n);
	rep(i, m){
		ll x, y;
		cin >> x >> y;
		tree[--x].pb(--y);
	}

	rep(i, n) dfs(i);
	ll ans = 0;
	rep(i, n) chmax(ans, dp[i]);
	co(ans);

	return 0;
}


Compiler output:
a.cc: In function 'void dfs(ll)':
a.cc:53:36: error: return-statement with a value, in function returning 'void' [-fpermissive]
   53 |         if(dp[node]) return dp[node];
      |                                    ^
a.cc:55:46: error: invalid use of void expression
   55 |         for(ll i : tree[node]) chmax(max, dfs(i));
      |                                           ~~~^~~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,m;
 int x,y;
  int mat[n][n];
  for(int i=0;i<m;i++)
  {
    cin>>x>>y;
    mat[x][y]=1;
  }
  int max=INT_MAX;
  k=0;
  for(int i=0;i<n;i++)
  {for(int j=1;j<n;j++)
    {
     if(mat[i][j]==1 && j==)
     {
     
     }
      
    }
    
  }
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:11: error: 'INT_MAX' was not declared in this scope
   13 |   int max=INT_MAX;
      |           ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:14:3: error: 'k' was not declared in this scope
   14 |   k=0;
      |   ^
a.cc:18:28: error: expected primary-expression before ')' token
   18 |      if(mat[i][j]==1 && j==)
      |                            ^
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#define ll long long int
using namespace std ;

const int maxn = 100000+4;

#define mod 1000000007

int min(int a, int b)
{
    if (a <= b) return a;
    return b;
}


int max(int a, int b)
{
    if( a > b) return a;
    return b;
}


int abs(int x)
{
    if(x<0)
        return (-1*x);
    return x;
}

bool vis[maxn];

int graph[maxn][maxn];
int node, edge;

int DP[maxn];
int dis[maxn];

stack <int> stk;

void dfs(int s)
{

memset(vis , false , sizeof vis);
    dis[s] = 0 ;
    vis[s] = true;
    DP[s] = 0 ;
    stk.push(s);

    while(!stk.empty())
    {
        int tt = stk.top();
        stk.pop();
        for(int i=1 ; i<=node ; i++)
        {
            if( graph[tt][i]==1 and  !vis[i] )
            {

                stk.push(i);
                dis[i] = dis[tt]+1;
                DP[s] = max( DP[s], dis[i]);

            }
        }
    }



}


int main()
{

    cin >> node >> edge;

    for(int i=1 ; i<=node ; i++)
        vis[i] = false;
    for(int i=1 ; i<=edge ; i++)
    {
        int x,y;

        cin >> x >> y;

        graph[x][y] = 1 ;
    }

   // dfs(1);

    for(int i=1 ; i<=node ; i++)
    {
      //  if(vis[i]==false)
            dfs(i);
    }

int ans = -1;

    for(int i=1 ; i<=node ; i++)
    {
        ans=max(ans,DP[i]);
    }
    cout << ans <<endl;


    return 0 ;
}


Compiler output:
/tmp/ccDz5JiD.o: in function `dfs(int)':
a.cc:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against symbol `dis' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `DP' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0xc6): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0xda): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `stk' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0x177): relocation truncated to fit: R_X86_64_PC32 against symbol `dis' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0x191): relocation truncated to fit: R_X86_64_PC32 against symbol `dis' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0x1a8): relocation truncated to fit: R_X86_64_PC32 against symbol `dis' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0x1bf): relocation truncated to fit: R_X86_64_PC32 against symbol `DP' defined in .bss section in /tmp/ccDz5JiD.o
a.cc:(.text+0x1e0): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: Java

import java.util.*;

public class Main {
    public static int solve(int n, int m, int[] x, int[] y) {
        Map<Integer, List<Integer>> graph = new HashMap<>();
      	for (int i = 0; i < n; i++) {
          graph.put(i, new LinkedList<Integer>());
        }
      
        for (int i = 0; i < m; i++) {
          graph.get(x[i] - 1).add(y[i] - 1);
        }

        int[] memo = new int[n];
        Arrays.fill(memo, -1);
        
      	int result = 0;
        for (int i = 0; i < n; i++) {
          max = Math.max(max, dfs(graph, i, memo));
        }
        return result;
    }

    private static int dfs(Map<Integer, List<Integer>> graph, int from, int[] memo) {
      if (memo[from] >= 0) {
        return memo[from];
      }

      int maxPath = 0;
      for (int to : graph.get(from)) {
        maxPath = Math.max(maxPath, dfs(graph, to, memo) + 1);
      }

      return memo[from] = maxPath;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        int[] from, to;
        from = new int[m];
        to = new int[m];
        for (int i = 0; i < m; i++) {
          from[i] = scanner.nextInt();
          to[i] = scanner.nextInt();
        }
        
        int result = solve(n, m, from, to);
        System.out.println(result);
    }
}

Compiler output:
Main.java:19: error: cannot find symbol
          max = Math.max(max, dfs(graph, i, memo));
          ^
  symbol:   variable max
  location: class Main
Main.java:19: error: cannot find symbol
          max = Math.max(max, dfs(graph, i, memo));
                         ^
  symbol:   variable max
  location: class Main
2 errors
Language: C++

#include <bits/stdc++.h>
#define int long long

using namespace std;
const int MN = 1e5+7;
const int INF = 1e15+7;

int n, m, x[MN], y[MN], dp[MN];

signed main()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++){
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
        g[x[i]].push_back(y[i]);
    }
    for(int i = 0; i < m; i++){
        dp[y[i]] = max(dp[y[i]], dp[x[i]] + 1);
        //cout << y[i] << ":";
        //cout << dp[y[i]] << ' ';
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans = max(ans, dp[i]);
    }
    cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'g' was not declared in this scope
   17 |         g[x[i]].push_back(y[i]);
      |         ^
Language: C++

// HEADERS //
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

// MISCELLANEOUS //
#define fast_IO() ios_base::sync_with_stdio(false),cin.tie(NULL)
#define gcd __gcd
#define cnt_1s __buitlin_popcount
#define ll long long
#define endl "\n"
#define test(t) cin >> t; while(t--)
#define mem(v, x) memset(v, x, sizeof(v))

// LOOPS //
#define rep(i, a, b) for(int i=(a); i<(b); i++)
#define irep(i, a, b) for(int i = (a)-1; i >= (b); i--)
#define srep(i, v) for(decltype(v.begin())i = v.begin(); i != v.end(); i++)

// CONTAINERS //
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ii pair<int,int>
#define ff first
#define ss second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define all(v) (v).begin(), (v).end()
#define present(v, x) (v).find(x) != (v).end()

// DEBUGGING //
#define dbg() printf("\n**DEBUG**\n")
#define chk(a) cerr << endl << #a << ":" << a << endl
#define chk2(a, b) cerr << endl << #a << ":" << a << "\t" << #b << ":" << b << endl

// CONSTANTS //
#define M 1000000007

// MAIN //
// using namespace __gnu_pbds;
using namespace std
int main() {
    fast_IO();
    int t, n, m, x, y;
    cin >> n >> m;
    map<int, int> mp;
    stack<int> temp;
    vi G[n], dp(n);
    rep(i, 0, m) {
        cin >> x >> y;
        x--, y--;
        G[x].eb(y); mp[y]++;
    }
    rep(i, 0, n) if(!mp[i]) temp.push(i);
    while(!temp.empty()) {
        int v = temp.top(); temp.pop();
        for(int i: G[v]) {
            dp[i] = max(dp[i], dp[v]+1);
            mp[i]--;
            if(!mp[i]) temp.push(i);
        }
    }
    int ans = 0;
    for(int i: dp) ans = max(ans, i);
    cout << ans;
}

Compiler output:
a.cc:45:20: error: expected ';' before 'int'
   45 | using namespace std
      |                    ^
      |                    ;
   46 | int main() {
      | ~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, n) for(ll i = 1; i <= n; ++i)

bool used[10005];
set <ll> arr[10005];
ll timer[10005];


int main() {
    ll n, m, a, b;
    cin >> n >> m;
    For(i, m) {
        cin >> a >> b;
        arr[a].insert(b);
        timer[i] = 0;
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }
    }
    
    For(i, n) {
        for(auto it : arr[i]) {
            if(timer[i] + 1 > timer[it]) timer[it] = timer[i] + 1;
        }

    ll max_ = timer[1];
    For(i, n - 1) {
        if(timer[i + 1] > max_) max_ = timer[i + 1];
    }
    cout << max_;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:11:12: note: to match this '{'
   11 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h> /** * author: j o s e m a g o * date: **/ using namespace std; #pragma GCC optimize ("Ofast") #define f first #define s second #define mp make_pair #define lb lower_bound #define ub upper_bound #define all(v) (v).begin(),(v).end() #define mset(a,v) memset(a,v,sizeof(a)) #define pb push_back #define sz(x) ((int)(x).size()) #define rsz resize #define ln "\n" typedef double db; typedef unsigned long long ull; typedef long long ll; typedef long double ld; const ld PI = 2*acos(0.0); const int MOD = 1000000007; const int JJJ = 100009; int N,A; vector<int>grafo[JJJ]; bool visited[JJJ]; int dp[JJJ]; int sol = 0; void dfs(int nod){ visited[nod] = true; dp[nod] = -1; for(int i = 0;i < (int)grafo[nod].size();i++){ int xx = grafo[nod][i]; if(!visited[xx]){ dfs(xx); } dp[nod] = max(dp[nod],dp[xx]); } dp[nod]++; } int main(){ //freopen("input.in","r",stdin); //freopen("input.out","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> A; for(int i = 0;i < A;i++){ int a,b; cin >> a >> b; grafo[a].pb(b); } for(int i = 1;i <= N;i++){ if(!visited[i]){ dfs(i); } sol = max(sol,dp[i]); } cout<<sol; return 0; } /* 4 5 1 2 1 3 3 2 2 4 3 4 6 3 2 3 4 5 5 6 5 8 5 3 2 3 2 4 5 2 5 1 1 4 4 3 1 3 */

Compiler output:
a.cc:1:68: warning: extra tokens at end of #include directive
    1 | #include <bits/stdc++.h> /** * author: j o s e m a g o * date: **/ using namespace std; #pragma GCC optimize ("Ofast") #define f first #define s second #define mp make_pair #define lb lower_bound #define ub upper_bound #define all(v) (v).begin(),(v).end() #define mset(a,v) memset(a,v,sizeof(a)) #define pb push_back #define sz(x) ((int)(x).size()) #define rsz resize #define ln "\n" typedef double db; typedef unsigned long long ull; typedef long long ll; typedef long double ld; const ld PI = 2*acos(0.0); const int MOD = 1000000007; const int JJJ = 100009; int N,A; vector<int>grafo[JJJ]; bool visited[JJJ]; int dp[JJJ]; int sol = 0; void dfs(int nod){ visited[nod] = true; dp[nod] = -1; for(int i = 0;i < (int)grafo[nod].size();i++){ int xx = grafo[nod][i]; if(!visited[xx]){ dfs(xx); } dp[nod] = max(dp[nod],dp[xx]); } dp[nod]++; } int main(){ //freopen("input.in","r",stdin); //freopen("input.out","w",stdout); ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> A; for(int i = 0;i < A;i++){ int a,b; cin >> a >> b; grafo[a].pb(b); } for(int i = 1;i <= N;i++){ if(!visited[i]){ dfs(i); } sol = max(sol,dp[i]); } cout<<sol; return 0; } /* 4 5 1 2 1 3 3 2 2 4 3 4 6 3 2 3 4 5 5 6 5 8 5 3 2 3 2 4 5 2 5 1 1 4 4 3 1 3 */
      |                                                                    ^~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: Java

import java.util.*;
public class Main
{
    public static void main(String args[])throws java.lang.Exception
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        ArrayList<ArrayList<Integer>[]> yum=new ArrayList<ArrayList<Integer>[]>();int curr=0;boolean bool=false;ArrayList<Integer> pow2=new ArrayList<Integer>();
        {
            ArrayList<Integer>[] h = new ArrayList<>[n];
            for (int i = 0; i < n; i++)
            {
                h[i] = new ArrayList<Integer>();
            }
            for (int i = 0; i < m; i++)
            {
                int x = sc.nextInt();
                int y = sc.nextInt();
                h[y - 1].add(x - 1);
                bool = true;
            }
            yum.add(h);
            pow2.add(1);
        }
        while(bool)
        {
            pow2.add(2*pow2.get(curr));
            bool=false;
            ArrayList<Integer>[] h = new ArrayList<>[n];
            for (int i = 0; i < n; i++)
            {
                h[i] = new ArrayList<Integer>();
            }
            ArrayList<Integer>[] prev=yum.get(curr);
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<prev[i].size();j++)
                {
                    for(int k=0;k<prev[prev[i].get(j)].size();k++)
                    {
                        h[i].add(prev[prev[i].get(j)].get(k));
                        bool=true;
                    }
                }
            }
            yum.add(h);
            curr++;
        }
        curr--;ArrayList<Integer>[] a;ArrayList<Integer>[] b;ArrayList<Integer>[] c;
        int val=pow2.get(curr);
        int delta=curr-1;
        a=yum.get(curr);
        while(delta>=0)
        {
            bool=false;
            b=yum.get(delta);
            c=new ArrayList<>[n];
            for (int i = 0; i < n; i++)
            {
                c[i] = new ArrayList<Integer>();
            }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<a[i].size();j++)
                {
                    for(int k=0;k<b[a[i].get(j)].size();k++)
                    {
                        c[i].add(b[a[i].get(j)].get(k));
                        bool=true;
                    }
                }
            }
            if(bool==true)
            {
                a=c;
                val=val+pow2.get(delta);
            }
            delta--;
        }
        System.out.println(val);
    }
}


Compiler output:
Main.java:11: error: cannot create array with '<>'
            ArrayList<Integer>[] h = new ArrayList<>[n];
                                                  ^
Main.java:30: error: cannot create array with '<>'
            ArrayList<Integer>[] h = new ArrayList<>[n];
                                                  ^
Main.java:58: error: cannot create array with '<>'
            c=new ArrayList<>[n];
                           ^
3 errors
Language: Java

import java.awt.*;
import java.util.*;
public class longestPath
{
    public static void main(String args[])throws java.lang.Exception
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        ArrayList<ArrayList<Integer>[]> yum=new ArrayList<ArrayList<Integer>[]>();int curr=0;boolean bool=false;ArrayList<Integer> pow2=new ArrayList<Integer>();
        {
            ArrayList<Integer>[] h = new ArrayList[n];
            for (int i = 0; i < n; i++)
            {
                h[i] = new ArrayList<Integer>();
            }
            for (int i = 0; i < m; i++)
            {
                int x = sc.nextInt();
                int y = sc.nextInt();
                h[y - 1].add(x - 1);
                bool = true;
            }
            yum.add(h);
            pow2.add(1);
        }
        while(bool)
        {
            pow2.add(2*pow2.get(curr));
            bool=false;
            ArrayList<Integer>[] h = new ArrayList[n];
            for (int i = 0; i < n; i++)
            {
                h[i] = new ArrayList<Integer>();
            }
            ArrayList<Integer>[] prev=yum.get(curr);
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<prev[i].size();j++)
                {
                    for(int k=0;k<prev[prev[i].get(j)].size();k++)
                    {
                        h[i].add(prev[prev[i].get(j)].get(k));
                        bool=true;
                    }
                }
            }
            yum.add(h);
            curr++;
        }
        curr--;ArrayList<Integer>[] a;ArrayList<Integer>[] b;ArrayList<Integer>[] c;
        int val=pow2.get(curr);
        int delta=curr-1;
        a=yum.get(curr);
        while(delta>=0)
        {
            bool=false;
            b=yum.get(delta);
            c=new ArrayList[n];
            for (int i = 0; i < n; i++)
            {
                c[i] = new ArrayList<Integer>();
            }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<a[i].size();j++)
                {
                    for(int k=0;k<b[a[i].get(j)].size();k++)
                    {
                        c[i].add(b[a[i].get(j)].get(k));
                        bool=true;
                    }
                }
            }
            if(bool==true)
            {
                a=c;
                val=val+pow2.get(delta);
            }
            delta--;
        }
        System.out.println(val);
    }
}

Compiler output:
Main.java:3: error: class longestPath is public, should be declared in a file named longestPath.java
public class longestPath
       ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1000000007
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int rec(int i, int* G, int* dp){
  if(dp[i] != -1) return dp[i];  // 既にdpテーブルが更新されている場合
  int cnt = 0;
  for(int j : G[i]){
    chmax(cnt, rec(j) + 1);
  }
  return dp[i] = cnt;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // Educational DP Contest G -  Longest Path
  // N頂点M辺の有向グラフG、頂点には1, 2, 3, …, N
  // i番目の有向辺は頂点xiからyiへ張られている
  // Gは有向閉路を含まない
  // メモ化再帰で解いていく
  int N, M;
  cin >> N >> M;
  vector<vector<int> > G(N, vector<int>());
  REP(i, M){  // 有向辺の情報を入力
    int x, y; cin >> x >> y; x--; y--;  // 0-indexed
    G[x].push_back(y);
  }

  vector<int> dp(N, -1);  // dp[i]:頂点i（0からN-1まで）を始点とした最長有向パス
  int ans = 0;  
  REP(i, N){
    chmax(ans, rec(i, G, dp));  // ローカル変数のポインタを渡す
  }
  
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int rec(int, int*, int*)':
a.cc:12:18: error: 'begin' was not declared in this scope
   12 |   for(int j : G[i]){
      |                  ^
a.cc:12:18: note: suggested alternatives:
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166,
                 from a.cc:1:
/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:12:18: error: 'end' was not declared in this scope
   12 |   for(int j : G[i]){
      |                  ^
a.cc:12:18: 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:13:19: error: too few arguments to function 'int rec(int, int*, int*)'
   13 |     chmax(cnt, rec(j) + 1);
      |                ~~~^~~
a.cc:9:5: note: declared here
    9 | int rec(int i, int* G, int* dp){
      |     ^~~
a.cc: In function 'int main()':
a.cc:37:23: error: cannot convert 'std::vector<std::vector<int> >' to 'int*'
   37 |     chmax(ans, rec(i, G, dp));  // ローカル変数のポインタを渡す
      |                       ^
      |                       |
      |                       std::vector<std::vector<int> >
a.cc:9:21: note:   initializing argument 2 of 'int rec(int, int*, int*)'
    9 | int rec(int i, int* G, int* dp){
      |                ~~~~~^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxx=1e5+10;
vector<int>graph[maxx];
int maxdep=0;
dfss(int n,int deep){
	if(deep>maxdep){
		maxdep=deep;
	}
	for(int i=0;i<graph[n].size();i++){
		int t=graph[n][i];
			dfs(t,deep+1);
	}
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int v,w;
		scanf("%d%d",&v,&w);
		graph[v].push_back(w);
	}
	for(int i=1;i<=n;i++){
			dfss(i,0);
	}
	printf("%d",maxdep);
}

Compiler output:
a.cc:6:1: error: ISO C++ forbids declaration of 'dfss' with no type [-fpermissive]
    6 | dfss(int n,int deep){
      | ^~~~
a.cc: In function 'int dfss(int, int)':
a.cc:12:25: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   12 |                         dfs(t,deep+1);
      |                         ^~~
      |                         ffs
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxx=1e5+10;
vector<int>graph[maxx];
int maxdep=0;
dfs(int n,int deep){
	if(deep>maxdep){
		maxdep=deep;
	}
	for(int i=0;i<graph[n].size();i++){
		int t=graph[n][i];
			dfs(t,deep+1);
	}
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int v,w;
		scanf("%d%d",&v,&w);
		graph[v].push_back(w);
	}
	for(int i=1;i<=n;i++){
			dfs(i,0);
	}
	printf("%d",maxdep);
}

Compiler output:
a.cc:6:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
    6 | dfs(int n,int deep){
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxx=1e5+10;
vector<int>graph[maxx];
int maxdep=0;
dfs(int n,int deep){
	if(deep>maxdep){
		maxdep=deep;
	}
	for(int i=0;i<graph[n].size();i++){
		int t=graph[n][i];
			dfs(t,deep+1);
	}
}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int v,w;
		scanf("%d%d",&v,&w);
		graph[v].push_back(w);
	}
	for(int i=1;i<=n;i++){
			dfs(i,0);
	}
	cout<<maxdep;
}

Compiler output:
a.cc:6:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
    6 | dfs(int n,int deep){
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
   14 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
vector<int>G[100010];
vector<int>dp(100010,0);
int r(){int x;cin>>x;return x;}
int dfs(int v){
    int &count=dp[v];
    if(count)return count;
    for(auto it:G[v])count=max(count,dfs(it)+1);
    return count;
}
void solve() 
{
    int n,m,ans=0;cin>>n>>m;
    REP(i,m)G[r()-1].pb(r()-1);
    REP(i,n)ans=max(ans,dfs(i));
    cout<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:17:22: error: 'class std::vector<int>' has no member named 'pb'
   17 |     REP(i,m)G[r()-1].pb(r()-1);
      |                      ^~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

#define f(i, n) for ( int i = 0; i < n; i++ )

const int M = 1005;
const int N = 100005;

bool g[N][N], viz[N];
int n, m, maxi = -1, len, max_len;


void dfs ( int x ){
  viz[x] = 1;
  len++;
  f (i, n){
    if ( g[x][i] && !viz[i] )
      dfs ( i );
    if (max_len < len )
      max_len = len;
  }
}



int main(){

  int x, y;

  cin >> n >> m;
  f (i, m){
    cin >> x >> y;
    g[x][y] = 1;
  }

  f( i, n ){
    len = 0;
    dfs( i );
  }

  cout << max_len;

  return 0;
}


Compiler output:
/tmp/ccGjOebR.o: in function `dfs(int)':
a.cc:(.text+0x13): relocation truncated to fit: R_X86_64_PC32 against symbol `viz' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x1d): relocation truncated to fit: R_X86_64_PC32 against symbol `len' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x26): relocation truncated to fit: R_X86_64_PC32 against symbol `len' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `viz' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `max_len' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x82): relocation truncated to fit: R_X86_64_PC32 against symbol `len' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x8c): relocation truncated to fit: R_X86_64_PC32 against symbol `len' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `max_len' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0x9c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGjOebR.o
/tmp/ccGjOebR.o: in function `main':
a.cc:(.text+0xb4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccGjOebR.o
a.cc:(.text+0xd0): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

//define DEBUG for debug
//#define DEBUG

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair 
#define pb push_back
#define MAX 100000+100
#define MOD 1000000007
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
vector<ll> edge[MAX];
ll dp[MAX],cevap = 0;
ll dfs(ll i){
	if(dp[i] == -1){
		ll ret = 0;
		for(int x : edge[i]){
			ret = max(ret,dfs(x)+1);
		}
		dp[i] = ret;
	}
	if(cevap < dp[i])
		cevap = dp[i];//define DEBUG for debug
#define DEBUG

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair 
#define pb push_back
#define MAX 100000+100
#define MOD 1000000007
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
vector<ll> edge[MAX];
ll dp[MAX],cevap = 0;
ll dfs(ll i){
	if(dp[i] == -1){
		ll ret = 0;
		for(int x : edge[i]){
			ret = max(ret,dfs(x)+1);
		}
		dp[i] = ret;
	}
	cevap = max(cevap,dp[i]);
	//cout << i << ' ' << dp[i] << ' ';
	return dp[i];
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef DEBUG
	freopen("i.txt","r",stdin);
	freopen("o.txt","w",stdout);
#endif
	ll n,m;cin >> n >> m;
	memset(dp,-1,MAX+100);
	for(ll i = 0;i < m;i++){
		ll a,b;cin >> a >> b;
		edge[a-1].pb(b-1);
	}
	for(ll i = 0;i <= n;i++){
		if(dp[i] == -1)
			dfs(i);
	}
	cout << cevap;
	return 0;
}
	//cout << i << ' ' << dp[i] << ' ';
	return dp[i];
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef DEBUG
	freopen("i.txt","r",stdin);
	freopen("o.txt","w",stdout);
#endif
	ll n,m;cin >> n >> m;
	memset(dp,-1,MAX+100);
	for(ll i = 0;i < m;i++){
		ll a,b;cin >> a >> b;
		edge[a-1].pb(b-1);
	}
	for(ll i = 0;i <= n;i++){
		if(dp[i] == -1)
			dfs(i);
	}
	cout << cevap;
	return 0;
}

Compiler output:
a.cc: In function 'll dfs(ll)':
a.cc:42:13: error: a function-definition is not allowed here before '{' token
   42 | ll dfs(ll i){
      |             ^
a.cc:54:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   54 | int main(){
      |         ^~
a.cc:54:9: note: remove parentheses to default-initialize a variable
   54 | int main(){
      |         ^~
      |         --
a.cc:54:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:54:11: error: a function-definition is not allowed here before '{' token
   54 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int dp[100020];


int n[100001][100010];
int le[100001];

int lp(int i)
{
    if(n[i] == 0)
    {
        dp[i] = 0;
        return 0;
    }
    else
    {
        int max = -1;
        for(int o = 0; o < 100; o++)
        {
            if(dp[o] == -1)
            {
                dp[o] = lp(o);
            }
            else
            {
                if(dp[o] > max)
                    max = dp[o];
            }            
        }
        dp[i] = max;
        return max;
    }    
}

int main()
{
    int N, M;

    cin >> N >> M;
    for(int i = 1; i <= N; i++)
    {
        le[i] = 0;
        dp[i] = -1;
    }

    

    int x, y;

    for(int i = 1; i <= M; i++)
    {
        cin >> x >> y;

        n[x][le[x]] = y;
        le[x]++;
    }

    for(int i = 1; i <= N; i++)
    {
        cout << i << ": " << le[i] << endl;
    }



    int rez = 0;

    for(int i = 1; i <= N; i++)
    {
        int t = lp(i);
        if(t > rez)
            rez = t;
    }

    cout << rez;

    return 0;
}

Compiler output:
/tmp/ccMwWcZo.o: in function `main':
a.cc:(.text+0x103): relocation truncated to fit: R_X86_64_PC32 against symbol `le' defined in .bss section in /tmp/ccMwWcZo.o
a.cc:(.text+0x17c): relocation truncated to fit: R_X86_64_PC32 against symbol `le' defined in .bss section in /tmp/ccMwWcZo.o
a.cc:(.text+0x1b9): relocation truncated to fit: R_X86_64_PC32 against symbol `le' defined in .bss section in /tmp/ccMwWcZo.o
a.cc:(.text+0x1d0): relocation truncated to fit: R_X86_64_PC32 against symbol `le' defined in .bss section in /tmp/ccMwWcZo.o
a.cc:(.text+0x22c): relocation truncated to fit: R_X86_64_PC32 against symbol `le' defined in .bss section in /tmp/ccMwWcZo.o
collect2: error: ld returned 1 exit status
Language: C++

// 動的計画法
// knapsack

#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <climits>
#include <cmath>
#include <functional>
#include <map>
#include <queue>
#include <set>
#include <stack>

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

const int n_max = 1e5 + 5;

int n,m,value;
int x[n_max], y[n_max];
vector<int> v[n_max];
vector<int> s[n_max];
int dp[n_max];
int temp, result;

int depth(int i) {
  if(dp[i] != -1) return dp[i];
  while(v[i].size()) {
    temp = v[i].back();v[i].pop_back();
    dp[i] = max(dp[i], depth(temp) + 1);
  }
  dp[i] = max(dp[i], 1);
  return dp[i];
}

int main() {
  cin >> n >> m;
  rep(i,n) {
    cin >> x[i] >> y[i];
    s[x[i]].push_back(y[i]);
  }
  rep(i,n+1) dp[i] = -1;
  rep(i,n) {
    if(s[i+1].size() == 0) {
      v = s;
      depth(i+1);
    }
  }
  rep(i,n) {
    result = max(result, dp[i+1]);
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:9: error: invalid array assignment
   79 |       v = s;
      |       ~~^~~
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <bits/stdc++.h>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;


vector <vector<int>> g;
vector <bool> used;
vector <int> v;


//行きがけか帰りがけか?
int dfs(int u)
{
    if(used[u])return 0;

    used[u] = true;
    for(int i: g[u])
    {
        dfs(i);
    }
    v.push_back(u);
}

void tsort(){
	for(int i = 0; i < n; i++) dfs(i);
	//reverse(v.begin(), v.end());
}

int main() {
    ll N,M;
    cin >> N >> M;
    g.resize(N);
    used.resize(N, false);
    
    REP(i,M)
    {
        int x, y;
        cin >> x >> y;
        --x;--y;
        g[x].push_back(y);
    }

    tsort();
	//なぜ、二重にreverse???
    //reverse(v.begin(), v.end());


    //dp[i]: トポロジカルソートで頂点iより後ろのパスの最大長
    vector <int>dp(N,0);
    int res = 0;
    //vの順がソートされている
    for(int i: v)
    {
        for(int u: g[i])
        {
            dp[i] = max(dp[i],dp[u] + 1);
        }
        res = max(res, dp[i]);
    }




    cout << res << endl;

    return 0;
}


Compiler output:
a.cc: In function 'void tsort()':
a.cc:37:28: error: 'n' was not declared in this scope
   37 |         for(int i = 0; i < n; i++) dfs(i);
      |                            ^
a.cc: In function 'int dfs(int)':
a.cc:33:16: warning: control reaches end of non-void function [-Wreturn-type]
   33 |     v.push_back(u);
      |     ~~~~~~~~~~~^~~
Language: C++

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<cstring>
#include<vector>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long LL;
const int maxn = 1e5+5;

vector<int>vec[maxn];
queue<int>q;
int in[maxn],num[maxn];

int main(){	
	int n,m;
	scanf("%d",&n);
	scanf("%d",&m);
	for(int i = 0; i <= n; i++) in[i] = 0;
	int u,v;
	for(int i = 1; i <= m; i++){
		scanf("%d %d",&u,&v);
		vec[u].push_back(v);
		in[v]++;
	}
	for(int i = 1; i <= n; i++){
		if(in[i] == 0) q.push(i);
	}
	int ans = 0;
	while(!q.empty()){
		int now = q.top(); q.pop();
		int len = vec[now].size();
		for(int i = 0; i < len; i++){
			if(--in[vec[now][i]] == 0){
				q.push(vec[now][i]);
				num[vec[now][i]] = num[now] + 1;
				ans = max(ans, num[vec[now][i]]);
			}
		}
	}
	printf("%d",ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:29: error: 'class std::queue<int>' has no member named 'top'; did you mean 'pop'?
   32 |                 int now = q.top(); q.pop();
      |                             ^~~
      |                             pop