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

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

#define times(n, i)      uptil(0, n, i)
#define rtimes(n, i)     downto((n) - 1, 0, i)
#define upto(f, t, i)    for(int _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(int _##i = (t), i = (f); i <  _##i; i++)
#define downto(f, t, i)  for(int _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(int _##i = (t), i = (f); i >  _##i; i--)
typedef long double LD;
#define long long long

#if defined(EBUG) && !defined(ONLINE_JUDGE)
#define debug true
#define ln << endl
#else
#define debug false
#define ln << '\n'
#endif
#define tb << '\t'
#define sp << ' '



signed main() { // long: 64bit
    if(!debug) {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }

    int N, T;
    scanf("%d%d",&N,&T);

    long ans = N*T, before = -T;
    times(N, i) {
        int t;
        scanf("%d",&t);
        ans -= max(0, before + T - t);
        before = t;
    }

    cout << ans ln;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:19: error: no matching function for call to 'max(int, long long int)'
   38 |         ans -= max(0, before + T - t);
      |                ~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:38:19: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   38 |         ans -= max(0, before + T - t);
      |                ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:38:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   38 |         ans -= max(0, before + T - t);
      |                ~~~^~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
//B
using namespace std;

inline ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b);}
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b);}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, w;
    cin>>n>>w;

    map<int,int> mp;
    mp[0] = 0;
    int weight, val;
    
    for (int i =0; i<n; i++){
        cin>>weight>>val;
        for (auto it: mp){
            if(it->first+ weight<=w){
                if(mp.find(it->first + weight) == mp.end()){
                    mp[it->first+weight] = 0;
                }
                mp[it->first + weight] = max (mp[it->first+weight], mp[it->first]+val);
            }
        }
    }
    map<int,int> :: iterator it;
    it = mp.end();
    cout<<it.second<<"\n";
    //cant do it based on weight, nor value



}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:18: error: base operand of '->' has non-pointer type 'std::pair<const int, int>'
   23 |             if(it->first+ weight<=w){
      |                  ^~
a.cc:24:30: error: base operand of '->' has non-pointer type 'std::pair<const int, int>'
   24 |                 if(mp.find(it->first + weight) == mp.end()){
      |                              ^~
a.cc:25:26: error: base operand of '->' has non-pointer type 'std::pair<const int, int>'
   25 |                     mp[it->first+weight] = 0;
      |                          ^~
a.cc:27:22: error: base operand of '->' has non-pointer type 'std::pair<const int, int>'
   27 |                 mp[it->first + weight] = max (mp[it->first+weight], mp[it->first]+val);
      |                      ^~
a.cc:27:52: error: base operand of '->' has non-pointer type 'std::pair<const int, int>'
   27 |                 mp[it->first + weight] = max (mp[it->first+weight], mp[it->first]+val);
      |                                                    ^~
a.cc:27:74: error: base operand of '->' has non-pointer type 'std::pair<const int, int>'
   27 |                 mp[it->first + weight] = max (mp[it->first+weight], mp[it->first]+val);
      |                                                                          ^~
a.cc:33:14: error: 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} has no member named 'second'
   33 |     cout<<it.second<<"\n";
      |              ^~~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

ll dp[101][305];

int main() {
  int n,w;
  scanf("%d%d",&n,&w);
  int ws = 0, sum = 0;
  rep(i,n) {
    int a,b;
    scanf("%d%d",&a,&b);
    if (!i) {
      ws = a;
    }
    // 壓縮
    a -= ws;
    // 選擇j個，重量為sum時，選或不選第i個物品
    for ( int j=i; j>=0; j-- ) {
      for ( int k=sum; k>=0; k-- ) {
        chmax(dp[j+1][k+a], dp[j][k]+b);
      }
    }
    sum += a;
  }
  ll ans = 0;
  // 選擇i個，壓縮後的重量j
  for ( int i=0; i<=n; i++ ) {
    for ( int j=0; j<=sum; j++ ) {
      ll x = (ll)ws*i+j;
      if (x <= w) {
        maxs(ans,dp[i][j]);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}






















Compiler output:
a.cc: In function 'int main()':
a.cc:85:9: error: 'chmax' was not declared in this scope
   85 |         chmax(dp[j+1][k+a], dp[j][k]+b);
      |         ^~~~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

ll dp[101][305];

int main() {
  int n,w;
  scanf("%d%d",&n,&w);
  int ws = 0, sum = 0;
  rep(i,n) {
    int a,b;
    scanf("%d%d",&a,&b);
    if (!i) {
      ws = a;
    }
    // 壓縮
    a -= ws;
    // 選擇j個，重量為sum時，選或不選第i個物品
    for ( int j=i; j>=0; j-- ) {
      for ( int k=sum; k>=0; k-- ) {
        chmax(dp[j+1][k+a], dp[j][k]+b);
      }
    }
    sum += a;
  }
  ll ans = 0;
  // 選擇i個，壓縮後的重量j
  for ( int i=0; i<=n; i++ ) {
    for ( int j=0; j<=swm; j++ ) {
      ll x = (ll)ws*i+j;
      if (x <= w) {
        maxs(ans,dp[i][j]);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}






















Compiler output:
a.cc: In function 'int main()':
a.cc:85:9: error: 'chmax' was not declared in this scope
   85 |         chmax(dp[j+1][k+a], dp[j][k]+b);
      |         ^~~~~
a.cc:93:23: error: 'swm' was not declared in this scope; did you mean 'sum'?
   93 |     for ( int j=0; j<=swm; j++ ) {
      |                       ^~~
      |                       sum
Language: C++

#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
	if(n==0) return (ll)1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];
// 
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

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

vector<P> wv{};
rep(i,n){
	ll p,q;
	cin>>p>>q;
	wv.pb(mp(p,q));
}

sort(ALL(wv));

ll ans=0;

vector<ll> vec{};
map<ll,ll> MP{};

MP[0]=(ll)0;
vec.push_back((ll)0);

for(ll i=0;i<wv.size();i++){
	ll mx=vec.size();
for(ll j=0;j<mx;j++){
	ll z=vec[j];
	if(z+wv[i].first>w)continue;
	if(!MP.count(z+wv[i].first)){
		MP[z+wv[i].first]=MP[z]+wv[i].second;
		ans=max(ans,MP[z+wv[i].first]);
		vec.pb(z+wv[i].first);
				}
	else {MP[z+wv[i].first]=max(MP[z+wv[i].first], MP[z]+wv[i].second);
	ans=max(ans,MP[z+wv[i].first]);
}
	}
}

}



cout<<ans<<endl;
}




Compiler output:
a.cc:149:1: error: 'cout' does not name a type; did you mean 'dcout'?
  149 | cout<<ans<<endl;
      | ^~~~
      | dcout
a.cc:150:1: error: expected declaration before '}' token
  150 | }
      | ^
Language: C++

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<class T>
bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return false;
	}
	return true;
}

template<class T>
bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return false;
	}
	return true;
}

