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

int main() {
	int n;
	cin >> n;
	for (long long i = 1;i <= 3500;++i) {
		for (long long q = i;q <= 3500;++q) {
			long long left = 4 * i * q;
			long long right = n * (i*q);
			long long top = 3500;
			long long bot = 0;
			while (top - bot > 1) {
				long long h = (top + bot)/2;
				long long low = left * h;
				long long high = right + n * h * (i + q);
				if (low > high) {
					top = h;
				}
				else if (low == high) {
					cout << i << " " << q << " " << h << endl;
					return 0;
				}
				else {
					bot = h;
				}
			}
			long long h = bot;
			long long low = left * h;
			long long high = right + n * h * (i + q);
            if (low == high) {
				cout << i << " " << q << " " << h << endl;
				return 0;
			}
			 h = top;
			 low = left * h;
			high = right + n * h * (i + q);
			if (low > high) {
				top = h;
			}
			else if (low == high) {
				cout << i << " " << q << " " << h << endl;
				return 0;
			}
			else {
				bot = h;
			}
			//left *= h
			//right += n*h*(q+i)
		}
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> n;
      |         ^~~
a.cc:18:41: error: 'cout' was not declared in this scope
   18 |                                         cout << i << " " << q << " " << h << endl;
      |                                         ^~~~
a.cc:18:78: error: 'endl' was not declared in this scope
   18 |                                         cout << i << " " << q << " " << h << endl;
      |                                                                              ^~~~
a.cc:29:33: error: 'cout' was not declared in this scope
   29 |                                 cout << i << " " << q << " " << h << endl;
      |                                 ^~~~
a.cc:29:70: error: 'endl' was not declared in this scope
   29 |                                 cout << i << " " << q << " " << h << endl;
      |                                                                      ^~~~
a.cc:39:33: error: 'cout' was not declared in this scope
   39 |                                 cout << i << " " << q << " " << h << endl;
      |                                 ^~~~
a.cc:39:70: error: 'endl' was not declared in this scope
   39 |                                 cout << i << " " << q << " " << h << endl;
      |                                                                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline void readInt(int &x) {
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;
}
inline void readLong(ll &x) {
	x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;
}
/*================Header Template==============*/
ll n;
int main() {
	readLong(n);
	for(ll h=1;h<=3500;h++) {
		for(ll w=1;w<=3500;w++) {
			ll tmp=4*h*w-n*h-n*w;
			ll get=n*h*w;
//			cout<<tmp<<endl;
			if(tmp<=0)
				continue;
			if(get%tmp==0) {
				cout<<h<<" "<<get/tmp<<" "<<w<<endl;
				return 0;
			}
		}
	}
} 

叶瑶琦 2017/9/30 20:20:51



Compiler output:
a.cc:35:1: error: '\U000053f6\U00007476\U00007426' does not name a type
   35 | 叶瑶琦 2017/9/30 20:20:51
      | ^~~~~~
Language: C++

#include <bits/stdc++.h>

#define REP(i, a, b)    for(int i = a, _b = b; i < _b; ++i)
#define FOR(i, a, b)    for(int i = a, _b = b; i <= _b; ++i)
#define endl            "\n"
#define puts(_content_) cout << (_content_) << "\n"
#define newline         cout << "\n"

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef Home 
	freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
#endif
	long long N;
	cin >> N;
	long long x, y, z;
	FOR(x, 1, 3500) {
		FOR(y, x, 3500) {
			long long M = (4LL*x*y - N*x - N*y);
			if(M == 0) continue;
			long long z = N*x*y/M;
			if(z > 0 && 4LL*x*y*z == N*x*y + N*y*z + N*x*z) {
				cout << x << " " << y << " " << z << endl;
				return 0;
			}
		}
	}		
	return 0;
}#include <bits/stdc++.h>

#define REP(i, a, b)    for(int i = a, _b = b; i < _b; ++i)
#define FOR(i, a, b)    for(int i = a, _b = b; i <= _b; ++i)
#define endl            "\n"
#define puts(_content_) cout << (_content_) << "\n"
#define newline         cout << "\n"

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef Home 
	freopen("input.txt", "r", stdin);
//   freopen("output.txt", "w", stdout);
#endif
	long long N;
	cin >> N;
	long long x, y, z;
	FOR(x, 1, 3500) {
		FOR(y, x, 3500) {
			long long M = (4LL*x*y - N*x - N*y);
			if(M == 0) continue;
			long long z = N*x*y/M;
			if(z > 0 && 4LL*x*y*z == N*x*y + N*y*z + N*x*z) {
				cout << x << " " << y << " " << z << endl;
				return 0;
			}
		}
	}		
	return 0;
}

Compiler output:
a.cc:33:2: error: stray '#' in program
   33 | }#include <bits/stdc++.h>
      |  ^
