#include using namespace std; int main(){ auto compare=[](vector a,vector b){ if(a[0]!=b[0]){ return a[0]>b[0]; }else{ return a[1]>b[1]; } }; int N; scanf("%d",&N); int A[N],B[N]; for(int i=0;i,vector>,decltype(compare)>q {compare}; int cand=0; for(int j=0;j){A[j],0}); } for(int j=0;j temp=q.top(); q.pop(); temp[0]+=B[(i+j)%N]/2; ++temp[1]; if(candcand){ ans=cand; } } printf("%d\n",ans); }