#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <math.h>
#include <array>
#include <random>
#include <bitset>
#include <climits>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl '\n'
#define mod 1000000007
#define INF 0x3f3f3f3f
#define int long long
#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,sse3,sse4,avx")
#pragma GCC target("popcnt")
template <class x>
using ordered_set = tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;
typedef pair<int, int> ipair;
int main()
{
cin.tie(0)->sync_with_stdio(0);
long long a, b;
cin >> a >> b;
vector<int> p1, p2;
for (int i = 0; i < a; i++)
{
if (i < ((a + 1) / 2))
{
int x;
cin >> x;
p1.push_back(x);
}
else
{
int x;
cin >> x;
p2.push_back(x);
}
}
vector<long long> asd;
for (int i = 0; i < (1 << p2.size()); i++)
{
long long sum = 0;
for (int j = 0; j < p2.size(); j++)
{
if (i & (1 << j))
{
sum += p2[j];
}
}
asd.push_back(sum);
}
sort(asd.begin(), asd.end());
long long ans = 0, sum = 0;
for (int i = 0; i < (1 << p1.size()); i++)
{
long long sum = 0;
for (int j = 0; j < p1.size(); j++)
{
if (i & (1 << j))
sum += p1[j];
}
ans += upper_bound(asd.begin(), asd.end(), (b - sum)) - asd.begin();
}
cout << ans;
}
Compilation message
cc1plus: error: '::main' must return 'int'
bobek.cpp: In function 'int main()':
bobek.cpp:71:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
71 | for (int j = 0; j < p2.size(); j++)
| ~~^~~~~~~~~~~
bobek.cpp:88:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
88 | for (int j = 0; j < p1.size(); j++)
| ~~^~~~~~~~~~~
bobek.cpp:84:24: warning: unused variable 'sum' [-Wunused-variable]
84 | long long ans = 0, sum = 0;
| ^~~