← Back to leaderboard

qwen2.5-coder:7b

5.1 GB measured VRAM · 4-8GB tier
Tier 1 — floor 5/5
seed 1 (passed): all cases passed
297 tokens · 2.275s
extracted code
import string

def is_palindrome(s):
    cleaned = ''.join((char.lower() for char in s if char.isalnum()))
    return cleaned == cleaned[::-1]
Tier 2 — edge-case handling 5/5
seed 1 (passed): all cases passed
218 tokens · 1.554s
extracted code
def second_largest(numbers):
    if len(numbers) < 2:
        return None
    first, second = (float('-inf'), float('-inf'))
    for num in numbers:
        if num > first:
            first, second = (num, first)
        elif first > num > second:
            second = num
    return second if second != float('-inf') else None
Tier 3 — multi-class interface 5/5
seed 1 (passed): all cases passed
511 tokens · 3.452s
extracted code
class Book:

    def __init__(self, title, author, isbn):
        self.title = title
        self.author = author
        self.isbn = isbn
        self.available = True

    def __repr__(self):
        return f'Book(title={self.title}, author={self.author}, isbn={self.isbn}, available={self.available})'

class Library:

    def __init__(self):
        self.books = []

    def add_book(self, book):
        if not any((b.isbn == book.isbn for b in self.books)):
            self.books.append(book)
            return True
        else:
            print(f'Book with ISBN {book.isbn} already exists.')
            return False

    def checkout_book(self, isbn):
        for book in self.books:
            if book.isbn == isbn and book.available:
                book.available = False
                return True
        return False

    def return_book(self, isbn):
        for book in self.books:
            if book.isbn == isbn and (not book.available):
                book.available = True
                return True
        return False

    def find_by_author(self, author):
        matching_books = [book for book in self.books if book.author == author]
        return matching_books
li
... [truncated, 71 more chars]
Tier 4 — bug-fix 5/5
seed 1 (passed): all cases passed
325 tokens · 2.24s
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.
    """
    if discount_percent < 0 or discount_percent > 100:
        raise ValueError('discount_percent must be between 0 and 100')
    if price < 0:
        raise ValueError('price cannot be negative')
    discount = discount_percent / 100 * price
    new_price = price - discount
    return round(new_price, 2)
Tier 5 — schema cross-reference 5/5
seed 1 (passed): all cases passed
698 tokens · 4.697s
extracted code
def top_customers(orders, customers, n):
    customer_spent = {}
    for order in orders:
        customer_id = order['customer_id']
        amount = order['amount']
        if customer_id not in customer_spent:
            customer_spent[customer_id] = {'total_spent': 0, 'order_count': 0}
        customer_spent[customer_id]['total_spent'] += amount
        customer_spent[customer_id]['order_count'] += 1
    top_customers_list = []
    for customer_id, data in customer_spent.items():
        name = next((c['name'] for c in customers if c['customer_id'] == customer_id), None)
        if name:
            top_customers_list.append({'name': name, 'total_spent': data['total_spent'], 'order_count': data['order_count']})
    top_customers_list.sort(key=lambda x: x['total_spent'], reverse=True)
    return top_customers_list[:n]
orders = [{'order_id': 1, 'customer_id': 'C001', 'amount': 150}, {'order_id': 2, 'customer_id': 'C002', 'amount': 300}, {'order_id': 3, 'customer_id': 'C001', 'amount': 200}, {'order_id': 4, 'customer_id': 'C003', 'amount': 50}]
customers = [{'customer_id': 'C001', 'name': 'Alice'}, {'customer_id': 'C002', 'name': 'Bob'}, {'customer_id': 'C003', 'name': 'Charlie'}]
... [truncated, 6 more chars]
Tier 6 — strict JSON format 0/5
seed 1 (FAILED): total_value = 279.75, expected 289.85
42 tokens · 0.437s
raw response
{
  "low_stock_items": ["Widget", "Gizmo"],
  "total_value": 279.75,
  "most_expensive_item": "Gizmo"
}