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

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

typedef long long ll;
#define endl '\n'
#define linf 0x3f3f3f3f3f3f3f3f

int n, w;
ll c[102], v[102];
ll dp[103][1003];

//dp[a][b] means the minimum weight to achieve val=b, using itens 1 to b

ll peso(int i, int val){
  if(val <=0) return 0;
  if(i==0) return inf;
  if(dp[i][val]!=-1) return dp[i][val];
  return dp[i][val]=min(peso(i-1, val), peso(i-1, val-v[i]) + c[i]);
}

int main(){ 
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  cin >> n >> w;
  for(int i=1; i<=n; i++) cin >> c[i] >> v[i];

  for(int i=1; i<=n; i++){
    for(int j=1; j<=1000; j++){
      dp[i][j]=-1;
    }
  }

  for(int val=1000; val>=0; val--) {
    if(peso(n, val)<=w){
      cout << val << endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'll peso(int, int)':
a.cc:16:19: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   16 |   if(i==0) return inf;
      |                   ^~~
      |                   ynf
Language: C++

#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
const int N = 1e5 + 10;
int dp[N];
int w[110];
int v[110];
int main()
{
	int n, sumw;
	scanf("%d%d", &n, &sumw);
	int sum = 0;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", &w[i], &v[i]);
		sum += v[i];
	}
	memset(dp, 0x3f3f3f3f, sizeof(dp));
	dp[0] = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = sum; j >= v[i]; j--)
		{
			dp[j] = min(dp[j],dp[j - v[i]] + w[i]);
		}
	}
	for (int i = sum; i >= 0; i--)
	{
		if (dp[i] <= sumw)
		{
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(void)
{
    IOS
    int n, W;
    cin >> n >> W;
    vector<ll> w(n), v(n);
    REP(i,n) cin >> w[i] >> v[i];

    map<ll,ll> dp;
    dp[0] = 0;
    ll ans = 0;
    REP(i,n) {
        for(auto x:dp) {
            if (x.first + w[i] <= W) {
                dp[x.first + w[i] = max(x.second + v[i], dp[x.first+w[i]);
                ans = max(ans,dp[x.first+w[i]);
                //cerr << x + w[i] << " " << dp[i+1][x + w[i]] << endl;
            }
        }
        //cerr << endl;
    }

    cout << ans << '\n';


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:73: error: expected ']' before ')' token
   30 |                 dp[x.first + w[i] = max(x.second + v[i], dp[x.first+w[i]);
      |                                                                         ^
      |                                                                         ]
a.cc:30:28: error: lvalue required as left operand of assignment
   30 |                 dp[x.first + w[i] = max(x.second + v[i], dp[x.first+w[i]);
a.cc:30:74: error: expected ']' before ';' token
   30 |                 dp[x.first + w[i] = max(x.second + v[i], dp[x.first+w[i]);
      |                                                                          ^
      |                                                                          ]
a.cc:31:46: error: expected ']' before ')' token
   31 |                 ans = max(ans,dp[x.first+w[i]);
      |                                              ^
      |                                              ]
Language: C++

/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long w,i,j,n;
    cin>>n>>w;
    vector<pair<long long,long long>> v(n+1);
    vector<vector<long long>> v(n+1,vector<long long> (w+1));
    for(i=1;i<n+1;++i)
    {
        cin>>v[i].first>>v[i].second;
    }
    for(i=0;i<n+1;++i)  dp[i][0] = 0;
    for(i=0;i<w+1;++i)  dp[0][i] = 0;
    for(i=1;i<n+1;++i)
    {
        for(j=1;j<w+1;++j)
        {
            if(j-v[i].first < 0)
                dp[i][j] = dp[i-1][j];
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-v[i].first]+v[i].second);
            }
        }
    }
    cout<<dp[n][w];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:31: error: conflicting declaration 'std::vector<std::vector<long long int> > v'
   16 |     vector<vector<long long>> v(n+1,vector<long long> (w+1));
      |                               ^
a.cc:15:39: note: previous declaration as 'std::vector<std::pair<long long int, long long int> > v'
   15 |     vector<pair<long long,long long>> v(n+1);
      |                                       ^
a.cc:21:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   21 |     for(i=0;i<n+1;++i)  dp[i][0] = 0;
      |                         ^~
      |                         dup
a.cc:22:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |     for(i=0;i<w+1;++i)  dp[0][i] = 0;
      |                         ^~
      |                         dup
a.cc:28:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   28 |                 dp[i][j] = dp[i-1][j];
      |                 ^~
      |                 dup
a.cc:31:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   31 |                 dp[i][j] = max(dp[i-1][j],dp[i-1][j-v[i].first]+v[i].second);
      |                 ^~
      |                 dup
a.cc:35:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   35 |     cout<<dp[n][w];
      |           ^~
      |           dup
Language: C++

/** Author : Parth Prajapati
 * 	Institute : Pandit Deendayal Petroleum University
**/
#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    long long w,i,j;
    cin>>n>>w;
    vector<pair<int,long long>> v(n+1);
    vector<vector<long long>> v(n+1,vector<long long> (w+1));
    for(i=1;i<n+1;++i)
    {
        cin>>v[i].first>>v[i].second;
    }
    for(i=0;i<n+1;++i)  dp[i][0] = 0;
    for(i=0;i<w+1;++i)  dp[0][i] = 0;
    for(i=1;i<n+1;++i)
    {
        for(j=1;j<w+1;++j)
        {
            if(j-v[i].first < 0)
                dp[i][j] = dp[i-1][j];
            else
            {
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-v[i].first]+v[i].second);
            }
        }
    }
    cout<<dp[n][w];
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:31: error: conflicting declaration 'std::vector<std::vector<long long int> > v'
   17 |     vector<vector<long long>> v(n+1,vector<long long> (w+1));
      |                               ^
a.cc:16:33: note: previous declaration as 'std::vector<std::pair<int, long long int> > v'
   16 |     vector<pair<int,long long>> v(n+1);
      |                                 ^
a.cc:22:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   22 |     for(i=0;i<n+1;++i)  dp[i][0] = 0;
      |                         ^~
      |                         dup
a.cc:23:25: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |     for(i=0;i<w+1;++i)  dp[0][i] = 0;
      |                         ^~
      |                         dup
a.cc:29:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   29 |                 dp[i][j] = dp[i-1][j];
      |                 ^~
      |                 dup
a.cc:32:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   32 |                 dp[i][j] = max(dp[i-1][j],dp[i-1][j-v[i].first]+v[i].second);
      |                 ^~
      |                 dup
a.cc:36:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   36 |     cout<<dp[n][w];
      |           ^~
      |           dup
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

const int k = 100001;
int n, m;
long long dp[k];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> m;
	
	long long ret = 0;
	memset(dp, 0x3f3f3f3f, sizeof(dp));
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		long long w, v;
		cin >> w >> v;
		for(int j = k - v - 1; j >= 0; j--){
			dp[j + v] = min(dp[j + v], dp[j] + w);
			if(dp[j + v] <= m) ret = max(ret, j + v);
		}
	}
	
	cout << ret << endl;

	return 0;
}#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
using namespace std;
#define endl '\n'
#define pi pair<int, int>

const int k = 100001;
int n, m;
long long dp[k];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n >> m;
	
	long long ret = 0;
	memset(dp, 0x3f3f3f3f, sizeof(dp));
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		long long w, v;
		cin >> w >> v;
		for(int j = k - v - 1; j >= 0; j--){
			dp[j + v] = min(dp[j + v], dp[j] + w);
			if(dp[j + v] <= m) ret = max(ret, j + v);
		}
	}
	
	cout << ret << endl;

	return 0;
}

Compiler output:
a.cc:34:2: error: stray '#' in program
   34 | }#include <iostream>
      |  ^
a.cc:34:3: error: 'include' does not name a type
   34 | }#include <iostream>
      |   ^~~~~~~
