func_code_string: #include <bits/stdc++.h>   using namespace std;   struct numer {     int rost;     int num_of;     numer() : rost(0), num_of(0) {}     numer(int _rost, int _num_of) : rost(_rost), num_of(_num_of) {}   };   int maxim(int a, int b) { return a > b ? a : b; }   int comp(const void *a, const void *b) {     int *A = (int *)a, *B = (int *)b;     return *A < *B ? -1 : *A > *B ? 1 : 0;   }   void push(stack<int> &S, numer &chel) {     for (int i = 0; i < chel.num_of; i++) S.push(chel.rost);   }   int balance(int *Rost, int num, int *&ring, bool else_good = false,               bool good = false) {     qsort(Rost, num, sizeof(int), comp);     vector<numer> people;     numer temp(Rost[0], 1);     stack<int> Stack;     for (int i = 1; i < num; i++) {       if (Rost[i] == Rost[i - 1])         temp.num_of++;       else {         people.push_back(temp);         temp = numer(Rost[i], 1);       }     }     people.push_back(temp);     int kol = people.size(), min = 0, curr = 0, tmp = 0, tmp1, *p = 0;     if (else_good == false) {       for (int i = 1; i <= kol; i++) {         curr += people[i - 1].num_of;         if (i == kol) {           tmp1 = balance(Rost + min, curr - min, p, true, false);           if (tmp1 > tmp) {             ring = p;             tmp = tmp1;           }           continue;         }         if (people[i].rost - people[i - 1].rost >= 2) {           tmp1 = balance(Rost + min, curr - min, p, true, false);           if (tmp1 > tmp) {             ring = p;             tmp = tmp1;           }           min = curr;         }       }     }     if (tmp == 0) {       int new_curr = people[0].num_of, new_min = 0;       if (good == false) {         for (int i = 1; i < kol; i++) {           new_curr += people[i].num_of;           if (people[i].num_of == 1 || i == kol - 1) {             tmp1 = balance(Rost + new_min, new_curr - new_min, p, true, true);             if (tmp1 > tmp) {               ring = p;               tmp = tmp1;             }             new_min = new_curr - people[i].num_of;           }         }         if (kol == 1) {           tmp = tmp1 = new_curr;           ring = new int[tmp];           for (int j = 0; j < tmp; j++) ring[j] = people[0].rost;         }       } else {         for (int i = 0; i < kol; i++) {           Stack.push(people[i].rost);           people[i].num_of--;         }         for (int i = kol - 1; i >= 0; i--) push(Stack, people[i]);         tmp = Stack.size();         ring = new int[tmp];         for (int i = 0; i < tmp; i++) {           ring[i] = Stack.top();           Stack.pop();         }       }     }     return tmp;   }   int main() {     int n;     cin >> n;     int *A = new int[n], *B = 0;     for (int i = 0; i < n; i++) cin >> A[i];     int k = balance(A, n, B);     cout << k << endl;     for (int i = 0; i < k; i++) cout << B[i] <<    ;     delete[] A;     delete[] B;     return 0;   }   