def run(load,read,check): old=load('C287_DATA.json')['rows'];cum=load('C365_DATA.json')['cumulative_register'];S={r['coordinate'] for r in cum};rows=[] for p in old: if not p['complete']:continue x,y=p['R'],p['Noah_required'];u,v=p['S'],p['F'];A=y+u check('corner_'+str(p['i']),A==x+v and y-x==v-u==1058 and x-u==y-v==8993 and u in S and v in S) rows.append({'annual_row_i':p['i'],'regular_pair':[x,y],'inherited_cumulative_pair':[u,v],'inherited_exchange_constant':A,'in_active_two_exchange_menu':A in [-2639,-2635],'cross_span':8993,'regular_Noah_records':p['Noah_records'],'cumulative_records':[next(z for z in cum if z['coordinate']==t) for t in [u,v]]}) matches=[] for h in load('PREVIOUS_DATA.json')['complete_images']: p=next(p for p in rows if p['regular_pair']==h['regular_pair']);same=h['cumulative_pair']==p['inherited_cumulative_pair'];cross=h['cross_span'];x,y=h['regular_pair'];A=h['exchange_constant'] check('sum_condition_'+str(A)+'_'+str(x),(cross==8993)==(x+y==A+8993)) matches.append({'regular_pair':h['regular_pair'],'fixed_A':A,'image_cumulative_pair':h['cumulative_pair'],'original_row_i':p['annual_row_i'],'same_inherited_annual_assignment':same,'cross_span':cross,'difference_from_17K':cross-8993}) return {'step':'C462','archived_complete_rows':rows,'fixed_menu_phase_comparisons':matches,'condition':'For fixed A,17K cross-spans hold iff x+y=A+17K.','counts':{'archived_complete_rows':len(rows),'fixed_menu_images':len(matches),'same_inherited_assignments':sum(x['same_inherited_annual_assignment'] for x in matches),'coordinate_only_reassignments':sum(not x['same_inherited_annual_assignment'] for x in matches)},'menu_changed':False}