Language: C++

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
//#include "MyMath.h"
//#include "MyDisjointset.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <map>
#include <string.h>
using namespace std;
typedef pair<ll, ll> P; typedef long long int ll;
const int INF = 2000000000;
int main() {
	ll n, W; cin >> n >> W;
	ll *v = new ll[n], *w = new ll[n];
	for (int i = 0; i < n; i++)
		cin >> v[i] >> w[i];
	int h = n / 2;
	P *h1 = new P[1 << h];
	memset(h1, 0, sizeof(h1));
	for (int i = 0; i < (1 << h); i++)
		for (int j = 0; j < h; j++)
			if (i >> j & 1) { h1[i].second += v[j]; h1[i].first += w[j]; }
	sort(h1, h1 + (1 << h));
	int m = 0;
	for (int i = 1; i < (1 << h); i++) 
		if (h1[m].second < h1[i].second) 
			h1[++m] = h1[i];
	m++;
	int hr = n - n / 2;
	P *h2 = new P[1 << hr];
	memset(h2, 0, sizeof(h2));
	for (int i = 0; i < (1 << hr); i++)
		for (int j = 0; j < hr; j++)
			if (i >> j & 1) { h2[i].second += v[h + j]; h2[i].first += w[h + j]; }
	ll res = -1;
	for (int i = 0; i < (1 << hr); i++) {
		ll mw = W - h2[i].first;
		if (mw >= 0) {
			ll t = (lower_bound(h1, h1 + m, P(mw, INF)) - 1)->second;
			res = max(res, h2[i].second + t);
		}
	}
	cout << res << endl;
}

Compiler output:
a.cc:15:14: error: 'll' was not declared in this scope
   15 | typedef pair<ll, ll> P; typedef long long int ll;
      |              ^~
a.cc:15:18: error: 'll' was not declared in this scope
   15 | typedef pair<ll, ll> P; typedef long long int ll;
      |                  ^~
a.cc:15:20: error: template argument 1 is invalid
   15 | typedef pair<ll, ll> P; typedef long long int ll;
      |                    ^
a.cc:15:20: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:27:49: error: request for member 'second' in '*(h1 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   27 |                         if (i >> j & 1) { h1[i].second += v[j]; h1[i].first += w[j]; }
      |                                                 ^~~~~~
a.cc:27:71: error: request for member 'first' in '*(h1 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   27 |                         if (i >> j & 1) { h1[i].second += v[j]; h1[i].first += w[j]; }
      |                                                                       ^~~~~
a.cc:31:27: error: request for member 'second' in '*(h1 + ((sizetype)(((long unsigned int)m) * 4)))', which is of non-class type 'P' {aka 'int'}
   31 |                 if (h1[m].second < h1[i].second)
      |                           ^~~~~~
a.cc:31:42: error: request for member 'second' in '*(h1 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   31 |                 if (h1[m].second < h1[i].second)
      |                                          ^~~~~~
a.cc:39:49: error: request for member 'second' in '*(h2 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   39 |                         if (i >> j & 1) { h2[i].second += v[h + j]; h2[i].first += w[h + j]; }
      |                                                 ^~~~~~
a.cc:39:75: error: request for member 'first' in '*(h2 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   39 |                         if (i >> j & 1) { h2[i].second += v[h + j]; h2[i].first += w[h + j]; }
      |                                                                           ^~~~~
a.cc:42:35: error: request for member 'first' in '*(h2 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   42 |                 ll mw = W - h2[i].first;
      |                                   ^~~~~
a.cc:44:66: error: expression list treated as compound expression in functional cast [-fpermissive]
   44 |                         ll t = (lower_bound(h1, h1 + m, P(mw, INF)) - 1)->second;
      |                                                                  ^
a.cc:44:75: error: request for member 'second' in '*(std::lower_bound<int*, int>(h1, (h1 + ((sizetype)(((long unsigned int)m) * 4))), ((int)((void)0, INF))) + -4)', which is of non-class type 'int'
   44 |                         ll t = (lower_bound(h1, h1 + m, P(mw, INF)) - 1)->second;
      |                                                                           ^~~~~~
a.cc:45:46: error: request for member 'second' in '*(h2 + ((sizetype)(((long unsigned int)i) * 4)))', which is of non-class type 'P' {aka 'int'}
   45 |                         res = max(res, h2[i].second + t);
      |                                              ^~~~~~