#!/usr/bin/env python3
import csv

# Read the performance data
data = {}
with open('performance_data.csv', 'r') as f:
    reader = csv.reader(f)
    next(reader)  # Skip header
    for row in reader:
        if len(row) >= 5:
            decimals = row[0]
            # Skip rows where language name is missing or is just "SUCCESS"
            if row[1] and row[1] not in ['SUCCESS', 'Brainfuck', 'Ruby'] and not row[1].startswith('3.'):
                language = row[1]
                time = row[2]
                memory = row[3]
                status = row[4]
                
                if decimals not in data:
                    data[decimals] = []
                data[decimals].append({
                    'language': language,
                    'time': time,
                    'memory': memory,
                    'status': status
                })

# Print summary
for dec in ['1', '2', '5', '10', '100', '1000', '2000']:
    if dec in data:
        print(f"\n=== {dec} decimals ===")
        for entry in data[dec][:10]:  # Show first 10
            print(f"{entry['language']}: {entry['time']}ms, {entry['memory']}")