Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<ll,P>  PP;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef priority_queue<PP, vector<PP>, greater<PP>> PPQueue;

#define fi          first
#define se          second
#define sfi         se.fi
#define sse         se.se
#define pb          push_back
#define INF         INT_MAX
#define MOD         1000000007
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     (upper_bound(all(x),y)-x.begin())
#define lb(x,y)     (lower_bound(all(x),y)-x.begin())
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)

int main(){
  cin.sync_with_stdio(false);
  ll n,k;
  cin >> n >> k;
  Vector a(n);
  rep(i,n)cin >> a[i];
  dsort(a);
  vector<bitset<5001>> table(n);
  rep(i,n)table[i].set(i);
  vector<bitset<5001>> dp(k,~bitset<5001>());
  dp[0] = ~dp[0];
  rep(i,n)for(ll j=k-1;j>=a[i];j--)if(!dp[j-a[i]][5000])dp[j] &= (dp[j-a[i]] | table[i]);
  ll cou = n;
  rep(i,n)repl(j,max(0,k-a[i]),k)if(!dp[j][i]){cou--;break;}
  cout << cou << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:21: error: no matching function for call to 'max(int, ll)'
   49 |   rep(i,n)repl(j,max(0,k-a[i]),k)if(!dp[j][i]){cou--;break;}
      |                  ~~~^~~~~~~~~~
a.cc:34:35: note: in definition of macro 'repl'
   34 | #define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
      |                                   ^
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:49:21: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   49 |   rep(i,n)repl(j,max(0,k-a[i]),k)if(!dp[j][i]){cou--;break;}
      |                  ~~~^~~~~~~~~~
a.cc:34:35: note: in definition of macro 'repl'
   34 | #define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
      |                                   ^
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:49:21: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   49 |   rep(i,n)repl(j,max(0,k-a[i]),k)if(!dp[j][i]){cou--;break;}
      |                  ~~~^~~~~~~~~~
a.cc:34:35: note: in definition of macro 'repl'
   34 | #define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
      |                                   ^