malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 1000007, M = 5000007;   const long long INF = 1e14;   inline void read(int &first) {     char c = getchar();     while ((c < 48) || (c > 57)) c = getchar();     first = c ^ 48;     c = getchar();     while ((c >= 48) && (c <= 57)) {       first = first * 10 + (c ^ 48);       c = getchar();     }   }   struct node {     int l, r;     int maxx;   } tr[N << 2];   int n, m, t, k;   int first[N], second;   int a[N];   int num[N];   int s[N];   int pre[N];   void build(int p, int l, int r) {     tr[p] = {l, r, 0};     if (l == r) {       tr[p].maxx = s[r];       return;     }     int mid = l + r >> 1;     build(p << 1, l, mid);     build(p << 1 | 1, mid + 1, r);     tr[p].maxx = max(tr[p << 1].maxx, tr[p << 1 | 1].maxx);   }   int query(int p, int l, int r) {     if (tr[p].l >= l && tr[p].r <= r) {       return tr[p].maxx;     }     int mid = tr[p].l + tr[p].r >> 1;     int res = 0;     if (l <= mid) res = max(res, query(p << 1, l, r));     if (r > mid) res = max(res, query(p << 1 | 1, l, r));     return res;   }   int main() {     scanf( %d , &t);     while (t--) {       for (int i = 0; i <= n; ++i) s[i] = pre[i] = num[i] = 0;       scanf( %d%d , &n, &m);       for (int i = 1; i <= n; ++i) scanf( %d , &first[i]), a[i] = first[i];       for (int i = 1; i <= n; ++i) scanf( %d , &second);       sort(a + 1, a + 1 + n);       int tot = unique(a + 1, a + 1 + n) - a - 1;       for (int i = 1; i <= n; ++i)         num[lower_bound(a + 1, a + 1 + tot, first[i]) - a]++;       for (int i = 1; i <= n; ++i) pre[i] = pre[i - 1] + num[i];       for (int i = 1; i <= n; ++i)         s[i] = pre[upper_bound(a + i + 1, a + 1 + tot, a[i] + m) - a - 1] -                pre[i - 1];       build(1, 1, tot);       int ans = 0;       for (int i = 1; i <= tot; ++i) {         ans =             max(ans,                 s[i] + query(1, upper_bound(a + i + 1, a + 1 + tot, a[i] + m) - a,                              tot));       }       printf( %d n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<  :   << arg1 << std::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...);   }   int main() {     int k;     scanf( %d , &k);     int x[10];     memset(x, 0, sizeof(x));     char s[5];     for (auto i = 0; i < 4; i++) {       scanf( %s , s);       for (auto j = 0; j < 4; j++) {         if (s[j] ==  . ) {           continue;         }         x[s[j] -  0 ]++;       }     }     for (auto i = 1; i < 10; i++) {       if (x[i] > 2 * k) {         printf( NO n );         return 0;       }     }     printf( YES n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int ara[200010];   string res;   string str;   void func(int le, int ri, int chk, int past) {     if (res.size() < str.size()) {       res = str;     }     if (le > ri) {       return;     }     if (chk == 0) {       if ((past < ara[le]) && (ara[le] < ara[ri])) {         str +=  L ;         func(le + 1, ri, chk, ara[le]);         str.pop_back();       } else if ((past < ara[ri]) && (ara[ri] < ara[le])) {         str +=  R ;         func(le, ri - 1, chk, ara[ri]);         str.pop_back();       } else if ((past < ara[ri]) && (ara[ri] == ara[le])) {         str +=  L ;         func(le + 1, ri, 1, ara[le]);         str.pop_back();         str +=  R ;         func(le, ri - 1, 2, ara[ri]);         str.pop_back();       } else if (past < ara[le]) {         str +=  L ;         func(le + 1, ri, chk, ara[le]);         str.pop_back();       } else if (past < ara[ri]) {         str +=  R ;         func(le, ri - 1, chk, ara[ri]);         str.pop_back();       }     } else if (chk == 1) {       if (past < ara[le]) {         str +=  L ;         func(le + 1, ri, chk, ara[le]);         str.pop_back();       }     } else {       if (past < ara[ri]) {         str +=  R ;         func(le, ri - 1, chk, ara[ri]);         str.pop_back();       }     }   }   int main() {     cin >> n;     for (int i = 0; i <= n - 1; i++) {       cin >> ara[i];     }     str =   ;     res =   ;     func(0, n - 1, 0, 0);     cout << res.size() <<   n ;     cout << res <<   n ;     return 0;   }
#include <bits/stdc++.h>   const int N = 300300;   using namespace std;   struct edge {     int ul, ur, dl, dr, a, al, ar;     long long xl, xr;   };   edge comb(edge a, edge b, int sa, int sb) {     edge g;     g.a = max(a.a, b.a);     g.al = a.al;     g.xl = a.xl;     g.ul = a.ul;     g.dl = a.dl;     g.ar = b.ar;     g.xr = b.xr;     g.ur = b.ur;     g.dr = b.dr;     if (a.xr == b.xl) {       return g;     } else if (a.xr > b.xl) {       g.a = max(g.a, a.ar + b.dl);       if (sb == b.dl) g.ar = a.ar + b.dl;       if (sa == a.a) g.al = a.a + b.dl;       if (sa == a.dl) g.dl += b.dl;       if (sb == b.ur) g.ur += a.ur;       g.a = max(g.a, max(g.al, g.ar));       return g;     } else {       g.a = max(g.a, a.dr + b.al);       if (sb == b.a) g.ar = a.dr + b.a;       if (sa == a.dr) g.al = a.dr + b.al;       if (sb == b.dr) g.dr += a.dr;       if (sa == a.ul) g.ul += b.ul;       g.a = max(g.a, max(g.al, g.ar));       return g;     }   }   edge t[4 * N];   int n;   int a[N];   long long lz[4 * N];   void push(int x) {     if (lz[x] == 0) return;     t[x * 2].xl += lz[x];     t[x * 2].xr += lz[x];     t[x * 2 + 1].xl += lz[x];     t[x * 2 + 1].xr += lz[x];     lz[x * 2] += lz[x];     lz[x * 2 + 1] += lz[x];     lz[x] = 0;   }   void build(int x, int l, int r) {     if (l == r) {       t[x].xl = t[x].xr = a[l];       t[x].a = t[x].al = t[x].ar = t[x].dl = t[x].dr = t[x].ul = t[x].ur = 1;       return;     }     int m = (l + r) / 2;     build(x * 2, l, m);     build(x * 2 + 1, m + 1, r);     t[x] = comb(t[x * 2], t[x * 2 + 1], m - l + 1, r - m);   }   void upd(int x, int l, int r, int tl, int tr, long long d) {     if (tl > tr) return;     if (l == tl && r == tr) {       lz[x] += d;       t[x].xl += d;       t[x].xr += d;       return;     }     push(x);     int m = (l + r) / 2;     upd(x * 2, l, m, tl, min(m, tr), d);     upd(x * 2 + 1, m + 1, r, max(m + 1, tl), tr, d);     t[x] = comb(t[x * 2], t[x * 2 + 1], m - l + 1, r - m);   }   int main() {     ios_base::sync_with_stdio(0);     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     build(1, 1, n);     int m;     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       int l, r, d;       scanf( %d%d%d , &l, &r, &d);       upd(1, 1, n, l, r, d);       printf( %d n , t[1].a);     }   }
#include <bits/stdc++.h>   using namespace std;   int c[100010];   long long ans;   int main() {     int n, x;     scanf( %d%d , &n, &x);     for (int i = 1; i <= n; i++) scanf( %d , &c[i]);     sort(c + 1, c + n + 1);     if (n < x) {       ans = 0;       for (int i = 1; i <= n; i++) ans += (long long)c[i] * (x - i + 1);       printf( %I64d , ans);       return 0;     }     if (n >= x) {       ans = 0;       for (int i = 1; i <= x; i++) ans += (long long)i * c[x + 1 - i];       for (int i = x + 1; i <= n; i++) ans += c[i];     }     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)   #define INP(arr,n) for(int a=0;a<n;a++)cin>>arr[a]   #define OTP(arr,n) for(int a=0;a<n;a++)cout<<arr[a]<<      #define ll long long int   #define pb(v,a) v.push_back(a)   int main() {   IOS;int t = 0;cin >> t;   while (t--) {       ll n = 0;cin >> n;       ll arr[n];INP(arr,n);       cout <<  0  ;       for (ll a = 1;a < n;a++) {           ll x = 0,y = 1;           bitset <64> bs(arr[a - 1]);           bitset <64> bs2(arr[a]);           for (int b = 0;b < 64;b++,y *= 2)               bs2[b] == 0 && bs[b] == 1 ? x += y,arr[a] += y: x = x;           cout << x <<    ;       }       cout <<   n ;   }   }
#include <bits/stdc++.h>   using namespace std;   string p[3][2] = {{ lios ,  liala }, { etr ,  etra }, { initis ,  inites }}, s;   pair<int, int> kind(string q) {     int l = q.length();     if (l >= 4 && q.substr(l - 4, 4) == p[0][0]) return pair<int, int>(0, 0);     if (l >= 5 && q.substr(l - 5, 5) == p[0][1]) return pair<int, int>(0, 1);     if (l >= 3 && q.substr(l - 3, 3) == p[1][0]) return pair<int, int>(1, 0);     if (l >= 4 && q.substr(l - 4, 4) == p[1][1]) return pair<int, int>(1, 1);     if (l >= 6 && q.substr(l - 6, 6) == p[2][0]) return pair<int, int>(2, 0);     if (l >= 6 && q.substr(l - 6, 6) == p[2][1]) return pair<int, int>(2, 1);     return pair<int, int>(-1, -1);   }   int tran[2][3] = {{0, 1, -1}, {-1, -1, 1}};   int main() {     int g = -1, st = -1, ok = true, tow = false;     cin >> s;     g = kind(s).second;     if (g != -1) st = tran[0][kind(s).first];     while (cin >> s && ok) {       tow = true;       pair<int, int> t = kind(s);       if (t.second != g) ok = false;       if (st == -1) break;       st = tran[st][t.first];     }     if ((tow && ok && st == 1) || (!tow && g != -1))       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, sb, a[4], data1[100001], num[100001];   void merge(int l, int r) {     int mid = (l + r) / 2;     int i = l, j = mid + 1, k = 0;     while (i <= mid && j <= r) {       if (data1[i] < data1[j])         num[k++] = data1[i++];       else         num[k++] = data1[j++];     }     while (i <= mid) num[k++] = data1[i++];     while (j <= r) num[k++] = data1[j++];     for (int p = 0; p < k; p++) data1[p + l] = num[p];   }   void sort(int l, int r) {     if (l >= r) return;     int mid = (l + r) / 2;     sort(l, mid);     sort(mid + 1, r);     merge(l, r);   }   int main() {     cin >> n;     for (int j = 0; j < n; j++) cin >> data1[j];     sort(0, n - 1);     for (int i = 1; i <= 3; i++) {       a[i] = 1;       while (data1[sb] == data1[sb + 1] && sb < n - 1) {         a[i]++;         sb++;       }       sb++;     }     if (data1[0] == data1[1]) {       if (data1[1] == data1[2])         cout << a[1] * (a[1] - 1) * (a[1] - 2) / 6;       else         cout << a[2];     } else {       if (data1[1] == data1[2])         cout << a[2] * (a[2] - 1) / 2;       else         cout << a[3];     }   }
#include <bits/stdc++.h>   using namespace std;   #pragma warning(disable : 4996)   #pragma comment(linker,  /STACK:336777216 )   const int sqrtn = 300;   const int inf = 987654321;   const int sz = 1e5 + 5;   const int mod = 1e9 + 7;   int n, vis[sz];   string str;   int main() {     scanf( %d , &n);     cin >> str;     int ret = 0, x = 0, y = 0, last = 0;     if (str[0] ==  U ) {       y++;       last = 1;     } else       x++, last = 0;     for (int i = 1; i < n; i++) {       if (str[i] ==  U )         y++;       else         x++;       if (vis[i - 1]) {         if (y > x && last == 0) {           ret++, last = 1;         } else if (x > y && last == 1) {           ret++, last = 0;         }       }       if (y == x) vis[i] = 1;     }     printf( %d , ret);   }
#include <bits/stdc++.h>   using namespace std;   int ly1[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   int ly2[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   int ly3[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   int nly[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,                31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};   int main() {     int n;     int i, j;     cin >> n;     int ara[n + 3];     for (i = 0; i < n; i++) cin >> ara[i];     int flg = 0;     int cnt = 0;     for (i = 0, cnt = 0; i < 36; i++, cnt++) {       int pos = i % 36;       for (j = 0; j < n; j++) {         if (ara[j] != ly1[(i + j) % 36]) {           flg = 1;           break;         }         if (j == n - 1) {           cout <<  YES ;           return 0;         }       }     }     for (i = 0, cnt = 0; i < 36; i++, cnt++) {       int pos = i % 36;       for (j = 0; j < n; j++) {         if (ara[j] != ly2[(i + j) % 36]) {           flg = 1;           break;         }         if (j == n - 1) {           cout <<  YES ;           return 0;         }       }     }     for (i = 0, cnt = 0; i < 36; i++, cnt++) {       int pos = i % 36;       for (j = 0; j < n; j++) {         if (ara[j] != ly3[(i + j) % 36]) {           flg = 1;           break;         }         if (j == n - 1) {           cout <<  YES ;           return 0;         }       }     }     for (i = 0, cnt = 0; i < 36; i++, cnt++) {       int pos = i % 36;       for (j = 0; j < n; j++) {         if (ara[j] != nly[(i + j) % 36]) {           flg = 1;           break;         }         if (j == n - 1) {           cout <<  YES ;           return 0;         }       }     }     cout <<  NO ;   }
#include <bits/stdc++.h>   using namespace std;   struct Query {     int p, s, id;     bool operator<(const Query &b) const { return (s < b.s); }   };   int main() {     int n;     scanf( %d , &n);     vector<int> a(n);     for (int i = 0; i < n; ++i) scanf( %d , &a[i]);     int m;     scanf( %d , &m);     vector<Query> q(m);     for (int i = 0; i < m; ++i) {       scanf( %d%d , &q[i].p, &q[i].s);       --q[i].p;       q[i].id = i;     }     sort(q.begin(), q.end());     vector<long long> ans(m, 0);     int lim = sqrt(n);     for (int i = 0; i < q.size(); ++i) {       if (q[i].s > lim) {         for (int j = q[i].p; j < n; j += q[i].s) ans[q[i].id] += a[j];       } else {         int cs = q[i].s;         vector<long long> sums(n, 0);         for (int j = n - 1; j >= 0; --j)           sums[j] = a[j] + ((j + cs < n) ? sums[j + cs] : 0);         int j;         for (j = i; j < q.size() && q[j].s == cs; ++j)           ans[q[j].id] = sums[q[j].p];         i = j - 1;       }     }     for (int i = 0; i < ans.size(); ++i) printf( %I64d n , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-8;   const int mod = 1e9 + 7;   const int N = 4e5 + 10;   const int inf = 1e9;   int n, k, m;   map<pair<int, int>, int> vis;   int mx[N << 2], tag[N << 2];   int a[N];   void pd(int p, int k) {     mx[p << 1] += k;     tag[p << 1] += k;     mx[p << 1 | 1] += k;     tag[p << 1 | 1] += k;     tag[p] = 0;   }   void up(int dl, int dr, int l, int r, int p, int k) {     if (l == dl && r == dr) {       mx[p] += k;       tag[p] += k;       return;     }     int mid = l + r >> 1;     pd(p, tag[p]);     if (dr <= mid)       up(dl, dr, l, mid, p << 1, k);     else if (dl > mid)       up(dl, dr, mid + 1, r, p << 1 | 1, k);     else       up(dl, mid, l, mid, p << 1, k), up(mid + 1, dr, mid + 1, r, p << 1 | 1, k);     mx[p] = max(mx[p << 1], mx[p << 1 | 1]);   }   int main() {     ios::sync_with_stdio(false);     cin >> n >> k >> m;     for (int i = 1; i <= m; i++) {       int x, y;       cin >> x >> y;       int p = abs(x - k) + y;       if (vis[make_pair(x, y)]) {         up(1, p, 1, 2 * n, 1, -1);         a[p]--;         if (a[p] == 0) up(p, p, 1, 2 * n, 1, -p + 1);         vis[make_pair(x, y)] = 0;       } else {         up(1, p, 1, 2 * n, 1, 1);         if (a[p] == 0) up(p, p, 1, 2 * n, 1, p - 1);         ++a[p];         vis[make_pair(x, y)] = 1;       }       cout << max(0, mx[1] - n) <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = (int)1e9;   const long long linf = (long long)1e18;   const double eps = (double)1e-8;   const int mod = (int)1e9 + 7;   const int maxn = (int)1e5 + 5;   const int MX = (int)1e5;   const int PRIME = 31;   string s, t;   int n, m, first;   long long hs[maxn], ht[maxn], st[maxn];   int d[maxn][33];   int subs(int l, int r) {     return 1ll * (hs[r] - hs[l - 1] + mod) % mod * st[max(n, m) - r] % mod;   }   int subt(int l, int r) {     return 1ll * (ht[r] - ht[l - 1] + mod) % mod * st[max(n, m) - r] % mod;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n;     cin >> s;     s =  _  + s;     cin >> m;     cin >> t;     t =  _  + t;     cin >> first;     st[0] = 1;     for (int i = (1); i <= (int)(MX); ++i) {       st[i] = 1ll * st[i - 1] * PRIME % mod;     }     hs[0] = 0;     for (int i = (1); i <= (int)(n); ++i) {       hs[i] = (hs[i - 1] + st[i - 1] * (s[i] -  a  + 1)) % mod;     }     ht[0] = 0;     for (int i = (1); i <= (int)(m); ++i) {       ht[i] = (ht[i - 1] + st[i - 1] * (t[i] -  a  + 1)) % mod;     }     memset((d), 0, sizeof(d));     for (int i = (0); i <= (int)(n - 1); ++i) {       for (int j = (0); j <= (int)(first); ++j) {         d[i + 1][j] = max(d[i + 1][j], d[i][j]);         if (j == first) continue;         int l = 0;         int r = min(n - i, m - d[i][j]);         while (l < r) {           int mid = (l + r + 1) / 2;           if (subs(i + 1, i + mid) == subt(d[i][j] + 1, d[i][j] + mid))             l = mid;           else             r = mid - 1;         }         d[i + l][j + 1] = max(d[i + l][j + 1], d[i][j] + l);       }     }     for (int i = (1); i <= (int)(first); ++i) {       if (d[n][i] == m) {         cout <<  YES               <<   n ;         return 0;       }     }     cout <<  NO           <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int a[123456], b[123456];   vector<long long int> v1, v2, v3;   map<long long int, long long int> mp;   map<string, long long int> mps;   map<char, long long int> mpc;   int main() {     long long int f = 0, x = 0, l = 0, r = 0, n, i;     cin >> n;     for (i = 0; i < n; i++) {       cin >> a[i];       b[i] = a[i];     }     sort(b, b + i);     for (i = 0; i < n; i++) {       if (a[i] != b[i]) {         l = i + 1;         break;       }     }     for (i = n - 1; i >= 0; i--) {       if (a[i] != b[i]) {         r = i + 1;         break;       }     }     if (l == 0 && r == 0) {       l = 1;       r = 1;       cout <<  yes  << endl;       cout << l <<     << r << endl;       return 0;     }     long long int k = r - 1;     for (i = l - 1; i <= r - 1; i++) {       long long int aa = i;       long long int bb = k;       if (mp[bb] == 0 && mp[aa] == 0) {         swap(a[i], a[k]);         mp[aa] = 1;         mp[bb] = 1;         k--;       }     }     for (i = 0; i < n; i++) {       if (a[i] != b[i]) {         cout <<  no  << endl;         return 0;       }     }     cout <<  yes  << endl;     cout << l <<     << r << endl;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     map<string, vector<int> > mda;     int n, k;     cin >> n >> k;     for (int i = 0; i < n; i++) {       string s;       cin >> s;       int cost;       cin >> cost;       mda[s].push_back(cost);     }     for (auto &c : mda) {       sort(c.second.rbegin(), c.second.rend());     }     long long ans = 0;     long long odd = 0;     for (auto &c : mda) {       string t = c.first;       reverse(t.begin(), t.end());       if (t < c.first) {         long long best = 0;         long long s = 0;         for (int i = 0; i < (int)c.second.size() && i < mda[t].size(); i++) {           s += c.second[i];           s += mda[t][i];           best = max(best, s);         }         ans += best;       } else if (t == c.first) {         long long s = 0;         int mda = 0;         long long last = 0;         long long fir = -1e18;         for (int i = 0; i < (int)c.second.size(); i++) {           if (c.second[i] > 0) {             last = c.second[i];             s += c.second[i];             mda++;           } else {             fir = c.second[i];             break;           }         }         if (mda % 2 == 0) {           ans += s;         } else {           long long me = max(s - last, s + fir);           long long delta_odd = s - me;           ans += me;           odd = max(odd, delta_odd);         }       }     }     cout << ans + odd << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long tc, n, arr1[100005], m, arr2[100005], count = 0, even = 0,                                                     even2 = 0, odd = 0, odd2 = 0;     cin >> tc;     while (tc--) {       cin >> n;       for (int i = 0; i < n; i++) {         cin >> arr1[i];         if (arr1[i] % 2 == 0)           even++;         else           odd++;       }       cin >> m;       for (int i = 0; i < m; i++) {         cin >> arr2[i];         if (arr2[i] % 2 == 0)           even2++;         else           odd2++;       }       count += even * even2;       count += odd * odd2;       cout << count << endl;       count = 0;       even = 0;       even2 = 0;       odd = 0;       odd2 = 0;     }   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   bool adj[4005][4005];   int edges[4005];   int main() {     int n, m, res = INF;     cin >> n >> m;     while (m--) {       int a, b;       cin >> a >> b;       adj[a][b] = adj[b][a] = 1;       edges[a]++;       edges[b]++;     }     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++) {         if (adj[i][j] == 1) {           for (int k = j + 1; k <= n; k++)             if (adj[j][k] == 1 && adj[k][i] == 1)               res = min(res, edges[i] + edges[j] + edges[k] - 6);         }       }     if (res == INF)       puts( -1 );     else       cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long maxn = -1e18;   long long minn = 1e18;   long long mod = 1000000007;   long long ans = 0;   long long cur = 0;   long long tong = 0, tong2 = 0;   long long cnt = 0;   long long k, l;   string s;   long long n, m, x, y;   long long b[100005];   long long was[200005];   bool flag = true;   vector<long long> node[200005];   long long dp[105][105];   long long a[55];   long long c[55];   map<string, int> ok;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> a[2] >> a[3] >> a[5] >> a[6];     cout << min(a[2], min(a[5], a[6])) * 256 +                 min(a[2] - min(a[2], min(a[5], a[6])), a[3]) * 32;   }