a.cc:33:3: error: 'include' does not name a type
   33 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:43:5: error: redefinition of 'int main()'
   43 | int main() {
      |     ^~~~
a.cc:11:5: note: 'int main()' previously defined here
   11 | int main() {
      |     ^~~~
Language: C++

#include<iostream>
using namespace std;

int check(long long int n,long long int x,long long int y){
	int a,b;//分子、分母
	a=4*x-n,b=n*x;
	if(a<=0)return -1;
	a=a*y-b,b*=y;
	if(a<=0)return -1;
	if(b%a==0)return b/a;
	else return -1;
}

int main(){
	long long int n;
	long long int a,b,c;
	long long int i,j,k;
	cin>>n;
	a=max((n/4),1);
	for(i=a;i<=3500;i++){
		for(j=a;j<3500;j++){
			k=check(n,i,j);
			if(k!=-1){
				cout<<i<<" "<<j<<" "<<k<<" "<<endl;
				return 0;
			}
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: no matching function for call to 'max(long long int, int)'
   19 |         a=max((n/4),1);
      |           ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:19:14: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   19 |         a=max((n/4),1);
      |           ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
using namespace std;
long long N;
long long main()
{
    cin>>N;
    for(long long a=1;a<=3500;a++)
    {
        for(long long b=1;b<=3500;b++)
        {
            if((4*a*b-a*N-b*N)>0&&(N*a*b)%(4*a*b-a*N-b*N)==0&&(N*a*b)/(4*a*b-a*N-b*N)>0)
            {
                cout<<a<<" "<<b<<" "<<N*a*b/(4*a*b-a*N-b*N);
                return 0;
            }
        }
    }
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;



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

	long double a;
	cin >> a;
	for (int i = 1; i <= 3500; i++) {
		for (int j = 1; j <= 3500; j++) {
			long double b = i;
			long double c = j;
			long double d = (long double)4 / a - 1 / b - 1 / c;
			if (d < EPS) {
				continue;
			}
			d = (long double)1 / d;
			if (abs(round(d) - d) < EPS) {
				cout << i << " " << j << " " << long long int(d + EPS) << endl;
				return 0;
			}
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:65: error: expected primary-expression before 'long'
   40 |                                 cout << i << " " << j << " " << long long int(d + EPS) << endl;
      |                                                                 ^~~~
Language: C++

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>
#include <bitset>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

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

int main() {

	lint N, K;
	cin >> N >> K;

	vector<lint> A(N), B(N);
	for (int i = 0; i < N; i++) cin >> A[i] >> B[i];

	vector<lint> Kr{ K };
	int now = 0;
	for (int i = 30; i >= 0; i--) {
		if (K >> i & 1) {
			Kr.emplace_back(now + (1 << i) - 1);
			bitset<32> tmp(Kr.back());
			DMP(tmp);
			now += 1 << i;
		}
	}

	lint ans = 0;
	for (const auto& k : Kr) {
		int sum = 0;
		for (int i = 0; i < N; i++) {
			if ((A[i] | k) == k) sum += B[i];
		}
		chmax(ans, sum);
	}

	cout << ans << "\n";

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:22: error: no matching function for call to 'chmax(lint&, int&)'
   61 |                 chmax(ans, sum);
      |                 ~~~~~^~~~~~~~~~
a.cc:34:13: note: candidate: 'template<class T> bool chmax(T&, T)'
   34 | inline bool chmax(T& a, const T b) { return a < b && (a = b, true); }
      |             ^~~~~
a.cc:34:13: note:   template argument deduction/substitution failed:
a.cc:61:22: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   61 |                 chmax(ans, sum);
      |                 ~~~~~^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=5e6+5;
int n,k,tot,head[55],nex[N],to[N],fi[N],se[N];
void add(int u,int x,int y)
{
    if(tot+1>=N) exit(0);
    ++tot;nex[tot]=head[u];head[u]=tot;fi[tot]=x;se[tot]=y;
}
int upbit(int x)
{
    for(int i=30;i>=0;i--)
        if(x>>i&1) return i;
    return -1;
}
long long sum[55];
int main()
{
    //freopen("01.txt","r",stdin);
    scanf("%d%d",&n,&k);
    printf("%lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:21: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |     printf("%lld\n",ans);
      |                     ^~~
      |                     abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k;
int upbit(int x)
{
    for(int i=30;i>=0;i--)
        if(x>>i&1) return i;
    return -1;
}
vector<pair<int,int>>v[55];
long long sum[55];
int main()
{
    //freopen("01.txt","r",stdin);
    scanf("%d%d",&n,&k);
    long long ans=0,res=0;
    int u=upbit(k);
    for(int i=1;i<=n;i++)
    {
        int a,b;scanf("%d%d",&a,&b);
        int k=upbit(a);
        if(k==-1||(a&k)==a) res+=b;
        else v[k].push_back({a,b}),sum[k]+=b;
    }
    for(int i=u;i>=0;i--)
    {
        if(k>>i&1)
        {
            long long s=0;
            for(int j=i-1;j>=0;j--)
                s+=sum[j];
            ans=max(ans,res+s);
            for(int i=0;i<v[i].size();i++)
            {
                x.first^=1<<i;
                int k=upbit(x.first);
                if(k==-1) res+=x.second;
                else v[k].push_back(x),sum[k]+=x.second;
            }
        }
        v[i].clear();
    }
    ans=max(ans,res);
    printf("%lld\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'x' was not declared in this scope
   35 |                 x.first^=1<<i;
      |                 ^
Language: C++

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

#define rep(i,n) for(ll i=0;i<n;i++)
using ll=long long;
using vl=vector<ll>;

int main(){
    ll n,k;cin >> n >>k;
    vl a(n),b(n);
    rep(i,n)cin >> a[i] >> b[i];
    ll res=0;
    rep(i,30){
        if((1LL<<i)&k){
            ll t=(1LL<<i);
            //ll p=((k-t)|(t-1));
          	p=0;
            ll sum=0;
            rep(j,n){
                if(p==(p|a[j]))sum+=b[j];
            }
            res=max(res,sum);
        }
    }
    ll tot=0;
    rep(j,n){
        if(k==(k|a[j]))tot+=b[j];
    }
    cout << max(res,tot) <<endl;
}   


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

#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, K;
	in >> N >> K;
	std::vector<LL>A(N), B(N);
	rep(i, N) in >> A[i] >> B[i];

	LL ans = 0;
	for (LL i = 30; i >= 0; --i)
	{
		if (K&(1LL << i)) //もしもKのibit目が1だったら
		{
            //max は ibit目より下が1で埋まっている
			LL max = (K ^ (1LL << i)) | ((1LL << i) - 1), res = 0;
			rep(j, N)//各A[j]について
			{
				bool flag = true;
				rep(k, 31)// k=0 ~ 30について
				{
                    // kbit目についてもしもA[j]が1なのに maxが0だったらだめ
					if ((A[j] & (1LL << k)) && !(max&(1LL << k)))
					{
						flag = false;
						break;
					}
				}
				if (flag) res += B[j];
			}
			ans = std::max(ans, res);
		}
	}
	LL res = 0;
	rep(i, N)　//各A[i]について
	{
        //これは常にKのビットと比較する
		bool flag = true;
		rep(j, 31)//j=0~30 jビット目について考える 
		{
            //もしもA[i]のjビット目が1 かつ Kのjビット目が立っていなかったらだめ ORを取るから
			if ((A[i] & (1LL << j)) && !(K&(1LL << j)))
			{
				flag = false;
				break;
			}
		}
        //A[i]の各ビットは全てKに含まれる
		if (flag) res += B[i];
	}
	ans = std::max(ans, res);

	out << ans << std::endl;
}


Compiler output:
a.cc:39:18: error: extended character 　 is not valid in an identifier
   39 |         rep(i, N)　//各A[i]について
      |                  ^
a.cc: In function 'int main()':
a.cc:39:18: error: '\U00003000' was not declared in this scope
   39 |         rep(i, N)　//各A[i]について
      |                  ^~
Language: C++

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

vector<int> f(int n) {
  vector<int> res(30);
  for (int i = 0; i < n; i++) {
    res[i] = (n >> i) & 1;
  }
  return res;
}

int main() {
  int n, k; cin >> n >> k;
  auto K = f(k);
  vector<ll> sum(30);
  ll res = 0;
  for (int i = 0; i < n; i++) {
    int x, y; cin >> x >> y; auto X = f(x);
    if (x <= (k | x)) res += y;
    bool l = false;
    if (int i = 29; i >= 0; i--) {
      if (!l && !K[i] && X[i]) break;
      if ((l || K[i]) && !X[i]) {
        l = true;
        sum[i] += y;
      }
    }
  }
  cout << max(res, *max_element(sum.begin(), sum.end())) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:27: error: expected ')' before ';' token
   22 |     if (int i = 29; i >= 0; i--) {
      |        ~                  ^
      |                           )
a.cc:22:32: error: expected ';' before ')' token
   22 |     if (int i = 29; i >= 0; i--) {
      |                                ^
      |                                ;
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int long long

// AND OR XORは各bitでみよ
//kが決まればO(n)
//最大、最小の探索において無駄な探索は不要

void solve() {
	int n, k; cin >> n >> k;
    vector<int> a(n), b(n);
    rep(i, n) {
        cin >> a[i] >> b[i];
    }
    int ans = 0;
    rep(j, n) {
        if(k | a[j] == k) ans += b[j];
    }
    for(int i = 32, i >= 0; i--) {
        if(k & (1<<i)) {
            int mask = k - (1<<i);
            rep(j, i) mask &= (1<<j);

            int res = 0;
            rep(j, n) {
                if(mask | a[j] == mask) res += b[j];
            }
            ans = max(ans, res);
        }
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:68:22: error: expected ';' before '>=' token
   68 |     for(int i = 32, i >= 0; i--) {
      |                      ^~~
      |                      ;
a.cc:68:23: error: expected primary-expression before '>=' token
   68 |     for(int i = 32, i >= 0; i--) {
      |                       ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<b;i++)
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> a(n),b(n);
  rep(i,0,n){
    cin>>a[i]>>b[i];
  }
  vector<ll> ks(1);
  ks[0]=k;
  bool f=0;
  rep(i,0,n){
    if(k&(1<<i)){
      if(f){
      	ks.push_back(k^(1<<i)|((1<<i)-1));
      }
    }
    else f=1;
  }
  ll ans=0;
  rep(j,0,ks.size()){
    rep(i,0,n){
      ll cnt = 0;
      if((a[i]|ks[j])==ks[j]) {
        cnt+=b[i];
      }
    }
    if(ans<cnt)ans=cnt;
  }
  cout<<ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: 'cnt' was not declared in this scope; did you mean 'int'?
   31 |     if(ans<cnt)ans=cnt;
      |            ^~~
      |            int
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
set<ll> join(set<ll> a,set<ll> b){
  if(a.size()>b.size())swap(a,b);
  set<ll> ret;
  for(auto itr=a.begin();itr!=a.end();itr++){
    ll now=*itr;
    auto x=lower_bound(b.begin(),b.end(),now);
    auto y=upper_bound(b.begin(),b.end(),now);
    if(*x!=*y)ret.insert(now);
  }
  return ret;
}
int main(){
  ll n,k;cin>>n>>k;
  set<ll> st[30];
  ll a[n],b[n];
  for(ll i=0;i<n;i++){
    cin>>a[i]>>b[i];
    ll m=a[i];
    for(ll j=0;j<30;j++){
      ll t=m%2;
      if(t==0)st[j].insert(i);
      m/=2;
    }
  }
  ll d;
  for(ll i=0;;i++){
    if(pow(2,i)>n){
      d=i;
      break;
    }
  }
  ll ans=0;
  map<ll.ll> mp;
  queue<ll> q;
  q.push((1<<d)-1);
  mp[(1<<d)-1]++;
  while(q.size()>0){
    ll now=q.front();q.pop();
    if(now<=k){
      set<ll> r;
      for(ll i=0;i<30;i++)r.insert(i);
      for(ll i=0;i<30;i++){
        ll y=now%2;
        if(y==0){
          r=join(st[i],r);
        }
        y/=2;
      }
      ll sum=0;
      for(auto itr=r.begin();itr!=r.end();itr++){
        ll u=*itr;
        sum+=b[u];
      }
      ans=max(ans,sum);
    }
    else{
      for(ll i=0;i<30;i++){
        if((now>>i)%2==1){
          ll e=1<<i;
          e=~e;
          ll w=e&now;
          if(mp[w]>0)continue;
          mp[w]++;
          q.push(w);
        }
      }
    }
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:12: error: wrong number of template arguments (1, should be at least 2)
   36 |   map<ll.ll> mp;
      |            ^
In file included from /usr/include/c++/14/map:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: provided for 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
  102 |     class map
      |           ^~~
a.cc:39:5: error: invalid types 'int[int]' for array subscript
   39 |   mp[(1<<d)-1]++;
      |     ^
a.cc:65:16: error: invalid types 'int[ll {aka long long int}]' for array subscript
   65 |           if(mp[w]>0)continue;
      |                ^
a.cc:66:13: error: invalid types 'int[ll {aka long long int}]' for array subscript
   66 |           mp[w]++;
      |             ^
Language: C++

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fo(i,l,r) for(int i=l;i<=r;i++)
#define of(i,l,r) for(int i=l;i>=r;i--)
#define fe(i,u) for(int i=head[u];i;i=e[i].next)
using namespace std;
typedef long long ll;
inline void open(const char *s)
{
	#ifndef ONLINE_JUDGE
	char str[20];
	sprintf(str,"in%s.txt",s);
	freopen(str,"r",stdin);
//	sprintf(str,"out%s.txt",s);
//	freopen(str,"w",stdout);
	#endif
}
inline int rd()
{
	static int x,f;
	x=0;f=1;
	char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return f>0?x:-x;
}
const int N=100010;
int n,K,a[N],b[N],bin[31];

int main()
{
	bin[0]=1;fo(i,1,30)bin[i]=bin[i-1]<<1;
	n=rd();K=rd();
	fo(i,1,n)a[i]=rd(),b[i]=rd();
	ll ans=0;
	fo(i,1,30){
		if(bin[i]&K==0)continue;
		int hh=(K^bin[i])|(bin[i]-1);
		ll res=0;
		fo(i,1,n)if(hh|a[i]==hh)res=res+(ll)b[i];
		ans=max(ans,res);
	}
	printf("%lld\n",res);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:25: error: 'res' was not declared in this scope
   45 |         printf("%lld\n",res);
      |                         ^~~
Language: C++

#include <Iostream>

using namespace std;
long long ans,sum,a[100010],b[100010],n,k,l;
int main(){
	int i,j;
	cin >> n >> k;
	for(i=0;i<n;i++){
		cin >> a[i] >> b[i];
		if((k | a[i]) == k){
			ans += b[i];
		}
	}
	for(j=0;j<=30;j++){
		if(k & (1<<j)){
			l = (k - (1<<j))|((1<<j)-1);
			sum = 0;
			for(i=0;i<n;i++){
				if((l | a[i]) == l){
					sum += b[i];
				}
			}
			ans = max(ans,sum);
		}
	}
	cout << ans << endl;
}

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

#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
typedef long long lint;
typedef vector<int>vi;
typedef pair<int,int>pii;
#define rep(i,n)for(int i=0;i<(int)(n);++i)

int main(){
  int n;
  lint k;
  cin>>n>>k;
  vector<lint>a(n),b(n);
  rep(i,n){
    cin>>a[i]>>b[i];
  }
  lint m=0;
  while(1){
    lint sum=0;
    rep(i,n)
      if((a[i]&k)==a[i])sum+=b[i];
    m=max(m,sum);
    if(k==0)break;
    k+=1;
    k&=k-1;
    k=max(k-1,0LL);
  }
  cout<<m<<endl;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include<algorithm>
^
Main.java:2: error: illegal character: '#'
#include<iostream>
^
Main.java:3: error: illegal character: '#'
#include<vector>
^
Main.java:5: error: class, interface, enum, or record expected
typedef long long lint;
^
Main.java:6: error: class, interface, enum, or record expected
typedef vector<int>vi;
^
Main.java:7: error: class, interface, enum, or record expected
typedef pair<int,int>pii;
^
Main.java:8: error: illegal character: '#'
#define rep(i,n)for(int i=0;i<(int)(n);++i)
^
Main.java:8: error: class, interface, enum, or record expected
#define rep(i,n)for(int i=0;i<(int)(n);++i)
        ^
Main.java:8: error: class, interface, enum, or record expected
#define rep(i,n)for(int i=0;i<(int)(n);++i)
                            ^
Main.java:8: error: class, interface, enum, or record expected
#define rep(i,n)for(int i=0;i<(int)(n);++i)
                                       ^
Main.java:12: error: unnamed classes are a preview feature and are disabled by default.
  lint k;
  ^
  (use --enable-preview to enable unnamed classes)
Main.java:13: error: class, interface, enum, or record expected
  cin>>n>>k;
  ^
Main.java:14: error: <identifier> expected
  vector<lint>a(n),b(n);
                 ^
Main.java:14: error: ';' expected
  vector<lint>a(n),b(n);
                  ^
Main.java:15: error: class, interface, enum, or record expected
  rep(i,n){
  ^
Main.java:17: error: class, interface, enum, or record expected
  }
  ^
Main.java:19: error: class, interface, enum, or record expected
  while(1){
  ^
Main.java:21: error: class, interface, enum, or record expected
    rep(i,n)
    ^
Main.java:23: error: class, interface, enum, or record expected
    m=max(m,sum);
    ^
Main.java:24: error: class, interface, enum, or record expected
    if(k==0)break;
    ^
Main.java:25: error: class, interface, enum, or record expected
    k+=1;
    ^
Main.java:26: error: class, interface, enum, or record expected
    k&=k-1;
    ^
Main.java:27: error: class, interface, enum, or record expected
    k=max(k-1,0LL);
    ^
Main.java:28: error: class, interface, enum, or record expected
  }
  ^
Main.java:30: error: class, interface, enum, or record expected
}
^
25 errors
Language: C++

#include <map>
#include <algorithm>
#include <cassert>
#include <climits>
#include <complex>
#include <cstdio>
#include <string>
#include <iostream>
#include <queue>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;

template<class T> bool chmin(T &a, T b) { return a>b?(a=b,true):false; }
template<class T> bool chmax(T &a, T b) { return a<b?(a=b,true):false; }
#define FOR(i,x,y) for(int i=(x);i<(int)(y);i++)
#define REP(i,y) for(int i=0;i<(int)(y);i++)
#define REPP(i,y) for(int i=1;i<=(int)(y);i++)
#define REPB(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define bs2int(bs) (int)((bs).to_ulong())

template<class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto it = v.begin(); it != v.end(); ++it) {
    if (it != v.begin()) os << " ";
    os << *it;
  }
  return os;
}

int n,k;
int a[100100], b[100100];

int main() {
  cin>>n>>k;
  vector<int> v;
  int leftmost_zero = -1;
  int i=0;
  while ((k>>i) > 0) {
    if(bit(k,i)==0) {
      leftmost_zero = i;
    }
    i++;
  }
  v.push_back(k);
  if (leftmost_zero != -1) {
    for(int i=leftmost_zero+1; (k>>i)>0; i++) {
      bitset<32> bs(k);
      REP(j,i) {
        bs.set(j);
      }
      bs.reset(i);
      v.push_back(bs2int(bs));
    }
  }
  REP(i,n) {
    cin>>a[i]>>b[i];
  }
  ll mxans = 0;
  for (int k : v) {
    ll ans = 0;
    REP(i,n) {
      if (k==(k | a[i])) ans+=b[i];
    }
    chmax(mxans, ans);
  }
  cout << mxans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:7: error: 'bitset' was not declared in this scope
   54 |       bitset<32> bs(k);
      |       ^~~~~~
a.cc:10:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    9 | #include <queue>
  +++ |+#include <bitset>
   10 | #include <string>
a.cc:54:18: error: 'bs' was not declared in this scope; did you mean 'b'?
   54 |       bitset<32> bs(k);
      |                  ^~
      |                  b
Language: C++

x(res, tmp_sum);
        tmp_sum = 0;
    }
    for(int ii=0;ii<N;ii++){
        if(CAN[0] == A[ii]){
            tmp_sum += B[ii];
        }
    }
    res = max(tmp_sum, res);
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc:1:2: error: expected constructor, destructor, or type conversion before '(' token
    1 | x(res, tmp_sum);
      |  ^
a.cc:2:9: error: 'tmp_sum' does not name a type
    2 |         tmp_sum = 0;
      |         ^~~~~~~
a.cc:3:5: error: expected declaration before '}' token
    3 |     }
      |     ^
a.cc:4:5: error: expected unqualified-id before 'for'
    4 |     for(int ii=0;ii<N;ii++){
      |     ^~~
a.cc:4:18: error: 'ii' does not name a type
    4 |     for(int ii=0;ii<N;ii++){
      |                  ^~
a.cc:4:23: error: 'ii' does not name a type
    4 |     for(int ii=0;ii<N;ii++){
      |                       ^~
a.cc:9:5: error: 'res' does not name a type
    9 |     res = max(tmp_sum, res);
      |     ^~~
a.cc:10:5: error: 'cout' does not name a type
   10 |     cout << res << endl;
      |     ^~~~
a.cc:11:5: error: expected unqualified-id before 'return'
   11 |     return 0;
      |     ^~~~~~
a.cc:12:1: error: expected declaration before '}' token
   12 | }
      | ^
Language: C++

 
#define prob CandyAddict
#ifdef  DEBUG
#define MAXN 100300
#else
#define endl '\n'
#define MAXN 100300
#endif

#include <bits/stdc++.h>

using namespace std;
#define rep(i, l, r) for (int i = l; i<r;i++)
#define vi vector<int>
#define all(v) v.begin(),v.end()
#define pb(c) push_back(c)
#define vii vector<pair<int,int>>
#define vvi vector<vector<int>>
#define ii pair<int,int>
#define mp(i, j) make_pair(i,j)
#define ull unsigned long long int
#define ll  long long int
 #define PI  3.141592653589793238
#define MOD (1000000007)
#define INF (1100000000)
#define EPS 0.00000001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#ifdef DEBUG
    freopen("input", "r", stdin);//use flush(cout)
#endif
    ll n, k;
    cin >> n >> k;
    ll ans = 0;
    ll a[n], b[n];
    rep (i, 0, n) {
        cin >> a[i] >> b[i];
    }
    int lastBit = -1;
    rep (i,0,32)
        if (k&(1<<i)) lastBit = i;

    int dp[n] = {0};
    for (int hole = -1; hole <= lastBit; hole++) {
        if (hole!=-1 && !(k&(1<<hole))) {
            continue;
        }
        ll res = 0;
        int orr =0;
        rep (i, 0, n) {

            bitset<32> mask;
            mask.set();
            mask = mask << (hole + 1);
            ull at = a[i] & mask.to_ulong();
            ull kt = k & mask.to_ulong();

            if (((a[i] & (1 << hole) )== 0) && (at | kt) == kt) {

                res += b[i];
                orr |= a[i];
            }


        }
        if(orr>k)
        cout<<orr<<" "<<k<<endl;
        ans = max(ans, res);



    }

    cout<<ans;
    return 0;
}

Compiler output:
a.cc:6:14: error: expected unqualified-id before '\xa'
    6 | #define endl '\n'
      |              ^~~~
a.cc:6:14: error: expected unqualified-id before '\xa'
    6 | #define endl '\n'
      |              ^~~~
a.cc:6:14: error: expected unqualified-id before '\xa'
    6 | #define endl '\n'
      |              ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, ll> P;
ll d[33];

ll solve(int index, P* a, int K, int N){
  ll su = 0;
  for(int i = 0; i < N; i++){
    if(a[i].first < d[index] && a[i].first <= K){
      su += a[i].second;
    }
    else if(a[i].first <= K){
      a[i].first -= d[index];
    }
  }

  if(index == 0)  return 0;
  else if(K - d[index] < 0) return solve(index-1, a, K, N)
  else return max(su, solve(index-1, a, K-d[index], N));
}

int main(){
  int N, K;
  P a[100100];
  cin >> N >> K;
  for(int i = 0; i < N; i++){
    cin >> a[i].first >> a[i].second;
  }
  ll x = 1;
  d[0] = 0;
  for(int i = 1; i <= 32; i++){
    d[i] = x;
    x *= 2;
  }

  int index = 0;
  for(index = 0; index <= 31; index++){
    if (K >= d[index] && K < d[index+1])  break;
  }
  cout << index << endl;
  cout << solve(index, a, K, N) << endl;

  return 0;
}


Compiler output:
a.cc: In function 'll solve(int, P*, int, int)':
a.cc:24:59: error: expected ';' before 'else'
   24 |   else if(K - d[index] < 0) return solve(index-1, a, K, N)
      |                                                           ^
      |                                                           ;
   25 |   else return max(su, solve(index-1, a, K-d[index], N));
      |   ~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

int n, k;
int a[100004], b[100004];

int dp[(1<<30)+3];
int m;

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);

	cin>>n>>k;
	rep(i, n)cin>>a[i]>>b[i];

	rep(i, k+1) {
		rep(j, n) {
			if((i&a[j]) == a[j])dp[i] += b[j];
		}
	}

	rep(i, k+1)m = dp[i]>m ? dp[i] : m;

	cout<<m<<endl;

	return 0;
}


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

#include <iostream>

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int n, k;
int a[limit], b[limit];

int dp[(1<<30)+3];
int m;

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);

	cin>>n>>k;
	rep(i, n)cin>>a[i]>>b[i];

	rep(i, k+1) {
		rep(j, n) {
			if((i&a[j]) == a[j])dp[i] += b[j];
		}
	}

	rep(i, k+1)m = dp[i]>m ? dp[i] : m;

	cout<<m<<endl;

	return 0;
}


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

#include <stdio.h>
#include <bitset>

#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define STR(i,str) for(int i=0;(str)[i];i++)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX3(a,b,c) ((a)>(b)?(a)>(c)?(a):(c):(b)>(c)?(b):(c))
#define MIN3(a,b,c) ((a)<(b)?(a)<(c)?(a):(c):(b)<(c)?(b):(c))
#define RNG(a,b) ((a)>(b)?(a)-(b):(b)-(a))
#define RNG3(a,b,c) ((a)>(b)?(b)>(c)?(a)-(c):(c)>(a)?(c)-(b):(a)-(b):(b)>(c)?(c)>(a)?(b)-(a):(b)-(c):(c)-(a))
#define MAXS(a,b) {if((a)<(b))(a)=(b);}
#define MINS(a,b) {if((a)>(b))(a)=(b);}

int n, k;
int a[120000], b[120000];
int table[40];


int main(){
	scanf("%d%d", &n, &k);
	REP(i, n) scanf("%d%d", a + i, b + i);
	
	int ans = 0;
	
	int hoge = 1;
	for(int i = 0; hoge <= k; i++){
		for(int j = 0; j < n; j++){
			if((a[j] - hoge) >> (i + 1) << (i + 1) == a[j] - hoge) table[i] += b[j];
		}
		hoge *= 2;
	}
	hoge /= 2;
	hoge--;
	
	for(int i = hoge; i < k; i += 2){
		int sum = 0;
		sum += table[i];
		MAXS(ans, sum);
	}
	
	{
		int sum = 0;
		sum += table[i];
		MAXS(ans, sum);
	}
	
	printf("%d\n", ans);
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:30: error: 'i' was not declared in this scope
   47 |                 sum += table[i];
      |                              ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int n, k;
int a[limit], b[limit];

int dp[(1<<30)+3];
int m;

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);

	cin>>n>>k;
	rep(i, n)cin>>a[i]>>b[i];

	rep(i, k+1) {
		rep(j, n) {
			if((i&a[j]) == a[j])dp[i] += b[j];
		}
	}

	rep(i, k+1)m = max(m, dp[i]);

	cout<<m<<endl;

	return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int n, k;
int a[limit], b[limit];

int dp[(1<<30)+3];
int m;

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);

	cin>>n>>k;
	rep(i, n)cin>>a[i]>>b[i];

	rep(i, k+1) {
		rep(j, n) {
			if((i&a[j]) == a[j])dp[i] += b[j];
		}
	}

	rep(i, k+1)m = max(m, dp[i]);

	cout<<m<<endl;

	return 0;
}


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

#include <bits/stdc++.h>
#define sqr(x) ((x)*(x))

using namespace std;
const double eps = 1e-9;
const int INF = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
typedef long long ll;
const ll MOD = (ll)1e9 + 7;
const int MAXN =(int)1e6;

int main() {
    int n, k;
    cin >> n >> k;
    vector <ll> a(n), b(n);
    vector <int> good;
    ll sum = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        if (a[i] <= k) {
            sum += b[i];
            good[i] = 1;
        }
    }

    ll ans = 0;
    for (ll i = 30; (1 << i) >= 0; --i) {
        int cur = (bool)((1 << i) & k);
        if (cur == 0) {
            for (int j = 0; j < n; ++j) {
                if (good[j] && ((a[j] >> i) & 1)) {
                    good[j] = 0;
                    sum -= b[j];
                }
            }
        } else {
            ll cur_bad = 0;
            for (int j = 0; j < n; ++j) {
                if (good.count(a[j]) && ((a[j] >> i) & 1)) {
                    cur_bad += b[j];
                }
            }
            ans = max(ans, sum - cur_bad);
        }
    }
    ans = max(ans, sum);
    cout << ans;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:26: error: 'class std::vector<int>' has no member named 'count'
   39 |                 if (good.count(a[j]) && ((a[j] >> i) & 1)) {
      |                          ^~~~~
Language: C++

/*#include<bits/stdc++.h>
using namespace std;
double long n;
int main()
{
    cin>>n;
    if(n>4)
    {
        n=n/4;
        n=n*3;
        cout<<n<<" "<<n<<" "<<n;
    }
    else
    {
        if(n==1)
        {
            cout<<-1;
        }
        else if(n==2)
        {
            cout<<"1 2 2";
        }
        else if(n==3)
        {
            cout<<"1 1 1";
        }
        else if(n==4)
        {
            cout<<1/3<<" "<<1/3<<" "<<1/3;
        }
    }
}

*/
#include<bits/stdc++.h>
using namespace std;
int n;
long long k;
int a[100009],b[100009];
int dp[10009][1000];
int ssss(int i,int sum)
{
    if(sum>k)return -100000000;
    if(i==n)return 0;
    if(dp[i][sum]!=-1)return dp[i][sum];
    int d=0;
    d=b[i]+ssss(i+1,sum|a[i]);
    d=max(d,ssss(i+1,sum));
    return dp[i][sum]=d;
}
int main()
{
    memset(dp,-1,sizeof(dp));
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    cout<<ssss(0,0);
}
*/


Compiler output:
a.cc:59:2: error: expected unqualified-id before '/' token
   59 | */
      |  ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int n, k;
int a[limit], b[limit];

int dp[(1<<30)+3];
int m;

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);

	cin>>n>>k;
	rep(i, n)cin>>a[i]>>b[i];

	rep(i, k+1) {
		rep(j, n) {
			if((i&a[j]) == a[j])dp[i] += b[j];
		}
	}

	rep(i, k+1)m = max(m, dp[i]);

	cout<<m<<endl;

	return 0;
}


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

#include <bits/stdc++.h>

using namespace std;

#define int long long

using ll = long long;
using pii =  pair<int, int>;

const int IINF =  0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = sizeof(int) == sizeof(long long) ? LINF : IINF;
const ll MOD = 1e9+7;

#define for_(i,a,b) for(int i = (a);i < (b);i++)
#define rfor_(i,a,b) for(int i = (b)-1;i >= (a);i--)

#define rep(i,n) for_(i,0,n)
#define rrep(i,n) rfor_(i,0,n)

#define pb push_back
//#define eb emplace_back
#define mp make_pair
#define ft first
#define sd second

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define rev(a) reverse(all(a))

#define endl '\n'

const int limit = 100007;

int N, K;
int A[limit], B[limit];

int dp[(1<<30)+3];
int m;

int mx(int k) {
	if(dp[k])return k;
	return mx(k);
}

signed main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(false);

	cin>>N>>K;
	rep(i, N)cin>>A[i]>>B[i];

	rep(i, K+1) {
		rep(j, N) {
			if((i&A[j]) == A[j])dp[i] += B[j];
		}
	}

	rep(i, K+1)m = max(m, dp[i]);

	cout<<m<<endl;

	return 0;
}


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

#include<bits/stdc++.h>
#define LL long long 
const int N=1e5+9;
using namespace std;
LL a[N],b[N],n,k,ans;
int pos[50],app[N],tot;
bool pd(int who,int difang)
{
	int flag=1;
	for(int i=30;i>=pos[difang];--i)
	   if(app[i]==0&&(a[who]&(1LL<<i)))
	      flag=0; 
	
	if(difang==tot)
	{
	 for(int i=pos[difang]-1;i>=0;--i)
	 if((a[who]&(1LL<<i)))
	  flag=0;
	 return flag;
    }
//if(difang==1&&who==3)
//{
//   system("pause");	
//}	
	for(int i=pos[difang]-1;i>=pos[difang+1];--i)
	 if((a[who]&(1LL<<i)))
	  flag=0;
	
	return flag;
	
}
int main()
{
//	freopen("data.in 

","r",stdin);
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;++i) scanf("%lld%lld",&a[i],&b[i]);
	
	for(int i=30;i>=0;--i)
	 if((1LL<<i)&k) pos[++tot]=i;

//for(int i=1;i<=tot;++i)
// printf("pos[%d]:%d\n",i,pos[i]);	
  
	for(int i=0;i<=tot;++i)
	{
	   if(i) app[pos[i]]=1;
	   LL now=0;
	   for(int j=1;j<=n;++j)
	   {
	   	 if(i)
		  {
		   if(pd(j,i)) 
            now=now+b[j];
	      }
		 else 
		  {
		     int flag=1;
				 for(int p=30;p>=pos[1];--p)
		       if((a[j]&(1ll<<p)))
		        flag=0;
			   if(flag) now=now+b[j];	
		  } 
	   }
	   ans=max(ans,now);
	}
	
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc:36:5: warning: missing terminating " character
   36 | ","r",stdin);
      |     ^
a.cc:36:5: error: missing terminating " character
   36 | ","r",stdin);
      |     ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:36:1: error: unable to find string literal operator 'operator""r' with 'const char [2]', 'long unsigned int' arguments
   36 | ","r",stdin);
      | ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pq_small priority_queue<int,vector<int>,greater<int> >
/**==Info==
*Program:
*Problem:
*Date:
*Algorithm:
*Stats:*/
ll n,k;
ll a[100005],b[100005];
bool used[100005];
ll ans;

inline void bt(ll v,ll p,int lastpointer){ //v-the or xxx p-value xxx
	for(int i=lastpointer;i<=n;i++){
		if(used[i]) continue;
		if((v|a[i])>k) continue;
		
		used[i]=true;
		ll pv=v|a[i],pp=p+b[i];
		ans=max(ans,pp);
		
		bt(pv,pp,i+1);
		
		used[i]=false;
	}
}

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		scnaf("%d%d",&a[i],&b[i]);
	}
	
	bt(0,0,0);
	cout<<ans;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:17: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
   56 |                 scnaf("%d%d",&a[i],&b[i]);
      |                 ^~~~~
      |                 scanf