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

#include<bits/stdc++.h>
using namespace std;
int n,w;
int arr[100][2];
long long dp[105][1000100000];
long long inf;
long long go(int i , int sum){
 
    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= w ; j++){
            if(arr[i-1][0] <= j)
            dp[i][j] = max(arr[i-1][1] + dp[i-1][j - arr[i-1][0]] , dp[i-1][j]);
            else
            dp[i][j] = dp[i-1][j];
        }
    }
    return dp[n][w];
}
int main(){
    cin >> n >> w;
    inf = 5 * 100000000000000;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < 2 ; j++)
            cin >> arr[i][j];
    long long res = go(0,0);
    if(res > 0)
        cout<<res;
    else
        cout<<0;
}

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

#include<bits/stdc++.h>
using namespace std;
pair<bool,long long int>mat[101][100002];
int main(){
	#ifdef EVAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int N,W;
	cin>>N>>W;
	long long int val[N];
	long long int pes[N];
	for(int i=0;i<N;i++)cin>>pes[i]>>val[i];
	mat[0][val[0]].first=1;
	mat[0][val[0]].second=pes[0];
	for(int i=1;i<N;i++){
		for(int j=0;j<100001;j++){
			if(mat[i-1][j].first==1){
				if(mat[i-1][j+val[i]].first==1){
					mat[i][j+val[i]].first=1;
					mat[i][j+val[i]].second=min(mat[i-1][j+val[i]].second,mat[i-1][j].second+pes[i]);
				}else{
					mat[i][j+val[i]].first=1;
					mat[i][j+val[i]].second=mat[i-1][j].second+pes[i];
				}
			}
			if(mat[i-1][j].first==1 && mat[i][j].first==0){
				mat[i][j].first=mat[i-1][j].first;
				mat[i][j].second=mat[i-1][j].second;
			}
		}
		if(mat[i-1][val[i]].first==0){
			mat[i][val[i]].first=1;
			mat[i][val[i]].second=pes[i];
		}else{
			mat[i][val[i]].first=1;
			mat[i][val[i]].second=min(mat[i-1][val[i]].second,pes[i])
		}
	}
	for(int i=100001;i>=0;i--){
		if(mat[N-1][i].first==1 && mat[N-1][i].second<=W){
			cout<<i;
			return 0;
		}		
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:82: error: expected ';' before '}' token
   37 |                         mat[i][val[i]].second=min(mat[i-1][val[i]].second,pes[i])
      |                                                                                  ^
      |                                                                                  ;
   38 |                 }
      |                 ~
Language: Java

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
      Scanner ob=new Scanner(System.in);
      int n=ob.nextInt();
      int s=ob.nextInt();
      int w[]=new int[n];
      int v[]=new int[n];
      int ans=0;
      ArrayList<Node>list=new ArrayList<>();
      for(int i=0;i<n;i++)
      {
          w[i]=ob.nextInt();
          v[i]=ob.nextInt();
          list.add(new Node(w[i],v[i]));
      }
      Collections.sort(list,new myComp());
      
     
      for(int i=0;i<n;i++)
      {
          int wt=list.get(i).w;
          int vt=list.get(i).v;
        //   System.out.println(wt+" "+vt+" s="+s);
          if(s>=wt)
          {
              s=s-wt;
              ans=ans+vt;
          }
      }

      System.out.println( ans);
    }
}
class myComp implements Comparator<Node>{
    public int compare(Node n1,Node n2)
    
    {
        if(n1.v!=n2.v)
            return n2.v-n1.v;
        else
            {
                return n1.w-n2.w;
            }
    }
}
class Node{
    int w,v;
    Node(int w,int v)
    {
        this.w=w;
        this.v=v;
    }
}

Compiler output:
Main.java:2: error: class MyClass is public, should be declared in a file named MyClass.java
public class MyClass {
       ^
1 error
Language: Java

import java.util.*;
public class MyClass {
    public static void main(String args[]) {
      Scanner ob=new Scanner(System.in);
      int n=ob.nextInt();
      int s=ob.nextInt();
      int w[]=new int[n];
      int v[]=new int[n];
      int ans=0;
      ArrayList<Node>list=new ArrayList<>();
      for(int i=0;i<n;i++)
      {
          w[i]=ob.nextInt();
          v[i]=ob.nextInt();
          list.add(new Node(w[i],v[i]));
      }
      Collections.sort(list,new myComp());
      
     
      for(int i=0;i<n;i++)
      {
          int wt=list.get(i).w;
          int vt=list.get(i).v;
        //   System.out.println(wt+" "+vt+" s="+s);
          if(s>=wt)
          {
              s=s-wt;
              ans=ans+vt;
          }
      }

      System.out.println( ans);
    }
}
class myComp implements Comparator<Node>{
    public int compare(Node n1,Node n2)
    
