func_code_string: #include <bits/stdc++.h>   using namespace std;   struct info {     int l, r, need, onemore, take;   };   vector<string> solve(vector<int> a, int n) {     vector<string> ans(n + 1, string(n,  0 ));     vector<info> state = {{0, n, (n + 1) / 2, ((n + 1) & 1), 0}};     int pos = 0;     for (auto i : a) {       for (auto &j : state)         while (j.need && i) {           --i;           --j.need;           ++j.take;         }       for (auto &j : state)         if (j.onemore && i) {           --i;           --j.onemore;           ++j.take;         }       int j = 0;       while (i > 0) {         if (state[j].take != state[j].r - state[j].l + 1) {           --i;           ++state[j].take;         }         j = (j + 1) % state.size();       }       vector<info> nstate;       for (auto &k : state) {         for (int p = k.l; p < k.l + k.take; ++p) ans[p][pos] =  1 ;         if (k.take) nstate.push_back({k.l, k.l + k.take - 1, 0, 0, 0});         if (k.take < k.r - k.l + 1)           nstate.push_back({k.l + k.take, k.r, 0, 0, 0});       }       state = nstate;       for (auto &k : state) {         k.need = (k.r - k.l + 1) / 2;         k.onemore = (k.r - k.l + 1) & 1;         k.take = 0;       }       ++pos;     }     sort(ans.begin(), ans.end());     reverse(ans.begin(), ans.end());     while (!ans.empty() && ans.back() == string(n,  0 )) ans.pop_back();     return ans;   }   void validate(vector<int> a, int n, vector<string> ans) {     for (auto &j : ans)       for (int i = 0; i < n; ++i)         if (j[i] ==  1 ) --a[i];     assert(count(a.begin(), a.end(), 0) == n);     for (int i = 1; i < ans.size(); ++i) assert(ans[i - 1] != ans[i]);   }   int main() {     ios_base::sync_with_stdio(0), cin.tie(0);     int n;     cin >> n;     vector<int> a(n);     for (auto &i : a) cin >> i;     auto ans = solve(a, n);     validate(a, n, ans);     cout << ans.size() <<   n ;     for (auto i : ans) cout << i <<   n ;     return 0;   }   