func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long maxn = 305;   const long long mode = 1e9 + 7;   const long long maxm = 1e5 + 10;   long long n, q, t, w[maxn], fa[maxn], nw[maxn], dp[maxm], son[maxn], z[maxn],       cur, ww[maxn];   long long u, v;   signed main() {     cin >> n >> q >> t;     for (long long i = 1; i <= n; ++i) cin >> w[i];     bool juge = true;     while (q--) {       cin >> u >> v;       if (fa[u] == v) {         juge = false;       }       fa[v] = u;       son[u] = v;     }     if (!juge) {       cout << 0;       return 0;     }     for (long long i = 1; i <= n; ++i) {       if (fa[i] == 0 && son[i]) {         long long sum = 0;         long long now = i;         while (now) {           ww[now] = sum + w[now];           nw[now] = nw[fa[now]] + sum + w[now];           sum += w[now];           now = son[now];         }       }       if (fa[i] == 0 && son[i] == 0) nw[i] = ww[i] = w[i];       if (son[i] == 0 && fa[i]) {         z[++cur] = i;       }     }     long long sum = 0;     for (long long i = 1; i <= n; ++i) {       if (son[i] == 0 && fa[i]) {         long long temp = 0, now = i;         while (now) {           temp += w[now];           now = fa[now];         }         sum += nw[i] - temp;       }     }     if (sum > t) {       cout << 0;       return 0;     } else if (sum == t) {       cout << 1;       return 0;     }     dp[sum] = 1;     for (long long i = 1; i <= n; ++i) {       for (long long j = ww[i]; j <= t; ++j) {         if (dp[j - ww[i]]) dp[j] += dp[j - ww[i]];         dp[j] %= mode;       }     }     cout << dp[t];     return 0;   }   