func_code_string: #include <bits/stdc++.h>   using namespace std;   bool q[2][1001];   short qf[3][1001], an[1001][1001][50][2];   inline short gt(int l, int r, int p) { return qf[p][r] - qf[p][l - 1]; }   int main() {     int n, p, k;     scanf( %d%d%d , &n, &p, &k);     for (int i = 0; i < (int)(2); ++i) {       int t;       scanf( %d , &t);       while (t--) {         int t;         scanf( %d , &t);         q[i][t] = true;       }     }     for (int i = 1; i < (int)(n + 1); ++i) {       qf[0][i] = qf[0][i - 1] + q[0][i];       qf[1][i] = qf[1][i - 1] + q[1][i];       qf[2][i] = qf[2][i - 1] + (q[0][i] || q[1][i]);     }     for (int i = 0; i < (int)(p + 1); ++i)       for (int j = 0; j < (int)(n + 1); ++j)         for (int w = 0; w < (int)(k); ++w)           for (int c = 0; c < (int)(2); ++c) an[i][j][w][c] = -2000;     for (int l = 0; l < (int)(p + 1); ++l)       for (int i = 0; i < (int)(n + 1); ++i) an[l][i][0][0] = an[l][i][0][1] = 0;     for (int l = 1; l < (int)(p + 1); ++l)       for (int i = 1; i < (int)(n + 1); ++i)         for (int j = 0; j < (int)(min(k, i + 1)); ++j)           for (int c = 0; c < (int)(2); ++c) {             short &a = an[l][i][j][c];             if (j)               a = gt(i, i, c) + an[l - (j == 1)][i - 1][j - 1][c];             else {               for (int z = 1; z < (int)(k); ++z)                 a = max(a, (short)(gt(i, i, c) + an[l][i - 1][z][c]));               a = max(a, an[l][i - 1][0][c]);             }             if (j > 1) a = max(a, an[l][i][j - 1][c]);             for (int z = 0; z < (int)(2); ++z)               a = max(a, (short)(gt(i, i, c) + an[l - 1][i - 1][0][z]));             a = max(a, (short)(gt(i - j + 1, i, 2) +                                an[l - 1][i - j][j ? k - j : 0][c ^ 1]));           }     short a = 0;     for (int i = 0; i < (int)(k); ++i)       for (int j = 0; j < (int)(2); ++j) a = max(a, an[p][n][i][j]);     printf( %u n , a);   }   