from fractions import Fraction as Q from itertools import permutations def run(load,check): # Each coordinate is a*m+b in K units; i cancels from differences. pts={'S':(1,-12),'F':(1,-10),'R':(0,5),'N':(0,7)};solutions=[];failures=[] orders=[p for p in permutations(pts) if p.index('S')0 if ok:solutions.append({'order':p,'W_K':str(m),'spacing_K':str(vals[0]),'coefficients':[str(pts[k][0]*m+pts[k][1]) for k in p]}) else:failures.append({'order':p,'equations':eq,'status':'inconsistent or nonpositive spacing'}) check('six order domains',len(orders)==6) check('four exact real solutions',sorted(Q(r['W_K']) for r in solutions)==[13,16,18,21]) check('interlace solutions',sorted(Q(r['W_K']) for r in solutions if Q(r['spacing_K'])==1)==[16,18]) check('separated solutions',sorted(Q(r['W_K']) for r in solutions if Q(r['spacing_K'])==2)==[13,21]) check('common annual offset cancels',all(r['S']+12*529==r['i'] for r in load('C287_DATA.json')['rows'])) return {'solutions':sorted(solutions,key=lambda r:Q(r['W_K'])),'failed_orders':failures,'method':'All order types solved exactly overQ; no chosen parameter scan','retained_bridge_matches':[13,16],'diagnostic_only_bridges':[18,21],'new_bridge_adopted':False}