a.cc:42:11: error: redefinition of 'const int k'
   42 | const int k = 100001;
      |           ^
a.cc:9:11: note: 'const int k' previously defined here
    9 | const int k = 100001;
      |           ^
a.cc:43:5: error: redefinition of 'int n'
   43 | int n, m;
      |     ^
a.cc:10:5: note: 'int n' previously declared here
   10 | int n, m;
      |     ^
a.cc:43:8: error: redefinition of 'int m'
   43 | int n, m;
      |        ^
a.cc:10:8: note: 'int m' previously declared here
   10 | int n, m;
      |        ^
a.cc:44:11: error: redefinition of 'long long int dp [100001]'
   44 | long long dp[k];
      |           ^~
a.cc:11:11: note: 'long long int dp [100001]' previously declared here
   11 | long long dp[k];
      |           ^~
a.cc:46:5: error: redefinition of 'int main()'
   46 | int main(){
      |     ^~~~
a.cc:13:5: note: 'int main()' previously defined here
   13 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long int w[108],v[108],n;
long long int dp[105][1000000008]={0},W;
long long int solve(int i, long long int c)
{
    long long int ans1,ans2;
    //ans1=0;ans2=0;
    if(i==n+1){return 0;}
    if(dp[i][c]!=-1)
    {return dp[i][c];}
    ans1=solve(i+1,c);
    if((c-w[i])>=0){ans2=solve(i+1,c-w[i])+v[i];}
    else{ans2=0;}
    dp[i][c]=max(ans1,ans2);
    return max(ans1,ans2);
 
}
int main()
{
    int i;
    //long long int a;
    cin>>n>>W;
    for(i=0;i<=101;i++)
        for(int j=0;j<=1000000004;j++)
            dp[i][j]=-1;
        
    for(i=1;i<=n;i++)
    {
        cin>>w[i]>>v[i];
        //cout<<dp[1][i];
    }
    //a=solve(1,W,N);
    cout<<solve(1,W);
}

Compiler output:
/tmp/ccLiX1LK.o: in function `main':
a.cc:(.text+0x197): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccLiX1LK.o
a.cc:(.text+0x26b): relocation truncated to fit: R_X86_64_PC32 against symbol `W' defined in .bss section in /tmp/ccLiX1LK.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <cassert>
#include <utility>

using namespace std;
using ll = long long;
using pr = pair<ll, ll>;

ll KnapsackDPW(vector<pr>&sack, int w) {
	vector<pr>dp(sack.size() + 1);
	sort(sack.begin(), sack.end());

	ll m = 0;

	for (int i = 0; i < sack.size(); ++i) {
		int temp_w = w - sack[i].first;
		dp[i] = { temp_w, sack[i].second };
		for (int j = i - 1; j >= 0; --j) {
			if (dp[j].first - dp[i].first >= 0 && dp[i].second < sack[i].second + dp[j].second) {
				dp[i] = { dp[j].first - dp[i].first, sack[i].second + dp[j].second };
			}
		}
	}

	return dp[sack.size() - 1].second;
}

int main() {
	/*fio;
	int n = 10;
	vector<vector<short>>board(n, vector<short>(n, 0));

	MoveOfAKnight(board, 0, 0);

	for (auto &x : board) {
		for (auto y : x)
			cout << ((y < 10) ? "0" : "") << y << " ";
		cout << endl;
	}*/
	int N, W, w, c;
	cin >> N >> W;
	vector<pr>sack;
	for (int i = 0; i < N; ++i) {
		cin >> w >> c;
		sack.push_back({ w, c });
	}
	cout << KnapsackDPW(sack, W) << endl;
}

Compiler output:
a.cc: In function 'll KnapsackDPW(std::vector<std::pair<long long int, long long int> >&, int)':
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   14 |         sort(sack.begin(), sack.end());
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>
#define MAXN 101
#define ll long long
using namespace std;
ll n,W,w[MAXN],v[MAXN],dp[100010][101];
int main(){
	scanf("%lld%lld",&n,&W);
	for(int i=0;i<n;i++){
		scanf("%lld%lld",w+i,v+i);
	}
	
	for(int i=0;i<=100000;i++){
		for(int j=0;j<n;j++){
			if(i==v[j] && w[j]<=W){
				dp[i][j] = w[j];
			}
			if(dp[i][j-1]){
				dp[i][j] = dp[i][j-1];
				if(dp[i][j-1]+w[j]<=W){
					dp[i+v[j]][j]=dp[i][j-1]+w[j];
				}
			}
		}
	}
	ll resp = 0;
	for(int i=0;i<=100000;i++){
		for(int j=0;j<n;j++){
			if(dp[i][j]){
				resp = max(resp,i);
			}
		}
	}
	printf("%lld\n",resp);
	return 0;
}

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

#include<bits/stdc++.h>

using namespace std;

int main()
{
  int n,w;
  cin>>n>>w;
  
  pair<long long ,long long>a[n];
  
  for(int i=0;i<n;i++)
    cin>>a[i].first>>a[i].second;
  
    map<long long ,map<long long,long long> > dp;
    
    memset(dp,0,sizeof(dp));
  
  	for(int i=1;i<n+1;i++)
    {
      	for(int j=1;j<=w;j++)
        {
          	if(a[i-1].first>j)
            {
              dp[i][j] = dp[i-1][j];
            }
          
          	else if(j==a[i-1].first)
            {
              	dp[i][j] = max(dp[i-1][j],a[i-1].second);
            }
          
          	else
            {
              	dp[i][j] = max(dp[i-1][j],dp[i-1][j-a[i-1].first] + a[i-1].second);
            }
        }
    }

	cout<<dp[n][w]<<endl;  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: cannot convert 'std::map<long long int, std::map<long long int, long long int> >' to 'void*'
   17 |     memset(dp,0,sizeof(dp));
      |            ^~
      |            |
      |            std::map<long long int, std::map<long long int, long long 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<bits/stdc++.h>
using namespace std;
#define int long long
typedef unsigned long long ull;
typedef long double ld;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265
const int MOD=1e9+7;
 
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a)  (a).begin(),(a).end()

const int N=1e9+5;

int n,w;
int a[N][3];
int dp[105][N];

int go(int pos,int wei)
{
    if(wei>w) return -1e18;
    if(pos==n+1)
        return 0;
    int &ans=dp[pos][wei];
    if(ans!=-1)
        return ans;
  	ans=0;
    ans=max(go(pos+1,wei),a[pos][2]+go(pos+1,wei+a[pos][1]));
    return ans;

}

int32_t main()
{
    IOS;
    cin>>n>>w;
    for(int i=1;i<=n;i++)
    {
        for(int j : {1,2})
            cin>>a[i][j];
    }
    memset(dp,-1,sizeof(dp));
    cout<<go(1,0)<<endl;
    
}


Compiler output:
/tmp/ccRdN3rv.o: in function `go(long long, long long)':
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccRdN3rv.o
/tmp/ccRdN3rv.o: in function `main':
a.cc:(.text+0x278): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccRdN3rv.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef unsigned long long ull;
typedef long double ld;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265
const int MOD=1e9+7;
 
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a)  (a).begin(),(a).end()

