malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n, q;   int x[100100], y[100100];   bool ans[100100];   int par[100100], sz[100100];   int distToPar[100100];   int getpar(int now) { return (par[now] == now) ? now : getpar(par[now]); }   bool getdist(int now) {     bool ret = (par[now] == now) ? 0 : (getdist(par[now]) ^ distToPar[now]);     return ret;   }   stack<pair<pair<int, int>, bool> > prevStat;   map<pair<int, int>, int> mp;   vector<pair<pair<int, int>, pair<int, int> > > opSeg;   vector<pair<int, int> > add[400400];   void addSeg(int tl, int tr, pair<int, int> val, int l, int r, int k) {     if (tl > r || l > tr) return;     if (tl <= l && r <= tr) {       add[k].push_back(val);       return;     }     int mid = (l + r) >> 1;     addSeg(tl, tr, val, l, mid, k + k);     addSeg(tl, tr, val, mid + 1, r, k + k + 1);   }   bool isBipar = 1;   void addEdge(pair<int, int> now) {     int u = now.first, v = now.second;     int pu = getpar(u), pv = getpar(v);     if (pu == pv) {       prevStat.push(make_pair(make_pair(-1, -1), isBipar));       if ((getdist(u) ^ getdist(v)) == 0) {         isBipar = 0;       }       return;     }     if (sz[pu] > sz[pv]) swap(u, v), swap(pu, pv);     prevStat.push(make_pair(make_pair(pu, sz[pu]), isBipar));     distToPar[pu] = getdist(u) ^ getdist(v) ^ 1;     par[pu] = pv;     sz[pv] += sz[pu];   }   void undo() {     int pos = prevStat.top().first.first, presz = prevStat.top().first.second,         preIsBipar = prevStat.top().second;     prevStat.pop();     if (pos >= 0) {       sz[pos] = presz;       sz[par[pos]] -= sz[pos];       par[pos] = pos;     }     isBipar = preIsBipar;   }   void solve(int l, int r, int k) {     for (int i = 0; i < (int)add[k].size(); i++) {       addEdge(add[k][i]);     }     if (l == r) {       ans[l] = isBipar;     } else {       int mid = (l + r) >> 1;       solve(l, mid, k + k);       solve(mid + 1, r, k + k + 1);     }     for (int i = 0; i < (int)add[k].size(); i++) undo();   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> q;     for (int i = 0; i < q; i++) {       cin >> x[i] >> y[i];       x[i]--, y[i]--;       if (x[i] > y[i]) swap(x[i], y[i]);     }     for (int i = 0; i < n; i++) par[i] = i, sz[i] = 1;     for (int i = 0; i < q; i++) {       pair<int, int> now = make_pair(x[i], y[i]);       if (!mp.count(now) || mp[now] < 0) {         mp[now] = i;       } else {         opSeg.push_back(make_pair(make_pair(mp[now], i), now));         mp[now] = -1;       }     }     for (map<pair<int, int>, int>::iterator it = mp.begin(); it != mp.end();          it++) {       if (it->second >= 0) {         opSeg.push_back(make_pair(make_pair(it->second, q), it->first));       }     }     for (int i = 0; i < (int)opSeg.size(); i++) {       addSeg(opSeg[i].first.first, opSeg[i].first.second - 1, opSeg[i].second, 0,              q - 1, 1);     }     solve(0, q - 1, 1);     for (int i = 0; i < q; i++) cout << (ans[i] ?  YES  :  NO ) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[1001000], cnt[1001000], z[1001000];   int main() {     ios::sync_with_stdio(false);     memset(cnt, 0, sizeof(cnt));     memset(z, 0, sizeof(z));     cin >> n >> m;     for (int i = 1; i <= n; i++) {       cin >> a[i];       if (a[i] <= m) cnt[a[i]]++;     }     int ans = 0, flag = 0;     for (int i = 1; i <= m; i++) {       if (cnt[i]) {         for (int k = 1; k * i <= m; k++) z[k * i] += cnt[i];       }     }     for (int i = 1; i <= m; i++) {       if (z[i] > ans) {         ans = z[i];         flag = i;       }     }     cout << (flag == 0 ? 1 : flag) <<     << ans << endl;     for (int i = 1; i <= n; i++) {       if (flag % a[i] == 0 && flag != 0) cout << i <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   signed long long int n, m, k, x, y;   signed long long int ct[3], myct;   int main() {     cin >> n >> m >> k >> x >> y;     signed long long int f1, q, val, rem = k;     if (n == 1) {       f1 = m;       q = rem / f1;       rem -= q * f1;       myct = q;       ct[1] = q;       ct[2] = q;       if (y <= rem) myct++;       if (rem != 0) ct[1]++;       cout << ct[1] <<     << ct[2] <<     << myct <<   n ;       return 0;     } else if (n == 2) {       f1 = 2 * m;       q = rem / f1;       rem -= q * f1;       myct = q;       ct[1] = ct[2] = q;       if (((x - 1) * m + y) <= rem) myct++;       if (rem != 0) ct[1]++;       cout << ct[1] <<     << ct[2] <<     << myct <<   n ;       return 0;     }     f1 = ((n - 2) * m * 2) + (2 * m);     q = rem / f1;     rem -= q * f1;     ct[0] = 2 * q;     ct[1] = q;     ct[2] = q;     int grp = -1;     if (x == 1) {       myct = q;       grp = 1;     } else if (x == n) {       myct = q;       grp = 2;     } else {       myct = 2 * q;       grp = 0;     }     int stp = 0;     if (rem > 0 && rem <= m) {       ct[1]++;       if (((x - 1) * m + y) <= rem) myct++;     } else if (rem > m && rem <= (n - 1) * m) {       ct[0]++;       ct[1]++;       if (((x - 1) * m + y) <= rem) myct++;     } else if (rem > (n - 1) * m && rem <= n * m) {       ct[0]++;       ct[1]++;       stp = 3;       if (rem == n * m) ct[2]++;       if (((x - 1) * m + y) <= rem) myct++;     } else if (rem > n * m && rem <= f1) {       ct[0] += 2;       ct[1]++;       ct[2]++;       myct++;       stp = 4;       if (x == 1 || x == n) {       } else {         rem -= n * m;         val = (n - x - 1) * m + y;         if (val <= rem) myct++;       }     }     signed long long int mini = ct[0], maxi = ct[0];     for (int i = 1; i < 3; i++) {       mini = min(mini, ct[i]);       maxi = max(maxi, ct[i]);     }     cout << maxi <<     << mini <<     << myct <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, mncnt = 1000000000, cnt;     string a;     string c =  ACTG ;     cin >> n >> a;     for (int i = 0; i <= n - 4; i++) {       cnt = 0;       string b = a.substr(i, 4);       for (int j = 0; j < 4; j++) {         int x = c[j] -  A ;         int y = b[j] -  A ;         if (abs(y - x) <= 13)           cnt += abs(y - x);         else           cnt += 26 - (abs(y - x));       }       mncnt = min(mncnt, cnt);     }     cout << mncnt << endl;   }
#include <bits/stdc++.h>   using namespace std;   int a[12][12], nxt[110];   int id(int x, int y) {     if (x & 1) return (10 - x) * 10 + 11 - y;     return (10 - x) * 10 + y;   }   double dp[120];   int main() {     for (int i = 1; i <= 10; i++)       for (int j = 1; j <= 10; j++) a[i][j] = id(i, j);     for (int i = 1; i <= 10; i++) {       for (int j = 1, k; j <= 10; j++) {         scanf( %d , &k);         nxt[a[i][j]] = a[i - k][j];       }     }     for (int i = 1; i < 6; i++) dp[100 - i] = 6;     for (int i = 94; i; i--) {       double x = 0;       for (int j = 1; j <= 6; j++) {         x += min(dp[i + j], dp[nxt[i + j]]);       }       dp[i] = x / 6 + 1;     }     printf( %.10f n , dp[1]);   }
#include <bits/stdc++.h>   using namespace std;   struct data {     int x, h, p;   } a[100005];   int n, x[100005], kq[100005], st[4 * 100005];   void update(int id, int l, int r, int p, int v) {     if (l > p || r < p) return;     if (l == p && l == r) {       st[id] = v;       return;     }     int m = (l + r) >> 1;     update(id << 1, l, m, p, v);     update((id << 1) + 1, m + 1, r, p, v);     st[id] = max(st[id << 1], st[(id << 1) + 1]);   }   int getmax(int id, int l, int r, int d, int c) {     if (l > c || r < d) return 0;     if (l >= d && r <= c) return st[id];     int m = (l + r) >> 1;     return max(getmax((id << 1), l, m, d, c),                getmax((id << 1) + 1, m + 1, r, d, c));   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> a[i].x >> a[i].h;       a[i].p = i;       a[i].h = a[i].x + a[i].h - 1;     }     sort(a + 1, a + n + 1, [](data a, data b) { return a.x < b.x; });     for (int i = n; i >= 1; --i) {       x[i] = a[i].x;       int pos = upper_bound(x + i + 1, x + n + 1, a[i].h) - x - 1;       int t = getmax(1, 1, n, i + 1, pos);       if (t < i) t = i;       kq[a[i].p] = t - i + 1;       update(1, 1, n, i, t);     }     for (int i = 1; i <= n; ++i) cout << kq[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int now[15][3], ans[15][3], nA, nB, nC, minN = 12, cnt, t[13];   void dfs(int a, int b, int c, int num, int jw, int cou, bool ifA, bool ifB) {     if (!a && !b && !c && !jw) {       minN = num;       cnt = cou;       memcpy(ans, now, sizeof(now));       return;     }     if (a % 10 + b % 10 - c % 10 + jw == 0 && c)       dfs(a / 10, b / 10, c / 10, num, 0, cou + 1, a ? 0 : 1, b ? 0 : 1);     else if (a % 10 + b % 10 - c % 10 + jw == 10 && c)       dfs(a / 10, b / 10, c / 10, num, 1, cou + 1, a ? 0 : 1, b ? 0 : 1);     else {       if (minN - ++num <= 0) return;       now[num][2] = ++cou;       if (!ifA && c) {         now[num][0] = 1;         now[num][1] = (c % 10 - b % 10 - jw + 10) % 10;         bool f = ifB;         if (!b) ifB = 1;         dfs(a, b / 10, c / 10, num, (now[num][1] + b % 10 + jw - c % 10) / 10,             cou, ifA, ifB);         ifB = f;       }       if (!ifB && c) {         now[num][0] = 2;         now[num][1] = (c % 10 - a % 10 + 10 - jw) % 10;         bool f = ifA;         if (a == 0) ifA = 1;         dfs(a / 10, b, c / 10, num, (now[num][1] + a % 10 + jw - c % 10) / 10,             cou, ifA, ifB);         ifA = f;       }       now[num][0] = 3;       now[num][1] = (a % 10 + b % 10 + jw) % 10;       if (!a) ifA = 1;       if (!b) ifB = 1;       dfs(a / 10, b / 10, c, num, (a % 10 + b % 10 + jw - now[num][1]) / 10, cou,           ifA, ifB);     }   }   int main() {     int a, b, c;     bool f;     scanf( %d+%d=%d , &a, &b, &c);     dfs(a, b, c, 0, 0, 0, 0, 0);     int p = 1;     while (p <= minN && ans[p][0] - 1) p++;     for (int i = 1; i <= cnt; i++)       if (p <= minN && ans[p][2] == i) {         t[i] = ans[p++][1];         while (p <= minN && ans[p][0] - 1) p++;       } else {         t[i] = a % 10;         a /= 10;       }     f = 0;     for (int i = cnt; i; i--)       if (f || t[i]) {         putchar(t[i] +  0 );         f = 1;       }     putchar( + );     p = 1;     while (p <= minN && ans[p][0] - 2) p++;     for (int i = 1; i <= cnt; i++)       if (p <= minN && ans[p][2] == i) {         t[i] = ans[p++][1];         while (p <= minN && ans[p][0] - 2) p++;       } else {         t[i] = b % 10;         b /= 10;       }     f = 0;     for (int i = cnt; i; i--)       if (f || t[i]) {         putchar(t[i] +  0 );         f = 1;       }     putchar( = );     p = 1;     while (p <= minN && ans[p][0] - 3) p++;     for (int i = 1; i <= cnt; i++)       if (p <= minN && ans[p][2] == i) {         t[i] = ans[p][1];         p++;         while (p <= minN && ans[p][0] - 3) p++;       } else {         t[i] = c % 10;         c /= 10;       }     f = 0;     for (int i = cnt; i; i--)       if (f || t[i]) {         putchar(t[i] +  0 );         f = 1;       }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int mas[1010][1010];   int main() {     int N, K;     cin >> N >> K;     for (int i = 1; i <= N; i++) {       int k = 0;       for (int j = 1; j <= N; j++) {         if (k == K)           break;         else if (i == j)           continue;         else if (mas[j][i] || mas[i][j])           continue;         else {           mas[i][j] = 1;           k++;         }       }       if (k < K) {         cout << -1 << endl;         return 0;       }     }     int cnt = 0;     for (int i = 1; i <= N; i++) {       for (int j = 1; j <= N; j++) {         if (mas[i][j]) cnt++;       }     }     cout << cnt << endl;     for (int i = 1; i <= N; i++) {       for (int j = 1; j <= N; j++) {         if (mas[i][j]) cout << i <<     << j << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, k, mod = 1e9 + 7;   map<long long, long long> mp;   string s;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     srand(time(0));     cin >> n >> k;     vector<long long> a(n + 2);     vector<long long> b(k + 2);     for (long long i = 1; i <= n; ++i) cin >> a[i], a[i] -= i;     a[0] = -2e9;     a[n + 1] = 2e9;     b[k + 1] = n + 1;     for (long long i = 1; i <= k; ++i) cin >> b[i];     long long ans = 0;     for (long long i = 0; i <= k; ++i) {       long long l = b[i];       long long r = b[i + 1];       if (a[l] > a[r]) {         cout << -1;         exit(0);       }       vector<long long> v;       for (long long j = l + 1; j < r; ++j) {         if (a[j] > a[r] || a[j] < a[l]) continue;         auto x = upper_bound(v.begin(), v.end(), a[j]);         if (x == v.end())           v.push_back(a[j]);         else           *x = a[j];       }       ans += r - l - 1 - v.size();     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int N, K, M, S;   int arr[500000];   int raito[500005];   int seen[500005];   int bucket[500005];   int shift[500005];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> M >> K >> N >> S;     for (int i = 0; i < M; i++) {       cin >> arr[i];     }     int t;     for (int i = 0; i < S; i++) {       cin >> t;       bucket[t]++;     }     for (int i = 0; i < 500005; i++) seen[i] = -1;     for (int i = M - 1; i >= 0; i--) {       raito[i] = seen[arr[i]];       seen[arr[i]] = i;     }     int maxima = 0;     for (int i = 0; i < 500005; i++) {       if (bucket[i] == 0) continue;       int cur = seen[i];       int p = 1;       while (cur != -1 && p < bucket[i]) {         cur = raito[cur];         p++;       }       if (cur == -1) {         cout << -1;         return 0;       }       shift[i] = cur;       maxima = max(maxima, cur);     }     vector<int> adj;     for (int i = 0; i < M;) {       int total = i / K + 1 + ((M - 1) - (maxima + 1) + 1) / K;       if (total >= N) {         int extra = K - S;         for (int j = i; j <= maxima; j++) {           if (extra <= 0 && bucket[arr[j]] == 0) {             adj.push_back(j + 1);           } else if (bucket[arr[j]] == 0) {             extra--;           } else {             bucket[arr[j]]--;           }         }         cout << adj.size() <<   n ;         for (int j = 0; j < adj.size(); j++) {           cout << adj[j] <<    ;         }         return 0;       }       if (i + 1 == M) break;       int pp = 0;       if (bucket[arr[i]] != 0) {         shift[arr[i]] = raito[shift[arr[i]]];         maxima = max(maxima, shift[arr[i]]);         if (shift[arr[i]] == -1) {           cout << -1;           return 0;         }       }       i++;     }     cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 400010;   int n;   int fa[MAXN][21];   int dep[MAXN];   int LCA(int x, int y) {     if (dep[x] < dep[y]) swap(x, y);     for (int i = 20; i >= 0; i--) {       if (dep[x] - (1 << i) >= dep[y]) {         x = fa[x][i];       }     }     if (x == y) return x;     for (int i = 20; i >= 0; i--) {       if (fa[x][i] != fa[y][i]) {         x = fa[x][i];         y = fa[y][i];       }     }     return fa[x][0];   }   int main() {     scanf( %d , &n);     int L, R;     L = R = 1;     int mx = 0;     int p;     for (int i = 2; i <= n; i++) {       scanf( %d , &p);       fa[i][0] = p;       dep[i] = dep[p] + 1;       for (int j = 1; j <= 20; j++) {         fa[i][j] = fa[fa[i][j - 1]][j - 1];       }       int z = LCA(i, L);       int ans1 = dep[i] + dep[L] - 2 * dep[z];       z = LCA(i, R);       int ans2 = dep[i] + dep[R] - 2 * dep[z];       if (ans1 > ans2 && ans1 > mx) {         mx = ans1;         R = i;       }       if (ans2 >= ans1 && ans2 > mx) {         L = i;         mx = ans2;       }       if (i == n)         printf( %d n , mx);       else         printf( %d  , mx);     }   }
#include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( Ofast,no-stack-protector )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #pragma GCC optimize( unroll-loops )   long long fun(long long n, long long m, long long mid) {     long long val = 0;     for (long long i = 1; i <= n; i++) val += min(m, (mid - 1) / i);     return val;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long tst = 1;     for (long long tt = 1; tt <= tst; tt++) {       long long n, m, k;       cin >> n >> m >> k;       long long l = 1, r = (n * m) + 1;       while (l < r) {         long long mid = (l + r) / 2;         if (fun(n, m, mid) < k)           l = mid + 1;         else           r = mid;       }       cout << l - 1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }   int main() {     long long a, b;     while (cin >> a >> b) {       long long suma = 0, sumb = 0;       long long ca = 0, cb = 0;       long long limit = lcm(a, b);       long long now = 0, prev = 0;       while (now <= limit) {         if (now % b != 0 || (now % a == 0 && a > b)) {           suma += now - prev;         } else {           sumb += now - prev;         }         prev = now;         now = min(a * (ca + 1), b * (cb + 1));         if (now % a == 0) ca++;         if (now % b == 0) cb++;       }       cout << (suma == sumb ?  Equal  : suma > sumb ?  Dasha  :  Masha ) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, dp[2000 + 10][2000 + 10];   bool v[2000 + 10][2000 + 10];   vector<int> vec[2000 + 10];   int solve(int curr, int kk) {     if (kk > k) return 0;     if (kk == k) return 1;     if (v[curr][kk]) return dp[curr][kk];     for (int i = 0; i < vec[curr].size(); i++) {       dp[curr][kk] += (solve(vec[curr][i], kk + 1)) % 1000000007;       dp[curr][kk] %= 1000000007;     }     v[curr][kk] = true;     return dp[curr][kk];   }   int main() {     ios::sync_with_stdio(false), cin.tie(0);     cin >> n >> k;     for (int i = 1; i <= n; i++) {       for (int j = i; j <= n; j += i) {         if (!(j % i)) vec[i].push_back(j);       }     }     cout << solve(1, 0) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005];   int dp[302][100005];   int main() {     ios::sync_with_stdio(0);     int n, q;     cin >> n;     for (int i = 1; i <= n; ++i) cin >> a[i];     cin >> q;     memset(dp, 0, sizeof(dp));     for (int k = min(300, n); k >= 1; --k) {       for (int i = n; i >= 1; --i) {         if (i + a[i] + k > n)           dp[k][i] = 1;         else           dp[k][i] = 1 + dp[k][i + a[i] + k];       }     }     while (q--) {       int p, k;       cin >> p >> k;       if (k <= 300)         cout << dp[k][p] << endl;       else {         int ans = 0;         while (p <= n) {           p = p + a[p] + k;           ans++;         }         cout << ans << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long n, ans = 0, minm;   long long A[10 * 100000 + 6];   unordered_map<long long, long long> M;   long long pos, neg, cc = 0, k = 0;   int main() {     scanf( %lld , &n);     for (int i = 1; i <= n; ++i) {       scanf( %lld , &A[i]);       M[A[i] - i]++;       ans += abs(A[i] - i);       if (A[i] <= i)         neg++;       else         pos++;     }     minm = ans;     for (long long i = 1, j = n; i <= n - 1; ++i, --j) {       if (A[j] - j - cc <= 0)         --neg;       else         --pos;       ans -= abs(A[j] - j - cc);       ans += A[j];       ++pos;       M[A[j] + cc]++;       M[A[j] - j]--;       ++cc;       ans -= pos;       ans += neg;       pos -= M[cc];       neg += M[cc];       if (ans <= minm) {         minm = ans;         k = i;       }     }     printf( %lld %lld n , minm, k);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[200005], ans1 = 1, ans2 = 0;   int main() {     int n, b, b1;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);     }     sort(a + 1, a + 1 + n);     b1 = 0;     for (int i = 2; i <= n; ++i) {       b = a[i] - a[i - 1];       if (b == 0) {         continue;       } else if (b == 1) {         if (b1 == 2) {           ans1++;           b1 = 0;         } else if (b1 == 1) {           b1 = 2;         } else if (b1 == 0) {           b1 = 1;         }       } else if (b == 2) {         if (b1 == 0) {           b1 = 2;         } else if (b1 >= 1) {           b1 = 0;           ans1++;         }       } else {         b1 = 0;         ans1++;       }     }     for (int i = 1; i <= n; ++i) {       b = a[i] - a[i - 1];       if (i == 1) {         a[i]--;         ans2++;         continue;       }       if (b >= 1) ans2++;       if (b == 0 && a[i] != a[i + 1]) {         ans2++;         a[i]++;       } else if (b == 1 && a[i] == a[i + 1] - 1) {         continue;       } else if (b == 1 && a[i] == a[i + 1] - 2) {         continue;       } else if (b == 1 && a[i] != a[i + 1]) {         a[i]++;       } else if (b >= 2) {         a[i]--;       }     }     printf( %d %d n , ans1, ans2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, const char* argv[]) {     int cases;     cin >> cases;     while (cases--) {       int num;       scanf( %d , &num);       vector<pair<int, int> > coords;       pair<int, int> z(0, 0);       coords.push_back(z);       for (int i = 0; i < num; ++i) {         int x, y;         scanf( %d%d , &x, &y);         coords.push_back({x, y});       }       sort(coords.begin(), coords.end());       string out;       bool ok = true;       for (int i = 1; i <= num; ++i) {         int diffx = coords[i].first - coords[i - 1].first;         int diffy = coords[i].second - coords[i - 1].second;         if (diffx < 0 || diffy < 0) {           ok = false;           break;         }         while (diffx--) out +=  R ;         while (diffy--) out +=  U ;       }       if (ok) {         cout <<  YES  << endl;         cout << out << endl;       } else {         cout <<  NO  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 110;   int a[M];   int main() {     int n, cnt = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , a + i);       if (a[i] % 2 == 0) cnt++;     }     if (n % 2 == 0) {       printf( No n );       return 0;     }     if (a[1] % 2 == 0 || a[n] % 2 == 0) {       printf( No n );       return 0;     } else {       printf( Yes n );       return 0;     }     return 0;   }