[codeforces]round670 D. Three Sequences

NoSuchKey