malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long inf = 1e18 + 1e17;   const long long mod = 1e9 + 7;   long long modInverse(long long a, long long m) {     long long m0 = m;     long long y = 0, x = 1;     if (m == 1) return 0;     while (a > 1) {       long long q = a / m;       long long t = m;       m = a % m, a = t;       t = y;       y = x - q * y;       x = t;     }     if (x < 0) x += m0;     return x;   }   long long powm(long long a, long long b) {     a = a % mod;     long long res = 1;     while (b) {       if (b & 1) res = (res * a) % mod;       a = (a * a) % mod;       b >>= 1;     }     return (res % mod);   }   const long long N = 5e3 + 6;   int n, k, water;   vector<int> v;   int dp[N][2], dpr[N][2];   int arr[N];   bool brr[N];   int ip = 1e9;   void makedp() {     dp[0][0] = 1;     dp[0][1] = -1;     for (int i = 0; i < n; i++) {       int x = arr[i] % k;       memset(dpr, -1, sizeof(dpr));       dpr[0][0] = 1;       for (int j = 1; j < k; j++) {         if (dp[j][0] == 0 && dp[(j - x + k) % k][0] == 1) {           dpr[j][0] = 1;           dpr[j][1] = i;         } else {           dpr[j][0] = dp[j][0];           dpr[j][1] = dp[j][1];         }       }       swap(dpr, dp);     }   }   bool check() {     int tt = 0;     for (int i = 0; i < n; i++) tt += arr[i];     if (tt < water || dp[water % k][0] == 0) {       cout <<  NO n ;       return true;       ;     }     return false;   }   void find() {     int val = water % k;     int x = dp[val][1];     while (x != -1) {       v.push_back(dp[val][1]);       val = (val - arr[x] % k + k) % k;       x = dp[val][1];     }   }   void seperate() {     memset(brr, 0, sizeof(brr));     int tt = 0;     for (int i : v) {       brr[i] = 1;       tt += arr[i];     }     for (int i = 1; i < v.size(); i++)       cout << ip <<     << v[i] + 1 <<     << v[0] + 1 <<   n ;     int mark = -1;     int tc = 0;     for (int i = 0; i < n; i++)       if (!brr[i]) {         mark = i;         tc += arr[i];       }     for (int i = 0; i < n; i++)       if (!brr[i] && mark != i)         cout << ip <<     << i + 1 <<     << mark + 1 <<   n ;     if (v.size() == 0) v.push_back(0);     if (tt > water)       cout << (tt - water) / k <<     << v[0] + 1 <<     << (0 == v[0] ? 2 : 1)            <<   n ;     else if (tt < water)       cout << (water - tt) / k <<     << mark + 1 <<     << v[0] + 1 <<   n ;   }   void solve() {     cin >> n >> k >> water;     for (int i = 0; i < n; i++) cin >> arr[i];     makedp();     if (check()) return;     cout <<  YES n ;     find();     seperate();   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t = 1;     for (long long i = 1; i <= t; i++) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   int freq[27];   char sent[101];   int main() {     int n;     scanf( %d , &n);     scanf( %s , sent);     while (n--) {       if (isupper(sent[n])) sent[n] = tolower(sent[n]);       freq[sent[n] -  a ]++;     }     for (int i = 0; i < 26; i++)       if (!freq[i]) {         printf( NO n );         return 0;       }     printf( YES n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   const int INF = 1e9 + 5;   int read(int base = 10) {     int x = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) x = x * base + ch -  0 , ch = getchar();     return x;   }   struct Node {     int num[12][2];   } tree[N << 2];   void push_up(int o, int l, int r) {     int tmp[4];     for (int ii = 1; ii <= 11; ii++) {       tmp[0] = tree[o << 1].num[ii][0];       tmp[1] = tree[o << 1].num[ii][1];       tmp[2] = tree[o << 1 | 1].num[ii][0];       tmp[3] = tree[o << 1 | 1].num[ii][1];       sort(tmp, tmp + 4);       tree[o].num[ii][0] = tmp[0];       tree[o].num[ii][1] = tmp[1];     }   }   void build(int o, int l, int r) {     if (l == r) {       int x = read();       int tmp = x;       for (int ii = 1; ii <= 11; tmp /= 10, ii++) {         if (tmp % 10 == 0) {           tree[o].num[ii][0] = tree[o].num[ii][1] = INF;           continue;         }         tree[o].num[ii][0] = x;         tree[o].num[ii][1] = INF;       }       return;     }     int mid = (l + r) >> 1;     build(o << 1, l, mid);     build(o << 1 | 1, mid + 1, r);     push_up(o, l, r);   }   int id, x;   void update(int o, int l, int r) {     if (l == r) {       int tmp = x;       for (int ii = 1; ii <= 11; ii++, tmp /= 10) {         if (tmp % 10) {           tree[o].num[ii][0] = x;           tree[o].num[ii][1] = INF;         } else {           tree[o].num[ii][0] = tree[o].num[ii][1] = INF;         }       }       return;     }     int mid = (l + r) >> 1;     if (id <= mid)       update(o << 1, l, mid);     else       update(o << 1 | 1, mid + 1, r);     push_up(o, l, r);   }   int L, R, ans[12][2];   int tmp[4];   void query_up(int o, int i) {     tmp[0] = ans[i][0];     tmp[1] = ans[i][1];     tmp[2] = tree[o].num[i][0];     tmp[3] = tree[o].num[i][1];     sort(tmp, tmp + 4);     ans[i][0] = tmp[0];     ans[i][1] = tmp[1];   }   void query(int o, int l, int r) {     if (L <= l && r <= R) {       for (int ii = 1; ii <= 11; ii++) {         query_up(o, ii);       }       return;     }     int mid = (l + r) >> 1;     if (L <= mid) query(o << 1, l, mid);     if (R > mid) query(o << 1 | 1, mid + 1, r);   }   int main() {     int n = read(), m = read();     build(1, 1, n);     while (m--) {       int op = read();       if (op == 1) {         id = read(), x = read();         update(1, 1, n);       } else {         L = read(), R = read();         for (int i = 1; i <= 11; i++) ans[i][0] = ans[i][1] = INF;         query(1, 1, n);         int all = INF * 2;         ;         for (int i = 1; i <= 11; i++) {           if (ans[i][0] == INF || ans[i][1] == INF) continue;           all = min(all, ans[i][0] + ans[i][1]);         }         if (all == INF * 2) {           cout <<  -1 n ;         } else {           cout << all <<   n ;         }       }     }   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<  :   << arg1 << endl;   }   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...);   }   const int INF = 1 << 30;   const int MOD = 1e9 + 7;   const int N = 1e6;   int a[N];   double sqr(double x) { return x * x; }   int main() {     int cas;     scanf( %d , &cas);     double ret = 0;     for (int num = 0; num < cas; ++num) {       int n = 250;       double ave = 0;       for (int i = 0; i < n; ++i) {         scanf( %d , &a[i]);         ave += a[i];       }       ave /= n;       double V = 0;       for (int i = 0; i < n; ++i) {         V += sqr(ave - a[i]);       }       V /= n;       double ratio = ave / V;       ret = max(ret, abs(ratio - 1));       puts(abs(ratio - 1) < 0.5 ?  poisson  :  uniform );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     string s;     cin >> s;     int ans = 0;     for (int i = 1; i < n; i++)       if (s[i - 1] ==  .  && s[i] ==  . ) ans++;     while (m--) {       int k;       char c;       cin >> k >> c;       if (c != s[k - 1]) {         if (c ==  . ) {           if (k > 1 && s[k - 2] ==  . ) ans++;           if (k < n && s[k] ==  . ) ans++;         }         if (s[k - 1] ==  . ) {           if (k > 1 && s[k - 2] ==  . ) ans--;           if (k < n && s[k] ==  . ) ans--;         }         s[k - 1] = c;       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int me;     int bebia;     int iliko = 0;     int ilarioni = 0;     cin >> me;     for (int i = 0; i < me; i++) {       cin >> bebia;       if (bebia > 0) iliko += bebia;       if (bebia == -1) {         if (iliko - 1 < 0) {           ilarioni++;         } else           iliko--;       }     }     cout << ilarioni;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, t;     int n;     int a[105];     cin >> n;     for (i = 0; i < n; i++) cin >> a[i];     sort(a, a + n);     int b[105] = {0};     int cnt = 1;     for (i = 0; i < n; i++) {       for (j = 0; j <= cnt; j++) {         if (!b[j]) {           b[j]++;           break;         } else if (b[j] <= a[i]) {           b[j]++;           break;         }       }       if (j == cnt) cnt++;     }     cout << cnt << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int rx[4] = {0, 0, 1, -1};   int ry[4] = {-1, 1, 0, 0};   int main() {     int n, k, a, b, u, v;     cin >> n >> k;     cin >> a >> b >> u >> v;     if (k < n + 1 || n == 4) {       cout << -1 << endl;       return 0;     }     int ind1, ind2;     vector<int> p(n + 1);     p[1] = a;     int ct = 2, i = 1;     while (ct <= n - 1) {       if (i == a || i == b) {         i++;         continue;       }       p[ct] = i;       ct++;       i++;     }     p[n] = b;     for (int i = 1; i < n - 2; i++) {       if ((p[i] == u && p[i + 1] == v) || (p[i] == v && p[i + 1] == u)) {         swap(p[i + 1], p[i + 2]);       }     }     if ((p[n - 2] == u && p[n - 1] == v) || (p[n - 2] == v && p[n - 1] == u)) {       swap(p[n - 3], p[n - 2]);     }     for (int i = 1; i <= n; i++) {       if (p[i] == u) {         ind1 = i;       }       if (p[i] == v) {         ind2 = i;       }     }     for (int i = 1; i <= n; i++) {       cout << p[i] <<    ;     }     cout << endl;     if (u < v) {       int s = ind1;       while (s >= 1) {         cout << p[s] <<    ;         s--;       }       s = ind1 + 1;       while (s < ind2) {         cout << p[s] <<    ;         s++;       }       s = n;       while (s >= ind2) {         cout << p[s] <<    ;         s--;       }     } else {       int s = ind1;       while (s <= n) {         cout << p[s] <<    ;         s++;       }       s = ind1 - 1;       while (s > ind2) {         cout << p[s] <<    ;         s--;       }       s = 1;       while (s <= ind2) {         cout << p[s] <<    ;         s++;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     int i;     cin >> s;     for (i = 0; i < s.size(); i++) {       if (s[i] ==  r ) cout << i + 1 <<   n ;     }     for (i = s.size() - 1; i >= 0; i--) {       if (s[i] ==  l ) cout << i + 1 <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long a, b, c, d;     cin >> a >> b >> c >> d;     long long sum = a + b + c + d;     if (sum % 2 == 0) {       if (a + b == sum / 2 || a + c == sum / 2 || a + d == sum / 2 ||           b + c == sum / 2 || b + d == sum / 2 || c + d == sum / 2 ||           a == sum / 2 || b == sum / 2 || c == sum / 2 || d == sum / 2)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     } else       cout <<  NO  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, r, n, x;     cin >> x;     r = x % 4;     if (r == 0) {       cout <<  1             <<   A ;     }     if (r == 1) {       cout <<  0             <<   A ;     }     if (r == 2) {       cout <<  1             <<   B ;     }     if (r == 3) {       cout <<  2             <<   A ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   inline bool SR(int &x) { return scanf( %d , &x) == 1; }   inline bool SR(long long &x) { return scanf( %lld , &x) == 1; }   inline bool SR(double &x) { return scanf( %lf , &x); }   inline bool SR(char *s) { return scanf( %s , s); }   inline bool RI() { return 1; }   template <typename I, typename... T>   bool RI(I &x, T &...tail) {     return SR(x) && RI(tail...);   }   inline void SP(const int x) { printf( %d , x); }   inline void SP(const long long x) { printf( %lld , x); }   inline void SP(const double x) { printf( %.10f , x); }   inline void SP(const char *s) { printf( %s , s); }   inline void PL() { puts(  ); }   template <typename I, typename... T>   void PL(const I x, const T... tail) {     SP(x);     if (sizeof...(tail)) putchar(   );     PL(tail...);   }   template <typename I>   inline void _DOING(const char *s, I &&x) {     cerr << s <<   =   << x <<   n ;   }   template <typename I, typename... T>   void _DOING(const char *s, I &&x, T &&...tail) {     int c = 0;     while (*s !=  ,  || c != 0) {       if (*s ==  (  || *s ==  [  || *s ==  { ) c++;       if (*s ==  )  || *s ==  ]  || *s ==  } ) c--;       cerr << *s++;     }     cerr <<   =   << x <<   ,  ;     _DOING(s + 1, tail...);   }   const int INF = 0x3f3f3f3f;   const long long INF64 = 0x3f3f3f3f3f3f3f3fll;   inline int RAND() {     static int x = 880301;     return x = (x * 0xdefacedll + 1ll) % 0x7fffffffll;   }   int n;   map<pair<int, int>, int> rd;   inline bool check(long long a, int b) {     long long x = 1;     while (b) {       if (a >= n) return 0;       if (b & 1) x = x * a;       if (x >= n) return 0;       a = a * a;       b >>= 1;     }     return 1;   }   int dfs(int a, int b) {     if (rd.count(make_pair(a, b))) return rd[make_pair(a, b)];     if (!check(a, b)) return rd[make_pair(a, b)] = 1;     if (a == 1) {       if (!check(a + 1, b))         return rd[make_pair(a, b)] = 0;       else if (dfs(a + 1, b) == -1 || dfs(a, b + 1) == -1)         return rd[make_pair(a, b)] = 1;       else if (dfs(a + 1, b) == 0 || dfs(a, b + 1) == 0)         return rd[make_pair(a, b)] = 0;       else         return rd[make_pair(a, b)] = -1;     } else if (b == 1) {       if (1ll * a * a >= n) {         if ((n - a) & 1)           return rd[make_pair(a, b)] = -1;         else           return rd[make_pair(a, b)] = 1;       } else if (dfs(a + 1, b) == -1 || dfs(a, b + 1) == -1)         return rd[make_pair(a, b)] = 1;       else if (dfs(a + 1, b) == 0 || dfs(a, b + 1) == 0)         return rd[make_pair(a, b)] = 0;       else         return rd[make_pair(a, b)] = -1;     } else {       if (dfs(a + 1, b) == -1 || dfs(a, b + 1) == -1)         return rd[make_pair(a, b)] = 1;       else         return rd[make_pair(a, b)] = -1;     }   }   int main() {     int a, b;     RI(a, b, n);     int res = dfs(a, b);     if (res == 1)       PL( Masha );     else if (res == -1)       PL( Stas );     else       PL( Missing );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxN = 50000 + 10;   int n;   int B[maxN];   vector<pair<int, int>> VB;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &B[i]);     for (int i = 0; i < n; i++) {       VB.push_back(make_pair(B[i] + B[(i + 1) % n], i));     }     sort(VB.begin(), VB.end());     for (int i = 0; i < n; i++) {       auto p = VB[i];       B[p.second] = i;     }     for (int i = 0; i < n; i++) printf( %d%c , B[i], (i == n - 1) ?   n  :    );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int arr[5001], k = 0;     string s, in;     stack<int> s1;     while (getline(cin, s)) {       in = in + s;     }     for (int i = 0; i < in.size(); i++) {       char st[5001] = {  0 };       if (in[i] ==  < ) {         i++;         int j = 0;         while (in[i] !=  > ) {           st[j++] = in[i];           i++;         }       }       string st1 =  table , st2 =  tr , st3 =  td , st4 =  /table , st5 =  /tr ,              st6 =  /td ;       if (st1.compare(st) == 0) arr[k++] = 1;       if (st2.compare(st) == 0) arr[k++] = 2;       if (st3.compare(st) == 0) arr[k++] = 3;       if (st4.compare(st) == 0) arr[k++] = 4;       if (st5.compare(st) == 0) arr[k++] = 5;       if (st6.compare(st) == 0) arr[k++] = 6;     }     int z = -1, max = z;     vector<int> v, v1;     for (int i = 0; i < k; i++) {       if (arr[i] == 1) {         s1.push(arr[i]);         v.push_back(0);       }       if (arr[i] == 2) s1.push(arr[i]);       if (arr[i] == 3) s1.push(arr[i]);       if (arr[i] == 4) {         s1.pop();         v1.push_back(v.back());         v.pop_back();       }       if (arr[i] == 5) s1.pop();       if (arr[i] == 6) {         s1.pop();         v.back()++;       }     }     sort(v1.begin(), v1.end());     for (int i = 0; i < v1.size(); i++) cout << v1[i] <<    ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   int main() {     int a, b, c;     int a1, b1, c1;     int s = 0;     scanf( %d%d%d%d%d%d , &a, &b, &c, &a1, &b1, &c1);     if (a > a1) {       s = s + ((a - a1) / 2);     } else       s = s - (a1 - a);     if (b > b1) {       s = s + ((b - b1) / 2);     } else       s = s - (b1 - b);     if (c > c1) {       s = s + ((c - c1) / 2);     } else       s = s - (c1 - c);     if (s >= 0) {       printf( YES );     } else       printf( NO );   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char *argv[]) {     int n, tmp = 1, res = 1;     cin >> n;     int A[n][2];     for (int i = 0; i < n; i++) cin >> A[i][0] >> A[i][1];     for (int i = 0; i < n - 1; i++) {       if ((A[i][0] == A[i + 1][0]) && (A[i][1] == A[i + 1][1])) {         tmp++;         if (res < tmp) res = tmp;       } else         tmp = 1;     }     cout << res << endl;     return EXIT_SUCCESS;   }
#include <bits/stdc++.h>   using namespace std;   unsigned long long int expo_fast(long long int a, long long int b) {     a = a;     long long int result = 1;     while (b) {       if (b & 1) result = (result * a);       b >>= 1;       a = (a * a);     }     return (result);   }   void take_in(vector<long long int> *arr) {     for (int i = 0; i < arr->size(); i++) cin >> (*(arr))[i];   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   unsigned long long int power(long long int x, unsigned long long int y,                                long long int p) {     long long int res = 1;     x = x % p;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int n, x1, x2, done = 0;     cin >> n >> x1 >> x2;     vector<pair<long long int, long long int> > arr;     vector<long long int> dp(n + 1);     for (int i = 0; i < n; i++) {       long long int x;       cin >> x;       arr.push_back({x, i});     }     sort(arr.begin(), arr.end());     dp[n] = arr[n - 1].first;     for (int i = n - 1; i > 0; i--) {       dp[i] = max(dp[i + 1], arr[i - 1].first * (n - i + 1));     }     auto bs = [n](long long int x, long long int tar) -> long long int {       int low = 1, high = n, ans = n + 1;       while (low <= high) {         int mid = (low + high) / 2;         if (x * mid >= tar) {           ans = mid;           high = mid - 1;         } else           low = mid + 1;       }       return ans;     };     for (int i = 1; i <= n; i++) {       vector<int> indx;       long long int len = bs(arr[i - 1].first, x1);       if (i + len - 1 < n && dp[i + len] >= x2) {         done = 1;         cout <<  Yes n ;         for (int j = n; j >= 1; j--) {           if (dp[j] >= x2) {             indx.push_back(j);             indx.push_back(n);             break;           }         }         cout << len <<     << indx[1] - indx[0] + 1 <<   n ;         for (int k = i; k < i + len; k++) cout << arr[k - 1].second + 1 <<    ;         cout <<   n ;         for (int k = indx[0]; k <= n; k++) cout << arr[k - 1].second + 1 <<    ;         break;       }       if (!done) {         len = bs(arr[i - 1].first, x2);         if (i + len - 1 < n && dp[i + len] >= x1) {           done = 1;           cout <<  Yes n ;           for (int j = n; j >= 1; j--) {             if (dp[j] >= x1) {               indx.push_back(j);               indx.push_back(n);               break;             }           }           cout << indx[1] - indx[0] + 1 <<     << len <<   n ;           for (int k = indx[0]; k <= n; k++) cout << arr[k - 1].second + 1 <<    ;           cout <<   n ;           for (int k = i; k < i + len; k++) cout << arr[k - 1].second + 1 <<    ;           break;         }       }     }     if (!done) cout <<  No ;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k, l[100100], c[100100];   vector<int> g[100100];   vector<int> s;   void dfs(int t) {     s.push_back(t);     l[t] = s.size();     for (auto v : g[t]) {       if (!l[v])         dfs(v);       else {         if (l[t] - l[v] + 1 >= k) {           printf( 2 n%d n , l[t] - l[v] + 1);           for (int i = l[v] - 1; i < l[t]; i++) printf( %d  , s[i]);           exit(0);         }       }     }     if (!c[t])       for (auto v : g[t]) c[v] = 1;     s.pop_back();   }   int main() {     int i, a, b;     scanf( %d %d , &n, &m);     for (i = 0; i < m; i++) {       scanf( %d %d , &a, &b);       g[a].push_back(b);       g[b].push_back(a);     }     while (k * k < n) k++;     dfs(1);     printf( 1 n );     for (i = 1; k; i++) {       if (!c[i]) {         printf( %d  , i);         k--;       }     }   }
#include <bits/stdc++.h>   using namespace std;   vector<int> v[200008];   int val[200008];   int n, tk;   int dp[200008];   int lim;   int siz[200008];   int cnt, tot;   int no[200008];   void dfs(int x, int p) {     no[x] = val[x] < lim;     dp[x] = 0;     int b1 = 0, b2 = 0, b3 = 0;     siz[x] = 1;     for (int i = 0; i < v[x].size(); i++) {       int y = v[x][i];       if (y == p) continue;       dfs(y, x);       siz[x] += siz[y], no[x] += no[y];       if (no[y] == 0)         b3 += siz[y];       else {         if (dp[y] > b1)           b2 = b1, b1 = dp[y];         else           b2 = max(b2, dp[y]);       }     }     if (val[x] < lim) return;     dp[x] = b1 + b3 + 1;     if (tot == no[x])       cnt = max(cnt, 1 + n - siz[x] + b1 + b2 + b3);     else       cnt = max(cnt, 1 + b1 + b2 + b3);   }   int check(int mid) {     lim = mid;     cnt = 0;     tot = 0;     for (int i = 1; i <= n; i++)       if (val[i] < lim) tot++;     dfs(1, 0);     return cnt >= tk;   }   int main() {     scanf( %d%d , &n, &tk);     for (int i = 1; i <= n; i++) scanf( %d , &val[i]);     for (int i = 1; i < n; i++) {       int x, y;       scanf( %d%d , &x, &y);       v[x].push_back(y);       v[y].push_back(x);     }     int l = 0, r = 1000000;     int ans = -1;     while (l <= r) {       int mid = (l + r) / 2;       if (check(mid))         ans = mid, l = mid + 1;       else         r = mid - 1;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int mini(long long int p, long long int q) {     if (p < q) return p;     return q;   }   int main() {     long long int k2, k3, k5, k6, total = 0;     cin >> k2 >> k3 >> k5 >> k6;     int m = 0;     m = mini(k2, k5);     m = mini(m, k6);     total = m * 256;     m = mini(k2 - m, k3);     total += m * 32;     cout << total << endl;   }