func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 2500 + 5;   int cnt = 0;   int rec[MAXN], mp[MAXN][MAXN], dp[MAXN][MAXN];   bool prime[MAXN];   void init(int n) {     memset(prime, true, sizeof(prime));     prime[0] = prime[1] = false;     for (int i = 2; i <= n; i++) {       if (prime[i]) rec[cnt++] = i;       for (int j = 0; j < cnt && rec[j] <= n / i; j++) {         prime[i * rec[j]] = false;         if (i % rec[j] == 0) break;       }     }   }   int main() {     init(600);     int n, m;     scanf( %d%d , &n, &m);     memset(mp, 0, sizeof(mp));     memset(dp, 0, sizeof(dp));     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         scanf( %1d , &mp[i][j]);         dp[i][j] = dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1] + mp[i][j];       }     int ans = dp[n][m], up = max(n, m);     for (int i = 0; rec[i] < up && i < cnt; i++) {       int tmp = 0;       for (int j = 0; j < n + rec[i]; j += rec[i])         for (int k = 0; k < m + rec[i]; k += rec[i]) {           int sum = dp[min(n, j + rec[i])][min(m, k + rec[i])] -                     dp[min(n, j)][min(m, k + rec[i])] -                     dp[min(n, j + rec[i])][min(m, k)] + dp[min(n, j)][min(m, k)];           tmp += min(rec[i] * rec[i] - sum, sum);         }       ans = min(ans, tmp);     }     printf( %d n , ans);     return 0;   }   