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

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

int main() {
    int N;
    cin >> N;
    vector<pair<int,int> > P(N);
    for (auto &i : P) cin >> i.first >> i.second;

    int l = 0, r = N + 1;
    while (r - l > 1) {
        int m = (r + l) / 2;
        int count = 0;
        for (int i = 0; i < N; i++) {
            if (P[i].first > m + 1 || P[i].second < m + 1) {
                count++;
            }
        }
        if (m <= N - count) {
            l = m;
        } else {
            r = m;
        }
    }

    cout << l << endl;

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

int main() {
    int N;
    cin >> N;
    vector<pair<int,int> > P(N);
    for (auto &i : P) cin >> i.first >> i.second;

    int l = 0, r = N + 1;
    while (r - l > 1) {
        int m = (r + l) / 2;
        int count = 0;
        for (int i = 0; i < N; i++) {
            if (P[i].first > m + 1 || P[i].second < m + 1) {
                count++;
            }
        }
        if (m <= N - count) {
            l = m;
        } else {
            r = m;
        }
    }

    cout << l << endl;

    return 0;
}

Compiler output:
a.cc:29:2: error: stray '#' in program
   29 | }#include <bits/stdc++.h>
      |  ^
a.cc:29:3: error: 'include' does not name a type
   29 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:32:5: error: redefinition of 'int main()'
   32 | int main() {
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main() {
      |     ^~~~
Language: C++

#include <bits/stdc++.h>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int N;
using pii = pair<int, int>;
int num[100005];

int main(){
	cin >> N;
	vector<pii> req; 
	REP(cnt, N) {
		int a, b;
		cin >> a >> b;
		num[a]++; num[b+1]--;
	}
	REP(i, N+1) num[i+1] += num[i];
	int res = 0;
	REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
	cout << max(res-1, 0) << endl;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:20: error: expected primary-expression before '?' token
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                    ^
a.cc:31:21: error: expected primary-expression before '?' token
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                     ^
a.cc:31:22: error: expected primary-expression before '?' token
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                      ^
a.cc:31:23: error: expected primary-expression before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
a.cc:31:23: error: expected ':' before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
      |                       :
a.cc:31:23: error: expected primary-expression before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
a.cc:31:23: error: expected ':' before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
      |                       :
a.cc:31:23: error: expected primary-expression before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
a.cc:31:23: error: expected ':' before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
      |                       :
a.cc:31:23: error: expected primary-expression before 'if'
   31 |         REP(i, N+1)???if(num[i]+1 > i) res = max(res, i);
      |                       ^~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)



int main(void){
	//come[i] := i???(?????????????????????)??§??????????????¨?????????????????????????????????????????°
	int come[100010];

	rep(i, 100010) come[i] = 0;//0??§?????????

	int n; scanf("%d", &n);
	rep(i, n){
		int a, b;
		scanf("%d %d", &a, &b);
		reps(j, a, b + 1){
			come[j]++;
		}
	}

	
	int ans = 0;
	rep(i, 100010){
		//???????????????????????????????????????i?????§????????°??\????????????????????????
		//come[i]????????????????????§???come[i] + 1??????i???????¶????????????????????¢??????????
		if(come[i] + 1 >= i){
			//??????????????????i?????§????????°??\??????????????¨???????????¶?????????????????§???
			//???????????\???????????????????????°???i-1???
			ans = max(asn, i - 1);
		}
	}
	printf("%d\n", --ans);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:35: error: 'asn' was not declared in this scope; did you mean 'ans'?
   47 |                         ans = max(asn, i - 1);
      |                                   ^~~
      |                                   ans
Language: C++

#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define MP make_pair
#define PII pair<int,int>

int main()
{
	int N;
	int ans = 0;
	cin >> N;
	vector <PII> friends;
	queue <PII> q;
	REP(i, N)
	{
		int t1, t2;
		cin >> t1 >> t2;
		friends.push_back(MP(t1, t2));
	}
	sort(friends.begin(), friends.end());
	REP(i, N)
	{
		if (q.empty())
		{
			q.push(friends[i]);
			ans = max(ans, int(q.size()));
		}
		else if (friends[i].first > N + 1)continue;
		else if (q.front().second < friends[i].first)
		{
			while (1)
			{
				if (q.empty())break;
				if (q.front().second >= friends[i].first)break;
				q.pop();
			}
			q.push(friends[i]);
		}
		else
		{
			q.push(friends[i]);
			ans = max(ans, int(q.size()));
		}
	}
	cout << ans - 1 << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   22 |         sort(friends.begin(), friends.end());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <cstdlib>

int main(void){
	int n;
	std::cin >> n;
	int endmax = 0;

	int* pn = new int[100000];
	memset(pn, 0, 100000 * sizeof(int));

	for(int i=0; i<n; i++){
		int beg, end;
		std::cin >> beg >> end;
		for(int i = beg; i <= end; i++) pn[i]++;
		if(end > endmax) endmax = end;
	}

	int mps = 1;
	for(int i=1; i<=endmax; i++){\
		if(pn[i]+1 >= i)mps = i;
	}

	std::cout << (mps-1) << '\n';
	return 0;
}

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

#include <iostream>
#include <stdlib.h>

int main(void){
	int n;
	std::cin >> n;
	int endmax = 0;

	int* pn = new int[100000];
	memset(pn, 0, 100000 * sizeof(int));

	for(int i=0; i<n; i++){
		int beg, end;
		std::cin >> beg >> end;
		for(int i = beg; i <= end; i++) pn[i]++;
		if(end > endmax) endmax = end;
	}

	int mps = 1;
	for(int i=1; i<=endmax; i++){\
		if(pn[i]+1 >= i)mps = i;
	}

	std::cout << (mps-1) << '\n';
	return 0;
}

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

#include <iostream>
#include <string>

using namespace std;

int a[100002], b[100002];
int cumsum[100003];

int main() {
	int N;
	cin >> N;

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

	memset(cumsum, 0, sizeof(cumsum));
	for(int i=0;i<N;i++)
	{
		cumsum[a[i]] += +1;
		cumsum[b[i] + 1] -= 1;
	}
	int ans = 0;
	for(int i=1;i<=N+1;i++)
	{
		cumsum[i] += cumsum[i - 1];
		if(cumsum[i] >= i - 1)
		{
			ans = i;
		}
	}
	cout << ans - 1 << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'memset' was not declared in this scope
   18 |         memset(cumsum, 0, sizeof(cumsum));
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | #include <string>
Language: C++

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;

    int arr[N + 1];
    memset(arr, 0, sizeof(arr));

    for (int i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;

        // 2 4
        // 1−３ 人呼んでオッケー
        if (a - 1 <= N)
            arr[a - 1]++;
        if (b <= N)
            arr[b]--;
    }

    int maxn = arr[0];
    int maxi = 0;
    for (int i = 1; i <= N; ++i) {
        arr[i] += arr[i - 1];
        if (arr[i] > maxn && arr[i] >= i) {
            maxn = arr[i];
            maxi = i;
        }
    }

    cout << maxi << endl;
}

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

#define REP(i, n) for (int i = 0; i < (n); ++i)
#include <cstdio>
#include <cstring>
int data[100002];

int main() {
  int n;
  scanf("%d", &n);

  memset(data, 0, sizeof(data));

  int b_max = 0;
  REP(i, n) {
    int a, b;
    scanf("%d%d", &a, &b);
    data[a]++;
    data[b + 1]--;

    if (b > b_max) b_max = b;
  }

  REP(i, b_max + 1) data[i] += data[i - 1];

  int ans = 0;
  REP(i, b_max + 1) {
    if (data[i + 1] >= i) ans = i;
  }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: expected primary-expression at end of input
   30 |   return
      |         ^
a.cc:30:9: error: expected ';' at end of input
   30 |   return
      |         ^
      |         ;
a.cc:30:9: error: expected '}' at end of input
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

//#include "bits/stdc++.h"

#include <iostream>
#include <array>
// #include <map>
// #include <string>
// #include <algorithm>
// #include <numeric>
// #include <limits>

using namespace std;

array<int, 100002> box; // use key 100001

int n;
int np;
int min_;
int max_;

int solve() {
	cin >> n;
	np = n + 1;
	for (int i = 0; i < n; i++) {
		cin >> min_ >> max_;
		if (min_ > np) {
			continue;
		}
		box[min_ - 1]--;
		max_ = min(max_, np);
		box[max_]++;
	}
	box[np + 2] = 0;
	for (int i = np + 1; i >= 0; i--) {
		box[i] += box[i+1];
		//std::cout << "debug " << i << " " << box[i] << std::endl; // debug
		if (i - 1 <= box[i]) {
			return i - 1;
		}
	}
	return 0;
}

int main() {

	std::ios::sync_with_stdio(false);
	std::cin.tie(false);


	cout << solve() << endl;

	//std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:21: error: no matching function for call to 'std::basic_istream<char>::tie(bool)'
   46 |         std::cin.tie(false);
      |         ~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/basic_ios.h:299:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
  299 |       tie() const
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:299:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/14/bits/basic_ios.h:311:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |       ^~~
/usr/include/c++/14/bits/basic_ios.h:311:43: note:   no known conversion for argument 1 from 'bool' to 'std::basic_ostream<char>*'
  311 |       tie(basic_ostream<_CharT, _Traits>* __tiestr)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
??
using std::cin;
using std::cout;
using std::endl;
??
int main(void) {
????????int N;
????????cin >> N;
????????std::vector<int> frimin(N);
????????std::vector<int> frimax(N);
????????for (int i = 0; i < N; i++) {
????????????????cin >> frimin[i] >> frimax[i];
????????}
??
????????std::sort(frimin.begin(), frimin.end());
????????std::sort(frimax.begin(), frimax.end());
??
????????int ret = 0;
????????int count = 1;
????????int imin = -1;
????????int imax = -1;
????????for (int f = 2; f < N+2 && f <= frimax[N-1]; f++) {
????????????????for (int i = imin+1; frimin[i] == f; i++) {
????????????????????????count++;
????????????????????????imin++;
????????????????}
????????????????for (int i = imax+1; frimax[i] == f-1; i++) {
????????????????????????count--;
????????????????????????imax++;
????????????????}
??
????????????????if ( count >= f && count != 1 ) {
????????????????????????ret = f-1;
????????????????}
????????}
??
????????cout << ret << endl;
????????return 0;
}

Compiler output:
a.cc:4:1: error: expected unqualified-id before '?' token
    4 | ??
      | ^
a.cc:8:1: error: expected unqualified-id before '?' token
    8 | ??
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
int main(){
  int n;
  cin>>n;
  int a[100002];
  lp(i,100002){
    a[i]=1;
  }
  lp(i,n){
    int x,y;
    cin>>x>>y;
    for(int i=x;i<=y && i<=n;i++){
      a[i]+=1;
    }
  }
  int ans=0;
  lp(i,n+2){
    if(a[i]>=i) ans=i;
  }
  if(ans==0) cout<<0<<endl;
  else 
  cout<<ans-1<<endl;
  return 0;
    
}
}


Compiler output:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

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

int data[100001][100002];

int main(){
	int n;
	cin >> n;

	//input
	for(int i = 1; i <= n; i++){
		int r, l;
		cin >> r >> l;
		for(int j = r; j <= l; j++) data[i][j] = 1;
	}

	vector<int> v;
	for(int i = 1; i <= n; i++){
		int ok = 0;
		for(int j = 1; j <= n; j++){
			if(data[j][i]) ok++;
		}
		if(ok + 1 >= i) v.push_back(i);
	}

	if(v.size()){
		sort(v.begin(), v.end());
		cout << v[v.size() - 1] - 1 << endl;
	}
	else cout << 0 << endl;

	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:14:45: error: reference to 'data' is ambiguous
   14 |                 for(int j = r; j <= l; j++) data[i][j] = 1;
      |                                             ^~~~
In file included from /usr/include/c++/14/string:53,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:4:5: note:                 'int data [100001][100002]'
    4 | int data[100001][100002];
      |     ^~~~
a.cc:21:28: error: reference to 'data' is ambiguous
   21 |                         if(data[j][i]) ok++;
      |                            ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
  344 |     data(initializer_list<_Tp> __il) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note:                 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
  334 |     data(_Tp (&__array)[_Nm]) noexcept
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
  323 |     data(const _Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note:                 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
  312 |     data(_Container& __cont) noexcept(noexcept(__cont.data()))
      |     ^~~~
a.cc:4:5: note:                 'int data [100001][100002]'
    4 | int data[100001][100002];
      |     ^~~~
Language: C++

#include<iostream>
#include<map>
#include<algorithm>
#include<functional>
#define all(c) c.begin(),c.end()
#include<vector>
#define MAX 100010
using namespace std;
typedef pair<int,int> P;
int main(){
	int n;
	cin>>n;
	int ans=0;
	//int a[MAX],b[MAX];
	int a,b;
	vector<P> box;
	for(int i=0;i<n;i++){
		//cin>>a[i]>>b[i];
		cin>>a>>b;
		box.push_back(P(a,b));
	}
	sort(all(box));
	for(int i=1;i<=n+1;i++){
		vector<int> vec;
		for(int j=0;j<n;j++){
			if(i>=box[j].first){
				vec.push_back(box[j].second);
				
				
			}else
			break;
		}
		//cout<<i<<endl;
		sort(all(vec));
		int t=0;
		for(int k=0;vec.size()>k;k++){
			if(i<=vec[k]){
			t++;
			//cout<<"------"<<endl;
			}
		}
		
		int s=(uppwer_bound(vec.begin(),vec.end(),i,greater<int>())-vec.begin());
		cout<<t<<"   "<<s<<endl;
		if(t+1<i)
		continue;
		ans=max(ans,i-1);
		if(t==0)
		ans=max(ans,0);
		for(int k=0;k<(int)vec.size();k++)
			cout<<vec[k];
		cout<<endl;
		//cout<<"  "<<t<<endl;
		
		vec.clear();
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:24: error: 'uppwer_bound' was not declared in this scope
   43 |                 int s=(uppwer_bound(vec.begin(),vec.end(),i,greater<int>())-vec.begin());
      |                        ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
  const int MAX = 100001;
  int n, a, b;
  int dp[MAX+1] = {};
   
  cin >> n;
  for(int i=0; i<n; i++) {
    cin >> a >> b;
    dp[a] ++;
    dp[b+1] --;
  }
 
  for(int i=2 i<MAX; i++) {
    dp[i+1] += dp[i];
  }
   
  int mx = 0;
  for(int i=2; i<MAX; i++) {
    if(dp[i]+1>=i) mx = i-1;
  }
  cout << mx << endl;
   
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:14: error: expected ';' before 'i'
   17 |   for(int i=2 i<MAX; i++) {
      |              ^~
      |              ;
Language: C

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;
#define INF 1<<29

typedef int Weight; 

struct Edge{
    int src;
    int dst;
    Weight weight;

    Edge(int src, int dst, Weight weight):
        src(src), dst(dst), weight(weight){ }
};

struct Node{
    int index;
    Weight cost;
    int prev;

    Node(int index, Weight cost, int prev) :
        index(index), cost(cost), prev(prev){ }
};

bool operator <(const Node &a, const Node &b){
    if(a.cost == b.cost){
        return a.index > b.index;
    }else{
        return a.cost > b.cost;
    }
}

void dijkstra(int s, vector<Weight> &costs, vector<int> &prev, vector<vector<Edge> > &edges){
    int n=costs.size();
    priority_queue<Node> q;

    costs.assign(n,INF);
    prev.assign(n,-1);
    costs[s] = 0;
    q.push(Node(s,0,-2));

    while(!q.empty()){
        Node fix = q.top(); 
        q.pop();
        if(prev[fix.index] != -1) continue;
       
        costs[fix.index] = fix.cost;
        prev[fix.index] = fix.prev;

        for(int i=0;i<edges[fix.index].size();i++){ //foreach edge from fixed
            if(costs[edges[fix.index][i].dst] > costs[fix.index] + edges[fix.index][i].weight){
                q.push(Node(edges[fix.index][i].dst, edges[fix.index][i].weight + costs[fix.index], fix.index));
            }
        }
    }
}

int main(){
    int n,tmp;
    cin >> n;
    vector<Weight> costs(n);
    vector<int> prev(n);
    vector<vector<Edge> > edges(n);

    for(int i=0;i<n;i++){
        cin >> tmp;
        if(tmp == 0){
            for(int j=1;j<=6;j++){
                edges[i].push_back(Edge(i,min(n-1,i+j),1));
            }
        }else{
            edges[i].push_back(Edge(i,min(n-1,i+tmp),0));
        }
    }
    dijkstra(0,costs,prev,edges);
    cout << costs[n-1] << endl;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define all(c) c.begin(),c.end()
#define INF 100000000
using namespace std;
vector<int> dp;
int n;
vector<int> v;
int ans;
void ret(int pos,int cnt){
	//cout<<pos<<endl;
	//cout<<"   "<<dp[pos]<<endl;
	if(pos>=n-1){
		ans=min(cnt,ans);
		//cout<<"  "<<cnt<<endl;
		return;
	}
	if(dp[pos]!=-1){
		if(cnt>=dp[pos])
			return;
		dp[pos]=cnt;
	}else
		dp[pos]=cnt;
	
	if(v[pos]!=0){
		ret(pos+v[pos],cnt);
		return;
	}
	int ans=INF;
	for(int i=1;i<=6;i++){
		if(pos+i>=n-1){
			//cout<<"----"<<pos<<endl;
		}
		ret(pos+i,cnt+1);
	}
}
int main(){
	cin>>n;
	v.resize(n);
	ans=INF;
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	dp.resize(n);
	fill(all(dp),-1);
	ret(0,0);
	cout<<ans<<endl;
	/*for(int i=0;i<n;i++){
		cout<<dp[i]<<endl;
	}*/
	return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <climits>
#include <set>
using namespace std;
#define repn(i,s,n) for (int i=int(s); i < int(n); i++)
#define rep(i,n) repn(i,0,n)
#define repd(i,n) for (int i=int(n)-1; i >= 0; i--)

typedef vector<int> VI;


int main() {
  int n;
  cin >> n;
  VI ps(n);
  rep(i,n) cin >> ps[i];

  VI state(n);  // 0: undefined, 1: traversing, 2:fixed
  VI dest(n);   // テ」ツδ榲」ツつケiテ」ツ?ォテヲツュツ「テ」ツ?セテ」ツ?」テ」ツ?淌ヲツ卍づ」ツ?ョティツ。ツ古・ツ?暗」ツ??1テ」ツ?ェテ」ツつ嘉ァツ?。テゥツ卍静」ツδォテ」ツδシテ」ツδ療」ツ??

  function<int(int)> dfs = [&](int v) -> int {
    if (ps[v] == 0) {
      // vテ」ツ?古・ツ按ーテァツ敖?・ツ慊ーテ」ツ?ョテ」ツδ榲」ツつケ
      state[v] = 2;
      return dest[v] = v;
    }
    if (state[v] == 2) {
      // vテ」ツ?古・ツ按ーテァツ敖?・ツ慊ーテ」ツ?古」ツ?ゥテ」ツ?禿」ツ?凝ァツ「ツコテ・ツョツ堙」ツ?療」ツ?ヲテ」ツ??」ツつ凝」ツδ榲」ツつケ
      return dest[v];
    }
    if (state[v] == 1) {
      // テァツ?。テゥツ卍静」ツδォテ」ツδシテ」ツδ療ヲツ、ツ愿・ツ?コ
      return -1;
    }
    state[v] = 1;
    dest[v] = dfs(v + ps[v]);  // テ・ツ?暗」ツ?クテゥツ?イテ」ツつ禿」ツ?ァテァツ「ツコテ・ツョツ堙」ツ?陛」ツ?崚」ツつ?
    state[v] = 2;
    return dest[v];
  };
  rep(i, n) {
    if (state[i] == 0) dfs(i);
  }

  // テゥツ鳴凝・ツァツ凝ァツつケテ」ツ?凝」ツつ嘉・ツケツ?・ツ?ェテ・ツ?暗ヲツ篠「テァツエツ「
  queue<int> que;
  que.push(0);
  VI dist(n, -1);
  dist[0] = 0;

  while(!que.empty()) {
    int v = que.front();
    que.pop();
    repn(i, v+1, v+7) {
      if (i >= n) break;
      int d = dest[i];
      if (d == -1) continue;
      if (dist[d] != -1) continue;
      dist[d] = dist[v] + 1;
      que.push(d);
    }
  }

  cout << dist[n-1] << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'function' was not declared in this scope
   27 |   function<int(int)> dfs = [&](int v) -> int {
      |   ^~~~~~~~
a.cc:10:1: note: 'std::function' is defined in header '<functional>'; this is probably fixable by adding '#include <functional>'
    9 | #include <set>
  +++ |+#include <functional>
   10 | using namespace std;
a.cc:27:12: error: expected primary-expression before 'int'
   27 |   function<int(int)> dfs = [&](int v) -> int {
      |            ^~~
a.cc:47:24: error: 'dfs' was not declared in this scope
   47 |     if (state[i] == 0) dfs(i);
      |                        ^~~
Language: C++

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

int main()
{
  int N,SR[200001],now,mi,len=0,M[200001];
  vector<int> V;
  cin>>N;
  for(int i=0;i<N;i++)cin>>SR[i];
  for(int i=0;i<N;i++)M[i]=1000002;
  M[0]=0;
  for(int i=1;i<=6;i++){
    for(int j=i;j<N;j++){
      for(int k=1;k<=i;k++){
        if(SR[j-k]==0)M[j]=min(M[j],M[j-k]+1);
      }
      
      now=j;
      V.clear();
      V.push_back(now);
      while(SR[now]!=0){
	now+=SR[now];
	M[now]=min(M[j],M[now]);
	if(find(V.begin(),V.end(),now)!=(V.end())){
	  while(!V.empty()){
	    now=V.front();
	    M[now]=1000003;
	    V.erase(V.begin());
	  }
	  break;
	}
	V.push_back(now);
      }
      
    }
  }
  cout<<M[N-1]<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin>>N;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:38:3: error: 'cout' was not declared in this scope
   38 |   cout<<M[N-1]<<endl;
      |   ^~~~
a.cc:38:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:17: error: 'endl' was not declared in this scope
   38 |   cout<<M[N-1]<<endl;
      |                 ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

# include <iostream>
# include <vector>
# include <queue>
const int MAX_N = 100000;
const int INF = 1000000;

int n;
int p[MAX_N];

std::vector<int> G[MAX_N];

bool f[MAX_N];

int func(int s) {
	if (f[s])
		return -1;
	if (p[s] == 0) {
		return s;
	}
	else {
		f[s] = true;
		return func(s + p[s]);
	}
}

int d[MAX_N];

int dijkstra(int s, int g) {
	std::fill(d, d + n, INF);
	std::queue<int> que;
	d[s] = 0;
	que.push(s);
	while (!que.empty()) {
		int v = que.front(); que.pop();
		if (v == g)
			break;
		for (int i = 0; i < G[v].size(); ++i) {
			int e = G[v][i];
			if (d[e] > d[v] + 1) {
				d[e] = d[v] + 1;
				que.push(e);
			}
		}
	}
	return d[g];
}

int main() {
	std::cin >> n;
	for (int i = 0; i < n; ++i)
		std::cin >> p[i];

	for (int i = 0; i < n; ++i) {
		if (p[i] == 0) {
			for (int j = 1; j <= 6; ++j) {
				if (i + j < n) {
					if (p[i + j] == 0)
						G[i].push_back(i + j);
					else {
						std::memset(f, false, sizeof(f));
						int v = func(i);
						if (v != -1)
							G[i].push_back(v);
					}
				}
			}
		}
	}
	std::cout << dijkstra(0, n - 1) << std::endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:54: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
   60 |                                                 std::memset(f, false, sizeof(f));
      |                                                      ^~~~~~
      |                                                      wmemset
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mk make_pair
int main(){
  int n;
  cin>>n;
  int a[n];
  bool ch[n]
  for(int i=0;i<n;i++){cin>>a[i];ch[i]=0;}
  queue<pair<int,int> >q;
  q.push(mk(0,0));
  ch[0]=1;
  while(!q.empty()){
    pair<int,int>b=q.front();q.pop();
    int d=b.first,c=b.second;
    if(d==n-1){cout<<c<<endl;return 0;}
    for(int i=0;i<6;i++){
      if(d+i>=n||ch[i])continue;
      if(a[d+i]){if(abs(a[d+i+a[d+i]])==abs(a[d+i+a[d+i+a[d+i]]])){ch[d+i+a[d+i]]=1;goto L;}
        int p=a[d+i],dd=d;
        while(1){
          if(a[dd+p]==0)break;
          if(abs(a[dd+p])==abs(a[dd+a[dd+p]])){ch[dd+p]=1;goto L;}
          dd=dd+p;p=a[dd+p];
        }
        q.push(mk(dd+p,c+1));
      }
      else{q.push(mk(d+i,c+1));ch[d+i]=1;}
      L:;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'for'
    9 |   for(int i=0;i<n;i++){cin>>a[i];ch[i]=0;}
      |   ^~~
a.cc:9:15: error: 'i' was not declared in this scope
    9 |   for(int i=0;i<n;i++){cin>>a[i];ch[i]=0;}
      |               ^
a.cc:12:3: error: 'ch' was not declared in this scope
   12 |   ch[0]=1;
      |   ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define mk make_pair
int main(){
  int n;
  cin>>n;
  int a[n];
  bool ch[n+100];
  for(int i=0;i<n;i++){cin>>a[i];}
    for(int i=0;i<n+100;i++)ch[i]=0;
  queue<pair<int,int> >q;
  q.push(mk(0,1));
  ch[0]=1;
  while(!q.empty()){
    pair<int,int>b=q.front();q.pop();
    int d=b.first,c=b.second;
    if(d==n-1){cout<<c-1<<endl;return 0;}
    for(int i=1;i<7;i++){
      if(a[d+i]+d+i>=n||ch[a[d+i]+d+i])continue;
      if(a[d+i]>0){if(abs(a[d+i+a[d+i]])==abs(a[d+i+a[d+i+a[d+i]]])){ch[d+i+a[d+i]]=1;goto L;}
        int p=a[d+i],dd=d;
        while(1){
          if(a[dd+p]==0)break;
          if(abs(a[dd+p])==abs(a[dd+a[dd+p]])){ch[dd+p]=1;goto L;}
          dd=dd+p;p=a[dd+p];
        }
        q.push(mk(dd+p,c+1));ch[dd+p]=1;
      }
      if(a[d+i]==0){q.push(mk(d+i,c+1));ch[d+i]=1;}
      L:;
    }
  }

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

/* ????????????????????? */

#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>

constexpr int INF=1<<29;

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<int> p(n);
  for (size_t i=0; i<n; ++i)
    scanf("%d", &p[i]);

  std::vector<int> dst(n, -2);
  dst[0] = 0;
  dst[n-1] = n-1;

  // -2 for unvisited, -1 for inf-loop
  // non-negative for index of destination
  std::function<int (int)> simulate=[&](int k) ->int {
    if (dst[k] != -2) return dst[k];
    if (p[k] == 0) return k;
    dst[k] = -1;  // mark for "not unvisited"
    return (dst[k] = rec(k+p[k]));
  };
  for (size_t i=1; i+1<n; ++i) {
    simulate(i);
  }

  std::vector<int> dp(n, INF);
  dp[0] = 0;
  for (size_t i=0; i<n; ++i) {
    if (p[i]) continue;
    for (size_t j=1; j<=6; ++j) {
      if (i+j >= n) break;
      dp[dst[i+j]] = std::min(dp[dst[i+j]], dp[i]+1);
    }
  }

  printf("%d\n", dp[n-1]);
  return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:28:22: error: 'rec' was not declared in this scope
   28 |     return (dst[k] = rec(k+p[k]));
      |                      ^~~
Language: C++

 
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
struct UnionFind{
    int n;
    set<int> dame;
    vi p;
    vi use;
    UnionFind(int N):n(N){
        p.resize(n);
        use.resize(n);
    	iota(all(p),0);
    	rep(i,n){
    	    int tmp;
    	    cin>>tmp;
    	    unite(i,tmp+i);
    	}
    }
    void unite(int a, int b){int c=root(a),d=root(b); if(c!=d) p[c]=d; else if(a!=b) dame.insert(root(a));}
    int root(int a){return p[a]=(p[a]==a?a:root(p[a]));}
    bool same(int a, int b){return root(a)==root(b);}
    void useable(){
        set<int> tmp;
        for(auto i :dame)tmp.insert(root(i));
        dame=tmp;
        rep(i,n){
            use[i]=dame.find(root(i))==dame.end();
        }
    }
};
int main(){
	int n;
	cin>>n;
	UnionFind uf(n);
	//rep(i,n)cout<<uf.p[i]<<",";cout<<endl;
	uf.useable();
    //for(auto i :uf.use)cout<<i<<",";cout<<endl;
    vi turn(n,-1);
    turn[0]=0;
    queue<int> que;
    que.push(0);
    while(turn[n-1]==-1){
        int c=que.front();que.pop();
        range(d,1,7){
            if(c+d<n && uf.use[c+d] && turn[uf.p[c+d]]==-1){
                que.push(uf.[c+d]);
                turn[uf.p[c+d]]=turn[c]+1;
            }
        }
    }
    cout<<turn[n-1]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:65:29: error: expected unqualified-id before '[' token
   65 |                 que.push(uf.[c+d]);
      |                             ^
Language: C++

N = gets.to_i
P = N.times.map{gets.to_i} + [0]*6

move = [nil]*(N+6)

dfs1 = lambda do |i|
    if move[i] == -1
        move[i] = false
        return false
    end
    return move[i] = move[i] if move[i] != nil
    return move[i] = i       if P[i] == 0
    move[i] = -1
    res = dfs1.call(i+P[i])
    return move[i] = res     if res
    return move[i] = false
end

(N+6).times do |i|
    dfs1.call(i)
end



dp = [10101010]*(N+6)
dp[0] = 0

(N-1).times do |ptr|
    1.upto(6) do |hop|
        to = move[ptr+hop]
        dp[to] = [dp[to], dp[ptr]+1].min if to
    end
end

p dp[N-1]



Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = gets.to_i
      | ^
a.cc:2:28: error: expected unqualified-id before '+' token
    2 | P = N.times.map{gets.to_i} + [0]*6
      |                            ^
Language: Java

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

public class My_Friends_Are_Small {
	public static void main(String[] args) {
		new My_Friends_Are_Small().solver();
	}

	final long MOD = 1_000_000_000 + 7;

	void solver() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();// the number of friends
		int W = sc.nextInt();// the capacity
		int[] w = new int[N];
		for (int i = 0; i < N; i++) {
			w[i] = sc.nextInt();
		}
		Arrays.sort(w);
		/*
		 * dp[k][i][j]????????????k?????????????????????????????§????£???°?????????????????????????°?????????????
		 * ?????????????????????i?????????????£???°???????????????????????°????????¨??????n?????§????????????????????????j??§????????¨????????´????????°???
		 */

		long[][][] dp = new long[2][210][10010];
		dp[0][N][W] = 0;
		for (int k = 0; k < N; k++) {
			int cur = k % 2, next = (k + 1) % 2;
			for (int i = 0; i <= N; i++) {
				for (int j = 0; j <= W; j++) {
					dp[next][i][j] = 0;
				}
			}
			for (int i = 0; i <= N; i++) {
				for (int j = 0; j <= W; j++) {
					if (dp[cur][i][j] == 0)
						continue;
					if (j - w[k] < 0)
						continue;
					dp[next][i][j - w[k]] += dp[cur][i][j] %= MOD;
					dp[next][Math.min(i, k)][j] += dp[cur][i][j] %= MOD;
				}
			}
		}
		long ret = 0;
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= W; j++) {
				if (i == N || j < w[i]) {
					ret += dp[N % 2][i][j] %= MOD;
				}
			}
		}
		System.out.println(ret % MOD);
	}
}

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

25 10000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 25 10000
      | ^~
Language: C++

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

public class Main {
	public static void main(String[] args) {
		new Main().solver();
	}

	final long MOD = 1_000_000_000 + 7;

	void solver() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();// the number of friends
		int W = sc.nextInt();// the capacity
		int[] w = new int[N];
		for (int i = 0; i < N; i++) {
			w[i] = sc.nextInt();
		}
		Arrays.sort(w);
		/*
		 * dp[k][i][j]????????????k?????????????????????????????§????£???°?????????????????????????°?????????????
		 * ?????????????????????i?????????????£???°???????????????????????°????????¨??????n?????§????????????????????????j??§????????¨????????´????????°???
		 */

		long[][][] dp = new long[2][210][10010];
		dp[0][N][W] = 1;
		for (int k = 0; k < N; k++) {
			int cur = k % 2, next = (k + 1) % 2;
			for (int i = 0; i <= N; i++) {
				for (int j = 0; j <= W; j++) {
					dp[next][i][j] = 0;
				}
			}
			for (int i = 0; i <= N; i++) {
				for (int j = 0; j <= W; j++) {
					if (dp[cur][i][j] == 0)
						continue;
					dp[next][Math.min(i, k)][j] += dp[cur][i][j]%=MOD;
					if (j - w[k] < 0)
						continue;
					dp[next][i][j - w[k]] += dp[cur][i][j]%=MOD ;
				}
			}
		}
		long ret = 0;
		for (int i = 0; i <= N; i++) {
			for (int j = 0; j <= W; j++) {
				if (i == N || j < w[i]) {
					ret += dp[N % 2][i][j]%=MOD;
				}
			}
		}
		System.out.println(ret % MOD);
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include <cstdio>
#include <algorithm>

#define MOD (1000000007)

using namespace std;

int N, W;
int Wdown, Wup;
int w[256];
int dp[202][10001];

int main()
{
	scanf("%d %d", &N, &W);
	
	for (int i = 0; i < N; i++){
		scanf("%d", &w[i]);
	}
	sort(w, w + N);
	reverse(w, w + N);
	
	dp[0][0] = 1;
	for (int i = 0; i < N; i++){
		memcpy(dp[i + 1], dp[i], sizeof(dp[i]));
		for (int j = W - w[i]; j >= 0; j--){
			dp[i + 1][j + w[i]] += dp[i][j];
			dp[i + 1][j + w[i]] %= MOD;
		}
	}
	reverse(w, w + N);
	int all, res;
	all = res = 0;
	for (int i = 1; i <= N; i++){
		int k = i - 1;
		for (int j = max(0, W - all - w[k] + 1); j <= W - all - (k ? w[k - 1] : 0); j++){
				res = (res + dp[N - k][j]) % MOD;
		}
		all += w[k];
	}
	
	printf("%d\n", res);
	
	return (0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'memcpy' was not declared in this scope
   25 |                 memcpy(dp[i + 1], dp[i], sizeof(dp[i]));
      |                 ^~~~~~
a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <algorithm>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,w;
int a[201];
int dp[201][10001];
int mod=1000000007;

int main(void){
	scanf("%d%d",&n,&w);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	sort(a,a+n);
	reverse(a,a+n);
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		memcpy(dp[i+1],dp[i],sizeof(dp[i]));
		for(int j=w-a[i];j>=0;j--){
			dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+dp[i][j])%mod;
		}
	}
	reverse(w,w+n);
	int all,res;
	all=res=0;
	for(int i=0;i<n;i++){
		for(int j=max(0,w-all-a[i]+1);j<=w-all-(i?a[i-1]:0);j++){
			res=(res+dp[n-i][j])%mod;
		}
		all+=w[i];
	}
	printf("%d\n",res);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:23: error: invalid types 'int[int]' for array subscript
   30 |                 all+=w[i];
      |                       ^
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:23:9:   required from here
   23 |         reverse(w,w+n);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(int&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = int]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:23:9:   required from here
   23 |         reverse(w,w+n);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,w;
int a[201];
int dp[201][10001];
int mod=1000000007;

int main(void){
	scanf("%d%d",&n,&w);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	sort(a,a+n);
	reverse(a,a+n);
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		memcpy(dp[i+1],dp[i],sizeof(dp[i]));
		for(int j=w-a[i];j>=0;j--){
			dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+dp[i][j])%mod;
		}
	}
	reverse(w,w+n);
	int all,res;
	all=res=0;
	for(int i=0;i<n;i++){
		for(int j=max(0,w-all-a[i]+1);j<=w-all-(i?a[i-1]:0);j++){
			res=(res+dp[n-i][j])%mod;
		}
		all+=a[i];
	}
	printf("%d\n",res);
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:23:9:   required from here
   23 |         reverse(w,w+n);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(int&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
                 from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = int]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:23:9:   required from here
   23 |         reverse(w,w+n);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,w;
int a[201];
int dp[201][10001];
int mod=1000000007;

int main(void){
	scanf("%d%d",&n,&w);
	for(int i=0;i<n;i++)scanf("%d",&a[i]);
	sort(a,a+n);
	reverse(a,a+n);
	dp[0][0]=1;
	for(int i=0;i<n;i++){
		memcpy(dp[i+1],dp[i],sizeof(dp[i]));
		for(int j=w-a[i];j>=0;j--){
			dp[i+1][j+a[i]]=(dp[i+1][j+a[i]]+dp[i][j])%mod;
		}
	}
	reverse(w,w+n);
	int all,res;
	all=res=0;
	for(int i=0;i<n;i++){
		for(int j=max(0,w-all-a[i]+1);j<=w-all-(i?a[i-1]:0);j++){
			res=(res+dp[n-i][j])%mod;
		}
		all+=a[i];
	}
	printf("%d\n",res);
	return 0;
}

Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::reverse(_BIter, _BIter) [with _BIter = int]':
a.cc:22:9:   required from here
   22 |         reverse(w,w+n);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1089:63: error: no matching function for call to '__iterator_category(int&)'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:65,
                 from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note: candidate: 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&)'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: note:   template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _Iter> constexpr typename std::iterator_traits< <template-parameter-1-1> >::iterator_category std::__iterator_category(const _Iter&) [with _Iter = int]':
/usr/include/c++/14/bits/stl_algo.h:1089:63:   required from 'void std::reverse(_BIter, _BIter) [with _BIter = int]'
 1089 |       std::__reverse(__first, __last, std::__iterator_category(__first));
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
a.cc:22:9:   required from here
   22 |         reverse(w,w+n);
      |         ~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:239:5: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
  239 |     __iterator_category(const _Iter&)
      |     ^~~~~~~~~~~~~~~~~~~