func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 1e3 + 100;   int n, p, k;   int dp[2][maxn][55][55];   int maks[2][2][maxn][55];   int tmaks[2][maxn];   int question[2][maxn];   int main() {     scanf( %d %d %d , &n, &p, &k);     int cnt, x;     int res = 0;     for (int i = 0; i < 2; ++i) {       scanf( %d , &cnt);       while (cnt--) {         scanf( %d , &x);         question[i][x] = 1;       }     }     if (p > 2 * ceil(n / k)) {       for (int i = 1; i <= n; ++i) res += (question[0][i] || question[1][i]);       cout << res << endl;       return 0;     }     int now = 0;     memset(dp, 0xc0, sizeof dp);     memset(maks, 0xc0, sizeof maks);     memset(tmaks, 0xc0, sizeof tmaks);     maks[1][0][0][0] = maks[1][1][0][0] = tmaks[1][0] = 0;     for (int i = 1; i <= n; ++i) {       for (int j = 0; j <= p; ++j) {         tmaks[now][j] = -0x3f3f3f3f;         for (int r = 0; r <= k; ++r) {           maks[now][0][j][r] = maks[now][1][j][r] = -0x3f3f3f3f;           for (int r1 = 0; r1 <= k; ++r1) dp[now][j][r][r1] = -0x3f3f3f3f;         }       }       for (int j = 0; j <= p; ++j) {         for (int r1 = 0; r1 <= k; ++r1) {           for (int r2 = 0; r2 <= k; ++r2) {             int &cur = dp[now][j][r1][r2];             if (r1 > 1 && r2 > 1 && j >= 2)               cur = max(cur, dp[!now][j][r1 - 1][r2 - 1] +                                  (question[0][i] || question[1][i]));             if ((r1 == 0 || r1 == 1) && j >= r1 && !(r2 == 0 || r2 == 1))               cur = max(cur, maks[!now][0][j - r1][r2 - 1] +                                  (question[1][i] || (question[0][i] && r1)));             if ((r2 == 0 || r2 == 1) && j >= r2 && !(r1 == 0 || r1 == 1))               cur = max(cur, maks[!now][1][j - r2][r1 - 1] +                                  ((question[1][i] && r2) || question[0][i]));             if ((r1 == 0 || r1 == 1) && (r2 == 0 || r2 == 1) && j >= r1 + r2)               cur = max(cur, tmaks[!now][j - r1 - r2] + ((question[0][i] && r1) ||                                                          (question[1][i] && r2)));             tmaks[now][j] = max(tmaks[now][j], cur);             maks[now][0][j][r2] = max(maks[now][0][j][r2], cur);             maks[now][1][j][r1] = max(maks[now][1][j][r1], cur);             res = max(res, cur);           }         }       }       now = !now;     }     printf( %d n , res);   }   