func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (!isdigit(ch)) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = x * 10 + ch - 48;       ch = getchar();     }     return x * f;   }   int n, m, W;   int w[100010], b[100010];   int f[1010];   vector<int> v[1010];   int find(int x) {     if (x == f[x]) return x;     f[x] = find(f[x]);     return f[x];   }   int dp[1010];   int main() {     n = read(), m = read(), W = read();     for (int i = 1; i <= n; ++i) w[i] = read();     for (int i = 1; i <= n; ++i) b[i] = read();     for (int i = 1; i <= n; ++i) f[i] = i;     for (int i = 1; i <= m; ++i) {       int u = read(), v = read();       f[find(u)] = find(v);     }     int tot = n;     for (int i = 1; i <= n; ++i) v[find(i)].push_back(i);     for (int i = 1; i <= n; ++i) {       int len = v[i].size() - 1;       int ww = 0, bb = 0;       if (len < 0) continue;       for (int j = 0; j <= len; ++j) ww += w[v[i][j]], bb += b[v[i][j]];       if (len > 0) {         if (ww > W) continue;         v[i].push_back(++tot);         w[tot] = ww, b[tot] = bb;       }     }     for (int i = 1; i <= n; ++i) {       int len = v[i].size() - 1;       if (len < 0) continue;       for (int j = W; j >= 0; --j) {         for (int k = 0; k <= len; ++k) {           int x = v[i][k];           if (j >= w[x]) dp[j] = max(dp[j], dp[j - w[x]] + b[x]);         }       }     }     int ans = 0;     for (int i = 1; i <= W; ++i) ans = max(ans, dp[i]);     printf( %d n , ans);     return 0;   }   