template<class T>
bool chmax(T &a, initializer_list<T> l)
{
	return chmax(a, *max_element(l.begin(), l.end()));
}

template<class T>
bool chmin(T &a, initializer_list<T> l)
{
	return chmin(a, *min_element(l.begin(), l.end));
}

ll N, W;
ll w0{-1};
map<ll, vector<ll>> m;

ll solve(ll i, ll w, ll v, vector<ll>& vec)
{
	if (i == 4)
	{
		if (w <= W) return v;
		else return 0;
	}

	ll res{0};
	for (ll k = 0; k <= vec[i].size(); ++k)
	{
		ll ww = (w0+i);
		ll tmp = solve(i+1, w+ww*k,
					   v+accumulate(m[ww].begin(),
									m[ww].begin()+k, 0ll), vec);
		chmax(res, tmp);
	}
	return res;
}

int main(int argc, char **argv)
{
	cin >> N >> W;
	REP(i, N)
	{
		ll w, v; cin >> w >> v;
		m[w].push_back(v);

		if (w0 == -1)
			w0 = w;
	}

	vector<ll> cntv(4, 0);
	ll i{0};
	for (auto &p : m)
	{
		sort(ALL(p.second), greater<ll>());
		cntv[i++] = (p.second.size()+1);
	}

	std::cout << solve(0, 0, 0, cntv) << std::endl;
}


