codeforces; solve "Below the Diagonal" from Round #163 (Div. 2)