malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n, k, mod = 1000000007;   char t[2042];   long long dp[2042][2042], suff[2042][2042];   int solve() {     dp[n][0] = 1;     for (int cInd = n - 1; cInd >= 0; cInd--) {       dp[cInd][0] = 1;       for (int kLeft = 0; kLeft <= k; kLeft++) {         bool f = 0;         for (int d = 0; cInd + d + 1 <= n; d++) {           if (kLeft - (n - (cInd + d)) * (d + 1) >= 0) {             dp[cInd][kLeft] +=                 (1LL * dp[cInd + d + 1][kLeft - (n - (cInd + d)) * (d + 1)] *                  ( z  - t[d + cInd])) %                 mod;           } else {             f = 1;             break;           }         }         if (f) {           for (int d = n - cInd - 1; 1; d--) {             if (kLeft - (n - (cInd + d)) * (d + 1) >= 0) {               dp[cInd][kLeft] +=                   (1LL * dp[cInd + d + 1][kLeft - (n - (cInd + d)) * (d + 1)] *                    ( z  - t[d + cInd])) %                   mod;             } else {               f = 1;               break;             }           }         }         dp[cInd][kLeft] +=             (suff[cInd + 1][kLeft] + dp[cInd + 1][kLeft] * (t[cInd] -  a )) % mod;         dp[cInd][kLeft] %= mod;         suff[cInd][kLeft] += (1LL * dp[cInd + 1][kLeft] * (t[cInd] -  a ) +                               suff[cInd + 1][kLeft]) %                              mod;       }     }     return dp[0][k];   }   int main() {     cin >> n >> k;     cin >> t;     cout << solve() <<   n ;     return 0;   }
#include <bits/stdc++.h>      using namespace std;   const int c=200002, sok=2e9;   long long t[c], kom[c], h[c], ki[c], n, m, maxi;   priority_queue<pair<long long, int> > q;   vector<pair<long long, int> > ans;   int holvan(int a) {       if (!ki[a]) {           return a;       }       return ki[a]=holvan(ki[a]);   }   void unio(int a, int b) {       a=holvan(a), b=holvan(b);       ki[b]=a;       h[a]+=h[b];   }   void pb(int l, int r) {       long long sum=kom[r]-kom[l-1], d=(r-l+1), atl=(sum-1)/d;       q.push({atl, l});   }   int main()   {       ios_base::sync_with_stdio(false);       cin >> n >> m;       for (int i=1; i<=n; i++) {           cin >> t[i];           kom[i]=kom[i-1]+t[i], h[i]=1;           if (i<n) {               pb(i, i);           }       }       ans.push_back({sok, 0});       n--;       while (q.size()>0) {           long long ert=q.top().first, id=q.top().second;           q.pop();           if (!ki[id]) {               maxi=max(maxi, h[id]+h[id+h[id]]-1);               ans.push_back({ert, maxi});               int kov=id+h[id];               if (kov!=n+1) {                   unio(id, kov);                   pb(id, id+h[id]-1);               }           }       }       reverse(ans.begin(), ans.end());       int si=ans.size();       for (int i=si-2; i>=0; i--) {           ans[i].first=min(ans[i].first, ans[i+1].first);       }       for (int i=1; i<=m; i++) {           int x;           cin >> x;           int lo=-1, hi=ans.size(), mid;           while (hi-lo>1) {               mid=(lo+hi)/2;               if (ans[mid].first>=x) {                   hi=mid;               } else {                   lo=mid;               }           }           cout << ans[hi].second <<    ;       }       cout <<   n ;       return 0;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long x1, out;   unsigned long long Fac(unsigned long long x1) {     unsigned long long out = 1;     for (int i = 1; i <= x1; i++) out = out * i;     return out;   }   unsigned long long Cnk(unsigned long long a, unsigned long long b,                          unsigned long long c) {     unsigned long long outL = 1;     vector<int> fac;     if (b > c) {       unsigned long long nCount = a - b;       for (int i = 2; i <= c; i++) fac.push_back(i);       while (nCount > 0) {         outL = outL * a;         a--;         nCount--;         for (int i = 0; i < fac.size(); i++) {           if (fac[i] > -1 && outL % fac[i] == 0) {             outL = outL / fac[i];             fac[i] = -1;           }         }       }     } else {       unsigned long long nCount = a - c;       for (int i = 2; i <= b; i++) fac.push_back(i);       while (nCount > 0) {         outL = outL * a;         a--;         nCount--;         for (int i = 0; i < fac.size(); i++) {           if (fac[i] > -1 && outL % fac[i] == 0) {             outL = outL / fac[i];             fac[i] = -1;           }         }       }     }     for (int i = 0; i < fac.size(); i++) {       if (fac[i] > -1) outL = outL / fac[i];     }     return outL;   }   int main() {     int n, m, t;     cin >> n >> m >> t;     for (int i = 4; i <= n; i++) {       for (int y = 1; y <= m; y++) {         if (i + y != t) continue;         out += (Cnk(n, i, n - i) * Cnk(m, y, m - y));       }     }     cout << out;     cin >> x1;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:64000000 )   using namespace std;   const int inf = (int)1e9;   const int mod = inf + 7;   const double eps = 1e-9;   const double pi = acos(-1.0);   int n;   string second;   int a[100];   vector<int> g[202];   int dp[77][77][77][4];   int calc(vector<int> &a, int n, vector<int> &b, int m, vector<int> &c, int k) {     n = a.size() - n;     m = (int)b.size() - m;     k = (int)c.size() - k;     int x = a[n];     int cnt = 0;     for (int i = m; i < b.size(); i++)       if (b[i] < x) cnt++;     for (int i = k; i < c.size(); i++)       if (c[i] < x) cnt++;     return cnt;   }   int get(int a, int b, int c, int ty) {     if (a + b + c == 0) return 0;     int &res = dp[a][b][c][ty];     if (res != -1) return res;     res = inf;     if (a > 0) {       if (ty != 1)         res = min(res, get(a - 1, b, c, 0) + calc(g[0], a, g[1], b, g[2], c));     }     if (b > 0) {       res = min(res, get(a, b - 1, c, 1) + calc(g[1], b, g[0], a, g[2], c));     }     if (c > 0) {       res = min(res, get(a, b, c - 1, 2) + calc(g[2], c, g[1], b, g[0], a));     }     return res;   }   int main() {     cin >> n >> second;     for (int i = 0; i < n; i++) {       if (second[i] ==  V )         a[i] = 1;       else if (second[i] ==  K )         a[i] = 0;       else         a[i] = 2;       g[a[i]].push_back(i);     }     memset(dp, -1, sizeof dp);     cout << get(g[0].size(), g[1].size(), g[2].size(), 3) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     double t, a, b, c, d, k;     cin >> t;     while (t--) {       cin >> a >> b >> c >> d >> k;       double p1, p2;       p1 = ceil(a / c);       p2 = ceil(b / d);       if (p1 + p2 <= k) {         cout << p1 <<     << p2 << endl;       } else {         cout << -1 << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   double ax, ay, bx, by, tx, ty, x, y;   char s[100100];   double len(double x1, double y1, double x2, double y2) {     return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));   }   int main() {     ios_base::sync_with_stdio(false);     cin >> ax >> ay >> bx >> by >> tx >> ty;     cin >> n;     vector<pair<double, int> > v1, v2;     double total = 0;     for (int i = 0; i < n; i++) {       cin >> x >> y;       v1.push_back(make_pair(len(ax, ay, x, y) - len(tx, ty, x, y), i));       v2.push_back(make_pair(len(bx, by, x, y) - len(tx, ty, x, y), i));       total += 2 * len(tx, ty, x, y);     }     sort(v1.begin(), v1.end());     sort(v2.begin(), v2.end());     double res = total;     double case1 = total + v1[0].first;     double case2 = total + v2[0].first;     res = min(case1, case2);     if (v1[0].second != v2[0].second) {       double case3 = total + v1[0].first + v2[0].first;       res = min(res, case3);     } else if (n > 1) {       double case4 = total + v1[0].first + v2[1].first;       res = min(res, case4);       double case5 = total + v1[1].first + v2[0].first;       res = min(res, case5);     }     printf( %.10lf , res);     return 0;   }
#include <bits/stdc++.h>   int main() {     int n;     scanf( %d , &n);     char arr[n][n + 1];     int i, j, k;     int sum = 0;     int count;     for (i = 0; i < n; i++) scanf( %s , arr[i]);     for (i = 0; i < n; i++) {       count = 0;       for (j = 0; j < n; j++) {         if (arr[i][j] ==  C ) count++;       }       sum += ((count * (count - 1)) / 2);     }     for (i = 0; i < n; i++) {       count = 0;       for (j = 0; j < n; j++) {         if (arr[j][i] ==  C ) count++;       }       sum += ((count * (count - 1)) / 2);     }     printf( %d , sum);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define mod1  1000000007   #define mod2  998244353   #define ff   first   #define ss   second   #define int  long long   #define ll   unsigned long long   #define pb   push_back   #define mp   make_pair   #define pii  pair<int,int>   #define inf  9e18   #define N    15000005   #define pi   2*asin(1.0)   #define endl   n        void fast() {       ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);   #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);   #endif   }            int32_t main() {       fast();       int t; cin>>t;       while(t--){           int n,m; cin>>n>>m;           int arr[n];           for(int i=0;i<n;i++){               cin>>arr[i];           }           int cnt=n;           int len=0;           for(int i=n-1;i>=0;i--){               if(arr[i]==cnt){                   cnt--;               }               else{                   len=i+1; break;               }           }           double ans=1.0;           for(int i=0;i<m;i++){               int r; double p;               cin>>r>>p;               if(r>=len){                   ans=(ans*(1.0-p));               }           }           ans=1.0-ans;           if(len==0) ans=1.0;           cout<<fixed<<setprecision(6)<<ans<<endl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ull = unsigned long long;   using ld = long double;   template <typename T>   ostream& operator<<(ostream& os, const vector<T>& v) {     for (const auto& x : v) os << x <<    ;     return os <<   n ;   }   template <typename T>   void operator>>(istream& is, vector<T>& v) {     for (auto& x : v) is >> x;   }   ll power(ll a, ll n) {     if (n == 0) {       return 1;     }     ll sqrt_a = pow(a, n / 2);     if (n % 2 == 1) {       return sqrt_a * sqrt_a * a;     } else {       return sqrt_a * sqrt_a;     }   }   template <typename T>   T sign(T a) {     if (a < 0) return -1;     if (a > 0) return 1;     return 0;   }   template <typename T>   T log_2(T n) {     T i = 1;     T j = 0;     while (i < n) {       i *= 2;       ++j;     }     return j;   }   template <typename T>   T mod(T a, T b) {     T ans = a % b;     return ans < 0 ? ans + b : ans;   }   ll gcd(ll a, ll b) {     while (b) {       a %= b;       swap(a, b);     }     return a;   }   ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }   class Node {    public:     char symbol;     bool passed = false;     vector<ll> neighbores = vector<ll>();   };   template <typename T>   class Compare {    public:     bool operator()(T& a, T& b) {       if (a.first < b.first) {         return true;       } else if (a.first == b.first) {         return a.second < b.second;       } else {         return false;       }     }   };   vector<ll> divs(ll n) {     vector<ll> ans;     while (n != 1) {       for (ll i = 2; i <= n; ++i) {         if (n % i == 0) {           ans.push_back(i);           n /= i;           break;         }       }     }     return ans;   }   void solve() {     ll a, b, c;     cin >> a >> b >> c;     if (a < c) {       cout <<  1  ;     } else {       cout <<  -1  ;     }     if (b * a > c) {       cout << b <<   n ;     } else {       cout <<  -1 n ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     ll t;     cin >> t;     while (t--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   string read(char x[]) {     scanf( %s , x);     return x;   }   const int N = 8;   const int M = 2e5 + 23;   int n, m, x[M], y[M], ans;   map<int, pair<long long, long long>> mp;   void solve() {     scanf( %d %d , &n, &m);     for (int i = 0; i < n; i++) scanf( %d , x + i);     for (int i = 0; i < m; i++) scanf( %d , y + i);     for (int i = 0; i < n; i++) {       for (int j = 0; j < m; j++) {         mp[x[i] + y[j]] = {mp[x[i] + y[j]].first | (1ll << i),                            mp[x[i] + y[j]].second | (1ll << j)};       }     }     for (auto v1 : mp)       for (auto v2 : mp) {         long long m1 = v1.second.first | v2.second.first,                   m2 = v1.second.second | v2.second.second;         ans = max(ans, __builtin_popcountll(m1) + __builtin_popcountll(m2));       }     printf( %d , ans);   }   int main() { solve(); }
#include <bits/stdc++.h>   using namespace std;   bool myfunction(int i, int j) { return (i < j); }   int main() {     long h[2003];     int n, a, b;     scanf( %d%d%d , &n, &a, &b);     for (int i = 0; i < n; i++) {       scanf( %ld , &h[i]);     }     sort(h, h + n, myfunction);     int x = h[b] - h[b - 1];     printf( %d , x);     return 0;   }
#include <bits/stdc++.h>   template <class t>   inline void read(t &s) {     s = 0;     register long long f = 1;     register char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) f = -1;       c = getchar();     }     while (isdigit(c)) s = (s << 3) + (s << 1) + (c ^ 48), c = getchar();     s *= f;     return;   }   template <class t, class... A>   inline void read(t &x, A &...a) {     read(x);     read(a...);   }   template <class t>   inline void write(t x) {     if (x < 0) putchar( - ), x = -x;     long long buf[21], top = 0;     while (x) buf[++top] = x % 10, x /= 10;     if (!top) buf[++top] = 0;     while (top) putchar(buf[top--] ^  0 );     return;   }   inline void setIn(std::string s) {     freopen(s.c_str(),  r , stdin);     return;   }   inline void setOut(std::string s) {     freopen(s.c_str(),  w , stdout);     return;   }   inline void setIO(std::string s =   ) {     setIn(s +  .in );     setOut(s +  .out );     return;   }   template <class t>   inline bool checkmin(t &x, t y) {     if (x > y) {       x = y;       return 1;     }     return 0;   }   template <class t>   inline bool checkmax(t &x, t y) {     if (x < y) {       x = y;       return 1;     }     return 0;   }   inline long long lowbit(long long x) { return x & (-x); }   const long long MaxN = 1e5 + 50;   long long f[MaxN], g[MaxN], b[MaxN], n, m;   struct BIT {     long long a[MaxN];     inline void init() { std::memset(a, 0, sizeof a); }     inline void upd(long long x, long long k) {       ++x;       while (x <= m + 1) checkmax(a[x], k), x += lowbit(x);     }     inline long long ask(long long x) {       ++x;       register long long ans = 0;       while (x) checkmax(ans, a[x]), x ^= lowbit(x);       return ans;     }   } tr;   signed main(void) {     read(n, m);     register long long l, r;     while (n--) read(l, r), ++b[l], --b[r + 1];     for (long long i = 1; i <= m; ++i) b[i] += b[i - 1];     tr.init();     for (long long i = 1; i <= m; ++i)       f[i] = tr.ask(b[i]) + 1, tr.upd(b[i], f[i]);     tr.init();     for (long long i = m; i; --i) g[i] = tr.ask(b[i]) + 1, tr.upd(b[i], g[i]);     register long long ans = 0;     for (long long i = 0; i <= m; ++i) checkmax(ans, f[i] + g[i + 1]);     write(ans), std::puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int b[1002][1002] = {0};   int main() {     int a[8][3] = {{7, 3, 5}, {2, 6, 4}, {1, 5, 7}, {0, 4, 6},                    {3, 7, 1}, {0, 2, 6}, {1, 3, 5}, {0, 2, 4}};     int x[8];     int y[8];     int d[8];     int n;     int m;     int tmpx, tmpy;     int sum = 0;     cin >> n >> m;     if (n == 2) {       cout <<  0 n ;       return 0;     }     for (int i = 0; i < m; ++i) {       cin >> tmpx >> tmpy;       b[tmpx][1] = 1;       b[tmpx][n] = 1;       b[1][tmpy] = 1;       b[n][tmpy] = 1;     }     for (int i = 2; i <= n / 2; ++i) {       x[0] = i;       x[1] = n + 1 - i;       x[2] = n;       x[3] = n;       x[4] = n + 1 - i;       x[5] = i;       x[6] = 1;       x[7] = 1;       y[0] = 1;       y[1] = 1;       y[2] = i;       y[3] = n + 1 - i;       y[4] = n;       y[5] = n;       y[6] = n + 1 - i;       y[7] = i;       bool g = false;       int count;       int mx = 0;       for (int j = 0; j < 256; ++j) {         count = 0;         for (int k = 0; k < 8; ++k) {           d[k] = ((j >> k) & 1);           count += d[k];         }         g = false;         for (int k = 0; k < 8 && (!g); ++k) {           if (d[k] == 1) {             if (b[x[k]][y[k]] == 1) {               g = true;               break;             }             for (int u = 0; u < 3; ++u) {               if (d[a[k][u]] == 1) {                 g = true;                 break;               }             }           }         }         if (g) continue;         if (count > mx) mx = count;       }       sum += mx;     }     if (n % 2 == 1) {       if (b[n / 2 + 1][1] == 0 || b[n / 2 + 1][n] == 0 || b[1][n / 2 + 1] == 0 ||           b[n][n / 2 + 1] == 0) {         ++sum;       }     }     cout << sum <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 100004;   unordered_map<string, int> mp;   unordered_set<int> st[M];   vector<int> g[M];   string s[M];   int m = 0;   int getid(string &t) {     if (mp.count(t))       return mp[t];     else {       s[++m] = t;       return mp[t] = m;     }   }   int val[M];   struct P {     int v, s0, s1;   } sv[M];   P dfs(int u, int p) {     if (g[u].empty())       return P{p, 0, 0};     else if (sv[u].v != -1)       return sv[u];     P win = P{-1, -1, -1}, lose = P{-1, -1, -1};     for (int v : g[u]) {       P nw = dfs(v, p ^ 1);       int s0 = nw.s0, s1 = nw.s1;       if (p == 0) {         s0 += val[v];         if (nw.v == 1 && (s0 > win.s0 || s0 == win.s0 && s1 < win.s1))           win = P{1, s0, s1};         if (nw.v == 0 && (s0 > lose.s0 || s0 == lose.s0 && s1 < lose.s1))           lose = P{0, s0, s1};       } else {         s1 += val[v];         if (nw.v == 0 && (s1 > win.s1 || s1 == win.s1 && s0 < win.s0))           win = P{0, s0, s1};         if (nw.v == 1 && (s1 > lose.s1 || s1 == lose.s1 && s0 < lose.s0))           lose = P{1, s0, s1};       }     }     if (win.v != -1)       return sv[u] = win;     else       return sv[u] = lose;   }   int main() {     int n;     memset(sv, -1, sizeof(sv));     cin >> n;     string t;     for (int i = 0; i < n; i++) {       cin >> t;       for (int j = 0; j < t.size(); j++) {         string u =   ;         for (int k = j; k < t.size(); k++) {           u += t[k];           int x = getid(u);           st[x].insert(i);         }       }     }     for (int i = 0; i <= m; i++) {       for (char ch =  a ; ch <=  z ; ch++) {         string t = s[i] + ch;         if (mp.count(t)) {           int x = mp[t];           g[i].push_back(x);         }         t = string(  ) + ch + s[i];         if (mp.count(t)) {           int x = mp[t];           g[i].push_back(x);         }       }       int sum = 0, mx = 0;       for (char ch : s[i]) {         int x = ch -  a  + 1;         mx = max(mx, x);         sum += x;       }       val[i] = sum * mx + st[i].size();     }     P p = dfs(0, 0);     puts(p.v ?  First  :  Second );     printf( %d %d n , p.s0, p.s1);   }
#include <bits/stdc++.h>   using namespace std;   void File() {     freopen( CF1045H.in ,  r , stdin);     freopen( CF1045H.out ,  w , stdout);   }   template <typename T>   void read(T &_) {     _ = 0;     T f = 1;     char c = getchar();     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) _ = (_ << 1) + (_ << 3) + (c ^  0 );     _ *= f;   }   const int maxn = 5e5 + 10;   const int mod = 1e9 + 7;   const int N = 1e5;   long long fac[maxn], ifac[maxn];   int c[5];   long long qpow(long long x, long long y) {     long long ret = 1;     x %= mod;     while (y) {       if (y & 1) ret = ret * x % mod;       x = x * x % mod;       y >>= 1;     }     return ret;   }   void math_init() {     fac[0] = 1;     for (int i = 1, i_end_ = N; i <= i_end_; ++i) fac[i] = fac[i - 1] * i % mod;     ifac[N] = qpow(fac[N], mod - 2);     for (int i = N - 1, i_end_ = 0; i >= i_end_; --i)       ifac[i] = ifac[i + 1] * (i + 1) % mod;   }   long long C(int x, int y) {     if (x < 0 || y < 0 || x < y) return 0;     return fac[x] * ifac[y] % mod * ifac[x - y] % mod;   }   long long calc(int x, int y) {     if (!x && !y) return 1;     return C(x + y - 1, y - 1);   }   long long solve(char *s, bool type) {     long long ret = 0;     int len = strlen(s + 1), lim = 0, res[5];     for (int i = 0, i_end_ = 3; i <= i_end_; ++i) lim += c[i], res[i] = c[i];     ++lim;     if (len < lim) return 0;     if (len > lim) {       type = 1;       len = lim;       for (int i = 1, i_end_ = len; i <= i_end_; ++i) s[i] =  1 ;     }     for (int i = 1, i_end_ = len; i <= i_end_; ++i) {       if (i > 2) --res[(s[i - 2] ^  0 ) << 1 | (s[i - 1] ^  0 )];       if (s[i] ==  0  || i == 1) continue;       if (i > 1) --res[(s[i - 1] ^  0 ) << 1];       if (res[2] >= res[1] - 1 && res[2] <= res[1]) {         ret = (ret + calc(res[0], res[2] + 1) * calc(res[3], res[1])) % mod;       }       if (i > 1) ++res[(s[i - 1] ^  0 ) << 1];     }     if (type) {       if (len > 1) --res[(s[len - 1] ^  0 ) << 1 | (s[len] ^  0 )];       if (!res[0] && !res[1] && !res[2] && !res[3]) ++ret;     }     return ret;   }   int main() {     char L[maxn], R[maxn];     math_init();     scanf( %s%s , L + 1, R + 1);     for (int i = 0, i_end_ = 3; i <= i_end_; ++i) read(c[i]);     printf( %lld n , ((solve(R, 1) - solve(L, 0)) % mod + mod) % mod);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[1000001];   int l, r;   int jum, jaw;   int main() {     int n, m, k;     cin >> n >> m >> k;     k--;     for (int i = 1; i <= n; i++) {       int dum;       cin >> dum;       a[dum]++;     }     l = 1;     r = m;     for (int i = 1; i <= m; i++) {       if (a[i] + jum > k) {         jaw += jum + a[i] - k;         a[i] = k - jum;         jum = k;       } else {         jum += a[i];       }     }     while (r < 1000000) {       r++;       jum -= a[l];       l++;       if (a[r] + jum > k) {         jaw += jum + a[r] - k;         a[r] = k - jum;         jum = k;       } else {         jum += a[r];       }     }     cout << jaw << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1010;   int a[maxn];   int main() {     int n = 4;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     sort(a, a + n);     int sum, ans;     sum = ans = 0;     ans = a[3];     int l = 0;     n = 2;     while (n >= 0) {       if (ans > sum)         sum += a[n--];       else {         ans += a[n--];       }     }     if (ans == sum)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }