import json, sys, io

# Fix stdout encoding for Windows
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')

with open(r'C:\allgifted\mathapi11v2\_work_barmodels\chunk_prod_image.json', 'r', encoding='utf-8') as f:
    data = json.load(f)

entries = data[960:1024]
print(f'Got {len(entries)} entries (960-1023)')
for i, e in enumerate(entries):
    idx = 960 + i
    img = e.get('question_image', '')
    q = e.get('question', '')[:200].replace('\n', ' ')
    sol = e.get('solution', '')
    if sol:
        sol_preview = sol[:150].replace('\n', ' ')
    else:
        sol_preview = 'NULL'
    hints = e.get('hints', [])
    ans = e.get('answers', [])
    corr = e.get('correct_index')
    print(f'--- [{idx}] id={e["id"]} type={e["type"]} correct_idx={corr}')
    print(f'  answers: {ans}')
    print(f'  image: {img if img else "none"}')
    print(f'  question: {q}')
    print(f'  solution: {sol_preview}')
    if hints:
        for hi, h in enumerate(hints):
            print(f'  hint{hi}: {str(h)[:150]}')
    print()
