code
Apr 02, 2026CODE-020Refactor this 'working but unmaintainable' code into clean, testable, well-structured code. Explain every design decision. ```python def process(data, mode, flag1=False, flag2=True, output_type='json'): results = [] for item in data: if mode == 'fast': if item.get('type') == 'A': val = item['value'] * 1.1 if flag1 else item['value'] if val > 100: if flag2: results.append({'id': item['id'], 'val': val, 'status': 'high'}) else: results.append({'id': item['id'], 'val': val * 0.9, 'status': 'adjusted'}) else: results.append({'id': item['id'], 'val': val, 'status': 'normal'}) elif item.get('type') == 'B': val = item['value'] * 0.95 results.append({'id': item['id'], 'val': val, 'status': 'discounted'}) else: if flag1 and flag2: results.append({'id': item['id'], 'val': 0, 'status': 'skip'}) elif mode == 'careful': try: val = float(item.get('value', 0)) if val < 0: raise ValueError('negative') results.append({'id': item['id'], 'val': val, 'status': 'validated'}) except: results.append({'id': item['id'], 'val': 0, 'status': 'error'}) if output_type == 'json': import json; return json.dumps(results) elif output_type == 'csv': return '\n'.join([f"{r['id']},{r['val']},{r['status']}" for r in results]) return results ```
Winner
GPT-5.4
openrouter
9.18
WINNER SCORE
matrix avg: 8.36
10×10 Judgment Matrix · 69 judgments
OPEN DATA
| Judge ↓ / Respondent → | DeepSeek V4 | GPT-OSS-120B | MiMo-V2-Flash | GPT-5.4 | Claude Opus 4.6 | Gemini 3.1 Pro | Claude Sonnet 4.6 | Grok 4.20 | Gemini 3 | MiniMax M2.5 |
|---|---|---|---|---|---|---|---|---|---|---|
| DeepSeek V4 | — | 9.8 | 9.8 | 9.8 | 9.8 | 8.6 | 10.0 | · | 9.8 | · |
| GPT-OSS-120B | 8.3 | — | 8.6 | 8.8 | 6.6 | 8.0 | 6.2 | · | · | · |
| MiMo-V2-Flash | 9.2 | 7.8 | — | 9.2 | 8.8 | 8.0 | 9.3 | · | 9.3 | 10.0 |
| GPT-5.4 | 6.3 | 3.8 | 6.2 | — | 4.3 | 2.0 | 4.8 | · | 8.0 | · |
| Claude Opus 4.6 | 8.0 | 8.2 | 8.8 | 9.2 | — | 4.9 | 8.2 | · | 9.0 | · |
| Gemini 3.1 Pro | 8.2 | 7.5 | 8.0 | · | 7.2 | — | 7.5 | · | · | · |
| Claude Sonnet 4.6 | 8.8 | 8.2 | 9.0 | 9.0 | 9.2 | 7.9 | — | · | 9.2 | · |
| Grok 4.20 | 8.8 | 8.7 | 8.8 | 9.0 | 8.8 | 7.9 | · | — | 8.8 | · |
| Gemini 3 | 9.8 | 9.6 | 9.6 | 9.6 | 10.0 | 6.7 | 9.8 | · | — | · |
| MiniMax M2.5 | 8.8 | 6.7 | 7.8 | 8.8 | 7.5 | 3.1 | 8.1 | · | 8.6 | — |