Compiler output:
a.cc: In function 'll solve(ll, ll, ll, std::vector<long long int>&)':
a.cc:62:36: error: request for member 'size' in '(& vec)->std::vector<long long int>::operator[](((std::vector<long long int>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}
   62 |         for (ll k = 0; k <= vec[i].size(); ++k)
      |                                    ^~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    int n;
    ll w[n],v[n];
    ll W;
    
    pair<ll,ll> ps[1<<n/2];
    int n2=n/2;
    for(int i=0;i<1<<n2;i++){
        ll sw=0,sv=0;
        rep(j,n2){
            if(i>>j&1){
                sw+=w[j];
                sv+=v[j];
            }
        }
        ps[i]={sw,sv};
    }
    sort(ps,ps+(1<<n2));
    int m=1;
    for(int i=1;i<1<<n2;i++){
        if(ps[m-1].second<ps[i].second){
            ps[m++]=ps[i];
        }
    }
    
    ll res=0;
    for(int i=0;i<1<<(n-n2);i++){
        ll sw=0;sv=0;
        for(int j=0;j<n-n2;j++){
            if(i>>j&1){
                sw+=w[n2+j];
                sv+=v[n2+j];
            }
        }
        if(sw<=W){
            ll tv=(lower_bound(ps,ps+m,make_pair(W-sw,INF))-1)->second;
            res=max(res,sv+tv);
        }
    }
    cout<<res<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'sv' was not declared in this scope; did you mean 'sw'?
   34 |         ll sw=0;sv=0;
      |                 ^~
      |                 sw
a.cc:42:55: error: 'INF' was not declared in this scope
   42 |             ll tv=(lower_bound(ps,ps+m,make_pair(W-sw,INF))-1)->second;
      |                                                       ^~~
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,W;
    cin>>n>>W;
    V<ll> w(n),v(n);
    rep(i,n) cin>>w[i]>>v[i];
    ll ans=0;
    V<V<ll>> c(4);
    rep(i,n) c[w[i]-w[0]].push_back(v[i]);
    ll s[5][101];
    rep(i,4) sort(all(c[i]),greater<ll>());
    rep(i,4){
        rep(j,c[i].size()+1) s[i][j]=0;
    }
    rep(i,4){
        rep(j,c[i].size()) s[i][j+1]=s[i][j]+c[i][j];
    }
    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=n;j++){
            for(ll k=0;k<=n;k++){
                if(i*w[0]+j*(w[0]+1)+k*(w[0]+2)>W) continue;
                ll l=min((W-(i*w[0]+j*(w[0]+1)+k*(w[0]+2)))/(w[0]+3),(LLONG_MAX)c[3].size());
                if(i>c[0].size()||j>c[1].size()||k>c[2].size()) continue;
                chmax(ans,s[0][i]+s[1][j]+s[2][k]+s[3][l]);
            }
        }
    }
    cout<<ans<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
