← Back to leaderboard

phi4-mini

3.7 GB measured VRAM · sub-4GB tier
Tier 1 — floor 5/5
seed 1 (passed): all cases passed
105 tokens · 5.46s
extracted code
def is_palindrome(s):
    cleaned_s = ''.join((char.lower() for char in s if char.isalnum()))
    return cleaned_s == cleaned_s[::-1]
Tier 2 — edge-case handling 0/5
seed 1 (FAILED): f([5, 5, 5]) = Not enough unique values, expected None
286 tokens · 1.471s
extracted code
def find_second_largest_unique(numbers):
    unique_numbers = set(numbers)
    if len(unique_numbers) < 2:
        return 'Not enough unique values'
    try:
        second_largest = sorted(list(unique_numbers))[-2]
        return second_largest
    except IndexError:
        return 'Not enough unique values'
numbers_list = [3, 1, 4, 2, 5, 3, 6, 7]
edge_case_1 = find_second_largest_unique([10])
edge_case_2 = find_second_largest_unique([])
Tier 3 — multi-class interface 1/5
seed 2 (FAILED): code failed to execute: invalid syntax (<string>, line 87)
1042 tokens · 4.999s
extracted code
class Book:
    def __init__(self, title: str, author: str, isbn: str):
        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):
        # Initialize an empty list to store books in the library.
        self.books = []

    def add_book(self, book: Book):
        """Add a new book to the collection."""
        if not any(b.isbn == book.isbn for b in self.books):  # Check for duplicate ISBNs
            self.books.append(book)
            print(f"Book '{book.title}' added successfully.")
        else:
            print("A book with this ISBN already exists.")

    def checkout_book(self, isbn: str) -> bool:
        """Checkout a book by its ISBN. Marks it unavailable if found."""
        for i in range(len(self.books)):
            if self.books[i].isbn == isbn and self.books[i].available:
                # Mark the book as checked out
                self.books[i].available = False
                print(f"Book '{self.books[i].title}' has been checked ou
... [truncated, 2320 more chars]
Tier 4 — bug-fix 5/5
seed 1 (passed): all cases passed
317 tokens · 1.619s
extracted code
def apply_discount(price, discount_percent):
    """
    Applies a percentage discount to a price.

    Parameters:
    - `price` (float): The original price before the discount.
    - `discount_percent` (int or float): A value between 0 and 100 inclusive representing how much of an off you want. For example,
      if it's set at 20, it means you're getting a 20% discount.

    Returns:
    - new_price (float): The price after the discounted amount has been applied.
        This is rounded to two decimal places for convenience in representation and returned as float type even though
        prices are usually represented with no fractional part. 

    Raises:
    - ValueError: If `discount_percent` is negative or greater than 100, indicating an invalid discount percentage value was provided,
      since a valid range must be between inclusive of zero (0%) to exclusive above one hundred (>100%).
    - ValueError: If the original price (`price`) entered for any reason such as being less than zero which doesn't make sense
      in this context.
    """
    if discount_percent < 0 or discount_percent > 100:
        raise ValueError('discount_percent must be between 0 and 100 inclusive.
... [truncated, 184 more chars]
Tier 5 — schema cross-reference 0/5
seed 1 (FAILED): exception: 'id'
539 tokens · 2.608s
extracted code
def top_customers(orders, customers, n):
    customer_dict = {customer['id']: {'name': customer['name'], 'total_spent': 0, 'order_count': 0} for customer in customers}
    for order in orders:
        if order['customer_id'] not in customer_dict:
            continue
        customer = customer_dict[order['customer_id']]
        customer['total_spent'] += order['amount']
        customer['order_count'] += 1
    sorted_customers = sorted(customer_dict.values(), key=lambda x: x['total_spent'], reverse=True)
    result = [{'name': customer['name'], 'total_spent': customer['total_spent'], 'order_count': customer['order_count']} for customer in sorted_customers[:n]]
    return result
orders_list = [{'id': 1, 'customer_id': 101, 'amount': 200}, {'id': 2, 'customer_id': 102, 'amount': 150}, {'id': 3, 'customer_id': 101, 'amount': 300}]
customers_list = [{'id': 101, 'name': 'Alice'}, {'id': 102, 'name': 'Bob'}]
Tier 6 — strict JSON format 0/5
seed 1 (FAILED): low_stock_items = {'Widget'}, expected {'Widget', 'Gizmo'}
32 tokens · 0.329s
raw response
```json
{"low_stock_items": ["Widget"], "total_value": 123.75, "most_expensive_item": "Gizmo"}
```