func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, h, l, r;   int a[2000 + 5], dp[2000 + 5][2000 + 5];   int solve(int curr, int idx) {     if (idx == n) {       if (l <= curr && curr <= r)         return 1;       else         return 0;     }     if (dp[curr][idx] != -1) return dp[curr][idx];     int p1 = 0, p2 = 0;     if (l <= curr && curr <= r) {       p1 = 1;       p2 = 1;     }     p1 += solve((curr + a[idx]) % h, idx + 1);     p2 += solve((curr + a[idx] - 1) % h, idx + 1);     return dp[curr][idx] = max(p1, p2);   }   int main(int argc, const char* argv[]) {     scanf( %d %d %d %d , &n, &h, &l, &r);     for (int i = 0; i < n; i++) scanf( %d , &a[i]);     for (int i = 0; i <= h; i++) {       for (int j = 0; j <= n; j++) {         dp[i][j] = -1;       }     }     int k = solve(a[0], 1);     for (int i = 0; i <= h; i++) {       for (int j = 0; j <= n; j++) {         dp[i][j] = -1;       }     }     k = max(k, solve(a[0] - 1, 1));     printf( %d n , k);     return 0;   }   