func_code_string: #include <bits/stdc++.h>   #include<unordered_map>   //#pragma GCC optimize(2)   #define ll long long   #define sc(n) scanf( %d ,&n)   #define scl(n) scanf( %lld ,&n)   //#define int ll   using namespace std;   inline int rd() { int x = 0, f = 1; char c = getchar(); while (c !=  -  && c < 48)c = getchar(); if (c ==  - )f = -1, c = getchar(); while (c > 47)x = (x << 1) + (x << 3) + (c ^ 48), c = getchar(); return f * x; }   const int maxn = 500001, inf = 2147483647;   const ll mod = 0 ? 998244353 : 1000000007, linf = 9223372036854775807;   const double pi = acos(-1);   inline ll mi(ll a, ll b, ll mm = mod) { a %= mm; ll u = 1; while (b) { if (b & 1)u = u * a % mm; a = a * a % mm, b >>= 1; }return u; }   inline ll gcd(ll a, ll b) { ll c = a % b; while (c)a = b, b = c, c = a % b; return b; }   inline void mem(int* a, int p = 0, int len = maxn) { for (int i = 0; i < len; i++)a[i] = p; }   struct p { int r, c; }e[maxn];   static bool cmp(p i, p j) { return i.r < j.r; };   int t, n, m, a[maxn], b[maxn], c[maxn], x, y, xx, yy, su, q, k, u, l, r;   string s;   int g(int n) {    int x = 1, y = n;    while (y)     x <<= 1, y >>= 1;    x >>= 1;    return x;   }   signed main() {    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);//sf和cin混用会出错    cin >> t;    while (t--) {     cin >> n >> m;     map<int, int>ma;     for (int i = 0; i < n; i++)      cin >> a[i], ma[a[i]]++;     su = 0;     while (n) {      su++;      y = m, x = g(m);      while (x) {       while (ma[x] && y >= x)        y -= x, n--, ma[x]--;       x >>= 1;      }     }     cout << su << endl;    }   }