#include using namespace std; #define ALL(x) x.begin(),x.end() #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b>n>>x>>y>>z; vector a(n); rep(i,n){ cin>>a[i]; a[i]++; a[i]=(a[i]+999)/1000; } // 1,5,10 // 10で払えるだけ払う,10が余ればmod10の降順で払う // 5でも繰り返す // debug(a); rep(i,n){ ll ne=a[i]/10; ll pay=min(ne,z); a[i]-=10*pay; z-=pay; } if(z){ sort(ALL(a),[](ll lhs,ll rhs){ return lhs%10>rhs%10; }); for(int i=0;irhs%5; }); for(int i=0;i