func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1010;   int n, m, maxw, tot, w[maxn], b[maxn], fa[maxn], sumw[maxn], sumb[maxn],       dp[maxn << 1][maxn], f[maxn];   vector<int> child[maxn];   vector<pair<int, int> > vec;   unordered_set<int> ancestor;   void init() {     for (int i = 1; i <= n; i++) {       fa[i] = i;       sumw[i] = w[i];       sumb[i] = b[i];     }   }   int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }   void unite(int x, int y) {     x = find(x), y = find(y);     if (x == y) return;     fa[x] = y;     sumw[y] += sumw[x];     sumb[y] += sumb[x];   }   int main() {     scanf( %d %d %d , &n, &m, &maxw);     for (int i = 1; i <= n; i++) {       scanf( %d , &w[i]);     }     for (int i = 1; i <= n; i++) {       scanf( %d , &b[i]);     }     init();     while (m--) {       int x, y;       scanf( %d %d , &x, &y);       unite(x, y);     }     for (int i = 1; i <= n; i++) {       child[find(i)].push_back(i);       ancestor.insert(find(i));     }     for (int x : ancestor) {       int last = tot;       for (int y : child[x]) {         tot++;         for (int z = 0; z <= maxw; z++) {           dp[tot][z] = f[z];           if (z >= w[y]) {             dp[tot][z] = max(dp[tot][z], f[z - w[y]] + b[y]);           }         }       }       tot++;       for (int y = 0; y <= maxw; y++) {         dp[tot][y] = f[y];         if (y >= sumw[x]) {           dp[tot][y] = max(dp[tot][y], f[y - sumw[x]] + sumb[x]);         }       }       for (int y = last + 1; y <= tot; y++) {         for (int z = 0; z <= maxw; z++) {           f[z] = max(f[z], dp[y][z]);         }       }     }     printf( %d n , *max_element(f, f + maxw + 1));     return 0;   }   