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 n, k;     cin >> n >> k;     string s;     cin >> s;     map<char, int> m;     for (int i = 0; i < s.size(); i++) {       m[s[i]]++;     }     char a =  A ;     bool flag1 = true;     for (int i = 1; i < k; i++) {       if (m[a] == 0) {         flag1 = false;         break;       }       a++;     }     bool flag = false;     for (int i = 0; i < s.size(); i++) {       if (a == s[i]) {         flag = true;         break;       }     }     int c = 999999;     if (flag == true && flag1 == true) {       for (auto x : m) {         if (x.second < c) {           c = x.second;         }       }       cout << c * k;     } else {       cout <<  0 ;     }   }
#include <bits/stdc++.h>   using namespace std;   set<int> inT;   set<int>::iterator it;   int ans[300000];   vector<int> pak;   int main() {     int n, m, l, r, x, i;     cin >> n >> m;     for (i = 0; i < n; i++) {       inT.insert(i);     }     for (i = 0; i < m; i++) {       cin >> l >> r >> x;       l--;       r--;       x--;       it = inT.lower_bound(l);       while (it != inT.end()) {         if (*it > r) break;         if (*it != x) {           pak.push_back(*it);           ans[*it] = x + 1;         }         it++;       }       for (x = 0; x < pak.size(); x++) inT.erase(pak[x]);       pak.clear();     }     for (i = 0; i < n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using cd = complex<double>;   const int max_n = 200500;   vector<int> g[max_n];   vector<int> og[max_n];   vector<int> used(max_n);   bool find_cycles(int x) {     used[x] = 1;     for (int i : g[x]) {       if (used[i] == 1) {         return true;       }       if (!used[i] && find_cycles(i)) {         return true;       }     }     used[x] = 2;     return false;   }   vector<int> ts;   void top_sort(int x) {     used[x] = 1;     for (int i : g[x]) {       if (!used[i]) {         top_sort(i);       }     }     ts.push_back(x);   }   vector<int> dp1(max_n);   void calc_dp1(int x) {     used[x] = 1;     dp1[x] = x;     for (int i : og[x]) {       if (!used[i]) {         calc_dp1(i);       }       dp1[x] = min(dp1[x], dp1[i]);     }   }   vector<int> dp2(max_n);   void calc_dp2(int x) {     used[x] = 1;     dp2[x] = x;     for (int i : g[x]) {       if (!used[i]) {         calc_dp2(i);       }       dp2[x] = min(dp2[x], dp2[i]);     }   }   int main() {     cout.precision(20);     cout << fixed;     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, m;     cin >> n >> m;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       g[a].push_back(b);       og[b].push_back(a);     }     for (int i = 1; i <= n; i++) {       if (!used[i]) {         if (find_cycles(i)) {           cout << -1;           return 0;         }       }     }     fill(used.begin(), used.end(), 0);     for (int i = 1; i <= n; i++) {       if (!used[i]) {         top_sort(i);       }     }     reverse(ts.begin(), ts.end());     fill(used.begin(), used.end(), 0);     for (int i = 0; i < n; i++) {       if (!used[ts[i]]) {         calc_dp1(ts[i]);       }     }     fill(used.begin(), used.end(), 0);     for (int i = 0; i < n; i++) {       if (!used[ts[i]]) {         calc_dp2(ts[i]);       }     }     int cnt = 0;     for (int i = 1; i <= n; i++) {       cnt += dp1[i] == i && dp2[i] == i;     }     cout << cnt <<   n ;     for (int i = 1; i <= n; i++) {       cout << (dp1[i] == i && dp2[i] == i ?  A  :  E );     }   }
#include <bits/stdc++.h>   using namespace std;   int x[2][2];   int main() {     for (int i = 0; i < 2; i++)       for (int j = 0; j < 2; j++) scanf( %d , x[i] + j);     printf( %d n ,            (max(1, abs(x[0][0] - x[1][0])) + max(1, abs(x[0][1] - x[1][1])) + 2) *                2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int x[3];   int main() {     int a, b, c, n, ans = 0, t = 0;     cin >> n;     cin >> x[0] >> x[1] >> x[2];     n--;     while (n--) {       if (t == 0) {         if (x[0] < x[1]) {           ans += x[0];           t = 1;         } else {           ans += x[1];           t = 2;         }       } else if (t == 1) {         if (x[0] < x[2]) {           ans += x[0];           t = 0;         } else {           ans += x[2];           t = 2;         }       } else {         if (x[2] < x[1]) {           ans += x[2];           t = 1;         } else {           ans += x[1];           t = 0;         }       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int c[5005], h[11], f[505];   int cnt[100005];   int fcnt[100005];   int cache[5005][505];   int solve(int idx1, int idx2) {     if (idx1 == 0 || idx2 == 0) return 0;     int &ret = cache[idx1][idx2];     if (ret != -1) return ret;     ret = 0;     for (int i = 0; i <= k && i <= idx1; i++)       ret = max(ret, solve(idx1 - i, idx2 - 1) + h[i]);     return ret;   }   int main() {     scanf( %d%d , &n, &k);     for (int i = 0; i < n * k; i++) {       scanf( %d , &c[i]);       cnt[c[i]]++;     }     for (int i = 0; i < n; i++) {       scanf( %d , &f[i]);       fcnt[f[i]]++;     }     for (int i = 1; i <= k; i++) scanf( %d , &h[i]);     int ans = 0;     for (int i = 0; i < 100005; i++) {       if (fcnt[i]) {         memset(cache, -1, sizeof(cache));         ans += solve(cnt[i], fcnt[i]);       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int const mxn = 1e3 + 10;   vector<pair<int, int> > ha[3], adj0[mxn][mxn], adj1[mxn][mxn];   int mark[mxn][mxn][3], fl[mxn][mxn][3];   int n, m;   int ans = 1e9;   string l[mxn];   void connect(int i, int j, int i2, int j2) {     if (i2 < 0 or i2 >= n or j2 < 0 or j2 >= m)       return;     else {       if (l[i2][j2] ==  . )         adj1[i][j].push_back({i2, j2});       else if (l[i2][j2] !=  # )         adj0[i][j].push_back({i2, j2});     }   }   int main() {     cin >> n >> m;     for (int i = 0; i < n; i++) cin >> l[i];     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (l[i][j] ==  1  or l[i][j] ==  2  or l[i][j] ==  3 ) {           ha[l[i][j] -  1 ].push_back({i, j});         }         connect(i, j, i + 1, j);         connect(i, j, i - 1, j);         connect(i, j, i, j + 1);         connect(i, j, i, j - 1);       }     }     for (int now = 0; now <= 2; now++) {       queue<pair<int, int> > q;       for (int i = 0; i < ha[now].size(); i++) {         q.push(ha[now][i]);         fl[ha[now][i].first][ha[now][i].second][now] = 0;         mark[ha[now][i].first][ha[now][i].second][now] = 1;       }       while (q.size()) {         int v1, v2;         v1 = q.front().first, v2 = q.front().second;         q.pop();         queue<pair<int, int> > q0;         q0.push({v1, v2});         while (q0.size()) {           int a1, a2;           a1 = q0.front().first, a2 = q0.front().second;           q0.pop();           for (int j = 0; j < adj0[a1][a2].size(); j++) {             int u1 = adj0[a1][a2][j].first, u2 = adj0[a1][a2][j].second;             if (!mark[u1][u2][now]) {               q0.push({u1, u2});               q.push({u1, u2});               mark[u1][u2][now] = 1;               fl[u1][u2][now] = fl[v1][v2][now];             }           }         }         for (int j = 0; j < adj1[v1][v2].size(); j++) {           int k1 = adj1[v1][v2][j].first, k2 = adj1[v1][v2][j].second;           if (!mark[k1][k2][now]) {             mark[k1][k2][now] = 1;             q.push({k1, k2});             fl[k1][k2][now] = fl[v1][v2][now] + 1;           }         }       }     }     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (l[i][j] ==  .  and mark[i][j][0] and mark[i][j][1] and mark[i][j][2])           ans = min(ans, (fl[i][j][0] + fl[i][j][2] + fl[i][j][1]) - 2);         else if (l[i][j] !=  #  and mark[i][j][0] and mark[i][j][1] and                  mark[i][j][2])           ans = min(ans, fl[i][j][0] + fl[i][j][2] + fl[i][j][1]);       }     }     if (ans == 1e9)       cout << -1;     else       cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   struct custom_hash {     static uint64_t splitmix64(uint64_t x) {       x += 0x9e3779b97f4a7c15;       x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;       x = (x ^ (x >> 27)) * 0x94d049bb133111eb;       return x ^ (x >> 31);     }     size_t operator()(uint64_t x) const {       static const uint64_t FIXED_RANDOM =           chrono::steady_clock::now().time_since_epoch().count();       return splitmix64(x + FIXED_RANDOM);     }   };   long long getPairsCount(int arr[], int n, long long sum) {     unordered_map<int, int, custom_hash> m;     for (int i = 0; i < n; i++) m[arr[i]]++;     long long twice_count = 0;     for (int i = 0; i < n; i++) {       twice_count += m[sum - arr[i]];       if (sum - arr[i] == arr[i]) twice_count--;     }     return twice_count / 2;   }   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       int ara[n];       long long sum = 0;       for (int i = 0; i < n; i++) {         cin >> ara[i];         sum += ara[i];       }       sum *= 2;       if (sum % n) {         cout <<  0 n ;         continue;       }       cout << getPairsCount(ara, n, sum / n) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   template <typename X>   inline bool minimize(X& p, X q) {     if (p <= q) return 0;     p = q;     return 1;   }   template <typename X>   inline bool maximize(X& p, X q) {     if (p >= q) return 0;     p = q;     return 1;   }   const int MAXN = 100005;   int Ya[MAXN], Yb[MAXN], L[MAXN];   inline double dis(int dx, int dy) {     return sqrt(1.0 * dx * dx + 1.0 * dy * dy);   }   int main() {     int N, M, a, b;     scanf( %d%d%d%d , &N, &M, &a, &b);     for (int i = 1; i <= N; ++i) scanf( %d , Ya + i);     for (int i = 1; i <= M; ++i) scanf( %d , Yb + i);     for (int i = 1; i <= M; ++i) scanf( %d , L + i);     double ans = 1e100;     int ap = 1, bp = 1;     for (int i = 1, j = 1; i <= M; ++i) {       int temp = ceil((double)a * Yb[i] / b);       while (j < N && Ya[j] < temp) ++j;       if (minimize(ans, dis(a, Ya[j]) + dis(b - a, Yb[i] - Ya[j]) + L[i]))         ap = j, bp = i;       if (j != 1 &&           minimize(ans, dis(a, Ya[j - 1]) + dis(b - a, Yb[i] - Ya[j - 1]) + L[i]))         ap = j - 1, bp = i;     }     printf( %d %d n , ap, bp);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline bool chkmin(T &x, T y) {     return y < x ? x = y, 1 : 0;   }   template <class T>   inline bool chkmax(T &x, T y) {     return x < y ? x = y, 1 : 0;   }   inline long long Max(long long x, long long y) { return x > y ? x : y; }   inline long long Min(long long x, long long y) { return x < y ? x : y; }   int n, m;   long long dp[2002][2002];   void Add(long long &x, long long y) {     x += y;     if (x >= 1000000007) x %= 1000000007;     if (x < 0) (x += 1000000007) %= 1000000007;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = (1), i_end_ = (n); i <= i_end_; i++) dp[i][1] = 1;     for (int k = (2), k_end_ = (m); k <= k_end_; k++)       for (int i = (1), i_end_ = (n); i <= i_end_; i++)         for (int j = i; j <= n; j += i) Add(dp[j][k], dp[i][k - 1]);     long long ans = 0;     for (int i = (1), i_end_ = (n); i <= i_end_; i++) Add(ans, dp[i][m]);     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long t, t0, t2, x, x2;   void cmp(long double &temp, long long &o, long long &o2, long long y,            long long y2) {     if (y2 > x2) return;     long double newTemp = (1.0 * t * y + t2 * y2) / (y + y2);     if (newTemp < t0) return;     if (newTemp > temp + 1e-9) return;     if (newTemp < temp || y + y2 > o + o2) o = y, o2 = y2, temp = newTemp;   }   int main() {     cin >> t >> t2 >> x >> x2 >> t0;     if (t0 == t2) {       if (t != t0)         cout << 0 <<     << x2 << endl;       else         cout << x <<     << x2 << endl;     } else if (t0 == t)       cout << x <<     << 0 << endl;     else {       long double temp = 1e9;       long long o = 0, o2 = 0;       cmp(temp, o, o2, 0, x2);       cmp(temp, o, o2, x, 0);       for (long long y = 0; y <= x; y++) {         long long y2 = (y * (t0 - t) + t2 - t0 - 1) / (t2 - t0);         cmp(temp, o, o2, y, y2);       }       cout << o <<     << o2 << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using pii = pair<int, int>;   using pll = pair<ll, ll>;   using vpii = vector<pii>;   using vpll = vector<pll>;   template <typename T>   ostream &operator<<(ostream &os, const vector<T> &v) {     for (const auto &x : v) os << x <<    ;     return os << endl;   }   ll ceil_div(ll a, ll b) { return (a + b - 1) / b; }   void solve(int n) {     if (n == 1) {       cout << -1 << endl;       return;     }     for (int i = 0; i < n; i++) {       cout << (i == 0 ? 2 : 3);     }     cout << endl;   }   int main(int argc, char const *argv[]) {     int T;     cin >> T;     for (int t = 0; t < T; t++) {       int n;       cin >> n;       solve(n);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define cp ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);   #define ll long long int     #define vint vector<int>   #define vllint vector<ll>   #define pair_int pair<int , int>   #define pair_ll_int pair<ll , ll>   #define vector_of_pair_int vector<pair_int>   #define pb push_back    #define test_case int t; cin>>t; while(t--)   #define umap unordered_map <int,int>    #define mapint map<int,int>   #define infinity 1000000000   #define mp make_pair      int main()    {     cp              test_case       {          ll n;          cin>>n;             if(n<=256)          {            int count=0;                    ll temp=n;            while(temp!=1)            {             count++;             if(temp%2==0)              temp=temp/2;             else              temp=temp/2+1;            }               cout<<count+n-3<<endl;                       for (int i = 1; i <=n-3; ++i)            {             /* code */              cout<<3+i-1<<   <<3+i<<endl;            }               for (int i = 0; i < count; ++i)            {             /* code */             cout<<n<<   <<2<<endl;            }                                     }          else          {            int count=0;                    ll temp=n;            while(temp!=1)            {             count++;                          temp=ceil(float(temp)/float(16));            }               cout<<count+n<<endl;                        for (int i = 3; i <n; ++i)            {             /* code */                if(i!=16)                {                 cout<<i<<   <<i+1<<endl;                }               }                           for (int i = 0; i < count; ++i)            {             /* code */             cout<<n<<   <<16<<endl;            }                        for (int i = 0; i < 4; ++i)            {             /* code */             cout<<16<<   <<2<<endl;            }                                 }       }          return 0;    }
#include <bits/stdc++.h>   using namespace std;   const int N = 205;   int mem[N][N];   int asol[N];   bool query(int i, int j) {     i = asol[i];     j = asol[j];     if (mem[i][j] != -1) return mem[i][j];     if (i == j) return false;     cout <<  ?   << i <<     << j << endl;     char c;     cin >> c;     mem[i][j] = (c ==  < );     mem[j][i] = !mem[i][j];     return mem[i][j];   }   int main() {     int t;     cin >> t;     while (t--) {       memset(mem, -1, sizeof mem);       int n;       cin >> n;       for (int i = 1; i <= 2 * n; i++) asol[i] = i;       shuffle(asol + 1, asol + 2 * n + 1, mt19937(23232));       vector<int> worse;       for (int i = 1; i < 2 * n; i += 2) {         if (query(i, i + 1))           worse.push_back(i);         else           worse.push_back(i + 1);       }       sort(worse.begin(), worse.end(), query);       int xx = worse.back();       worse.pop_back();       int yy = worse.back();       vector<int> choto, boro;       for (int i = 1; i <= 2 * n; i++) {         if (i == yy) continue;         if (query(yy, i))           boro.push_back(i);         else           choto.push_back(i);       }       if (boro.size() <= n) {         sort(choto.begin(), choto.end(), query);         cout <<  !  << endl;       } else {         int xxpr = (xx % 2 ? xx + 1 : xx - 1);         vector<int> worse;         if (query(xx, xxpr))           worse.push_back(xx);         else           worse.push_back(xxpr);         int unpaired = -1;         for (int x : boro) {           if (x == xx || x == xxpr) continue;           if (unpaired == -1)             unpaired = x;           else {             if (query(unpaired, x))               worse.push_back(unpaired);             else               worse.push_back(x);             unpaired = -1;           }         }         if (unpaired != -1) worse.push_back(unpaired);         sort(worse.begin(), worse.end(), query);         cout <<  !  << endl;       }     }   }
#include <bits/stdc++.h>      using namespace std;      int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int tt;     cin >> tt;     while(tt--) {       int n;       cin >> n;       vector<int> a(n);       for(int i = 0; i < n; i++) {         cin >> a[i];       }       set<int> s;       s.insert(a[0]);       bool ok = true;       for(int i = 1; i < n; i++) {         int x = min(a[i], a[i - 1]);         int y = max(a[i], a[i - 1]);         if(s.upper_bound(x) != s.end()) {           if(*s.upper_bound(x) < y) {             ok = false;             break;           }         }         s.insert(a[i]);       }       cout << (ok ?  YES  :  NO ) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a[3];     int x[3];     int last = 0;     cin >> a[0] >> a[1] >> a[2];     cin >> x[0] >> x[1] >> x[2];     for (int i = 0; i < 3; ++i) {       int t = a[i] - x[i];       if (t > 0) t /= 2;       last += t;     }     if (last < 0)       cout <<  No n ;     else       cout <<  Yes n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define rep(i, a, b) for(int i = a; i < b; ++i)      int debug = 0;      const int N = 510;      int n, p[N], a[N][N];      int main() {       cin >> n;       rep(i, 1, n + 1) {           cin >> p[i];       }       rep(i, 1, n + 1) {           int x = i, y = i;           rep(_, 0, p[i]) {               a[x][y] = p[i];               if (y > 1 && a[x][y - 1] == 0) {                   --y;               } else {                   ++x;               }           }       }       rep(i, 1, n + 1) {           rep(j, 1, i + 1) {               cout << a[i][j] <<    ;           }           cout <<   n ;       }   }
#include <bits/stdc++.h>   using namespace std;   long long getmax(long long arr[]) {     long long m = 0;     for (long long i = 0; i < 26; i++) {       m = max(m, arr[i]);     }     return m;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n, m;     cin >> n >> m;     string arr[n];     long long alpha[26];     long long res = 0;     for (long long i = 0; i < n; i++) cin >> arr[i];     long long marks[m];     for (long long i = 0; i < m; i++) cin >> marks[i];     for (long long i = 0; i < m; i++) {       memset(alpha, 0, sizeof(alpha));       for (long long j = 0; j < n; j++) {         int k = arr[j][i] -  A ;         alpha[k]++;       }       long long c = getmax(alpha);       res += c * marks[i];     }     cout << res <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   struct ee {     int d;     int y;   };   ee e[120];   ee r[1200];   bool ok(ee a, ee b) { return a.y > b.y; }   int main() {     int n;     int k;     while (cin >> n >> k) {       memset(e, 0, sizeof(e));       memset(r, 0, sizeof(r));       for (int i = 0; i < n; i++) {         cin >> e[i].y;         e[i].d = i + 1;       }       sort(e, e + n, ok);       int m = 0, m2 = 0;       int ss;       for (int i = 0; i < k; i++) {         ss = e[0].y - e[n - 1].y;         if (ss <= 1) {           break;         }         e[0].y--;         e[n - 1].y++;         r[i].d = e[0].d;         r[i].y = e[n - 1].d;         sort(e, e + n, ok);         m++;         if (ss > e[0].y - e[n - 1].y) {           m2 = m;           ss = e[0].y - e[n - 1].y;         }       }       cout << ss <<     << m2 << endl;       for (int i = 0; i < m2; i++) {         cout << r[i].d <<     << r[i].y << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1001];   int dp[1010][1010];   int from[1010][1010][2];   int del[1010][1010][2];   int main() {     int i, j, n;     cin >> n;     for (i = 0; i < n; i++) cin >> a[i];     if (n % 2) n++;     for (i = 0; i <= n + 2; i++)       for (j = 0; j <= n + 2; j++) dp[i][j] = 2000000000;     dp[0][1] = 0;     for (i = 0; i < n; i++)       for (j = i + 1; j < n; j++) {         if (dp[i][j + 2] > dp[i][j] + max(a[j], a[j + 1])) {           dp[i][j + 2] = dp[i][j] + max(a[j], a[j + 1]);           from[i][j + 2][0] = i, from[i][j + 2][1] = j;           del[i][j + 2][0] = j, del[i][j + 2][1] = j + 1;         }         if (dp[j + 1][j + 2] > dp[i][j] + max(a[i], a[j])) {           dp[j + 1][j + 2] = dp[i][j] + max(a[i], a[j]);           from[j + 1][j + 2][0] = i, from[j + 1][j + 2][1] = j;           del[j + 1][j + 2][0] = i, del[j + 1][j + 2][1] = j;         }         if (dp[j][j + 2] > dp[i][j] + max(a[i], a[j + 1])) {           dp[j][j + 2] = dp[i][j] + max(a[i], a[j + 1]);           from[j][j + 2][0] = i, from[j][j + 2][1] = j;           del[j][j + 2][0] = i, del[j][j + 2][1] = j + 1;         }       }     i = n, j = n + 1;     cout << dp[i][j] << endl;     vector<int> res;     while (i || j) {       int p1 = from[i][j][0], p2 = from[i][j][1];       res.push_back(del[i][j][0] + 1), res.push_back(del[i][j][1] + 1);       i = p1, j = p2;     }     for (i = n - 1; i >= 0; i -= 2) {       cout << res[i - 1];       if (a[res[i] - 1]) cout <<     << res[i];       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, i, j, k, l, tot, ans, v;   long long o, p;   long long f[110010];   struct rec {     long long x, y;   } a[100010];   bool cmp(rec x, rec y) { return x.x < y.x || ((x.x == y.x) && (x.y < y.y)); }   int find(int k, int l, long long x) {     while (k < l) {       int mid = (k + l) / 2;       if (f[mid] <= x)         k = mid + 1;       else         l = mid;     }     return k;   }   int main() {     cin >> n;     for (i = 0; i < n; i++) {       scanf( %I64d%I64d , &a[i].x, &a[i].y);     }     cin >> v;     for (i = 0; i < n; i++) {       o = a[i].x;       p = a[i].y;       a[i].x = -o + p * v;       a[i].y = o + p * v;     }     sort(a, a + n, cmp);     tot = 1;     f[0] = -1e12, f[1] = 1e12;     for (i = 0; i < n; i++) {       j = find(0, tot, a[i].y);       if (f[j] > a[i].y) f[j] = a[i].y;       if (j >= tot) f[++tot] = 1e12;     }     ans = tot - 1;     f[tot = 1] = 1e12;     for (i = 0; i < n; i++)       if ((a[i].x >= 0) && (a[i].y >= 0)) {         j = find(0, tot, a[i].y);         if (f[j] > a[i].y) f[j] = a[i].y;         if (j >= tot) f[++tot] = 1e12;       }     printf( %d %d n , tot - 1, ans);     cin >> n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   int a[100000];   int main() {     int n, k;     cin >> n >> k;     int sum = 0;     bool ok = false;     vector<int> ans;     for (int i = 0; i < n; i++) {       cin >> a[i];       sum += a[i];     }     if (sum % k != 0) {       printf( No n );     } else {       sum /= k;       int temp = 0;       int cnt = 0;       for (int i = 0; i < n; i++) {         temp += a[i];         cnt++;         if (temp > sum) {           printf( No n );           ok = true;           break;         } else if (temp == sum) {           temp = 0;           ans.push_back(cnt);           cnt = 0;         }       }       if (!ok) {         printf( Yes n );         for (int i = 0; i < ans.size(); i++) {           if (i > 0) printf(   );           printf( %d , ans[i]);         }         printf(  n );       }     }     return 0;   }