#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,n,c) for (int i=0;i using vec = vector; template using vvec = vec>; template using vvvec = vec>; using ll = long long; using pii = pair; using pll = pair; template bool chmin(T &a, T b){ if (a>b){ a = b; return true; } return false; } template bool chmax(T &a, T b){ if (a T sum(vec x){ T res=0; for (auto e:x){ res += e; } return res; } template void printv(vec x){ for (auto e:x){ cout<>= 1; } return res; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int N,M; cin>>N>>M; vec V(N); for (auto &v:V){ cin>>v; } vec bit(1<>S; t = 0; for (int j=0;j dp(1<>j) & 1){ score = calc(i-t,t); chmax(dp[i],dp[i-t]+score*score); } } } cout<