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

#include<stdio.h>
int main()
{
int N,T;
int t[200000];
int x;
scanf("%d %d",&N,&T);
for (x=0;x<N;x++)
scan("%d",&t[x]);
int sum;
for (x=0;x<N;x++)
{
if(t[x]<=T)
sum+=t[x];
else
sum+=T;
}
printf("%d",sum);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:1: error: 'scan' was not declared in this scope; did you mean 'scanf'?
    9 | scan("%d",&t[x]);
      | ^~~~
      | scanf
Language: Java

import java.util.*;

public class Main {
	public static void main(String []args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t = sc.nextInt();
		int[] frags = new int[n];
		int i = 0;
		while(sc.hasNext()) {
			frags[i++] = sc.nextInt();
		}
		Main soln = new Main();
		System.out.println(soln.jdg(t, frags));
	}

	private long jdg(int t, int[] frags) {
		long res = (long)t;
		if(frags.length==1) return res;
		int dlt = 0;
		for(int i=0; i<dlt.length; i++) {
			dlt = frags[i+1]-frags[i];
			res += (long)((dlt<t)? dlt:t);
		}
		return res;
	}
}

Compiler output:
Main.java:21: error: int cannot be dereferenced
		for(int i=0; i<dlt.length; i++) {
		                  ^
1 error
Language: C++

#include <iostream>
using namespace std;
int main(){
  int N,T;
  cin >> N >> T;
  int t[N];
  scanf("%d",t);
  long long now=0,ans=0;
  for(int i=0;i<N;i++){
    if(t[i+1]>t[i]+T){
      ans-=(t[i+1]-t[i]);
      ans+=T;
    }
  }
  ans+=t[i]+T;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:10: error: 'i' was not declared in this scope
   15 |   ans+=t[i]+T;
      |          ^
Language: C++

#include <iostream>
using namespace std;
int int main(){
  int N,T;
  cin >> N >> T;
  int t[N];
  scanf("%d",t);
  long long now=0,ans=0;
  for(int i=0;i<N;i++){
    if(t[i]>now){
      ans-=t[i]-now;
    }
    if(t[i]+T>now){
      now=t[i]+T;
    }
  }
  ans+=now;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:3:1: error: two or more data types in declaration of 'main'
    3 | int int main(){
      | ^~~
Language: C

#include <iostream>
using namespace std;
int int main(){
  int N,T;
  cin >> N >> T;
  int t[N];
  scanf("%d",t);
  long long now=0,ans=0;
  for(int i=0;i<N;i++){
    if(t[i]>now){
      ans-=t[i]-now;
    }
    if(t[i]+T>now){
      now=t[i]+T;
    }
  }
  ans+=now;
  cout << ans << endl;
  return 0;
}


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

import java.util.Scanner;

public class Main {
	public static void main(String args[]){

		Scanner cin = new Scanner(System.in);

		int N = cin.nextInt();
		long T = cin.nextLong();


		long before = cin.nextLong();
                if(N>1){
		    long tmp = cin.nextLong();
                }
		long sum =0L;

		for(int i=0;i<N-1;i++){
			if(tmp-before<T){
				sum += T-(tmp-before);
			}
			if(i<N-2){
				before = tmp;
				tmp = cin.nextLong();
			}
		}
		System.out.println(N*T-sum);
	}
}


Compiler output:
Main.java:19: error: cannot find symbol
			if(tmp-before<T){
			   ^
  symbol:   variable tmp
  location: class Main
Main.java:20: error: cannot find symbol
				sum += T-(tmp-before);
				          ^
  symbol:   variable tmp
  location: class Main
Main.java:23: error: cannot find symbol
				before = tmp;
				         ^
  symbol:   variable tmp
  location: class Main
Main.java:24: error: cannot find symbol
				tmp = cin.nextLong();
				^
  symbol:   variable tmp
  location: class Main
4 errors
Language: Java

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int t = scan.nextInt();
		
		int s = scan.nextInt();
		int sum = 0;

		for(int i = 1 ; i < n ; < i++){
			
			int time = scan.nextInt();
			if(time - s >= t){
				sum += t;
			} else {
				sum += time - s;
			}
			s = time;
		}
		System.out.println(sum);
	}
}

Compiler output:
Main.java:13: error: > or ',' expected
		for(int i = 1 ; i < n ; < i++){
		                           ^
Main.java:13: error: illegal start of expression
		for(int i = 1 ; i < n ; < i++){
		                             ^
2 errors
Language: Java

import java.util.Scanner;

public class Main{
	pulic static void main(String[] args){
		
		Scanner scan = new Scanner(System.in);
		int n = Integer.ParseInt(scan.read());
		int t = Integer.ParseInt(scan.read());
		
		int s = Integer.ParseInt(scan.next());;
		int sum = 0;

		for(int i = 1 ; i < n ; < i++){
			
			int time = Integer.ParseInt(scan.next());
			if(time - s >= t){
				sum += t;
			} else {
				sum += time - s;
			}
			s = time;
		}
		System.out.println(sum);
	}
}

Compiler output:
Main.java:4: error: <identifier> expected
	pulic static void main(String[] args){
	     ^
Main.java:13: error: > or ',' expected
		for(int i = 1 ; i < n ; < i++){
		                           ^
Main.java:13: error: illegal start of expression
		for(int i = 1 ; i < n ; < i++){
		                             ^
3 errors
Language: C++

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

// ABC060C Sentou

int main() {
    ios.sync_with_stdio(false);
    int N, T, t;
    cin >> N >> T;
    int total = T;
    int prev_t = 0;
    for (int i = 0; i < N; ++i){
        cin >> t;
        if (prev_t + T < t){
            total += T;
        }else {
            total += t - prev_t;
        }
        prev_t = t;
    }
    cout << total << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: expected unqualified-id before '.' token
    8 |     ios.sync_with_stdio(false);
      |        ^
Language: C

#include <stdio.h>

int main(){
  long long int n,t,tmpa,tmpb,i,ret=0;
  scanf("%lld%lld",&n,&t);
  for(i=1;i<n;i++){
    scanf("%lld ",&tmpa);
    if(i!=1){
      ret += (tmpa-tmpb>t)?t:(tmpa-tmpb);
    }
    tmpb = tmpa;
    //printf("%d\n",ret);                                                           }
  scanf("%lld",&tmpa);
  ret += (tmpa-tmpb>t)?t:(tmpa-tmpb);
  printf("%lld\n",ret+t);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:1: error: expected declaration or statement at end of input
   17 | }
      | ^
Language: C

#include <stdio.h>
 
int main()
{
int a,b,i;
int count=0;
scanf("%d %d",&a,&b);
 
int c[a];
for(i=0;i<a;i++){
scanf("%d",&c[i]);
}
 
for(i=0;i<a;i++){
count+=b;
if (i+1 == a) {
count += b;
} else if((c[i+1]-c[i])<b) {
count += c[i+1]-c[i];
} else {
count += b;
}
}
 
printf("%d\n",count);
 

Compiler output:
main.c: In function 'main':
main.c:25:1: error: expected declaration or statement at end of input
   25 | printf("%d\n",count);
      | ^~~~~~
Language: C

#include <stdio.h>

int main()
{
int a,b,i;
int count=0;
scanf("%d %d",&a,&b);

int c[a];
for(i=0;i<a;i++){
scanf("%d",&c[i]);
}

for(i=0;i<a;i++){
count+=b;
if (i+1 == a) {
count += b
} else if((c[i+1]-c[i])<b) {
count += c[i+1]-c[i]
} else {
count += b
}
}

printf("%d\n",count);

}

Compiler output:
main.c: In function 'main':
main.c:17:11: error: expected ';' before '}' token
   17 | count += b
      |           ^
      |           ;
   18 | } else if((c[i+1]-c[i])<b) {
      | ~          
main.c:19:21: error: expected ';' before '}' token
   19 | count += c[i+1]-c[i]
      |                     ^
      |                     ;
   20 | } else {
      | ~                    
main.c:21:11: error: expected ';' before '}' token
   21 | count += b
      |           ^
      |           ;
   22 | }
      | ~
Language: C++

#include<iostream>
using namespace std;
int N,T;
int a[2000000];
int main(){
	cin>>N>>T;
	int sum=0;
	for (int i=0;i<N;i++){
		cin>>a[i];
		if(i==0)sum=T;
		else{
			if(a[i]-a[i-1]<=T){
				int len=T-(t[i]-t[i-1]);
				sum=+sum-len+T;
			}
			else{
				sum=sum+T;
			}
		}
	}
	cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:44: error: 't' was not declared in this scope
   13 |                                 int len=T-(t[i]-t[i-1]);
      |                                            ^
Language: C++

#include<iostream>
using namespace std;


int main(){
int n,t,sum=0,fin,ans=0,big=0;
    long int t2;
cin>>n>>t;
fin=t
for(int i=0;i<n;i++){
cin>>t2;
if(t2<=fin){
fin=t2+t;
}
else{
ans=ans+fin-big;
big=t2;
fin=t+t2;
}
}
ans=ans+fin-big;
cout<<ans<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: expected ';' before 'for'
    9 | fin=t
      |      ^
      |      ;
   10 | for(int i=0;i<n;i++){
      | ~~~   
a.cc:10:13: error: 'i' was not declared in this scope
   10 | for(int i=0;i<n;i++){
      |             ^
Language: C++

#include<iostream>
using namespace std;
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#endif

int main(){
int n,t,sum=0,fin,ans=0,big=0;
    long int t2;
cin>>n>>t;
fin=t
for(int i=0;i<n;i++){
cin>>t2;
if(t2<=fin){
fin=t2+t;
}
else{
ans=ans+fin-big;
big=t2;
fin=t+t2;
}
}
ans=ans+fin-big;
cout<<ans<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:6: error: expected ';' before 'for'
   13 | fin=t
      |      ^
      |      ;
   14 | for(int i=0;i<n;i++){
      | ~~~   
a.cc:14:13: error: 'i' was not declared in this scope
   14 | for(int i=0;i<n;i++){
      |             ^
Language: C++

#include <iostream>

using namespace std;

int main(){
    long long N,T;
    cin >> N >> T;
    long long t[N+1]; // how to initialize this kind of variable-sized object?
    for(int i=0;i<N+1;i++) t[i]=LONG_MAX;
    for(int i=0;i<N;i++) cin >> t[i];
    
    long long ans = 0;
    int i=0;
    long long prev = 0;
    while(i < N){
        prev = i;
        while(t[i+1] < t[i]+ T){
            i += 1;
        }
        ans += t[i] + T - t[prev];
        i += 1;
    }
    cout << ans << endl;                                                              
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:33: error: 'LONG_MAX' was not declared in this scope
    9 |     for(int i=0;i<N+1;i++) t[i]=LONG_MAX;
      |                                 ^~~~~~~~
a.cc:2:1: note: 'LONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 |
Language: C++

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

int n;
long long t,ans=0;

int main()
{
    cin>>n>>t;
    cin>>p;
    
    if(n==1){
    cout<<t<<endl;return 0;}
    
    for(int i=2;i<=n;i++)
    {
    cin>>q;
    ans+=min(t,q-p);
    p=q;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'p' was not declared in this scope
   10 |     cin>>p;
      |          ^
a.cc:17:10: error: 'q' was not declared in this scope
   17 |     cin>>q;
      |          ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;A
 
int main(){
	long long int n,t;
	vector<long long int> v;
	long long int total=0;
 
	int now=0;
 
	cin>>n>>t;
 
 
	for(int i=0;i<n;i++){
		long long int tmp;
		cin>>tmp;
		v.push_back(tmp);
	}
	now=v[0];
 
	for(int i=1;i<n;i++){
		total+=min(t,v[i]-v[i-1]);
	}
	total+=t;
	cout<<total<<endl;
 
	
 
	return 0;
}

Compiler output:
a.cc:5:21: error: 'A' does not name a type
    5 | using namespace std;A
      |                     ^
Language: C++

include<iostream>
#include <stdio.h>

using namespace std;
int main()
{
	long N, T,i,j,S;
	N = 0;
	T = 0;
	S = 0;
	int a[200000];

	cin >> N, T;

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

		if (a[j] < T)
			S = S + a[j];
		else
			S = S + T;

	}

	cout << S;

	cin >> j;

	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:13:9: error: 'cin' was not declared in this scope
   13 |         cin >> N, T;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <stdio.h>
  +++ |+#include <iostream>
    3 | 
a.cc:30:9: error: 'cout' was not declared in this scope
   30 |         cout << S;
      |         ^~~~
a.cc:30:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: Java

import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int i=1;
int n=sc.nextInt();
long T=sc.nextLong();
long[] t=new long[n];
long rtn=0;
t[0]=sc.nextLong();
for(i;i<n;i++){
t[i]=sc.nextLong();
rtn+=Math.min(T,t[i]-t[i-1]);
}
System.out.println(rtn);
}
}

Compiler output:
Main.java:11: error: not a statement
for(i;i<n;i++){
    ^
1 error
Language: C++

#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int n, t;

	cin >> n;
	cin >> t;

	vector <int> v;

	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		v.emplace_back(a);
	}

	int res = 0;

	for (size_t i = 0; i < v.size(); ++i)
	{
		res += t;

		if (i + 1 < v.size())
		{
			if (t >= v[i + 1] - v[i])
			{
				res -= t - (v[i + 1] - v[i]9;
			}
		}
	}

	cout << res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:60: error: expected ')' before numeric constant
   35 |                                 res -= t - (v[i + 1] - v[i]9;
      |                                            ~               ^
      |                                                            )
Language: C++

//#include "flyugelMap2.h"

#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

int main()
{
	int n, t;

	cin >> n;
	cin >> t;

	vector <int> v;

	for (int i = 0; i < n; ++i)
	{
		int a;
		cin >> a;
		v.emplace_back(a);
	}

	int res = 0;

	for (size_t i = 0; i < v.size(); ++i)
	{
		res += t;

		if (i + 1 < v.size())
		{
			if (t >= v[i + 1] - v[i])
			{
				res -= t - v[i + 1] - v[i];
			}
		}
	}

	

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

#include<iostream>
#include <algorithm>
#include<stdint>
using namespace std;
int main() {
	int n, t, f, l;
	int64_t sum = 0;
	cin >> n >> t >> f;
	for (int i = 0;i < n - 1;i ++) {
		cin >> l;
		sum += min(l-f, t);
		f = l;
	}
	cout << sum+t;
}

Compiler output:
a.cc:3:9: fatal error: stdint: No such file or directory
    3 | #include<stdint>
      |         ^~~~~~~~
compilation terminated.
Language: C++

include <iostream>

using namespace std;

int main()
{
int n,t,a,b,c=0;
cin>>n>>t;
int tab[n];
for(int i=0;i<n;i++){
    cin>>tab[i];
}
for(int i=0;i<n-1;i++){
   if(tab[i+1]-tab[i]>=t) c+=t;
   else c+=tab[i+1]-tab[i];
}
cout<<c;
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:1: error: 'cin' was not declared in this scope
    8 | cin>>n>>t;
      | ^~~
a.cc:17:1: error: 'cout' was not declared in this scope
   17 | cout<<c;
      | ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
ll dp[105][20000];
ll cost[1000],weight[1000];
ll value,task,a;
ll O_1knapsack(ll n,ll val)
{
    int i,w;
    for(i=0; i<=n; i++)

        for(w=0; w<=val; w++)
        {
            if (i==0 || w==0)
                dp[i][w] = 0;
            else if(weight[i-1]<=w)
            {
                if(cost[i-1]+dp[i-1][w-weight[i-1]]>=dp[i-1][w])
                {
                    dp[i][w]=cost[i-1]+dp[i-1][w-weight[i-1]];

                }
                else
                {
                    dp[i][w]=dp[i-1][w];
                }
            }
            else
                dp[i][w]=dp[i-1][w];

        }
    return dp[n][val];
}
int main()
{
    //freopen("output.txt", "w", stdout);
    int i;
    cin>>task>>value;
    for( i=0; i<task; i++)
    {
        cin>>weight[i]>>cost[i];

    }
    a=O_1knapsack(task,value);
    cout<<a<<endl;

    return 0;
}


Compiler output:
a.cc:3:1: error: 'll' does not name a type
    3 | ll dp[105][20000];
      | ^~
a.cc:4:1: error: 'll' does not name a type
    4 | ll cost[1000],weight[1000];
      | ^~
a.cc:5:1: error: 'll' does not name a type
    5 | ll value,task,a;
      | ^~
a.cc:6:1: error: 'll' does not name a type
    6 | ll O_1knapsack(ll n,ll val)
      | ^~
a.cc: In function 'int main()':
a.cc:37:10: error: 'task' was not declared in this scope
   37 |     cin>>task>>value;
      |          ^~~~
a.cc:37:16: error: 'value' was not declared in this scope
   37 |     cin>>task>>value;
      |                ^~~~~
a.cc:40:14: error: 'weight' was not declared in this scope
   40 |         cin>>weight[i]>>cost[i];
      |              ^~~~~~
a.cc:40:25: error: 'cost' was not declared in this scope; did you mean 'cosl'?
   40 |         cin>>weight[i]>>cost[i];
      |                         ^~~~
      |                         cosl
a.cc:43:5: error: 'a' was not declared in this scope
   43 |     a=O_1knapsack(task,value);
      |     ^
a.cc:43:7: error: 'O_1knapsack' was not declared in this scope
   43 |     a=O_1knapsack(task,value);
      |       ^~~~~~~~~~~
Language: C++


using namespace std;

int N, W;
int w[100], v[100];

int dp(int num, int weight) {
  if(num == N){
   return 0;
  } else if (weight < w[num]) {
    return dp(num+1, weight);
  } else {
    return max(dp(num+1, weight),
               dp(num+1, weight -w[num]) + v[num]);
  }
}

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

  int ret = dp(0, W);

  cout << ret << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int dp(int, int)':
a.cc:13:12: error: 'max' was not declared in this scope
   13 |     return max(dp(num+1, weight),
      |            ^~~
a.cc: In function 'int main()':
a.cc:19:3: error: 'cin' was not declared in this scope
   19 |   cin >> N >> W;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | 
a.cc:26:3: error: 'cout' was not declared in this scope
   26 |   cout << ret << endl;
      |   ^~~~
a.cc:26:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:26:18: error: 'endl' was not declared in this scope
   26 |   cout << ret << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 |
Language: C++

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std; 

int n,w;
vector <pii> v;
map <pii,int> mp;

int fun(int i,int j){
    if (j>w) return INT_MIN;
    if (i==n) return 0;
    if (mp.count({i,j})) return mp[{i,j}];
    return mp[{i,j}] = max(fun(i+1,j),fun(i+1,j+v[i].ff)+v[i].ss);
}

inline void solve(){
    cin>>n>>w; 
    v.resize(n);
    for (int i=0;i<n;i++){
        int a,b; cin>>a>>b;
        v[i].ff=a;
        v[i].ss=b;
    }
    cout << fun(0,0) << endl; 
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Compiler output:
a.cc: In function 'long long int fun(long long int, long long int)':
a.cc:32:21: error: 'INT_MIN' was not declared in this scope
   32 |     if (j>w) return INT_MIN;
      |                     ^~~~~~~
a.cc:15:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <queue>
  +++ |+#include <climits>
   15 | #define   mod  998244353
Language: C++

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

int main()
{
  int n,w;
  cin>>n>>w;
   
  vector<int> wt(n);
  vector<int> v(n);
  
  for(int i=0;i<n;i++)
     cin>>wt[i];
  for(int i=0;i<n;i++)
     cin>>v[i];
  
  int dp[n+1][w+1];
  for(int i=0;i<n+1;i++)
    dp[i][0]=0;
  
  for(int i=0;i<w+1;i++)
    dp[0][i]=1;
  
  for(int i=1;i<n+1;i++)
  {
    for(int j=1;j<w+1;j++)
    {
      if(wt[i-1]<=j)
      dp[i][j]= max(v[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]<<endl;
                    
                    return 0;
                    }


Compiler output:
a.cc: In function 'int main()':
a.cc:29:59: error: expected ')' before ';' token
   29 |       dp[i][j]= max(v[i-1]+dp[i-1][j-wt[i-1]] + dp[i-1][j];
      |                    ~                                      ^
      |                                                           )
Language: C++

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

int main()
{
  int n,w;
  cin>>n>>w;
   
  vector<int> wt(n);
  vector<int> v(n);
  
  for(int i=0;i<n;i++)
     cin>>wt[i];
  for(int i=0;i<n;i++)
     cin>>v[i];
  
  int dp[n+1][w+1];
  for(int i=0;i<n+1;i++)
    dp[i][0]=0;
  
  for(int i=0;i<w+1;i++)
    dp[0][i]=1;
  
  for(int i=1;i<n+1;i++)
  {
    for(int j=1;j<w+1;j++)
    {
      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]<<endl;
                    
                    return 0;
                    }


Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: 'val' was not declared in this scope
   29 |       dp[i][j]= max(val[i-1]+dp[i-1][j-wt[i-1]] + dp[i-1][j];
      |                     ^~~
Language: C++

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

int main()
{
  int n,w;
  cin>>n>>w;
   
  vector<int> wt(n);
  vector<int> v(n);
  
  for(int i=0;i<n;i++)
     cin>>wt[i];
  for(int i=0;i<n;i++)
     cin>>v[i];
  
  int dp[n+1][w+1];
  for(int i=0;i<n+1;i++)
    dp[i][0]=0;
  
  for(int i=0;i<w+1;i++)
    dp[0][i]=1;
  
  for(int i=1;i<n+1;i++)
  {
    for(int j=1;j<w+1;j++)
    {
      if(wt[i-1]<=j)
      dp[i][j]= max(val[i-1]+dp[i-1][j-arr[i-1]] + dp[i-1][j];     
      else
      dp[i][j]=dp[i-1][j];              
         }
                    
                    }
                    
                    cout<<dp[n][w]<<endl;
                    
                    return 0;
                    }

Compiler output:
a.cc: In function 'int main()':
a.cc:29:21: error: 'val' was not declared in this scope
   29 |       dp[i][j]= max(val[i-1]+dp[i-1][j-arr[i-1]] + dp[i-1][j];
      |                     ^~~
a.cc:29:40: error: 'arr' was not declared in this scope
   29 |       dp[i][j]= max(val[i-1]+dp[i-1][j-arr[i-1]] + dp[i-1][j];
      |                                        ^~~
Language: C++

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

// 入力
int n, W;
int weight[110], value[110];

// DPテーブル
int dp[110][10010];

int main() {
  cin >> n >> W;
  for (int i = 0; i < n; ++i) cin >> weight[i] >> value[i];

  // DP初期条件: dp[0][w] = 0
  for (int w = 0; w <= W; ++w) dp[0][w] = 0;

  // DPループ
  for (int i = 0; i < n; ++i) {
    for (int w = 0; w <= W; ++w) {
      if (w >= weight[i]) dp[i+1][w] = max(dp[i][w-weight[i]] + value[i], dp[i][w]);
      else dp[i+1][w] = dp[i][w];
    }
  }

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

Compiler output:
a.cc:1:9: fatal error: bitset/std++.h: No such file or directory
    1 | #include<bitset/std++.h>
      |         ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vi vector<int>
using ll = long long;
using namespace std;
int main(){
  int n,W;
  cin >> n >> W;
  vi w(n);
  vi v(n);
  map<int, vi> weights;
  rep(i, n){
    cin >> w[i] >> v[i];
    weights[w[i]].push_back(v[i]);
  }
  int ans = 0;
  int weight = w[0];
  for(auto x : weights){
    SORT(x.second);
    reverse(x.second.begin(), x.second.end());
  }
  rep(a, weights[weight].size() + 1){
    rep(b, weights[weight + 1].size() + 1){
      rep(c, weights[weight + 2].size() + 1){
        rep(d, weights[weight + 3].size() + 1){
          if(a*weight + b*(weight+1) + c*(weight+2) + d*(weight+3) <= W){
            int res = 0;
            rep(i, a) res += weights[weight][i];
            rep(i, b) res += weights[weight + 1][i];
            rep(i, c) res += weights[weight + 2][i];
            rep(i, d) res += weights[weight + 3][i];
            ans = (ans < res) ? res : ans;
          }
        }
      }
    }
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'SORT' was not declared in this scope
   19 |     SORT(x.second);
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,W; cin>>N>>W;
  int ans=0;
  vii A(4);
  int memo=0; cin>>memo;
  int X; cin>>X;
  A[0].push_back(X);
  rep(i,0,N-1){
    int X,Y; cin>>X>>Y;
    A[X-memo].push_back(Y);
  }
  vii S(4);
  rep(i,0,4){
    sort(ALL(A[i]),greater<int>());
    int sum=0;
    S[i].puah_back(0);
    rep(j,0,A[i].size()){
      sum+=A[i][j];
      S[i].push_back(sum);
    }
  }
  REP(i,0,A[0].size()){
    REP(j,0,A[1].size()){
      REP(k,0,A[2].size()){
        REP(l,0,A[3].size()){
          int K=i*memo;
          K+=j*memo+j;
          K+=k*memo+k*2;
          K+=l*memo+l*3;
          if(K<=W){
            int sum=0;
            sum+=S[0][i];
            sum+=S[1][j];
            sum+=S[2][k];
            sum+=S[3][l];
            ans=max(ans,sum);
          }
        }
      }
    }
  }
  cout<<ans<<endl;
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:30:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'puah_back'; did you mean 'push_back'?
   30 |     S[i].puah_back(0);
      |          ^~~~~~~~~
      |          push_back
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,W; cin>>N>>W;
  int ans=0;
  vii A(4);
  int memo=0; cin>>memo;
  int X; cin>>X;
  A[0].push_back(X);
  rep(i,0,N-1){
    int X,Y; cin>>X>>Y;
    A[X-memo].push_back(Y);
  }
  vii S(4);
  rep(i,0,4){
    sort(ALL(A[i]),greater<int>());
    int sum=0;
    S[i].puah_back(0);
    rep(j,0,A[i].size()){
      sum+=A[i][j];
      S[i].puah_back(sum);
    }
  }
  REP(i,0,A[0].size()){
    REP(j,0,A[1].size()){
      REP(k,0,A[2].size()){
        REP(l,0,A[3].size()){
          int K=i*memo;
          K+=j*memo+j;
          K+=k*memo+k*2;
          K+=l*memo+l*3;
          if(K<=W){
            int sum=0;
            sum+=S[0][i];
            sum+=S[1][j];
            sum+=S[2][k];
            sum+=S[3][l];
            ans=max(ans,sum);
          }
        }
      }
    }
  }
  cout<<ans<<endl;
  }



Compiler output:
a.cc: In function 'int main()':
a.cc:30:10: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'puah_back'; did you mean 'push_back'?
   30 |     S[i].puah_back(0);
      |          ^~~~~~~~~
      |          push_back
a.cc:33:12: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'class std::vector<long long int>'} has no member named 'puah_back'; did you mean 'push_back'?
   33 |       S[i].puah_back(sum);
      |            ^~~~~~~~~
      |            push_back
Language: C++

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

int main(){
  int N,W;
  cin>>N>>W;
  vector<int> w(N),v(N);
  for(int i=0;i<N;i++){
    cin>>w.at(i)>>v.at(i);
  }
  
  vector<int> value(W+1,0);
  if(w.at(0)<=W){
    value.at(w.at(0))=v.at(0);
  }
  for(int i=1;i<N;i++){
    for(int j=w.(i);j+w.at(i)<=W;j++){
      value.at(j+w.at(i))=max(value.at(j+w.at(i)),value.at(j)+v.at(i));
    }
  }
  int ans=1;
  for(int i=0;i<W+1;i++){
    ans=max(ans,value.at(i));
  }
  
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:17: error: expected unqualified-id before '(' token
   17 |     for(int j=w.(i);j+w.at(i)<=W;j++){
      |                 ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N;
    int64_t W;
    cin >> N >> W;
    vector< vector<int64_t> > v(4);
    --N;
    int w0, v0;
    cin >> w0 >> v0;
    v[0].push_back(v0);
    while(N--) {
        int w, v;
        cin >> w >> v;
        v[w-w0].push_back(v);
    }

    for(auto e: v) {
        sort(e.begin(), e.end());
        e.push_back(0);
        reverse(e.begin(), e.end());
        partial_sum(e.begin(), e.end(), e.begin());
    }

    int64_t ans = 0;
    for(int64_t i=0; i<v[0].size(); i++) {
        for(int64_t j=0; j<v[1].size(); j++) {
            for(int64_t k=0; k<v[2].size(); k++) {
                for(int64_t l=0; l<v[3].size(); l++) {
                    if(w0*(i+j+k+l) + j + 2*k + 3*l <= W) {
                        ans = max(ans, v[0][i] + v[1][j] + v[2][k] + v[3][l]);
                    }
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: invalid types 'int[int]' for array subscript
   20 |         v[w-w0].push_back(v);
      |          ^
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

ll dp[1002][MOD];
ll w[1002],v[1002];

void knapsack(ll i, ll wi){
    i++;
    wi++;
    if(wi < w[i]){
        dp[i][wi] = dp[i-1][wi];
    }else{
        dp[i][wi] = max(dp[i-1][wi],dp[i-1][wi-w[i]]+v[i]);
    }
}



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

    int N,W;
    cin >> N >> W;
    
    for(int i = 0; i < N+2;i++){
        for(int l = 0; l < W+2;l++){
            dp[i][l] = 0;
        }
    }
    for(int i = 1; i < N+1;i++){
        cin >> w[i] >> v[i];
    }

    for(int i = 0; i < N;i++){
        for(int l = 0; l < W;l++){
            knapsack(i,l);
        }
    }

    // for(int i = 0; i < N+2;i++){
    //     for(int l = 0; l < W+2;l++){
    //         cout << dp[i][l] << " ";
    //     }
    //     cout << endl;
    // }

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




    return 0;
}

Compiler output:
/tmp/ccQBrpgA.o: in function `knapsack(long long, long long)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccQBrpgA.o
a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccQBrpgA.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQBrpgA.o
/tmp/ccQBrpgA.o: in function `main':
a.cc:(.text+0x210): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccQBrpgA.o
a.cc:(.text+0x23c): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccQBrpgA.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

int N,W;
ll dp[1002][MOD];
ll w[1002],v[1002];

void knapsack(ll i, ll wi){
    i++;
    wi++;
    if(wi < w[i]){
        dp[i][wi] = dp[i-1][wi];
    }else{
        dp[i][wi] = max(dp[i-1][wi],dp[i-1][wi-w[i]]+v[i]);
    }
}



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

    
    cin >> N >> W;
    
    for(int i = 0; i < N+2;i++){
        for(int l = 0; l < W+2;l++){
            dp[i][l] = 0;
        }
    }
    for(int i = 1; i < N+1;i++){
        cin >> w[i] >> v[i];
    }

    for(int i = 0; i < N;i++){
        for(int l = 0; l < W;l++){
            knapsack(i,l);
        }
    }

    // for(int i = 0; i < N+2;i++){
    //     for(int l = 0; l < W+2;l++){
    //         cout << dp[i][l] << " ";
    //     }
    //     cout << endl;
    // }

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




    return 0;
}

Compiler output:
/tmp/ccDuJreq.o: in function `knapsack(long long, long long)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccDuJreq.o
a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccDuJreq.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccDuJreq.o
/tmp/ccDuJreq.o: in function `main':
a.cc:(.text+0x21c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccDuJreq.o
a.cc:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccDuJreq.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const int MOD = 1e9+7;


#define REP(i, N) for (int i = 0; i < (N); i++)
#define REPP(i, a, b) for (int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((int)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<int>>

using namespace std;

int N,W;
ll dp[1002][MOD];
ll w[1002],v[1002];

void knapsack(ll i, ll wi){
    i++;
    wi++;
    if(wi < w[i]){
        dp[i][wi] = dp[i-1][wi];
    }else{
        dp[i][wi] = max(dp[i-1][wi],dp[i-1][wi-w[i]]+v[i]);
    }
}



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

    
    cin >> N >> W;
    
    for(int i = 0; i < N+2;i++){
        for(int l = 0; l < W+2;l++){
            dp[i][l] = 0;
        }
    }
    for(int i = 1; i < N+1;i++){
        cin >> w[i] >> v[i];
    }

    for(int i = 0; i < N;i++){
        for(int l = 0; l < W;l++){
            knapsack(i,l);
        }
    }

for(int i = 0; i < N+2;i++){
        for(int l = 0; l < W+2;l++){
            cout << dp[i][l] << " ";
        }
        cout << endl;
    }
    




    return 0;
}

Compiler output:
/tmp/cckzq5u4.o: in function `knapsack(long long, long long)':
a.cc:(.text+0x29): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckzq5u4.o
a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckzq5u4.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckzq5u4.o
/tmp/cckzq5u4.o: in function `main':
a.cc:(.text+0x21c): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckzq5u4.o
a.cc:(.text+0x248): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckzq5u4.o
collect2: error: ld returned 1 exit status
Language: C++

#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll d[101][1000000005];
ll w[105];
ll v[105];

int main(){
    ll n,W;
    cin >> n>>W;
    ll l=0;
    rep(i,n){
        cin >> w[i]>>v[i];
        //l=(w[0]+3)*(i+2);
        if(i==0){
            rep(j,w[0]){
                d[0][j]=0;
            }
            reps(j,w[0],W){
                d[0][j]=v[0];
            }
        }else{
            rep(j,W+1){
                if(j-w[i]>=0){
                    d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
                }else{
                    d[i][j]=d[i-1][j];
                }
            }
        }
    }
    /*
    rep(i,n){
        rep(j,W+1){
            cerr<<d[i][j]<<' ';
        }
        cerr<<endl;
    }
    */
    
    cout<<d[n-1][W]<<endl;
    return 0;
}

Compiler output:
/tmp/cckmSxMK.o: in function `main':
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/cckmSxMK.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/cckmSxMK.o
collect2: error: ld returned 1 exit status
Language: C++

#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll d[101][1000000005];
ll w[105];
ll v[105];

int main(){
    ll n,W;
    cin >> n>>W;
    ll l=0;
    rep(i,n){
        cin >> w[i]>>v[i];
        //l=(w[0]+3)*(i+2);
        if(i==0){
            rep(j,w[0]){
                d[0][j]=0;
            }
            reps(j,w[0],W){
                d[0][j]=v[0];
            }
        }else{
            rep(j,W+1){
                if(j-w[i]>=0){
                    d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
                }else{
                    d[i][j]=d[i-1][j];
                }
            }
        }
    }
    rep(i,n){
        rep(j,W+1){
            cerr<<d[i][j]<<' ';
        }
        cerr<<endl;
    }
    
    cout<<d[n-1][W]<<endl;
    return 0;
}

Compiler output:
/tmp/ccIbkYMh.o: in function `main':
a.cc:(.text+0x54): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x80): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0xd0): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x163): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccIbkYMh.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccIbkYMh.o
collect2: error: ld returned 1 exit status
Language: C++

#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll d[101][1000000005];
ll w[105];
ll v[105];

int main(){
    int n,W;
    cin >> n>>W;
    int l=0;
    rep(i,n){
        cin >> w[i]>>v[i];
        //l=(w[0]+3)*(i+2);
        if(i==0){
            rep(j,w[0]){
                d[0][j]=0;
            }
            reps(j,w[0],W){
                d[0][j]=v[0];
            }
        }else{
            rep(j,W+1){
                if(j-w[i]>=0){
                    d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
                }else{
                    d[i][j]=d[i-1][j];
                }
            }
        }
    }
    rep(i,n){
        rep(j,W+1){
            cerr<<d[i][j]<<' ';
        }
        cerr<<endl;
    }
    
    cout<<d[n-1][W]<<endl;
    return 0;
}

Compiler output:
/tmp/ccaiFZBd.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccaiFZBd.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccaiFZBd.o
collect2: error: ld returned 1 exit status
Language: C++

#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

ll d[101][1000000005];
ll w[105];
ll v[105];

int main(){
    int n,W;
    cin >> n>>W;
    int l=0;
    rep(i,n){
        cin >> w[i]>>v[i];
        //l=(w[0]+3)*(i+2);
        if(i==0){
            rep(j,w[0]){
                d[0][j]=0;
            }
            reps(j,w[0],W){
                d[0][j]=v[0];
            }
        }else{
            rep(j,W+1){
                if(j-w[i]>=0){
                    d[i][j]=max(d[i-1][j],d[i-1][j-w[i]]+v[i]);
                }else{
                    d[i][j]=d[i-1][j];
                }
            }
        }
    }
    /*
    rep(i,n){
        rep(j,W){
            cerr<<d[i][j]<<' ';
        }
        cerr<<endl;
    }
    */
    cout<<d[n-1][W]<<endl;
    return 0;
}

Compiler output:
/tmp/ccwnlfiD.o: in function `main':
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x7f): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x12b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x15b): relocation truncated to fit: R_X86_64_PC32 against symbol `w' defined in .bss section in /tmp/ccwnlfiD.o
a.cc:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against symbol `v' defined in .bss section in /tmp/ccwnlfiD.o
collect2: error: ld returned 1 exit status