func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int sett(long long int N, int pos) { return N = N | (1 << pos); }   int reset(int N, int pos) { return N = N & ~(1 << pos); }   bool check(int N, int pos) { return (bool)(N & (1 << pos)); }   void update(long long &x, long long val) {     x = x + val;     if (x > 1000000007) x -= 1000000007;   }   void fast() {     ios_base::sync_with_stdio(0);     cin.tie(NULL), cout.tie(NULL);   }   long long int poww(long long int a, long long int b) {     long long int ans = 1;     while (b--) {       ans *= a;     }     return ans;   }   int moves[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};   char a[300][300];   long long int num[300][300];   long long int ans[300][300];   int n, m;   long long int p, q;   int vis[250][250];   int valid(int i, int j) {     if (i < 0 || i >= n || j < 0 || j >= m) return 0;     if (a[i][j] ==  * ) return 0;     return 1;   }   void dfs(int i, int j, long long int val, int dfs_cnt) {     cout <<  now in      << i <<     << j << endl;     vis[i][j] = dfs_cnt;     ans[i][j] += val;     long long int next_level = val / 2;     if (!next_level) return;     for (int k = 0; k < 4; k++) {       int next_i = i + moves[k][0];       int next_j = j + moves[k][1];       if (valid(next_i, next_j) && vis[next_i][next_j] != dfs_cnt) {         dfs(next_i, next_j, next_level, dfs_cnt);       }     }   }   void bfs(int i, int j, long long int val, int bfs_cnt) {     queue<pair<pair<int, int>, long long int> > q;     q.push(make_pair(make_pair(i, j), val));     vis[i][j] = bfs_cnt;     while (!q.empty()) {       pair<pair<int, int>, long long int> frnt;       frnt = q.front();       q.pop();       int ii = frnt.first.first;       int jj = frnt.first.second;       long long int val = frnt.second;       ans[ii][jj] += val;       long long int next_level = val / 2;       if (next_level == 0) continue;       for (int k = 0; k < 4; k++) {         int next_i = ii + moves[k][0];         int next_j = jj + moves[k][1];         if (valid(next_i, next_j) && vis[next_i][next_j] != bfs_cnt) {           vis[next_i][next_j] = bfs_cnt;           pair<pair<int, int>, long long int> temp;           temp = make_pair(make_pair(next_i, next_j), next_level);           q.push(temp);         }       }     }   }   bool cmp(pair<pair<int, int>, int> a, pair<pair<int, int>, int> b) {     if (a.first.first > b.first.first)       return 1;     else if (a.first.first == b.first.first) {       if (a.first.second < b.first.second) return 1;     }     return 0;   }   int main() {     int n, k, m, a;     scanf( %d%d , &n, &k);     scanf( %d%d , &m, &a);     int vote_time[200][2];     memset(vote_time, 0, sizeof(vote_time));     int cnt = n;     for (int i = 1; i <= a; i++) {       int p;       scanf( %d , &p);       vote_time[p][0]++;       vote_time[p][1] = i;       if (vote_time[p][0] == 1) cnt--;     }     int ans[n + 10];     memset(ans, 0, sizeof(ans));     if (m == 0) {       for (int i = 1; i <= n; i++) printf( 3  );       return 0;     }     int flag0 = 0;     for (int i = 1; i <= n; i++) {       if (vote_time[i][0] == 0 && flag0 == 3) {         ans[i] = 3;         continue;       }       int candidates_vote = vote_time[i][0] + (m - a);       int candidates_time = vote_time[i][1];       if (m - a > 0) candidates_time = m;       if (candidates_vote == 0) {         ans[i] = 3;         flag0 = 3;       }       vector<pair<pair<int, int>, int> > bal;       pair<pair<int, int>, int> temp =           make_pair(make_pair(candidates_vote, candidates_time), i);       bal.push_back(temp);       for (int j = 1; j <= n; j++) {         if (i != j) {           temp = make_pair(make_pair(vote_time[j][0], vote_time[j][1]), j);           bal.push_back(temp);         }       }       sort(bal.begin(), bal.end(), cmp);       int pos = m;       for (int j = 0; j < n; j++) {         if (bal[j].second == i) {           pos = j + 1;           break;         }       }       if (pos > k) {         ans[i] = 3;         if (vote_time[i][0] == 0) {           flag0 = 3;         }       }     }     for (int i = 1; i <= n; i++) {       if (ans[i] > 0) continue;       if (vote_time[i][0] == 0) {         ans[i] == 2;         continue;       }       vector<pair<pair<int, int>, int> > bal;       pair<pair<int, int>, int> temp;       for (int j = 1; j <= n; j++) {         temp = make_pair(make_pair(vote_time[j][0], vote_time[j][1]), j);         bal.push_back(temp);       }       sort(bal.begin(), bal.end(), cmp);       int pos = m;       for (int j = 0; j < n; j++) {         if (bal[j].second == i) {           pos = j + 1;           break;         }       }       int sorte_hobe = k - pos + 1;       if (k == n) {         ans[i] = 1;         continue;       }       int tot_need = 0;       for (int j = pos; j < pos + sorte_hobe; j++) {         int gap = bal[pos - 1].first.first - bal[j].first.first + 1;         tot_need += gap;       }       int baki_ase = m - a;       if (tot_need > baki_ase) {         ans[i] = 1;       }       if (tot_need == 0 && baki_ase == 0) {         ans[i] = 1;       }     }     for (int i = 1; i <= n; i++) {       if (ans[i] == 0)         printf( 2  );       else         printf( %d  , ans[i]);     }     return 0;   }   