const int N=1e9+5;

int n,w;
int a[N][3];
int dp[105][N];

int go(int pos,int wei)
{
    if(wei>w) return -1e15;
    if(pos==n+1)
        return 0;
    int &ans=dp[pos][wei];
    if(ans!=-1)
        return ans;
  	ans=0;
    ans=max(go(pos+1,wei),a[pos][2]+go(pos+1,wei+a[pos][1]));
    return ans;

}

int32_t main()
{
    IOS;
    cin>>n>>w;
    for(int i=1;i<=n;i++)
    {
        for(int j : {1,2})
            cin>>a[i][j];
    }
    memset(dp,-1,sizeof(dp));
    cout<<go(1,0)<<endl;
    
}


Compiler output:
/tmp/ccgoq54R.o: in function `go(long long, long long)':
a.cc:(.text+0x65): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccgoq54R.o
/tmp/ccgoq54R.o: in function `main':
a.cc:(.text+0x278): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccgoq54R.o
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

const int maxn = 1000000000+5;
const int inf = 0x3f3f3f3f;
const int maxm=1000000000+5;

long long a[maxn],t[maxn],f[maxm];

int main(){
	int n,m;
	cin>>n>>m;
    for(int i=1;i<=n;i++){
    	cin>>t[i]>>a[i];
    }
    for(int j=1;j<=m;j++){
    	f[j]=-inf;
    }
    f[0]=0;
    for(int i=1;i<=n;i++){
    	for(int j=m;j>=0;j--){
    		if(j>=t[i]){
    			f[j]=max(f[j],f[j-t[i]]+a[i]);
    		}	
    		}
    }
    long long ret=-1;
    for(int j=0;j<=m;j++){
    	ret=max(ret,f[j]);
    }
cout<<ret <<endl;
return 0;
	
}

