func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 210000, K = 60;   int n, k, p;   int a[N], sum[N], f[N][K];   int main() {     scanf( %d%d%d , &n, &k, &p);     for (int i = 1; i <= n; i++)       scanf( %d , &a[i]), sum[i] = (sum[i - 1] + a[i] % p) % p;     memset(f, -0x3f, sizeof(f));     f[0][0] = 0;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= k; j++) {         for (int o = 0; o <= p; o++) {           f[sum[i]][j] = max(f[sum[i]][j], f[o][j - 1] + (sum[i] - o + p) % p);         }       }     }     printf( %d n , f[sum[n]][k]);     return 0;   }   