Codeforces Round 1072 (Div. 3) Upsolving (finished)