malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     for (int z = 0; z < t; z++) {       int n, x, y;       cin >> n;       vector<vector<int>> v;       for (int i = 0; i < n; i++) {         cin >> x >> y;         vector<int> t(2);         t[0] = x, t[1] = y;         v.push_back(t);       }       sort(v.begin(), v.end());       bool e = false;       for (int i = 0; i < n - 1; i++)         if (v[i + 1][1] < v[i][1]) {           e = true;           break;         }       if (e)         cout <<  NO  << endl;       else {         cout <<  YES  << endl;         string s;         for (int i = 0; i < v[0][0]; i++) s +=  R ;         for (int i = 0; i < v[0][1]; i++) s +=  U ;         for (int i = 0; i < n - 1; i++) {           for (int j = v[i][0]; j < v[i + 1][0]; j++) s +=  R ;           for (int j = v[i][1]; j < v[i + 1][1]; j++) s +=  U ;         }         cout << s << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string a[n];     for (int i = 0; i < n; ++i) cin >> a[i];     string col[] = { Power ,  Space ,  Time ,  Soul ,  Reality ,  Mind };     string stone[] = { purple ,  blue ,  green ,  orange ,  red ,  yellow };     cout << 6 - n <<   n ;     for (int i = 0; i < 6; ++i) {       int flag = 0;       for (int j = 0; j < n; ++j) {         if (stone[i] == a[j]) {           flag = 1;           break;         }       }       if (!flag) {         cout << col[i] <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 10, M = 1e9, eps = 1e-7, MOD = 1e9 + 7;   long long tab[N];   int main() {     long long n, l;     cin >> n >> l;     n--;     for (long long i = 1; i <= n; i++) cin >> tab[i];     long long pocz = 0;     long long pot = 1 << 30;     while (pot > 0) {       long long moze = pot + pocz;       if (moze > M) {         pot /= 2;         continue;       }       long long pom = 0;       bool czujka = true;       for (long long i = 1; i <= l; i++) pom += tab[i];       if (pom < moze) czujka = false;       for (long long i = l + 1; i <= n; i++) {         pom += tab[i];         pom -= tab[i - l];         if (pom < moze) czujka = false;       }       if (czujka) pocz = moze;       pot /= 2;     }     cout << pocz;   }
#include <bits/stdc++.h>   using namespace std;   bool endline = false;   template <class T>   istream& operator>>(istream& inp, vector<T>& v) {     for (auto& it : v) inp >> it;     return inp;   }   template <class T>   ostream& operator<<(ostream& out, vector<T>& v) {     for (auto& it : v) out << it << (endline ?   n  :    );     return out;   }   template <class T, class U>   istream& operator>>(istream& inp, pair<T, U>& v) {     inp >> v.first >> v.second;     return inp;   }   template <class T, class U>   ostream& operator<<(ostream& out, pair<T, U>& v) {     out << v.first <<     << v.second;     return out;   }   void debug() { cout << endl; }   template <typename H, typename... T>   void debug(H a, T... b) {     cout << a <<    ;     debug(b...);   }   void FAST_IO(string filein =   , string fileout =   ) {     if (fopen(filein.c_str(),  r )) {       freopen(filein.c_str(),  r , stdin);       freopen(fileout.c_str(),  w , stdout);     }     cin.tie(0), cout.tie(0)->sync_with_stdio(0);   }   void Hollwo_Pelw();   signed main() {     FAST_IO( .inp ,  .out );     int testcases = 1;     for (int test = 1; test <= testcases; test++) {       Hollwo_Pelw();     }     return 0;   }   const int allmod[3] = {(int)1e9 + 7, 998244353, (int)1e9 + 9};   const int mod = allmod[1];   const int MAXN = 1e6 + 6;   const int inf = 2e9;   const long long linf = 1e18;   long long n;   void dofirst() {     cout <<  First  << endl;     for (long long i = 1; i <= n; i++) cout << i <<    ;     for (long long i = 1; i <= n; i++) cout << i <<    ;     cout << endl;   }   vector<long long> pr[MAXN], adj[MAXN];   void addedge(long long u, long long v) {     adj[u].push_back(v), adj[v].push_back(u);   }   long long vis[MAXN];   void dfs(long long u, long long c) {     vis[u] = c;     for (auto v : adj[u])       if (!vis[v]) dfs(v, 3 - c);   }   void check(long long v) {     long long sum = 0;     for (long long i = 1; i <= 2 * n; i++)       if (vis[i] == v) sum += i;     if (sum % (2 * n) == 0) {       for (long long i = 1; i <= 2 * n; i++)         if (vis[i] == v) cout << i <<    ;       cout << endl;     }   }   void dosecond() {     cout <<  Second  << endl;     for (long long i = 1, p; i <= 2 * n; i++) cin >> p, pr[p].push_back(i);     for (long long i = 1; i <= n; i++)       addedge(pr[i][0], pr[i][1]), addedge(i, i + n);     for (long long i = 1; i <= 2 * n; i++)       if (!vis[i]) dfs(i, 1);     check(1);     check(2);   }   void getverdict() {     long long x;     cin >> x;     if (!x) exit(0);   }   void Hollwo_Pelw() {     cin >> n;     if (n % 2 == 0) {       dofirst();     } else {       dosecond();     }     getverdict();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, i = 1;     cin >> n >> k;     if (k == 1)       cout << n;     else {       vector<int> ans;       while (ans.size() < k) {         i = 2;         while (n % i != 0 && i <= n + 1) i++;         if (i >= n + 1) {           cout << -1;           return 0;         }         n /= i;         ans.push_back(i);       }       for (i = 0; i < ans.size() - 1; i++) cout << ans[i] <<    ;       cout << n * ans[ans.size() - 1];     }   }
#include <bits/stdc++.h>   using namespace std;   void OJ() {}   void solve() {     long long n;     cin >> n;     long long digit = 1000000, a = -1, b = -1;     for (long long i = 0; i < 1e6; ++i) {       if (n >= 4 * i)         if ((n - 4 * i) % 7 == 0) {           if ((n - 4 * i) / 7 + i <= digit)             digit = (n - 4 * i) / 7 + i, a = i, b = (n - 4 * i) / 7;         }     }     if (a == -1) {       cout << -1;       return;     }     for (long long i = 0; i < a; ++i) cout << 4;     for (long long i = 0; i < b; ++i) cout << 7;   }   signed main() {     OJ();     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();   }
#include <bits/stdc++.h>   using namespace std;   int p[12];   int main() {     long long n;     cin >> n;     if (n < 5) {       cout << (n * (n - 1) / 2) << endl;       return 0;     }     long long p = 5;     for (int i = 1;; ++i) {       if (p > n) {         p /= 10;         long long tot = p * 2;         --i;         ++n;         if (n % tot <= p) {           long long a = n % tot;           long long b = p - a;           long long x = n / tot;           long long ans = (a * x * (x + 1)) + (b * x * x);           ans -= x;           cout << ans << endl;         } else {           long long a = n % tot - p;           long long b = p - a;           long long x = n / tot;           long long ans = (a * (x + 1) * (x + 1)) + b * x * (x + 1);           ans -= x;           cout << ans << endl;         }         return 0;       }       p *= 10;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   void rd(T &k) {     char c = getchar();     int f = 1;     k = 0;     while (c <  0  || c >  9 ) {       if (c ==  - ) f *= -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       k = k * 10 + c -  0 ;       c = getchar();     }     k *= f;   }   const int N = 2200;   int n, m, k, s, t;   char c[5005];   int f[N][1 << 12], sum[N];   int g[1 << 12];   int main() {     cin >> c + 1;     n = strlen(c + 1);     for (k = 0, s = 1; s <= n; ++k, s <<= 1)       ;     --k;     m = n + 1 - (1 << k);     f[0][0] = 1;     for (register int i = 1; i <= m; ++i) {       char mx =  z ;       memset(g, 0, sizeof(g));       for (register int j = 0; j < (1 << k); ++j) {         if (f[i - 1][j]) g[j] = 1;         for (register int p = 0; p < k; ++p)           if ((j & (1 << p)) && g[j ^ (1 << p)]) g[j] = 1;         if (g[j]) mx = min(mx, c[i + j]);       }       cout << mx;       for (register int j = 0; j < (1 << k); ++j)         if (g[j] && c[j + i] == mx) f[i][j] = 1;     }   }
#include <bits/stdc++.h>   using namespace std;   const long long int INF = 1e18;   int32_t main() {     long long int n;     cin >> n;     if (n % 2 != 0) {       cout << 0 <<   n ;       return 0;       ;     }     long long int k = pow(2, n / 2);     cout << k <<   n ;     return 0;     ;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   #pragma GCC optimize( unroll-loops )   using namespace std;   using ll = long long;   using db = long double;   using ii = pair<int, int>;   const int N = 5e5 + 5, LG = 19, MOD = 1e9 + 7;   const int SQ = 225;   const long double EPS = 1e-7;   string s;   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int _;     cin >> _;     while (_--) {       int n;       cin >> n;       int cnt[2] = {};       vector<int> v;       for (int i = 0; i < n; i++) {         string s;         cin >> s;         v.push_back(s.size() / 2);         for (auto c : s) cnt[c -  0 ]++;       }       cnt[0] /= 2;       cnt[1] /= 2;       sort(v.begin(), v.end());       int sum = cnt[0] + cnt[1];       int ans = 0;       for (auto x : v)         if (x <= sum) {           sum -= x;           ans++;         }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long x, long long y, long long mod = 2e18) {     long long ans = 1;     x %= mod;     while (y) {       if (y & 1) ans = (x * ans) % mod;       x = (x * x) % mod;       y >>= 1;     }     return ans;   }   signed main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long t;     cin >> t;     cout << setprecision(20);     while (t--) {       long long n, k;       cin >> n >> k;       if (n >= 32) {         cout <<  YES   << n - 1 << endl;         continue;       }       long long total = (pow(4, n) - 1) / 3;       if (k > total) {         cout <<  NO  << endl;         continue;       }       long long left;       bool f = 0;       for (long long i = n; i >= 1; i--) {         left = power(2, i + 1) - (i + 2);         long long curr = (2 * (i) + 1) * (power(4, n - i) / 3);         if (total - curr >= k && k >= left) {           cout <<  YES   << n - i << endl;           f = 1;           break;         }       }       if (!f) cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[51][51];   long long combinatorics(long long n, long long k) {     double res = 1;     for (long long i = 1; i <= k; ++i) res = res * (n - k + i) / i;     return (long long)(res + 0.01);   }   int main() {     long long n, m, i, j, numOneRow[51] = {0}, numZeroRow[51] = {0},                           numOneColumn[51] = {0}, numZeroColumn[51] = {0}, x, y;     long long c;     cin >> n >> m;     c = m * n;     for (i = 0; i < n; i++) {       for (j = 0; j < m; j++) {         cin >> a[i][j];         if (a[i][j] == 0) {           numZeroRow[i]++, numZeroColumn[j]++;         } else {           numOneRow[i]++, numOneColumn[j]++;         }       }     }     for (i = 0; i < n; i++) {       j = 2;       x = numOneRow[i], y = numZeroRow[i];       while (x >= j) {         c += combinatorics(x, j);         j++;       }       j = 2;       while (y >= j) {         c += combinatorics(y, j);         j++;       }     }     for (j = 0; j < m; j++) {       i = 2;       x = numOneColumn[j], y = numZeroColumn[j];       while (x >= i) {         c += combinatorics(x, i);         i++;       }       i = 2;       while (y >= i) {         c += combinatorics(y, i);         i++;       }     }     cout << c << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e6 + 10;   typedef struct Item {     long long v;     int id;     Item(long long a, int b) {       v = a;       id = b;     }     bool operator<(const Item &rhs) const { return v < rhs.v; }   } Item;   typedef struct Node {     vector<int> p;     vector<Item> pp;     long long sum, r;     int id;     bool operator<(const Node &rhs) const {       return pp.back().v < rhs.pp.back().v;     }   } Node;   int n, m;   Node nd[MAXN];   int bs(int i, int u, int v, long long x) {     if (u > v) return -1;     int mid = u + (v - u) / 2;     if (nd[i].pp[mid].v == x)       return mid;     else if (nd[i].pp[mid].v > x)       return bs(i, u, mid - 1, x);     return bs(i, mid + 1, v, x);   }   int main(void) {     ios::sync_with_stdio(false);     cin.tie(0);     cout << setprecision(10) << fixed;     cin >> n;     for (int i = 0; i < n; i++) {       int k;       cin >> k;       nd[i].sum = 0;       nd[i].id = i + 1;       for (int j = 0; j < k; j++) {         long long v;         cin >> v;         nd[i].sum += v;         nd[i].p.push_back(v);       }       for (int j = 0; j < k; j++)         nd[i].pp.push_back(Item(nd[i].sum - nd[i].p[j], j + 1));       sort(nd[i].pp.begin(), nd[i].pp.end());       nd[i].r = nd[i].pp.back().v;     }     sort(nd, nd + n);     bool found = false;     for (int i = 1; i < n; i++) {       for (int j = i - 1; j >= 0; j--) {         if (nd[j].r < nd[i].pp[0].v) break;         for (int k = 0; k < nd[j].pp.size(); k++) {           int pos = bs(i, 0, nd[i].pp.size() - 1, nd[j].pp[k].v);           if (pos > -1) {             found = true;             cout <<  YES  << endl;             cout << nd[i].id <<     << nd[i].pp[pos].id << endl;             cout << nd[j].id <<     << nd[j].pp[k].id << endl;             break;           }         }         if (found) break;       }       if (found) break;     }     if (!found) cout <<  NO  << endl;     cerr <<  execute time :   << (double)clock() / CLOCKS_PER_SEC << endl;     return 0;   }
#include <bits/stdc++.h>   const int maxn = int(1e5) + 7, mod = int(1e9) + 7;   bool not_prime[maxn];   std::map<int, int> cnt[maxn];   std::vector<int> factor[maxn];   long long qpow(long long p, long long q) {     long long ret = 1;     while (q) {       if (q & 1) ret = ret * p % mod;       p = p * p % mod;       q >>= 1;     }     return ret;   }   void init() {     for (int i = 2; i < maxn; i++) {       for (int j = 2; i * j < maxn; j++) factor[i * j].push_back(i);       if (!not_prime[i]) {         for (int j = 1; i * j < maxn; j++) {           int num = i * j;           not_prime[num] = true;           cnt[num][i] = j;         }       }     }   }   int f[maxn], m;   int calc(int x, int y) {     int ret = m / y, a = x / y, b = m / y;     std::vector<int> buf;     for (auto &it : cnt[a]) {       buf.push_back(it.first);     }     int len = int(buf.size());     for (int i = 1; i < 1 << len; i++) {       int tmp = 1;       for (int j = 0; j < len; j++) {         if ((i >> j) & 1) {           tmp = -tmp * buf[j];         }       }       ret += b / tmp;     }     return ret;   }   int main() {     init();     std::cin >> m;     int inv_m = int(qpow(m, mod - 2)), ans = 1;     for (int i = 2; i <= m; i++) {       f[i] = 1;       for (auto &k : factor[i]) {         f[i] = int((f[i] + 1ll * calc(i, k) * f[k] % mod * inv_m % mod) % mod);       }       f[i] =           int(1ll * f[i] *               qpow((1 - 1ll * (m / i) * inv_m % mod + mod) % mod, mod - 2) % mod);       ans = int((ans + 1ll * f[i] * inv_m % mod) % mod);     }     std::cout << ans << std::endl;     return 0;   }
#include <bits/stdc++.h>   int gcd(int a, int b) {     int r;     while (b != 0) {       r = a % b;       a = b;       b = r;     }     return a;   }   int main() {     int n, m;     int deg1, deg2;     scanf( %d %d , &n, &m);     for (int i = 0, a; i <= n; i++) {       scanf( %d , &a);       if (i == 0) deg1 = a;     }     for (int i = 0, a; i <= m; i++) {       scanf( %d , &a);       if (i == 0) deg2 = a;     }     if (n > m) {       if (deg1 > 0 && deg2 > 0 || (deg1 < 0 && deg2 < 0))         printf( Infinity );       else         printf( -Infinity );     } else if (m > n)       printf( 0/1 );     else {       while (gcd(deg1, deg2) != 1) {         int r = gcd(deg1, deg2);         deg1 /= r;         deg2 /= r;       }       if (deg1 < 0 && deg2 < 0 || (deg1 > 0 && deg2 > 0))         printf( %d/%d , deg1, deg2);       else         printf( -%d/%d , abs(deg1), abs(deg2));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 5;   struct node {     int vl, mnvl;     node *l, *r;     node() {       mnvl = MAXN;       vl = -1;       l = r = NULL;     }   };   vector<node*> dv(MAXN);   vector<bool> inarr(MAXN, false);   vector<vector<int>> diverse(MAXN);   deque<int> dbl(int a) {     deque<int> d;     while (a != 0) d.push_front(a % 2), a /= 2;     while (d.size() != 18) d.push_front(0);     return d;   }   void ins(node* d, deque<int> a, int n) {     while (!a.empty()) {       d->mnvl = min(d->mnvl, n);       int b = a.front();       a.pop_front();       if (b == 0) {         if (d->l == NULL) d->l = new node();         d = d->l;       } else {         if (d->r == NULL) d->r = new node();         d = d->r;       }     }     d->vl = n;     d->mnvl = min(d->mnvl, n);   }   int fnd(node* d, deque<int> xd, int s, int x) {     while (!xd.empty()) {       int xx = xd.front();       xd.pop_front();       if (xx == 0)         if (d->r != NULL && d->r->mnvl + x <= s)           d = d->r;         else if (d->l != NULL && d->l->mnvl + x <= s)           d = d->l;         else           return -1;       else if (d->l != NULL && d->l->mnvl + x <= s)         d = d->l;       else if (d->r != NULL && d->r->mnvl + x <= s)         d = d->r;       else         return -1;     }     return d->vl;   }   int main() {     for (int i = 1; i < MAXN; i++)       for (int j = i; j < MAXN; j += i) diverse[j].push_back(i);     for (int i = 1; i < dv.size(); i++) dv[i] = new node();     int n, q, a, x, k, s;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> q;       if (q == 1) {         cin >> a;         if (!inarr[a]) {           inarr[a] = true;           deque<int> d = dbl(a);           for (int i = 0; i < diverse[a].size(); i++)             ins(dv[diverse[a][i]], d, a);         }       } else {         cin >> x >> k >> s;         if (x % k != 0 || s - x <= 0)           cout << -1 << endl;         else           cout << fnd(dv[k], dbl(x), s, x) << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long fast_pow(long long a, long long p) {     long long res = 1;     while (p) {       if (p % 2 == 0) {         a = a * 1LL * a % 1000000007;         p /= 2;       } else {         res = res * 1LL * a % 1000000007;         p--;       }     }     return res;   }   long long fact(long long n) {     long long res = 1;     for (long long i = 1; i <= n; i++) {       res = res * 1LL * i % 1000000007;     }     return res;   }   long long C(long long n, long long k) {     return fact(n) * 1LL * fast_pow(fact(k), 1000000007 - 2) % 1000000007 * 1LL *            fast_pow(fact(n - k), 1000000007 - 2) % 1000000007;   }   vector<long long> sieveOfEratosthenes(long long n) {     vector<long long> primes;     vector<bool> prime(n + 1, true);     for (long long p = 2; p * p <= n; p++) {       if (prime[p] == true) {         for (long long i = p * p; i <= n; i += p) prime[i] = false;       }     }     for (long long p = 2; p <= n; p++)       if (prime[p]) primes.push_back(p);     return primes;   }   bool isPrime(long long n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long i = 5; i * i <= n; i = i + 6)       if (n % i == 0 || n % (i + 2) == 0) return false;     return true;   }   bool isPerfectSquare(long double x) {     if (x >= 0) {       long long sr = sqrt(x);       return (sr * sr == x);     }     return false;   }   long long sum(long long n) {     long long res = 0;     while (n > 0) {       res += n % 10;       n = n / 10;     }     return res;   }   vector<long long> adj[10001];   vector<long long> vis(10001);   vector<long long> col(10001);   void dfs(long long v) {     vis[v] = 1;     for (auto ch : adj[v]) {       if (vis[ch] == 0) {         dfs(ch);       }     }   }   bool bptdfs(long long v, long long c) {     vis[v] = 1;     col[v] = c;     for (auto ch : adj[v]) {       if (vis[ch] == 0) {         if (bptdfs(ch, c ^ 1) == false) {           return false;         }       } else {         if (col[v] == col[ch]) {           return false;         }       }     }     return true;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);     long long t = 1;     while (t--) {       long long n, M;       cin >> n >> M;       vector<long long> t(n);       for (long long i = (0); i <= (n - 1); i++) {         cin >> t[i];       }       vector<long long> ans(n, 0);       for (long long i = (1); i <= (n - 1); i++) {         long long c = 0, sum = 0;         priority_queue<long long> q;         for (long long j = (0); j <= (i); j++) {           sum += t[j];           if (j != i) {             q.push(t[j]);           }         }         if (sum > M) {           while (sum > M) {             long long x = q.top();             q.pop();             sum -= x;             c++;           }         }         ans[i] = c;       }       for (auto x : ans) {         cout << x <<    ;       }       cout << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   class UFDS {    public:     vector<int> p, rank;     int count = 0;     UFDS(int n) {       p.resize(n);       rank.resize(n);       for (int i = 0; i < n; i++) p[i] = i;       count = n;     }     int getParent(int i) { return (p[i] == i) ? i : (p[i] = getParent(p[i])); }     void join(int i, int j) {       int a = getParent(i), b = getParent(j);       if (a == b) return;       count -= 1;       if (rank[a] > rank[b]) {         p[b] = a;       } else {         p[a] = b;         if (rank[a] == rank[b]) rank[b] += 1;       }     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, m;     cin >> n >> m;     set<int> ls, rss;     vector<int> rs;     vector<vector<int> > edges(m, vector<int>(4));     for (int i = 0; i < m; i++) {       cin >> edges[i][2] >> edges[i][3] >> edges[i][0] >> edges[i][1];       ls.insert(edges[i][0]);       if (!rss.count(edges[i][1])) {         rss.insert(edges[i][1]);         rs.push_back(edges[i][1]);       }       edges[i][2] -= 1;       edges[i][3] -= 1;     }     sort(rs.begin(), rs.end());     sort(edges.begin(), edges.end());     int out = 0, prev = 0;     for (auto l : ls) {       int lo = prev, hi = rss.size(), ans = -1;       while (lo < hi) {         int idx = (lo + hi) / 2;         int mid = rs[idx];         UFDS ufds(n);         for (auto e : edges) {           if (e[0] > l) break;           if (e[1] >= mid) ufds.join(e[2], e[3]);         }         if (ufds.getParent(0) == ufds.getParent(n - 1)) {           lo = idx + 1;           ans = mid;           prev = idx;         } else {           hi = idx;         }       }       if (ans != -1) out = max(out, ans - l + 1);     }     if (out)       cout << out;     else       cout <<  Nice work, Dima! ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const long double PI = 3.141592653589793238462643383279502884197;   priority_queue<int, vector<int>, greater<int> > pq;   vector<int> v;   int al[256];   char s[200001], t[200001];   int visit[200001];   int n, m;   int main() {     scanf( %s %s , s, t);     n = strlen(s);     m = strlen(t);     memset(al, -1, sizeof(al));     int l = 0;     for (int i = 0; i < n; i++) {       if (l < m && s[i] == t[l]) {         al[s[i]] = l;         l++;       }       if (al[s[i]] == -1) return !printf( No );       visit[i] = al[s[i]];     }     if (l != m) return !printf( No );     l = m - 1;     memset(al, -1, sizeof(al));     for (int i = n - 1; i >= 0; i--) {       if (l >= 0 && s[i] == t[l]) {         al[s[i]] = l;         l--;       }       if (al[s[i]] == -1) return !printf( No );       if (visit[i] < al[s[i]]) return !printf( No );     }     if (l != -1) return !printf( No );     printf( Yes );   }