ll@n,@x,@y,d[y+1][x+1]{},z=0; rep(n){ ll@a,@b,@c; rrep(v,b,y+1){ rrep(u,a,x+1){ z>?=d[v][u]>?=c+d[v-b][u-a]; } } } wt(z);