(全探索できるなら全探索しろ)
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'\n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え(=でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:48:81: error: expected ')' before 'c'
   48 |                 ll l=min((W-(i*w[0]+j*(w[0]+1)+k*(w[0]+2)))/(w[0]+3),(LLONG_MAX)c[3].size());
      |                         ~                                                       ^
      |                                                                                 )
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};
/* -- template -- */
const int MAX_N = 101, MAX_W = 3001;
int dp[MAX_N][MAX_N][MAX_W]; //dp[i + 1][j][w] : i番目までみたとき，j個で重さw以下での価値の最大値
int main() {
    int N, W; cin >> N >> W;
    int w[N], v[N];
    rep(i, N) cin >> w[i] >> v[i];
    rep(i, N - 1) w[i + 1] -= (w[0] - 1);
    int tmp = w[0];
    w[0] = 1;
    rep(i, N) {
        rep(j, N){
            rep(ww, MAX_W) {
                dp[i + 1][j + 1][ww] = max(dp[i][j + 1][ww], dp[i + 1][j + 1][ww])
                if(ww - w[i] >= 0)
                    dp[i + 1][j + 1][ww] = max(dp[i + 1][j + 1][ww], dp[i][j][ww - w[i]] + v[i]);
            }
        }
    }
    int ans = 0;
    rep(j, N) {
        rep(ww, MAX_W) {
            if((j + 1) * (tmp - 1) + ww == W)
                ans = max(ans, dp[N][j + 1][ww]);
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:83: error: expected ';' before 'if'
   90 |                 dp[i + 1][j + 1][ww] = max(dp[i][j + 1][ww], dp[i + 1][j + 1][ww])
      |                                                                                   ^
      |                                                                                   ;
   91 |                 if(ww - w[i] >= 0)
      |                 ~~
Language: Java



import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

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

		int n = sc.nextInt();
		int W = sc.nextInt();
		int[] w = new int[n];
		int[] v = new int[n];

		ArrayList<Integer> arr0 = new ArrayList<Integer>();
		ArrayList<Integer> arr1 = new ArrayList<Integer>();
		ArrayList<Integer> arr2 = new ArrayList<Integer>();
		ArrayList<Integer> arr3 = new ArrayList<Integer>();

		arr0.add(0);
		arr1.add(0);
		arr2.add(0);
		arr3.add(0);

		for (int i = 0; i < n; i++) {
			w[i] = Integer.parseInt(sc.next());
			v[i] = Integer.parseInt(sc.next());
			if (w[i] - w[0] == 0)
				arr0.add(v[i]);
			if (w[i] - w[0] == 1)
				arr1.add(v[i]);
			if (w[i] - w[0] == 2)
				arr2.add(v[i]);
			if (w[i] - w[0] == 3)
				arr3.add(v[i]);
		}

		Collections.sort(arr0, Collections.reverseOrder());
		Collections.sort(arr1, Collections.reverseOrder());
		Collections.sort(arr2, Collections.reverseOrder());
		Collections.sort(arr3, Collections.reverseOrder());

		ArrayList<Long> arrsum0 = new ArrayList<Long>();
		ArrayList<Long> arrsum1 = new ArrayList<Long>();
		ArrayList<Long> arrsum2 = new ArrayList<Long>();
		ArrayList<Long> arrsum3 = new ArrayList<Long>();

		arrsum0.add(0l);
		arrsum1.add(0l);
		arrsum2.add(0l);
		arrsum3.add(0l);
		long sum = 0;

		for (int i = 0; i < arr0.size(); i++) {
			sum += arr0.get(i);
			arrsum0.add(sum);
		}

		sum = 0;

		for (int i = 0; i < arr1.size(); i++) {
			sum += arr1.get(i);
			arrsum1.add(sum);
		}

		sum = 0;

		for (int i = 0; i < arr2.size(); i++) {
			sum += arr2.get(i);
			arrsum2.add(sum);
		}

		sum = 0;

		for (int i = 0; i < arr3.size(); i++) {
			sum += arr3.get(i);
			arrsum3.add(sum);
		}

		long max = 0;

		for (int i = 0; i < arr0.size(); i++) {
			for (int j = 0; j < arr1.size(); j++) {
				for (int k = 0; k < arr2.size(); k++) {
					for (int m = 0; m < arr3.size(); m++) {
						if (i * w[0] + j * (w[0] + 1) + k * (w[0] + 2) + m * (w[0] + 3) > W)
							continue;
						max = Math.max(max, arrsum0.get(i) + arrsum1.get(j) + arrsum2.get(k) + arrsum3.get(m));
					}
				}
			}
		}

		System.out.println(max);

	}

}


Compiler output:
Main.java:7: error: illegal character: '\u3000'
public class?Main {
            ^
1 error
Language: C++

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

const int MAX_N = 100; 
const int MAX_W = INF; 


int n, W;
int w[MAX_N], v[MAX_N];
int dp[MAX_N + 1][MAX_W + 1]; 


int rec_dp(int i, int j) {
  if (dp[i][j] != -1) {
   
    return dp[i][j];
  }
  int res;
  if (i == n) {
  
    res = 0;
  } else if (j < w[i]) {

    res = rec_dp(i + 1, j);
  } else {
  
    res = max(
        rec_dp(i + 1, j),
        rec_dp(i + 1, j - w[i]) + v[i]
    );
  }
  
  return dp[i][j] = res;
}

void solve_dp() {
  memset(dp, -1, sizeof(dp)); 
  cout << rec_dp(0, W) << endl;
}




int main() {
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> v[i];
  }

  solve_dp(); 

  return 0;
}

Compiler output:
a.cc:5:19: error: 'INF' was not declared in this scope
    5 | const int MAX_W = INF;
      |                   ^~~
a.cc:10:25: error: size of array 'dp' is not an integral constant-expression
   10 | int dp[MAX_N + 1][MAX_W + 1];
      |                   ~~~~~~^~~
Language: C++

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

const int MAX_N = 100; 
const int MAX_W = INF; 


int n, W;
int w[MAX_N], v[MAX_N];
int dp[MAX_N + 1][MAX_W + 1]; 


int rec_dp(int i, int j) {
  if (dp[i][j] != -1) {
   
    return dp[i][j];
  }
  int res;
  if (i == n) {
  
    res = 0;
  } else if (j < w[i]) {

    res = rec_dp(i + 1, j);
  } else {
  
    res = max(
        rec_dp(i + 1, j),
        rec_dp(i + 1, j - w[i]) + v[i]
    );
  }
   結果をテーブルに記憶する
  return dp[i][j] = res;
}
 メモ化再帰を用いた解法
void solve_dp() {
  memset(dp, -1, sizeof(dp)); 
  cout << rec_dp(0, W) << endl;
}




int main() {
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> v[i];
  }

  solve_dp(); 

  return 0;
}

