func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<pair<int, int> > sort_positions;     int a[n];     for (int i = 0; i < n; i++) {       cin >> a[i];       sort_positions.push_back(make_pair(a[i], i));     }     sort(a, a + n);     sort(sort_positions.begin(), sort_positions.end());     set<vector<int> > subsets;     for (int i = 0; i < n; i++) {       bool isempty = true;       vector<int> next_subset;       for (int j = 0; j < i; j++)         if (a[j] > i) {           next_subset.push_back(1);           isempty = false;         } else           next_subset.push_back(0);       int next_num = min(a[i], i + 1);       set<vector<int> > next_subsets;       if (isempty) {         next_subset.push_back(1);         next_subsets.insert(next_subset);         next_num--;         for (set<vector<int> >::iterator it = subsets.begin();              it != subsets.end(); it++) {           vector<int> subset(*it);           if (next_num > 0)             subset.push_back(1);           else             subset.push_back(0);           next_subsets.insert(subset);           next_num--;         }       } else {         for (set<vector<int> >::iterator it = subsets.begin();              it != subsets.end(); it++) {           vector<int> subset(*it);           if (next_num > 0)             subset.push_back(1);           else             subset.push_back(0);           next_subsets.insert(subset);           next_num--;         }         next_subset.push_back(0);         next_subsets.insert(next_subset);         if (next_num == 1) {           vector<int> subset(i, 0);           subset.push_back(1);           next_subsets.insert(subset);         }       }       subsets = next_subsets;     }     vector<int> ox[n];     for (int i = 0; i < sort_positions.size(); i++) {       int idx = sort_positions[i].second;       ox[idx].resize(0);       for (set<vector<int> >::iterator it = subsets.begin(); it != subsets.end();            it++)         ox[idx].push_back((*it)[i]);     }     cout << subsets.size() << endl;     for (int i = 0; i < subsets.size(); i++) {       for (int j = 0; j < n; j++) cout << ox[j][i];       cout << endl;     }     return 0;   }   