func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int da[550];   int dp[550][1050];   int dp2[550][550];   struct kutija {     int in, out, w, s, v;   } K[505];   bool cmp(const kutija &a, const kutija &b) {     if (a.in != b.in) return a.in < b.in;     if (a.out != b.out) return a.out > b.out;     return a.s > b.s;   }   int rek(int x, int g) {     if (g < 0) return -1e9;     if (x == n + 1) return 0;     if (dp[x][g] != -1) return dp[x][g];     memset(dp2[x], 0, sizeof dp2[x]);     for (int i = x + 1; i <= n; i++) {       dp2[x][i + 1] = max(dp2[x][i + 1], dp2[x][i]);       if (K[i].in >= K[x].out || K[i].out > K[x].out) continue;       dp2[x][da[i]] = max(dp2[x][da[i]],                           dp2[x][i] + K[i].v + rek(i, min(K[i].s, g - K[i].w)));     }     dp[x][g] = dp2[x][n + 1];     return dp2[x][n + 1];   }   int main(void) {     scanf( %d%d , &n, &K[0].s);     K[0].in = 0;     K[0].out = 2 * n;     K[0].w = 0;     K[0].v = 0;     for (int i = 1; i <= n; i++)       scanf( %d%d%d%d%d , &K[i].in, &K[i].out, &K[i].w, &K[i].s, &K[i].v);     sort(K, K + n + 1, cmp);     memset(dp, -1, sizeof dp);     for (int i = 0; i <= n; i++) {       da[i] = n + 1;       for (int j = 0; j < n + 1; j++) {         if (K[i].out <= K[j].in) {           da[i] = j;           break;         }       }     }     printf( %d , rek(0, K[0].s));     return 0;   }   