malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int inf = 2000000000;   int H, T, R, m, hi[205], ti[205], n, hj[205], tj[205], h[205][205],       t[3000000][3], w, d[205][205];   void adde(int x, int y, int X, int Y) {     t[w][0] = X;     t[w][1] = Y;     t[w][2] = h[x][y];     h[x][y] = w++;   }   struct node {     int x, y, d;     bool operator<(const node &t) const { return d > t.d; }   } temp;   priority_queue<node> q;   bool dij() {     for (int i = 0; i <= 200; i++)       for (int j = 0; j <= 200; j++) d[i][j] = inf;     d[H][T] = 0;     temp.x = H;     temp.y = T;     temp.d = d[H][T];     q.push(temp);     while (!q.empty()) {       temp = q.top();       q.pop();       int x = temp.x, y = temp.y;       if (temp.d == d[x][y]) {         for (int i = h[x][y]; i != -1; i = t[i][2]) {           int X = t[i][0], Y = t[i][1];           if (d[x][y] + 1 < d[X][Y]) {             d[X][Y] = d[x][y] + 1;             temp.x = X;             temp.y = Y;             temp.d = d[X][Y];             q.push(temp);           }         }       }     }     return d[0][0] != inf;   }   bool spfa() {     int q[21010][2], rq, wq, g[205][205];     bool b[205][205];     for (int i = 0; i <= 200; i++)       for (int j = 0; j <= 200; j++) d[i][j] = 0;     rq = wq = 0;     q[wq][0] = H;     q[wq][1] = T;     wq++;     memset(g, 0, sizeof(g));     g[H][T]++;     memset(b, true, sizeof(b));     b[H][T] = false;     while (wq--) {       int x = q[wq][0], y = q[wq][1];       b[x][y] = true;       for (int i = h[x][y]; i != -1; i = t[i][2]) {         int X = t[i][0], Y = t[i][1];         if (d[x][y] + 1 > d[X][Y]) {           d[X][Y] = d[x][y] + 1;           if (b[X][Y]) {             g[X][Y]++;             if (g[X][Y] > 21000) return true;             b[X][Y] = false;             q[wq][0] = X;             q[wq][1] = Y;             wq++;           }         }       }     }     return false;   }   int main() {     scanf( %d%d%d , &H, &T, &R);     scanf( %d , &m);     for (int i = 1; i <= m; i++) {       scanf( %d%d , &hi[i], &ti[i]);       hi[i] -= i;     }     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d%d , &hj[i], &tj[i]);       tj[i] -= i;     }     memset(h, -1, sizeof(h));     w = 0;     for (int i = 0; i <= R; i++) {       for (int j = 0; i + j <= R; j++) {         for (int k = 1; (k <= m) && (k <= i); k++)           if (i + hi[k] + j + ti[k] > R)             adde(i, j, 200, 200);           else             adde(i, j, i + hi[k], j + ti[k]);         for (int k = 1; (k <= n) && (k <= j); k++)           if (i + hj[k] + j + tj[k] > R)             adde(i, j, 200, 200);           else             adde(i, j, i + hj[k], j + tj[k]);       }     }     if (dij())       printf( Ivan n%d n , d[0][0]);     else if (spfa())       printf( Draw n );     else       printf( Zmey n%d n , d[200][200]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 101000;   int n, z[N], a[N], b[N];   set<pair<int, int> > Set;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &a[i]);     }     for (int i = 0; i < n; i++) {       scanf( %d , &b[i]);     }     vector<int> ans;     for (int i = 0; i < n; i++) {       z[i] = a[i] - b[i];       if (i) z[i] += z[i - 1];       Set.insert(make_pair(z[i], i));     }     int line = 0;     for (int i = 0; i < n; i++) {       if (Set.begin()->first >= line) {         ans.push_back(i + 1);       }       line = z[i];     }     line = 0;     Set.clear();     for (int i = n - 1; i >= 0; i--) {       z[i] = a[i] - b[(i + n - 1) % n];       if (i != n - 1) z[i] += z[i + 1];       Set.insert(make_pair(z[i], i));     }     for (int i = n - 1; i >= 0; i--) {       if (Set.begin()->first >= line) {         ans.push_back(i + 1);       }       line = z[i];     }     sort(ans.begin(), ans.end());     ans.erase(unique(ans.begin(), ans.end()), ans.end());     printf( %d n , (int)ans.size());     for (__typeof((ans).begin()) it = (ans).begin(); it != (ans).end(); it++) {       printf( %d  , *it);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a, r, m;   vector<int> h;   vector<long long> pref;   long long cost(long long goal) {     long long indexl = distance(h.begin(), lower_bound(h.begin(), h.end(), goal));     long long cost_a = 0;     if (indexl > 0) {       cost_a = goal * (indexl)-pref[indexl - 1];     }     long long indexh = distance(h.begin(), upper_bound(h.begin(), h.end(), goal));     long long cost_r =         pref[n - 1] - pref[indexh - 1] - (n - 1 - indexh + 1) * goal;     long long res = 0;     if (cost_a > cost_r) {       res = m * cost_r + (cost_a - cost_r) * a;     } else {       res = m * cost_a + (cost_r - cost_a) * r;     };     ;     ;     return res;   }   void solve() {     cin >> n >> a >> r >> m;     m = min(m, a + r);     h = vector<int>(n);     pref = vector<long long>(n);     for (int i = 0; i < n; ++i) {       cin >> h[i];     }     sort(h.begin(), h.end());     ;     for (int i = 0; i < n; ++i) {       if (i > 0) {         pref[i] = pref[i - 1] + h[i];       } else {         pref[i] = h[i];       }     }     long long answer = LLONG_MAX;     for (int i = 0; i < n; ++i) {       if (i > 0 && h[i] == h[i - 1]) {         continue;       }       answer = min(answer, cost((long long)h[i]));     }     answer = min(answer, cost((long long)(pref[n - 1] / n)));     answer = min(answer, cost((long long)(1 + pref[n - 1] / n)));     cout << answer << endl;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t = 1;     for (int i = 1; i <= t; ++i) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename A, typename B>   string to_string(pair<A, B> p);   template <typename A, typename B, typename C>   string to_string(tuple<A, B, C> p);   template <typename A, typename B, typename C, typename D>   string to_string(tuple<A, B, C, D> p);   string to_string(const string& s) { return     + s +    ; }   string to_string(const char* s) { return to_string((string)s); }   string to_string(bool b) { return (b ?  true  :  false ); }   string to_string(vector<bool> v) {     bool first = true;     string res =  { ;     for (int i = 0; i < static_cast<int>(v.size()); i++) {       if (!first) {         res +=  ,  ;       }       first = false;       res += to_string(v[i]);     }     res +=  } ;     return res;   }   template <size_t N>   string to_string(bitset<N> v) {     string res =   ;     for (size_t i = 0; i < N; i++) {       res += static_cast<char>( 0  + v[i]);     }     return res;   }   template <typename A>   string to_string(A v) {     bool first = true;     string res =  { ;     for (const auto& x : v) {       if (!first) {         res +=  ,  ;       }       first = false;       res += to_string(x);     }     res +=  } ;     return res;   }   template <typename A, typename B>   string to_string(pair<A, B> p) {     return  (  + to_string(p.first) +  ,   + to_string(p.second) +  ) ;   }   template <typename A, typename B, typename C>   string to_string(tuple<A, B, C> p) {     return  (  + to_string(get<0>(p)) +  ,   + to_string(get<1>(p)) +  ,   +            to_string(get<2>(p)) +  ) ;   }   template <typename A, typename B, typename C, typename D>   string to_string(tuple<A, B, C, D> p) {     return  (  + to_string(get<0>(p)) +  ,   + to_string(get<1>(p)) +  ,   +            to_string(get<2>(p)) +  ,   + to_string(get<3>(p)) +  ) ;   }   void debug_out() { cerr << endl; }   template <typename Head, typename... Tail>   void debug_out(Head H, Tail... T) {     cerr <<     << to_string(H);     debug_out(T...);   }   const int mod = 1e9 + 7;   const int maxn = 200005;   const int inf = 1e9;   int tiempo[maxn], x[maxn], y[maxn], pref[maxn], dp[maxn];   void solve() {     int r, n;     cin >> r >> n;     for (int i = 1; i <= n; i++) {       cin >> tiempo[i] >> x[i] >> y[i];       dp[i] = -inf;     }     x[0] = y[0] = 1;     int ans = -inf;     for (int i = 1; i <= n; i++) {       for (int j = i - 1; j >= 0; j--) {         if (tiempo[i] - tiempo[j] > 2 * r) {           dp[i] = max(dp[i], pref[j] + 1);           break;         }         int dist = abs(x[i] - x[j]) + abs(y[i] - y[j]);         if (dist <= (tiempo[i] - tiempo[j])) {           dp[i] = max(dp[i], dp[j] + 1);         }       }       pref[i] = pref[i - 1];       pref[i] = max(pref[i], dp[i]);       ans = max(ans, pref[i]);     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long double eps = 1e-9;   const int inf = (1 << 30) - 1;   const long long inf64 = ((long long)1 << 62) - 1;   const long double pi = 3.1415926535897932384626433832795;   const string task =   ;   template <class T>   T sqr(T x) {     return x * x;   }   const int nmax = 2100;   int a[nmax][nmax];   char s[nmax][nmax];   int n, res;   int x[nmax], y[nmax];   int main() {     int n;     cin >> n;     gets(s[0]);     for (int i = 0; i < (int)(n); i++) gets(s[i]);     for (int i = 0; i < (int)(n); i++)       for (int j = 0; j < (int)(n); j++) a[i][j] = s[i][j] -  0 ;     int res = 0;     memset(x, 0, sizeof x);     memset(y, 0, sizeof y);     for (int i = n - 1; i > 0; i--) {       for (int j = 0; i + j < n; j++) {         int now = a[i + j][j] + x[i + j] + y[j];         now = now & 1;         if (now) {           res++;           x[i + j]++;           y[j]++;         }       }     }     for (int i = 0; i < (int)(n); i++) a[i][i] = (a[i][i] + x[i] + y[i]) & 1;     memset(x, 0, sizeof x);     memset(y, 0, sizeof y);     for (int i = n - 1; i > 0; i--) {       for (int j = 0; i + j < n; j++) {         int now = a[j][i + j] + x[j] + y[i + j];         now = now & 1;         if (now) {           res++;           y[i + j]++;           x[j]++;         }       }     }     for (int i = 0; i < (int)(n); i++) a[i][i] = (a[i][i] + x[i] + y[i]) & 1;     for (int i = 0; i < (int)(n); i++)       if (a[i][i] == 1) res++;     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = (1ll << 60);   const int maxn = 10010;   long long dp[2][maxn], c;   int p[maxn], s[maxn];   int n, id;   int main() {     scanf( %d%I64d , &n, &c);     for (int i = 0; i < n; i++) scanf( %d , p + i);     for (int i = 0; i < n; i++) scanf( %d , s + i);     for (int i = 1; i <= n; i++) dp[0][i] = inf;     for (int i = 0; i < n; i++) {       for (int j = 0; j <= i + 1; j++) dp[id ^ 1][j] = inf;       for (int j = 0; j <= i; j++) {         dp[id ^ 1][j] = min(dp[id ^ 1][j], dp[id][j] + p[i] + c * j);         dp[id ^ 1][j + 1] = min(dp[id ^ 1][j + 1], dp[id][j] + s[i]);       }       id ^= 1;     }     long long res = inf;     for (int i = 0; i <= n; i++) res = min(res, dp[id][i]);     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void in(long long int &number) {     bool negative = false;     register int c;     number = 0;     c = getchar();     if (c ==  - ) {       negative = true;       c = getchar();     }     for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;     if (negative) number *= -1;   }   void in(int &number) {     bool negative = false;     register int c;     number = 0;     c = getchar();     if (c ==  - ) {       negative = true;       c = getchar();     }     for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;     if (negative) number *= -1;   }   int k[100005];   int main() {     int n, m;     in(n);     in(m);     memset(k, 0, sizeof(k));     vector<long long int> a(n);     for (int i = 0; i <= n - 1; i++) in(a[i]);     vector<int> dp(n);     dp[n - 1] = 1;     k[a[n - 1]] = 1;     for (int i = n - 2; i >= 0; i--) {       if (k[a[i]] == 0) {         dp[i] = dp[i + 1] + 1;         k[a[i]] = 1;       } else         dp[i] = dp[i + 1];     }     while (m--) {       int l;       in(l);       l--;       cout << dp[l] <<   n ;     }     return 0;   }
#include<bits/stdc++.h>   #define mx                          100005   #define lli                         long long int   #define ulli                        unsigned long long int   #define mset(a,b)                   memset(a, b, sizeof(a))   #define infile                      freopen( in.txt ,  r , stdin);   #define outfile                     freopen ( out.txt , w ,stdout);   #define fileclose                   fclose (stdin); fclose (stdout);   #define test_case                   lli T; cin>>T;for(lli t=1;t<=T;t++)   #define scani(x)                    scanf( %d ,&x);   #define printi(x)                   printf( %d n ,x);   #define scanli(x)                   scanf( %lld ,&x);   #define printli(x)                  printf( %lld n ,x);   #define frep(i,from,to)             for(lli i=from;i<=to;i++)   #define frev(i,from,to)             for(lli i=from;i>=to;i--)      using namespace std;      int main()   {          //infile       //outfile       test_case       {           lli n;           lli x,mini=2000000000,mi;           scanli(n);              frep(i,1,n)           {               cin>>x;               if(x<mini)               {                   mi=i;                   mini=x;               }           }           cout<<n-1<<  n ;           frep(j,1,n)           {               if(mi!=j)                  cout<<mi<<   <<j<<   <<mini<<   <<abs(mi-j)+mini<<  n ;           }             }       fileclose   }
#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma )   #pragma GCC optimize( unroll-loops )   using namespace std;   long long int MOD = 998244353;   double eps = 1e-12;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int k, n, w, product = 0;     cin >> k >> n >> w;     for (int i = 1; i <= w; i++) {       product += (i * k);     }     long long int res = product - n;     if (res <= 0)       cout <<  0  << endl;     else       cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 32005;   int n, m, i, j, f;   int a[N];   long long ans;   int main() {     scanf( %d%d , &n, &m);     for (i = m + 1; i <= (n + 1) / 2; i++) {       for (j = m + 1; j < 2 * i; j++) {         f = (i * (2 * i - j) + (n + 1) * (2 * j - i)) / (i + j);         f = max(f, m);         if (f > n - m) continue;         a[i] += n - m - f;       }     }     for (i = m + 1; i <= (n + 1) / 2; i++) ans += 2 * a[i];     if (n % 2) ans -= a[i - 1];     printf( %I64d n , 3 * ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Mod = 1e9 + 7;   const double pi = 2 * acos(0.0);   const int N = 3e5 + 5;   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n, t;     cin >> t;     while (t--) {       cin >> n;       int x, z = 0, tot = 0;       for (int i = 0; i < n; i++) {         cin >> x;         if (!x) z++;         tot += x;       }       cout << z + ((tot + z) == 0) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, x;   int a[105];   long double dp[2][105][10005];   const long double threshold = 1e-12;   int main() {     scanf( %d%d , &n, &x);     long double s = 0.0;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       s += a[i];     }     dp[0][0][0] = 1.0;     for (int i = 0; i < n; i++) {       int now = i & 1, nxt = now ^ 1;       memset(dp[nxt], 0, sizeof(dp[nxt]));       for (int j = 0; j <= i; j++) {         for (int k = 0; k <= 10000; k++) {           dp[nxt][j][k] += dp[now][j][k];           dp[nxt][j + 1][k + a[i + 1]] += dp[now][j][k] * (j + 1) / (n - j);         }       }     }     long double ans = 0.0;     for (int i = 0; i <= n - 1; i++)       for (int j = 0; j <= s; j++)         ans += dp[n & 1][i][j] *                (min((s - j) / (n - i), ((long double)n / (n - i) + 1) * x / 2.0));     printf( %.10Lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int MOD = 1000000007;   const long double PI = 3.14159265;   long long int powerWithMod(long long int base, long long int exponent,                              long long int MODulus = LLONG_MAX) {     long long int ansult = 1;     base %= MODulus;     while (exponent > 0) {       if (exponent % 2 == 1) ansult = (ansult * base) % MODulus;       exponent >>= 1;       base = (base * base) % MODulus;     }     return ansult;   }   long long int gcdExtended(long long int a, long long int b, long long int *x,                             long long int *y) {     cout << a <<     << b <<     << *x <<     << *y <<   n ;     if (a == 0) {       *x = 0, *y = 1;       return b;     }     long long int x1, y1;     long long int gcd = gcdExtended(b % a, a, &x1, &y1);     *x = y1 - (b / a) * x1;     *y = x1;     cout <<  AFTER   << a <<     << b <<     << *x <<     << *y <<   n ;     return gcd;   }   long long int MODInverse(long long int a, long long int m) {     long long int x, y;     long long int g = gcdExtended(a, m, &x, &y);     cout << g <<     << x <<     << y <<   n ;     long long int ans = (x % m + m) % m;     return ans;   }   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     long long int n, a = 0, x, m = 0;     cin >> n;     for (int i = 1; i <= n; i++) cin >> x, a += x, m = max(x, m);     cout << max(m, (a + n - 2) / (n - 1)) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int N = 100005;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     {       long long int i, j, k, n, m, ans = 0, cnt = 0, sum = 0;       cin >> n;       vector<long long int> v;       long long int a[n];       j = 0;       ans = 0;       for (i = 0; i < n; i++) {         cin >> a[i];         if (a[i] < 0) {           j++;           if (j == 3) {             v.push_back(i - ans);             cnt++;             ans = i;             j = 1;           }         }         if (i == n - 1) {           v.push_back(i - ans + 1);           cnt++;         }       }       cout << max((long long int)1, cnt) << endl;       for (auto x : v) {         cout << x <<    ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e7;   const long long MOD = 998244353;   vector<vector<int> > occur;   vector<vector<long long> > minC, dp;   long long gV(int l, int r) {     if (l == r + 1) {       return 1;     }     return dp[l][r];   }   void calc(int l, int r) {     int cMinC = minC[l][r];     vector<int> &cOccur = occur[cMinC];     int fI = cOccur[0];     int lI = cOccur[cOccur.size() - 1];     if (fI < l || r < lI) {       dp[l][r] = 0;       return;     }     long long sumR = 0;     for (int nR = lI; nR <= r; nR++) {       sumR = (sumR + gV(lI + 1, nR) * gV(nR + 1, r)) % MOD;     }     long long sumL = 0;     for (int nL = fI; nL >= l; nL--) {       sumL = (sumL + gV(l, nL - 1) * gV(nL, fI - 1)) % MOD;     }     long long inProd = 1;     for (int i = 0; i + 1 < cOccur.size(); i++) {       inProd = inProd * gV(cOccur[i] + 1, cOccur[i + 1] - 1) % MOD;     }     dp[l][r] = (sumL * sumR % MOD) * inProd % MOD;   }   int main() {     int N, M;     cin >> M >> N;     vector<int> a;     for (int i = 0; i < N; i++) {       int x;       cin >> x;       x--;       if (a.empty() || a[a.size() - 1] != x) {         a.push_back(x);       }     }     N = a.size();     if (N > 2 * M) {       cout << 0 << endl;       return 0;     }     minC.resize(N);     for (int i = 0; i < N; i++) {       minC[i].resize(N);       int cMin = a[i];       for (int j = i; j < N; j++) {         cMin = min(cMin, a[j]);         minC[i][j] = cMin;       }     }     occur.resize(M);     for (int i = 0; i < N; i++) {       occur[a[i]].push_back(i);     }     dp.resize(N);     for (int i = 0; i < N; i++) {       dp[i].resize(N);       fill(dp[i].begin(), dp[i].end(), 0);     }     for (int len = 1; len <= N; len++) {       for (int l = 0; l < N; l++) {         int r = l + len - 1;         if (r >= N) {           continue;         }         calc(l, r);       }     }     cout << dp[0][N - 1] << endl;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK: 2000000 )   using namespace std;   int main(void) {     srand(time(0));     cout << fixed << setprecision(7);     cerr << fixed << setprecision(7);     int n;     ios_base ::sync_with_stdio(0);     cin.tie(0);     cin >> n;     function<int(int)> ok = [&](int k) {       return !k ? 0 : ok(k / 10) | ((k % 10 != 4) && (k % 10 != 7));     };     static int f[1 << 20];     for (int i = 1; i <= n; ++i) f[i] = i;     function<int(int)> get = [&](int k) {       return k == f[k] ? k : f[k] = get(f[k]);     };     for (int i = 1; i < n; ++i) {       int a, b, c;       cin >> a >> b >> c;       if (ok(c)) f[get(a)] = get(b);     }     static int S[1 << 20];     for (int i = 1; i <= n; ++i) ++S[get(i)];     long long ans = 0;     for (int i = 1; i <= n; ++i)       ans += 1ll * (n - S[get(i)]) * (n - S[get(i)] - 1);     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   vector<long long> v[100009], vv[100009];   long long vis[100009], dis[101][100001], ar[100001];   void bfs(long long k) {     queue<long long> q;     memset(vis, 0, sizeof(vis));     for (long long x : vv[k]) {       q.push(x);       vis[x] = 1;       dis[k][x] = 0;     }     while (!q.empty()) {       long long x = q.front();       q.pop();       for (long long y : v[x]) {         if (!vis[y]) {           vis[y] = 1;           q.push(y);           dis[k][y] = dis[k][x] + 1;         }       }     }   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, m, k, s, ans = 1e15;     cin >> n >> m >> k >> s;     for (long long i = 1; i <= n; i++) {       cin >> ar[i];       vv[ar[i]].push_back(i);     }     for (long long i = 0; i < m; i++) {       long long x, y;       cin >> x >> y;       v[x].push_back(y);       v[y].push_back(x);     }     for (long long i = 1; i <= k; i++) bfs(i);     for (long long i = 1; i <= n; i++) {       vector<long long> hh;       long long as = 0;       for (long long j = 1; j <= k; j++) hh.push_back(dis[j][i]);       sort(hh.begin(), hh.end());       for (long long j = 0; j < s; j++) as += hh[j];       cout << as <<    ;     }     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 4e5 + 5;   const int MAXM = 2e5 + 5;   const int MOD = 998244353;   const int INF = 0x3f3f3f3f;   int a[MAXN], sum[MAXN];   vector<int> v;   map<int, int> mp;   int main() {     int n, I;     scanf( %d%d , &n, &I);     mp.clear();     memset(sum, 0, sizeof(sum));     int B = I * 8;     for (int i = 1; i <= n; ++i) {       scanf( %d , &a[i]);       if (mp.find(a[i]) == mp.end()) {         mp[a[i]] = 1;       } else {         ++mp[a[i]];       }       v.emplace_back(a[i]);     }     sort(a + 1, a + n + 1);     sort(v.begin(), v.end());     v.erase(unique(v.begin(), v.end()), v.end());     int sz = v.size(), K;     for (int i = sz; i >= 1; --i) {       if (n * int(ceil(log2(i))) <= B) {         K = i;         break;       }     }     for (int i = 0; i < sz; ++i) {       if (i == 0)         sum[i] = mp[v[i]];       else         sum[i] = sum[i - 1] + mp[v[i]];     }     int ans = n, tmp = 0;     for (int i = 0; i <= max(sz - K, 0); ++i) {       tmp = 0;       if (i != 0) tmp += sum[i - 1];       tmp += sum[sz - 1] - sum[min(i + K - 1, sz - 1)];       ans = min(tmp, ans);     }     printf( %d n , ans);     return 0;   }