func_code_string: #include <bits/stdc++.h>   const int maxx = 2e5 + 7;   const int maxn = 1e9 + 7;   using namespace std;   inline int read() {     int s = 0, w = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) s = s * 10 + ch -  0 , ch = getchar();     return s * w;   }   long long n, h, l, r;   int dp[2005][2005], a[2006];   int check(int op) {     if (op <= r && op >= l)       return 1;     else       return 0;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> h >> l >> r;     memset(dp, -1, sizeof dp);     dp[0][0] = 0;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       for (int j = 0; j < h; j++) {         if (dp[i - 1][(j - a[i] + h) % h] < 0 &&             dp[i - 1][(j - a[i] + 1 + h) % h] < 0)           continue;         dp[i][j] = max(dp[i - 1][(j - a[i] + h) % h],                        dp[i - 1][(j - a[i] + 1 + h) % h]) +                    check(j);       }     }     int ans = 0;     for (int i = 0; i < h; i++) {       ans = max(ans, dp[n][i]);     }     cout << ans << endl;     return 0;   }   