#include #define int ll using namespace std; #define rep(i,n) for(int i=0;i=0;i--) #define rng(i,c,n) for(int i=c;i #define _4ab8goq ios::sync_with_stdio(0),cin.tie(0); typedef long long ll; typedef vector vi; typedef pair pii; void print(){cout<<'\n';} template void print(const h&v,const t&...u){cout<>cnt[i]; } int ans=0; do{ int now=0; rep(i,n){ now+=cnt[ord[i]]; ans=max(ans,now); if(i+1