func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   const int N = 1e2 + 5, M = 1e5 + 5;   int lim = (1 << 10) - 1;   bool vis[M];   vector<int> primes;   int idx[M];   void pre() {     for (int i = 2; primes.size() < 110; ++i) {       if (vis[i]) continue;       primes.emplace_back(i);       for (int j = i; j < M; j += i) vis[j] = true;     }     for (int i = 0; i < 110; ++i) idx[primes[i]] = i;   }   vector<int> tmp;   void fac(int x) {     tmp.clear();     for (int i = 2; i * i <= x; ++i) {       if (x % i) continue;       tmp.emplace_back(idx[i]);       while (x % i == 0) x /= i;     }     if (x > 1) tmp.emplace_back(idx[x]);   }   int n, a[N];   int dp[N][1 << 10][N + 10];   int solve(int i, int msk, int j) {     if (i == n) return 0;     if (msk == lim && j == 110) return (int)1e7;     int &ret = dp[i][msk][j];     if (~ret) return ret;     ret = (int)1e7;     if (j < 110 && a[i] > primes[j])       cout <<  yala n2fl ya 3mna kda mb2tsh nf3a  << endl;     if (j < 110) ret = min(ret, solve(i + 1, msk, j + 1) - a[i] + primes[j]);     for (int f = 0; f < 10; ++f) {       if ((msk & (1 << f))) continue;       int nw = primes[f];       for (int k = 0; k <= 15 && (int)1e7 / nw >= primes[f]; ++k, nw *= primes[f])         ret = min(ret, solve(i + 1, (msk | (1 << f)), j) + abs(a[i] - nw));     }     for (int hna = 1; hna <= 30; ++hna) {       bool baz = false;       int nmsk = msk;       fac(hna);       for (auto f : tmp) {         nmsk |= (1 << f);         baz |= ((msk & (1 << f)) > 0);       }       if (baz) continue;       ret = min(ret, solve(i + 1, nmsk, j) + abs(a[i] - hna));     }     return ret;   }   vector<int> out;   void build(int i, int msk, int j) {     if (i == n) {       for (auto x : out) printf( %d%c , x,    n [&x == &out.back()]);       exit(0);     }     if (msk == lim && j == 110) return;     int m3lsh = solve(i, msk, j);     if (j < 110 && m3lsh == solve(i + 1, msk, j + 1) - a[i] + primes[j]) {       out.emplace_back(primes[j]);       build(i + 1, msk, j + 1);       return;     }     for (int f = 0; f < 10; ++f) {       if ((msk & (1 << f))) continue;       int nw = primes[f];       for (int k = 0; k <= 15 && (int)1e7 / nw >= primes[f];            ++k, nw *= primes[f]) {         if (m3lsh == solve(i + 1, (msk | (1 << f)), j) + abs(a[i] - nw)) {           out.emplace_back(nw);           build(i + 1, (msk | (1 << f)), j);           return;         }       }     }     for (int hna = 1; hna <= 30; ++hna) {       bool baz = false;       int nmsk = msk;       fac(hna);       for (auto f : tmp) {         nmsk |= (1 << f);         baz |= (msk & (1 << f));       }       if (baz) continue;       if (m3lsh == solve(i + 1, nmsk, j) + abs(a[i] - hna)) {         out.emplace_back(hna);         build(i + 1, nmsk, j);         return;       }     }   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     ;     pre();     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %d , a + i);     memset(dp, -1, sizeof dp);     solve(0, 0, 10);     build(0, 0, 10);   }   