Compiler output:
a.cc:5:19: error: 'INF' was not declared in this scope
    5 | const int MAX_W = INF;
      |                   ^~~
a.cc:10:25: error: size of array 'dp' is not an integral constant-expression
   10 | int dp[MAX_N + 1][MAX_W + 1];
      |                   ~~~~~~^~~
a.cc: In function 'int rec_dp(int, int)':
a.cc:32:4: error: '\U00007d50\U0000679c\U00003092\U000030c6\U000030fc\U000030d6\U000030eb\U0000306b\U00008a18\U000061b6\U00003059\U0000308b' was not declared in this scope
   32 |    結果をテーブルに記憶する
      |    ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc: At global scope:
a.cc:35:2: error: '\U000030e1\U000030e2\U00005316\U0000518d\U00005e30\U00003092\U00007528\U00003044\U0000305f\U000089e3\U00006cd5' does not name a type
   35 |  メモ化再帰を用いた解法
      |  ^~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:50:3: error: 'solve_dp' was not declared in this scope
   50 |   solve_dp();
      |   ^~~~~~~~
a.cc: In function 'int rec_dp(int, int)':
a.cc:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
Language: C++

100 990000000
10000000 7584766
10000000 7535949
10000000 7434002
10000000 6224567
10000000 6343925
10000000 6491532
10000000 6704808
10000000 7747279
10000000 7689345
10000000 6003017
10000000 6725907
10000000 7702215
10000000 7686168
10000000 7558917
10000000 6776247
10000000 6545406
10000000 7449047
10000000 7992266
10000000 7751548
10000000 6833032
10000000 7444187
10000000 6819556
10000000 7259985
10000000 6300722
10000000 7233159
10000000 6684330
10000000 6605340
10000000 6874447
10000000 6562109
10000000 7653862
10000000 7409485
10000000 7519891
10000000 7360602
10000000 7819608
10000000 6527920
10000000 6570132
10000000 7651746
10000000 6338431
10000000 7155606
10000000 6025264
10000000 7589982
10000000 6869928
10000000 7630769
10000000 7515380
10000000 6911677
10000000 6674583
10000000 6825273
10000000 6416446
10000000 6623463
10000000 6204563
10000000 6486536
10000000 7600404
10000000 6158906
10000000 7871860
10000000 6719067
10000000 7784027
10000000 7238436
10000000 6605371
10000000 6188240
10000000 7104146
10000000 7365699
10000000 7982853
10000000 6494590
10000000 7174280
10000000 7016579
10000000 7855557
10000000 7668950
10000000 6023444
10000000 7921868
10000000 6042331
10000000 7104691
10000000 6105386
10000000 6067079
10000000 6601243
10000000 6576047
10000000 7848387
10000000 7745981
10000000 6640679
10000000 6669411
10000000 7952639
10000000 7873630
10000000 6199071
10000000 7017695
10000000 6592489
10000000 7848562
10000000 6660501
10000000 7007295
10000000 6296877
10000000 6359013
10000000 7851641
10000000 7555938
10000000 6068489
10000000 7113355
10000000 6953012
10000000 7787784
10000000 6537197
10000000 7825797
10000000 7431682
10000000 7444819
10000003 10000000


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

#include <iostream>
#include <bits/stdc++.h>

using namespace std;
long long int a[110],b[110],dp[110][110][330];
int main()
{
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=n;i++)
    {
        cin >> a[i] >> b[i];
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            for(int k=0;k<=3*j;k++){
                dp[i+1][j][k] = max(dp[i+1][j][k],dp[i][j][k]);
              
                dp[i+1][j+1][k+a[i]-a[1]] = max(dp[i+1][j+1][k+a[i]-a[1]],dp[i][j][k] + b[i]);
            }
        }
    }
    long long int  ans = 0;
  
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=3*i;j++){
            ll w = a[1]*i + j;
            if(w <= m)
                ans = max(ans,dp[n+1][i][j]);
        }
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:13: error: 'll' was not declared in this scope
   30 |             ll w = a[1]*i + j;
      |             ^~
