Language: C++

#include "bits/stdc++.h"
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)


#define MAX_V 200000
vector<int> G[MAX_V];
vector<int> rG[MAX_V];
vector<int> each_scc[MAX_V];


void add_edge(int from, int to){
    G[from].push_back(to);
    rG[to].push_back(from);
}

void dfs(int v,bool used[], vector<int> &vs){
    used[v] = true;
    rep(i,G[v].size()){
        if(!used[G[v][i]])dfs(G[v][i],used,vs);
    }
    vs.push_back(v);
}

void rdfs(int v,int k,vector<int> &sccs, vector<int> &cmp, bool used[]){
    used[v] = true;
    sccs.push_back(v);
    cmp[v]=k;
    rep(i,rG[v].size()){
        if(!used[rG[v][i]])rdfs(rG[v][i],k,sccs,cmp,used);
    }
}

int scc(int V, vector<int> &cmp){
    vector<int> vs;
    bool used[MAX_V];
    fill(used, used+MAX_V, false);
    vs.clear();
    rep(v,V){
        if(!used[v])dfs(v,used, vs);
    }
    fill(used, used+MAX_V, false);
    int k=0;
    int cnt = 0;
    for(int i=vs.size()-1;i>=0;i--){
        vector<int> sccs;
        if(!used[vs[i]]){
            rdfs(vs[i],k++,sccs,cmp,used);
            each_scc[cnt++] = sccs;
        }
    }
    return k;
}


vector<int> nG[MAX_V];


int dfs(int cur,int prev,vector<int> &cost){
    int ret = cost[cur];
    int add=0;
    for(auto &e:nG[cur]){
        if(e==prev)continue;
        add = max(add,dfs(e,cur,cost));
    }
    return ret+add;
}


int main(){
    int v,e;
    cin>>v>>e;
    vector<int> c(v);
    rep(i,v)cin>>c[i];
    rep(i,e){
        int a,b;
        cin>>a>>b;
        add_edge(a,v+b);
        add_edge(v+a,b);
    }

    vector<int> cmp(v*2);
    int k = scc(2*v,cmp);

//    set<pii> st;

    rep(i,k){
        set<int> st;
        for(auto &e:each_scc[i]){
            for(auto &to:G[e]){
                if(st.count(cmp[to])!=0)continue;
//                if(st.count(pii(i,cmp[to]))!=0)continue;
                if(i==cmp[to])continue;
//                st.insert(pii(i,cmp[to]));
                st.insert(cmp[to]);
                nG[i].pb(cmp[to]);
            }
        }
    }

    const auto f = [](vector<int> &list, vector<int> &cost, int v ){
        int ret = 0;
        for(auto &e:list){
            if(e>=v)continue;
            ret += cost[e];
        }
        return ret;
    };

    vector<int> nc(k);
    rep(i,k){
        nc[i] = f(each_scc[i],c);
    }
    cout<<dfs(cmp[0],-1,nc,v)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:119:18: error: no match for call to '(const main()::<lambda(std::vector<int>&, std::vector<int>&, int)>) (std::vector<int>&, std::vector<int>&)'
  119 |         nc[i] = f(each_scc[i],c);
      |                 ~^~~~~~~~~~~~~~~
a.cc:119:18: note: candidate: 'int (*)(std::vector<int>&, std::vector<int>&, int)' (conversion)
a.cc:119:18: note:   candidate expects 4 arguments, 3 provided
a.cc:108:20: note: candidate: 'main()::<lambda(std::vector<int>&, std::vector<int>&, int)>'
  108 |     const auto f = [](vector<int> &list, vector<int> &cost, int v ){
      |                    ^
a.cc:108:20: note:   candidate expects 3 arguments, 2 provided
a.cc:121:14: error: no matching function for call to 'dfs(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, int, std::vector<int>&, int&)'
  121 |     cout<<dfs(cmp[0],-1,nc,v)<<endl;
      |           ~~~^~~~~~~~~~~~~~~~
a.cc:24:6: note: candidate: 'void dfs(int, bool*, std::vector<int>&)'
   24 | void dfs(int v,bool used[], vector<int> &vs){
      |      ^~~
a.cc:24:6: note:   candidate expects 3 arguments, 4 provided
a.cc:66:5: note: candidate: 'int dfs(int, int, std::vector<int>&)'
   66 | int dfs(int cur,int prev,vector<int> &cost){
      |     ^~~
a.cc:66:5: note:   candidate expects 3 arguments, 4 provided