from hashlib import sha256
from itertools import combinations,product
from pathlib import Path
raw=Path('cap236.txt').read_bytes(); assert sha256(raw).hexdigest()=='1d6a5c73bd44d4cd99e40cf97644dd4a0c37f1bd39e3f6edfc47fd9756240efe'
C=set(raw.decode().splitlines()); D=set('0001101 0001110 0002101 0002110 0010011 0010110 0011001 0020011 0020110 0021001 0100011 0100101 0101010 0112222 0120100 0200011 0200101 0201010 0220100 0221000'.split()); A=set('0000001 0000010 0000100 2112222'.split()); assert D<=C and len(D)==20 and not A&C
third=lambda x,y: ''.join(str((-int(a)-int(b))%3) for a,b in zip(x,y))
blocked={third(x,y) for x,y in combinations(C-D,2)}
U={''.join(v) for v in product('012',repeat=7)}-C-blocked
assert U==A
W=(C-D)|A; assert len(W)==220 and all(third(x,y) not in W for x,y in combinations(W,2)); print('20 deletions, exactly four unlocked, all four jointly insertable')
