import requests,json,random,hashlib from pathlib import Path rev='6e4ed1a2a79af7d8630a6b768ec859cb5af4d3be';url=f'https://huggingface.co/datasets/HuggingFaceH4/MATH-500/resolve/{rev}/test.jsonl';r=requests.get(url,timeout=30);r.raise_for_status();raw=r.content;rows=[json.loads(x) for x in raw.splitlines() if x.strip()];prior={x['source_row'] for x in [json.loads(s) for s in Path('experiments/math500_pilot_20.jsonl').read_text(encoding='utf-8').splitlines()]};eligible=[i for i in range(len(rows)) if i not in prior]; indices=sorted(random.Random(2026110411).sample(eligible,5));p=Path('experiments/long_diagnostic_5.jsonl');p.write_text(''.join(json.dumps({'source_row':i,**rows[i]},ensure_ascii=False)+'\n' for i in indices),encoding='utf8');Path('experiments/long_diagnostic_5_manifest.json').write_text(json.dumps({'repo':'HuggingFaceH4/MATH-500','revision':rev,'source_sha256':hashlib.sha256(raw).hexdigest(),'selection':'Random(2026110411) from all rows excluding pilot 20, sorted','source_rows':indices,'selection_sha256':hashlib.sha256(p.read_bytes()).hexdigest(),'note':'disjoint from ModelClinic pilot and calibration; authors evaluated MATH-500, model training contamination unknown'},indent=2));print('selected',indices)