func_code_string: #include <bits/stdc++.h>   using namespace std;   struct pp {     long long cost;     bool operator<(const pp &temp) const { return cost < temp.cost; }   };   map<pp, int> hs;   int n, c[2];   pp now;   map<pp, int> solve(int n) {     map<pp, int> ret, ms;     map<pp, int>::iterator it;     pp u, now;     ret.clear();     if (n <= 3) {       now.cost = c[0];       ret[now]++;       now.cost = c[1];       ret[now]++;     }     if (n == 2) return ret;     if (n > 3) ret = solve(n / 2);     int nc = 0, vl;     while (n > 3 && nc < n / 2) {       it = ret.begin();       if (nc + it->second >= n / 2)         vl = n / 2 - nc;       else         vl = it->second;       u = it->first;       ret[u] -= vl;       if (ret[u] == 0) ret.erase(u);       nc += vl;       now = u;       now.cost += c[0];       ret[now] += vl;       now = u;       now.cost += c[1];       ret[now] += vl;     }     if (n & 1) {       it = ret.begin();       u = it->first;       ret[u]--;       if (ret[u] == 0) ret.erase(u);       now = u;       now.cost += c[0];       ret[now]++;       now = u;       now.cost += c[1];       ret[now]++;     }     return ret;   }   int main() {     scanf( %d%d%d , &n, &c[0], &c[1]);     if (c[0] == 0 || c[1] == 0) {       printf( %lld n , (long long)(n - 1) * (long long)max(c[0], c[1]));       return 0;     }     hs = solve(n);     map<pp, int>::iterator it;     pp u;     long long ans = 0;     for (it = hs.begin(); it != hs.end(); it++) {       u = it->first;       ans += (long long)u.cost * (long long)hs[u];     }     printf( %lld n , ans);     return 0;   }   