malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   inline int gi() {     char tmp = getchar();     int ans = 0, flag = 1;     while (!isdigit(tmp)) {       if (tmp ==  - ) flag = -1;       tmp = getchar();     }     while (isdigit(tmp)) {       ans = ans * 10 + tmp -  0 ;       tmp = getchar();     }     return ans * flag;   }   inline void in(int &x) { x = gi(); }   inline void in2(int &x, int &y) { in(x), in(y); }   inline void in3(int &x, int &y, int &z) { in(x), in(y), in(z); }   inline void in4(int &x, int &y, int &z, int &a) { in3(x, y, z), in(a); }   inline void smax(int &x, int y) { x = max(x, y); }   inline void smin(int &x, int y) { x = min(x, y); }   int lowbit(int x) { return x & -x; }   const int N = 1002000;   int C[N], n, maxx;   void Add(int x, int v) {     while (x <= maxx) {       smax(C[x], v);       x += lowbit(x);     }   }   int Query(int x) {     int ans = 0;     while (x) {       smax(ans, C[x]);       x -= lowbit(x);     }     return ans;   }   struct Nod {     int x, y;   } Node[N];   bool cmp(Nod a, Nod b) {     if (a.y != b.y) return a.y < b.y;     return a.x < b.x;   }   signed main() {     int n = gi();     for (int i = (int)(1); i <= (int)(n); ++i) {       Node[i].x = gi();       Node[i].y = i - Node[i].x;       smax(maxx, Node[i].x);     }     sort(Node + 1, Node + n + 1, cmp);     int ans = 0;     for (int i = (int)(1); i <= (int)(n); ++i) {       if (Node[i].y < 0) continue;       int g = Query(Node[i].x - 1);       Add(Node[i].x, g + 1);       smax(ans, g + 1);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     map<string, string> hh;     map<string, string>::iterator it;     int n;     string a, b, c;     cin >> n;     while (n--) {       cin >> a >> b;       it = hh.find(a);       if (it == hh.end())         hh[b] = a;       else {         c = it->second;         hh.erase(it);         hh[b] = c;       }     }     cout << hh.size() << endl;     for (it = hh.begin(); it != hh.end(); it++)       cout << it->second <<     << it->first << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, c[23][23], d[23], u[23];   int main() {     scanf( %d%d , &n, &m);     for (int xt, yt, i = 1; i <= m; ++i) {       scanf( %d%d , &xt, &yt);       if (c[xt][yt] || xt == yt) continue;       ++d[xt], ++d[yt];       c[xt][yt] = c[yt][xt] = 1;     }     for (int j, co, p, mint, i = 1; i <= n; ++i) {       fill(u, u + n + 1, 0);       co = 0;       for (j = i; !u[j]; j = p) {         mint = n + n;         p = j;         u[j] = 1;         ++co;         for (int k = 1; k <= n; ++k)           if (!u[k] && c[j][k] && (d[k] < mint || d[k] == mint && k < p))             p = k, mint = d[k];       }       if (co == n) {         puts( Yes );         return 0;       }     }     puts( No );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     vector<pair<int, int> > v;     for (int i = 0; i < n; i++) {       int a;       cin >> a;       v.push_back(make_pair(a, i));     }     sort(v.begin(), v.end());     int cur = 0;     vector<int> ans;     for (int i = 0; i < v.size() && cur + v[i].first <= k; i++) {       cur += v[i].first;       ans.push_back(v[i].second);     }     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); i++) {       cout << ans[i] + 1 <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   bool Check(char x) {     if (x <=  3  && x >=  1 )       return true;     else       return false;   }   int main() {     char s[1000];     cin >> s;     char x;     for (int i = 0; i < strlen(s); ++i) {       for (int j = i + 1; j < strlen(s); ++j) {         if (s[j] < s[i] && Check(s[i]) && Check(s[j])) {           x = s[i];           s[i] = s[j];           s[j] = x;         }       }     }     for (int i = 0; i < strlen(s); i++) {       cout << s[i];     }     return 0;   }
#include <bits/stdc++.h>   int a[300300];   int b[300300];   int t[300300];   int n, q;   void update(int u, const int &val) {     while (1 <= u && u <= n) {       t[u] += val;       u = u + (u & (-u));     }   }   int sum(int u) {     int res = 0;     while (1 <= u && u <= n) {       res += t[u];       u = u & (u - 1);     }     return (res);   }   void init(void) {     int i, v;     scanf( %d , &n);     for (i = 1; i <= n; i = i + 1) {       scanf( %d , &v);       a[i] = v;       b[v] = i;     }     memset(t, 0, sizeof t);     for (i = 2; i <= n; i = i + 1)       if (b[i] < b[i - 1]) update(i, 1);   }   void swap(int &a, int &b) {     int sw;     sw = a;     a = b;     b = sw;   }   void answer(void) {     int i, t, x, y, r, t1, t2;     bool px, py, px1, py1;     scanf( %d , &q);     for (i = 1; i <= q; i = i + 1) {       scanf( %d , &t);       scanf( %d , &x);       scanf( %d , &y);       if (t == 2) {         t1 = a[x];         t2 = a[y];         px = (b[t1] < b[t1 - 1]);         py = (b[t2] < b[t2 - 1]);         px1 = (b[t1 + 1] < b[t1]);         py1 = (b[t2 + 1] < b[t2]);         b[t1] = y;         b[t2] = x;         swap(a[x], a[y]);         if (b[t1] < b[t1 - 1] && !px) update(t1, 1);         if (b[t1] > b[t1 - 1] && px) update(t1, -1);         if (b[t1 + 1] < b[t1] && !px1) update(t1 + 1, 1);         if (b[t1 + 1] > b[t1] && px1) update(t1 + 1, -1);         if (t2 != t1 && t2 != t1 + 1) {           if (b[t2] < b[t2 - 1] && !py) update(t2, 1);           if (b[t2] > b[t2 - 1] && py) update(t2, -1);         }         if (t2 + 1 != t1 && t2 + 1 != t1 + 1) {           if (b[t2 + 1] < b[t2] && !py1) update(t2 + 1, 1);           if (b[t2 + 1] > b[t2] && py1) update(t2 + 1, -1);         }       } else {         r = sum(y) - sum(x);         printf( %d n , r + 1);       }     }   }   int main(void) {     init();     answer();     return 0;   }
#include <bits/stdc++.h>   using i64 = long long;   std::vector<std::vector<int>> read_tree1(int v) {     std::vector<std::vector<int>> graph(v);     while (v-- > 1) {       int x, y;       std::cin >> x >> y;       graph[x - 1].push_back(y - 1);       graph[y - 1].push_back(x - 1);     }     return graph;   }   template <class T>   std::pair<T, T> ext_euclid(T a, T b) {     if (b == 0) {       return {a > 0 ? +1 : -1, 0};     } else {       auto res = ext_euclid(b, a % b);       return {res.second, res.first - a / b * res.second};     }   }   template <class T>   T mod_inv(T num, T mod) {     num = (num % mod + mod) % mod;     T res = ext_euclid(num, mod).first;     return res < 0 ? res + mod : res;   }   int main() {     std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0);     const i64 MOD = 998244353;     int n;     std::cin >> n;     auto tree = read_tree1(n);     std::function<std::tuple<i64, i64, i64>(int, int)> dfs =         [&](int cur, int prv) -> std::tuple<i64, i64, i64> {       std::vector<std::tuple<i64, i64, i64>> nxts;       for (int nxt : tree[cur])         if (nxt != prv) {           nxts.push_back(dfs(nxt, cur));         }       i64 prod = 1;       for (const auto& [f, g, h] : nxts) {         prod = prod * (f + h) % MOD;       }       i64 F = 1, G = 1, H = 0;       for (const auto& [f, g, h] : nxts) {         F = F * f % MOD;         G = G * (f + h) % MOD;         H = (H + g * mod_inv(f + h, MOD)) % MOD;       }       H = H * prod % MOD;       F = (F + H) % MOD;       return {F, G, H};     };     std::cout << std::get<0>(dfs(0, -1)) <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2005, K = 55, mod = 998244353;   int n, k, b[N], f[2 * K][N], g[2 * K][N], C[N][N];   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d , &b[i]);     f[k][0] = 1;     for (int i = 1; i <= n; i++) {       memset(g, 0, sizeof(g));       for (int j = max(0, k - b[i - 1]); j <= 2 * k; j++) {         int j2 = j + b[i - 1] - b[i] + 1, x = j + b[i - 1] - k;         if (x < 0 || x > n || j2 > 2 * k) continue;         for (int d = max(0, -j2); d < i; d++) {           if (j2 < 0)             (g[0][d + j2] += f[j][d]) %= mod;           else             (g[j2][d] += f[j][d]) %= mod;         }       }       for (int j = 0; j < 2 * k; j++)         for (int d = 1; d <= i; d++) (g[j + 1][d - 1] += g[j][d]) %= mod;       for (int j = max(0, k - b[i - 1]); j <= 2 * k; j++) {         int j2 = j + b[i - 1] - b[i], x = j + b[i - 1] - k;         if (x < 0 || x > n || j2 < 0 || j2 > 2 * k) continue;         for (int d = 0; d < i; d++) {           (g[j2][d] += 1ll * f[j][d] * (d + x) % mod) %= mod;           (g[j2][d + 1] += 1ll * f[j][d] * (d + 1) % mod) %= mod;         }       }       swap(f, g);     }     C[0][0] = 1;     for (int i = 1; i <= n; i++) {       C[i][0] = C[i][i] = 1;       for (int j = 1; j < n; j++) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;     }     int ans = 0;     for (int j = 0; j <= 2 * k; j++) {       int x = b[n] + j - k;       if (x < 0 || x > n) continue;       for (int d = 0; d <= n - x; d++)         (ans += 1ll * f[j][d] * C[n - x][d] % mod) %= mod;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   void printArray(vector<T> arr) {     for (T a : arr) cout << a <<    ;     cout <<   n ;   }   void printVerdict(bool verdict) { cout << (verdict ?  YES  :  NO ) <<   n ; }   vector<long long> findPrime(long long n) {     vector<long long> ret;     for (int i = 2; i * i <= n && ret.empty(); i++) {       if (n % i == 0) ret.push_back(i);     }     if (ret.empty()) return {};     for (int i = 2; i * i <= n / ret.front(); i++) {       if ((n / ret.front()) % i == 0 && i != ret.front()) {         ret.push_back(i);         break;       }     }     ret.push_back((n / ret.front()) / ret.back());     if (ret.back() == ret[0] || ret.back() == ret[1]) return {};     return ret;   }   int main() {     std::ios_base::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       long long n;       cin >> n;       bool verdict = true;       vector<long long> ret = findPrime(n);       if (ret.empty()) verdict = false;       printVerdict(verdict);       if (verdict) printArray(ret);     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5;   const long long M = 1e9 + 9;   int n, x, y;   pair<int, int> pos[N];   map<pair<int, int>, int> mp;   set<int> q;   long long ans;   int children(int x, int y) {     int ret = 0;     for (int dx = -1; dx <= 1; dx++) {       map<pair<int, int>, int>::iterator c = mp.find(make_pair(x + dx, y - 1));       if (c != mp.end()) ret++;     }     return ret;   }   void update(int x, int y) {     map<pair<int, int>, int>::iterator p = mp.find(make_pair(x, y));     if (p == mp.end()) return;     for (int dx = -1; dx <= 1; dx++) {       map<pair<int, int>, int>::iterator c = mp.find(make_pair(x + dx, y + 1));       if (c != mp.end() && children(x + dx, y + 1) == 1) {         q.erase(p->second);         return;       }     }     q.insert(p->second);   }   void insert(int x, int y, int z) {     pos[z].first = x;     pos[z].second = y;     mp[make_pair(x, y)] = z;   }   void remove(int x, int y) {     mp.erase(make_pair(x, y));     for (int dx = -1; dx <= 1; dx++) {       update(x + dx, y + 1);       update(x + dx, y - 1);     }     for (int dx = -2; dx <= 2; dx++) {       update(x + dx, y);     }   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x >> y;       insert(x, y, i);     }     for (int i = 0; i < n; i++) {       update(pos[i].first, pos[i].second);     }     for (int act = 0; !q.empty(); act++) {       set<int>::iterator it;       if ((act & 1) == 0) {         it = --q.end();       } else {         it = q.begin();       }       ans = ans * n + (*it);       ans %= M;       remove(pos[*it].first, pos[*it].second);       q.erase(it);     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   static const int INF = 500000000;   template <class T>   void debug(T a, T b) {     for (; a != b; ++a) cerr << *a <<    ;     cerr << endl;   }   string s[2005];   int n, K;   int lcp[2005];   int prof[2005][2005];   struct uf {     int par[2005];     vector<int> dp[2005];     void init(int n) {       for (int i = 0; i < n; ++i) {         dp[i].resize(2);       }       memset(par, -1, sizeof(par));     }     int root(int a) {       if (par[a] == -1) return a;       return par[a] = root(par[a]);     }     void unite(int a, int b, int lb) {       a = root(a);       b = root(b);       vector<int> tmp(dp[a].size() + dp[b].size() - 1);       for (int i = 0; i < dp[a].size(); ++i)         for (int j = 0; j < dp[b].size(); ++j)           tmp[i + j] = max(tmp[i + j], dp[a][i] + dp[b][j] + lb * i * j);       par[a] = b;       dp[b] = tmp;       dp[a].clear();     }   };   uf u;   int used[2005];   int main() {     scanf( %d%d , &n, &K);     for (int i = 0; i < n; ++i) cin >> s[i];     sort(s, s + n);     u.init(n);     for (int i = 0; i < n - 1; ++i) {       int& t = lcp[i];       for (t = 0;            t < s[i].size() && t < s[i + 1].size() && s[i][t] == s[i + 1][t]; ++t)         ;     }     for (int i = 0; i < n - 1; ++i) {       int tallest = -1, ind;       for (int j = 0; j < n - 1; ++j)         if (used[j] == 0 && tallest < lcp[j]) {           tallest = lcp[j];           ind = j;         }       used[ind] = 1;       u.unite(ind, ind + 1, tallest);     }     printf( %d n , u.dp[u.root(0)][K]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     int arr[n + 10];     for (int i = 1; i <= n; i++) scanf( %d , &arr[i]);     int start, end;     start = 1;     int pos_1 = -1, pos_2 = -1;     int cnt = 0;     int t = 0;     for (int i = 1; i <= n;) {       pos_1 = -1;       pos_2 = -1;       start = i;       for (int j = start; j <= n; j++) {         if (arr[j] != -1) {           pos_1 = j;           break;         }       }       if (pos_1 != -1) {         for (int j = pos_1 + 1; j <= n; j++)           if (arr[j] != -1) {             pos_2 = j;             break;           }         if (pos_2 == -1) {           cnt++;           break;         }         t++;         if (arr[pos_1] == arr[pos_2]) {           start = pos_2 + 1;           for (int j = pos_2 + 1; j <= n; j++)             if (arr[j] == -1 || arr[j] == arr[pos_1])               start = j + 1;             else {               start = j;               break;             }           cnt++;         } else {           long long val = (arr[pos_2] - arr[pos_1]);           int d = pos_2 - pos_1;           if (val % d == 0) {             int yes = val / d;             val = arr[pos_1];             yes *= (-1);             for (int j = pos_1 - 1; j >= start; j--) {               val += yes;               if (val <= 0) {                 cnt++;                 start = pos_2;                 goto End;               }               if (arr[j] != -1 && arr[j] != val) {                 cnt++;                 start = pos_2;                 goto End;               }             }             val = arr[pos_2];             yes *= (-1);             start = -1;             for (int j = pos_2 + 1; j <= n; j++) {               val += yes;               if (val <= 0) {                 start = j;                 break;               }               if (arr[j] != -1 && arr[j] != val) {                 start = j;                 break;               }             }             if (start == -1) start = n + 1;             cnt++;           } else {             cnt += 1;             start = pos_2;           }         }       } else {         cnt++;         break;       }     End:;       i = start;     }     cout << cnt << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long long N = 5e5;   long long id[N], a[N], pos[N];   int main() {     ios_base::sync_with_stdio(false);     long long n, t, m, l, k, ans, i, j, res = 0, fl;     t = 1;     long long x;     while (t--) {       long long o;       cin >> n >> m >> k;       for (i = 0; i < n; i++) {         cin >> a[i];         pos[a[i]] = i;       }       long long ct = 1;       j = 0;       for (o = 0;; o += k) {         for (i = o; i < o + k; ++i) id[a[i]] = ct;         ct++;         if (i > n) break;       }       for (i = 0; i < m; i++) {         cin >> x;         res += id[x];         if (pos[x] > 0) {           long long p = pos[x];           long long val = a[p - 1];           swap(id[x], id[val]);           swap(a[p], a[p - 1]);           pos[x] = p - 1;           pos[val] = p;         }       }       cout << res <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   signed main() {     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       long long maxai = 0;       multiset<long long> a;       for (long long i = 0; i < n; i++) {         long long ai;         cin >> ai;         a.insert(ai);         if (ai > maxai) maxai = ai;       }       while (maxai != 1 && a.size()) {         long long br = 0;         for (long long i = 1; i <= maxai / 2; i++) {           if (maxai % i != 0) continue;           for (long long k = 1; k < 1010; k++) {             if (k * maxai / i > 1010) break;             long long count = a.count(k * maxai / i);             if (count) {               br = 1;               for (long long j = 0; j < count; j++) cout << k * maxai / i <<    ;               a.erase(k * maxai / i);               maxai = gcd(maxai, k * maxai / i);               break;             }           }           if (br) break;         }         if (!br) break;       }       for (multiset<long long>::iterator i = a.begin(); i != a.end(); i++)         cout << *i <<    ;       cout << endl;     }   }
#include <bits/stdc++.h>   const double EPS = 1e-24;   const long long int MOD = 1000000007ll;   const double PI = 3.14159265359;   int INF = 2147483645;   long long int INFINF = 9223372036854775807;   template <class T>   T Max2(T a, T b) {     return a < b ? b : a;   }   template <class T>   T Min2(T a, T b) {     return a < b ? a : b;   }   template <class T>   T Max3(T a, T b, T c) {     return Max2(Max2(a, b), c);   }   template <class T>   T Min3(T a, T b, T c) {     return Min2(Min2(a, b), c);   }   template <class T>   T Max4(T a, T b, T c, T d) {     return Max2(Max2(a, b), Max2(c, d));   }   template <class T>   T Min4(T a, T b, T c, T d) {     return Min2(Min2(a, b), Max2(c, d));   }   using namespace std;   int n;   int a[110];   int main() {     std::ios::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     reverse(a, a + n);     int sum = 0, cur = 0;     for (int i = 0; i < n; i++) sum += a[i];     int cnt = 0;     while (cur <= sum / 2) cur += a[cnt++];     cout << cnt;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int t;     cin >> t;     while (t--) {       int n, m, a, b;       cin >> n >> m >> a >> b;       a--;       b--;       vector<vector<int> > graph(n);       for (int i = 0; i < m; i++) {         int u, v;         cin >> u >> v;         u--;         v--;         graph[u].push_back(v);         graph[v].push_back(u);       }       int x = 0;       vector<bool> vis(n);       function<void(int)> dfs = [&](int u) {         vis[u] = true;         for (int v : graph[u]) {           if (vis[v] || v == x) continue;           dfs(v);         }       };       x = b;       dfs(a);       int cnta = count(vis.begin(), vis.end(), false) - 1;       fill(vis.begin(), vis.end(), false);       x = a;       dfs(b);       int cntb = count(vis.begin(), vis.end(), false) - 1;       cout << (long long)cnta * cntb <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   const int M = 0x3f3f3f3f;   long long n, m, k, q, h;   int ld[N], rd[N];   vector<long long> p;   int main() {     ios::sync_with_stdio(false);     cin.tie(0), cout.tie(0);     cin >> n >> m >> k >> q;     vector<vector<long long> > vec(n + 1);     memset(ld, 0x3f, sizeof(ld));     memset(rd, 0x3f, sizeof(rd));     while (k--) {       int x, y;       cin >> x >> y;       vec[x].push_back(y);     }     int f = !vec[1].empty();     vector<vector<long long> > tp = move(vec);     for (int i = 1; i <= n; ++i)       if (!tp[i].empty()) {         h = i;         sort(tp[i].begin(), tp[i].end());         vec.push_back(tp[i]);       }     long long l = (vec[0].back() << 1) - vec[0][0] - 1, r = vec[0].back() - 1,               lp = vec[0][0], rp = vec[0].back();     while (q--) {       int pos;       cin >> pos;       p.push_back(pos);     }     sort(p.begin(), p.end());     for (int i = 1; i <= m; ++i) {       auto tmp = lower_bound(p.begin(), p.end(), i);       if (tmp != p.end())         rd[i] = *tmp - i;       else         rd[i] = M;       tmp = upper_bound(p.begin(), p.end(), i);       if (tmp != p.begin())         ld[i] = i - *(tmp - 1);       else         ld[i] = M;     }     q = vec.size();     if (!f) l = r = rd[1], lp = rp = rd[1] + 1;     for (int i = f; i < q; ++i) {       vector<pair<long long, long long> > pos;       if (ld[lp] ^ M) pos.push_back(make_pair(lp - ld[lp], l + ld[lp]));       if (rd[lp] ^ M) pos.push_back(make_pair(lp + rd[lp], l + rd[lp]));       if (ld[rp] ^ M) pos.push_back(make_pair(rp - ld[rp], r + ld[rp]));       if (rd[rp] ^ M) pos.push_back(make_pair(rp + rd[rp], r + rd[rp]));       l = r = 1e18, lp = vec[i][0], rp = vec[i].back();       for (auto j : pos) {         if (j.first >= rp)           l = min(l, j.second + j.first - lp);         else           l = min(l, j.second + rp - j.first + rp - lp);         if (j.first <= lp)           r = min(r, j.second + rp - j.first);         else           r = min(r, j.second + j.first - lp + rp - lp);       }     }     cout << min(l, r) + h - 1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     string a;     cin >> a;     char vowels[5] = { a ,  e ,  i ,  o ,  u };     for (int i = 0; i < a.size() - 1; ++i) {       bool flag = false;       for (int k = 0; k < 5; ++k) {         if (a[i] == vowels[k]) {           flag = true;           break;         }       }       if (a[i] ==  n ) flag = true;       if (flag) {         continue;       }       for (int k = 0; k < 5; ++k) {         if (a[i + 1] == vowels[k]) {           flag = true;           break;         }       }       if (flag == false) {         cout <<  NO  << endl;         return 0;       }     }     int n = a.size();     bool flag = false;     for (int k = 0; k < 5; ++k) {       if (a[n - 1] == vowels[k]) {         flag = true;         break;       }     }     if (a[n - 1] ==  n ) flag = true;     if (flag == true)       cout <<  YES  << endl;     else       cout <<  NO ;     return 0;   }