    {
        if(n1.v!=n2.v)
            return n2.v-n1.v;
        else
            {
                return n2.w-n1.w;
            }
    }
}
class Node{
    int w,v;
    Node(int w,int v)
    {
        this.w=w;
        this.v=v;
    }
}

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

#define ll long long int
#define fr(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#include<bits/stdc++.h>
//https://atcoder.jp/contests/dp/submissions/12796237
using namespace std;

int main()
{
ll N,W;
  cin>>N;
  cin>>W;

  ll arr1[N][2];
  fr(i,0,N)
  {
    cin>>arr1[i][0];
  cin>>arr1[i][1];
  }
  ll Wt[N];
  ll val[N];
  fr(i,0,N)
  {
    Wt[i]=arr1[i][0];
    val[i]=arr1[i][1];#define ll long long int
#define fr(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#include<bits/stdc++.h>
//https://atcoder.jp/contests/dp/submissions/12796237
using namespace std;

int main()
{
ll N,W;
  cin>>N;
  cin>>W;

  ll arr1[N][2];
  fr(i,0,N)
  {
    cin>>arr1[i][0];
  cin>>arr1[i][1];
  }
  ll Wt[N];
  ll val[N];
  fr(i,0,N)
  {
    Wt[i]=arr1[i][0];
    val[i]=arr1[i][1];
  }
  ll dp[N+1][W+1];
  fr(i,0,N+1){
   dp[i][0]=0;
  }
  fr(i,0,W+1)
  dp[0][i]=0;
    fr(i,1,N+1)
      fr(j,1,W+1)
    {
    if(Wt[i-1]<=j)
      dp[i][j]=max(val[i-1]+dp[i-1][j-Wt[i-1]],dp[i-1][j]);

      else
        dp[i][j]=dp[i-1][j];

    }
  }
  ll dp[N+1][W+1];
  fr(i,0,N+1){
   dp[i][0]=0;
  }
  fr(i,0,W+1)
  dp[0][i]=0;
    fr(i,1,N+1)
      fr(j,1,W+1)
    {
    if(Wt[i-1]<=j)
      dp[i][j]=max(val[i-1]+dp[i-1][j-Wt[i-1]],dp[i-1][j]);

      else
        dp[i][j]=dp[i-1][j];

    }
  cout<<dp[N][W];
}

Compiler output:
a.cc:24:23: error: stray '#' in program
   24 |     val[i]=arr1[i][1];#define ll long long int
      |                       ^
a.cc: In function 'int main()':
a.cc:24:24: error: 'define' was not declared in this scope
   24 |     val[i]=arr1[i][1];#define ll long long int
      |                        ^~~~~~
a.cc:30:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   30 | int main()
      |         ^~
a.cc:30:9: note: remove parentheses to default-initialize a variable
   30 | int main()
      |         ^~
      |         --
a.cc:30:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:31:1: error: a function-definition is not allowed here before '{' token
   31 | {
      | ^
a.cc:83:2: error: expected '}' at end of input
   83 | }
      |  ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#define ll long long int
#define fr(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#include<bits/stdc++.h>
//https://atcoder.jp/contests/dp/submissions/12796237
using namespace std;

int main()
{
ll N,W;
  cin>>N;
  cin>>W;

  ll arr1[N][2];
  fr(i,0,N)
  {
    cin>>arr1[i][0];
  cin>>arr1[i][1];
  }
  ll Wt[N];
  ll val[N];
  fr(i,0,N)
  {
    Wt[i]=arr1[i][0];
    val[i]=arr1[i][1];
  }
  ll dp[N+1][W+1];
  fr(i,0,N+1){
   dp[i][0]=0;
  }
  fr(i,0,W+1)
  dp[0][i]=0;
    fr(i,1,N+1)
      fr(j,1,W+1)
    {
    if(Wt[i-1]<=j)
      dp[i][j]=max(val[i-1]+dp[i-1][j-Wt[i-1]],dp[i-1][j]);

      else
        dp[i][j]=dp[i-1][j];

    }

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

#include <set>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int dp[100001];

signed main(void) {
	int N,W;
	cin >> N>>W;
	vector<int>w(N),v(N);
	rep(i, N) {
		cin >> w[i]>>v[i];
	}
	rep(i, 100002) {
		dp[i] = INF;
	}

	dp[0] = 0;
	rep(i, N) {
		rrep(j, 100002) {
			if (j >= v[i]) 
				dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
		}
	}
	rrep(i, 100002) {
		if (dp[i] <= W) {
			print(i);
			break;
		}
	}
}

Compiler output:
a.cc: In function 'void print(T)':
a.cc:23:14: error: 'cout' is not a member of 'std'
   23 |         std::cout << x << " ";
      |              ^~~~
a.cc:2:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <set>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc: In function 'void println(T)':
a.cc:29:14: error: 'cout' is not a member of 'std'
   29 |         std::cout << x << "\n";
      |              ^~~~
a.cc:29:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc: In function 'int main()':
a.cc:36:9: error: 'cin' was not declared in this scope
   36 |         cin >> N>>W;
      |         ^~~
a.cc:36:9: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:9: error: 'vector' was not declared in this scope
   37 |         vector<int>w(N),v(N);
      |         ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <set>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:10:13: error: expected primary-expression before 'long'
   10 | #define int long long
      |             ^~~~
a.cc:37:16: note: in expansion of macro 'int'
   37 |         vector<int>w(N),v(N);
      |                ^~~
a.cc:39:24: error: 'w' was not declared in this scope
   39 |                 cin >> w[i]>>v[i];
      |                        ^
a.cc:39:30: error: 'v' was not declared in this scope
   39 |                 cin >> w[i]>>v[i];
      |                              ^
a.cc:48:34: error: 'v' was not declared in this scope
   48 |                         if (j >= v[i])
      |                                  ^
a.cc:49:67: error: 'w' was not declared in this scope
   49 |                                 dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
      |                                                                   ^
Language: C++

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

#define int        long long
// #define mp      make_pair
#define eb         emplace_back
#define pb         push_back
#define ss         second
#define ff         first
#define IOS        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod        998244353
#define MOD        (1000*1000*1000+7)
#define MN         LLONG_MIN
#define MX         LLONG_MAX
#define v1d        vector<int>
#define v2d        vector<vector<int>>
#define vip        vector<pair<int,int> >
#define v1s        vector<string>
#define pa         pair<int,int>
#define mxpq(T)    priority_queue <T>
#define mnpq(T)    priority_queue<T,vector<T>,greater<T>>
#define print(v)   for(auto i:v)cout<<i<<" ";cout<<"\n";
#define p2d(v)     for(auto a:v){for(auto b:a)cout<<b<<" ";cout<<endl;}
#define p1d(v)     for(auto a:v)cout<<a<<" ";cout<<endl;
#define ppd(v)     for(auto a:v)cout<<a.ff<<" "<<a.ss<<endl;
#define endl       "\n"
#define input(b,n) for(int i=0;i<n;i++)cin>>b[i];
#define Sort(v)    sort(v.begin(),v.end())
#define RSort(v)   sort(v.rbegin(),v.rend())
#define all(v)     v.begin(),v.end()
int gcd(int a,int b){return b?gcd(b,a%b):a;}
//string s = bitset<64>(a).to_string();

void azmuth(int n=12){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout<<setprecision(n)<<fixed;
    
}
int lb = 1000000000;

//____________________________________________________________________________________

int fun(vip &v,int n,int W,int idx,int val){
    if(idx >= n)return val;
    return max(fun(v,n,W-v[idx].ff,idx+1,val+v[idx].ss),fun(v,n,W,idx+1,val));
}

void solve(){
    int n,W;cin>>n>>W;
    vip v(n);
    for(int i=0;i<n;i++){
        int w,v;cin>>w>>v;
        v[i] = {w,v};
    }
    int ans = fun(v,n,W,i,0);
    cout<<ans<<"\n";
}

int32_t main(){
    azmuth();
    int t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
    


    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:53:10: error: invalid types 'long long int[long long int]' for array subscript
   53 |         v[i] = {w,v};
      |          ^
a.cc:55:25: error: 'i' was not declared in this scope
   55 |     int ans = fun(v,n,W,i,0);
      |                         ^
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll min(ll a,ll b)
{
  return a < b ? a : b;
}
ll func(vector<ll> val,vector<ll> wt,ll n,ll W)
{
  ll i,j,V=0;
  ll res=-1;
  for(i=0;i<n;i++)
    V+=val[i];
  int dp[n+1][V+1];
  for(i=0;i<=n;i++)
  {
    for(j=0;j<=V;j++)
    {
      if(i==0||j==0)
        dp[i][j]=0;
      else if(val[i-1]<=j)
        dp[i][j]=min(wt[i-1]+dp[i-1][j-val[i-1]],dp[i-1][j]);
      else
        dp[i][j]=dp[i-1][j];
    }
  }
  for(i=0;i<=V;i++)
  {
    if(dp[n][i]<W)
      res=max(res,i);
  }
  return res;
}
int main()
{
  ll n,W,val,wt;
  vector<ll> v,w;
  cin>>n>>W;
  ll i;
  for(i=0;i<n;i++)
  {
    cin>>wt>>val;
    v.push_back(val);
    w.push_back(wt);
  }
  cout<<func(v,wt,n,W)<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:16: error: could not convert 'wt' from 'long long int' to 'std::vector<long long int>'
   46 |   cout<<func(v,wt,n,W)<<"\n";
      |                ^~
      |                |
      |                long long int
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll min(ll a,ll b)
{
  return a < b ? a : b;
}
ll func(vector<ll> val,vector<ll> wt,ll n,ll W)
{
  ll i,j,V=0;
  ll res=-1;
  for(i=0;i<n;i++)
    V+=val[i];
  int dp[n+1][V+1];
  for(i=0;i<=n;i++)
  {
    for(j=0;j<=V;j++)
    {
      if(i==0||j==0)
        dp[i][j]=0;
      else if(val[i-1]<=j)
        dp[i][j]=min(wt[i-1]+dp[i-1][j-val[i-1]],dp[i-1][j]);
      else
        dp[i][j]=dp[i-1][j];
    }
  }
  for(i=0;i<=V;i++)
  {
    if(dp[n][i]<W)
      res=max(res,i);
  }
  return res;
}
int main()
{
  ll n,W,val,wt;
  vector<ll> v,w;
  cin>>n>>W;
  ll i;
  for(i=0;i<n;i++)
  {
    cin>>wt>>val;
    v.push_back(val);
    w.push_back(wt);
  }
  cout<<func(val,wt,n,W)<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:14: error: could not convert 'val' from 'long long int' to 'std::vector<long long int>'
   46 |   cout<<func(val,wt,n,W)<<"\n";
      |              ^~~
      |              |
      |              long long int
Language: C++

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

ll func(vector<ll> val,vector<ll> wt,ll n,ll W)
{
  ll i,j,V=0;
  ll res=-1;
  for(i=0;i<n;i++)
    V+=val[i];
  int dp[n+1][V+1];
  for(i=0;i<=n;i++)
  {
    for(j=0;j<=V;j++)
    {
      if(i==0||j==0)
        dp[i][j]=0;
      else if(val[i-1]<=j)
        dp[i][j]=min(wt[i-1]+dp[i-1][j-val[i-1]],dp[i-1][j]);
      else
        dp[i][j]=dp[i-1][j];
    }
  }
  for(i=0;i<=V;i++)
  {
    if(dp[n][i]<W)
      res=max(res,i);
  }
  return res;
}
int main()
{
  ll n,W,val,wt;
  vector<ll> v,w;
  cin>>n>>W;
  ll i;
  for(i=0;i<n;i++)
  {
    cin>>wt>>val;
    v.push_back(val);
    w.push_back(wt);
  }
  cout<<func(val,wt,n,W)<<"\n";
}

Compiler output:
a.cc:2:2: error: invalid preprocessing directive #deine; did you mean #define?
    2 | #deine ll long long int
      |  ^~~~~
      |  define
a.cc:5:1: error: 'll' does not name a type
    5 | ll func(vector<ll> val,vector<ll> wt,ll n,ll W)
      | ^~
a.cc: In function 'int main()':
a.cc:33:3: error: 'll' was not declared in this scope
   33 |   ll n,W,val,wt;
      |   ^~
a.cc:34:12: error: template argument 2 is invalid
   34 |   vector<ll> v,w;
      |            ^
a.cc:35:8: error: 'n' was not declared in this scope
   35 |   cin>>n>>W;
      |        ^
a.cc:35:11: error: 'W' was not declared in this scope
   35 |   cin>>n>>W;
      |           ^
a.cc:36:5: error: expected ';' before 'i'
   36 |   ll i;
      |     ^~
      |     ;
a.cc:37:7: error: 'i' was not declared in this scope
   37 |   for(i=0;i<n;i++)
      |       ^
a.cc:39:10: error: 'wt' was not declared in this scope; did you mean 'w'?
   39 |     cin>>wt>>val;
      |          ^~
      |          w
a.cc:39:14: error: 'val' was not declared in this scope
   39 |     cin>>wt>>val;
      |              ^~~
a.cc:40:7: error: request for member 'push_back' in 'v', which is of non-class type 'int'
   40 |     v.push_back(val);
      |       ^~~~~~~~~
a.cc:41:7: error: request for member 'push_back' in 'w', which is of non-class type 'int'
   41 |     w.push_back(wt);
      |       ^~~~~~~~~
a.cc:43:14: error: 'val' was not declared in this scope
   43 |   cout<<func(val,wt,n,W)<<"\n";
      |              ^~~
a.cc:43:18: error: 'wt' was not declared in this scope; did you mean 'w'?
   43 |   cout<<func(val,wt,n,W)<<"\n";
      |                  ^~
      |                  w
a.cc:43:9: error: 'func' was not declared in this scope
   43 |   cout<<func(val,wt,n,W)<<"\n";
      |         ^~~~
Language: C++

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


int main()
{
	short int a[1000 + 100][2], b[1 + 100][100000000 + 100] = { 0 };
	int n,w;
	cin >> n>>w;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 2; j++)
		{
			cin >> a[i][j];
			
		}
	
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			if (j - a[i][0] > -1)
			{
				b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
			}
			else b[i][j] = b[i - 1][j];
			
		}
		
	}
	cout << b[n][w]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:46: error: no matching function for call to 'max(int, short int&)'
   25 |                                 b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_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:25:46: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   25 |                                 b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:2:
/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:25:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |                                 b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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


int main()
{
	int a[1000 + 100][2], b[1 + 100][10000000 + 100] = { 0 };
	int n,w;
	cin >> n>>w;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 2; j++)
		{
			cin >> a[i][j];
			
		}
	
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= w; j++)11111
		{
			if (j - a[i][0] > -1)
			{
				b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
			}
			else b[i][j] = b[i - 1][j];
			
		}
		
	}
	cout << b[n][w]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:50: error: expected ';' before '{' token
   21 |                 for (int j = 1; j <= w; j++)11111
      |                                                  ^
      |                                                  ;
   22 |                 {
      |                 ~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
short int a[1000 + 100][2], b[10 + 100][1000000000+100] = { 0 };

int main()
{
	
	int n,w;
	cin >> n>>w;
	for (int i = 1; i <= n; i++)
		for (int j = 0; j < 2; j++)
		{
			cin >> a[i][j];
			
		}
	
	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= w; j++)
		{
			if (j - a[i][0] > -1)
			{
				b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
			}
			else b[i][j] = b[i - 1][j];
			
		}
		
	}
	cout << b[n][w]<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:46: error: no matching function for call to 'max(int, short int&)'
   25 |                                 b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_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:25:46: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   25 |                                 b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
                 from a.cc:2:
/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:25:46: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   25 |                                 b[i][j] = max(a[i][1] + b[i-1][j - a[i][0]],b[i-1][j]);
      |                                           ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++


#include <iostream>
#include<utility>
#include<math.h>
#include<vector>
#include<math.h>
using namespace std;
typedef long long int ll;
const long long int N=1000;
ll n,w,k,m,temp,arr[N+1][N+1],dp[N+1][N+1],visited[N+1][N+1];


bool fun(pair<ll, ll>& a,pair<ll, ll>& b)
{
    if(a.first < b.first) return true;
    else if(a.first==b.first && a.second > b.second) return true;
    return false;
}


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

int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>w;
    ll weight,value;
    vector<pair<ll,ll>> store;
    for(auto i=0;i<n;i++)
    {
        cin>>weight>>value;
        store.push_back(make_pair(weight, value));
    }
    
    sort(store.begin(),store.end(),fun);
    vector<ll> dp(w+1,0);
    dp[0]=0;
    
        for(auto j=0;j<store.size();j++)
        {
            for(auto wt=w-store[j].first;wt>=0;wt--)
            {
                maxi(dp[wt+store[j].first], dp[wt]+store[j].second);
            }
        }
    ll ans=0;
    for(auto i=0;i<w+1;i++)
        maxi(ans,dp[i]);
    cout<<ans;
  
    return 0;
        
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:39:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   39 |     sort(store.begin(),store.end(),fun);
      |     ^~~~
      |     sqrt
Language: Java



import java.util.Scanner;
public class Main{
 
  public static void main(String[] args)
  {
     
   Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    long totalWt=s.nextLong();
    long wt[]=new long[n];
   long profit[]=new long[n];
    
    for(int i=0;i<n;i++ )
    {
    	wt[i]=s.nextLong();
    	profit[i]=s.nextLong();
    }
    
    long dp[][]=new long[n][totalWt+1];
    for(int i=0;i<n;i++)
    {
    	dp[i][0]=0;
    }
    for(long i=wt[0];i<=totalWt;i++)
    {
    	dp[0][i]=profit[0];
    }
    for(int i=1;i<n;i++)
    {
    	for(long j=0;j<=totalWt;j++)
    	{
           		if(j-wt[i]>=0)
           		{
           			dp[i][j]=Math.max(profit[i]+dp[i-1][j-wt[i]], dp[i-1][j]);
           		}
           		else
           			dp[i][j]=dp[i-1][j];
    	}
    }
    
    
   
    System.out.println(dp[n-1][totalWt]);
    
    s.close();
    
  }
}


Compiler output:
Main.java:21: error: incompatible types: possible lossy conversion from long to int
    long dp[][]=new long[n][totalWt+1];
                                   ^
Main.java:28: error: incompatible types: possible lossy conversion from long to int
    	dp[0][i]=profit[0];
    	      ^
Main.java:36: error: incompatible types: possible lossy conversion from long to int
           			dp[i][j]=Math.max(profit[i]+dp[i-1][j-wt[i]], dp[i-1][j]);
           			      ^
Main.java:36: error: incompatible types: possible lossy conversion from long to int
           			dp[i][j]=Math.max(profit[i]+dp[i-1][j-wt[i]], dp[i-1][j]);
           			                                     ^
Main.java:36: error: incompatible types: possible lossy conversion from long to int
           			dp[i][j]=Math.max(profit[i]+dp[i-1][j-wt[i]], dp[i-1][j]);
           			                                                      ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
           			dp[i][j]=dp[i-1][j];
           			      ^
Main.java:39: error: incompatible types: possible lossy conversion from long to int
           			dp[i][j]=dp[i-1][j];
           			                 ^
Main.java:45: error: incompatible types: possible lossy conversion from long to int
    System.out.println(dp[n-1][totalWt]);
                               ^
8 errors
Language: C++

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

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

typedef long long ll;

int main ()
{
	ll n, w;
  	cin >> n >> w;
  	ll weight[110], value[110];
  	for(int i = 0; i < n; i++)
    {
    	cin >> weight[i] >> value[i];
    }
  	ll dp[110][100010] = {1LL};
  	for(int i = 0; i < n; i++)
    {
    	for(int sum_v = 0; sum_v <100010; sum_v++)
        {
        	if(sum_v > value[i])
            {
            	chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i]);
            }
          	chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }
  	ll res = 0;
  	for(int sum_v = 0; sum_v < 100010; sum_v++)
    {
    	if(dp[n][sum_V] < w)
        {
        	res = sum_v;
        }
    }
  	cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:18: error: 'sum_V' was not declared in this scope; did you mean 'sum_v'?
   49 |         if(dp[n][sum_V] < w)
      |                  ^~~~~
      |                  sum_v
Language: C++

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

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

typedef long long ll;

int main ()
{
	ll n, w;
  	cin >> n >> w;
  	ll weight[110], value[110];
  	for(int i = 0; i < n; i++)
    {
    	cin >> weight[i] >> value[i];
    }
  	ll dp[110][100010] = {1LL};
  	for(int i = 0; i < n; i++)
    {
    	for(sum_v = 0; sum_v <100010; sum_v++)
        {
        	if(sum_v > value[i])
            {
            	chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i]);
            }
          	chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }
  	ll res = 0;
  	for(int sum_v = 0; sum_v < 100010; sum_v++)
    {
    	if(dp[n][sum_V] < w)
        {
        	res = sum_v;
        }
    }
  	cout << res << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:13: error: 'sum_v' was not declared in this scope
   37 |         for(sum_v = 0; sum_v <100010; sum_v++)
      |             ^~~~~
a.cc:49:18: error: 'sum_V' was not declared in this scope; did you mean 'sum_v'?
   49 |         if(dp[n][sum_V] < w)
      |                  ^~~~~
      |                  sum_v
Language: C++

/*
 *created by Kraken on 27-04-2020 at 11:27
 */
import java.util.*;
import java.io.*;

public class Main {
  private static final long INF = (long) 1e18 + 1;

  public static void main(String[] args) {
    FastReader sc = new FastReader();
    int n = sc.nextInt();
    long w = sc.nextLong();
    long[] weights = new long[n];
    int[] values = new int[n];
    int sum = 0;
    for (int i = 0; i < n; i++) {
      weights[i] = sc.nextLong();
      values[i] = sc.nextInt();
      sum += values[i];
    }
    long[] dp = new long[sum + 1];
    Arrays.fill(dp, INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
      for (int nowValue = sum - values[i]; nowValue >= 0; nowValue--) {
        dp[nowValue + values[i]] = Math.min(dp[nowValue + values[i]], dp[nowValue] + weights[i]);
      }
    }
    System.out.println(Arrays.toString(dp));
    long res = 0;
    for (int i = 0; i <= sum; i++) {
      if (dp[i] <= w) res = Math.max(res, i);
    }
    System.out.println(res);
  }

  static class FastReader {

    BufferedReader br;

    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() {
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
      try {
        str = br.readLine();
      }
      catch (IOException e) {
        e.printStackTrace();
      }
      return str;
    }
  }
}


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

#include <bits/stdc++.h>

using namespace std;

int const NMAX = 1e2;
int const WMAX = 1e9;
int n, w;
//a = 1, b = 2, c = 3;
int we[1 + NMAX], va[1 + NMAX];
//long long dp[1 + NMAX][1 + WMAX];
long long prev[1 + WMAX], cur[1 + WMAX];

int main() {
  cin >> n >> w;
  for(int i = 1; i <= n; i++) {
    cin >> we[i] >> va[i];
  }
  for(int i = 1; i <= n; i++) {
    for(int j = 0; j <= w; j++) {
      cur[j] = max(cur[j], prev[j]);
      if(j - we[i] >= 0) {
        cur[j][j] = max(cur[j][j], prev[j-we[i]] + va[i]);
      }
    }
    for(int j = 0; j <= w; j++) {
      prev[j] = cur[j];
    }
  }
  cout << cur[w];
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: reference to 'prev' is ambiguous
   20 |       cur[j] = max(cur[j], prev[j]);
      |                            ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 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_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:11:11: note:                 'long long int prev [1000000001]'
   11 | long long prev[1 + WMAX], cur[1 + WMAX];
      |           ^~~~
a.cc:22:15: error: invalid types 'long long int[int]' for array subscript
   22 |         cur[j][j] = max(cur[j][j], prev[j-we[i]] + va[i]);
      |               ^
a.cc:22:31: error: invalid types 'long long int[int]' for array subscript
   22 |         cur[j][j] = max(cur[j][j], prev[j-we[i]] + va[i]);
      |                               ^
a.cc:22:36: error: reference to 'prev' is ambiguous
   22 |         cur[j][j] = max(cur[j][j], prev[j-we[i]] + va[i]);
      |                                    ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:11:11: note:                 'long long int prev [1000000001]'
   11 | long long prev[1 + WMAX], cur[1 + WMAX];
      |           ^~~~
a.cc:26:7: error: reference to 'prev' is ambiguous
   26 |       prev[j] = cur[j];
      |       ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:11:11: note:                 'long long int prev [1000000001]'
   11 | long long prev[1 + WMAX], cur[1 + WMAX];
      |           ^~~~
Language: C++

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

#define V_SUM_MAX 1000 
#define N_MAX 100 
#define W_MAX 1000000001

// To store the states of DP 
int dp[V_SUM_MAX + 1][N_MAX]; 
bool v[V_SUM_MAX + 1][N_MAX]; 

int solveDp(int r, int i, int* w, int* val, int n) 
{ 
	if (r <= 0) 
		return 0; 
	if (i == n) 
		return W_MAX; 
	if (v[r][i]) 
		return dp[r][i];  
	v[r][i] = 1; 

	dp[r][i] 
		= min(solveDp(r, i + 1, w, val, n), 
			w[i] + solveDp(r - val[i], 
							i + 1, w, val, n)); 
	return dp[r][i]; 
} 

long long maxWeight(int* w, int* val, int n, int c) 
{ 
	for (int i = V_SUM_MAX; i >= 0; i--) { 
		if (solveDp(i, 0, w, val, n) <= c) { 
			return i; 
		} 
	} 
	return 0; 
} 
int main() 
{ 
	long long n,wt,i;
  	cin>>n>>wt;
  	long long w[n],v[n];
  	for(i=0;i<n;i++)
      cin>>w[i]>>v[i];
  	long long ans=maxWeight(w,v,n,wt);
  	cout<<ans<<endl;
	return 0; 
} 


Compiler output:
a.cc: In function 'int main()':
a.cc:45:33: error: cannot convert 'long long int*' to 'int*'
   45 |         long long ans=maxWeight(w,v,n,wt);
      |                                 ^
      |                                 |
      |                                 long long int*
a.cc:29:26: note:   initializing argument 1 of 'long long int maxWeight(int*, int*, int, int)'
   29 | long long maxWeight(int* w, int* val, int n, int c)
      |                     ~~~~~^
Language: C++

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf8');

// Your code here!
const max = (a)=>{
    let i = a.length;
    let max=-Infinity;
    while (i--) {
        if (a[i] > max)max = a[i];
    }
    return max;
}
const min = (a)=>{
    let i = a.length;
    let max=Infinity;
    while (i--) {
        if (a[i] < max)max = a[i];
    }
    return max;
}
const Main = (p)=>{
	p = p.split("\n");//2 or more
	//let N = parseInt(p[0]);//N
	const N = parseInt(p[0].split(" ")[0]);//N M
	const W = parseInt(p[0].split(" ")[1]);//N M
	//let h = (p[1].split(" ").map(Number));//a1 a2 a3...
	
	let w = new Array(N);
	let v = new Array(N);
	//let c=new Array(N);
    //let z=new Array(N);
    for(let i=0;i<N;i++){
        let h = (p[i+1].split(" ").map(Number));
        w[i]=h[0];
        v[i]=h[1];
    }
    
    const maxv=100;
	let m = new Array(N+1);
    //console.log(N,W,w,v);return;
    m[0]=new Array(maxv+1).fill(Infinity);
    m[0][0]=0;
    for(let i=0;i<=N;i++){
        m[i+1]=m[i].concat();
        for(let j=0;j<=maxv;j++){
            if(j-v[i]>=0){
                //console.log(m[i][j-w[i]]+v[i],m[i][j])
                m[i+1][j]=Math.min(m[i][j-v[i]]+w[i],m[i][j]);
            }
            
        }
        //console.log(i,m[i])
    }
	//console.log(m[N][maxv-1]);
	let i=maxv;
	while(m[N][i--]>W);//console.log(m[N][i--]);
	console.log(i+1);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Compiler output:
a.cc:1:1: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
    1 | 'use strict';
      | ^~~~~~~~~~~~
a.cc:3:27: warning: multi-character character constant [-Wmultichar]
    3 | process.stdin.setEncoding('utf8');
      |                           ^~~~~~
a.cc:1:1: error: expected unqualified-id before '\x72696374'
    1 | 'use strict';
      | ^~~~~~~~~~~~
a.cc:2:1: error: 'process' does not name a type
    2 | process.stdin.resume();
      | ^~~~~~~
a.cc:3:1: error: 'process' does not name a type
    3 | process.stdin.setEncoding('utf8');
      | ^~~~~~~
a.cc:6:7: error: 'max' does not name a type
    6 | const max = (a)=>{
      |       ^~~
a.cc:14:7: error: 'min' does not name a type
   14 | const min = (a)=>{
      |       ^~~
a.cc:22:7: error: 'Main' does not name a type
   22 | const Main = (p)=>{
      |       ^~~~
a.cc:60:5: error: expected constructor, destructor, or type conversion before '(' token
   60 | Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
      |     ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;

//const int MAX_N = 110;
const int MAX_V = 100100;

const int MAX_V = 1000;
long long dp[MAX_N][MAX_V];
const long long INF = 1LL<<60;

int main(){
    long long N, M;
    cin >> N >> M;
    vector<long long> w(N);
    vector<long long> v(N);

    for(long long i=0; i<N; ++i){
        cin >> w[i];
        cin >> v[i];
    }

    //init
    for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;
    dp[0][0] = 0;

    //j means sum_v
    for(long long i=0; i<=N; ++i){
        for(long long j=0; j<=MAX_V; ++j){
            if(v[i]<=j){
                dp[i+1][j] = min(dp[i+1][j], dp[i][j-v[i]]+w[i]);
            }else{
                dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            }
        }
    }

    // 最適値の出力
    long long res = 0;
    for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
        if (dp[N][sum_v] <= M) res = sum_v;
    }

    cout << res << endl;
}

Compiler output:
a.cc:9:11: error: redefinition of 'const int MAX_V'
    9 | const int MAX_V = 1000;
      |           ^~~~~
a.cc:7:11: note: 'const int MAX_V' previously defined here
    7 | const int MAX_V = 100100;
      |           ^~~~~
a.cc:10:14: error: 'MAX_N' was not declared in this scope; did you mean 'MAX_V'?
   10 | long long dp[MAX_N][MAX_V];
      |              ^~~~~
      |              MAX_V
a.cc: In function 'int main()':
a.cc:25:25: error: 'MAX_N' was not declared in this scope; did you mean 'MAX_V'?
   25 |     for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;
      |                         ^~~~~
      |                         MAX_V
a.cc:25:69: error: 'dp' was not declared in this scope
   25 |     for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;
      |                                                                     ^~
a.cc:26:5: error: 'dp' was not declared in this scope
   26 |     dp[0][0] = 0;
      |     ^~
Language: C++

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

typedef long long int ll;
using namespace std;
#define vl vector<ll>
#define vi vector<int>
#define ff first
#define ss second

void solve() {
    int n, W;
    cin >> n >> W;
    vl dp(1005, 9223372036854775807);
    dp[0] = 0 ;
    for (int i = 0; i < n; i++) {
        int weight, value;
        cin >> weight >> value;
        for (int v = 1000; v >= value; v--) {
            if(dp[v - value] != LONG_LONG_MAX)
                dp[v] = min(dp[v], weight + dp[v - value]);
        }
    }

    ll ans = 0;
    for(int i = 1000 ; i >= 0 ; i--) {
        if(dp[i] <= W ) {
            ans = i ;
            break ;
        }
    }
    cout << ans << endl;
}


int main() {
#ifdef _DEBUG // place in cmake-build-debug folder
    freopen("in.txt", "r", stdin);
    freopen(
    for (int i = idx + 1; i < n; i++) {
        res[i] = min(res[i - 1], m[i]);
    }
    for (int i = idx - 1; i >= 0; i--) {
        res[i] = min(res[i + 1], m[i])"out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    int q;
//    cin >> q;
//    for (int i = 1; i <= q; i++) {
//        // cout << "Case #" << i << ": ";
//        solve();
//    }
    solve();

    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:27:33: error: 'LONG_LONG_MAX' was not declared in this scope
   27 |             if(dp[v - value] != LONG_LONG_MAX)
      |                                 ^~~~~~~~~~~~~
Language: C++

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

typedef long long int ll;
using namespace std;
#define vl vector<ll>
#define vi vector<int>
#define ff first
#define ss second

void solve() {
    int n, W;
    cin >> n >> W;
    vl dp(1005, LONG_LONG_MAX);
    dp[0] = 0 ;
    for (int i = 0; i < n; i++) {
        int weight, value;
        cin >> weight >> value;
        for (int v = 1000; v >= value; v--) {
            if(dp[v - value] != LONG_LONG_MAX)
                dp[v] = min(dp[v], weight + dp[v - value]);
        }
    }
   
    ll ans = 0;
    for(int i = 1000 ; i >= 0 ; i--) {
        if(dp[i] <= W ) {
            ans = i ;
            break ;
        }
    }
    cout << ans << endl;
}


int main() {
#ifdef _DEBUG // place in cmake-build-debug folder
    freopen("in.txt", "r", stdin);
    freopen(
    for (int i = idx + 1; i < n; i++) {
        res[i] = min(res[i - 1], m[i]);
    }
    for (int i = idx - 1; i >= 0; i--) {
        res[i] = min(res[i + 1], m[i])"out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    int q;
//    cin >> q;
//    for (int i = 1; i <= q; i++) {
//        // cout << "Case #" << i << ": ";
//        solve();
//    }
    solve();

    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:21:17: error: 'LONG_LONG_MAX' was not declared in this scope
   21 |     vl dp(1005, LONG_LONG_MAX);
      |                 ^~~~~~~~~~~~~
Language: C++

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

long long n, k, w[105], v[105], dp[105][1000000005], best;

int main(){
	cin>>n>>k;
	for(int i=1; i<=n; i++){
		cin>>w[i]>>v[i];
	}
	
	for(int i=1; i<=n; i++){
		for(int j=1; j<=k; j++){
			best=dp[i-1][j];
			if(j>=w[i])best=max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);
			dp[i][j]=best;
		}
		//cout<<dp[i][k]<<endl;
	}
	cout<<dp[n][k]<<endl;
	//cout<<dp[2][3]<<endl;
}


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

#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
//
//
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define int long long
#define ll long long
#define ld long double
#define gap ' '
#define endl '\n'
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
unordered_map<pair<int,int>,int,HASH>dp;
int W[101],v[101];
int f(int n,int w) {
	if(n==0 or w==0) return 0;
	if(dp.count({n,w})!=0) return dp[{n,w}];
	int a=0;
	if(w-W[n]>=0) a=max(a,f(n-1,w-W[n])+v[n]);
	a=max(a,f(n-1,w));
	return dp[{n,w}]=a;
}
void solve() {
	int n,w;
	cin>>n>>w;
	dp.max_load_factor(0.25);
	dp.reverve(32768);
	for(int i=1;i<=n;i++)
	cin>>W[i]>>v[i];
	cout<<f(n,w)<<endl;
}
void solve(bool testcase) {
	int t;cin>>t;while(t--)solve();
}
int32_t main() {
	fio
	solve();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:33:12: error: 'class std::unordered_map<std::pair<long long int, long long int>, long long int, HASH>' has no member named 'reverve'; did you mean 'reserve'?
   33 |         dp.reverve(32768);
      |            ^~~~~~~
      |            reserve