func_code_string: #include <bits/stdc++.h>   using namespace std;   void read_file(bool outToFile = true) {}   int A[500 + 9];   int n, m, b, mod;   int dp[2][500 + 9 + 2][500 + 9 + 1];   int build() {     int p = 0;     for (int c = 0; c <= b; c++) dp[p][0][c] = dp[!p][0][c] = 1;     for (int c = 0; c <= b; c++)       for (int r = 1; r <= m; r++) dp[p][r][c] = 0;     for (int i = n - 1; i >= 0; i--) {       p = !p;       for (int r = 1; r <= m; r++)         for (int c = b; c >= 0; c--)           if (A[i] + c <= b)             dp[p][r][c] = (dp[!p][r][c] + dp[p][r - 1][c + A[i]]) % mod;           else             dp[p][r][c] = dp[!p][r][c];     }     return dp[p][m][0];   }   int main() {     read_file(false);     while (cin >> n >> m >> b >> mod) {       for (int i = 0; i < n; i++) cin >> A[i];       cout << build() << endl;     }   }   