func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ii = pair<ll, ll>;   inline int get_state(ll s, int x) { return ((s >> (5 * x)) & 0x1f); }   inline ll set_state(ll s, ll v, int x) {     return ((s & ~(0x1fLL << (5 * x))) | (v << (5 * x)));   }   int cs[10];   map<ll, int> st;   map<ll, ii> ps;   bool kill_all(ll s, int n, int a, int b) {     for (int i = 2; i <= n - 1; ++i)       if (cs[i] >           b * get_state(s, i - 1) + a * get_state(s, i) + b * get_state(s, i + 1))         return false;     return true;   }   bool all_dead(ll s, int pos, int a, int b) {     for (int i = pos - 1; i <= pos + 1; ++i) {       if (cs[i] >           b * get_state(s, i - 1) + a * get_state(s, i) + b * get_state(s, i + 1))         return false;     }     return true;   }   int dp(ll s, int n, int a, int b) {     if (s == 0) return 0;     auto it = st.find(s);     if (it != st.end()) {       return it->second;     }     auto res = 1000000000;     for (int i = 2; i <= n - 1; ++i) {       if (get_state(s, i - 1) or get_state(s, i) or get_state(s, i + 1)) {         auto r = set_state(s, max(get_state(s, i) - a, 0), i);         r = set_state(r, max(get_state(r, i - 1) - b, 0), i - 1);         r = set_state(r, max(get_state(r, i + 1) - b, 0), i + 1);         auto value = dp(r, n, a, b) + 1;         if (value < res) {           res = value;           ps[s] = ii(r, i);         }       }     }     st[s] = res;     return res;   }   vector<int> solve(int n, int a, int b) {     vector<int> shoots;     ll s = 0;     for (int i = 1; i <= n; ++i) s = set_state(s, cs[i], i);     while (cs[1] > 0) {       shoots.push_back(2);       cs[1] -= b;       cs[2] -= a;       cs[3] -= b;       s = set_state(s, max(get_state(s, 1) - b, 0), 1);       s = set_state(s, max(get_state(s, 2) - a, 0), 2);       s = set_state(s, max(get_state(s, 3) - b, 0), 3);     }     while (cs[n] > 0) {       shoots.push_back(n - 1);       cs[n] -= b;       cs[n - 1] -= a;       cs[n - 2] -= b;       s = set_state(s, max(get_state(s, n - 2) - b, 0), n - 2);       s = set_state(s, max(get_state(s, n - 1) - a, 0), n - 1);       s = set_state(s, max(get_state(s, n) - b, 0), n);     }     dp(s, n, a, b);     auto it = ps.find(s);     while (it != ps.end()) {       s = it->second.first;       shoots.push_back(it->second.second);       it = ps.find(s);     }     for (int i = 2; i <= n - 1; ++i)       for (int j = 0; j < get_state(s, i); ++j) shoots.push_back(i);     return shoots;   }   int main() {     int n, a, b;     cin >> n >> a >> b;     for (int i = 1; i <= n; ++i) {       cin >> cs[i];       ++cs[i];     }     auto shoots = solve(n, a, b);     cout << shoots.size() << endl;     for (size_t i = 0; i < shoots.size(); ++i)       printf( %d%c , shoots[i],    n [i + 1 == shoots.size()]);     return 0;   }   