criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <chrono>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <sstream>
#include <queue>


using namespace std;
using ll = unsigned long long;
using triplet = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vi = vector<int>;
using vvi = vector<vi>;

int main()
{
#ifdef LOCAL_TEST
    freopen("data.txt", "r", stdin);
#endif
    
    int n, K;
    scanf("%d %d\n", &n, &K);
    
    vi cards(n);
    for (int i = 0; i < n; ++i) scanf("%d", &cards[i]);
    sort(cards.begin(), cards.end());
    
    // if any sum of subset between [K-cards[i], K) exists that means this card is unnecessary
    bitset<5002> sum;
    sum[0] = 1;
    int result = n;
    bool bFound = false;
    for (int j = n-1; j >= 0 && !bFound; --j)
    {
        int c = cards[j];
        for (int i = K-c; i >= 0 && i < K; ++i)
        {
            if (sum[i])
            {
                result = j;
                bFound = true;
                break;
            }
        }
        sum |= sum << c;
    }
    printf("%d\n", result);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:5: error: 'bitset' was not declared in this scope
   38 |     bitset<5002> sum;
      |     ^~~~~~
a.cc:15:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   14 | #include <queue>
  +++ |+#include <bitset>
   15 | 
a.cc:38:18: error: 'sum' was not declared in this scope
   38 |     bitset<5002> sum;
      |                  ^~~
Language: C++

#include "IntMod.h"
typedef IntMod<1000000007> MInt;

#include "Union_Find.h"

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>

using namespace std;
#define REP(i,a,n) for(int i = a; i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = n - 1; i >= a; --i)
#define EPS 0.0001
#define INF 0x3FFFFFFF
#define INFLL 0x3FFFFFFF3FFFFFFF
#define INFD 1.0e+308
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;

#if 1
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
#endif

int N, K;
int A[100001];
bool DP[5000];
int main() {
	cin >> N >> K;
	REP(i, 0, N) {
		cin >> A[i];
	}
	if (N > 400 || K > 400) {
		cout << 1 << endl;
		return 0;
	}

	int ans = 0;
	REP(i, 0, N) {
		fill(DP, DP + 401, false);
		DP[0] = 1;
		REP(j, 0, N) {
			if (i == j) continue;
			if (A[j] > K) continue;
			REPM(k, K, 0) {
				if (k - A[k] < 0) continue;
				DP[k] |= DP[k - A[j]];
			}
		}
		bool ok = true;
		REP(s, K - A[i], K) {
			if (DP[s]) ok = false;
		}
		if (ok) ++ans;
	}
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:1:10: fatal error: IntMod.h: No such file or directory
    1 | #include "IntMod.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

int N,K;
int ans = 0;
vector<int> V;
int dp[5010][10010] = {1};

int main()
{
    scanf("%d%d",&N,&K);
    for(int i = 0; i < N; i++)
    {
        int a;
        scanf("%d",&a);
        if(a <= K)
        {
            V.push_back(a);
        }
    }
    N = V.size();
    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j <= K * 2; j++)
        {
            if(dp[i][j] != 0)
            {
                dp[i + 1][j] += dp[i][j];
                if(i + V[i] <= K * 2)dp[i + 1][j + V[i]] += dp[i][j];
            }
        }
    }
    for(int i = 0; i < N; i++)
    {
        int now = V[i];
        int mem[5010] = {0};
        for(int j = 0; j <= K; j++)
        {
            if(j == K)ans++;
            if(dp[N][j] - mem[j] > 0 && dp[N][j + now] > 0)
            {
                mem[j + now] += dp[N][j] - mem[j];
                mem[j] += dp[N][j] - mem[j];
                if(j >= K - now)
                {
                    break;
                }

            }
        }
    }
    printf("%d\n",ans);
}


Compiler output:
/tmp/cc44Qukr.s: Assembler messages:
/tmp/cc44Qukr.s: Fatal error: can't fill 256 bytes in section .data of /tmp/ccJOdwFz.o: 'No space left on device'
/tmp/cc44Qukr.s: Fatal error: /tmp/ccJOdwFz.o: No such file or directory
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; i++)

