func_code_string: #include <bits/stdc++.h>   using namespace std;   const double eps = 1e-9;   int v[1024];   int vv[1024];   int N;   int try_it(int last) {     for (int i = (0); i < (N); i++) vv[i] = v[i];     for (int i = (last); i < (N); i++) vv[i] = max(0, vv[i] - 1);     vv[N] = 0;     int NN = N;     while (NN > 0 && vv[NN - 1] == 0) --NN;     int moves = 0, p = -1;     while (vv[NN - 1] > 0) {       moves += 3;       ++p;       while (vv[p + 1] >= vv[p]) {         moves += 2;         ++p;       }       ++moves;       --vv[p];       --p;       while (p >= 0 && vv[p] == vv[p + 1] + 1) {         --vv[p];         --p;         moves++;       }       moves++;     }     return moves + N * 3 - 2 * p - last;   }   void do_it(int last) {     for (int i = (0); i < (N); i++) vv[i] = v[i];     for (int i = (last); i < (N); i++) vv[i] = max(0, vv[i] - 1);     vv[N] = 0;     int NN = N;     while (NN > 0 && vv[NN - 1] == 0) --NN;     int p = -1;     while (vv[NN - 1] > 0) {       cout <<  ARA ;       ++p;       while (vv[p + 1] >= vv[p]) {         cout <<  RA ;         ++p;       }       cout <<  L ;       --vv[p];       --p;       while (p >= 0 && vv[p] == vv[p + 1] + 1) {         --vv[p];         --p;         cout <<  L ;       }       cout <<  A ;     }     while (p++ < N - 1) cout <<  AR ;     cout <<  A ;     while (p-- > last) cout <<  L ;     cout <<  A n ;   }   int main() {     ios::sync_with_stdio(false);     cin >> N;     for (int i = (0); i < (N); i++) cin >> v[i];     v[N] = 0;     while (N > 0 && v[N - 1] == 0) --N;     int best = try_it(0);     int last = 0;     for (int i = (1); i < (N); i++) {       int c = try_it(i);       if (c < best) {         best = c;         last = i;       }     }     do_it(last);     return 0;   }   