← Back to leaderboard

gemma4:26b

17 GB measured VRAM · 12GB+ tier
Tier 1 — floor 5/5
seed 1 (passed): all cases passed
1053 tokens · 19.985s
extracted code
import string

def is_palindrome(s):
    cleaned = ''.join((char.lower() for char in s if char.isalnum()))
    return cleaned == cleaned[::-1]
test_cases = [('Racecar', True), ('A man, a plan, a canal: Panama', True), ('race car', True), ('hello', False), ("No 'x' in Nixon", True), ('12321', True), ('123456', False), ('!@#$%^&*', True)]
Tier 2 — edge-case handling 4/5
seed 1 (FAILED): exception on [5, 3, 9, 9, 7]: name 'unique_numbers' is not defined
1621 tokens · 12.409s
extracted code
from typing import List, Optional

def get_second_largest(nums: List[int]) -> Optional[int]:
    """
    Returns the second largest unique value from a list of integers.
    Returns None if a second largest value does not exist.
    """
    unique_nums = set(nums)
    if len(unique_nums) < 2:
        return None
    sorted_nums = sorted(list(unique_numbers), reverse=True)
    return sorted_nums[1]

def get_second_largest_fast(nums: List[int]) -> Optional[int]:
    unique_nums = set(nums)
    if len(unique_nums) < 2:
        return None
    first = second = float('-inf')
    for n in unique_nums:
        if n > first:
            second = first
            first = n
        elif n > second:
            second = n
    return second
Tier 3 — multi-class interface 5/5
seed 1 (passed): all cases passed
1936 tokens · 14.946s
extracted code
class Book:
    """Represents a single book in the library."""

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

    def __repr__(self):
        status = 'Available' if self.available else 'Checked Out'
        return f"Book('{self.title}' by {self.author}, ISBN: {self.isbn}, [{status}])"

class Library:
    """Represents a collection of books and management logic."""

    def __init__(self):
        self.books = {}

    def add_book(self, book):
        """Adds a Book object to the library."""
        self.books[book.isbn] = book
        print(f'Added: {book.title}')

    def checkout_book(self, isbn):
        """
        Marks a book as unavailable. 
        Returns True if successful, False if missing or already checked out.
        """
        book = self.books.get(isbn)
        if book and book.available:
            book.available = False
            print(f'Successfully checked out: {book.title}')
            return True
        else:
            reason = 'not found' if not book else 'already checked out'
            print(f'Checkout failed: Book {
... [truncated, 726 more chars]
Tier 4 — bug-fix 5/5
seed 1 (passed): all cases passed
1074 tokens · 8.322s
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 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.')
    discount_amount = price * (discount_percent / 100)
    new_price = price - discount_amount
    return round(new_price, 2)
Tier 5 — schema cross-reference 5/5
seed 1 (passed): all cases passed
1945 tokens · 14.988s
extracted code
from collections import defaultdict

def top_customers(orders, customers, n):
    stats = defaultdict(lambda: {'total_spent': 0.0, 'order_count': 0})
    for order in orders:
        cid = order['customer_id']
        amount = order['amount']
        stats[cid]['total_spent'] += amount
        stats[cid]['order_count'] += 1
    name_map = {c['customer_id']: c['name'] for c in customers}
    result = []
    for cid, data in stats.items():
        if cid in name_map:
            result.append({'name': name_map[cid], 'total_spent': data['total_spent'], 'order_count': data['order_count']})
    result.sort(key=lambda x: x['total_spent'], reverse=True)
    return result[:n]
Tier 6 — strict JSON format 5/5
seed 1 (passed): strict JSON, all values correct
621 tokens · 5.044s
raw response
{"low_stock_items": ["Widget", "Gizmo"], "total_value": 289.85, "most_expensive_item": "Gizmo"}