codeforces round#522 E - The Unbearable Lightness of Weights

NoSuchKey