Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<unordered_map>
#include<map>
#include<set>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)
#define loopj(x,y) for(int j = x;j<(y);j++)

int main()
{
	ios :: sync_with_stdio(false);
	cin.tie(nullptr);
  
	int n, W;
	cin >> n >> W;
	vector<int> w(n);
	vector<int> v(n);
	ll max_val = 0;

	loopi(0, n)
	{
		cin >> w[i] >> v[i];
		max_val += v[i];
	}

	vector<int> dp(max_val + 1, 1000000001);
	dp[0] = 0;
	loopj(0, n)
	{
		rloopi(max_val, v[j])
		{
			dp[i] = min(dp[i - v[j]] + w[j], dp[i]);

		}
	}

	int ans;
	rloopi(max_val, 0)
	{
		if (dp[i] <= W)
		{
			ans = i;
			break;
		}
	}

	cout << ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: 'ios' has not been declared
   19 |         ios :: sync_with_stdio(false);
      |         ^~~
a.cc:20:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   20 |         cin.tie(nullptr);
      |         ^~~
      |         std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:24:9: error: 'vector' was not declared in this scope
   24 |         vector<int> w(n);
      |         ^~~~~~
a.cc:24:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:24:16: error: expected primary-expression before 'int'
   24 |         vector<int> w(n);
      |                ^~~
a.cc:25:16: error: expected primary-expression before 'int'
   25 |         vector<int> v(n);
      |                ^~~
a.cc:26:9: error: 'll' was not declared in this scope
   26 |         ll max_val = 0;
      |         ^~
a.cc:30:24: error: 'w' was not declared in this scope
   30 |                 cin >> w[i] >> v[i];
      |                        ^
a.cc:30:32: error: 'v' was not declared in this scope
   30 |                 cin >> w[i] >> v[i];
      |                                ^
a.cc:31:17: error: 'max_val' was not declared in this scope
   31 |                 max_val += v[i];
      |                 ^~~~~~~
a.cc:34:16: error: expected primary-expression before 'int'
   34 |         vector<int> dp(max_val + 1, 1000000001);
      |                ^~~
a.cc:35:9: error: 'dp' was not declared in this scope
   35 |         dp[0] = 0;
      |         ^~
a.cc:38:24: error: 'max_val' was not declared in this scope
   38 |                 rloopi(max_val, v[j])
      |                        ^~~~~~~
a.cc:13:33: note: in definition of macro 'rloopi'
   13 | #define rloopi(x,y) for(int i = x;i>=(y);i--)
      |                                 ^
a.cc:38:33: error: 'v' was not declared in this scope
   38 |                 rloopi(max_val, v[j])
      |                                 ^
a.cc:13:39: note: in definition of macro 'rloopi'
   13 | #define rloopi(x,y) for(int i = x;i>=(y);i--)
      |                                       ^
a.cc:40:52: error: 'w' was not declared in this scope
   40 |                         dp[i] = min(dp[i - v[j]] + w[j], dp[i]);
      |                                                    ^
a.cc:40:33: error: 'min' was not declared in this scope; did you mean 'std::min'?
   40 |                         dp[i] = min(dp[i - v[j]] + w[j], dp[i]);
      |                                 ^~~
      |                                 std::min
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:46:16: error: 'max_val' was not declared in this scope
   46 |         rloopi(max_val, 0)
      |                ^~~~~~~
a.cc:13:33: note: in definition of macro 'rloopi'
   13 | #define rloopi(x,y) for(int i = x;i>=(y);i--)
      |                                 ^
a.cc:55:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   55 |         cout << ans;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~