UVA 13154 https://gist.github.com/ss1h2a3tw/d87e3ebf67a08d631c6fd8fcabf2e08f Codeforces 100800G https://gist.github.com/ss1h2a3tw/77230a157243e4f557427d9e90c5fbcf