codeforces 1249D1/D2 Too Many Segments

NoSuchKey