func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k, mx, a[100][100], dp[100][100], me[100], inf = -1e15;   int sub(int a, int b) { return (((a - b) % k) + k); }   signed main(void) {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m >> k;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) cin >> a[i][j];     memset(dp, -1, sizeof dp);     dp[0][0] = 0;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         for (int u = min(m / 2, j); u >= 1; u--) {           for (int t = 0; t < k; t++) {             int x = sub(t, a[i][j]) % k;             if (dp[u - 1][x] != -1)               dp[u][t] = max(dp[u][t], dp[u - 1][x] + a[i][j]);           }         }       }       for (int u = 1; u <= m / 2; u++) {         for (int t = 0; t < k; t++) {           dp[0][t] = max(dp[0][t], dp[u][t]);           if (n != i) dp[u][t] = -1;         }       }     }     int mx = 0;     for (int i = 0; i <= m / 2; i++) mx = max(mx, dp[i][0]);     cout << mx <<   n ;   }   