Compiler output:
/tmp/ccrZvCyM.o: in function `main':
a.cc:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0xac): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0xc7): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0xfc): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0x123): relocation truncated to fit: R_X86_64_PC32 against symbol `t' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccrZvCyM.o
a.cc:(.text+0x1dd): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccrZvCyM.o
collect2: error: ld returned 1 exit status
Language: C++

def solve():
    N, W = map(int, input().split())
    MAX_V = 100000
    MAX_N = 100
    w = []
    v = []
    for i in range(N):
        tmpw, tmpv = map(int, input().split())
        w.append(tmpw)
        v.append(tmpv)

    dp = [[float('inf') for i in range(MAX_V+1)] for j in range(MAX_N+1)]

    dp[0][0] = 0

    for i in range(N):
        for sum_v in range(MAX_V):
            if sum_v - v[i] >= 0:
                dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v - v[i]] + w[i])
            
            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])
        
    res = 0
    for sum_v in range(MAX_V+1):
        if dp[N][sum_v] <= W:
            res = sum_v
    print(res)

if __name__ == '__main__':
    solve()

Compiler output:
a.cc:12:18: warning: multi-character character constant [-Wmultichar]
   12 |     dp = [[float('inf') for i in range(MAX_V+1)] for j in range(MAX_N+1)]
      |                  ^~~~~
a.cc:29:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   29 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def solve():
      | ^~~
Language: C++

#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N=1e5+5;
map<int> dp;
int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int N,W;
	cin>>N>>W;
	forn(i,N){
		int w,v;
		cin>>w>>v;
		for(int j=W;j>=w;j--){
			dp[j]=max(dp[j],dp[j-w]+v);
		}
	}
	cout<<dp[W];
    return 0;
}



Compiler output:
a.cc:24:8: error: wrong number of template arguments (1, should be at least 2)
   24 | map<int> dp;
      |        ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc: In function 'int main()':
a.cc:35:27: error: invalid types 'int[int]' for array subscript
   35 |                         dp[j]=max(dp[j],dp[j-w]+v);
      |                           ^
a.cc:35:37: error: invalid types 'int[int]' for array subscript
   35 |                         dp[j]=max(dp[j],dp[j-w]+v);
      |                                     ^
