malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   struct Edge {     int u, v;   };   const int MAXN = 2e5 + 5;   int p[MAXN];   vector<Edge> edges;   vector<int> G[MAXN];   bool va[MAXN], vb[MAXN];   int find(int x) { return x == p[x] ? x : p[x] = find(p[x]); }   int main() {     memset(va, 0, sizeof(va));     memset(vb, 0, sizeof(vb));     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) p[i] = i;     while (m--) {       int u, v;       scanf( %d%d , &u, &v);       edges.push_back((Edge){u, v});     }     int s, t, ds, dt;     scanf( %d%d%d%d , &s, &t, &ds, &dt);     vector<Edge> g;     bool ok = 0;     for (int i = 0; i < edges.size(); i++) {       int u = edges[i].u, v = edges[i].v;       bool flag = 0;       if (u == s || u == t) G[u].push_back(v), flag = 1;       if (v == s || v == t) G[v].push_back(u), flag = 1;       if (flag) continue;       u = find(u), v = find(v);       if (u != v) {         p[v] = u;         g.push_back((Edge){edges[i].u, edges[i].v});       }     }     for (int i = 0; i < G[s].size(); i++) va[G[s][i]] = 1;     for (int i = 0; i < G[t].size(); i++) vb[G[t][i]] = 1;     int as = 0, at = 0;     for (int i = 0; i < G[s].size(); i++) {       if (as > ds) break;       if (G[s][i] == t) {         ok = 1;         continue;       }       if (vb[G[s][i]]) continue;       int u = find(s), v = find(G[s][i]);       if (u != v) {         as++;         p[u] = v;         g.push_back((Edge){s, G[s][i]});       }     }     for (int i = 0; i < G[s].size(); i++) {       if (as >= ds) break;       if (G[s][i] == t) {         ok = 1;         continue;       }       int u = find(s), v = find(G[s][i]);       if (u != v) {         as++;         p[u] = v;         g.push_back((Edge){s, G[s][i]});       }     }     for (int i = 0; i < G[t].size(); i++) {       if (at > dt) break;       if (G[t][i] == s) {         ok = 1;         continue;       }       int u = find(t), v = find(G[t][i]);       if (u != v) {         at++;         p[u] = v;         g.push_back((Edge){t, G[t][i]});       }     }     int u = find(s), v = find(t);     if (u != v) {       if (ok) {         g.push_back((Edge){s, t});         as++;         at++;       } else {         puts( No );         return 0;       }     }     if (as > ds || at > dt)       puts( No );     else {       puts( Yes );       for (int i = 0; i < g.size(); i++) {         printf( %d %d n , g[i].u, g[i].v);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dept[105], lend[105];   int main() {     int n, m, a, b, c, sum = 0;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; ++i) {       scanf( %d%d%d , &a, &b, &c);       lend[b] += c;       dept[a] += c;     }     for (int i = 1; i <= n; ++i) {       if (lend[i] < dept[i]) sum += dept[i] - lend[i];     }     cout << sum;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 10;   char ch[N];   int a[N];   int main() {     int n;     cin >> n;     stack<int> st;     for (int i = 1; i <= n * 2; i++) {       scanf(  %c , ch + i);       if (ch[i] ==  + ) {         st.push(i);       } else {         if (st.empty()) {           puts( NO );           return 0;         }         scanf( %d , a + i);         a[st.top()] = a[i];         st.pop();       }     }     set<int> tmp;     for (int i = 1; i <= n * 2; i++) {       if (ch[i] ==  + ) {         tmp.insert(a[i]);       } else {         if (*tmp.begin() != a[i]) {           puts( NO );           return 0;         }         tmp.erase(tmp.begin());       }     }     puts( YES );     for (int i = 1; i <= n * 2; i++) {       if (ch[i] ==  + ) printf( %d  , a[i]);     }     return 0;   }
#include <bits/stdc++.h>   int main() {     int i, n, k;     int v[210];     scanf( %d %d , &n, &k);     for (i = 0; i <= 2 * n; i++) scanf( %d , v + i);     for (i = 1; k > 0 && i < 2 * n + 1; i += 2) {       if (v[i] - 1 > v[i - 1] && v[i] - 1 > v[i + 1]) {         k--;         v[i]--;       }     }     for (i = 0; i < 2 * n + 1; i++) printf( %d  , v[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double esp = 0.00000001;   const int N = 60;   const int PSize = 100;   const double PCross = 0.3;   const double PMuta = 0.05;   int a[200010], t[200010];   int n, T;   vector<int> res;   bool cmp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }   bool ok(int k, vector<pair<int, int> > e) {     if (k > e.size()) return false;     int ans = 0;     sort(e.begin(), e.end(), cmp);     for (int i = 0; i < k; i++) ans += e[i].second;     if (ans > T) return false;     res.clear();     for (int i = 0; i < k; i++) res.push_back(e[i].first);     return true;   }   int main() {     cin >> n >> T;     for (int i = 0; i < n; i++) cin >> a[i] >> t[i];     int l = 0, r = n;     while (l < r) {       int mid = (l + r + 1) >> 1;       vector<pair<int, int> > e;       for (int i = 0; i < n; i++)         if (a[i] >= mid) e.push_back(make_pair(i, t[i]));       if (ok(mid, e))         l = mid;       else         r = mid - 1;     }     cout << l << endl << res.size() << endl;     for (int i = 0; i < res.size(); i++) {       if (i) cout <<    ;       cout << res[i] + 1;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cout << *it <<   =   << a <<   n ;     err(++it, args...);   }   const int MOD = 1e9 + 7, N = 2e5 + 5, B = 32;   vector<int> g[N];   vector<int> inv(N);   map<pair<int, int>, int> mp;   map<int, vector<int>> mpans;   void dfs(int u, int p) {     for (auto v : g[u]) {       if (v == p) continue;       if (mp[{u, v}]) inv[v] += 1;       dfs(v, u);       inv[u] += inv[v];     }   }   void dfs1(int u, int p, int temp) {     mpans[temp].push_back(u);     for (auto v : g[u]) {       if (v == p) continue;       int v1;       if (mp[{u, v}])         v1 = -1;       else         v1 = 1;       dfs1(v, u, temp + v1);     }   }   void solve() {     int n;     cin >> n;     for (int i = 1; i < n; i++) {       int x, y;       cin >> x >> y;       mp[{x, y}] = 0;       mp[{y, x}] = 1;       g[x].push_back(y);       g[y].push_back(x);     }     dfs(1, 0);     dfs1(1, 0, inv[1]);     auto xx = *mpans.begin();     cout << xx.first <<   n ;     sort(xx.second.begin(), xx.second.end());     for (auto r : xx.second) cout << r <<    ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     solve();   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 7;   const int N = 1e6 + 5;   int main() {     int n;     cin >> n;     for (int i = 0; i <= 2 * n; i++) {       for (int j = 0; j < 2 * abs(n - i); j++) cout <<    ;       int cnt = 0;       for (int j = 0; j <= 2 * n - 2 * abs(n - i); j++) {         if (j != 0) cout <<    ;         cout << cnt;         if (j >= n - abs(n - i))           cnt--;         else           cnt++;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct station {     int p, x, dir;     station() {}     station(int pp, int xx, int dirr) {       p = pp;       x = xx;       dir = dirr;     }   };   bool cmp(station a, station b) {     if (a.x != b.x) return a.x < b.x;     return a.dir == 1;   }   int d, n, m;   int main() {     ios_base::sync_with_stdio(0);     cin >> d >> n >> m;     vector<station> v;     for (int i = 0; i < m; i++) {       int x, p;       cin >> x >> p;       v.push_back(station(p, x, 1));       v.push_back(station(p, min(d, x + n), -1));     }     v.push_back(station(0, 0, 1));     v.push_back(station(0, n, -1));     sort(v.begin(), v.end(), cmp);     long long last = 0;     long long res = 0;     multiset<long long> s;     s.insert(0);     long long mx = 0;     for (int i = 1; i < v.size(); i++) {       long long cur = (long long)v[i].x;       long long mn = *s.begin();       res += (cur - last) * mn;       if (cur - last > n || s.size() == 0) return cout << -1, 0;       if (v[i].dir == 1) {         s.insert(v[i].p);       } else {         s.erase(s.find(v[i].p));       }       last = cur;     }     (last == d) ? cout << res : cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr <<     << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   void inp_out() {}   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     inp_out();     long long int n, w;     cin >> n >> w;     vector<long long int> a(n);     for (long long int i = 0; i < n; ++i) {       cin >> a[i];     }     long long int val = 0, mx = w, mn = 0;     for (long long int i = 0; i < n; ++i) {       if (abs(a[i]) > w) {         cout << 0;         return 0;       }       val += a[i];       if (val > w) {         cout << 0;         return 0;       }       long long int val1 = min(w, w - val);       long long int val2 = max(0ll, -val);       mx = min(val1, mx);       mn = max(val2, mn);     }     cout << max(0ll, mx - mn + 1);     return 0;   }
#include <bits/stdc++.h>   const int N = 29;   const int K = 10;   const int MOD = 1e9 + 7;   int n, m, k;   int g[N][N];   int s[N][N][K];   int state[N][N];   int f[N];   bool ch[N];   int fac[N];   int inv[N];   int ans;   inline void init() {     scanf( %d%d%d , &n, &m, &k);     if (n + m - 1 > k) {       puts( 0 );       exit(0);     }     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= m; ++j) scanf( %d , &g[i][j]);   }   inline int pow_mod(int a, int b) {     int ret = 1;     while (b) {       if (b & 1) ret = 1ll * ret * a % MOD;       a = 1ll * a * a % MOD, b >>= 1;     }     return ret;   }   inline int P(int n, int m) { return 1ll * fac[n] * inv[n - m] % MOD; }   void dfs(int x, int y, int tot, int tot2) {     if (tot > k) return;     if (y == m + 1) x++, y = 1;     if (x == n + 1) {       ans = (ans + P(k - tot2, tot - tot2)) % MOD;       return;     }     state[x][y] = state[x - 1][y] | state[x][y - 1];     if (g[x][y]) {       if (f[g[x][y]]) {         if (((state[x][y] >> (f[g[x][y]] - 1)) & 1)) return;         state[x][y] ^= (1 << (f[g[x][y]] - 1));         dfs(x, y + 1, tot, tot2);         state[x][y] ^= (1 << (f[g[x][y]] - 1));       } else {         for (int i = 1; i <= tot + 1; ++i)           if (!((state[x][y] >> (i - 1)) & 1) && !ch[i]) {             state[x][y] ^= (1 << (i - 1));             f[g[x][y]] = i, ch[i] = true;             dfs(x, y + 1, std::max(i, tot), tot2 + 1);             f[g[x][y]] = 0, ch[i] = false;             state[x][y] ^= (1 << (i - 1));           }       }     } else {       for (int i = 1; i <= tot + 1; ++i)         if (!((state[x][y] >> (i - 1)) & 1)) {           state[x][y] ^= (1 << (i - 1));           dfs(x, y + 1, std::max(i, tot), tot2);           state[x][y] ^= (1 << (i - 1));         }     }   }   inline void solve() {     fac[0] = inv[0] = 1;     for (int i = 1; i <= k; ++i) {       fac[i] = 1ll * fac[i - 1] * i % MOD;       inv[i] = 1ll * inv[i - 1] * pow_mod(i, MOD - 2) % MOD;     }     memset(s, 0, sizeof s);     dfs(1, 1, 0, 0);     std::cout << ans << std::endl;   }   int main() {     init();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1000006], g[1000006];   char str[1000006];   int sum1 = 0, sum2 = 0;   int main() {     int n, i;     scanf(  %d , &n);     for (i = 0; i < n; i++) {       scanf(  %d %d , &a[i], &g[i]);     }     for (i = 0; i < n; i++) {       int c = sum2 - (sum1 + a[i]);       int d = sum1 - (sum2 + g[i]);       if (c < 0) c = -c;       if (d < 0) d = -d;       if (c < d) {         str[i] =  A ;         sum1 = sum1 + a[i];       } else {         str[i] =  G ;         sum2 = sum2 + g[i];       }     }     str[i] =   n ;     printf( %s n , str);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   map<int, int> f, val;   int lastans;   int read() {     int x = 0, f = 1;     char s;     while ((s = getchar()) >  9  || s <  0 )       if (s ==  - ) f = -1;     while (s >=  0  && s <=  9 )       x = (x << 1) + (x << 3) + (s ^ 48), s = getchar();     return x * f;   }   int Find(int x) {     if (!f.count(x)) return x;     int t = Find(f[x]);     val[x] ^= val[f[x]];     return f[x] = t;   }   int main() {     int op, u, v, w, x, y;     for (int t = read(); t; --t) {       op = read(), u = read() ^ lastans, v = read() ^ lastans;       if (u > v) swap(u, v);       --u;       x = Find(u), y = Find(v);       if (op == 1) {         w = read() ^ lastans;         if (x ^ y) {           f[x] = y;           val[x] = val[u] ^ val[v] ^ w;         }       } else {         if (x ^ y)           puts( -1 ), lastans = 1;         else           printf( %d n , val[u] ^ val[v]), lastans = val[u] ^ val[v];       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, m, k, t, cs, n, mx, v;     scanf( %d , &n), scanf( %d , &m);     int cnt = 0, ppl = 0;     for (i = 1; i <= n; i++) {       scanf( %d , &v);       if (ppl + v <= m)         ppl += v;       else {         cnt++;         ppl = v;       }     }     if (ppl) cnt++;     printf( %d n , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k, a[1000005], b[1000005];   int mi[1 << 20], mx[1 << 20], p[30], cs1[30], cs2[30], dp1[1 << 20],       dp2[1 << 20], cs = 0;   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= k; ++i) scanf( %1d , &cs1[i]);     for (int i = 1; i <= k; ++i) scanf( %1d , &cs2[i]);     for (int i = 1; i <= k; ++i) cs -= cs1[i] + cs2[i];     cs += k;     for (int i = 1; i <= n; ++i) scanf( %d%d , &a[i], &b[i]);     memset(mi, 63, sizeof(mi));     memset(mx, -63, sizeof(mx));     for (int i = 1; i <= k; ++i) p[i] = i;     int tp = 0;     for (int i = 1; i <= k; ++i) tp |= cs2[i] << (i - 1);     mx[tp] = max(mx[tp], n + 1);     for (int i = n; i >= 1; --i) {       int p1 = 0, p2 = 0;       for (int j = 1; j <= k; ++j)         if (p[j] == a[i] || p[j] == b[i]) p2 = p1, p1 = j;       swap(p[p1], p[p2]);       int w1 = 0, w2 = 0;       for (int j = 1; j <= k; ++j)         w1 |= cs1[p[j]] << (j - 1), w2 |= cs2[p[j]] << (j - 1);       mi[w1] = min(mi[w1], i);       mx[w2] = max(mx[w2], i);     }     int len = 1 << k, ans = 0, l = 0, r = 0;     for (int i = len - 1; i >= 0; --i) {       dp1[i] = mi[i];       dp2[i] = mx[i];       int sz = 0;       for (int j = 0; j < k; ++j) {         if (!((1 << j) & i))           ((dp1[i] > dp1[i | (1 << j)]) && (dp1[i] = dp1[i | (1 << j)])),               ((dp2[i] < dp2[i | (1 << j)]) && (dp2[i] = dp2[i | (1 << j)]));         else           ++sz;       }       if (dp2[i] - dp1[i] >= m && 2 * sz + cs >= ans)         ans = 2 * sz + cs, l = dp1[i], r = dp2[i] - 1;     }     printf( %d n , ans);     printf( %d %d n , l, r);   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   ostream &operator<<(ostream &os, const vector<T> &p) {     os <<  [ ;     for (auto &it : p) os << it <<    ;     return os <<  ] ;   }   template <class S, class T>   ostream &operator<<(ostream &os, const pair<S, T> &p) {     return os <<  (  << p.first <<  ,  << p.second <<  ) ;   }   template <class T>   inline T Bit(T x, long long i) {     return (x >> i) & 1;   }   template <class T>   bool umin(T &a, T b) {     return a > b ? (a = b, true) : false;   }   template <class T>   bool umax(T &a, T b) {     return a < b ? (a = b, true) : false;   }   void solve(long long tc) {     long long n;     cin >> n;     vector<long long> a(n);     for (long long i = 0; i < n; i++) cin >> a[i];     long long sum = accumulate(a.begin(), a.end(), 0LL);     multiset<long long> ms;     for (long long i = 0; i < n; i++) ms.insert(a[i]);     long long q;     cin >> q;     while (q--) {       long long x, y;       cin >> x >> y;       auto it = ms.lower_bound(x);       long long ans = 2e18;       if (it != ms.end()) {         long long z = *it;         if (sum - z >= y) {           ans = 0;         } else {           umin(ans, y - (sum - z));         }       }       it = ms.upper_bound(x);       if (it != ms.begin()) {         it--;         long long cur = x - *it;         if (sum - *it <= y) cur += (y - sum + *it);         umin(ans, cur);       }       cout << ans <<   n ;     }   }   signed main() {     ios_base ::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t = 1;     for (long long i = 1; i <= t; i++) solve(i);     return 0;   }
//#pragma GCC optimize( Ofast )   //#pragma GCC target( avx,avx2,fma )      #include <bits/stdc++.h>   using namespace std;   void __print(int x) {cerr << x;}   void __print(long x) {cerr << x;}   void __print(long long x) {cerr << x;}   void __print(unsigned x) {cerr << x;}   void __print(unsigned long x) {cerr << x;}   void __print(unsigned long long x) {cerr << x;}   void __print(float x) {cerr << x;}   void __print(double x) {cerr << x;}   void __print(long double x) {cerr << x;}   void __print(char x) {cerr <<      << x <<     ;}   void __print(const char *x) {cerr <<     << x <<    ;}   void __print(const string &x) {cerr <<     << x <<    ;}   void __print(bool x) {cerr << (x ?  true  :  false );}   template<typename T, typename V>   void __print(const pair<T, V> &x) {cerr <<  { ; __print(x.first); cerr <<  , ; __print(x.second); cerr <<  } ;}   template<typename T>   void __print(const T &x) {int f = 0; cerr <<  { ; for (auto &i: x) cerr << (f++ ?  ,  :   ), __print(i); cerr <<  } ;}   void _print() {cerr <<  ] n ;}   template <typename T, typename... V>   void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr <<  ,  ; _print(v...);}   void debug3(int *t,int st,int n) {cerr <<  {  << t[st];for(int i=st+1;i<=n;i++) cerr<< , ,__print(t[i]);cerr << } <<  n ;}   #ifndef ONLINE_JUDGE   #define debug(x...) cerr <<  [  << #x <<  ] = [ ; _print(x)   #define debug2(x...) cerr<< [  << #x <<  ] =  ; debug3(x)   #endif      #define N 200005   #define ll long long   #define ull unsigned long long   #define pii pair<int,int>   #define sf second.first   #define ss second.second   #define INF 1e9      int v[N];      int main()   {       ios::sync_with_stdio(false);       cin.tie(0);       cout.tie(0);       //freopen( test.in ,  r , stdin);       int t,n,m,i,j,x;       double pr,pb,sol;          cin >> t ;       while ( t-- )       {           pr = 1 ;           sol = 0 ;           cin >> n >> m ;           for ( i = 1; i <= n ; i++ )               cin >> v[i] ;           for ( j=n ; v[j]==j&&j; j-- ) ;           while ( m-- )           {               cin >> x >> pb ;               if ( x < j )                   continue ;               sol = sol + pr*pb ;               pr = pr*(1-pb) ;           }           if ( j == 0 )               sol = 1 ;           cout << sol <<   n ;       }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> a = vector<int>(10, 0);   vector<int> b;   int main() {     srand(time(NULL));     for (int i = 0; i < 6; i++) {       int x;       cin >> x;       a[x]++;     }     bool f = false;     for (int i = 0; i < 10; i++) {       if (a[i] != 0) {         b.push_back(a[i]);       }       if (a[i] >= 4) {         f = true;       }     }     if (b.size() > 3 || f == false) {       cout <<  Alien  << endl;       return 0;     }     sort(b.begin(), b.end());     if (b.size() == 3 || (b[0] == 1 && b[1] == 5)) {       cout <<  Bear  << endl;       return 0;     }     if (b.size() <= 2) {       cout <<  Elephant  << endl;       return 0;     }     return 0;   }
#include <bits/stdc++.h>   std::mt19937 rnd(time(0));   const int N = 200005;   int n, m, a[N], c[N];   int v;   int ans;   int p[N << 1];   void updAns(int x) {     if (v == x) {       return;     }     for (int i = 0; i <= 2 * n; ++i) {       p[i] = -1;     }     int now = n;     p[now] = 0;     for (int i = 1; i <= n; ++i) {       if (a[i] == v) {         ++now;       } else if (a[i] == x) {         --now;       }       if (p[now] == -1) {         p[now] = i;       } else {         ans = std::max(ans, i - p[now]);       }     }   }   int wnext(int i, int t) {     if (t == 0) {       return rnd() % i;     } else if (t < 0) {       return std::min<int>(rnd() % i, wnext(i, t + 1));     } else {       return std::max<int>(rnd() % i, wnext(i, t - 1));     }   }   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(0);     std::cin >> n;     for (int i = 1; i <= n; ++i) {       std::cin >> a[i];       ++c[a[i]];       m = std::max(m, a[i]);     }     std::vector<std::pair<int, int>> val;     v = 0;     for (int i = 1; i <= m; ++i) {       if (!v || c[i] > c[v]) {         v = i;       }       if (c[i]) {         val.push_back({c[i], i});       }     }     std::sort(val.begin(), val.end());     std::reverse(val.begin(), val.end());     const int B = 200;     for (int i = 0; i < B && i < (int)val.size(); ++i) {       updAns(val[i].second);     }     if ((int)val.size() > B) {       for (int i = 0; i < B; ++i) {         int x = wnext(val.size() - B, 0) + B;         updAns(val[x].second);       }     }     std::cout << ans <<   n ;   }
#include <bits/stdc++.h>   int main(void) {     int x1, y1, x2, y2, temp;     int n;     int x[1001], y[1001], r[1001];     int i, j;     int people, blanket = 0;     scanf( %d%d%d%d%d , &x1, &y1, &x2, &y2, &n);     for (i = 0; i < n; i++) {       scanf( %d%d%d , &x[i], &y[i], &r[i]);       r[i] = r[i] * r[i];     }     if (x1 > x2) {       temp = x1;       x1 = x2;       x2 = temp;     }     if (y1 > y2) {       temp = y1;       y1 = y2;       y2 = temp;     }     for (i = x1; i < x2; i++) {       for (j = 0; j < n; j++) {         if (r[j] >= (i - x[j]) * (i - x[j]) + (y1 - y[j]) * (y1 - y[j])) break;         if (j == n - 1) {           blanket++;         }       }     }     for (i = x1 + 1; i <= x2; i++) {       for (j = 0; j < n; j++) {         if (r[j] >= (i - x[j]) * (i - x[j]) + (y2 - y[j]) * (y2 - y[j])) break;         if (j == n - 1) {           blanket++;         }       }     }     for (i = y1 + 1; i <= y2; i++) {       for (j = 0; j < n; j++) {         if (r[j] >= (i - y[j]) * (i - y[j]) + (x1 - x[j]) * (x1 - x[j])) break;         if (j == n - 1) {           blanket++;         }       }     }     for (i = y1; i < y2; i++) {       for (j = 0; j < n; j++) {         if (r[j] >= (i - y[j]) * (i - y[j]) + (x2 - x[j]) * (x2 - x[j])) break;         if (j == n - 1) {           blanket++;         }       }     }     printf( %d , blanket);   }
#include <bits/stdc++.h>   using namespace std;   pair<int, int> a[300005];   int n, x, y;   void resi(int x, int y, bool naopako) {     int z = 0, j = -1, k = -1, c = 0;     for (int i = 1; i <= n; i++) {       z = a[i].first;       c++;       if (j == -1 && z * c >= x) {         j = i;         z = c = 0;       }       if (j != -1 && k == -1 && z * c >= y) {         k = i;         break;       }     }     if (k != -1) {       cout <<  Yes n ;       if (!naopako) {         cout << j <<     << k - j <<   n ;         for (int i = 1; i <= j; i++) {           cout << a[i].second <<    ;         }         cout <<   n ;         for (int i = j + 1; i <= k; i++) {           cout << a[i].second <<    ;         }         cout <<   n ;       } else {         cerr <<  naopako! n ;         cout << k - j <<     << j <<   n ;         for (int i = j + 1; i <= k; i++) {           cout << a[i].second <<    ;         }         cout <<   n ;         for (int i = 1; i <= j; i++) {           cout << a[i].second <<    ;         }         cout <<   n ;       }       exit(0);     }   }   void solve() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     cin >> n >> x >> y;     for (int i = 1; i <= n; i++) {       cin >> a[i].first;       a[i].second = i;     }     sort(a + 1, a + n + 1);     reverse(a + 1, a + n + 1);     resi(x, y, false);     resi(y, x, true);     cout <<  No n ;   }   int main() { solve(); }