func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 1;   const int M = 1e9 + 7;   int n;   vector<int> d;   vector<pair<int, int> > construct(int cur, vector<int> d) {     if (((int)d.size()) == 0) return vector<pair<int, int> >();     vector<pair<int, int> > tmp;     for (int i = 0; i < (d[0]); i++) {       for (int j = cur + i + 1; j <= cur + d.back(); j++)         tmp.push_back(make_pair(cur + i, j));     }     cur += d[0];     for (int i = 1; i < ((int)d.size()); i++) d[i] -= d[0];     d.erase(d.begin());     if (((int)d.size())) d.pop_back();     auto t = construct(cur, d);     for (auto x : t) tmp.push_back(x);     return tmp;   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n;     d.resize(n);     for (int i = 0; i < (n); i++) cin >> d[i];     auto ans = construct(0, d);     cout << ((int)ans.size()) << endl;     for (auto x : ans) cout << x.first + 1 <<     << x.second + 1 << endl;   }   