a.cc:35:43: error: invalid types 'int[int]' for array subscript
   35 |                         dp[j]=max(dp[j],dp[j-w]+v);
      |                                           ^
a.cc:38:17: error: invalid types 'int[int]' for array subscript
   38 |         cout<<dp[W];
      |                 ^
Language: C++

#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define fore(i, l, r) for (int i = int(l); i <= int(r); ++i)
#define ford(i, n) for (int i = int(n)-1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define endl '\n'
#define de(x) cout<<#x<<" = "<<(x)<<endl
#define de2(x,y) cout<<#x<<" = "<<(x) <<' '<< #y<<" = "<<y<<endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

const int N=1e5+5;
unordered_map<int> dp;
int main() {

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int N,W;
	cin>>N>>W;
	forn(i,N){
		int w,v;
		cin>>w>>v;
		for(int j=W;j>=w;j--){
			dp[j]=max(dp[j],dp[j-w]+v);
		}
	}
	cout<<dp[W];
    return 0;
}



Compiler output:
a.cc:24:18: error: wrong number of template arguments (1, should be at least 2)
   24 | unordered_map<int> dp;
      |                  ^
In file included from /usr/include/c++/14/unordered_map:41,
                 from /usr/include/c++/14/functional:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/unordered_map.h:109:11: note: provided for 'template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> class std::unordered_map'
  109 |     class unordered_map
      |           ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:35:27: error: invalid types 'int[int]' for array subscript
   35 |                         dp[j]=max(dp[j],dp[j-w]+v);
      |                           ^
a.cc:35:37: error: invalid types 'int[int]' for array subscript
   35 |                         dp[j]=max(dp[j],dp[j-w]+v);
      |                                     ^
a.cc:35:43: error: invalid types 'int[int]' for array subscript
   35 |                         dp[j]=max(dp[j],dp[j-w]+v);
      |                                           ^
a.cc:38:17: error: invalid types 'int[int]' for array subscript
   38 |         cout<<dp[W];
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define debug(x) cerr<<#x<<" "<<x<<endl;
#define f(i,n) for(ll i=0; i<n; i++)
#define f1(i,n) for(ll i=1; i<=n; i++)
#define fr(i,n) for(ll i=n-1; i>=0; i--)
#define f1r(i,n) for(ll i=n; i>0; i--)
#define mst(arr,val) memset(arr,val,sizeof(arr))
#define all(x) x.begin(),x.end()

