← Back to leaderboard

qwen3.5:9b Champion

5.7 GB measured VRAM · 4-8GB tier
Tier 1 — floor 5/5
seed 1 (passed): all cases passed
781 tokens · 10.964s
extracted code
def is_palindrome(s):
    left = 0
    right = len(s) - 1
    
    while left < right:
        # Skip non-alphanumeric characters from the left
        if not s[left].isalnum():
            left += 1
            continue
        
        # Skip non-alphanumeric characters from the right
        if not s[right].isalnum():
            right -= 1
            continue
            
        # Compare characters (case-insensitive)
        if s[left].lower() != s[right].lower():
            return False
        
        left += 1
        right -= 1
    
    return True
Tier 2 — edge-case handling 0/5
seed 1 (FAILED): exception on [5, 5, 5]: List must contain at least two different integers.
730 tokens · 6.477s
extracted code
def second_largest_unique(nums):
    """
    Returns the second largest unique integer from a list of integers.

    Args:
        nums (list[int]): A list containing at least two distinct integers.

    Returns:
        int or None: The second largest unique value if it exists, otherwise None.

    Raises:
        ValueError: If fewer than 2 unique values are present in the input list.
    """
    if not nums:
        return None
    unique_nums = sorted(set(nums), reverse=True)
    if len(unique_nums) < 2:
        raise ValueError('List must contain at least two different integers.')
    return unique_nums[1]

def second_largest_unique_safe(nums):
    if not nums or len(set(nums)) < 2:
        return None
    return sorted(set(nums), reverse=True)[1]
Tier 3 — multi-class interface 5/5
seed 1 (passed): all cases passed
1246 tokens · 10.323s
extracted code
class Book:
    """Represents a book with title, author, ISBN, and availability status."""

    def __init__(self, title, author, isbn):
        self.title = title
        self.author = author
        self.isbn = isbn
        self.available = True  # Default to available upon creation

    def checkout(self):
        """Mark the book as checked out (unavailable)."""
        if not self.available:
            raise RuntimeError("This book is already unavailable.")
        self.available = False

    def return_book(self):
        """Mark the book as returned and available again."""
        if self.available:
            raise RuntimeError("This book was never checked out or already returned.")
        self.available = True


class Library:
    """Manages a collection of books with methods to add, checkout, return, and search by author."""

    def __init__(self):
        self.books = {}  # Dictionary mapping ISBN -> Book object

    def add_book(self, book):
        """Add a new book to the library. Raises error if duplicate ISBN exists."""
        if not isinstance(book, Book):
            raise TypeError("Only instances of 'Book' can be added.")
        if book.isbn in self.books:
... [truncated, 3055 more chars]
Tier 4 — bug-fix 5/5
seed 1 (passed): all cases passed
702 tokens · 5.935s
extracted code
def apply_discount(price, discount_percent):
    """
    Applies a percentage discount to a price.
    discount_percent is 0-100 (e.g., 20 means 20% off).
    Returns the discounted price, rounded to 2 decimal places.
    Raises ValueError if discount_percent is negative or greater than 100.
    Raises ValueError if price is negative.
    """
    # Validate inputs according to docstring
    if price < 0:
        raise ValueError("price cannot be negative")

    if discount_percent < 0 or discount_percent > 100:
        raise ValueError("discount_percent must be between 0 and 100")

    # Calculate the correct discount (divide by 100)
    discount = price * (discount_percent / 100)
    new_price = price - discount

    return round(new_price, 2)
Tier 5 — schema cross-reference 5/5
seed 1 (passed): all cases passed
846 tokens · 7.007s
extracted code
def top_customers(orders, customers, n):
    """
    Returns the top n customers by total order amount.

    Args:
        orders (list of dict): Each with keys 'order_id', 'customer_id', 'amount'
        customers (list of dict): Each with keys 'customer_id', 'name'
        n (int): Number of top customers to return

    Returns:
        list of dict: Top n customers sorted by total_spent descending, each with 
                      exactly the keys: name, total_spent, order_count
    """
    # Create a mapping from customer_id to name for quick lookup
    customer_map = {c['customer_id']: c['name'] for c in customers}

    # Aggregate order data by customer
    customer_stats = {}

    for order in orders:
        cid = order['customer_id']
        amount = order['amount']

        if cid not in customer_map:
            continue  # Skip unknown customers

        name = customer_map[cid]

        if cid not in customer_stats:
            customer_stats[cid] = {
                'name': name,
                'total_spent': amount,
                'order_count': 1
            }
        else:
            customer_stats[cid]['total_spent'] += amount
            customer_stats[cid]['o
... [truncated, 241 more chars]
Tier 6 — strict JSON format 5/5
seed 1 (passed): strict JSON, all values correct
860 tokens · 7.078s
raw response
{"low_stock_items": ["Widget", "Gizmo"], "total_value": 289.85, "most_expensive_item": "Gizmo"}