func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 505;   int n, in[N], out[N], w[N], s[N], v[N];   vector<int> st[N << 1];   int f1[N][N << 1], f2[N][N << 1];   int dfs(int x, int S) {     if (S < 0) return 0;     if (~f1[x][S]) return f1[x][S];     f2[x][out[x] + 1] = 0;     for (int i = out[x]; i >= in[x]; i--) {       f2[x][i] = f2[x][i + 1];       for (int j = 0; j < st[i].size(); j++) {         int p = st[i][j];         if (out[p] > out[x] || p == x) continue;         f2[x][i] = max(f2[x][i], dfs(p, min(S - w[p], s[p])) + f2[x][out[p]]);       }     }     return f1[x][S] = f2[x][in[x]] + v[x];   }   int main() {     int S;     scanf( %d%d , &n, &S);     for (int i = 1; i <= n; i++) {       scanf( %d%d%d%d%d , &in[i], &out[i], &w[i], &s[i], &v[i]);       st[in[i]].push_back(i);     }     memset(f1, -1, sizeof f1);     in[0] = 0;     out[0] = 2 * n + 1;     printf( %d n , dfs(0, S));     return 0;   }   