func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:268435456 )   using namespace std;   template <typename T1, typename T2>   istream& operator>>(istream& in, pair<T1, T2>& t) {     return in >> t.first >> t.second;   }   template <typename T1, typename T2>   ostream& operator<<(ostream& out, pair<T1, T2>& t) {     return out << t.first <<     << t.second << endl;   }   template <typename T>   istream& operator>>(istream& in, vector<T>& t) {     for (long long i = 0; i < t.size(); i++) in >> t[i];     return in;   }   template <typename T>   ostream& operator<<(ostream& out, vector<T>& t) {     for (long long i = 0; i < t.size(); i++) out << t[i] <<    ;     return out;   }   long long n, d, k;   vector<vector<long long> > g;   long long in = 1;   void printg(long long x, long long p = -1) {     for (long long to : g[x]) {       cout << x + 1 <<     << to + 1 << endl;       printg(to, x);     }   }   void con(long long x) {     g[x].push_back(in++);     if (in >= n) {       puts( YES );       printg(0);       exit(0);     }   }   void add(long long h) {     long long t = 0;     for (long long i = 1; i <= h; ++i) {       con(t);       t = in - 1;     }   }   void build(long long x, long long p, long long h, long long curh = 1) {     if (curh >= h) return;     for (long long i : g[x]) {       build(i, x, h, curh + 1);     }     while (g[x].size() < k - 1) {       con(x);       build(in - 1, x, h, curh + 1);     }   }   signed main() {     long long rrrr = 1e5;     cin >> n >> d >> k;     d++;     if (n < d) return puts( NO ), 0;     if (k == 1) {       if (n == d && n == 2) {         cout <<  YES  << endl;         for (long long i = 0; i < n - 1; ++i) {           cout << i + 1 <<     << i + 2 << endl;         }         return 0;       } else         return puts( NO ), 0;     }     --d;     g.resize(n);     add(d / 2);     add((d + 1) / 2);     build(g[0][0], 0, d / 2);     build(g[0][1], 0, (d + 1) / 2);     for (long long i = 2; i < k; ++i) {       if (d / 2 == 0) continue;       con(0);       build(in - 1, 0, d / 2);     }     cout <<  NO  << endl;     return 0;   }   