malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct Point {     long long x, y;     int type;     void get(int t) {       cin >> x >> y;       type = t;     }   };   int N, M;   Point R[500], B[500], P[1000], pivot;   bool used[500];   Point operator-(Point p1, Point p2) { return Point{p1.x - p2.x, p1.y - p2.y}; }   int quadrant(Point p) {     if (p.x >= 0 && p.y >= 0) return 1;     if (p.x <= 0 && p.y >= 0) return 2;     if (p.x <= 0 && p.y <= 0) return 3;     return 4;   }   long long cross(Point p1, Point p2) { return p1.x * p2.y - p1.y * p2.x; }   bool operator<(Point p1, Point p2) {     if (quadrant(p1 - pivot) != quadrant(p2 - pivot))       return quadrant(p1 - pivot) < quadrant(p2 - pivot);     return cross(p1 - pivot, p2 - pivot) > 0;   }   int main() {     while (cin >> N >> M) {       for (int i = 0; i < N; i++) R[i].get(0);       for (int i = 0; i < M; i++) B[i].get(1);       memset(used, 0, sizeof(used));       int x = 0;       for (int i = 0; i < N; i++) {         used[i] = 1;         pivot = R[i];         int cnt = 0;         for (int j = 0; j < N; j++)           if (!used[j]) P[cnt++] = R[j];         for (int j = 0; j < M; j++) P[cnt++] = B[j];         sort(P, P + cnt);         for (int j = 0; j < cnt; j++) {           if (P[j].type == 0) {             int last = -1;             for (int k = (j + 1) % cnt; k != j; k = (k + 1) % cnt) {               bool ok = (last == -1 || cross(P[last] - P[j], P[k] - P[j]) > 0);               if (P[k].type == 0) {                 if (cross(P[j] - R[i], P[k] - R[i]) < 0) break;                 if (ok) x++;               } else if (ok)                 last = k;             }           }         }       }       cout << x << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     if (n > m) swap(n, m);     switch (n) {       case 1:         cout << m / 6 * 6 + 2 * max(m % 6 - 3, 0);         break;       case 2:         switch (m) {           case 2:             cout << 0;             break;           case 3:             cout << 4;             break;           case 7:             cout << 12;             break;           default:             cout << 2 * m;             break;         }         break;       default:         cout << 1ll * n * m / 2 * 2;         break;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[500000 + 5], ans[500000 + 5];   int main() {     int n, k, d;     cin >> n >> k >> d;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     ans[n + 1] = 0;     ans[n] = 1;     int lptr = n - 1, dptr = n - 1;     for (int i = n - 1; i >= 0; i--) {       while (lptr > 0 && lptr - i > k - 1) lptr--;       while (dptr > 0 && a[dptr] - a[i] > d) dptr--;       if (ans[lptr + 1] - ans[dptr + 2] > 0 && lptr - i == k - 1) ans[i]++;       ans[i] += ans[i + 1];     }     if (ans[0] - ans[1] == 1)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     cerr.tie(nullptr);     int n, p, k;     cin >> n >> p >> k;     map<int, int> mp;     long long sol = 0;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       int y = x * 1ll * x % p;       y = y * 1ll * y % p;       y = ((y - k * 1ll * x) % p + p) % p;       sol += mp[y]++;     }     cout << sol <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const long double pi = 3.1415926535897932384626433832795l;   template <typename T>   inline auto sqr(T x) -> decltype(x * x) {     return x * x;   }   template <typename T1, typename T2>   inline bool umx(T1& a, T2 b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   template <typename T1, typename T2>   inline bool umn(T1& a, T2 b) {     if (b < a) {       a = b;       return 1;     }     return 0;   }   const int K = 5;   const int INF = 1e9;   struct node {     int t[K][K];     node() {       for (int i = int(0); i < int(K); ++i)         for (int j = int(0); j < int(K); ++j) t[i][j] = INF;       for (int i = int(0); i < int(K); ++i) t[i][i] = 0;     }   };   const int N = 200100;   node t[4 * N];   int sz;   node botva(node a, node b) {     node c;     for (int i = int(0); i < int(K); ++i)       for (int j = int(i); j < int(K); ++j) {         c.t[i][j] = INF;         for (int k = int(i); k < int(j + 1); ++k)           umn(c.t[i][j], a.t[i][k] + b.t[k][j]);       }     return c;   }   node fnd(int i, int x, int y, int l, int r) {     if (x > r || y < l) return node();     if (x >= l && y <= r) {       return t[i];     }     return botva(fnd(2 * i, x, (x + y) >> 1, l, r),                  fnd(2 * i + 1, ((x + y) >> 1) + 1, y, l, r));   }   node fnd(int l, int r) {     l += sz, r += sz;     if (l == r) {       return t[l];     }     node left = t[l], right = t[r];     while (l / 2 != r / 2) {       if (!(l & 1)) {         left = botva(left, t[l + 1]);       }       if (r & 1) {         right = botva(t[r - 1], right);       }       l >>= 1, r >>= 1;     }     return botva(left, right);   }   char c[N];   int main() {     cout.setf(ios::showpoint | ios::fixed);     cout.precision(20);     int n, q;     cin >> n >> q;     string s;     getline(cin, s);     gets(c);     s = c;     string g =  2017 ;     sz = 1;     while (sz < n) sz <<= 1;     for (int i = int(0); i < int(n); ++i) {       node& v = t[i + sz];       for (int j = int(0); j < int(((int)(g).size())); ++j) {         if (g[j] == s[i]) {           v.t[j][j] = 1;           v.t[j][j + 1] = 0;         }       }       if (s[i] ==  6 ) {         v.t[3][3] = v.t[4][4] = 1;       }     }     for (int i = int(sz) - 1; i >= int(1); --i) {       t[i] = botva(t[2 * i], t[2 * i + 1]);     }     for (int i = int(0); i < int(q); ++i) {       int l, r;       scanf( %d%d , &l, &r);       l--, r--;       node res = fnd(1, 0, sz - 1, l, r);       if (res.t[0][4] >= INF) {         printf( -1 n );       } else {         printf( %d n , res.t[0][4]);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> knapsack(long long lim, vector<int> allItems) {     vector<bool> mark;     int mx = 0;     for (auto it : allItems) mx += it;     mx = min((long long)mx, lim);     mark.assign(mx + 1, 0);     mark[0] = true;     for (auto it : allItems) {       for (int i = (int)mx; i >= (int)it; i--) {         mark[i] = max(mark[i], mark[i - it]);       }     }     vector<int> ret;     for (int i = (int)0; i <= (int)mx; i++)       if (mark[i]) ret.push_back(i);     return ret;   }   long long W;   long long cnt[9];   long long max840 = 0;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> W;     for (int i = (int)1; i <= (int)8; i++) cin >> cnt[i];     for (int i = (int)1; i <= (int)8; i++) {       int blockSize = 840 / i;       if (cnt[i] < blockSize) continue;       max840 += cnt[i] / blockSize;       cnt[i] %= blockSize;       if (cnt[i] < blockSize) max840 -= 1, cnt[i] += blockSize;     }     vector<int> allItems;     for (int i = (int)1; i <= (int)8; i++) {       int rem = cnt[i];       for (int k = (int)0; k <= (int)60; k++) {         if (rem < (1LL << k)) {           allItems.push_back(rem * i);           break;         } else {           rem -= (1LL << k);           allItems.push_back((1LL << k) * i);         }       }     }     vector<int> allCreatedValue = knapsack(W, allItems);     long long ans = 0;     for (auto it : allCreatedValue) {       long long left = W - it;       left -= 1LL * min(left / 840, max840) * 840;       ans = max(ans, W - left);     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long a, long long b) {     long long result = 1;     while (b > 0) {       if (b % 2 == 1) {         result *= a;       }       a *= a;       b /= 2;     }     return result;   }   long long gcd(long long x, long long y) {     long long r;     while (y != 0 && (r = x % y) != 0) {       x = y;       y = r;     }     return y == 0 ? x : y;   }   long long countSetBits(long long x) {     long long Count = 0;     while (x > 0) {       if (x & 1) Count++;       x = x >> 1;     }     return Count;   }   bool isPerfectSquare(long long n) {     long long sr = sqrt(n);     if (sr * sr == n)       return true;     else       return false;   }   long long mod(long long x, long long M) { return ((x % M + M) % M); }   long long add(long long a, long long b, long long M) {     return mod(mod(a, M) + mod(b, M), M);   }   long long mul(long long a, long long b, long long M) {     return mod(mod(a, M) * mod(b, M), M);   }   long long powerM(long long a, long long b, long long M) {     long long res = 1;     while (b) {       if (b % 2 == 1) {         res = mul(a, res, M);       }       a = mul(a, a, M);       b /= 2;     }     return res;   }   long long modInverse(long long n, long long M) { return powerM(n, M - 2, M); }   long long nCrM(long long n, long long r, long long M) {     if (n < r) return 0;     if (r == 0) return 1;     vector<long long> fact(n + 1);     fact[0] = 1;     for (long long i = 1; i <= n; i++) {       fact[i] = mul(fact[i - 1], i, M);     }     return mul(mul(fact[n], modInverse(fact[r], M), M),                modInverse(fact[n - r], M), M);   }   long long n;   vector<pair<long long, long long>> vv;   map<pair<long long, long long>, long long> vis;   long long ans = 0;   void dfs(pair<long long, long long> p) {     vis[p] = 1;     for (long long i = 0; i < n; i++) {       if (vis[vv[i]] == 0) {         if (vv[i].first == p.first || vv[i].second == p.second) {           dfs(vv[i]);         }       }     }   }   void solve() {     cin >> n;     for (long long i = 0; i < n; i++) {       long long x1, y1;       cin >> x1 >> y1;       vv.push_back({x1, y1});     }     for (long long i = 0; i < n; i++) {       if (vis[vv[i]] == 0) {         dfs(vv[i]);         ans++;       }     }     cout << ans - 1 <<   n ;   }   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     solve();     return 0;   }
#include <bits/stdc++.h>   int main() {     long long n, k;     scanf( %lld %lld , &n, &k);     long long total(0), count(0);     for (long long p = 1; p <= n; p++) {       long long x;       scanf( %lld , &x);       if (p > 1 && total - x * (n - p) * (p - count - 1) < k) {         printf( %lld n , p);         ++count;       } else {         total += x * (p - 1 - count);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline int IN() {     int x = 0, ch = getchar(), f = 1;     while (!isdigit(ch) && (ch !=  - ) && (ch != EOF)) ch = getchar();     if (ch ==  - ) {       f = -1;       ch = getchar();     }     while (isdigit(ch)) {       x = (x << 1) + (x << 3) + ch -  0 ;       ch = getchar();     }     return x * f;   }   struct Flower {     long long x, y, da, db;     bool operator<(const Flower& w) const { return da < w.da; }   } a, b, c[2005];   long long Dist(Flower a, Flower b) {     return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);   }   int n;   long long mxb[2005];   int main() {     n = IN();     a.x = 1ll * IN(), a.y = 1ll * IN();     b.x = 1ll * IN(), b.y = 1ll * IN();     for (int i = 1; i <= n; i++) {       c[i].x = 1ll * IN(), c[i].y = 1ll * IN();       c[i].da = Dist(c[i], a);       c[i].db = Dist(c[i], b);     }     sort(c + 1, c + n + 1);     mxb[n + 1] = 0;     for (int i = n; i >= 1; i--) mxb[i] = max(mxb[i + 1], c[i].db);     long long Ans = mxb[1], ND = 0;     for (int i = 2; i <= n + 1; i++) Ans = min(Ans, c[i - 1].da + mxb[i]);     printf( %I64d n , Ans);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     for (int i = 0; i < t; ++i) {       int n;       cin >> n;       string s;       cin >> s;       int sum(0), pos(-1), pos1(-1), ot(-1), num(0);       for (int i = 0; i < s.length(); ++i) sum += (s[i] -  0 );       for (int i = 0; i < s.length(); ++i) {         if ((s[i] -  0 ) % 2) {           pos = i;           num = s[i] -  0 ;         }       }       for (int i = 0; i < s.length(); ++i) {         if ((s[i] -  0 ) % 2 == 0)           pos1 = i;         else if ((s[i] -  0 ) % 2 && i != pos)           ot = s[i] -  0 ;       }       if (n == 1 || pos == -1)         cout << -1 <<   n ;       else if (pos1 == -1) {         if (n % 2 == 0)           cout << s <<   n ;         else {           s.erase(s.begin() + 0);           cout << s <<   n ;         }       } else if (ot != -1)         cout << ot * 10 + num <<   n ;       else if (ot == -1)         cout << -1 <<   n ;     }   }
#include <bits/stdc++.h>   double a, b, c, d, x, y;   int main() {     scanf( %lf%lf%lf%lf , &a, &b, &c, &d);     x = a / b;     y = c / d;     printf( %lf , x / (1.0 - (1.0 - x) * (1.0 - y)));   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   const ll OO = 1e18;   int di[8] = {0, 0, 1, -1, -1, 1, -1, 1};   int dj[8] = {1, -1, 0, 0, 1, 1, -1, -1};   string ys =  YES , no =  NO ;   void fast() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);   }   string s1, s2;   int n, m, idx_shift;   const int N = 1001;   int mem[N][N];   int dp(int i, int j) {     if (i == s1.size()) return s2.size() - j;     if (j == s2.size()) return s1.size() - i;     int &rt = mem[i][j];     if (~rt) return rt;     if (s1[i] == s2[j]) return rt = dp(i + 1, j + 1);     int choice1 = 1 + dp(i, j + 1);     int choice2 = 1 + dp(i + 1, j);     int choice3 = 1 + dp(i + 1, j + 1);     return rt = min({choice1, choice2, choice3});   }   void build(int i, int j) {     if (i == s1.size()) {       int to_add = s2.size() - j;       for (int k = 0; k < to_add; k++)         cout <<  INSERT   << i + k + 1 + idx_shift <<     << s2[k + j] <<   n ;       idx_shift += to_add;       return;     }     if (j == s2.size()) {       int to_delete = s1.size() - i;       for (int k = 0; k < to_delete; k++) {         cout <<  DELETE   << i + k + 1 + idx_shift <<   n ;         --idx_shift;       }       return;     }     if (s1[i] == s2[j]) {       build(i + 1, j + 1);       return;     }     int choice1 = 1 + dp(i, j + 1);     int choice2 = 1 + dp(i + 1, j);     int choice3 = 1 + dp(i + 1, j + 1);     int optimal = dp(i, j);     if (choice1 == optimal) {       cout <<  INSERT   << i + 1 + idx_shift <<     << s2[j] <<   n ;       ++idx_shift;       build(i, j + 1);     } else if (choice2 == optimal) {       cout <<  DELETE   << i + 1 + idx_shift <<   n ;       --idx_shift;       build(i + 1, j);     } else {       cout <<  REPLACE   << i + 1 + idx_shift <<     << s2[j] <<   n ;       build(i + 1, j + 1);     }   }   int main() {     fast();     cin >> s1 >> s2;     memset(mem, -1, sizeof mem);     cout << dp(0, 0) <<   n ;     idx_shift = 0;     build(0, 0);   }
#include <bits/stdc++.h>   using namespace std;   long long sol(long long n, long long t) {     long long ret = n * (n + 1) * (2 * n + 3 * t + 1);     ret /= 6;     return ret;   }   int main() {     ios_base::sync_with_stdio(0);     long long x;     cin >> x;     long long ans = 0;     vector<pair<long long, long long> > aa;     for (long long n = 1;; n++) {       long long z = sol(n, 0);       if (z > x) {         break;       }       long long r = 6 * x - 2 * n * n * n - 3 * n * n - n;       long long d = 3 * n * n + 3 * n;       if (r % d == 0) {         ans++;         aa.push_back(make_pair(n, n + r / d));       }     }     long long xx = aa.size();     for (int i = 0; i < xx; i++) {       if (aa[i].first != aa[i].second)         aa.push_back(make_pair(aa[i].second, aa[i].first));     }     cout << aa.size() <<   n ;     sort(aa.begin(), aa.end());     for (int i = 0; i < aa.size(); i++) {       cout << aa[i].first <<     << aa[i].second <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   using ll = long long;   void solve() {     string s;     int a;     cin >> a >> s;     int sum = 0;     vector<int> v;     v.push_back(0);     for (int i = s.size() - 1; i >= 0; i--) {       if (s[i] ==  P )         sum++;       else {         v.push_back(sum);         sum = 0;       }     }     cout << *max_element(v.begin(), v.end()) << endl;   }   int main() {     int t;     cin >> t;     while (t--) solve();   }
#include <bits/stdc++.h>   using namespace std;   vector<int> v[1000005];   int ok[2][1000005];   int main() {     int q;     cin >> q;     while (q--) {       int n;       cin >> n;       for (int i = 0; i < n; i++) ok[0][i] = 0;       set<int> s;       for (int i = 0; i < n; i++) s.insert(i);       int cnt = 0;       for (int i = 0; i < n; i++) {         int x;         cin >> x;         v[i].clear();         for (int j = 0; j < x; j++) {           int a;           cin >> a;           v[i].push_back(a - 1);         }         for (int j = 0; j < v[i].size(); j++) {           if (s.count(v[i][j])) {             ok[0][i] = ok[1][v[i][j]] = 1;             s.erase(v[i][j]);             cnt++;             break;           }         }       }       if (cnt == n)         cout <<  OPTIMAL  << endl;       else {         cout <<  IMPROVE  << endl;         for (int i = n - 1; i >= 0; i--) {           if (ok[0][i] == 0) {             cout << (i + 1) <<     << (*s.rbegin() + 1) << endl;             ;             break;           }         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, a[55], b[55], c, mx;     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> a[i];     }     cin >> m;     for (int j = 1; j <= m; j++) {       cin >> b[j];     }     mx = 0;     c = 1;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (b[j] / a[i] >= mx && b[j] % a[i] == 0) {           if (b[j] / a[i] == mx) {             c++;           }           if (b[j] / a[i] > mx) {             c = 1;           }           mx = b[j] / a[i];         }       }     }     cout << c << endl;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC target( avx2 )   #pragma GCC optimization( O3 )   #pragma GCC optimization( unroll-loops )   int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};   int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};   const double PI = acos(-1), EPS = 1e-7;   const int OO = 0x3f3f3f3f, N = 1e7 + 5, mod = 1e9 + 7;   using namespace std;   long long gcd(long long x, long long y) { return (!y) ? x : gcd(y, x % y); }   long long lcm(long long x, long long y) { return ((x / gcd(x, y)) * y); }   void file() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   vector<long long> v;   int main() {     std::ios_base::sync_with_stdio(0);     cin.tie(NULL);     file();     long long n, d;     long long x, y;     cin >> n >> d;     while (n--) {       cin >> x >> y;       if (x == d || y == d || x == 7 - d || y == 7 - d) {         cout <<  NO  <<   n ;         return 0;       }     }     cout <<  YES  <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int months[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   string itos(long long i) {     string s =   ;     while (i) {       s += char(i % 10 +  0 );       i /= 10;     }     reverse(s.begin(), s.end());     return s;   }   long long stoi(string &s) {     long long tot = 0;     for (int i = (int)s.length() - 1, j = 1; i >= 0; i--, j *= 10) {       tot += j * (s[i] +  0 );     }     return tot;   }   bool cmp(const pair<int, int> &a, const pair<int, int> &b) {     return (a.first > b.first);   }   long long pwr(long long base, long long p, long long mod = 1000000007) {     long long ans = 1;     while (p) {       if (p & 1) ans = (ans * base) % 1000000007;       base = (base * base) % 1000000007;       p /= 2;     }     return ans;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long lcm(long long a, long long b) { return (a * b * 1LL) / gcd(a, b); }   const int N = 1e6 + 5;   int n, m, k, cnt = 0;   long long dist[N];   vector<pair<pair<int, long long>, int> > adj[N];   priority_queue<pair<pair<long long, int>, int>,                  vector<pair<pair<long long, int>, int> >,                  greater<pair<pair<long long, int>, int> > >       q;   void dijkstra(int src) {     for (int i = 1; i < N; i++) dist[i] = 1e18;     q.push(make_pair(make_pair(0, 0), src));     while (!q.empty()) {       pair<pair<long long, int>, int> p = q.top();       q.pop();       int u = p.second;       long long d = p.first.first;       int t = p.first.second;       if (dist[u] != 1e18) continue;       dist[u] = d;       if (t == 1) cnt++;       for (int i = 0; i < adj[u].size(); i++) {         int v = adj[u][i].first.first;         long long w = adj[u][i].first.second;         int t = adj[u][i].second;         if (dist[v] > w + d) {           q.push(make_pair(make_pair(w + d, t), v));         }       }     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout << fixed << setprecision(10);     clock_t clk;     clk = clock();     cin >> n >> m >> k;     for (int i = (1); i <= (m); ++i) {       int x, y, w;       cin >> x >> y >> w;       adj[x].push_back(make_pair(make_pair(y, w), 0));       adj[y].push_back(make_pair(make_pair(x, w), 0));     }     for (int i = (1); i <= (k); ++i) {       int x, w;       cin >> x >> w;       adj[1].push_back(make_pair(make_pair(x, w), 1));       adj[x].push_back(make_pair(make_pair(1, w), 1));     }     dijkstra(1);     cnt = k - cnt;     cout << cnt;     clk = clock() - clk;     cerr << fixed << setprecision(6) <<  Time:   << ((double)clk) / CLOCKS_PER_SEC          <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<int> se;   struct zzz {     int v, id;   } zz[1000005];   bool cmp(const zzz &i, const zzz &j) { return i.v > j.v; }   int N, M, K;   char S[1000005], T[1000005], s[1000005];   int z[1000005], p[2][1000005];   void w(int td) {     for (int i = 0; i < M; i++) s[i] = T[i];     s[M] =    ;     for (int i = 0; i < N; i++) s[M + 1 + i] = S[i];     int L = 0, R = 0, n = N + M + 1;     for (int i = 1; i < n; i++) {       if (i > R) {         L = R = i;         while (R < n && s[R - L] == s[R]) R++;         z[i] = R - L;         R--;       } else {         int k = i - L;         if (z[k] < R - i + 1)           z[i] = z[k];         else {           L = i;           while (R < n && s[R - L] == s[R]) R++;           z[i] = R - L;           R--;         }       }     }     for (int i = 0; i < N; i++) zz[i].v = z[M + 1 + i], zz[i].id = i;     sort(zz, zz + N, cmp);     int i = -1;     se.clear();     for (int x = M; x >= 0; x--) {       while (i + 1 < N && zz[i + 1].v >= x) {         i++;         se.insert(zz[i].id);       }       if (se.lower_bound(K - x) == se.end())         p[td][x] = 1000000000;       else         p[td][x] = *se.lower_bound(K - x);     }   }   int main() {     scanf( %d%d%d , &N, &M, &K);     scanf( %s%s , S, T);     w(0);     for (int i = 1; i <= N; i++)       if (z[M + i] == M) {         puts( Yes );         if (i + K + K - 1 <= N)           printf( %d %d , i, i + K);         else           printf( %d %d , N - K - K + 1, N - K + 1);         return 0;       }     reverse(S, S + N);     reverse(T, T + M);     w(1);     for (int i = 1; i < M; i++)       if (i <= K && M - i <= K && p[0][i] + i <= N - p[1][M - i] - (M - i)) {         puts( Yes );         printf( %d %d , p[0][i] + i - K + 1, N - p[1][M - i] - (M - i) + 1);         return 0;       }     puts( No );   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1005;   const int INF = 0x3f3f3f3f;   int n, a[MAXN];   vector<int> ans;   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       if (i != 1 && a[i] == 1) ans.push_back(a[i - 1]);     }     ans.push_back(a[n]);     printf( %d n , ans.size());     for (auto i : ans) printf( %d  , i);     return 0;   }