#include using namespace std; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a>n; vector ys(n); for(Int i=0;i>ys[i],ys[i]+=10000; const Int MAX = 4.1e4; const Int INF = 1e9; vector dp(MAX,0); for(Int y:ys){ vector nx(MAX,INF); Int res=INF; for(Int i=0;i