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

#include <iostream>
#include <cstring>
#include <cmath> 
#include <algorithm>

using namespace std;

ll dp[maxn];
ll n,W;
ll v[maxn];
ll w[maxn];
int main()
{
    memset(dp,0x3f,sizeof(dp));
    gbtb;
    cin>>n>>W;
    repd(i,1,n)
    {
        cin>>w[i]>>v[i];
    }
    ll ans=0ll;
    dp[0]=0;
    repd(i,1,n)
    {
        for(int j=1e5;j>=v[i];--j)
        {
            {
                dp[j]=min(dp[j],dp[j-v[i]]+w[i]);
                if(dp[j]<=W)
                    ans=max(ans,(ll)(j));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

inline void getInt(int* p) {
    char ch;
    do {
        ch = getchar();
    } while (ch == ' ' || ch == '\n');
    if (ch == '-') {
        *p = -(getchar() - '0');
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 - ch + '0';
        }
    }
    else {
        *p = ch - '0';
        while ((ch = getchar()) >= '0' && ch <= '9') {
            *p = *p * 10 + ch - '0';
        }
    }
}

Compiler output:
a.cc:8:1: error: 'll' does not name a type
    8 | ll dp[maxn];
      | ^~
a.cc:9:1: error: 'll' does not name a type
    9 | ll n,W;
      | ^~
a.cc:10:1: error: 'll' does not name a type
   10 | ll v[maxn];
      | ^~
a.cc:11:1: error: 'll' does not name a type
   11 | ll w[maxn];
      | ^~
a.cc: In function 'int main()':
a.cc:14:12: error: 'dp' was not declared in this scope
   14 |     memset(dp,0x3f,sizeof(dp));
      |            ^~
a.cc:15:5: error: 'gbtb' was not declared in this scope
   15 |     gbtb;
      |     ^~~~
a.cc:16:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   16 |     cin>>n>>W;
      |          ^
      |          yn
a.cc:16:13: error: 'W' was not declared in this scope
   16 |     cin>>n>>W;
      |             ^
a.cc:17:10: error: 'i' was not declared in this scope
   17 |     repd(i,1,n)
      |          ^
a.cc:17:5: error: 'repd' was not declared in this scope
   17 |     repd(i,1,n)
      |     ^~~~
a.cc:21:5: error: 'll' was not declared in this scope
   21 |     ll ans=0ll;
      |     ^~
a.cc:34:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |     cout<<ans<<endl;
      |           ^~~
      |           abs
Language: Java

import java.util.Scanner;

class Main{
   
 public static void main(String... args){
      final int MINUS_INF = -(int)(10e9 + 7);
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

      int[] weight = new int[N];
      int[] value = new int[N];
      
      int sum_value = 0;
      for(int i = 0; i < N; i++){
        weight[i] = sc.nextInt();
        value[i] = sc.nextInt();
        sum_value += value[i];
      }
   
   	  for(int i = 0; i < N; i++){
      //dp[i] = minimum weight by having exact value of i.
      //since here value <= 10^3 so dp[] dimension is taken as value
      //and not weight because weight <= 10^9
      long[] dp = new long[sum_value+1]; //if all N items are of value 1000.
      for(int i=0; i <= sum_value; i++){
      	dp[i] = MINUS_INF;
      }
        
      dp[0] = 0;
      for(int i = 0; i < N; i++){
        for(long existing_val = 0; existing_val <= sum_value; existing_val++){
          if(existing_val >= value){
          	dp[existing_val] = Math.min(dp[existing_val], 
                                        dp[existing_val - value[i]] + weight[i]);
          }
        }
      }
   
   	  long ans = 0;
      for(int i = 0; i <= sum_value; i++){
      	ans = Math.min(ans, dp[i]);
      }
      System.out.println(ans);
   
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:49: error: reached end of file while parsing
}
 ^
1 error
Language: Java

import java.util.Scanner;

class Main{
   
 public static void main(String... args){
      final int INF = -(int)(10e9 + 7);
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

   	  int V = 1000*100;
      //dp[i] = minimum weight by having exact value of i.
      //since here value <= 10^3 so dp[] dimension is taken as value
      //and not weight because weight <= 10^9
      long[] dp = new long[V+1]; //if all N<= 100 items are of value 1000.
      for(int i = 0; i < N; i++){
        int weight = sc.nextInt();
        int value = sc.nextInt();
        for(int existing_val = value; existing_value <= V; existing_value++){
          if(existing_value >= value){
          	dp[existing_val] = Math.min(dp[existing_value], dp[existing_val - value] + weight);
          }
        }
      }
   
   	  long ans = 0;
      for(int i = 0; i <= V; i++){
      	ans = Math.min(ans, dp[i]);
      }
      System.out.println(ans);
   
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:19: error: cannot find symbol
        for(int existing_val = value; existing_value <= V; existing_value++){
                                      ^
  symbol:   variable existing_value
  location: class Main
Main.java:19: error: cannot find symbol
        for(int existing_val = value; existing_value <= V; existing_value++){
                                                           ^
  symbol:   variable existing_value
  location: class Main
Main.java:20: error: cannot find symbol
          if(existing_value >= value){
             ^
  symbol:   variable existing_value
  location: class Main
Main.java:21: error: cannot find symbol
          	dp[existing_val] = Math.min(dp[existing_value], dp[existing_val - value] + weight);
          	                               ^
  symbol:   variable existing_value
  location: class Main
4 errors
Language: Java

import java.util.Scanner;

class Main{
   
 public static void main(String... args){
      final int (int)(10e9 + 7);
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();

   	  int V = 1000*100;
      //dp[i] = minimum weight by having exact value of i.
      //since here value <= 10^3 so dp[] dimension is taken as value
      //and not weight because weight <= 10^9
      int[] dp = new int[1000*100+1]; //if all N<= 100 items are of value 1000.
      for(int i = 0; i < N; i++){
        int weight = sc.nextInt();
        int value = sc.nextInt();
        for(int existing_val = value; existing_value <= V; existing_value++){
          if(existing_value >= value){
          	dp[existing_val] = Math.min(dp[existing_value], dp[existing_val - value] + weight);
          }
        }
      }
   
   	  int ans = 0;
      for(int i = 0; i <= V; i++){
      	ans = Math.min(ans, dp[i]);
      }
      System.out.println(ans);
   
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:6: error: <identifier> expected
      final int (int)(10e9 + 7);
               ^
Main.java:6: error: not a statement
      final int (int)(10e9 + 7);
                 ^
Main.java:6: error: ';' expected
      final int (int)(10e9 + 7);
                    ^
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int k[101][100001];
int Knapsack(int W,int n,int val[],int wt[])
{
  if(W<=100000)
    return k[n][w];
  else
    return max(val[n-1]+Knapsack(W-wt[n-1],n-1,val,wt),Knapsack(W,n-1,val,wt));
}
int main(){
int n,W;
  cin>>n>>W;
  int wt[n],val[n];
  for(int i=0;i<n;i++){
		cin>>wt[i]>>val[i];}
  for(int i=0;i<=n;i++){
		for(int w=0;w<=100000;w++){
			if(i==0 or w==0)
              k[i][w]=0;
          	else if(wt[i-1]<=w)
              k[i][w]=max(val[i-1]+k[i-1][w-wt[i-1]],k[i-1][w]);
          	else
              k[i][w]=k[i-1][w];
        }
  }
  cout<<Knapsack(W,n,val,wt);
  
  return 0;


Compiler output:
a.cc: In function 'int Knapsack(int, int, int*, int*)':
a.cc:7:17: error: 'w' was not declared in this scope
    7 |     return k[n][w];
      |                 ^
a.cc: In function 'int main()':
a.cc:29:12: error: expected '}' at end of input
   29 |   return 0;
      |            ^
a.cc:11:11: note: to match this '{'
   11 | int main(){
      |           ^
Language: Java

import java.util.Scanner;

class Main{

  private static long solve(long[] weight, long[] value, int N, long W) {
    if(weight == null || value == null) 
      return 0;
  	long[][] T = new long[N][W+1];
  	
    if(weight[0] <= W)
		T[0][weight[0]] = value[0]; 
        
  	for(int i = 1; i < N; i++) {
  		for(long w = 1; w <= W; w++) {
  			if(w >= weight[i]) {
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  			} else {
  				T[i][w] = T[i-1][w];
  			}
  		}
  	}
  	
  	return T[N-1][W];
  	
  }
  
  public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      long W = sc.nextInt();
     
      long[] weight = new long[N] ;
      long[] value = new long[N] ;
      
      for(int i = 0; i< N; i++){
            weight[i] = sc.nextLong();
            value[i] = sc.nextLong();
      }
      System.out.println(solve(weight, value, N, W));
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:8: error: incompatible types: possible lossy conversion from long to int
  	long[][] T = new long[N][W+1];
  	                          ^
Main.java:11: error: incompatible types: possible lossy conversion from long to int
		T[0][weight[0]] = value[0]; 
		           ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  				     ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  				                          ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  				                                       ^
Main.java:18: error: incompatible types: possible lossy conversion from long to int
  				T[i][w] = T[i-1][w];
  				     ^
Main.java:18: error: incompatible types: possible lossy conversion from long to int
  				T[i][w] = T[i-1][w];
  				                 ^
Main.java:23: error: incompatible types: possible lossy conversion from long to int
  	return T[N-1][W];
  	              ^
8 errors
Language: Java

import java.util.Scanner;

class Main{

  private static long solve(long[] weight, long[] value, int N, int W) {
    if(weight == null || value == null) 
      return 0;
  	long[][] T = new long[N][W+1];
  	
    if(weight[0] <= W)
		T[0][weight[0]] = value[0]; 
        
  	for(int i = 1; i < N; i++) {
  		for(int w = 1; w <= W; w++) {
  			if(w >= weight[i]) {
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  			} else {
  				T[i][w] = T[i-1][w];
  			}
  		}
  	}
  	
  	return T[N-1][W];
  	
  }
  
  public static void main(String... args){
      Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int W = sc.nextInt();
     
      long[] weight = new long[N] ;
      long[] value = new long[N] ;
      
      for(int i = 0; i< N; i++){
            weight[i] = sc.nextInt();
            value[i] = sc.nextInt();
      }
      System.out.println(solve(weight, value, N, W));
      if(sc != null)
        sc.close();
  }
}


Compiler output:
Main.java:11: error: incompatible types: possible lossy conversion from long to int
		T[0][weight[0]] = value[0]; 
		           ^
Main.java:16: error: incompatible types: possible lossy conversion from long to int
  				T[i][w] = Math.max(T[i-1][w], T[i-1][w - weight[i]] + value[i]);
  				                                       ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int N = 1e8 + 25, M = 1e6 + 25, oo = 1e9, mod = 1e9 + 7;
const long long OO = 1e18+25;

int n, w[125], v[125],W, virwi;
long long mem[100][N];
map <int, int> mp;

long long dp(int idx=0, int wi=W)
{
    if(idx == n) return 0;
    if(!mp[wi]) mp[wi] = ++virwi;
    int vwi = mp[wi];
    long long &ret = mem[idx][vwi];
    if(ret != -1) return ret;
    return ret = max(dp(idx+1, wi), (wi>=w[idx]?dp(idx+1, wi-w[idx])+v[idx]:0));
}

int main()
{
    memset(mem, -1, sizeof mem);
    scanf("%d%d",&n,&W);
    for(int i=0; i<n; i++) scanf("%d%d",w+i,v+i);
    printf("%lld",dp());
    return 0;
}

Compiler output:
/tmp/cc3VvIsf.o: in function `dp(int, int)':
a.cc:(.text+0x2e): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/cc3VvIsf.o
a.cc:(.text+0x64): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/cc3VvIsf.o
a.cc:(.text+0x7c): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/cc3VvIsf.o
/tmp/cc3VvIsf.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x268): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/cc3VvIsf.o
a.cc:(.text+0x281): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/cc3VvIsf.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
struct node{
  int v,w;
};
int knapsack(int w,vector<node> v)
{
  int ts=0;
  for(int i=0;i<v.size();i++)
    ts+=v[i].v;
  vector<int> dp(ts+1,10000000);
  int min=v[0].v;
  for(int i=0;i<v.size();i++)
    if(v[i].v<min)
      min=v[i];
  for(int i=0;i<=min;i++)
    dp[i]=0;
  for(int i=0;i<v.size();i++)
    for(int j=ts;j>0 && j>=v[i].v;j--)
      if(dp[j]>dp[j-v[i].v]+v[i].w)
        dp[j]=dp[j-v[i].v]+v[i].w;
  
  for(int i=ts;i>=0;i--)
    if(dp[i]<=w)
    	return i;	
  return 0;
}
int main()
{
  int n,w;cin>>n>>w;
  vector<node> v(n);
  for(int i=0;i<n;i++)
    cin>>v[i].w>>v[i].v;
  cout<<knapsack(w,v)<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int knapsack(int, std::vector<node>)':
a.cc:15:14: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<node>, node>::value_type' {aka 'node'} to 'int' in assignment
   15 |       min=v[i];
      |              ^
Language: Java

import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int maxWeight = scan.nextInt();
    
    int[] weights = new int[n];
    int[] values = new int[n];
    
    for (int i = 0; i < n; i++) {
      weights[i] = scan.nextInt();
      values[i] = scan.nextInt();
    }
    scan.close();

    long result = solve(n, weights, values, maxWeight);
    System.out.println(result);
  }
  
  private final static int MAX_VALUE = 100*1000;
  
  private static long solve(int N, int[] weights, int[] values, int maxWeight){
    long[] minWeight = new long[MAX_VALUE + 1];
    Arrays.fill(minWeight, Long.MAX_VALUE);
    minWeight[0] = 0;

    for (int k = 0; k < N; k++) {
      for (int val = MAX_VALUE - values[k]; value >= 0; value--) {
        if (minWeight[val] == Long.MAX_VALUE) {
          continue;
        }

        int newValue = val + values[k];
        long newWeight = minWeight[val] + weights[k];
        long currentMinWeight = minWeight[newValue];

        if (newWeight < currentMinWeight) {
          minWeight[newValue] = newWeight;
        }
      }
    }

    for (int value = MAX_VALUE; value > 0; value--) {
      if (minWeight[value] <= maxWeight) return value;
    }

    return 0;
  }
}

Compiler output:
Main.java:30: error: cannot find symbol
      for (int val = MAX_VALUE - values[k]; value >= 0; value--) {
                                            ^
  symbol:   variable value
  location: class Main
Main.java:30: error: cannot find symbol
      for (int val = MAX_VALUE - values[k]; value >= 0; value--) {
                                                        ^
  symbol:   variable value
  location: class Main
2 errors
Language: Java


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

class Solution {

    private int N;
    private int W;

    private List<Integer> w;
    private List<Integer> v;

    public int calculate(int weight, List<Integer> w, List<Integer> v) {
        W = weight;
        this.v = v;
        this.w = w;
        
        return calculate(weight, N - 1);
    }

    private int calculate(int weight, int pos) {
        if (pos < 0 || weight == 0) return 0;

        if (w.get(pos) > weight) return calculate(weight, pos - 1);

        int no = calculate(weight, pos - 1);
        int yes = v.get(pos) - calculate(weight, pos - 1);
        return Math.max(no, yes);
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int W = in.nextInt();

        List<Integer> w = new ArrayList<>();
        List<Integer> v = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            w.add(in.nextInt());
            v.add(in.nextInt());
        }

        Solution s = new Solution();
        int result = s.calculate();
        System.out.println(result);
    }

}


Compiler output:
Main.java:45: error: no suitable method found for calculate(no arguments)
        int result = s.calculate();
                      ^
    method Solution.calculate(int,List<Integer>,List<Integer>) is not applicable
      (actual and formal argument lists differ in length)
    method Solution.calculate(int,int) is not applicable
      (actual and formal argument lists differ in length)
1 error
Language: Java


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Solution {

    public Solution(Scanner in) {
        N = in.nextInt();
        W = in.nextInt();

        w = new ArrayList<>();
        v = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            w.add(in.nextInt());
            v.add(in.nextInt());
        }
    }

    private int N;
    private int W;

    private List<Integer> w;
    private List<Integer> v;

    public int calculate() {
        int weight = W;
        int amount = 0;
        calculate(weight, amount, N - 1);
        return 0;
    }

    private int calculate(int weight, int amount, int pos) {
        if (pos == -1 || weight == 0) return 0;

        if (w.get(pos) > weight) return calculate(weight, amount, pos - 1);

        int no = calculate(weight, amount, pos - 1);
        int yes = v.get(pos) - calculate(weight, amount, pos - 1);
        return Math.max(no, yes);
    }

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

        Solution s = new Solution(in);
        int result = s.calculate();
        System.out.println(result);
    }

}


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

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

int main()
{
//    freopen("Knapsack2.inp","r",stdin);
    long long int n, W, i, j, T=0;
    cin>>n>>W;
    int w[n], v[n];
    for(i=1; i<=n; i++) { cin>>w[i]>>v[i]; T+=v[i]; }

    long long int f[T+1];
    f[0]=0; //f[v[i]]=w[1];
    for(i=1; i<=T; i++) f[i]=1000000;

    for(i=1; i<=n; i++)
    {
        for(t=T; t>=v[i]; t--) f[t]=min(w[i]+f[t-v[i]], f[t]);
    }

//    int m=T;
//    while(f[m]>W && m>=v[1]) m--;
//    cout<<m;
    for(i=T; i>=v[1]; i--) { if(f[i]<=W) { cout<<i; return 0; } }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:13: error: 't' was not declared in this scope
   19 |         for(t=T; t>=v[i]; t--) f[t]=min(w[i]+f[t-v[i]], f[t]);
      |             ^
Language: C++

#include <bits/stdc++.h>
#define pb push_back
#define INF 0x3f3f3f3
#define NMAX int(10e9+3)
#define ll long long
using namespace std;
typedef pair<int, string> pii;

ll n, k, dp[2][NMAX], val[105], p[105];

int main() {
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
        cin >> p[i] >> val[i];

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= k; j++) {
            dp[i & 1][j] = dp[~i & 1][j];
            if(p[i] <= j) dp[i & 1][j] = max(dp[i & 1][j], dp[~i & 1][j-p[i]]+val[i]);
        }
    }
    cout << dp[n & 1][k] << endl;
}


Compiler output:
a.cc:4:14: error: size of array 'dp' exceeds maximum object size '9223372036854775807'
    4 | #define NMAX int(10e9+3)
      |              ^~~~~~~~~~~
a.cc:9:16: note: in expansion of macro 'NMAX'
    9 | ll n, k, dp[2][NMAX], val[105], p[105];
      |                ^~~~
Language: C++

#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;
typedef int ll;
typedef pair<ll, ll> pi;
ll n, w, wt[105], v[105], dp[2][1000000005], ans;
bool tog;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n >> w;
	for (ll i = 1; i <= n ; i++)cin >> wt[i] >> v[i];
	for (ll i = 1; i <= n; i++){
		if (i%2 == 1)tog = 1; //setting 0th one
		else tog = 0;
		for (ll j = 1; j <= w; j++){
			if (j-wt[i] >= 0)dp[!tog][j] = max(v[i]+dp[tog][j-wt[i]], dp[tog][j]);
			else dp[!tog][j] = dp[tog][j];
		}
	}
	(n%2 == 0) ? ans=dp[1][w]:ans=dp[0][w];
	cout << ans;
}


Compiler output:
/tmp/ccYHe1Bi.o: in function `main':
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0xea): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x122): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x1c3): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x1f9): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x203): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x2ab): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x2cd): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYHe1Bi.o
a.cc:(.text+0x2d3): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccYHe1Bi.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
ll n, w, wt[105], v[105], dp[2][1000000005], ans;
bool tog;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n >> w;
	for (ll i = 1; i <= n ; i++)cin >> wt[i] >> v[i];
	for (ll i = 1; i <= n; i++){
		if (i%2 == 1)tog = 1; //setting 0th one
		else tog = 0;
		for (ll j = 1; j <= w; j++){
			if (j-wt[i] >= 0)dp[!tog][j] = max(v[i]+dp[tog][j-wt[i]], dp[tog][j]);
			else dp[!tog][j] = dp[tog][j];
		}
	}
	(n%2 == 0) ? ans=dp[1][w]:ans=dp[0][w];
	cout << ans;
}


Compiler output:
/tmp/cc9JaUh4.o: in function `main':
a.cc:(.text+0xec): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0xf5): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x131): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x212): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x2c1): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc9JaUh4.o
a.cc:(.text+0x2eb): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/cc9JaUh4.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pi;
ll n, w, wt[105], v[105], dp[2][1000000005], ans;
bool tog;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> n >> w;
	for (ll i = 1; i <= n ; i++)cin >> wt[i] >> v[i];
	for (ll i = 1; i <= n; i++){
		if (i%2 == 1)tog = 1; //setting 0th one
		else tog = 0;
		for (ll j = 1; j <= w; j++){
			if (j-wt[i] >= 0)dp[!tog][j] = max(v[i]+dp[tog][j-wt[i]], dp[tog][j]);
			else dp[!tog][j] = dp[tog][j];
		}
	}
	(n%2 == 0) ? ans=dp[1][w]:ans=dp[0][w];
	cout << ans;
}


Compiler output:
/tmp/ccibhHcH.o: in function `main':
a.cc:(.text+0xec): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0xf5): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x131): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x174): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x208): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x212): relocation truncated to fit: R_X86_64_PC32 against symbol `tog' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x2c1): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccibhHcH.o
a.cc:(.text+0x2eb): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccibhHcH.o
collect2: error: ld returned 1 exit status
Language: C++

//bismillah
//created by anaksoleh
//24 Dec 2019
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll N,W;
ll dp[1000000005];
ll w[103];
ll v[103];

void solve()
{
    for(ll i = 1 ; i <= N ; i++){
        for(ll c = W ; c >= w[i] ; c--){
            dp[c] = max(dp[c],dp[c - w[i]] + v[i]);
        }
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> N >> W;
    for(ll i = 1 ; i <= N ; i++){
        cin >> w[i] >> v[i];
    }
    solve();
    cout << dp[W] << '\n';

    return 0;
}


Compiler output:
/tmp/ccsXyfl4.o: in function `solve()':
a.cc:(.text+0x34): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccsXyfl4.o
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccsXyfl4.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccsXyfl4.o
/tmp/ccsXyfl4.o: in function `main':
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccsXyfl4.o
a.cc:(.text+0x187): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccsXyfl4.o
collect2: error: ld returned 1 exit status
Language: C++

//bismillah
//created by anaksoleh
//24 Dec 2019
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll N,W;
bool computed[103][100000005];
ll dp[103][100000005];
ll value[103];
ll weight[103];

ll solve(ll n,ll c)
{
    if(n == 0)return 0;
    if(computed[n][c])return dp[n][c];

    ll best = solve(n-1,c);
    if(c >= weight[n]){
        best = max(best,solve(n-1,c - weight[n]) + value[n]);
    }
    computed[n][c] = true;
    dp[n][c] = best;
    return best;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> N >> W;
    for(ll i = 1 ; i <= N ; i++){
        cin >> weight[i] >> value[i];
    }
    solve(N,W);
    cout << dp[N][W] << '\n';

    return 0;
}


Compiler output:
/tmp/ccWc5ac7.o: in function `solve(long long, long long)':
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccWc5ac7.o
a.cc:(.text+0x98): relocation truncated to fit: R_X86_64_PC32 against symbol `weight' defined in .bss section in /tmp/ccWc5ac7.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `weight' defined in .bss section in /tmp/ccWc5ac7.o
a.cc:(.text+0xe6): relocation truncated to fit: R_X86_64_PC32 against symbol `value' defined in .bss section in /tmp/ccWc5ac7.o
a.cc:(.text+0x14f): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccWc5ac7.o
/tmp/ccWc5ac7.o: in function `main':
a.cc:(.text+0x1ca): relocation truncated to fit: R_X86_64_PC32 against symbol `weight' defined in .bss section in /tmp/ccWc5ac7.o
a.cc:(.text+0x1f5): relocation truncated to fit: R_X86_64_PC32 against symbol `value' defined in .bss section in /tmp/ccWc5ac7.o
a.cc:(.text+0x255): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccWc5ac7.o
collect2: error: ld returned 1 exit status
Language: C++

//bismillah
//created by anaksoleh
//24 Dec 2019
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
int N,W;
bool computed[103][100000005];
ll dp[103][100000005];
ll value[103];
ll weight[103];

ll solve(ll n,ll c)
{
    if(n == 0)return 0;
    if(computed[n][c])return dp[n][c];

    ll best = solve(n-1,c);
    if(c >= weight[n]){
        best = max(best,solve(n-1,c - weight[n]) + value[n]);
    }
    computed[n][c] = true;
    dp[n][c] = best;
    return best;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> N >> W;
    for(int i = 1 ; i <= N ; i++){
        cin >> weight[i] >> value[i];
    }
    solve(N,W);
    cout << dp[N][W] << '\n';

    return 0;
}


Compiler output:
/tmp/ccHt2d6s.o: in function `solve(long long, long long)':
a.cc:(.text+0x61): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccHt2d6s.o
a.cc:(.text+0x98): relocation truncated to fit: R_X86_64_PC32 against symbol `weight' defined in .bss section in /tmp/ccHt2d6s.o
a.cc:(.text+0xb5): relocation truncated to fit: R_X86_64_PC32 against symbol `weight' defined in .bss section in /tmp/ccHt2d6s.o
a.cc:(.text+0xe6): relocation truncated to fit: R_X86_64_PC32 against symbol `value' defined in .bss section in /tmp/ccHt2d6s.o
a.cc:(.text+0x14f): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccHt2d6s.o
/tmp/ccHt2d6s.o: in function `main':
a.cc:(.text+0x1ca): relocation truncated to fit: R_X86_64_PC32 against symbol `weight' defined in .bss section in /tmp/ccHt2d6s.o
a.cc:(.text+0x1f6): relocation truncated to fit: R_X86_64_PC32 against symbol `value' defined in .bss section in /tmp/ccHt2d6s.o
a.cc:(.text+0x259): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccHt2d6s.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
	ll n,W,ans=0;
	cin>>n>>W;
	vector<ll> w(n+1),v(n+1);
    vector<vector<ll>> dp(n+1,vector<ll>(1e5+1,1e10));
	/*
	State
	dp[i][j]: Denotes the minimum weight of items(from 1 to i) picked in the bag having total value == j
	Recurrence
	2 choices 1: we pick the ith element, 2: we dont pick the ith element 
	The 2 choices are checked for all weights
	dp[i][j]=minimum(weight of items picked from 1 to i-1 with value == j,weight of items picked from 1 to i-1 with value == (j-value[i]) + weight[i])
	*/
	for(ll i=1;i<=n;i++)
	cin>>w[i]>>v[i];
	for(ll i=0;i<=n;i++){
        dp[i][0] = 0;
    }
	for(ll i=1;i<=n;i++){
		for(ll j=0;j<=val;j++){
			if(v[i]>j)
				dp[i][j]=dp[i-1][j];
			else
				dp[i][j]=min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
			if(dp[i][j]<=W)
				ans=max(ans,j);
		}
	}
	cout<<ans<<"\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:31: error: 'val' was not declared in this scope
   23 |                 for(ll j=0;j<=val;j++){
      |                               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long knapSack(long long W, long long wt[], long long val[], long long n) {
  long long i, w, K[n + 5][W + 5];
  for (i = 0; i <= n; i++) {
    for (w = 0; w <= W; w++) {
      if (i == 0 || w == 0)
        K[i][w] = 0;
      else if (wt[i - 1] <= w)
        K[i][w] = max(val[i - 1] + K[i - 1][w - wt[i - 1]], K[i - 1][w]);
      else
        K[i][w] = K[i - 1][w];
    }
  }

  return K[n][W];
}
int main() {
  long long val[300], wt[300], W, n;
  cin >> n >> W;
  for (int i = 0; i < n; i++) {
    cin >> w[i] >> val[i];
  }
  cout << knapSack(W, wt, val, n);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'w' was not declared in this scope
   22 |     cin >> w[i] >> val[i];
      |            ^
Language: C++

include <bits/stdc++.h>
using namespace std;
// const int N = 1e5 + 7;
typedef long long int lli;
// int a[N];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, w, val_max = 0;
    cin >> n >> w;
    vector<lli> val(n), wei(n);
    for (int i = 0; i < n; i++) {
        cin >> wei[i] >> val[i];
        val_max += val[i];
    }
 
    vector<lli> weight(val_max + 1, INT_MAX);
 
    weight[0] = 0;
 
    for (int i = 0; i < n; i++) {
        vector<lli> temp(val_max + 1);
        for (int j = 1; j <= val_max; j++) {
            temp[j] = min(
                weight[j],
                j - val[i] >= 0 ? weight[j - val[i]] + wei[i] : INT_MAX);
        }
        weight = temp;
    }
 
    // for (int i = 0; i <= val_max; i++) {
    //     cout << weight[i] << " ";
    // }
    // cout << endl;
 
    int ans = 0;
 
    for (int i = 0; i <= val_max; i++) {
        if (weight[i] <= w) {
            ans = i;
        }
    }
 
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'ios_base' has not been declared
    7 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(0);
      |     ^~~
a.cc:9:5: error: 'cout' was not declared in this scope
    9 |     cout.tie(0);
      |     ^~~~
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<lli> val(n), wei(n);
      |     ^~~~~~
a.cc:12:15: error: expected primary-expression before '>' token
   12 |     vector<lli> val(n), wei(n);
      |               ^
a.cc:12:17: error: 'val' was not declared in this scope
   12 |     vector<lli> val(n), wei(n);
      |                 ^~~
a.cc:12:25: error: 'wei' was not declared in this scope
   12 |     vector<lli> val(n), wei(n);
      |                         ^~~
a.cc:18:15: error: expected primary-expression before '>' token
   18 |     vector<lli> weight(val_max + 1, INT_MAX);
      |               ^
a.cc:18:37: error: 'INT_MAX' was not declared in this scope
   18 |     vector<lli> weight(val_max + 1, INT_MAX);
      |                                     ^~~~~~~
a.cc:1:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | include <bits/stdc++.h>
a.cc:18:17: error: 'weight' was not declared in this scope
   18 |     vector<lli> weight(val_max + 1, INT_MAX);
      |                 ^~~~~~
a.cc:23:19: error: expected primary-expression before '>' token
   23 |         vector<lli> temp(val_max + 1);
      |                   ^
a.cc:23:21: error: 'temp' was not declared in this scope
   23 |         vector<lli> temp(val_max + 1);
      |                     ^~~~
a.cc:25:23: error: 'min' was not declared in this scope; did you mean 'main'?
   25 |             temp[j] = min(
      |                       ^~~
      |                       main
a.cc:45:20: error: 'endl' was not declared in this scope
   45 |     cout << ans << endl;
      |                    ^~~~
Language: C++

clude <bits/stdc++.h>
using namespace std;
// const int N = 1e5 + 7;
typedef long long int lli;
// int a[N];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, w, val_max = 0;
    cin >> n >> w;
    vector<lli> val(n), wei(n);
    for (int i = 0; i < n; i++) {
        cin >> wei[i] >> val[i];
        val_max += val[i];
    }
 
    vector<lli> weight(val_max + 1, INT_MAX);
 
    weight[0] = 0;
 
    for (int i = 0; i < n; i++) {
        vector<lli> temp(val_max + 1);
        for (int j = 1; j <= val_max; j++) {
            temp[j] = min(
                weight[j],
                j - val[i] >= 0 ? weight[j - val[i]] + wei[i] : INT_MAX);
        }
        weight = temp;
    }
 
    // for (int i = 0; i <= val_max; i++) {
    //     cout << weight[i] << " ";
    // }
    // cout << endl;
 
    int ans = 0;
 
    for (int i = 0; i <= val_max; i++) {
        if (weight[i] <= w) {
            ans = i;
        }
    }
 
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'clude' does not name a type
    1 | clude <bits/stdc++.h>
      | ^~~~~
a.cc: In function 'int main()':
a.cc:7:5: error: 'ios_base' has not been declared
    7 |     ios_base::sync_with_stdio(0);
      |     ^~~~~~~~
a.cc:8:5: error: 'cin' was not declared in this scope
    8 |     cin.tie(0);
      |     ^~~
a.cc:9:5: error: 'cout' was not declared in this scope
    9 |     cout.tie(0);
      |     ^~~~
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<lli> val(n), wei(n);
      |     ^~~~~~
a.cc:12:15: error: expected primary-expression before '>' token
   12 |     vector<lli> val(n), wei(n);
      |               ^
a.cc:12:17: error: 'val' was not declared in this scope
   12 |     vector<lli> val(n), wei(n);
      |                 ^~~
a.cc:12:25: error: 'wei' was not declared in this scope
   12 |     vector<lli> val(n), wei(n);
      |                         ^~~
a.cc:18:15: error: expected primary-expression before '>' token
   18 |     vector<lli> weight(val_max + 1, INT_MAX);
      |               ^
a.cc:18:37: error: 'INT_MAX' was not declared in this scope
   18 |     vector<lli> weight(val_max + 1, INT_MAX);
      |                                     ^~~~~~~
a.cc:1:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
  +++ |+#include <climits>
    1 | clude <bits/stdc++.h>
a.cc:18:17: error: 'weight' was not declared in this scope
   18 |     vector<lli> weight(val_max + 1, INT_MAX);
      |                 ^~~~~~
a.cc:23:19: error: expected primary-expression before '>' token
   23 |         vector<lli> temp(val_max + 1);
      |                   ^
a.cc:23:21: error: 'temp' was not declared in this scope
   23 |         vector<lli> temp(val_max + 1);
      |                     ^~~~
a.cc:25:23: error: 'min' was not declared in this scope; did you mean 'main'?
   25 |             temp[j] = min(
      |                       ^~~
      |                       main
a.cc:45:20: error: 'endl' was not declared in this scope
   45 |     cout << ans << endl;
      |                    ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vl = vector<ll>;
using vvll = vector<vl>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  int n,W;
  cin>>n>>W;
  vl w(n);
  vl v(n);
  rep(i,n){
    cin>>w[i]>>v[i];
  }
  vvll dp(110,vl(100100,MOD));
  dp[0][0]=0;
  rep(i,n){
    rep(j,100100){
      if(j>=v[i]){
        dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  ll ans=0;
  int cu=0;
  rep(i,100100){
    if(dp[n][i]<=W){
      ans=dp[n][i];
      cu=i;
    }

  }
  COUT(i);
}

        
    


Compiler output:
a.cc: In function 'int main()':
a.cc:57:8: error: 'i' was not declared in this scope
   57 |   COUT(i);
      |        ^
a.cc:14:24: note: in definition of macro 'COUT'
   14 | #define COUT(x) cout<<(x)<<endl
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vl = vector<ll>;
using vvll = vector<vl>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  int n,w;
  cin>>n>>w;
  vl w(n);
  vl v(n);
  rep(i,n){
    cin>>w[i]>>v[i];
  }
  vvll dp(110,vl(100100,MOD));
  dp[0][0]=0;
  rep(i,n){
    rep(j,100100){
      if(j>=v[i]){
        dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  ll ans=0;
  rep(i,100100){
    if(dp[n][i]<=w){
      ans=dp[n][i];
    }
  }
  COUT(ans);
}

        
    


Compiler output:
a.cc: In function 'int main()':
a.cc:31:6: error: conflicting declaration 'vl w'
   31 |   vl w(n);
      |      ^
a.cc:29:9: note: previous declaration as 'int w'
   29 |   int n,w;
      |         ^
a.cc:34:11: error: invalid types 'int[long long int]' for array subscript
   34 |     cin>>w[i]>>v[i];
      |           ^
a.cc:41:48: error: invalid types 'int[long long int]' for array subscript
   41 |         dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      |                                                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vl = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  int n,w;
  cin>>n>>w;
  vl w(n);
  vl v(n);
  rep(i,n){
    cin>>w[i]>>v[i];
  }
  vvll dp(110,vl(100100,MOD));
  dp[0][0]=0;
  rep(i,n){
    rep(j,100100){
      if(j>=v[i]){
        dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  ll ans=0;
  rep(i,100100){
    if(dp[n][i]<=w){
      ans=dp[n][i];
    }
  }
  COUT(ans);
}

        
    


Compiler output:
a.cc:25:21: error: 'vll' was not declared in this scope; did you mean 'vl'?
   25 | using vvll = vector<vll>;
      |                     ^~~
      |                     vl
a.cc:25:24: error: template argument 1 is invalid
   25 | using vvll = vector<vll>;
      |                        ^
a.cc:25:24: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:31:6: error: conflicting declaration 'vl w'
   31 |   vl w(n);
      |      ^
a.cc:29:9: note: previous declaration as 'int w'
   29 |   int n,w;
      |         ^
a.cc:34:11: error: invalid types 'int[long long int]' for array subscript
   34 |     cin>>w[i]>>v[i];
      |           ^
a.cc:36:3: error: 'vvll' was not declared in this scope; did you mean 'vl'?
   36 |   vvll dp(110,vl(100100,MOD));
      |   ^~~~
      |   vl
a.cc:37:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
   37 |   dp[0][0]=0;
      |   ^~
      |   dup
a.cc:41:48: error: invalid types 'int[long long int]' for array subscript
   41 |         dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      |                                                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  int n,w;
  cin>>n>>w;
  vll w(n);
  vll v(n);
  rep(i,n){
    cin>>w[i]>>v[i];
  }
  vvll dp(110,vl(100100,MOD));
  dp[0][0]=0;
  rep(i,n){
    rep(j,100100){
      if(j>=v[i]){
        dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      }
      else{
        dp[i+1][j]=dp[i][j];
      }
    }
  }
  ll ans=0;
  rep(i,100100){
    if(dp[n][i]<=w){
      ans=dp[n][i];
    }
  }
  COUT(ans);
}

        
    

Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: conflicting declaration 'vll w'
   31 |   vll w(n);
      |       ^
a.cc:29:9: note: previous declaration as 'int w'
   29 |   int n,w;
      |         ^
a.cc:34:11: error: invalid types 'int[long long int]' for array subscript
   34 |     cin>>w[i]>>v[i];
      |           ^
a.cc:36:15: error: 'vl' was not declared in this scope; did you mean 'v'?
   36 |   vvll dp(110,vl(100100,MOD));
      |               ^~
      |               v
a.cc:41:48: error: invalid types 'int[long long int]' for array subscript
   41 |         dp[i+1][j]=min(dp[i][j],dp[i][j-v[i]]+w[i]);
      |                                                ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<assert.h>
typedef long long ll;
using namespace std;
ll min(ll x, ll y){
	return x > y ? y : x;
}
int main(){
	//freopen("input.txt", "r", stdin);
	int n,W;
	cin >> n>>W;
	vector<ll>val(n);
	vector<ll>wgt(n);
	int sum = 0;
	for (int i = 0; i < n; i++){
		cin >> wgt[i] >> val[i];
		sum += val[i];
	}
	vector<ll>dp(sum + 1,INT_MAX);
	dp[0] = 0;
	for (int i = 0; i < n; i++){
		for (int j = sum; j >= val[i]; j--){
			dp[j] = min(dp[j], dp[j - val[i]] + wgt[i]);
		}
	}
	for (int i = sum; i >= 0; i--){
		if (dp[i] <= W){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:30: error: 'INT_MAX' was not declared in this scope
   21 |         vector<ll>dp(sum + 1,INT_MAX);
      |                              ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include<assert.h>
  +++ |+#include <climits>
    5 | typedef long long ll;