malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   #pragma optimize( -O3 )   string to_string(string s) { return     + s +    ; }   string to_string(const char* s) { return to_string((string)s); }   string to_string(const bool& b) { return (b ?  true  :  false ); }   template <typename A, typename B>   string to_string(pair<A, B> p) {     return  (  + to_string(p.first) +  ,   + to_string(p.second) +  ) ;   }   template <typename A>   string to_string(const A& v) {     bool first = true;     string res =  { ;     for (const auto& x : v) {       if (!first) res +=  ,  ;       first = false;       res += to_string(x);     }     res +=  } ;     return res;   }   void debug_out() { cerr << endl; }   template <typename Head, typename... Tail>   void debug_out(Head H, Tail... T) {     cerr <<     << to_string(H);     debug_out(T...);   }   template <typename T>   inline void _read(T& x) {     cin >> x;   }   template <typename A, typename B>   inline void _read(pair<A, B>& x) {     _read(x.first);     _read(x.second);   }   template <typename T>   inline void _read(vector<T>& x) {     for (auto& v : x) _read(v);   }   void R() {}   template <typename T, typename... U>   void R(T& head, U&... tail) {     _read(head);     R(tail...);   }   template <typename T>   inline void _write(const T& x) {     cout << x <<    ;   }   template <typename A, typename B>   inline void _write(const pair<A, B>& x) {     _write(x.first);     _write(x.second);   }   template <typename T>   inline void _write(const vector<T>& in) {     for (const auto& x : in) _write(x);   }   void W() { cout <<   n ; }   template <typename T, typename... U>   void W(const T& head, const U&... tail) {     _write(head);     W(tail...);   }   void go();   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     go();     return 0;   }   const int M = 1 << 4;   const int N = 1 << 17;   const int K = 4;   const int mod = 1e9 + 7;   int dp[N][M][1 << K];   void go() {     int n, k, m;     R(n, k, m);     dp[0][0][0] = 1;     for (int i = 0; i < n; i++)       for (int j = 0; j <= k; j++)         for (int s = 0; s < (1 << m); s++) {           int t = (s << 1) % (1 << m);           (dp[i + 1][j][t] += dp[i][j][s]) %= mod;           if (j < k) {             int w = __builtin_popcount(s) + 1;             (dp[i + 1][j + 1][t | 1] += 1LL * w * dp[i][j][s] % mod) %= mod;           }         }     long long ans = 0;     for (int s = 0; s < (1 << m); s++) (ans += dp[n][k][s]) %= mod;     W(ans);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 300005, INF = 9999999;   const long long P = 1e9 + 7;   template <typename T>   inline void read(T& first, char s = getchar()) {     first = 0;     while (s >  9  || s <  0 ) s = getchar();     while (s <=  9  && s >=  0 ) first = first * 10 + s -  0 , s = getchar();   }   int k, a, b;   int main() {     read(k), read(a), read(b);     if (a < k && b < k) {       cout << -1 << endl;       return 0;     }     if (a < k || b < k) {       if (a < b) swap(a, b);       if (a % k != 0) {         cout << -1 << endl;         return 0;       } else {         cout << (a / k) << endl;         return 0;       }     }     int ans = a / k + b / k;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s, t;     cin >> t >> s;     set<char> b(t.begin(), t.end());     int n;     cin >> n;     for (int k = 0; k < n; ++k) {       cin >> t;       int i = 0;       int j = 0;       while (i < s.size() || j < t.size()) {         if (s[i] ==  ? ) {           if (b.find(t[j]) != b.end()) {             ++i;             ++j;           } else {             break;           }         } else if (s[i] ==  * ) {           int x = t.size() - s.size() + 1;           if (x < 0) {             break;           } else if (all_of(t.begin() + i, t.begin() + i + x,                             [&](char c) { return b.find(c) == b.end(); })) {             ++i;             j += x;           } else {             break;           }         } else {           if (s[i] == t[j]) {             ++i;             ++j;           } else {             break;           }         }       }       if (i == s.size() && j == t.size())         cout <<  YES n ;       else         cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mo = 998244353, N = 2e5 + 5, M = 59, S = 32771;   inline int poww(int x, int y) {     int ans = 1;     for (; y; y >>= 1, x = 1ll * x * x % mo)       if (y & 1) ans = 1ll * ans * x % mo;     return ans;   }   int n, m, i, j, k, mi[N], C[M][M], ct[M];   long long a[M], x, val[2][S];   vector<long long> ve;   bool bb[M];   inline void solve1(vector<long long> ve) {     int p1 = 0, p2 = min(15, (int)ve.size()), p3 = ve.size();     for (i = 0; i < 1 << p2 - p1; ++i)       for (j = 0; j < p2 - p1; ++j)         if (i >> j & 1) val[0][i] ^= ve[j];     for (i = 0; i < 1 << p3 - p2; ++i)       for (j = 0; j < p3 - p2; ++j)         if (i >> j & 1) val[1][i] ^= ve[j + p2];     int s1 = (1 << p2) - 1, s2 = ((1 << p3) - 1) ^ s1;     for (i = 0; i < 1 << p3; ++i)       ++ct[__builtin_popcountll(val[0][i & s1] ^ val[1][(i & s2) >> p2])];   }   int id[M], xb;   inline void solve2() {     for (i = 0; i < m; ++i)       if (!bb[i]) id[xb++] = i;     vector<long long> v2;     for (i = 0; i < xb; ++i) {       long long x = 1 << i;       for (j = 0; j < ve.size(); ++j)         if (ve[j] >> id[i] & 1) x |= 1ll << j + xb;       v2.push_back(x);     }     solve1(v2);     static int cc[M], dd[M];     for (i = 0; i <= m; ++i) dd[i] = ((long long)ct[i] << ve.size()) % mo;     for (i = 0; i <= m; ++i)       for (j = 0; j <= m; ++j)         for (k = 0; k <= i; ++k)           if (k <= j && i - k <= m - j)             cc[i] = (cc[i] + 1ll * C[j][k] * C[m - j][i - k] % mo *                                  (k & 1 ? mo - dd[j] : dd[j])) %                     mo;     for (i = 0; i <= m; ++i)       cc[i] = 1ll * cc[i] * poww((1ll << m) % mo, mo - 2) % mo;     memcpy(ct, cc, sizeof cc);   }   int main() {     for (i = ** C = 1; i < M; ++i)       for (j = *C[i] = 1; j <= i; ++j)         C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mo;     for (i = *mi = 1; i < N; ++i) mi[i] = 2 * mi[i - 1] % mo;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; ++i) {       scanf( %lld , &x);       for (j = m - 1; j >= 0; --j)         if (x >> j & 1) {           if (!a[j]) {             a[j] = x;             break;           }           x ^= a[j];         }     }     for (i = 0; i < m; ++i)       if (a[i])         for (j = i + 1; j < m; ++j)           if (a[j] >> i & 1) a[j] ^= a[i];     for (i = 0; i < m; ++i)       if (a[i]) ve.push_back(a[i]), bb[i] = 1;     if (ve.size() <= 26)       solve1(ve);     else       solve2();     for (i = 0; i <= m; ++i) ct[i] = 1ll * ct[i] * mi[n - ve.size()] % mo;     for (i = 0; i <= m; ++i) printf( %d%c , ct[i], i == m ?   n  :    );   }
#include <bits/stdc++.h>   using namespace std;   const int Inf = (int)1e9 + 7;   const long long LongInf = (long long)1e18 + 7;   namespace {   const int N = 1007;   const int MOD = (int)1e9 + 7;   int k, pa, pb;   long long dp[N][N];   long long pw(long long x, int m) {     if (m == 0) return 1;     long long y = pw(x, m / 2);     y = (y * y) % MOD;     if (m % 2) y = (y * x) % MOD;     return y;   }   long long inv(int x) { return pw(x, MOD - 2); }   void solve() {     cin >> k >> pa >> pb;     long long s = inv(pa + pb);     pa = (pa * s) % MOD;     pb = (pb * s) % MOD;     long long res = 0;     dp[1][0] = 1;     long long rem = (pa * inv(pb)) % MOD;     for (int i = 1; i <= k; i++) {       for (int j = 0; j <= k; j++) {         if (i + j >= k) {           res += (dp[i][j] * (i + j + rem)) % MOD;           res %= MOD;         } else {           (dp[i + 1][j] += (dp[i][j] * pa) % MOD) %= MOD;           (dp[i][i + j] += (dp[i][j] * pb) % MOD) %= MOD;         }       }     }     cout << res <<   n ;   }   }  // namespace   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout.precision(9);     cout << fixed;     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MaxN = 1e4 + 10;   int n, b, q;   pair<int, int> h[MaxN];   unordered_map<int, int> e[MaxN];   vector<int> c[MaxN];   int flow, parent[MaxN], mini, curr;   void dfs(int x) {     if (parent[q + 6] != -1) return;     for (int i = 0; i < c[x].size(); i++) {       if (e[x][c[x][i]] > 0 && parent[c[x][i]] == -1) {         parent[c[x][i]] = x;         dfs(c[x][i]);       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin >> n >> b >> q;     for (int i = 0; i < q; i++) cin >> h[i].first >> h[i].second;     for (int i = 1; i <= 5; i++) {       c[0].push_back(i);       c[i].push_back(0);       e[0][i] = n / 5;       e[i][0] = 0;     }     sort(h, h + q);     h[q].first = b;     h[q].second = n;     q++;     for (int i = q - 1; i >= 0; i--) {       e[i + 6][q + 6] = h[i].second;       e[q + 6][i + 6] = 0;       c[i + 6].push_back(q + 6);       c[q + 6].push_back(i + 6);       if (i < q - 1) {         e[i + 7][q + 6] -= h[i].second;         if (e[i + 7][q + 6] < 0) {           cout <<  unfair ;           return 0;         }       }       for (int j = 0; j < 5; j++) {         e[j + 1][i + 6] = h[i].first / 5;         if (j > 0 && h[i].first % 5 >= j) e[j + 1][i + 6]++;         e[i + 6][j + 1] = 0;         c[j + 1].push_back(i + 6);         c[i + 6].push_back(j + 1);         if (i < q - 1) e[j + 1][i + 7] -= e[j + 1][i + 6];       }     }     while (true) {       for (int i = 0; i < MaxN; i++) parent[i] = -1;       parent[0] = 0;       dfs(0);       if (parent[q + 6] == -1) break;       curr = q + 6;       mini = 1e6;       while (curr != 0) {         mini = min(mini, e[parent[curr]][curr]);         curr = parent[curr];       }       flow += mini;       curr = q + 6;       while (curr != 0) {         e[parent[curr]][curr] -= mini;         e[curr][parent[curr]] += mini;         curr = parent[curr];       }     }     if (flow == n)       cout <<  fair ;     else       cout <<  unfair ;     return 0;   }
#include <bits/stdc++.h>   int main() {     const int maxN = 3002;     bool tests[maxN] = {0};     int n(0);     scanf( %d , &n);     for (int k = 0; k < n; k++) {       int temp;       scanf( %d , &temp);       tests[temp] = 1;     }     for (int index = 1; index < maxN; index++) {       if (!tests[index]) {         printf( %d n , index);         break;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, sum = 0;     cin >> n;     bool isLR = false;     char a[n];     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] ==  L  || a[i] ==  R ) isLR = true;     }     bool flag = false;     int count = 0;     for (int i = 0; i < n; i++) {       if (a[i] ==  .  && flag == true)         count++;       else if (a[i] ==  L )         flag = true;       else if (a[i] ==  R ) {         sum += count;         count = 0;         flag = false;       }     }     flag = false;     count = 0;     for (int i = 0; i < n; i++) {       if (a[i] ==  .  && flag == true)         count++;       else if (a[i] ==  R )         flag = true;       else if (a[i] ==  L ) {         if (count % 2 != 0) sum++;         count = 0;         flag = false;       }     }     count = 0;     for (int i = 0; i < n; i++) {       if (a[i] ==  . )         count++;       else if (a[i] ==  L )         break;       else if (a[i] ==  R ) {         sum += count;         break;       }     }     count = 0;     for (int i = n - 1; i >= 0; i--) {       if (a[i] ==  . )         count++;       else if (a[i] ==  R )         break;       else if (a[i] ==  L ) {         sum += count;         break;       }     }     if (isLR == true)       cout << sum;     else       cout << n;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 5e5 + 5, inf = 1e16;   long long a[N], p[N], b[N], seg[N << 2], m;   void shift(long long id) {     if (seg[id] == 0) return;     seg[id << 1] += seg[id], seg[id << 1 | 1] += seg[id];     seg[id] = 0;   }   void add(long long l, long long r, long long val, long long L = 0,            long long R = m + 1, long long id = 1) {     if (r <= L || R <= l) return;     if (l <= L && R <= r) {       seg[id] += val;       return;     }     shift(id);     long long mid = (L + R) >> 1;     add(l, r, val, L, mid, id << 1);     add(l, r, val, mid, R, id << 1 | 1);     return;   }   long long get(long long l, long long L = 0, long long R = m + 1,                 long long id = 1) {     if (R - L == 1) return seg[id];     shift(id);     long long mid = (L + R) >> 1;     if (l < mid)       return get(l, L, mid, id << 1);     else       return get(l, mid, R, id << 1 | 1);   }   int32_t main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);     long long n;     cin >> n;     for (long long i = 0; i < n; i++) cin >> a[i];     for (long long i = 0; i < n; i++) cin >> p[i];     cin >> m;     for (long long i = 1; i <= m; i++) cin >> b[i];     add(1, m + 1, inf);     for (long long i = 0; i < n; i++) {       long long x = lower_bound(b, b + m + 1, a[i]) - b, val = inf * 10;       if (a[i] == b[x]) val = get(x - 1);       if (p[i] < 0)         add(0, m + 1, p[i]);       else         add(0, x, p[i]);       if (val < get(x)) add(x, x + 1, val - get(x));     }     if (get(m) > 1e15) return cout <<  NO n , 0;     cout <<  YES n  << get(m) <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   struct point {     int x, y;     point(int x = 0, int y = 0) : x(x), y(y) {}   };   point p[305];   int n;   point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }   int cp(point a, point b) { return a.x * b.y - a.y * b.x; }   double work() {     int i, j, k, f1, f2;     double s1, s2, ans = 0;     for (i = 1; i <= n; ++i)       for (j = i + 1; j <= n; ++j) {         s1 = s2 = 0;         f1 = f2 = 0;         for (k = 1; k <= n; ++k)           if (k != i && k != j) {             if (cp(p[i] - p[j], p[k] - p[j]) < 0) {               s1 = max(s1, -(double)cp(p[i] - p[j], p[k] - p[j]) / 2);               f1 = 1;             } else {               s2 = max(s2, (double)cp(p[i] - p[j], p[k] - p[j]) / 2);               f2 = 1;             }           }         if (f1 && f2) ans = max(ans, s1 + s2);       }     return ans;   }   int main() {     int i;     scanf( %d , &n);     for (i = 1; i <= n; ++i) scanf( %d%d , &p[i].x, &p[i].y);     printf( %.10lf n , work());     return 0;   }
#include <bits/stdc++.h>   #define debug(x) cout << #x <<   =   << x << endl   #define REP(i, n) for (Long i = 0; i < (Long)n; i++)   using namespace std;      typedef long long Long;      const int MX = 3e5;   vector<Long> adj[MX];   set<pair<Long,Long>> queries[MX];   Long saved[MX];   Long single[MX];   Long cnt[2 * MX + 8];   Long ans = 0;      void merge(Long u, Long v, Long gU, Long gV, Long lowLimit, Long &curGroup, map<pair<Long, Long>, Long> &crossedCnt) {    //u to v    if (queries[saved[u]].size() > queries[saved[v]].size()) {     swap(u, v);     swap(gU, gV);    }     for (auto p : queries[saved[u]]) {     Long x = p.first;     auto it = queries[saved[v]].lower_bound({x, -1});     if (it != queries[saved[v]].end() && it->first == x) {      pair<Long, Long> pairIndex = {p.second, it->second};      queries[saved[v]].erase(it);      if (pairIndex.first < lowLimit) {       pairIndex.first = gU;      }      if (pairIndex.second < lowLimit) {       pairIndex.second = gV;      }           Long a = min(pairIndex.first, pairIndex.second);      Long b = max(pairIndex.first, pairIndex.second);      if (a != lowLimit) {       crossedCnt[{a, b}]++;       cnt[a]--;       cnt[b]--;      } else {       cnt[b]--;      }           } else {      Long gInsert = p.second;      if (gInsert < lowLimit) {       gInsert = gU;      }      queries[saved[v]].insert({x, gInsert});     }    }    curGroup = gV;    saved[u] = saved[v];   }      Long groups = 1;   void dfs(Long u, Long p = -1) {    Long sz = queries[u].size();    Long T = 2 * single[u] + sz;    Long cur = 0;        map<pair<Long, Long>, Long> crossedCnt;        for (Long v : adj[u]) {     if (v != p) {      dfs(v, u);     }    }    Long lowLimit = groups;    groups++;    Long curGroup = lowLimit;;    for (Long v : adj[u]) {     if (v != p) {      sz = queries[saved[v]].size();      T += sz;      cur -= sz * (sz - 1) / 2;      Long g = groups++;      cnt[g] += sz;      Long gU = curGroup;      merge(u, v, gU, g, lowLimit, curGroup, crossedCnt);     }    }    sz = queries[saved[u]].size();    T += sz;    cur -= sz * (sz - 1) / 2;    assert(T % 2 == 0);    T /= 2;        cur += T * (T - 1) / 2;    for (auto crossed : crossedCnt) {     sz = crossed.second;     cur += sz * (sz - 1) / 2;    }    for (Long i = lowLimit + 1; i < groups; i++) {     cur += cnt[i] * (cnt[i] - 1) / 2;    }    ans += cur;   }      int main() {    ios_base::sync_with_stdio(false);    cin.tie(NULL);    cout.tie(NULL);    Long n;    cin >> n;    REP(i , n - 1) {     Long u, v;     cin >> u >> v;     u--;     v--;     adj[u].push_back(v);     adj[v].push_back(u);    }    REP(i , n) {     saved[i] = i;    }    Long m;    cin >> m;        REP(i, m) {     Long u , v;     cin >> u >> v;     u--;     v--;     if (u != v) {      queries[u].insert({i, 0});      queries[v].insert({i, 0});     } else {      single[u]++;     }       }    dfs(0);    assert(groups <= 2 * n);    cout << ans <<   n ;          return 0;   }
#include <bits/stdc++.h>   using namespace std;   int MOD = 1e9 + 7;   long long int power(long long int a, long long int b) {     long long int res = 1;     a = a % MOD;     while (b > 0) {       if (b & 1) {         res = (res * a) % MOD;         b--;       }       a = (a * a) % MOD;       b >>= 1;     }     return res;   }   long long int fermat_inv(long long int y) { return power(y, MOD - 2); }   long long int gcd(long long int a, long long int b) {     return (b == 0) ? a : gcd(b, a % b);   }   long long int min(long long int a, long long int b) { return (a > b) ? b : a; }   long long int max(long long int a, long long int b) { return (a > b) ? a : b; }   bool prime[1000001];   vector<int> primes;   void SieveOfEratosthenes(int n) {     memset(prime, true, sizeof(prime));     for (int p = 2; p * p <= n; p++) {       if (prime[p] == true) {         for (int i = p * p; i <= n; i += p) prime[i] = false;       }     }     for (int p = 2; p < 1000001; p++)       if (prime[p]) primes.push_back(p);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     cin >> t;     while (t--) {       long long int n, a, b;       string s;       cin >> n >> a >> b >> s;       long long int cost = n * a + (n + 1) * b;       vector<int> v;       long long int j = 1;       for (int i = 1; i < n; i++) {         if (s[i] == s[i - 1])           j++;         else {           v.push_back(j);           j = 1;         }       }       if (v.empty()) {         cout << cost <<   n ;         continue;       }       v.erase(v.begin());       cost += 2 * a;       for (int i = 0; i < v.size(); i++) {         if (i % 2 == 0)           cost += (long long int)(v[i] + 1) * b;         else {           if (2 * a <= (long long int)(v[i] - 1) * b)             cost += 2 * a;           else             cost += (long long int)(v[i] - 1) * b;         }       }       cout << cost <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   char str;   int n, m, g;   int num[20480];   struct edge {     int to;     int nxt;     int val;   } nd[8 * 20480];   int head[20480], cnt;   int cur[20480], dep[20480];   queue<int> q;   int ans;   template <class X>   inline void read(X &x) {     x = 0;     X f = 1;     while (!isdigit(str)) {       if (str ==  - ) {         f = -1;       }       str = getchar();     }     while (isdigit(str)) {       x *= 10;       x += str -  0 ;       str = getchar();     }     x *= f;     return;   }   void init() {     memset(head, -1, sizeof(head));     cnt = 0;     return;   }   void add(int x, int y, int z) {     nd[cnt].to = y;     nd[cnt].nxt = head[x];     nd[cnt].val = z;     head[x] = cnt++;     return;   }   bool bfs(int s, int t) {     memset(dep, 0x3f, sizeof(dep));     memcpy(cur, head, sizeof(cur));     while (q.size()) {       q.pop();     }     q.push(s);     dep[s] = 0;     while (q.size()) {       int x = q.front();       q.pop();       for (int i = head[x]; i != -1; i = nd[i].nxt) {         int tt = nd[i].to;         if (dep[tt] == 0x3f3f3f3f && nd[i].val) {           dep[tt] = dep[x] + 1;           q.push(tt);         }       }     }     return dep[t] != 0x3f3f3f3f;   }   int dfs(int x, int t, int lim) {     if (x == t || !lim) {       return lim;     }     int ff = 0, f;     for (int i = cur[x]; i != -1; i = nd[i].nxt) {       cur[x] = i;       int tt = nd[i].to;       if (dep[tt] == dep[x] + 1 && (f = dfs(tt, t, min(lim, nd[i].val)))) {         ff += f;         lim -= f;         nd[i].val -= f;         nd[i ^ 1].val += f;         if (!lim) {           break;         }       }     }     return ff;   }   void dinic(int s, int t) {     while (bfs(s, t)) {       ans -= dfs(s, t, 0x3f3f3f3f);     }     return;   }   int main() {     init();     read(n), read(m), read(g);     for (int i = 1; i <= n; i++) {       read(num[i]);     }     for (int i = 1; i <= n; i++) {       int x;       read(x);       if (num[i]) {         add(i, n + m + 1, x);         add(n + m + 1, i, 0);       } else {         add(0, i, x);         add(i, 0, 0);       }     }     for (int i = 1; i <= m; i++) {       int opt, x, k;       read(opt), read(x), read(k);       ans += x;       for (int j = 1; j <= k; j++) {         int y;         read(y);         if (opt == 0) {           add(n + i, y, 0x3f3f3f3f);           add(y, n + i, 0);         } else {           add(y, n + i, 0x3f3f3f3f);           add(n + i, y, 0);         }       }       int z;       read(z);       if (opt == 0) {         add(0, n + i, z * g + x);         add(n + i, 0, 0);       } else {         add(n + i, n + m + 1, z * g + x);         add(n + m + 1, n + i, 0);       }     }     dinic(0, n + m + 1);     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, m, min_m, max_n, min_n, x;     scanf( %d%d , &n, &m);     scanf( %d , &max_n);     min_n = max_n;     n--;     while (n--) {       scanf( %d , &x);       if (x > max_n) {         max_n = x;       } else if (x < min_n) {         min_n = x;       }     }     scanf( %d , &min_m);     m--;     while (m--) {       scanf( %d , &x);       if (x < min_m) {         min_m = x;       }     }     if (min_m <= max_n) {       printf( -1 );       return 0;     }     int t = max_n;     while (t < min_m) {       if (2 * min_n <= t) {         printf( %d , t);         return 0;       }       t++;     }     printf( -1 );   }
#include <bits/stdc++.h>   using namespace std;   const int N = 25, INF = 1e9 + 5;   inline int read() {     char c = getchar();     int x = 0, f = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = x * 10 + c -  0 ;       c = getchar();     }     return x * f;   }   int n, m, a[N][N];   bool check() {     for (int i = 1; i <= n; i++) {       int cnt = 0;       for (int j = 1; j <= m; j++)         if (a[i][j] != j) cnt++;       if (cnt > 2) return false;     }     return true;   }   int main() {     n = read();     m = read();     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) a[i][j] = read();     if (check()) {       puts( YES );       return 0;     }     for (int i = 1; i <= m; i++)       for (int j = i + 1; j <= m; j++) {         for (int z = 1; z <= n; z++) swap(a[z][i], a[z][j]);         if (check()) {           puts( YES );           return 0;         }         for (int z = 1; z <= n; z++) swap(a[z][i], a[z][j]);       }     puts( NO );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, x;     cin >> n;     int s1 = 0, s2 = 0;     for (int i = 0; i < n; i++) {       cin >> x;       s1 += x;     }     for (int i = 0; i < n; i++) {       cin >> x;       s2 += x;     }     cout << (s2 <= s1 ?  YES  :  NO );     return 0;   }