malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long oo = 1e18;   struct dta {     int u, id;     dta(int _u = 0, int _id = 0) {       u = _u;       id = _id;     }   };   struct TDij {     long long val;     int x;     TDij(long long _val = 0, int _x = 0) {       x = _x;       val = _val;     }   };   inline bool operator<(const TDij &a, const TDij &b) { return (a.val > b.val); }   int n, m, k, cost[300010], trace[300010], delneed;   bool flag[300010];   long long F[300010];   vector<dta> A[300010];   priority_queue<TDij> Q;   void dijks() {     memset(flag, true, sizeof(flag));     memset(trace, 0, sizeof(trace));     for (int i = 2; i <= n; ++i) F[i] = oo;     F[1] = 0;     Q.push(TDij(0, 1));     while (!Q.empty()) {       TDij topx = Q.top();       Q.pop();       if (topx.val != F[topx.x]) continue;       int u = topx.x;       for (int i = 0; i <= A[u].size() - 1; ++i) {         if (F[A[u][i].u] > F[u] + cost[A[u][i].id]) {           F[A[u][i].u] = F[u] + cost[A[u][i].id];           flag[trace[A[u][i].u]] = true;           trace[A[u][i].u] = A[u][i].id;           flag[A[u][i].id] = false;           Q.push(TDij(F[A[u][i].u], A[u][i].u));         }       }     }   }   void dfs(int x, int par, int pared) {     for (int i = 0; i <= A[x].size() - 1; ++i)       if (A[x][i].u != par && !flag[A[x][i].id]) {         dfs(A[x][i].u, x, A[x][i].id);         if (delneed == 0) return;       }     if (delneed > 0) {       (--delneed);       flag[pared] = true;     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k;     for (int i = 1; i <= m; ++i) {       int u, v;       cin >> u >> v >> cost[i];       A[u].push_back(dta(v, i));       A[v].push_back(dta(u, i));     }     dijks();     delneed = m - k;     if (!delneed) {       for (int i = 1; i <= m; ++i) delneed += (!flag[i]);       cout << delneed <<   n ;       for (int i = 1; i <= m; ++i)         if (!flag[i]) cout << i <<    ;       return 0;     }     for (int i = 1; i <= m; ++i)       if (flag[i]) {         if ((--delneed) == 0) {           cout << k <<   n ;           for (int j = 1; j <= i; ++j)             if (!flag[j]) cout << j <<    ;           for (int j = i + 1; j <= m; ++j) cout << j <<    ;           return 0;         }       }     dfs(1, 0, 0);     cout << k <<   n ;     for (int i = 1; i <= m; ++i)       if (!flag[i]) cout << i <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<string> solve(int k) {     vector<string> s;     if (k == 0) {       s.push_back( + );       return s;     }     vector<string> prev = solve(k - 1), rev;     for (int i = 0; i < prev.size(); i++) {       string temp;       for (int j = 0; j < prev.size(); j++) {         if (prev[i][j] ==  + )           temp +=  * ;         else           temp +=  + ;       }       rev.push_back(temp);     }     for (int i = 0; i < prev.size(); i++) {       s.push_back(prev[i] + prev[i]);       s.push_back(prev[i] + rev[i]);     }     return s;   }   int main() {     int k;     cin >> k;     vector<string> s;     s = solve(k);     for (int i = 0; i < s.size(); i++) {       cout << s[i] << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   inline int read() {     int s = 0;     char c;     while ((c = getchar()) <  0  || c >  9 )       ;     do {       s = s * 10 + c -  0 ;     } while ((c = getchar()) >=  0  && c <=  9 );     return s;   }   const int N = 3010, M = 310;   int n, m, rp[M];   double f[M][2][N], tp[N][M];   priority_queue<pair<double, int> > h;   double nxdp(int i) {     int p = (++rp[i]) & 1;     if (rp[i] > n) return -1e9;     f[i][p][0] = 0;     for (int k = 1; k <= n; k++)       f[i][p][k] =           tp[k][i] * f[i][p ^ 1][k - 1] + (1 - tp[k][i]) * f[i][p][k - 1];     return f[i][p][n];   }   double work() {     int i, k;     double ans = 0;     for (i = 1; i <= m; i++)       for (k = 0; k <= n; k++) f[i][0][k] = 1;     for (i = 1; i <= m; i++) h.push(make_pair(nxdp(i), i));     for (i = 1; i <= n; i++) {       pair<double, int> t = h.top();       h.pop();       ans += t.first;       h.push(make_pair(nxdp(t.second), t.second));     }     return ans;   }   int main() {     int i, j;     n = read(), m = read();     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) tp[i][j] = read() * 0.001;     printf( %.11lf n , work());     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int siz = 1e5 + 10;   const long long modu = 1e9 + 7;   int pre[13] = {1, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292, 341};   int main() {     int n;     scanf( %d , &n);     if (n < 13) {       cout << pre[n] << endl;       return 0;     }     long long n1 = n;     long long ans = pre[12];     ans += (n1 - 12ll) * 49ll;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> mp;   int main() {     int n, num, flag = 1, f;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &num);       ++mp[num];     }     map<int, int>::iterator it = mp.begin();     int ln = it->first;     int lm = it->second;     int l = ln, r = ln;     ++it;     for (; it != mp.end(); ++it) {       if (it->first > r + 1) {         flag = 0;         break;       } else {         if (lm == it->second) {           lm = 1;           r = it->first;         } else if (lm > it->second) {           lm -= it->second;           if (lm > 1) {             flag = 0;             break;           }         } else if (lm < it->second) {           if (l + 1 != it->first) {             lm = it->second - lm + 1;             r = it->first;             continue;           }           l = it->first;           r = it->first;           lm = it->second - lm;         }       }     }     if (l + 1 != r) flag = 0;     if (flag && lm < 2) {       printf( YES );     } else       printf( NO );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int ct[2][6] = {0};     for (int i = 0; i < n; i++) {       int tmp;       scanf( %d , &tmp);       ct[0][tmp]++;     }     for (int i = 0; i < n; i++) {       int tmp;       scanf( %d , &tmp);       ct[1][tmp]++;     }     int diff = 0;     int flag = 0;     for (int i = 1; i <= 5; i++) {       if (ct[0][i] != ct[1][i]) {         int tmp = abs(ct[0][i] - ct[1][i]);         if (tmp % 2 != 0) flag = 1;         diff += tmp / 2;       }     }     if (flag == 0)       cout << diff / 2;     else       cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long j, k, s, l, m, n, t, d;   long long e[111][33333], a, b, i, p, c;   map<string, long long> y;   string q, r, w;   int main() {     cin >> n >> a >> b >> c;     n *= 2;     for (i = 0; i <= a; i++) {       for (j = 0; j <= b; j++) {         k = n - i - 2 * j;         if (k % 4 == 0 && k / 4 <= c && k >= 0) s++;       }     }     cout << s;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, t, k, d, t1, t2, kol;     bool f;     f = false;     cin >> n;     cin >> t;     cin >> k;     cin >> d;     t1 = 0;     t2 = 0;     kol = 0;     while (kol < n) {       t1++;       if (t1 % t == 0) {         kol = kol + k;       }     }     kol = 0;     while (kol < n) {       t2++;       if (f == true) {         if ((t2 - d) % t == 0) {           kol = kol + k;         }       }       if (t2 % t == 0) {         kol = kol + k;       }       if (t2 % d == 0) {         f = true;       }     }     if (t1 > t2) {       cout <<  YES ;     } else {       cout <<  NO ;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int y, w;     cin >> y >> w;     int ans;     ans;     if (y >= w) {       ans = 6 - y + 1;     } else if (w >= y) {       ans = 6 - w + 1;     }     if (ans == 6) {       cout << 1 <<  /  << 1 << endl;     }     if (ans == 1) {       cout << 1 <<  /  << 6 << endl;     }     if (ans == 2) {       cout << 1 <<  /  << 3 << endl;     }     if (ans == 3) {       cout << 1 <<  /  << 2 << endl;     }     if (ans == 4) {       cout << 2 <<  /  << 3 << endl;     }     if (ans == 5) {       cout << 5 <<  /  << 6 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[111], ans = 1e9;   set<int> s[111];   int main() {     ios_base ::sync_with_stdio(false);     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       cin >> a[i];     }     for (int i = 0, x, y; i < m; ++i) {       cin >> x >> y;       s[x].insert(y);       s[y].insert(x);     }     for (int i = 1; i < n - 1; ++i) {       for (int j = i + 1; j < n; ++j) {         if (s[i].count(j)) {           for (int k = j + 1; k <= n; ++k) {             if (s[i].count(k) && s[j].count(k)) {               ans = min(a[i] + a[j] + a[k], ans);             }           }         }       }     }     if (ans == 1e9) {       cout << -1;     } else {       cout << ans;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int temp = 0;     int n = 0;     cin >> n;     vector<int> city(n);     for (int i = 0; i < n; ++i) {       cin >> city[i];     }     int max = 0;     int min = 0;     for (int j = 0; j < n; ++j) {       if (j == n - 1) {         min = abs(city[j] - city[j - 1]);         max = abs(city[j] - city[0]);       } else if (j == 0) {         min = abs(city[0] - city[1]);         max = abs(city[0] - city[n - 1]);       } else {         if (abs(city[j] - city[j + 1]) < abs(city[j] - city[j - 1]))           min = abs(city[j] - city[j + 1]);         else if (abs(city[j] - city[j + 1]) >= abs(city[j] - city[j - 1]))           min = abs(city[j] - city[j - 1]);         if (abs(city[j] - city[0]) < abs(city[j] - city[n - 1]))           max = abs(city[j] - city[n - 1]);         else if (abs(city[j] - city[0]) >= abs(city[j] - city[n - 1]))           max = abs(city[j] - city[0]);       }       cout << min <<     << max << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   T gcd(T a, T b) {     return (b == 0) ? a : gcd(b, a % b);   }   template <typename T>   T lcm(T a, T b) {     return a * (b / gcd(a, b));   }   template <typename T>   T mod_exp(T b, T p, T m) {     T x = 1;     while (p) {       if (p & 1) x = (x * b) % m;       b = (b * b) % m;       p = p >> 1;     }     return x;   }   template <typename T>   T invFermat(T a, T p) {     return mod_exp(a, p - 2, p);   }   template <typename T>   T exp(T b, T p) {     T x = 1;     while (p) {       if (p & 1) x = (x * b);       b = (b * b);       p = p >> 1;     }     return x;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     ;     int a, b;     cin >> a >> b;     if (a == 0 && b == 0) {       cout <<  NO  <<   n ;     } else if (abs(a - b) <= 1)       cout <<  YES  <<   n ;     else       cout <<  NO  <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int A[105][105];   int main() {     int n;     int ans = 0;     cin >> n;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       for (int j = 0; j < n; j++) {         if (s[j] ==  C ) {           A[i][j] = 1;         } else {           A[i][j] = 0;         }       }     }     for (int i = 0; i < n; i++) {       int cnt = 0;       for (int j = 0; j < n; j++) {         if (A[i][j] == 1) {           cnt++;         }       }       ans += (cnt * (cnt - 1)) / 2;     }     for (int i = 0; i < n; i++) {       int cnt = 0;       for (int j = 0; j < n; j++) {         if (A[j][i] == 1) {           cnt++;         }       }       ans += (cnt * (cnt - 1)) / 2;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN(1e5 + 10);   typedef int i_N[maxN];   int N, Gx[maxN][2], Fx[maxN][2][2];   i_N A;   string S;   int main() {     scanf( %d n , &N);     getline(cin, S);     for (int i = 0; i < (int)S.size(); i++) A[i + 1] = S[i] ==  1 ;     A[0] = A[N + 1] = -1;     for (int i = N; i; i--) {       Gx[i][0] = Gx[i + 1][0];       Gx[i][1] = Gx[i + 1][1];       if (A[i] == 0)         Gx[i][0] = max(Gx[i][0], Gx[i + 1][1] + 1);       else         Gx[i][1] = max(Gx[i][1], Gx[i + 1][0] + 1);     }     int ans(0);     for (int i = 1; i <= N; i++) {       for (int j = 0; j < 2; j++)         for (int k = 0; k < 2; k++) Fx[i][j][k] = Fx[i - 1][j][k];       if (A[i] == 0) {         Fx[i][0][0] = max(Fx[i][0][0], Fx[i - 1][1][0] + 1);         Fx[i][1][1] = max(Fx[i][1][1], max(Fx[i - 1][0][0], Fx[i - 1][0][1]) + 1);       } else {         Fx[i][1][0] = max(Fx[i][1][0], Fx[i - 1][0][0] + 1);         Fx[i][0][1] = max(Fx[i][0][1], max(Fx[i - 1][1][0], Fx[i - 1][1][1]) + 1);       }       ans = max(ans, max(Fx[i][0][1] + Gx[i + 1][1], Fx[i][1][1] + Gx[i + 1][0]));     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int n, d;   string s, t;   map<pair<char, char>, vector<int> > M;   map<char, vector<int> > N;   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> s >> t;     d = 0;     for (int i = 0; i < n; ++i) {       if (s[i] != t[i]) {         M[make_pair(s[i], t[i])].push_back(i + 1);         N[s[i]].push_back(i + 1);         ++d;       }     }     for (int i = 0; i < n; ++i) {       if (s[i] != t[i]) {         map<pair<char, char>, vector<int> >::iterator it =             M.find(make_pair(t[i], s[i]));         if (it != M.end()) {           cout << d - 2 << endl;           cout << i + 1 <<     << it->second.back() << endl;           return 0;         }       }     }     for (int i = 0; i < n; ++i) {       if (s[i] != t[i]) {         if (N.find(t[i]) != N.end()) {           cout << d - 1 << endl;           cout << i + 1 <<     << N[t[i]].back() << endl;           return 0;         }       }     }     cout << d << endl;     cout <<  -1 -1  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   set<int> s;   int ans[300005];   int main() {     int n, m, l, r, x;     cin >> n >> m;     for (int i = 1; i < n + 1; i++) {       s.insert(i);       ans[i] = 0;     }     for (int i = 0; i < m; i++) {       cin >> l >> r >> x;       set<int>::iterator lb = s.lower_bound(l), ub = s.upper_bound(r);       for (set<int>::iterator it = lb; it != ub; it++)         if (*it != x) ans[*it] = x;       s.erase(lb, ub);       s.insert(x);     }     for (int i = 1; i < n + 1; i++) cout << ans[i] <<    ;     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e3 + 5;   char s[N];   int n, f[N], mk[N], cnt[N];   vector<int> p;   void init() {     for (int i = 2; i < N; i++)       if (!mk[i]) {         p.push_back(i);         for (int j = i + i; j < N; j += i) mk[j] = true;       }   }   int main() {     scanf( %s , s + 1);     n = strlen(s + 1);     init();     memset(mk, 0, sizeof(mk));     for (int i = 0; i < p.size(); i++) {       if (p[i] * 2 > n) break;       for (int j = 1; j * p[i] <= n; j++) mk[p[i] * j] = true;     }     int tot = 0, mx = 0, pos;     for (int i = 1; i <= n; i++) {       cnt[s[i] -  a ]++;       if (mk[i]) tot++;     }     for (int i = 0; i < 26; i++)       if (mx < cnt[i]) mx = cnt[i], pos = i;     if (mx < tot) {       cout <<  NO  <<   n ;       return 0;     }     puts( YES );     for (int i = 1; i <= n; i++) {       if (mk[i])         printf( %c ,  a  + pos), cnt[pos]--, tot--;       else         for (int j = 0; j < 26; j++)           if (j == pos && cnt[j] > tot || (j != pos && cnt[j])) {             printf( %c ,  a  + j);             cnt[j]--;             break;           }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<vector<long long int> > edge(100010);   long long int vis[100010];   vector<long long int> color[2];   bool dfs(long long int a, long long int c = 2) {     vis[a] = c;     color[c - 1].push_back(a);     for (auto x : edge[a]) {       if (!vis[x] && dfs(x, 3ll - c)) {         return 1;       }       if (vis[x] != 3ll - c) {         return 1;       }     }     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, m, x, y;     cin >> n >> m;     for (long long int i = 1; i <= m; i++) {       cin >> x >> y;       edge[x].push_back(y);       edge[y].push_back(x);     }     for (long long int i = 1; i <= n; i++) {       if (!vis[i]) {         if (edge[i].size() == 0) {           continue;         }         if (dfs(i)) {           cout << -1 << endl;           return 0;         }       }     }     for (long long int i = 0; i < 2; i++) {       cout << color[i].size() << endl;       for (auto x : color[i]) {         cout << x <<    ;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int p[110];   int find(int v) {     if (p[v] == v) return v;     return p[v] = find(p[v]);   }   bool merge(int u, int v) {     int x = find(u);     int y = find(v);     if (x != y) {       p[x] = y;       return true;     }     return false;   }   int main() {     int n, m;     cin >> n >> m;     vector<pair<int, int> > edges;     for (int i = 0; i < m; i++) {       int a, b;       cin >> a >> b;       edges.push_back({a, b});       p[a] = a;       p[b] = b;     }     int flag = 0, count = 1;     for (pair<int, int> e : edges) {       int a = e.first, b = e.second;       if (!merge(a, b)) {         flag++;         if (flag > 1) break;       } else         count++;     }     if (flag == 1 && count == n)       cout <<  FHTAGN!             <<   n ;     else       cout <<  NO             <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char local =  O ;   template <typename T>   void read(T &p) {     cin >> p;   }   template <typename T, typename T1>   void read(pair<T, T1> &p) {     read(p.first);     read(p.second);   }   template <typename T>   void read(T arr[], long long n) {     for (long long i = 0; i < n; i++) {       read(arr[i]);     }   }   template <typename T>   void read(vector<T> &arr) {     for (long long i = 0; i < arr.size(); i++) {       read(arr[i]);     }   }   template <typename T>   void out(T &n) {     cout << n;   }   template <typename T, typename T1>   void out(pair<T, T1> &p) {     cout <<  ( ;     out(p.first);     cout <<  , ;     out(p.second);     cout <<  ) ;   }   template <typename T>   void out(T arr[], long long n) {     for (long long i = 0; i < n; i++) {       out(arr[i]);       cout <<    ;     }   }   template <typename T>   void out(vector<T> &arr) {     for (long long i = 0; i < arr.size(); i++) {       out(arr[i]);       cout <<    ;     }   }   template <typename T>   void out(set<T> &arr) {     for (auto i : arr) {       out(i);       cout <<    ;     }   }   template <typename T>   void out(multiset<T> &arr) {     for (auto i : arr) {       out(i);       cout <<    ;     }   }   template <typename T, typename T1>   void out(map<T, T1> &m) {     for (auto i : m) {       out(i.first);       cout <<   ->  ;       out(i.second);       cout <<  ,  ;     }   }   template <typename Arg1>   void __f(const char *name, Arg1 &&arg1) {     cout << name <<   :  ;     out(arg1);   }   template <typename Arg1, typename... Args>   void __f(const char *names, Arg1 &&arg1, Args &&...args) {     const char *comma = strchr(names + 1,  , );     cout.write(names, comma - names) <<   :  ;     out(arg1);     cout <<   |  ;     __f(comma + 1, args...);   }   template <class T>   void debug(T n, string a) {     cout << a <<  =  << n <<   n ;   }   void cal() {}   void solve() {     int n, h;     cin >> n >> h;     for (int i = 1; i < n; i++) {       cout << fixed << setprecision(15) << (sqrt(i / (n * 1.0)) * h) <<    ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t1;     t1 = 1;     cal();     while (t1--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 1e5 + 5;   bool match(string s1, string s2) {     long long cnt = 0;     for (long long i = 0; s1[i]; ++i) {       if (s1[i] != s2[i]) ++cnt;       if (cnt > 1) return 0;     }     return 1;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       long long n, m;       cin >> n >> m;       vector<string> v(n);       for (long long i = 0; i < n; ++i) cin >> v[i];       bool ans = 0;       string str;       for (long long i = 0; i < m; ++i) {         string s = v[0];         for (long long j = 1; j < n; ++j) {           s[i] = v[j][i];           bool all_match = 1;           for (long long k = 1; k < n; ++k) {             if (!match(s, v[k])) {               all_match = 0;               break;             }           }           if (all_match) {             ans = 1;             str = s;             break;           }         }         if (ans) break;       }       if (ans)         cout << str <<   n ;       else {         bool all_match = 1;         for (long long i = 1; i < n; ++i) {           if (!match(v[0], v[i])) {             all_match = 0;             break;           }         }         if (all_match)           cout << v[0] <<   n ;         else           cout << -1 <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long min(long long a, long long b) {     if (a < b)       return a;     else       return b;   }   static long long gcd(long long a, long long b) {     long long r;     while (b != 0) {       r = a % b;       a = b;       b = r;     }     return a;   }   long long lcm(long long a, long long b) {     long long temp = gcd(a, b);     return temp ? (a / temp * b) : 0;   }   unsigned long long PowMod(unsigned long long x, unsigned long long e,                             unsigned long long mod) {     unsigned long long res;     if (e == 0) {       res = 1;     } else if (e == 1) {       res = x;     } else {       res = PowMod(x, e / 2, mod);       res = res * res % mod;       if (e % 2) res = res * x % mod;     }     return res;   }   int solve() {     int n, m;     cin >> n >> m;     long long a[n], b[m];     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int j = 0; j < m; j++) {       cin >> b[j];     }     vector<pair<long long, int> > v;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         v.push_back(make_pair(a[i] * b[j], i));       }     }     sort((v).begin(), (v).end());     int I = v[(n * m) - 1].second;     long long ans = (1000000000LL) * (1000000000LL) * (-1LL);     ans--;     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         if (i != I) {           ans = max(ans, a[i] * b[j]);         }       }     }     cout << ans;     return 0;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int t = 1;     for (int i = 1; i <= t; i++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int static_init = []() {     ios_base::sync_with_stdio(false), cin.tie(0), cout << fixed;     return 0;   }();   constexpr int N = 3e5;   int32_t n, x[2], c[N + 1], p[N + 1];   int64_t t[N + 2];   bool run(bool sw) {     for (int k1 = 1; k1 <= n; k1++) {       int i1 =           lower_bound(p + 1, p + n + 2 - k1, x[sw],                       [k1](int i, int x) { return (int64_t)c[i] * k1 < x; }) -           p;       int j = i1 + k1;       if (j <= n && t[j] >= x[!sw]) {         int i2;         for (i2 = n; i2 >= j; i2--) {           if (t[i2] == t[j]) break;         }         int k2 = n - i2 + 1;         if (sw) swap(k1, k2), swap(i1, i2);         cout <<  Yes n  << k1 <<     << k2 << endl;         for (int i = i1; i < i1 + k1; i++)           cout << p[i] << (i == i1 + k1 - 1 ?   n  :    );         for (int i = i2; i < i2 + k2; i++)           cout << p[i] << (i == i2 + k2 - 1 ?   n  :    );         return true;       }     }     return false;   }   int main() {     cin >> n >> x[0] >> x[1];     for (int i = 1; i <= n; i++) cin >> c[i];     iota(p + 1, p + n + 1, 1);     sort(p + 1, p + n + 1, [](int i, int j) { return c[i] < c[j]; });     for (int i = n; i >= 1; i--) {       t[i] = max(t[i + 1], (int64_t)c[p[i]] * (n - i + 1));     }     if (!run(false) && !run(true)) cout <<  No  << endl;     return 0;   }