malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long long MOD = 1e9 + 7;   long long add(long long a, long long b) { return (a + b) % MOD; }   long long sub(long long a, long long b) { return ((a - b) % MOD + MOD) % MOD; }   long long mul(long long a, long long b) { return (a * b) % MOD; }   long long a[800000], tim[200];   set<long long> se;   long long n, m;   bool check(long long x, long long s) {     long long mid = x;     long long p = -1, sum = 0;     for (int i = 100; i >= 1; i--) {       if (tim[i] <= x)         x -= tim[i];       else if (tim[i] > x && p == -1) {         p = tim[i] - x;         x = -1;         sum += p * i;       } else if (p != -1) {         sum += i * tim[i];       }     }     if (m - sum >= a[s]) return true;     return false;   }   int main() {     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       long long l = 0, r = i + 1, mid, ans = LLONG_MAX;       while (l <= r) {         mid = (l + r) >> 1;         if (check(mid, i)) {           r = mid - 1;           ans = min(ans, mid);         } else           l = mid + 1;       }       cout << ans <<    ;       tim[a[i]]++;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int base = 639941;   char str[1505], bad[30];   set<long long int> s;   int main() {     int k, n, i, j;     scanf( %s , str);     scanf( %s , bad);     scanf( %d , &k);     n = strlen(str);     int ans = 0;     for (i = 0; i < n; i++) {       int b = 0;       long long int h = 0;       long long int pw = 1LL;       for (j = i; j < n; j++) {         b += ( 1  - bad[str[j] -  a ]);         if (b > k) break;         pw *= base;         h += (pw * str[j]);         s.insert(h);       }     }     printf( %d n , s.size());     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:128000000 )   using namespace std;   const int INF = 1000000000;   typedef struct zap {     int p;     zap *left, *right, *rod;   };   char s[100];   zap *top = 0, *temp = 0;   int dfs(zap *t) {     if (t->p == 0) {       printf( int );       return 0;     }     printf( pair< );     dfs(t->left);     printf( , );     dfs(t->right);     printf( > );     return 0;   }   int main() {     int k, i, v, j, x, y, to, n, r, p, l, fl, m;     scanf( %i , &n);     fl = 0;     while (scanf( %s , &s) != EOF) {       if (fl) {         printf( Error occurred n );         return 0;       }       if (!top) {         top = new zap;         top->left = top->rod = top->right = 0;         if (s[0] ==  p )           top->p = 1;         else           top->p = 0;         temp = top;         if (top->p == 0) fl = 1;         continue;       }       zap *newe = new zap;       if (s[0] ==  p )         newe->p = 1;       else         newe->p = 0;       newe->left = newe->right = newe->rod = 0;       newe->rod = top;       if (!top->left) {         top->left = newe;         top = newe;       } else if (!top->right) {         top->right = newe;         top = newe;       }       while (top->p == 0 || (top->left && top->right)) {         if (top == temp) {           fl = 1;           break;         }         top = top->rod;       }     }     if (top != temp || (top->p && (!top->left || !top->right))) {       printf( Error occurred n );       return 0;     }     dfs(top);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int q, w, e, W;   int a[500000], k, b, c, d, n, m, ip1, ip2, a1, b1, c1, d1, m1[500000],       m2[500000], m3[500000], m4[500000];   string old[2000], nov[2000], s1, s2;   int main() {     cin >> q;     for (int i = 1; i <= q; i++) {       cin >> s1 >> s2;       int ok = 0;       for (int j = 1; j <= k; j++)         if (nov[j] == s1) {           nov[j] = s2;           ok = 1;           break;         }       if (ok == 0) old[++k] = s1, nov[k] = s2;     }     cout << k << endl;     for (int j = 1; j <= k; j++) cout << old[j] <<     << nov[j] << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 300010;   int dia, n;   long long a[N], ans;   map<long long, int> mp;   int main() {     cin >> dia >> n;     ans = (long long)n * (n - 1LL) * (n - 2LL) / 6LL;     for (int i = 1, s, f; i <= n; ++i) {       cin >> s >> f;       if (!s) f += dia;       f %= 2 * dia;       a[i] = f;     }     sort(a + 1, a + n + 1);     for (int i = n + 1; i <= 2 * n; ++i) {       a[i] = a[i - n] + 2 * dia;       mp[a[i]]++;       mp[a[i - n]]++;     }     for (int i = 1, ni = 1; i <= n; ++i) {       for (; a[ni + 1] - a[i] < dia; ++ni)         ;       ans -= (long long)(ni - i) * (ni - i - 1LL) / 2LL;     }     if (ans) {       cout << ans <<   n ;       return 0;     }     long long l = 0;     for (int i = 1, ni; i <= n; ++i) {       for (; a[ni + 1] - a[i] < dia; ++ni)         ;       if (ni - i > 1) l = max(l, a[ni] - a[i]);     }     for (int i = 1, ni = 1; i <= n; ++i) {       ni = max(ni, i);       mp[a[i]]--;       for (; a[ni + 1] - a[i] < l; ++ni)         ;       if (a[ni + 1] - a[i] == l) {         if (ni + 1 - i > 1) ans += (long long)(ni - i) * mp[a[ni + 1]];         ans += (long long)mp[a[ni + 1]] * (mp[a[ni + 1]] - 1) / 2LL;       }     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   map<string, string> m;   map<string, int> used;   string f(string x) {     used[x] = 1;     if (m[x] == x) return x;     return f(m[x]);   }   int main() {     int count = 0;     vector<string> tab;     int n;     cin >> n;     for (int i = 0; i < n; i++) {       string p1, p2;       cin >> p1 >> p2;       if (m[p1].empty()) {         ++count;         tab.push_back(p1);       }       used[p1] = 0;       used[p2] = 0;       m[p1] = p2;       m[p2] = p2;     }     cout << count << endl;     for (int i = 0; i < count; ++i) {       if (used[tab[i]] == 1) continue;       cout << tab[i] <<     << f(tab[i]) << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2002;   int n, a[N][N], c[N], p[N], t, A;   string s[N];   bool C() {     for (int i = 1; i <= n; i++) p[i] = c[i];     sort(p + 1, p + n + 1), t = 0;     for (int i = 1; i < n; i++) {       t += p[i];       if (t == i * (i - 1) / 2) return false;     }     return true;   }   void S(int x) {     for (int i = 1; i <= n; i++)       c[x] -= a[x][i], c[i] -= a[i][x], swap(a[x][i], a[i][x]), c[x] += a[x][i],           c[i] += a[i][x];   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++) cin >> s[i];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) a[i][j] = s[i][j - 1] -  0 , c[i] += a[i][j];     for (int i = 1; i <= n; i++) S(i), A += C(), S(i);     if (C())       cout << 0 <<     << 1;     else if (A)       cout << 1 <<     << A;     else if (n == 6)       cout << 2 <<     << 18;     else       cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 2010;   int n, m, k;   long long sum[maxn][maxn];   char s[maxn][maxn];   long long calc(int x, int y) {     if (x <= 0 || y <= 0) return 0;     long long ans = 0;     int a = x % n, b = y % m;     ans = (1ll * x * y - 1ll * a * b) / 2;     if ((__builtin_popcount(x / n) ^ __builtin_popcount(y / m)) % 2 == 0)       ans += sum[a][b];     else       ans += 1ll * a * b - sum[a][b];     return ans;   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1; i <= n; i++) scanf( %s , s[i] + 1);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         int now = s[i][j] -  0 ;         sum[i][j] = now;         sum[i][j + m] = now ^ 1;         sum[i + n][j] = now ^ 1;         sum[i + n][j + m] = now;       }     n <<= 1;     m <<= 1;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         sum[i][j] += sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];     while (k--) {       int x1, y1, x2, y2;       scanf( %d%d%d%d , &x1, &y1, &x2, &y2);       printf( %lld n , calc(x2, y2) - calc(x2, y1 - 1) - calc(x1 - 1, y2) +                            calc(x1 - 1, y1 - 1));     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a[100005];     int n;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int i = 0; i < n; i++) {       printf( %I64d  , a[i] + a[i + 1]);     }   }
#include <bits/stdc++.h>   using namespace std;   string s;   int k;   int main() {     cin >> s;     for (int i = 0; i < s.length(); i++)       if (s[i] ==  1 ) k++;     if (k > 1)       cout << (s.length() + 1) / 2 << endl;     else       cout << s.length() / 2 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long read() {     long long a = 0, b = getchar(), c = 1;     while (!isdigit(b)) c = b ==  -  ? -1 : 1, b = getchar();     while (isdigit(b)) a = a * 10 + b -  0 , b = getchar();     return a * c;   }   void print(long long x) {     if (x < 0) putchar( - ), x = -x;     int y = x % 10 +  0 ;     if (x >= 10) print(x / 10);     putchar(y);   }   int n, x, y, a[100005];   int main() {     n = read(), x = read(), y = read();     for (int i = 0; i < n; i++) a[i] = read();     for (int i = 0; i < n; i++) {       bool z = true;       for (int j = max(0, i - x); j < i; j++)         if (a[j] <= a[i]) z = false;       for (int j = min(n - 1, i + y); j > i; j--)         if (a[j] <= a[i]) z = false;       if (z) return print(i + 1), 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct Vec {     double x, y;     Vec(double newX = 0, double newY = 0) {       x = newX;       y = newY;     }     Vec operator+(Vec r) { return Vec(x + r.x, y + r.y); }     Vec operator-(Vec r) { return Vec(x - r.x, y - r.y); }     Vec operator*(double r) { return Vec(x * r, y * r); }     Vec operator/(double r) { return Vec(x / r, y / r); }     double operator*(Vec r) { return x * r.x + y * r.y; }     Vec normal() { return Vec(y, -x); }     double len() { return sqrt(x * x + y * y); }   };   double cprod(Vec l, Vec r) { return l.x * r.y - l.y * r.x; }   Vec intersection(Vec first1, Vec first2, Vec second1, Vec second2) {     Vec n1 = (first2 - first1).normal();     Vec n2 = (second2 - second1).normal();     double c1 = first1 * n1;     double c2 = second1 * n2;     double x = c1 * n2.y - c2 * n1.y;     double y = c2 * n1.x - c1 * n2.x;     double div = n1.x * n2.y - n1.y * n2.x;     return Vec(x, y) / div;   }   double getArea(vector<Vec> pts) {     double result = 0;     for (size_t i = 0; i < pts.size(); i++)       result += cprod(pts[i], pts[(i + 1) % pts.size()] - pts[i]) / 2;     return abs(result);   }   int n, r;   double pi = acos(-1);   Vec getPt(int ind) {     ind = (ind % n + n) % n;     return Vec(r * sin(2 * pi * ind / n), r * cos(2 * pi * ind / n));   }   int main() {     double area = 0;     cin >> n >> r;     {       vector<Vec> pts = {           getPt(0), getPt(n / 2),           intersection(getPt(n / 2), getPt(-1), getPt(n / 2 + 1), getPt(1)),           getPt(n / 2 + 1)};       area += getArea(pts);     }     int segments = 2, cursize = (n - 3) / 2;     while (cursize > 0) {       Vec mid;       if (cursize + 1 != n / 2)         mid = intersection(getPt(0), getPt(n / 2), getPt(cursize + 1),                            getPt(cursize + 1 - n / 2));       else         mid = getPt(0) + (getPt(n / 2) - getPt(0)) / 2;       if (cursize % 2) {         Vec top = getPt((cursize + 1) / 2);         Vec lopp = getPt((cursize + 1) / 2 - n / 2);         Vec ropp = getPt((cursize + 1) / 2 + n / 2);         vector<Vec> pts = {top, intersection(top, lopp, getPt(0), getPt(n / 2)),                            mid,                            intersection(top, ropp, getPt(cursize + 1),                                         getPt(cursize + 1 - n / 2))};         area += segments * getArea(pts);         cursize = (cursize - 1) / 2;       } else {         Vec top1 = getPt((cursize + 1) / 2);         Vec top2 = getPt((cursize + 1) / 2 + 1);         Vec bot1 = getPt((cursize + 1) / 2 + n / 2);         Vec bot2 = getPt((cursize + 1) / 2 - n / 2);         Vec bot3 = getPt((cursize + 1) / 2 + 1 - n / 2);         vector<Vec> pts = {             top1,             intersection(top1, bot2, getPt(0), getPt(n / 2)),             mid,             intersection(top2, bot2, getPt(cursize + 1), getPt(cursize + 1 - n / 2)),             top2,             intersection(top1, bot1, top2, bot3)};         area += segments * getArea(pts);         cursize = (cursize - 2) / 2;       }       segments *= 2;     }     cout << fixed << setprecision(8) << area <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 1 << 30;   int n, m, str[100100], lim[100100], up[100100], D[100100], col[100100 * 4];   long long ans;   vector<int> F[100100 * 4];   vector<long long> sum2[100100 * 4], sum[100100 * 4];   bool cmp(int x, int y) { return D[x] > D[y]; }   void build(int node, int l, int r) {     col[node] = -2;     if (l == r) {       F[node].push_back(l);       sum[node].push_back(up[l]);       sum2[node].push_back(lim[l]);       return;     }     int mid = (l + r) >> 1, son = node << 1;     build(son, l, mid);     build(son | 1, mid + 1, r);     F[node].resize(r - l + 1);     sum[node].resize(r - l + 1);     sum2[node].resize(r - l + 1);     merge(F[son].begin(), F[son].end(), F[son | 1].begin(), F[son | 1].end(),           F[node].begin(), cmp);     sum[node][0] = up[F[node][0]], sum2[node][0] = lim[F[node][0]];     for (int i = 1, size = F[node].size(); i < size; i++) {       sum[node][i] = sum[node][i - 1] + up[F[node][i]];       sum2[node][i] = sum2[node][i - 1] + lim[F[node][i]];     }   }   void update(int node) {     if (col[node] > 0) col[node << 1] = col[(node << 1) | 1] = col[node];   }   void getans(int node, int l, int r, int ll, int rr, int t) {     if (l > rr || ll > r) return;     if (ll <= l && rr >= r && (col[node] > 0 || col[node] == -2)) {       if (col[node] > 0) {         int dif = t - col[node];         int l = -1, r = F[node].size() - 1;         while (l < r) {           int mid = (l + r + 1) >> 1;           if (D[F[node][mid]] >= dif)             l = mid;           else             r = mid - 1;         }         if (l >= 0) ans += sum[node][l] * dif - sum2[node][l];         ans += sum2[node][F[node].size() - 1];       } else {         for (int i = 0, size = F[node].size(); i < size; i++)           ans += min((long long)lim[F[node][i]],                      (long long)t * up[F[node][i]] + str[F[node][i]]);       }       col[node] = t;       return;     }     update(node);     int mid = (l + r) >> 1, son = node << 1;     getans(son, l, mid, ll, rr, t);     getans(son | 1, mid + 1, r, ll, rr, t);     if (col[son] == col[son | 1])       col[node] = col[son];     else       col[node] = -1;   }   int main() {     cin >> n;     for (int i = 1; i <= n; i++)       scanf( %d %d %d , &str[i], &lim[i], &up[i]),           D[i] = up[i] == 0 ? Maxn : lim[i] / up[i];     build(1, 1, n);     int t, l, r;     cin >> m;     for (int i = 1; i <= m; i++) {       scanf( %d %d %d , &t, &l, &r);       ans = 0;       getans(1, 1, n, l, r, t);       printf( %lld n , ans);     }   }
#include <bits/stdc++.h>   int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }   int main() {     int la, ra, ta, lb, rb, tb;     scanf( %d%d%d , &la, &ra, &ta), ++ra;     scanf( %d%d%d , &lb, &rb, &tb), ++rb;     int g = gcd(ta, tb);     ra -= la / g * g, la %= g;     rb -= lb / g * g, lb %= g;     if (lb > la) lb -= g, rb -= g;     int ans = 0;     ans = std::max(ans, std::min(ra, rb) - std::max(la, lb));     lb += g, rb += g;     ans = std::max(ans, std::min(ra, rb) - std::max(la, lb));     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1E4 + 10;   bool st[MAXN];   int n, k, l, f[1 << 20], dis[25][25], id[MAXN], d[MAXN], tot;   vector<int> g[MAXN];   queue<int> q;   inline void add(int u, int v) {     g[u].push_back(v);     g[v].push_back(u);   }   void bfs(int s) {     memset(d, 0x3f, sizeof d);     d[s] = 0;     q.push(s);     while (!q.empty()) {       int x = q.front();       q.pop();       for (int v : g[x])         if (d[v] == 0x3f3f3f3f) {           d[v] = d[x] + 1;           q.push(v);         }     }     for (int i = 1; i <= n; i++)       if (id[i]) dis[id[i]][id[s]] = min(dis[id[i]][id[s]], d[i]);   }   int main() {     scanf( %d%d%d , &n, &k, &l);     for (int i = 1, x; i <= k; i++) {       scanf( %d , &x);       st[x - 1] ^= 1;       st[x] ^= 1;     }     for (int i = 0; i <= n; i++)       if (st[i]) id[i] = ++tot;     for (int i = 1, x; i <= l; i++) {       scanf( %d , &x);       for (int j = 1; j <= n - x + 1; j++) add(j - 1, j + x - 1);     }     memset(dis, 0x3f, sizeof dis);     for (int i = 0; i <= n; i++)       if (id[i]) bfs(i);     memset(f, 0x3f, sizeof f);     f[0] = 0;     for (int s = 1; s < (1 << tot); s++)       for (int i = 0; i < tot; i++)         if ((s >> i) & 1)           for (int j = 0; j < tot; j++)             if ((s >> j) & 1)               f[s] = min(f[s], f[s ^ (1 << i) ^ (1 << j)] + dis[i + 1][j + 1]);     if (f[(1 << tot) - 1] == 0x3f3f3f3f)       puts( -1 );     else       printf( %d n , f[(1 << tot) - 1]);   }
#include <bits/stdc++.h>   using namespace std;   const int Maxn = 3e5 + 5;   const int inf = 1 << 29;   inline int min(int a, int b) { return a < b ? a : b; }   inline int max(int a, int b) { return a > b ? a : b; }   inline int R() {     char ch = getchar();     int x = 0;     bool f = 0;     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = 1;     for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);     if (f == 1) x = -x;     return x;   }   int a[Maxn], n, t, L[Maxn], N[Maxn], ans[Maxn];   bool vis[Maxn];   int main() {     t = R();     while (t--) {       n = R();       for (int i = 0; i <= n + 1; i++) {         ans[i] = inf;         N[i] = vis[i] = 0;       }       for (int i = 1; i <= n; i++) {         a[i] = R();         L[a[i]] = 0;       }       for (int i = 1; i <= n; i++) {         if (!L[a[i]])           L[a[i]] = i;         else {           N[L[a[i]]] = i;           L[a[i]] = i;         }       }       for (int i = 1; i <= n; i++)         if (N[i] == 0) N[i] = n + 1;       for (int i = 1; i <= n; i++)         if (!vis[i]) {           int M = i;           for (int p = i; N[p] != 0; p = N[p]) {             vis[p] = 1;             M = max(M, N[p] - p);           }           ans[M] = min(ans[M], a[i]);         }       ans[0] = inf;       for (int i = 1; i <= n; i++) ans[i] = min(ans[i], ans[i - 1]);       for (int i = 1; i <= n; i++) {         if (ans[i] == inf) ans[i] = -1;         printf( %d  , ans[i]);       }       puts(  );     }   }
#include <bits/stdc++.h>   using namespace std;   void work(long long ang) {     for (long long n = 3;; n++) {       if (ang * n % 180 == 0) {         if (ang * n / 180 <= n - 2) {           printf( %I64d n , n);           return;         }       }       if (n == 998244353) break;     }   }   int main() {     int T;     int n;     scanf( %d , &T);     for (; T--;) {       scanf( %d , &n);       work(n);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 998244353;   string s;   int n, ans;   int T, A[1010], B[1010], cnt, head[2010], nxt[100010], dis[100010], id;   bool w[100010];   void link(int a, int b, int c) {     nxt[++id] = head[a], head[a] = id, dis[id] = b, w[id] = c;     nxt[++id] = head[b], head[b] = id, dis[id] = a, w[id] = c;   }   int power[2010];   bool vis[2010], col[2010];   bool dfs(int x) {     for (int i = head[x]; i; i = nxt[i]) {       if (!vis[dis[i]]) {         vis[dis[i]] = 1;         col[dis[i]] = col[x] ^ w[i];         if (dfs(dis[i])) return 1;       } else if (col[dis[i]] ^ col[x] ^ w[i])         return 1;     }     return 0;   }   int main() {     cin >> s;     n = s.size();     s =     + s;     power[0] = 1;     for (int i = 1; i <= 2000; ++i) power[i] = power[i - 1] * 2 % MOD;     for (int S = 2; S <= n; ++S) {       memset(head, 0, sizeof(head));       id = cnt = 0;       T = cnt++;       for (int i = S; i <= n; ++i) A[i] = cnt++;       for (int i = 1; i <= n; ++i) B[i] = cnt++;       link(B[1], T, 1);       link(A[S], T, 1);       for (int i = S; i <= n; ++i) {         if (s[i] ==  0 )           link(A[i], B[i], 0);         else if (s[i] ==  1 )           link(A[i], B[i], 1);       }       for (int i = 1; i < S; ++i) {         if (s[i] ==  0 )           link(B[i], T, 0);         else if (s[i] ==  1 )           link(B[i], T, 1);       }       for (int i = S, j = n; i < j; ++i, --j) link(A[i], A[j], 0);       for (int i = 1, j = n; i < j; ++i, --j) link(B[i], B[j], 0);       memset(vis, 0, sizeof(vis));       int C = 0;       for (int i = 0; i < cnt; ++i)         if (!vis[i]) {           ++C;           if (dfs(i)) {             C = -1;             break;           }         }       if (~C) ans = (ans + power[C - 1]) % MOD;     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 4e6 + 5;   long long n, a[N], b[N], sum[N], I, lim = 1, mx = -1, Ans;   long long read() {     long long x = 0, f = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 1) + (x << 3) + c -  0 ;       c = getchar();     }     return f * x;   }   long long qpow(long long x, long long y) {     long long ret = 1;     while (y) {       if (y & 1) ret = ret * x;       y >>= 1;       x = x * x;     }     return ret;   }   long long LG2(long long x) {     long long ret = log2(x);     if (qpow(2, ret) >= x)       return ret;     else       return ret + 1;   }   int main() {     memset(sum, 0, sizeof(sum));     memset(a, 0, sizeof(a));     memset(b, 0, sizeof(b));     n = read(), I = read();     for (register long long i = (1); i <= (n); i++) a[i] = read();     sort(a + 1, a + n + 1);     a[0] = -1;     for (register long long i = (1); i <= (n); i++) {       if (a[i] != a[i - 1])         b[++b[0]] = 1;       else         b[b[0]]++;     }     for (register long long i = (2); i <= (b[0]); i++) {       if (LG2(i) * n <= 8 * I)         lim = i;       else         break;     }     if (lim >= b[0])       printf( 0 n );     else {       for (register long long i = (1); i <= (b[0]); i++)         sum[i] = sum[i - 1] + b[i];       for (register long long i = (lim); i <= (b[0]); i++)         mx = max(mx, sum[i] - sum[i - lim]);       Ans = sum[b[0]] - mx;       printf( %lld n , Ans);     }     return 0;   }