typedef long long int ll;
typedef pair<ll,ll> pii;
ll M=1e9+7;
ll M2=998244353;
void show(vector<ll> v)
{
    for(int i=0; i<v.size(); i++)
        cout<<v[i]<<" ";
    cout<<"\n";
}
void showrev(vector<ll> v)
{
    for(int i=0; i<v.size(); i++)
        cout<<v[v.size()-i-1]<<" ";
    cout<<"\n";
}
void showarr(ll arr[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<arr[i]<<" ";
    cout<<"\n";
}
void showpv(vector<pair<ll,ll> > v)
{
    f(i,v.size())
        cout<<"("<<v[i].ff<<","<<v[i].ss<<")"<<" ";
    cout<<"\n";
}
void showmap(map<ll,ll> m)
{
    for(auto i:m)
        cout<<" ("<<i.ff<<","<<i.ss<<") ";
    cout<<"\n";
}
ll knapSack(ll W, ll wt, ll val[], ll n)  
{  
    if (n == 0 || W == 0)  
        return 0;  
    if (wt[n-1] > W)  
        return knapSack(W, wt, val, n-1);  
  
    else return max( val[n-1] + knapSack(W-wt[n-1], wt, val, n-1),  
                    knapSack(W, wt, val, n-1) );  
}  
int main()
{
    IOS
    ll T = 1,Q=1;
    //cin>>T;

    while(T--)
    {
        ll n,w; cin>>n>>w;
        ll wth[n],val[n];
        f(i,n)
            cin>>wth[i]>>val[i];
        ll ans = knapSack(w,wt,val,n);
        cout<<ans<<"\n";
    }
    return 0;
}


Compiler output:
a.cc: In function 'll knapSack(ll, ll, ll*, ll)':
a.cc:55:11: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   55 |     if (wt[n-1] > W)
      |           ^
a.cc:58:46: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   58 |     else return max( val[n-1] + knapSack(W-wt[n-1], wt, val, n-1),
      |                                              ^
a.cc: In function 'int main()':
a.cc:73:29: error: 'wt' was not declared in this scope; did you mean 'wth'?
   73 |         ll ans = knapSack(w,wt,val,n);
      |                             ^~
      |                             wth
Language: C++

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

#define int               long long
#define endl              '\n'
#define ff                first
#define ss                second
#define pb                push_back
#define vii               vector<int> 
#define pii               pair<int,int>
#define loop(i,s,e)       for(int i=s;i<e;i++)
#define mset(a,f)         memset(a,f,sizeof(a))
#define fastio            ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

int n, W;
pii arr[N];
int  dp[N][100007];

int getval(int it, int v)
{            
      if( v == 0 ) return 0;
      if( v < 0 || it == 0 ) return inf;  
      if( dp[it][v] != -1 ) return dp[it][v];
      int a = inf , b = inf;
      a = arr[it].ff + getval(it - 1, v - arr[it].ss);
      b = getval(it - 1, v);
      return dp[it][v] = min(a,b);
}

int32_t main() {
      fastio;
    
      cin >> n >> W;
      loop(i,1,n+1)  cin >> arr[i].ff >> arr[i].ss;
      mset(dp,-1);
      int ans = 0;
      loop(v,0,100001) if( getval(n,v) <= W ) ans = v;
      cout << ans << endl; 

}















Compiler output:
a.cc:16:9: error: 'N' was not declared in this scope
   16 | pii arr[N];
      |         ^
a.cc:17:9: error: 'N' was not declared in this scope
   17 | int  dp[N][100007];
      |         ^
a.cc: In function 'long long int getval(long long int, long long int)':
a.cc:22:37: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   22 |       if( v < 0 || it == 0 ) return inf;
      |                                     ^~~
      |                                     ynf
a.cc:23:11: error: 'dp' was not declared in this scope; did you mean 'dup'?
   23 |       if( dp[it][v] != -1 ) return dp[it][v];
      |           ^~
      |           dup
a.cc:24:15: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   24 |       int a = inf , b = inf;
      |               ^~~
      |               ynf
a.cc:25:11: error: 'arr' was not declared in this scope
   25 |       a = arr[it].ff + getval(it - 1, v - arr[it].ss);
      |           ^~~
a.cc:26:7: error: 'b' was not declared in this scope
   26 |       b = getval(it - 1, v);
      |       ^
a.cc:27:14: error: 'dp' was not declared in this scope; did you mean 'dup'?
   27 |       return dp[it][v] = min(a,b);
      |              ^~
      |              dup
a.cc: In function 'int32_t main()':
a.cc:34:29: error: 'arr' was not declared in this scope
   34 |       loop(i,1,n+1)  cin >> arr[i].ff >> arr[i].ss;
      |                             ^~~
a.cc:35:12: error: 'dp' was not declared in this scope; did you mean 'dup'?
   35 |       mset(dp,-1);
      |            ^~
a.cc:12:34: note: in definition of macro 'mset'
   12 | #define mset(a,f)         memset(a,f,sizeof(a))
      |                                  ^
Language: C++

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
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; }
int INF=1e10;
int MOD=1e9+7;
signed main(){
int a,b;
cin>>a>>b;
vector<int> c(a),d(a);
rep(i,a)
cin>>c[i]>>d[i];
int dp[110][100010];
rep(i,110)rep(j,100010)
dp[i][j]=INF;
dp[0][0]=0;

rep(i,a)rep(j,100010){
if(j>=v[i])
  chmin(dp[i+1][j],dp[i][j-v[i]]+w[i]);
chmin(dp[i+1][j],dp[i][j]);
}
int ans=0;
rep(i,100010){
if(dp[a][i]<=b)
  ans=i;
}
cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:7: error: 'v' was not declared in this scope
   29 | if(j>=v[i])
      |       ^
a.cc:30:34: error: 'w' was not declared in this scope
   30 |   chmin(dp[i+1][j],dp[i][j-v[i]]+w[i]);
      |                                  ^
Language: C++

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

#define ll long long int
#define loop(i,s,e) for(ll i=s; i<e; i++)
#define endl '\n'
#define vll vector<ll>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define bug(...)        __f (#__VA_ARGS__, __VA_ARGS__)
#define N 100001
#define pb push_back
#define INF LLONG_MAX
#define inf INT_MAX
#define minusinf INT_MIN

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

ll n, w;
ll weight[101], value[101];
ll dp[10000001];

map<pll, ll> mp;

ll index = 0;

ll util(ll i, ll wt){
	if(i>=n) return 0;
	pll temp = {i,wt}; 

	if(mp.count(temp)!=0 and dp[mp[temp]]!=-1) return dp[mp[temp]];

	ll a = minusinf, b = minusinf;

	if(wt + weight[i] <= w) a = value[i] + util(i+1, wt + weight[i]);
	b = util(i+1, wt);

	if(mp.count(temp)==0){
		mp[temp]=index;
		index++;
	}

	return dp[mp[temp]] = max(a, b);
}

void alpha(){

	cin>>n>>w;
	loop(i,0,n) cin>>weight[i]>>value[i];

	memset(dp, -1, sizeof(dp));

	cout<<util(0, 0)<<endl;

	// for(auto i: mp) cout<<i.ff.ff<<" "<<i.ff.ss<<" "<<i.ss<<endl;

	return;

}

int main(){

	ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);


    ll t=1;
	//cin>>t;

  	while(t--) alpha();

	return 0;

}

Compiler output:
a.cc:33:4: error: 'long long int index' redeclared as different kind of entity
   33 | ll index = 0;
      |    ^~~~~
In file included from /usr/include/string.h:462,
                 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/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'long long int util(long long int, long long int)':
a.cc:47:26: error: cannot resolve overloaded function 'index' based on conversion to type 'std::map<std::pair<long long int, long long int>, long long int>::mapped_type' {aka 'long long int'}
   47 |                 mp[temp]=index;
      |                          ^~~~~
a.cc:48:22: error: no post-increment operator for type
   48 |                 index++;
      |                      ^~
Language: C++

#include <iostream>
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=1018LL+5;

void max_self(ll& a, ll b) {
    a = max(a, b);
}


void min_self(ll& a, ll b) {
    a = min(a, b);
}

void knapsack2()
{
int n, W;
    scanf("%d%d", &n, &W);
    vector<int> weight(n), value(n);
    for(int i = 0; i < n; ++i) {
        scanf("%d%d", &weight[i], &value[i]);
    }
    int sum_value = 0;
    for(int x : value) {
        sum_value += x;
    }
    vector<ll> dp(sum_value + 1, INF); // 0 ... W
    dp[0] = 0;
    // dp[i] - the minimum total weight of items with total value exactly i
    for(int item = 0; item < n; ++item) {
        for(int value_already = sum_value - value[item]; value_already >= 0; --value_already) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            min_self(dp[value_already+value[item]], dp[value_already] + weight[item]);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= sum_value; ++i) {
        if(dp[i] <= W) {
            answer = max(answer, (ll) i);
        }
       
    }
    printf("%lld\n", answer);
}
int main() {
    /
    knapsack2();
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:5: error: expected primary-expression before '/' token
   47 |     /
      |     ^
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define pb                push_back
#define ppb               pop_back
#define pf                push_front
#define ppf               pop_front
#define all(x)            (x).begin(),(x).end()
#define int               long long
#define fr                first
#define sc                second
#define vc                vector
#define endl              '\n'
#define pii               pair<int,int>
#define msi               map<string,int>
#define mii               map<int,int>
#define psi               pair<string,int>
#define pis               pair<int,string>
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define LSB(i)            ((i)&-(i))

template<typename T>
using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 105;
const int V = 1e5 + 5;
int w[N], v[N];
int dp[N][V];
int n, wt;

int dynamic(int pos, int we, int val)
{

    if (we > wt)
        return INT_MIN;
    if (pos >= n)
        return 0;
    if (dp[pos][val] != -1)
        return dp[pos][val];
    int ans;
    ans = max(dynamic(pos + 1, we + w[pos], val + v[pos]) + val[pos], dynamic(pos + 1, we, val));
    dp[pos][val] = ans;
    return ans;
}

void solve()
{
    cin >> n >> wt;
    mem1(dp);
    for (int i = 0; i < n; i++)
        cin >> w[i] >> v[i];
    cout << dynamic(0, 0, 0);
}
signed main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}

Compiler output:
a.cc: In function 'long long int dynamic(long long int, long long int, long long int)':
a.cc:46:64: error: invalid types 'long long int[long long int]' for array subscript
   46 |     ans = max(dynamic(pos + 1, we + w[pos], val + v[pos]) + val[pos], dynamic(pos + 1, we, val));
      |                                                                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, w;
  cin >> n >> w;
  vi wei(n), val(n);
  rep(i, n) cin >> wei[i] >> val[i];
  int vmax = n * 1000;
  vector<vi> dp(n + 1, vi(vmax + 1, w + 1));
  dp[0][0] = 0;
  rep(i, n) rep(j, vmax + 1) {
    dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
    if(j + val[i] <= vmax)
  #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n, w;
  cin >> n >> w;
  vi wei(n), val(n);
  rep(i, n) cin >> wei[i] >> val[i];
  int vmax = n * 1000;
  vector<vi> dp(n + 1, vi(vmax + 1, w + 1));
  dp[0][0] = 0;
  rep(i, n) rep(j, vmax + 1) {
    dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
    dp[i + 1][j + val[i]] = min(dp[i + 1][j + val[i]], dp[i][j] + wei[i]);
  }
  int ans = 0;
  rep(j, vmax + 1) if(dp[n][j] <= w) ans = j;
  cout << ans << endl;
}    dp[i + 1][j + val[i]] = min(dp[i + 1][j + val[i]], dp[i][j] + wei[i]);
  }
  int ans = 0;
  rep(j, vmax + 1) if(dp[n][j] <= w) ans = j;
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   40 | int main() {
      |         ^~
a.cc:40:9: note: remove parentheses to default-initialize a variable
   40 | int main() {
      |         ^~
      |         --
a.cc:40:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:40:12: error: a function-definition is not allowed here before '{' token
   40 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
    ll val[100001];
    ll wei[100001];
int32_t main()
{
    ll n,w;
    cin>>n>>w;
    ll dp[w+1][n+1];

    for(int i=0;i<n;i++)
    {
          cin>>wei[i];
        cin>>val[i];

    }
    for(int i=0;i<=w;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==0||j==0)
            dp[i][j]=0;

            else if(i<wei[j-1])
                dp[i][j]=dp[i][j-1];
            else
                dp[i][j]=max(val[j-1]+dp[i-wei[j-1]][j-1],dp[i][j-1]);

        }
    }

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:31:6: error: expected '}' at end of input
   31 |     }
      |      ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int v[105],w[105];
