Problem

Source: China Yingtan ,Dec 16, 2015

Tags: inequalities, Sequences



Let $a_1,a_2,\cdots, a_{31} ;b_1,b_2, \cdots, b_{31}$ be positive integers such that $a_1< a_2<\cdots< a_{31}\leq2015$ , $ b_1< b_2<\cdots<b_{31}\leq2015$ and $a_1+a_2+\cdots+a_{31}=b_1+b_2+\cdots+b_{31}.$ Find the maximum value of $S=|a_1-b_1|+|a_2-b_2|+\cdots+|a_{31}-b_{31}|.$