← Back to leaderboard

gemma4:12b

8.4 GB measured VRAM · 8-12GB tier
Tier 1 — floor 5/5
seed 1 (passed): all cases passed
987 tokens · 15.037s
extracted code
import string

def is_palindrome(s):
    filtered_chars = [char.lower() for char in s if char.isalnum()]
    filtered_str = ''.join(filtered_chars)
    return filtered_str == filtered_str[::-1]
test_cases = [('Racecar', True), ('A man, a plan, a canal: Panama', True), ("No 'x' in Nixon", True), ('hello', False), ('12321', True), ('123456', False)]
Tier 2 — edge-case handling 5/5
seed 1 (passed): all cases passed
1725 tokens · 20.762s
extracted code
from typing import List, Optional

def get_second_largest(numbers: List[int]) -> Optional[int]:
    """
    Returns the second largest unique integer from a list.
    
    Args:
        numbers: A list of integers.
        
    Returns:
        The second largest unique integer, or None if it doesn't exist.
    """
    unique_numbers = set(numbers)
    if len(unique_numbers) < 2:
        return None
    sorted_unique = sorted(list(unique_numbers), reverse=True)
    return sorted_unique[1]

def get_second_largest_fast(numbers: List[int]) -> Optional[int]:
    unique_nums = set(numbers)
    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 and n != first:
            second = n
    return second if second != float('-inf') else None
Tier 3 — multi-class interface 5/5
seed 1 (passed): all cases passed
1962 tokens · 23.676s
extracted code
class Book:

    def __init__(self, title, author, isbn, available=True):
        """
        Initializes a Book object.
        :param title: String, the title of the book
        :param author: String, the author of the book
        :param isbn: String/Int, unique identifier for the book
        :param available: Boolean, default is 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"'{self.title}' by {self.author} (ISBN: {self.isbn}) - [{status}]"

class Library:

    def __init__(self):
        """Initializes an empty list to store Book objects."""
        self.books = []

    def add_book(self, book):
        """Adds a Book object to the library collection."""
        self.books.append(book)

    def _find_book_by_isbn(self, isbn):
        """Helper method to find a book by its ISBN."""
        for book in self.books:
            if book.isbn == isbn:
                return book
        return None

    def checkout_book(self, isbn):
        """
        Marks a book as unavailable if it exis
... [truncated, 766 more chars]
Tier 4 — bug-fix 5/5
seed 1 (passed): all cases passed
948 tokens · 11.394s
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 = 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
1962 tokens · 23.707s
extracted code
def top_customers(orders, customers, n):
    name_map = {c['customer_id']: c['name'] for c in customers}
    stats = {}
    for o in orders:
        cid = o['customer_id']
        if cid not in stats:
            stats[cid] = {'total_spent': 0.0, 'order_count': 0}
        stats[cid]['total_spent'] += o['amount']
        stats[cid]['order_count'] += 1
    results = []
    for cid, data in stats.items():
        results.append({'name': name_map.get(cid, 'Unknown'), 'total_spent': data['total_spent'], 'order_count': data['order_count']})
    results.sort(key=lambda x: x['total_spent'], reverse=True)
    return results[:n]
Tier 6 — strict JSON format 5/5
seed 1 (passed): strict JSON, all values correct
639 tokens · 7.798s
raw response
{"low_stock_items": ["Widget", "Gizmo"], "total_value": 289.85, "most_expensive_item": "Gizmo"}