#include using namespace std; using u32 = unsigned int; u32 A1[1<<10]; u32 A2[1<<19]; u32 sortcnt23[1<<16] = {}; u32 A3[1<<19]; u32 B2[1<<19]; u32 B3[1<<19]; int main() { using namespace std; u32 N,M,K; cin >> N >> M >> K; for(u32 i=0; i> A1[i]; A1[N] = 0; N++; u32 A2p = 0; if(K/2 >= 0) A2[A2p++] = 0; if(K/2 >= 1) for(u32 i=0; i= 2) for(u32 i=0; i= 3) for(u32 i=0; i= 0) B2[B2p++] = 0; if((K+1)/2 >= 1) for(u32 i=0; i= 2) for(u32 i=0; i= 3) for(u32 i=0; i>16]++; for(u32 i=1; i<(1<<16); i++) sortcnt23[i] += sortcnt23[i-1]; for(u32 i=0; i>16]] = A3[i]; for(int i=0; i<1<<19; i++) sortcnt23[i] = 0; for(u32 i=0; i>16]++; for(u32 i=1; i<(1<<16); i++) sortcnt23[i] += sortcnt23[i-1]; for(u32 i=0; i>16]] = B3[i]; u32 ans = 0; u32 q = B2p-1; while(B2[q] > M) q--; for(u32 p=0; p M) q--; if(ans < A2[p] + B2[q]) ans = A2[p] + B2[q]; } cout << ans << '\n'; return 0; } struct ios_do_not_sync{ ios_do_not_sync(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); } } ios_do_not_sync_instance;