#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M,Q; cin >> N >> M >> Q; vector A(N),B(N); for(int i=0; i> A.at(i) >> B.at(i); int n2 = 1< S(n2); vector S2(n2); for(int i=0; i= inf) break; } } long long answer = 0; for(int i=0; i0; k=(k-1)&i){ if(S.at(k) > Q) continue; int left = i-k; if(S.at(left) > M) continue; answer = max(answer,S2.at(i)); break; } } cout << answer << endl; }