a.cc:31:16: error: 'w' was not declared in this scope
   31 |             if(w <= m)
      |                ^
Language: C++

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

int knapsack(int max_weight, vector<int> weight, vector<int> profit) {
    int items_quantity = profit.size();
    int knap[items_quantity+1][max_weight+1];
    memset(knapsack, 0, sizeof knapsack);

    for(int i = 0; i <= items_quantity; i++) {
        for(int w = 0; w <= max_weight; w++) {
            if (i == 0 || w == 0)
                knap[i][w] = 0;
            else if (weight[i-1] <= w)
                knap[i][w] = max(profit[i-1]+knap[i-1][w-weight[i-1]], knap[i-1][w]);
            else
                knap[i][w] = knap[i-1][w];
        }
    }
    
    return knap[items_quantity][max_weight];
}

int main() {
    int N, W;
    cin >> N >> W;
    
    vector<int> weight(N), profit(N);
    for(int i = 0; i < N; i++)
        cin >> weight[i] >> profit[i];
    
    int ans = knapsack(W, weight, profit);
    cout << ans << '\n';
    
    return 0;
}

Compiler output:
a.cc: In function 'int knapsack(int, std::vector<int>, std::vector<int>)':
a.cc:7:32: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
    7 |     memset(knapsack, 0, sizeof knapsack);
      |                                ^~~~~~~~
a.cc:7:12: error: invalid conversion from 'int (*)(int, std::vector<int>, std::vector<int>)' to 'void*' [-fpermissive]
    7 |     memset(knapsack, 0, sizeof knapsack);
      |            ^~~~~~~~
      |            |
      |            int (*)(int, std::vector<int>, std::vector<int>)
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:61:28: note:   initializing argument 1 of 'void* memset(void*, int, size_t)'
   61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
      |                      ~~~~~~^~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

ll dp[110][310][110];//dp[index][weight][choose]

int main(){
  ll n,W;
  cin >> n >> W;
  ll w[n],v[n];
  rep(i,n){
    cin >> w[i] >> v[i];
  }
  rep(i,n)sum+=w[i];
  ll x=w[0];
  rep(i,n)w[i]-=x;
  ll sum=0;
  rep(i,n+1){
    rep(j,301){
      rep(k,n){
        if(j-w[i]>=0){
          dp[i+1][j][k+1]=max(dp[i][j-w[i]][k]+v[i],dp[i][j][k+1]);
        }
        else{
          dp[i+1][j][k+1]=dp[i][j][k+1];
        }
      }
    }
  }
  ll ans=0;
  if(W-n*x>=sum){
    ll res=0;
    rep(i,n)res+=v[i];
    cout << res << endl;
    return 0;
  }
  for(ll i=1;i<=n && W-i*x>=0;i++){
    if(W-i*x<=sum)ans=max(ans,dp[n][W-i*x][i]);
  }
  cout << ans << endl;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: 'sum' was not declared in this scope
   33 |   rep(i,n)sum+=w[i];
      |           ^~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1000003 ;

ll dp[110][310][101];//dp[index][weight][choose]

int main(){
  ll n,W;
  cin >> n >> W;
  ll w[n],v[n];
  rep(i,n){
    cin >> w[i] >> v[i];
  }
  rep(i,n)sum+=w[i];
  ll x=w[0];
  rep(i,n)w[i]-=x;
  ll sum=0;
  rep(i,n+1){
    rep(j,301){
      rep(k,n){
        if(j-w[i]>=0){
          dp[i+1][j][k+1]=max(dp[i][j-w[i]][k]+v[i],dp[i][j][k+1]);
        }
        else{
          dp[i+1][j][k+1]=dp[i][j][k+1];
        }
      }
    }
  }
  ll ans=0;
  if(W-n*x>sum){
    ll res=0;
    rep(i,n)res+=v[i];
    cout << res << endl;
    return 0;
  }
  for(ll i=1;i<=n && W-i*x>=0;i++){
    if(W-i*x<=sum)ans=max(ans,dp[n][W-i*x][i]);
  }
  cout << ans << endl;
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:11: error: 'sum' was not declared in this scope
   33 |   rep(i,n)sum+=w[i];
      |           ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

vector<ll> cum_value[5];
ll weights[5];
ll n, w;

int dfs(int index, ll weight, ll value)
{
    if (weight > w) return 0;
    if (index > 4 or cum_value[index].size() == 0)
        return value;
    int ans = 0;
    rep(i, 0, cum_value[index].size())
    {
        ans = max(ans, dfs(index + 1, weight + weights[index] * i, value + cum_value[index][i]));
        // cout << cum_value[index][i]<<' '<<weight << endl;
    }
    return ans;
}

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

    map<int, vector<int>> w_vec;
    rep(i, 0, n)
    {
        int w, v;
        cin >> w >> v;
        w_vec[w].push_back(v);
    }

    int index = 0;
    for (auto w_v :w_vec)
    {
        weights[index] = w_v.first;
        vector<ll> values = w_v.second;
        sort(values.rbegin(), values.rend());

        cum_value[index].push_back(0);
        for (auto v: values)
        {
            ll prev = cum_value[index].back();
            cum_value[index].push_back(prev + v);
        }
        ++index;
    }

    cout << dfs(0, 0, 0) << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:33: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
   41 |         vector<ll> values = w_v.second;
      |                             ~~~~^~~~~~
Language: C++

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

signed main(){
	int N,W;cin>>N>>W;
	vector<int>w(N),v(N);
	rep(i,N)cin>>w[i]>>v[i];
	vector<vector<int>>v4(4),sm(4,vector<int>(101,0));
	int w0=w[0];
	rep(i,n){int x=w[i]-w0;v4[x].push_back(v[i]);}
	rep(i,4){sort(begin(v4[i]),end(v4[i]),greater<int>());}
	vector<int>sz(4);
	rep(i,4)sz[i]=v4[i].size();
	rep(i,4)rep(j,sz[j])sm[i][j+1]=sm[i][j]+v4[i][j];

	int ret=0,ans=0;
	rep(i,sz[0])rep(j,sz[1])rep(k,sz[2])rep(l,sz[3]){
		
		if(i*w0+j*(w0+1)+k*(w0+2)+l*(w0+3)>W)continue;
		ret=0;
		ret+=sm[0][i];ret+=sm[1][j];ret+=sm[2][k];ret+=sm[3][l];
		ans=max(ans,ret);
	}
	cout<<ans<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'n' was not declared in this scope
   12 |         rep(i,n){int x=w[i]-w0;v4[x].push_back(v[i]);}
      |               ^
a.cc:4:33: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                 ^
Language: C++

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

signed main(){
	int N,W;cin>>N>>W;
	vector<int>w(N),v(N);
	rep(i,N)cin>>w[i]>>v[i];
	vector<vector<int>>v4(4),sm(4,vector<int>(101,0));
	int w0=w[0];
	rep(i,n){int x=w[i]-w0;v4[x].push_back(v[i]);}
	rep(i,4){sort(begin(v4[i]),end(v4[i]),greater<int>());}
	vector<int>sz(4);
	rep(i,4)sz[i]=v4[i].size();
	rep(i,4)rep(j,sz[j])sm[i][j+1]=sm[i][j]+v4[i][j];

	int ret=0,ans=0;
	rep(i,sz[0])rep(j,sz[1])rep(k,sz[2])rep(l,sz[3]){
		ret=0;
		if(i*w0+j*(w0+1)+k*(w0+2)+l*(w0+3)>W)continue;
		ret+=sm[0][i];ret+=sm[1][j];ret+=sm[2][k];ret+=sm[3][l];}
		ans=max(ans,ret);
	}
	cout<<ans<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'n' was not declared in this scope
   12 |         rep(i,n){int x=w[i]-w0;v4[x].push_back(v[i]);}
      |               ^
a.cc:4:33: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                 ^
a.cc: At global scope:
a.cc:25:9: error: 'cout' does not name a type
   25 |         cout<<ans<<endl;
      |         ^~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

/*************************************************************************
    > File Name: test.cpp
    > Author: Akira 
    > Mail: qaq.febr2.qaq@gmail.com 
 ************************************************************************/

#include<bits/stdc++.h>
typedef long long LL;
const int MaxN = 101;

LL N,W;
LL w[MaxN], v[MaxN];
LL DP[MaxN][4*MaxN][MaxN];
void solve()
{
    LL W1 = w[1];
    for(int i=1;i<=N;i++) 
    	w[i] = w[i] - W1;
	
	
    for(int i=1;i<=N;i++)
    {
        for(int j=0;j<=300;j++)
        {
            for(int k=1;k<=N;k++)
            {
                if( j >= w[i] ) 
                    DP[i][j][k] = max( DP[i-1][j][k], DP[i-1][j-w[i]][k-1]+v[i]);
                else 
                    DP[i][j][k] = DP[i-1][j][k];
            }
        }
    }
    LL ans = 0;
    for(int j=0;j<=300;j++)
    {
        for(int k=0;k<=N;k++)
        {
            if( k*W1+j<=W)
            {
                ans = max(ans, DP[N][j][k]);
            }
        }
    }
    printf("%lld\n", ans);
}

int main()
{
   
    scanf("%lld%lld", &N, &W);
    for(int i=1;i<=N;i++) scanf("%lld%lld", &w[i], &v[i]);
    solve();
   
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:28:35: error: 'max' was not declared in this scope; did you mean 'std::max'?
   28 |                     DP[i][j][k] = max( DP[i-1][j][k], DP[i-1][j-w[i]][k-1]+v[i]);
      |                                   ^~~
      |                                   std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:41:23: error: 'max' was not declared in this scope; did you mean 'std::max'?
   41 |                 ans = max(ans, DP[N][j][k]);
      |                       ^~~
      |                       std::max
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int dp[110][31333];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, W, w[110], v[110];
	cin>>n>>W;
	REP(i, n){
		cin>>w[i]>>v[i];
	}
	if(w[0]>W){
		cout<<0<<'\n';
		return 0;
	}
	int m=300;
	ll mi=W/w[0]*m;
	CHMIN(mi, n*m);
	REP(i, n){
		REP(j, mi+1){
			dp[i][j]=-1;
		}
	}
	dp[0][0]=0;
	REP(i, n){
		REP(j, mi+1){
			CHMAX(dp[i+1][j], dp[i][j]);
			if(dp[i][j]>=0){
				int tmp=(j%m+w[i]-w[0]);
				CHMAX(dp[i+1][j/m*m+(tmp/w[0]+1)*m+tmp%w[0]], dp[i][j]+v[i]);
			}
		}
	}
	int ans=0;
	REP(i, mi+1){
		CHMAX(ans, dp[n][i]);
	}
	cout<<ans<<'\n';
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:14: error: no matching function for call to 'CHMIN(ll&, int)'
   48 |         CHMIN(mi, n*m);
      |         ~~~~~^~~~~~~~~
a.cc:21:34: note: candidate: 'template<class T> void CHMIN(T&, T)'
   21 | template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}
      |                                  ^~~~~
a.cc:21:34: note:   template argument deduction/substitution failed:
a.cc:48:14: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   48 |         CHMIN(mi, n*m);
      |         ~~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,W;
  cin >> N >> W;
  long long DP[N+1][W]={};
  list<long long> maxw={0};
  for (int i=1;i<N;i++){
    long long w,v;
    cin >> w >> v;
    for(long long x:maxw){
      if (x+w<=W) DP[i][x+w]=max(DP[i-1][x+w],DP[i-1][x]+v);
    }
  }
  long long ans=0;
  for(long long y:maxw){
    ans=max(DP[N][y],max);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: no matching function for call to 'max(long long int&, <unresolved overloaded function type>)'
   17 |     ans=max(DP[N][y],max);
      |         ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = long long int]'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:36: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const long long int&'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |                         ~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:17:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   17 |     ans=max(DP[N][y],max);
      |         ~~~^~~~~~~~~~~~~~
Language: C++

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

int main(){
  int n,wm; cin >> n >> wm;
  vector<vector<int>> a(4);
  int w; cin >> w;
  int v; cin >> v;
  a[0].push_back(v);
  for(int i=1;i<n;i++){
    int ww; cin >> ww >> v;
  	a[ww-w].push_back(v);
  }
  for(int i=0;i<4;i++) sort(a[i].begin(),a[i].end(), greater<int>());
  int ans = 0;
  for(int i=1;i<=a[0].size();i++)
    for(int j=1;j<=a[1].size();j++)
      for(int k=1;k<=a[2].size();k++)
        for(int l=1;l<=a[3].size();m++){
          if(i*w + j*(w+1) + k*(w+2) + l*(w+3) <= wm){
          int sum=0;
          for(int m=0;m<i;m++) sum+=a[0][m];
          for(int m=0;m<j;m++) sum+=a[1][m];
          for(int m=0;m<k;m++) sum+=a[2][m];
          for(int m=0;m<l;m++) sum+=a[3][m];
          ans = max(ans,sum);
          }
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:36: error: 'm' was not declared in this scope
   19 |         for(int l=1;l<=a[3].size();m++){
      |                                    ^