Solution (source code)

= Solution

At a boundary parallel to lattice links, define each star as the product over links of the retained lattice incident on the vertex,
$$
A_v=\prod_{j\ni v}X_j.
$$
A boundary vertex has three rather than four retained incident links. For a plaquette adjacent to the boundary, retain
$$
B_p=\prod_{j\in\partial p}Z_j,
$$
including its boundary link. A boundary link belongs to only one bulk plaquette, so applying $X$ on that link flips one $B_p$ rather than two. A magnetic string made from $X$ operators can therefore terminate at the boundary and its endpoint can be created or removed by a local boundary operator. This is precisely an $m$-condensing, or magnetic, <electric and magnetic boundaries of the surface code>[boundary]. By contrast, the same local operation does not permit an isolated electric endpoint.