func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<pair<int, int>> tr;   int S(int n) {     int ans = 1;     while (ans < n) ans *= 2;     return ans;   }   int k;   void upd(int v) {     v += k;     tr[v].first--;     for (; v > 1; v >>= 1) {       tr[v >> 1] = max(tr[v], tr[v ^ 1]);     }   }   template <typename T>   inline T getint() {     T val = 0;     char c;     bool neg = false;     while ((c = getchar()) && !(c >=  0  && c <=  9 )) {       neg |= c ==  - ;     }     do {       val = (val * 10) + c -  0 ;     } while ((c = getchar()) && (c >=  0  && c <=  9 ));     return val * (neg ? -1 : 1);   }   inline void writeInt(int x) {     if (x < 0) putc( - , stdout), x = -x;     char s[20];     int n = 0;     while (x || !n) s[n++] =  0  + x % 10, x /= 10;     while (n--) putc(s[n], stdout);   }   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int x, y;       cin >> x >> y;       vector<vector<int>> pos(n + 2);       vector<int> b(n);       tr.assign(10 * n, {0, 0});       for (int i = 0; i < n; i++) {         b[i] = getint<int>();         pos[b[i]].push_back(i);       }       int zn;       for (int i = 1; i < n + 2; i++) {         if (pos[i].empty()) {           zn = i;           break;         }       }       k = S(n + 1);       for (int i = 1; i < n + 2; i++) {         tr[k + i - 1] = {pos[i].size(), i};       }       for (int i = k - 1; i > 0; i--) {         tr[i] = max(tr[i * 2], tr[i * 2 + 1]);       }       vector<int> ans(n + 2);       int kol = x;       vector<int> h(n + 2);       vector<int> st;       while (kol--) {         ans[tr[1].second]++;         if (!h[tr[1].second]) st.push_back(tr[1].second);         h[tr[1].second]++;         upd(tr[1].second - 1);       }       kol = n - y;       int last = 0;       for (int i = 1; i <= kol; i++) {         if (2 * tr[1].first <= n - x - last) {           break;         }         ans[tr[1].second]++;         if (!h[tr[1].second]) st.push_back(tr[1].second);         h[tr[1].second]++;         upd(tr[1].second - 1);         last = i;       }       if (tr[1].first * 2 > n - x - last) {         cout <<  NO n ;         continue;       }       vector<int> a(n);       for (auto& ss : st) {         for (int i = 0; i < ans[ss]; i++) {           if (x) {             a[pos[ss][i]] = ss;             --x;           } else {             a[pos[ss][i]] = zn;           }         }       }       vector<vector<int>> npos(n + 2);       h.assign(n + 2, 0);       vector<int> s;       vector<int> cp;       for (int i = 0; i < n; i++) {         if (!a[i]) {           npos[b[i]].push_back(i);           cp.push_back(i);           h[b[i]]++;           if (h[b[i]] == 1) s.push_back(b[i]);         }       }       for (int i = 0; i < s.size(); i++) {         if (npos[s[i]].empty()) continue;         int uk = min(i + 1, (int)s.size() - 1);         for (int j = 0; j < npos[s[i]].size(); j++) {           if (npos[s[uk]].empty()) ++uk;           if (uk > s.size() - 1) break;           int p2 = npos[s[uk]].back();           a[npos[s[i]][j]] = b[p2];           a[p2] = b[npos[s[i]][j]];           npos[s[uk]].pop_back();         }       }       int col;       int uk = -1;       vector<int> cp2;       h.assign(n + 2, 0);       for (int i = 0; i < cp.size(); i++) {         if (!a[cp[i]] || a[cp[i]] == b[cp[i]]) {           h[cp[i]]++;           cp2.push_back(cp[i]);           a[cp[i]] = b[cp[i]];           if (uk == -1) {             col = a[cp[i]];             uk = i;           }         }       }       if (uk != -1) {         int i = 0;         for (int j = 0; j < cp2.size(); j++) {           for (;; i++) {             if (a[cp[i]] != col && !h[cp[i]] && b[cp[i]] != col) {               swap(a[cp[i]], a[cp2[j]]);               break;             }           }         }       }       kol -= last;       for (int i = 0; i < cp.size(); i++) {         if (kol) {           a[cp[i]] = zn;           --kol;         } else           break;       }       cout <<  Yes n ;       for (int i = 0; i < a.size(); i++) {         writeInt(a[i]);         cout <<    ;       }       cout <<   n ;     }   }   