func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxN = 11111;   pair<int, int> a[maxN];   short dp[maxN][maxN];   int s[maxN];   bool mycmp(pair<int, int> a, pair<int, int> b) {     if (a.second != b.second) return (a.second < b.second);     return (a.first > b.first);   }   int main() {     ios_base::sync_with_stdio(false);     int n, l, r;     cin >> n >> l >> r;     for (int i = 1; i <= n; ++i) {       cin >> a[i].first;     }     for (int i = 1; i <= n; ++i) {       cin >> a[i].second;     }     sort(a + 1, a + n + 1, mycmp);     int sum = 0;     for (int i = 1; i <= n; ++i) {       sum += a[i].first;     }     s[0] = 0;     for (int i = 1; i <= n; ++i) {       s[i] = s[i - 1] + a[i].first;     }     for (int i = 0; i <= n; ++i) {       for (int j = 0; j <= sum; ++j) {         dp[i][j] = -1;       }     }     dp[0][0] = 0;     for (int i = 0; i < n; ++i) {       for (int j = 0; j <= s[i]; ++j) {         if (dp[i][j] < 0) continue;         int type = a[i + 1].second, w = a[i + 1].first;         if (type == 0) {           dp[i + 1][j + w] = max(dp[i + 1][j + w], dp[i][j]);           dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);         } else {           int x = j, y = sum - (s[i] - j);           short f1 = (x >= l && x <= r);           if (dp[i][j] + f1 > dp[i + 1][j + w]) {             dp[i + 1][j + w] = dp[i][j] + f1;           }           short f2 = (y - a[i + 1].first >= l && y - a[i + 1].first <= r);           if (dp[i][j] + f2 > dp[i + 1][j]) {             dp[i + 1][j] = dp[i][j] + f2;           }         }       }     }     short ans = -1;     for (int i = 0; i <= sum; ++i) {       ans = max(ans, dp[n][i]);     }     cout << ans << endl;     return 0;   }   