#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
using namespace std;
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 1e5 + 100, M = 4096 + 10, len = 21, inf = 1e18;
const ll mod = 1e9 + 7;
ll arr[N], ans = LLONG_MAX, n, a, b;
void calc(ll i, ll gr, ll sum, ll cur){
	if(i == n){
		if(gr >= a) ans = min(ans, sum | cur);
		return;
	}
	if(gr > b) return;
	calc(i + 1, gr, sum + arr[i + 1], cur);
	calc(i + 1, gr + 1,  arr[i + 1], cur | sum);
}
int main(){
  	ios::sync_with_stdio(false);
  	cin.tie(NULL);
  	cin >> n >> a >> b;
  	for(ll i = 1; i <= n; i++){
  		cin >> arr[i];
  	}
  	calc(1, 1, arr[1], 0);
  	cout << ans;
  return 0;
}
 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |