Editorial
For a binary string of length , consider the checksum
The strings whose checksum is form a Varshamov--Tenengolts code that corrects one insertion or deletion.
For an original length , choose the smallest satisfying , and set . Reserve positions for check bits and place the bits of into all remaining positions in order.
Let be the checksum contributed by the data bits. Choose the integer with . Since , its binary representation fits exactly in the reserved positions. The completed string has checksum .
For , we have and . For , repeat every bit twice instead. This short repetition code also corrects one insertion. Alice therefore always satisfies the length bound, and for every , giving points.
Bob receives a string of length . For every possible deletion position , compute the checksum after deleting that character and find a position that yields checksum . The single-insertion-correcting property makes the recovered codeword unique. A weighted sum and suffix counts of 1 compute all candidate checksums in total time.
After recovering the codeword, collect the characters at positions that are not powers of two. They form the original string .
Each execution takes time and auxiliary space. The largest integer needed by the checksum calculation is , which fits in a signed 64-bit integer.
Solution written by GPT5