long long dp[1e9+5];

int main()
{
	int n,W;
	cin>>n>>W;
//	memset(dp,0,sizeof(dp));
	for(int i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	for(int i=1;i<=n;i++)
		for(int j=W;j>=w[i];j--)
			dp[j]=max(dp[j-w[i]]+v[i],dp[j]);
	cout<<dp[W];
	//long long ans=-1;
//	for(int i=0;i<=W;i++)
//		ans=max(ans,dp[i]);		
//	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:5:17: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    5 | long long dp[1e9+5];
      |              ~~~^~
a.cc:5:17: error: could not convert '(1.0e+9 + (double)5)' from 'double' to 'long unsigned int'
    5 | long long dp[1e9+5];
      |              ~~~^~
      |                 |
      |                 double
a.cc:5:17: error: size of array 'dp' has non-integral type 'double'
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long w[8100000000],v[8100000000];
long long f[8101000];
int main(){
	int n,W;
	cin>>n>>W;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];		
	}	
	for(int i=1;i<=n;i++)
	{
		for(int t=W;t>=w[i];t--)
		{
				f[t]=max(f[t],f[t-w[i]]+v[i]);
		}
	}
	cout<<f[W];
	return 0;
}



Compiler output:
/tmp/ccQWyRXS.o: in function `main':
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQWyRXS.o
a.cc:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccQWyRXS.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQWyRXS.o
a.cc:(.text+0x109): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccQWyRXS.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccQWyRXS.o
a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccQWyRXS.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long e=811100000;
long long w[e],v[e];
long long f[8101000];
int main(){
	int n,W;
	cin>>n>>W;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];		
	}	
	for(int i=1;i<=n;i++)
	{
		for(int t=W;t>=w[i];t--)
		{
				f[t]=max(f[t],f[t-w[i]]+v[i]);
		}
	}
	cout<<f[W];
	return 0;
}


Compiler output:
/tmp/ccsb3hg1.o: in function `main':
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccsb3hg1.o
a.cc:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccsb3hg1.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccsb3hg1.o
a.cc:(.text+0x109): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccsb3hg1.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccsb3hg1.o
a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccsb3hg1.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long e=811100000;
long long w[e],v[e];
long long f[8101000];
int main(){
	int n,W;
	cin>>n>>W;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];		
	}	
	for(int i=1;i<=n;i++)
	{
		for(int t=W;t>=w[i];t--)
		{
				f[t]=max(f[t],f[t-w[i]]+v[i]);
		}
	}
	cout<<f[W];
	return 0;
}


Compiler output:
/tmp/ccSA4yY3.o: in function `main':
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccSA4yY3.o
a.cc:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccSA4yY3.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccSA4yY3.o
a.cc:(.text+0x109): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccSA4yY3.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccSA4yY3.o
a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccSA4yY3.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long e=81110000000;
long long w[e],v[e];
long long f[8101000];
int main(){
	int n,W;
	cin>>n>>W;
	for(int i=1;i<=n;i++)
	{
		cin>>w[i]>>v[i];		
	}	
	for(int i=1;i<=n;i++)
	{
		for(int t=W;t>=w[i];t--)
		{
				f[t]=max(f[t],f[t-w[i]]+v[i]);
		}
	}
	cout<<f[W];
	return 0;
}


Compiler output:
/tmp/ccta6rs7.o: in function `main':
a.cc:(.text+0x75): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccta6rs7.o
a.cc:(.text+0xd2): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccta6rs7.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccta6rs7.o
a.cc:(.text+0x109): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccta6rs7.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccta6rs7.o
a.cc:(.text+0x186): relocation truncated to fit: R_X86_64_PC32 against symbol `f' defined in .bss section in /tmp/ccta6rs7.o
collect2: error: ld returned 1 exit status