func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long INFF = 0x3f3f3f3f3f3f3f3fll;   const long long M = 1e9 + 7;   const long long maxn = 5007;   const double eps = 0.00000001;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   template <typename T>   inline T abs(T a) {     return a > 0 ? a : -a;   }   template <typename T>   inline T powMM(T a, T b) {     T ret = 1;     for (; b; b >>= 1ll, a = a * a % M) ret = 1ll * ret * a % M;     return ret;   }   vector<int> edge[maxn];   vector<long long> dp1[maxn], dp2[maxn];   long long now1[maxn], now2[maxn];   long long a[maxn], b[maxn], m;   int num[maxn], ans;   void dfs(int x) {     num[x] = 1;     dp1[x].resize(maxn, INFF);     dp2[x].resize(maxn, INFF);     dp1[x][1] = a[x];     dp1[x][0] = 0;     dp2[x][1] = a[x] - b[x];     dp2[x][0] = INFF;     int i, j;     for (int v : edge[x]) {       dfs(v);       for (i = 0; i <= num[x]; i++) now1[i] = dp1[x][i], now2[i] = dp2[x][i];       for (i = 0; i <= num[x]; i++)         for (j = 1; j <= num[v]; j++) {           dp1[x][i + j] = min(dp1[x][i + j], now1[i] + dp1[v][j]);           dp2[x][i + j] = min(dp2[x][i + j], now2[i] + min(dp1[v][j], dp2[v][j]));         }       vector<long long>().swap(dp1[v]);       vector<long long>().swap(dp2[v]);       num[x] += num[v];     }   }   int n;   int i, j, k;   int main() {     scanf( %d%I64d , &n, &m);     for (i = 1; i <= n; i++) {       scanf( %I64d%I64d , &a[i], &b[i]);       if (i != 1) {         int v;         scanf( %d , &v);         edge[v].push_back(i);       };     }     dfs(1);     ans = 0;     for (i = 1; i <= n; i++)       if (dp1[1][i] <= m || dp2[1][i] <= m) ans = max(ans, i);     printf( %d , ans);   }   