malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct data {     int to, head;   } e[750000 * 2];   stack<int> s;   vector<int> cir[750000];   int n, m, len, head[750000], dfn[750000], low[750000], cnt, num, p[750000],       binv[750000], d[750000];   int ans, tot;   long long mm;   int mul(int a, int b) {     int ans = 1;     while (b) {       if (b & 1) ans = 1ll * ans * a % 1000000007;       a = 1ll * a * a % 1000000007;       b >>= 1;     }     return ans;   }   void dfs(int lab, int fa) {     dfn[lab] = low[lab] = ++num;     s.push(lab);     for (int i = head[lab]; i; i = e[i].head) {       if (!dfn[e[i].to]) {         dfs(e[i].to, lab);         low[lab] = min(low[lab], low[e[i].to]);         if (low[e[i].to] == dfn[lab]) {           cnt++;           int m1;           do {             m1 = s.top();             s.pop();             if (dfn[lab] == low[m1]) cir[cnt].push_back(m1);           } while (m1 != e[i].to);           cir[cnt].push_back(lab);           m1 = cir[cnt].size();           for (auto j : cir[cnt]) p[j] = (1ll * p[j] + binv[m1]) % 1000000007;           tot = (1ll * tot + binv[m1]) % 1000000007;         }       }       if (e[i].to != fa) low[lab] = min(low[lab], dfn[e[i].to]);     }   }   void add(int u, int v) {     e[++len].to = v;     e[len].head = head[u];     head[u] = len;   }   int main() {     binv[0] = 1;     binv[1] = mul(2, 1000000007 - 2);     int u, v, m1, m2, m3;     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; i++) {       scanf( %d%d , &u, &v);       add(u, v);       add(v, u);       d[u]++;       d[v]++;     }     m1 = max(n, 10);     for (int i = 2; i <= m1; i++)       binv[i] = 1ll * binv[1] * binv[i - 1] % 1000000007;     ans = 1ll * n * (n + 1) % 1000000007 * binv[2] % 1000000007;     ans = (ans + 1ll * m * binv[2]) % 1000000007;     dfs(1, 0);     for (int i = 1; i <= n; i++) {       ans = (ans - 2ll * d[i] * binv[2]) % 1000000007;       ans = (ans - 2ll * (m - d[i]) * binv[3]) % 1000000007;       ans = (ans + 2ll * p[i]) % 1000000007;       ans = (ans + 2ll * (tot - p[i]) * binv[1]) % 1000000007;       for (int j = head[i]; j; j = e[j].head) {         if (e[j].to < i) continue;         ans = (ans + (1ll * d[i] + d[e[j].to] - 3 + m) * binv[4]) % 1000000007;       }     }     ans = (1ll * ans + tot) % 1000000007;     for (int i = 1; i <= cnt; i++) {       m1 = 0;       m2 = cir[i].size(), m3 = 0;       for (auto j : cir[i]) {         m1 = (1ll * m1 + p[j] - binv[m2]) % 1000000007;         ans = (ans + 1ll * (p[j] - binv[m2]) * binv[m2] % 1000000007 * 2) %               1000000007;         m3 = (1ll * m3 + d[j] - 2) % 1000000007;         ans = (ans - 2ll * binv[m2 + 1] * (d[j] - 2)) % 1000000007;       }       m1 = (1ll * m1 + binv[m2]) % 1000000007;       ans = (ans + 1ll * (tot - m1) * binv[m2]) % 1000000007;       ans = (ans - 2ll * m2 * binv[m2]) % 1000000007;       ans = (ans - 2ll * (m - m3 - m2) * binv[m2 + 2]) % 1000000007;     }     m1 = (1ll * n * binv[1] - 1ll * m * binv[2] + 1ll * tot) % 1000000007;     ans = ((ans - 1ll * m1 * m1) % 1000000007 + 1000000007) % 1000000007;     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k;   long long rase[100][100], satis[100];   long long DP[20][(int)1e6 + 1];   long long solve(int index, int mask) {     if (DP[index][mask] != -1) {       return DP[index][mask];     }     if (__builtin_popcount(mask) == m) {       return DP[index][mask] = 0;     }     long long res = -1;     for (int i = 0; i < n; i++) {       if ((mask & (1 << i)) == false) {         res = max(res, solve(i, mask | (1 << i)) + satis[i] + rase[index][i]);       }     }     return DP[index][mask] = res;   }   int main() {     memset(DP, -1, sizeof(DP));     cin >> n >> m >> k;     for (int i = 0; i < n; i++) {       cin >> satis[i];     }     for (int i = 0; i < k; i++) {       long long x, y, c;       cin >> x >> y >> c;       x--;       y--;       rase[x][y] = c;     }     long long res = -1;     for (int i = 0; i < n; i++) {       res = max(res, solve(i, 1 << i) + satis[i]);     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   namespace SAT2 {   vector<int> v[200000 + 5], V[200000 + 5];   int n, b[200000 + 5], dn, q[200000 + 5], mark[200000 + 5], num, yes[200000 + 5];   void init(int sz) {     for (int i = 1; i <= sz; ++i)       v[i].clear(), V[i].clear(), mark[i] = b[i] = yes[i] = 0;     dn = num = 0;     n = sz;   }   void ins(int f, int t) {     v[f].push_back(t);     v[((t & 1) ? t + 1 : t - 1)].push_back(((f & 1) ? f + 1 : f - 1));     V[t].push_back(f);     V[((f & 1) ? f + 1 : f - 1)].push_back(((t & 1) ? t + 1 : t - 1));   }   void dfs(int x) {     b[x] = 1;     for (int i = 0; i < v[x].size(); ++i)       if (!b[v[x][i]]) dfs(v[x][i]);     q[++dn] = x;   }   void rdfs(int x) {     mark[x] = num;     for (int i = 0; i < V[x].size(); ++i)       if (!mark[V[x][i]]) rdfs(V[x][i]);   }   bool Solve() {     for (int i = 1; i <= n; ++i)       if (!b[i]) dfs(i);     for (int i = n; i; --i)       if (!mark[q[i]]) ++num, rdfs(q[i]);     for (int i = 1; i <= n; ++i)       if (mark[i] == mark[((i & 1) ? i + 1 : i - 1)]) return false;     for (int i = 1; i <= n; ++i)       yes[mark[i] > mark[((i & 1) ? i + 1 : i - 1)] ? i                                                     : ((i & 1) ? i + 1 : i - 1)] =           1;     return true;   }   }  // namespace SAT2   int n, a, b, s[100000 + 5];   map<int, int> mp;   int main() {     n = read();     a = read();     b = read();     SAT2::init(2 * n);     for (int i = 1; i <= n; ++i) mp[s[i] = read()] = i;     for (int i = 1; i <= n; ++i) {       int t1 = mp[a - s[i]], t2 = mp[b - s[i]];       if (t1)         SAT2::ins(2 * i - 1, 2 * t1 - 1);       else         SAT2::ins(2 * i - 1, 2 * i);       if (t2)         SAT2::ins(2 * i, 2 * t2);       else         SAT2::ins(2 * i, 2 * i - 1);     }     if (!SAT2::Solve()) return 0 * puts( NO );     puts( YES );     for (int i = 1; i <= n; ++i) printf(SAT2::yes[2 * i - 1] ?  0   :  1  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> v[200005];   int colour[200005];   long long dp[200005];   long long ans[200005];   void dfs(long long source, long long p) {     dp[source] = colour[source];     for (int i = 0; i < v[source].size(); ++i) {       if (v[source][i] == p) continue;       dfs(v[source][i], source);       dp[source] += max((long long)0, dp[v[source][i]]);     }   }   void dfs2(long long source, long long p) {     ans[source] = dp[source];     for (int i = 0; i < v[source].size(); ++i) {       if (v[source][i] == p) continue;       dp[source] -= max((long long)0, dp[v[source][i]]);       dp[v[source][i]] += max((long long)0, dp[source]);       dfs2(v[source][i], source);       dp[v[source][i]] -= max((long long)0, dp[source]);       dp[source] += max((long long)0, dp[v[source][i]]);     }   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     long long n, x, y;     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> colour[i];       if (!colour[i]) colour[i] = -1;       ans[i] = 0;     }     for (int i = 0; i < n - 1; ++i) {       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     dfs(1, 0);     dfs2(1, 0);     for (int i = 1; i <= n; ++i) {       cout << ans[i] <<    ;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t, n, m;   long long r, ans[800005];   stack<int> s;   vector<pair<char, vector<int>>> v;   char x[800005 * 6];   void dfs(int a) {     if (v[a].first ==  _ ) return;     vector<int> tv;     for (int i : v[a].second) {       dfs(i);       if (v[a].first == v[i].first) {         if (tv.size() < v[i].second.size()) tv.swap(v[i].second);         tv.insert(tv.end(), v[i].second.begin(), v[i].second.end());       } else         tv.push_back(i);     }     v[a].second.swap(tv);     if (v[a].first ==  S ) {       int best = v[a].second.front();       for (int i : v[a].second)         if (v[i].second.size() < v[best].second.size()) best = i;       v[a].first = v[best].first;       v[a].second.swap(v[best].second);     }   }   int main() {     scanf( %d , &t);     while (t--) {       scanf( %lld  , &r);       fgets(x, sizeof(x), stdin);       x[n = strlen(x) - 1] = 0;       if (n == 1) {         printf( REVOLTING %lld n , r);         continue;       }       m = 0;       s = stack<int>();       s.push(0);       v = {{ S , vector<int>()}};       for (int i = 0; i < n; i++) {         if (x[i] ==  ( ) {           s.push(v.size());           v.emplace_back( ? , vector<int>());         } else if (x[i] ==  ) ) {           int tmp = s.top();           s.pop();           v[s.top()].second.push_back(tmp);         } else if (x[i] ==  * ) {           v[s.top()].second.push_back(v.size());           v.emplace_back( _ , vector<int>{m++});         } else if (x[i] !=    )           v[s.top()].first = x[i];       }       dfs(0);       if (v[0].first ==  _ )         ans[v[0].second.front()] = r;       else         for (int i : v[0].second)           ans[v[i].second.front()] = (long long)r * v[0].second.size();       printf( REVOLTING );       for (int i = 0; i < m; i++) {         printf(  %lld , ans[i]);         ans[i] = 0;       }       puts(  );     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int n, ans = 0, ini = 1, mul = 10;     long long int temp;     cin >> n;     while (mul <= n) {       temp = mul / 10;       ans += (mul - temp) * ini;       mul *= 10;       ++ini;     }     mul /= 10, ini;     if (n - (mul - 1) >= 0) {       n -= (mul - 1);       ans += n * ini;     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<pair<long long int, long long int>,               pair<long long int, long long int> > >       q;   int main() {     long long int n, x1, cur, x, y, cost, type, ans, best[200501], i;     cin >> n >> x;     for (i = 0; i < n; i++) {       cin >> x1 >> y >> cost;       q.push_back(make_pair(make_pair(x1, -1), make_pair(y, cost)));       q.push_back(make_pair(make_pair(y, 1), make_pair(x1, cost)));     }     for (i = 0; i < 200500; i++) best[i] = 2e9 + 2;     ans = 2e9 + 2;     sort(q.begin(), q.end());     for (i = 0; i < q.size(); i++) {       type = q[i].first.second;       if (type == -1) {         cur = q[i].second.first - q[i].first.first + 1;         if (cur <= x) ans = min(ans, q[i].second.second + best[x - cur]);       } else {         cur = q[i].first.first - q[i].second.first + 1;         best[cur] = min(best[cur], q[i].second.second);       }     }     long long int k = 2e9 + 2;     if (ans == k) ans = -1;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   class fenwick {     int n;     vector<long long> v;       public:     long long sum(int r) {       long long rval = 0;       for (; r >= 0; r = (r & (r + 1)) - 1) {         rval += v[r];       }       return rval;     }     void update(int in, int d) {       for (; in < n; in = (in | (in + 1))) {         v[in] += d;       }     }     fenwick(int N) : n(N) { v.resize(n, 0); }   };   class udalost {    public:     int typ, wh, i, t;   };   bool cmp(udalost& a, udalost& b) {     if (a.t == b.t) {       return a.typ < b.typ;     }     return a.t < b.t;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m;     cin >> n >> m;     vector<int> p(n), s(n), b(n), inc(m), pref(m), ans(m, 0);     for (int i = 0; i < n; i++) {       cin >> p[i];     }     for (int i = 0; i < n; i++) {       cin >> s[i];     }     for (int i = 0; i < n; i++) {       cin >> b[i];     }     for (int i = 0; i < m; i++) {       cin >> inc[i];     }     for (int i = 0; i < m; i++) {       cin >> pref[i];     }     vector<udalost> u;     set<long long> x;     for (int i = 0; i < n; i++) {       u.push_back({0, p[i] + b[i], 1, p[i]});       u.push_back({1, b[i] + 1 - p[i], -1, p[i]});       u.push_back({0, p[i] + b[i], -1, s[i] + 1});       u.push_back({1, b[i] + 1 - p[i], 1, s[i] + 1});       x.insert(p[i] + b[i]);       x.insert(b[i] + 1 - p[i]);     }     for (int i = 0; i < m; i++) {       u.push_back({2, pref[i], i, inc[i]});       x.insert(pref[i] + inc[i]);       x.insert(pref[i] - inc[i]);     }     sort(u.begin(), u.end(), cmp);     map<int, int> xs;     while (!x.empty()) {       xs[*x.begin()] = xs.size();       x.erase(x.begin());     }     fenwick l(xs.size()), r(xs.size());     for (int i = 0; i < u.size(); i++) {       if (u[i].typ == 0) {         l.update(xs[u[i].wh], u[i].i);       } else if (u[i].typ == 1) {         r.update(xs[u[i].wh], u[i].i);       } else {         ans[u[i].i] = l.sum(xs[u[i].wh + u[i].t]) + r.sum(xs[u[i].wh - u[i].t]);       }     }     for (int i = 0; i < m; i++) {       cout << ans[i] <<    ;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   char a[1002][34], b[34];   int point[1002], res[1002], h[1002];   int main() {     int n, x, i, j, p = 1;     scanf( %d , &n);     scanf( %s %d , &a[0], &x);     point[0] += x;     h[0] = point[0];     res[0] = 0;     for (i = 1; i < n; i++) {       scanf( %s %d , &b, &x);       for (j = 0; j < p; j++) {         if (strcmp(a[j], b) == 0) {           break;         }       }       if (i == p) {         strcpy(a[p], b);         p++;       }       point[j] += x;       h[i] = point[j];       res[i] = j;     }     int max = point[0];     for (i = 1; i < p; i++) {       if (point[i] > max) max = point[i];     }     for (i = 0; i < n; i++) {       if (point[res[i]] == max && h[i] >= max) break;     }     printf( %s , a[res[i]]);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> a;     int n;     int i;     bool ans;     cin >> n;     a.resize(n);     for (i = 0; i < n; i++) {       cin >> a[i];     }     sort(a.begin(), a.end());     ans = false;     for (i = 1; i < n; i++) {       if (a[i] > a[i - 1] && 2 * a[i - 1] > a[i]) {         ans = true;         break;       }     }     cout << (ans ?  YES  :  NO ) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> g[100002];   int find(int v, int* parent) {     if (parent[v] == v) {       return v;     }     return find(parent[v], parent);   }   int vis[100002];   int dp[100002];   void dfs(int u) {     vis[u] = 1;     for (int i = 0; i < g[u].size(); i++) {       int v = g[u][i];       if (!vis[v]) dfs(v);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, s;     cin >> n >> s;     for (int i = 0; i < n - 1; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     int cnt = 0;     for (int i = 1; i <= n; i++) {       if (g[i].size() == 1) cnt++;     }     double ans = (2. * s) / (1. * cnt);     cout << setprecision(12) << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int d[100][100];   char s[10000];   int main() {     int i, j, k, max, min, ans1, ans2, o, p, e1, e2, e3, tot, x, y, n;     string name1, name2;     map<string, int> mp;     vector<string> a;     vector<int> aa;     scanf( %d , &n);     mp.clear();     a.clear();     memset(d, 0, sizeof(d));     for (i = 0; i < n; i++) {       scanf( %s , s);       name1 = s;       scanf( %s , s);       scanf( %s , s);       name2 = s;       if (mp.find(name1) == mp.end()) {         mp[name1] = a.size();         a.push_back(name1);       }       if (mp.find(name2) == mp.end()) {         mp[name2] = a.size();         a.push_back(name2);       }       d[mp[name1]][mp[name2]] = 1;     }     scanf( %d%d%d , &e1, &e2, &e3);     ans1 = 2000000000;     ans2 = 0;     aa.clear();     for (i = 0; i < 7; i++) aa.push_back(i);     do {       for (i = 1; i < 7; i++)         for (j = 1; i + j < 7; j++) {           k = 7 - i - j;           max = -2000000000;           min = 2000000000;           if (e1 / i > max) max = e1 / i;           if (e1 / i < min) min = e1 / i;           if (e2 / j > max) max = e2 / j;           if (e2 / j < min) min = e2 / j;           if (e3 / k > max) max = e3 / k;           if (e3 / k < min) min = e3 / k;           if (max - min < ans1) ans1 = max - min;         }     } while (next_permutation(aa.begin(), aa.end()));     aa.clear();     for (i = 0; i < 7; i++) aa.push_back(i);     do {       for (i = 1; i < 7; i++)         for (j = 1; i + j < 7; j++) {           k = 7 - i - j;           max = -2000000000;           min = 2000000000;           if (e1 / i > max) max = e1 / i;           if (e1 / i < min) min = e1 / i;           if (e2 / j > max) max = e2 / j;           if (e2 / j < min) min = e2 / j;           if (e3 / k > max) max = e3 / k;           if (e3 / k < min) min = e3 / k;           if (max - min == ans1) {             tot = 0;             x = 0;             y = x + i - 1;             for (o = x; o <= y; o++)               for (p = x; p <= y; p++)                 if (d[aa[o]][aa[p]] == 1) tot++;             x = i;             y = x + j - 1;             for (o = x; o <= y; o++)               for (p = x; p <= y; p++)                 if (d[aa[o]][aa[p]] == 1) tot++;             x = i + j;             y = x + k - 1;             for (o = x; o <= y; o++)               for (p = x; p <= y; p++)                 if (d[aa[o]][aa[p]] == 1) tot++;             if (tot > ans2) ans2 = tot;           }         }     } while (next_permutation(aa.begin(), aa.end()));     printf( %d %d n , ans1, ans2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[100003], ss[100003];   int main() {     int ans = 0;     scanf( %s , s + 1);     int len = strlen(s + 1);     int n = 0;     for (int i = 1; i <= len; i++) {       if (n > 0 && ss[n] == s[i]) {         n--;         ans++;       } else         ss[++n] = s[i];     }     if (ans % 2)       printf( Yes n );     else       printf( No n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 25;   long long f[N], s[N], a[N], res;   int n;   deque<pair<long long, long long> > dq;   bool ok(pair<long long, long long> x, pair<long long, long long> y,           pair<long long, long long> z) {     return ((x.second - y.second) * (z.first - y.first) >             (y.first - x.first) * (y.second - z.second));   }   void add(pair<long long, long long> x) {     while (dq.size() > 1 && !ok(x, dq[dq.size() - 1], dq[dq.size() - 2]))       dq.pop_back();     dq.push_back(x);   }   long long cal(int m, int x) { return dq[m].first * x + dq[m].second; }   long long query(int x) {     if (dq.size() == 1) return cal(0, x);     int l = 0, r = dq.size() - 2;     while (l < r) {       int m = (l + r) >> 1;       if (cal(m, x) < cal(m + 1, x))         l = m + 1;       else         r = m;     }     return max(cal(l, x), cal(l + 1, x));   }   int main() {     ios::sync_with_stdio(false);     cin >> n;     for (int i = 1; i <= n; ++i) {       cin >> a[i];       f[i] = f[i - 1] + a[i] * i;       s[i] = s[i - 1] + a[i];     }     for (int i = 1; i <= n; ++i) add(pair<long long, long long>(i, -s[i - 1]));     for (int i = 1; i <= n; ++i) {       res = max(res, query(a[i]) + s[i - 1] - a[i] * i);     }     dq.clear();     for (int i = 1; i <= n; ++i) add(pair<long long, long long>(i, -s[i]));     for (int i = 1; i <= n; ++i) {       res = max(res, query(a[i]) + s[i] - a[i] * i);     }     cout << res + f[n];   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:20000000 )   using namespace std;   const long long mod = 1000000007;   const double eps = 1e-7;   const long long INF = 1000000000000000;   int main() {     string s;     cin >> s;     int x = -1, k = 0;     for (int(i) = (0); (i) < (s.size()); ++(i)) {       if (s[i] ==  @ ) {         x = i;         k++;       }     }     if (k == 0 || k > 1 || x > 16 || x == 0) {       cout <<  NO ;       return 0;     }     for (int(i) = (0); (i) < (x); ++(i)) {       bool p = 0;       if (s[i] >=  a  && s[i] <=  z ) p = 1;       if (s[i] >=  A  && s[i] <=  Z ) p = 1;       if (s[i] >=  0  && s[i] <=  9 ) p = 1;       if (s[i] ==  _ ) p = 1;       if (!p) {         cout <<  NO ;         return 0;       }     }     int y = -1;     k = 0;     for (int(i) = (x); (i) < (s.size()); ++(i))       if (s[i] ==  / ) {         y = i;         k++;       }     if (k > 1) {       cout <<  NO ;       return 0;     }     if (y == -1) y = s.size();     if (y - x - 1 > 32 || y - x - 1 < 1) {       cout <<  NO ;       return 0;     }     string d =   ;     for (int(i) = (x + 1); (i) < (y); ++(i))       if (s[i] ==  . ) {         if (d.size() < 1 || d.size() > 16) {           cout <<  NO ;           return 0;         }         for (int(j) = (0); (j) < (d.size()); ++(j)) {           bool p = 0;           if (d[j] >=  a  && d[j] <=  z ) p = 1;           if (d[j] >=  A  && d[j] <=  Z ) p = 1;           if (d[j] >=  0  && d[j] <=  9 ) p = 1;           if (d[j] ==  _ ) p = 1;           if (!p) {             cout <<  NO ;             return 0;           }         }         d =   ;       } else         d += s[i];     if (d.size() < 1 || d.size() > 16) {       cout <<  NO ;       return 0;     }     for (int(j) = (0); (j) < (d.size()); ++(j)) {       bool p = 0;       if (d[j] >=  a  && d[j] <=  z ) p = 1;       if (d[j] >=  A  && d[j] <=  Z ) p = 1;       if (d[j] >=  0  && d[j] <=  9 ) p = 1;       if (d[j] ==  _ ) p = 1;       if (!p) {         cout <<  NO ;         return 0;       }     }     if (k) {       d =   ;       for (int(i) = (y + 1); (i) < (s.size()); ++(i)) d += s[i];       if (d.size() < 1 || d.size() > 16) {         cout <<  NO ;         return 0;       }       for (int(j) = (0); (j) < (d.size()); ++(j)) {         bool p = 0;         if (d[j] >=  a  && d[j] <=  z ) p = 1;         if (d[j] >=  A  && d[j] <=  Z ) p = 1;         if (d[j] >=  0  && d[j] <=  9 ) p = 1;         if (d[j] ==  _ ) p = 1;         if (!p) {           cout <<  NO ;           return 0;         }       }     }     cout <<  YES ;     return 0;   }