int main () {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  ll sum = 0;
  rep(i,n) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a.begin(), a.end());

  if(sum < k) {
    cout << n << endl;
    return 0;
  }

  vector<int> can(k,0);
  can[0] = 1;

  for(int i = n - 2; i >= 0; i--) {
    for(int l = k - 1; l >= 0; l--) {
      if(can[l] && l + a[i+1] < k) can[l+a[i+1]] = 1;
    }

    if((i != 0 && a[i] == a[i-1]) || k - a[i] <= 0) continue;
    bool nec = false;
    for(int j = k - a[i]; j < k; j++) {
      if(can[j]) nec = true;
    }
    if(!nec) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  out << 0 << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:3: error: 'out' was not declared in this scope
   40 |   out << 0 << endl;
      |   ^~~
Language: C++

#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

bool f(int pos, int k, vector<int> card)
{
	const int prev = card[pos];
	card[pos] = 0;

	const int size = card.size();
	vector<vector<bool>> table(size+1, vector<bool>(k+1, false));
	table[0][0] = true;

	for(int i=0; i<size; i++)
	{
		for(int j=0; j<k+1; j++)
		{
			if(table[i][j] == false)
				continue;

			table[i+1][j] = table[i][j];

			int n = j + card[i];
			if(n > k)
				continue;

			table[i+1][n] = true;
		}
	}

	bool flag = false;
	for(int i=max(0, k-prev); i<k; i++)
		if(table[size][i] == true)
			flag = true;

	return flag;
}

int main(void)
{
	int N, K;
	cin >> N >> K;

	vector<int> a(N);
	for(int i=0; i<N; i++)
		cin >> a[i];

	vector<bool> cnt(N);
	for(int i=0; i<N; i++)
		cnt[i] = f(i, K, a);

	cout << count(cnt.begin(), cnt.end(), false) << endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:54:17: error: 'count' was not declared in this scope; did you mean 'cnt'?
   54 |         cout << count(cnt.begin(), cnt.end(), false) << endl;
      |                 ^~~~~
      |                 cnt
Language: C++

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int N, K, a[5010];
bool dp[5010][5010];

// 必要ならば true
bool d(int x) {
    if(a[x] > K) return true;
    memset(dp, false, sizeof(dp));
    dp[0][0] = true;
    rep(i,0,N) repq(j,0,K) {
        dp[i+1][j] |= dp[i][j];
        if(i != x) dp[i+1][min(K, j+a[i])] |= dp[i][j];
    }
    bool ret = false;
    rep(i,max(0LL, K-a[x]),K) {
        ret |= dp[N][i];
    }
    return ret;
}

signed main() {
    cin >> N >> K;
    rep(i,0,N) cin >> a[i];
    if(accumulate(a, a+N, 0LL) < K) {
        cout << N << endl;
        return 0;
    }
    sort(a, a+N);

    int lb = 0, ub = N+1;
    while(ub - lb > 1) {
        int mid = (ub + lb) / 2;
        if(d(mid)) ub = mid;
        else lb = mid;
    }
    cout << ub << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:91:8: error: 'accumulate' was not declared in this scope
   91 |     if(accumulate(a, a+N, 0LL) < K) {
      |        ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll sum;
bool dp[5005][5005];
int N,K;
int a[5005];
int main() {
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if(sum < K) {
    cout << N <<endl; return 0;
  }
  sort(a,a+N,greater<int>());

  int l = 0;
  int r = N+1;
 
  while(r - l > 1) {
    for(int i = 0; i <= N; i++) fill(dp[i],dp[i]+N+1,false);
    dp[0][0] = true;
    int mid = (l+r) / 2;
    if(a[mid] > K) {
      l = mid
	continue;
    }
    int tmp = a[mid];
    a[mid] = 0;
    for(int i = 0; i < N; i++) {
      for(int j = K-1; j >= 0; j--) {
	if(dp[i][j] && j + a[i] < 5005) {
	  dp[i+1][j+a[i]] = dp[i][j+a[i]] = dp[i][j];
	  dp[i+1][j] = dp[i][j];
	}
      }
    }
    a[mid] = tmp;
    bool there = false;
    for(int i = K - tmp; i < K; i++) {
      if(dp[N][i]) {
	there = true;
	break;
      }
    }
    if(there) l = mid;
    else r = mid;
    // cout <<r<<endl;
  }

  cout << N - r <<endl;
}
  


Compiler output:
a.cc: In function 'int main()':
a.cc:28:14: error: expected ';' before 'continue'
   28 |       l = mid
      |              ^
      |              ;
   29 |         continue;
      |         ~~~~~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;

int N, K, a[5000];

bool C(int idx) {
    vector<vector<bool> > dp(N+1, vector<bool>(K+1, false));
    dp[0][0] = true;
    for(int i=0; i<N; i++) {
        for(int j=0; j<=K; j++) {
            if(dp[i][j]) {
                dp[i+1][j] = true;
                if(i != idx && j + a[i] <= K) dp[i+1][j+a[i]] = true;
            }
        }
    }
    for(int j=K-a[idx]; j<K; j++) {
        if(dp[N][j]) return true;
    }
    return false;
}

int main() {
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> a[i];
    sort(a, a+N, greater<int>());
    int l = 0, h = N + 1;
    while(h - l > 1) {
        int m = (l + h) / 2;
        if(C(m-1)) l = m;
        else h = m;
    }
    cout << N - l << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |     sort(a, a+N, greater<int>());
      |     ^~~~
      |     short
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] a = new int[N];
    for(int i = 0; i < N; i++) {
      a[i] = sc.nextInt();
    }
    Arrays.sort(a);
    int ans = -1;
    int left = 0;
    int right = N;
    while(left < right) {
      int med = (left + right) / 2;
      if(a[med] < K) {
        // dp[i][j]はカードiまででカードmedを使わずに総和をjと出来るかを表す
        boolean[][] dp = new boolean[N][K];
        dp[0][0] = true;
        if(med != 0) dp[0][a[0]] = true;
        for(int i = 1; i < N; i++) {
          dp[i][0] = true;
          for(int j = 1; j < K; j++) {
            if(med != i) {
              if(a[i] <= j) {
                dp[i][j] = (dp[i - 1][j] == 1) || (dp[i - 1][j - a[i]] == 1);
              } else {
                dp[i][j] = dp[i - 1][j];
              }
            } else {
              dp[i][j] = dp[i - 1][j];
            }
          }
        }
        boolean flg = false;
        for(int j = K - a[med]; j < K; j++) {
          if(dp[N - 1][j]) flg = true;
        }
        if(flg) {
          right = med;
        } else {
          ans = med;
          right = med + 1;
        }
      } else {
        right = med;
      }
    }
    ans++;
    System.out.println(ans);
  }
}

Compiler output:
Main.java:28: error: incomparable types: boolean and int
                dp[i][j] = (dp[i - 1][j] == 1) || (dp[i - 1][j - a[i]] == 1);
                                         ^
Main.java:28: error: incomparable types: boolean and int
                dp[i][j] = (dp[i - 1][j] == 1) || (dp[i - 1][j - a[i]] == 1);
                                                                       ^
2 errors
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using vb = vector<bool>;
using vvb = vector<vb>;

int solve(long long N, long long K, vector<long long> &as);
int solve_core(long long K, vector<long long> &as);
void fill_dp(long long K, const vector<long long> &as, vvb & dp);
bool is_necessary(long long a, long long K, const vb &dpf, const vb &dpb);


int main() {
    long long N, K;
    cin >> N >> K;
    vector<long long> as(N, 0);
    for (auto & a : as) cin >> a;
    cout << solve(N, K, as) << endl;
    return 0;
}

int solve(long long N, long long K, vector<long long> &as){
    if (N == 1) return (as[0] >= K) ? 0 : 1;
    long long total = accumulate(as.begin(), as.end(), 0);
    if (total < K) return N;
    vector<long long> subset;
    for (auto a : as) if (a < K) subset.push_back(a);
    return solve_core(K, subset);
}


int solve_core(long long K, vector<long long> &as){
    int N = as.size();
    vector<vector<bool>> dpf(N + 1, vector<bool>(K, false));  // dpf[n][k] as[:n] の部分和を k にできるか否か
    vector<vector<bool>> dpb(N + 1, vector<bool>(K, false));  // dpb[n][k] as[n:] の部分和を k にできるか否か
    fill_dp(K, as, dpf);
    reverse(as.begin(), as.end());
    fill_dp(K, as, dpb);
    reverse(dpb.begin(), dpb.end());
    reverse(as.begin(), as.end());
    int ans = 0;
    for (int n = 0; n != N; ++n){
        if (not is_necessary(as[n], K, dpf[n], dpb[n + 1])) ++ans;
    }
    return ans;
}

void fill_dp(long long K, const vector<long long> &as, vvb &dp){
    // dp[n][k] as[:n] を用いて 部分和を k とできれば true できなければ false
    int n = 0;
    dp[0][0] = true;
    for (const auto a : as){
        ++n;
        dp[n] = dp[n - 1]; // 値がコピーされているのか？
        for (auto k = K - 1; k >= a; --k){
            if (dp[n - 1][k - a]) dp[n][k] = true;
        }
    }
}

bool is_necessary(long long a, long long K, const vb &dpf, const vb &dpb){
    // a が必要であるかどうか判断する。
    // dpf[k] as[:n] の部分和を k にできれば true, できなければ false
    // dpb[k] as[n+1:] の部分和を k にできれば true, できなければ false
    // 尺取り法の要領で、
    // K > k1 + k2 >= K - a && dpf[k1] && dpf[k2] となる k1, k2 があれば true, なければ false を返す。
    long long k2 = K - 1;
    for (long long k1 = 0; k1 < K; ++k1){
        if (not dpf[k1]) continue;
        while (k1 + k2 >= K) --k2;
        while (k2 >= 0 and k1 + k2 >= K - a) {
            if (dpb[k2]) return true;
            --k2;
        }
    }
    return false;
}


Compiler output:
a.cc: In function 'int solve(long long int, long long int, std::vector<long long int>&)':
a.cc:25:23: error: 'accumulate' was not declared in this scope
   25 |     long long total = accumulate(as.begin(), as.end(), 0);
      |                       ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define print(x) cout<<x<<endl;

int n, k;
int a[5002];
int ans;
bool is;

int main() {
	cin >> n >> k;
	rep(i, 0, n)cin >> a[i];
	sort(a, a + n);

	int l = 0, r = n;
	while(r>l){
		int s = (l + r) / 2;
		if (a[s] > k)continue;

		is = false;
		bool dp[5002][5002] = {};
		dp[0][0] = true;
		if (s > 0)dp[0][a[0]] = true;
		rep(i, 1, n) {
			rep(j, 0, k) {
				dp[i][j] = dp[i - 1][j] || dp[i-1][j - a[i]]];
			}
		}
		rep (m, k - a[s], k) {
			if (dp[n - 1][m]) { is = true; break; }
		}
		if (is)r = s;
		else l = s + 1;
	}
	print(r);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:77: error: expected ';' before ']' token
   27 |                                 dp[i][j] = dp[i - 1][j] || dp[i-1][j - a[i]]];
      |                                                                             ^
      |                                                                             ;
Language: C++

def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
def na(n,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
def bit(n) n.to_s(2).split("").map(&:to_i) end
def inp() a=gets.to_s.chomp.split(" ").map{|u|u.to_i}; return a end
def sum(a) ans = 0;a.each{|d|ans+=d} ;return ans end
n,k = inp
a =inp
dp = na2(k+1,2,0)
sum = sum(a)
sort = a.sort{|a,b| b<=>a}
if(sum < k)
  puts n
  exit
elsif(sum == k)
  puts 0
  exit
end
ans = Array.new(0,0)
c = 0
x = 0
h = {0 => 0}
dp[0][0] = 1
sort.each.with_index do |d,i|
  ku = i %2
  ti = (i+1)%2
  (k+1).times do |dd|
    if(dp[dd][ku] == 1)
      dp[dd][ti] = 1
      if(dd+d<k)
        dp[dd + d][ti] = 1
      else
        ans = d
      end
    end
  end
end
t = a.sort.index(ans).to_s.to_i
p (t )

Compiler output:
a.cc:5:28: error: too many decimal points in number
    5 | def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
      |                            ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end
      | ^~~
a.cc:6:29: error: 'a' does not name a type
    6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
      |                             ^
a.cc:6:48: error: expected unqualified-id before 'return'
    6 | def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end
      |                                                ^~~~~~
a.cc:8:46: error: 'end' does not name a type
    8 | def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
      |                                              ^~~
a.cc:9:62: error: 'end' does not name a type
    9 | def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
      |                                                              ^~~
a.cc:11:56: error: expected unqualified-id before 'return'
   11 | def inp() a=gets.to_s.chomp.split(" ").map{|u|u.to_i}; return a end
      |                                                        ^~~~~~
a.cc:12:20: error: 'a' does not name a type
   12 | def sum(a) ans = 0;a.each{|d|ans+=d} ;return ans end
      |                    ^
a.cc:12:39: error: expected unqualified-id before 'return'
   12 | def sum(a) ans = 0;a.each{|d|ans+=d} ;return ans end
      |                                       ^~~~~~
a.cc:18:1: error: expected unqualified-id before 'if'
   18 | if(sum < k)
      | ^~
a.cc:29:1: error: 'dp' does not name a type
   29 | dp[0][0] = 1
      | ^~
Language: C++

#include <iostream>

#define lli long long int
#define DEBUG 0

using namespace std;

lli show(lli *a,lli num){
	for(lli i=0;i<num;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}

lli solve(lli *a,lli index,lli n,lli k){

	lli dp[n+1][k];
	for(lli i=0;i<=n;i++){
		for(lli j=0;j<k;j++){
			if(j==0){
				dp[i][j]=1;
			}else{
				dp[i][j]=0;
			}
		}
	}

	for(lli i=0;i<n;i++){
		for(lli j=0;j<k;j++){
			if(dp[i][j]==1){
				if(j+a[i]<k && i!=index){
					dp[i+1][j+a[i]]=1;
				}
				dp[i+1][j]=1;
			}
		}
		if(DEBUG)cout<<"index="<<index<<endl;
		if(DEBUG)cout<<"i="<<i<<endl;
		if(DEBUG)show(dp[i+1],k);
	}

	for(lli i=k-a[index];i<k;i++){
		if(dp[n][i]==1){
			return 1;
		}
	}

	return 0;

}

lli main(){

	lli n,k;
	lli *a;

	cin>>n>>k;

	if(n>=5001||k>=5001){
		return 0;
	}

	a = new lli[n];

	for(lli i=0;i<n;i++){
		cin>>a[i];
	}
	lli ans=n;
	for(lli i=0;i<n;i++){
		ans -= solve(a,i,n,k);
	}

	cout<<ans<<endl;

/*
	if(ans!=0){
		cout<<ans<<endl;
	}
	else{
		cout<<n<<endl;
	}
*/
	return 0;
	





}

Compiler output:
a.cc: In function 'long long int show(long long int*, long long int)':
a.cc:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
   13 | }
      | ^
a.cc: At global scope:
a.cc:3:23: error: '::main' must return 'int'
    3 | #define lli long long int
      |                       ^~~
a.cc:52:1: note: in expansion of macro 'lli'
   52 | lli main(){
      | ^~~
Language: C++

#include <iostream>

#define lli long long lli
#define DEBUG 0

using namespace std;

lli show(lli *a,lli num){
	for(lli i=0;i<num;i++){
		cout<<a[i]<<" ";
	}
	cout<<endl;
}

lli solve(lli *a,lli index,lli n,lli k){

	lli dp[n+1][k];
	for(lli i=0;i<=n;i++){
		for(lli j=0;j<k;j++){
			if(j==0){
				dp[i][j]=1;
			}else{
				dp[i][j]=0;
			}
		}
	}

	for(lli i=0;i<n;i++){
		for(lli j=0;j<k;j++){
			if(dp[i][j]==1){
				if(j+a[i]<k && i!=index){
					dp[i+1][j+a[i]]=1;
				}
				dp[i+1][j]=1;
			}
		}
		if(DEBUG)cout<<"index="<<index<<endl;
		if(DEBUG)cout<<"i="<<i<<endl;
		if(DEBUG)show(dp[i+1],k);
	}

	for(lli i=k-a[index];i<k;i++){
		if(dp[n][i]==1){
			return 1;
		}
	}

	return 0;

}

lli main(){

	lli n,k;
	lli *a;

	cin>>n>>k;

	if(n>=5001||k>=5001){
		return 0;
	}

	a = new lli[n];

	for(lli i=0;i<n;i++){
		cin>>a[i];
	}
	lli ans=n;
	for(lli i=0;i<n;i++){
		ans -= solve(a,i,n,k);
	}

	cout<<ans<<endl;

/*
	if(ans!=0){
		cout<<ans<<endl;
	}
	else{
		cout<<n<<endl;
	}
*/
	return 0;
	





}

Compiler output:
a.cc:8:5: error: expected initializer before 'show'
    8 | lli show(lli *a,lli num){
      |     ^~~~
a.cc:15:5: error: expected initializer before 'solve'
   15 | lli solve(lli *a,lli index,lli n,lli k){
      |     ^~~~~
a.cc:52:5: error: expected initializer before 'main'
   52 | lli main(){
      |     ^~~~
Language: Java

import java.util.Scanner;
import java.util.Arrays;

public class Sub{
  static int n, k;
  static int[] a;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    n = sc.nextInt();
    k = sc.nextInt();
    a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    int count = 0;
    for(int i = 0; i < n; i++){
      if(a[i] >= k){
        ++count;
      }
    }

    int[] b = new int[n - count];
    int m = 0;
    for(int i = 0; i < n; i++){
      if(a[i] < k){
        b[m++] = a[i];
      }
    }

    int ans = 0;
    for(int i = 0; i < m; i++){
      if(!check(i, b)){
        ++ans;
      }
    }

    System.out.println(ans);
  }

  private static boolean check(int index, int[] b){
    int[] c = new int[b.length - 1];
    int m = 0;
    for(int i = 0; i < b.length; i++){
      if(i != index){
        c[m++] = b[i];
      }
    }

    boolean[][] dp = new boolean[m + 1][400 * 400 + 1];
    dp[0][0] = true;
    for(int i = 1; i <= m; i++){
      for(int j = 0; j < dp[i].length; j++){
        if(j - c[i - 1] >= 0){
          dp[i][j] = dp[i - 1][j] || dp[i - 1][j - c[i - 1]];
        }
        else{
          dp[i][j] = dp[i - 1][j];
        }
      }
    }

    for(int s = k - b[index]; s < k; s++){
      if(dp[m][s]){
        return true;
      }
    }

    return false;
  }
}

Compiler output:
Main.java:4: error: class Sub is public, should be declared in a file named Sub.java
public class Sub{
       ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

class NoNeed
{
private:
	int n, k;
	int sum;
	vector<vector<bool> > l_dp;
	vector<vector<bool> > r_dp;
	vector<int> a;
public:
	NoNeed(){
		cin >> n >> k;
		a.resize(n);
		sum = 0;
		for (int i = 0; i < n; ++i)
		{
			cin >> a[i];
			sum += a[i];
		}
		l_dp = vector<vector<bool> >(n, vector<bool>(k+1, false));
		r_dp = vector<vector<bool> >(n, vector<bool>(k+1, false));
	}

	bool is_valid(int med){
		if(a[med] >= k){
			return true;
		}

		for (int i = k - a[med]; i < k; ++i)
		{
			if(med == 0){
				if(r_dp[1][i]) return true;;
				break;
			}

			if(med == n-1){
				if(l_dp[n-2][i]) return true;
				break;
			}

			for (int j = 0; j <= i; ++j)
			{
				if(l_dp[med-1][j] && r_dp[med+1][i-j]){
					return  true;
				}
			}
		}
		return false;
	}

	void set_dp(){
		l_dp[0][0] = true;
		l_dp[0][a[0]] = true;
		for (int i = 1; i < n; ++i)
		{
			for (int j = 0; j <= k; ++j)
			{
				if(l_dp[i-1][j] || (j - a[i] >= 0 && l_dp[i-1][j - a[i]]) ){
					l_dp[i][j] = true;
				}
			}
		}
		r_dp[n-1][0] = true;
		r_dp[n-1][a[n-1]] = true;
		for (int i = n-2; i >= 0; --i)
		{
			for (int j = 0; j <= k; ++j)
			{
				if(r_dp[i+1][j] || (j -  a[i] >= 0 && r_dp[i+1][j - a[i]]) ){
					r_dp[i][j] = true;
				}
			}
		}

	}

	void exec(){
		sort(a.begin(), a.end());
		if(sum < k){
			cout << n << endl;
			return;
		}

		if(n == 1){
			cout << 0 << endl;
			return;
		}

		set_dp();
		int left = 0;
		int right = n-1;
		int ans = 0;
		while(left < right){
			int med = (left + right) / 2;
			if(is_valid(med)){
				right = med;
			}else{
				left = med + 1;
				ans = left
			}
		}
		cout << ans + 1 << endl;
	}
};


int main(){
	NoNeed nn = NoNeed();
	nn.exec();
}

Compiler output:
a.cc: In member function 'void NoNeed::exec()':
a.cc:106:25: error: expected ';' before '}' token
  106 |                         }
      |                         ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <random>
#include <deque>

#define INF_LL 1e18
#define INF 1e9

#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()

using namespace std;

using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;

const ll MOD = 1e9+7;

int dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
int dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

template<typename T>
void chmax(T &a, T &b){
	a = max(a, b);
}

template<typename T>
void chmin(T &a, T &b){
	a = min(a, b);
}

class Union_find{
private:
	vector<int> par;
	vector<int> rank;
	int n;

public:
	Union_find(int a){
		n = a;
		for(int i = 0;i < n;i++){
			par.push_back(i);
			rank.push_back(0);
		}
	}

	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;

		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = x;
			if(rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y){
		return find(x) == find(y);
	}
};

class RMQ{
	int n;
	vector<int> dat;
public:
	RMQ(int n_){
		n = 1;
		while(n < n_) n *= 2;
		REP(i, n*2-1){
			dat.push_back(INF);
		}
	}

	void update(int x, int i){
		i += n-1;
		dat[i] = x;
		while(i > 0){
			i = (i-1)/2;
			dat[i] = min(dat[i*2+1], dat[i*2+2]);
		}
	}

	int query(int a, int b, int l, int r, int x){
		if(a <= l && r <= b) return dat[x];
		if(r <= a || b <= l) return INF;

		int res = INF;
		res = min(query(a, b, l, (l+r)/2, x*2+1), query(a, b, (l+r)/2, r, x*2+2));
		return res;
	}
	int query(int a, int b){
		return query(a, b, 0, n, 0);
	}
};

const ll mod = 1e9+7;

int N, K;
vector<ll> a;
bool dp[5050][5050] = {};

bool ok(ll in){
	memset(dp, 0, sizeof(dp));
	dp[0][0] = true;
	REP(i, N){
		dp[i][0] = true;
		REP(j, K+1) dp[i+1][j] = dp[i][j];
		REP(j, K+1){
			if(i != in){
				if(dp[i][j]){
					if(j+a[i] <= K)
						//dp[i+1][j+a[i]] = true;
				}
			}
		}
	}
	FOR(i, K-a[in], K){
		if(dp[N][i]){
			return true;
		}
	}
	return false;
}

int main(void){
	cin >> N >> K;
	REP(i, N){
		int A;
		cin >> A;
		a.push_back(A);
	}
	int l = 0, r = N, m;
	sort(all(a));
	while(r-l > 1){
		m = (l+r)/2;
		if(ok(m)){
			r = m;
		}else{
			l = m;
		}
	}
	if(!ok(m)){
		cout << m+1 << endl;
	}else{
		cout << m << endl;
	}
}


Compiler output:
a.cc: In function 'bool ok(ll)':
a.cc:138:33: error: expected primary-expression before '}' token
  138 |                                 }
      |                                 ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

ll dp[5050][5050];

int main(){
	ll n,k,ans=0;
	cin>>n>>k;
	vector<ll>a(n);
	//入力
	rep(i,n)cin>>a[i];

	sort(all(a));

	rep(s,n){
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		rep(i,n+1){
			rep(j,k+1){
				dp[i+1][j]+=dp[i][j];
				if(j+a[i]<=k&&i!=s){
					dp[i+1][j+a[i]]+=dp[i][j];
				}
			}
		}
		FOR(j,max(k-a[s],0ll),k){
			if(dp[n+1][j]){
				ans++;
				break;
			}
		}
	}
	cout<<n-ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:17: error: 'memset' was not declared in this scope
   40 |                 memset(dp,0,sizeof(dp));
      |                 ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <queue>
  +++ |+#include <cstring>
   11 | #include <time.h>
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

ll dp[5050][5050];

int main(){
	ll n,k,ans=0;
	cin>>n>>k;
	vector<ll>a(n);
	//入力
	rep(i,n)cin>>a[i];

	sort(all(a));

	rep(s,n){
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		rep(i,n+1){
			rep(j,k+1){
				dp[i+1][j]+=dp[i][j];
				if(j+a[i]<=k&&i!=s){
					dp[i+1][j+a[i]]+=dp[i][j];
				}
			}
		}
		FOR(j,max(k-a[s],0ll),k){
			if(dp[n+1][j]){
				ans++;
				break;
			}
		}
	}
	cout<<n-ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'memset' was not declared in this scope
   39 |                 memset(dp,0,sizeof(dp));
      |                 ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 | #include <time.h>
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>

using namespace std;
typedef long long ll;
#define pl pair<ll,ll>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++)
#define dbg(x) cout << #x"="<< (x) << endl
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a) 
#define in(x) cin >> x;
#define all(x) (x).begin(), (x).end()
#define INF 2147483600
#define fi first
#define se second

ll dp[5050][5050];

int main(){
	ll n,k,ans=0;
	cin>>n>>k;
	vector<ll>a(n);
	//入力
	rep(i,n)cin>>a[i];

	sort(all(a));

	rep(s,n){
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		rep(i,n+1){
			rep(j,k+1){
				dp[i+1][j]+=dp[i][j];
				if(j+a[i]<=k&&i!=s){
					dp[i+1][j+a[i]]+=dp[i][j];
				}
			}
		}
		FOR(j,k-a[s],k){
			if(dp[n+1][j]){
				ans++;
				break;
			}
		}
	}
	cout<<n-ans<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'memset' was not declared in this scope
   39 |                 memset(dp,0,sizeof(dp));
      |                 ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    9 | #include <queue>
  +++ |+#include <cstring>
   10 | #include <time.h>
Language: C++

#include <bits/stdc++.h>

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; --i)
typedef long long ll;
typedef long double ld;

using namespace std;

void solve(ll N, ll K, vector<ll> a){
    ll ans = 0;
    vector<ll> dp(K + 1);
    dp[0] = 1;
    rep(i, N) {
        rep(j, N) {
            if (i == j) continue;
            rep(k, a[j]) {
                if (K - k - 1 >= 0) dp[K] += dp[K - k - 1];
            }
            rrep(k, K) {
                if (k - a[j] >= 0) dp[k] = dp[k] + dp[k - a[j]];
            }
        }
        ll hoge = 0;
        rep(k, a[i]) {
            if (K - k - 1 >= 0) hoge += dp[K - k - 1];
        }
        if (hoge == 0) ans++;
        fill(dp.begin(), dp.end(), 0);
        dp[0] = 1;
    }
    cout << ans << endl;

}

int main(){
    // 提出時は削除 //////////////////////////////
	FILE* fp_in = //freopen("/Users/kokinakamura/git/ToolsForAtCoder/workspace/abc056/D/in_D_3.txt", "r", stdin);
    ////////////////////////////////////////////

	ll N;
	ll K;
	scanf("%lld",&N);
	vector<ll> a(N-1+1);
	scanf("%lld",&K);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&a[i]);
	}
	solve(N, K, a);

    // 提出時は削除 //////////////////////////////
 //   fclose(fp_in);
    ////////////////////////////////////////////
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:12: error: expected primary-expression before 'N'
   41 |         ll N;
      |            ^
a.cc:43:23: error: 'N' was not declared in this scope
   43 |         scanf("%lld",&N);
      |                       ^
Language: C++

#include <bits\stdc++.h>
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
#define reps(i,j,N) for(LL i=j;i<N;++i)
typedef long long int LL;
typedef std::pair<int, int> P;

int N, K, a[5112];
int ans;

int main()
{
	in >> N >> K;
	rep(i, N) { in >> a[i]; }

	LL sum;
	std::sort(a, a + N, std::greater<int>());
	rep(i, N)
	{
		sum = 0;
		reps(j, i, N)
		{
			sum += a[j];
			if (sum >= K)
			{
				ans = std::max<LL>(ans, j + 1);
				sum -= a[j];
			}
		}
	}
	ans = N - ans;

	out << ans << std::endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include "bits\stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
#define reps(i,j,N) for(LL i=j;i<N;++i)
typedef long long int LL;
typedef std::pair<int, int> P;

int N, K, a[5112];
int ans;

int main()
{
	in >> N >> K;
	rep(i, N) { in >> a[i]; }

	LL sum;
	std::sort(a, a + N, std::greater<int>());
	rep(i, N)
	{
		sum = 0;
		reps(j, i, N)
		{
			sum += a[j];
			if (sum >= K)
			{
				ans = std::max<LL>(ans, j + 1);
				sum -= a[j];
			}
		}
	}
	ans = N - ans;

	out << ans << std::endl;
	return 0;
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include "bits\stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
  int N,K;
  cin >> N >> K;
  vector<long long int>A(N);
  for(int i=0; i < N; i++)
    cin >> A[i];
  vector<vector<bool> >dp(N,vector<bool>(K));
  int ans = 0;
  for(int i=0; i < N; i++){
    long long int ai = A[i];
    A[i] = 0;
    for(int y=0; y < K; y++){
      if(A[0]==y)
	dp[0][y] = true;
      else
        dp[0][y] = false;
    }
    for(int x=0; x < N; x++){
      dp[x][0] = true;
    }
    for(int x=1; x < N; x++){
      for(int y=1; y < K; y++){
	if(y-A[x] >= 0 && A[x] > 0)
	  dp[x][y] = dp[x-1][y-A[x]];
	if(dp[x][y] != true) dp[x][y] = dp[x-1][y];
	}
      }
    }
    bool need = false;
    int s;
    if(K < ai) s = 0;
    else s = K-ai;
    for(int a=s; a < K; a++){
      if(dp[N-1][a]){
        need = true;
        break;
      }
    }
    if(need == false) ans++;
    A[i] = ai;
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:12: error: 'ai' was not declared in this scope
   41 |     if(K < ai) s = 0;
      |            ^~
a.cc:50:7: error: 'i' was not declared in this scope
   50 |     A[i] = ai;
      |       ^
a.cc:50:12: error: 'ai' was not declared in this scope
   50 |     A[i] = ai;
      |            ^~
a.cc: At global scope:
a.cc:52:3: error: 'cout' does not name a type
   52 |   cout << ans << endl;
      |   ^~~~
a.cc:53:3: error: expected unqualified-id before 'return'
   53 |   return 0;
      |   ^~~~~~
a.cc:54:1: error: expected declaration before '}' token
   54 | }
      | ^
Language: C++

#include<stdio.h>
#include<stdlib.h>

void main()
{
  int N;
  int K;
  unsigned long long a[5000];
  int i;
  int j;
  unsigned long long maxsum=0;
  unsigned long long *sets;
  unsigned long long sum[5000];
  unsigned long long temp;
  unsigned long long necessary[5000];
  int necessarycount=0;
  int unnecessary=0;
  scanf("%d %d",&N,&K);
  sets = (unsigned long long*) malloc (K);
  for(i=0; i<N;i++) 
  {
          scanf("%llu",&a[i]);
          maxsum+=a[i];
  }
  if(maxsum<K){  
          // all cards are unnecessary since cannot get full sum
          printf("%d\n",N);
  }else{
          if(maxsum==K){
                  // all cards are necessary since need them to get full sum
                  printf("0\n");
          }else{
                  // find possible subsets of cards
                  for(i=0; i<N; i++){
                          sum[i]=maxsum;
                          necessary[i]=0;
                  }
                  for(i=0; i<N; i++){
                          for(j=0; j<N; j++) {
                                  temp = a[(i+j)%N];
                                  if((sum[i]-temp)>=K)
                                  {
                                          sum[i]=sum[i]-temp;
                                          sets[i*N+j]=0;
                                  }else{
                                          sets[i*N+j]=temp;
                                  }
                          }
                  }
                  for(i=0;i<N;i++){
                          for(j=0;j<N;j++){
                                  if(necessary[(i+j)%N]<sets[i*N+j])
                                  {
                                          necessary[(i+j)%N]=sets[i*N+j];
                                          necessarycount++;
                                  }
                          }
                  }
                  unnecessary=N-necessarycount;
                  printf("%d\n",unnecessary);
          }
  }
free (sets);
}

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | void main()
      | ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
long long a[5001];
int main()
{
	long long N,M,K,i,j,s,ans;
	scanf("%lld%lld",&N,&K);
	for(i=0; i<N; i++)
		scanf("%d",&a[i]);
	sort(a,a+N);
	ans=0,s=0;
	for(i=N-1; i>=0; i--)
	{
		s+=a[i];
		ans++;
		if(s>=K)
		{
			s=0,ans=0;
			while(a[i]==a[i-1]&&i>0)
				i--;
			if(i==0)
				ans=0;
            
	}
	printf("%lld\n",ans);
	return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: expected '}' at end of input
   30 |  }
      |   ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
long long a[5001];
int main()
{
	long long N,M,K,i,j,s,ans;
	scanf("%lld%lld",&N,&K);
	for(i=0; i<N; i++)
		scanf("%d",&a[i]);
	sort(a,a+N);
	ans=0,s=0;
	for(i=N-1; i>=0; i--)
	{
		s+=a[i];
		ans++;
		if(s>=K)
		{
			s=0,ans=0;
			while(a[i]==a[i-1]&&i>0)
				i--;
			if(i=0)
				ans=0;
            
	}
	printf("%lld\n",ans);
	return 0;
 }


Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: expected '}' at end of input
   30 |  }
      |   ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
long long int n,k,i,sum=0,plus=0,ans=0;
cin>>n>>k;
vector<int>A;
int AA[n];
for(i=0;i<n;i++){
    cin>>AA[i];
    A.push_back(AA[i]);
}
sort(A.begin(), A.end() );

for(i=0;i<A.size;i++)sum+=A[i];
for(i=0;i<A.size;i++){
    sum-=A[i];
    if(sum<n)break;
    ans++;
}
cout<<ans<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   16 | for(i=0;i<A.size;i++)sum+=A[i];
      |           ~~^~~~
      |                 ()
a.cc:17:13: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   17 | for(i=0;i<A.size;i++){
      |           ~~^~~~
      |                 ()
Language: C

#include <stdio.h>
#include <stdlib.h>

int main()
{   
    int N,K,a[5000],b;
    scanf("%d %d",&N,&K);
    b=N;
    for(i=0;i<N;i++)
    {
        scanf("%d",a[i]);
        c+=a[i];
    }
    while(c>=K)
        for(i=1;i<=N;i++)
        for(j=)
        
}

Compiler output:
main.c: In function 'main':
main.c:9:9: error: 'i' undeclared (first use in this function)
    9 |     for(i=0;i<N;i++)
      |         ^
main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:9: error: 'c' undeclared (first use in this function)
   12 |         c+=a[i];
      |         ^
main.c:16:13: error: 'j' undeclared (first use in this function)
   16 |         for(j=)
      |             ^
main.c:16:15: error: expected expression before ')' token
   16 |         for(j=)
      |               ^
main.c:16:15: error: expected expression before ')' token
main.c:18:1: error: expected expression before '}' token
   18 | }
      | ^
Language: C++

#include <iostream>
#include <queue>
#include <map>
#include <queue>
#include <cmath>
using namespace std;
const int maxn = 5010;
long long save[maxn];
long long sum[maxn][maxn];
int main(){
    int n,i,j;
    long long k;
    scanf("%d%lld",&n,&k);
    for(i=1;i<=n;i++){
        scanf("%lld",&save[i]);
    }
    sort(save+1, save+1+n);
    long long now = 0;
    for(i=1;i<=n;i++){
        now += save[i];
        if(now>=k){
            break;
        }
    }
    bool flag = true;
    if(now>=k){
        for(i=1;now>=k;i++){
            now -= save[i];
        }
        cout<<i-2<<endl;
        flag = false;
    }
    if(flag){
        cout<<n<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   17 |     sort(save+1, save+1+n);
      |     ^~~~
      |     sqrt
Language: C++

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Yulian
 */

#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>


#include <iostream>

#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>



#include <assert.h>


using namespace std;

class D {
public:
  void rec(vector<int> &a, int k, int s, vector<bool> &g) {
//    int s = accumulate(v.begin(), v.end(), 0);
//    int s = accumulate(v.begin(), v.end(), 0);
    int tmp;
    for (int i = 0; i < a.size(); ++i) {
      if (a[i] != 0) {
        tmp = a[i];
        if (s - tmp < k) {
          g[i] = g[i] || s >= k;
        } else {
          a[i] = 0;
          rec(a, k, s - tmp, g);
          a[i] = tmp;
        }
      }
    }
  }

  void solve(std::istream &in, std::ostream &out) {
    int n, k, res, sum = 0;
    in >> n >> k;
    vector<int> a(n);
    vector<bool> b(n, false);
    for (int i = 0; i < n; ++i) {
      in >> a[i];
    }
    rec(a, k, accumulate(a.begin(), a.end(), 0), b);
    for (const auto &el : b) {
      if (!el) {
        ++res;
      }
    }
    out << res << endl;
  }
};


int main() {
	D solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Compiler output:
a.cc: In member function 'void D::solve(std::istream&, std::ostream&)':
a.cc:67:15: error: 'accumulate' was not declared in this scope
   67 |     rec(a, k, accumulate(a.begin(), a.end(), 0), b);
      |               ^~~~~~~~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;

int a[5500];

int main()
{
	int n, k;
	memset(a, 0, sizeof(a));
	long long sum = 0;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		sum += a[i];
	}
	if (sum < k)
	{
		cout << n << endl;
	}
	else
	{
		sort(a, a + n);
		if (a[0] >= k)
			cout << 0 << endl;
		else
		{
			int ans;
			int tot = 0, tt = 0;
			for (int i = n - 1; i >= 0; i--)
			{
				if (a[i] >= k)
				{
					tt++;
					continue;
				}
				tot += a[i];
				if (tot >= k)
				{
					ans = i;
					if ((i > 0) && (a[i - 1] == a[i]))
					{
						for (int j = i;; j--)
						{
							if (a[j] == a[i])
								continue;
							if (a[j] < a[i])
							{
								ans = j+1;
								break;
							}
						}
					}
					break;
				}
			}
			if (tot < k)
				ans = n - tt;
			cout << ans << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'memset' was not declared in this scope
   10 |         memset(a, 0, sizeof(a));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | using namespace std;