func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, a[505];   int m, b[505];   int sumA[505];   int sumB[505];   int dp[505][505];   struct Answer {     int p;     char c;     Answer(void){};     Answer(int x, char y) {       p = x;       c = y;     }   } stk[505];   int tot = 0;   int tree[505];   int lowbit(int x) { return x & -x; }   int query(int p) {     int r = 0;     while (p) {       r += tree[p];       p -= lowbit(p);     }     return r;   }   void add(int p) {     while (p <= n) {       tree[p] += 1;       p += lowbit(p);     }   }   void dfs(int l, int r) {     if (l == r) return;     if (dp[l + 1][r] && sumA[r] - sumA[l] > a[l]) {       dfs(l + 1, r);       stk[++tot] = Answer(l,  L );     } else {       dfs(l, r - 1);       stk[++tot] = Answer(r,  R );     }   }   signed main(void) {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , a + i);     scanf( %d , &m);     for (int i = 1; i <= m; ++i) scanf( %d , b + i);     memset(sumA, 0, sizeof(sumA));     memset(sumB, 0, sizeof(sumB));     for (int i = 1; i <= n; ++i) sumA[i] = sumA[i - 1] + a[i];     for (int i = 1; i <= m; ++i) sumB[i] = sumB[i - 1] + b[i];     memset(dp, 0, sizeof(dp));     for (int i = 1; i <= n; ++i) dp[i][i] = 1;     for (int i = 1; i < n; ++i)       for (int j = 1; i + j <= n; ++j) {         if (sumA[i + j] - sumA[j] > a[j]) dp[j][i + j] |= dp[j + 1][i + j];         if (sumA[i + j - 1] - sumA[j - 1] > a[i + j])           dp[j][i + j] |= dp[j][i + j - 1];       }     bool flag = true;     for (int i = 1, j = 1, k; i <= m; ++i) {       for (k = j; k <= n && sumA[k] != sumB[i]; ++k)         ;       if (k > n) {         flag = false;         break;       }       if (i == m && k != n) {         flag = false;         break;       }       if (!dp[j][k]) {         flag = false;         break;       }       dfs(j, k);       j = k + 1;     }     if (!flag) return puts( NO ), 0;     puts( YES );     memset(tree, 0, sizeof(tree));     for (int i = 1; i <= tot; ++i) {       int q = query(stk[i].p);       add(stk[i].p);       stk[i].p -= q;       if (stk[i].c ==  L )         ++stk[i].p;       else         --stk[i].p;     }     for (int i = 1; i <= tot; ++i) printf( %d %c n , stk[i].p, stk[i].c);   }   