{
 "run_id": 2,
 "model": "qwen3-30b-a3b",
 "mode": "oneshot",
 "challenge": "lru-cache",
 "sample": 0,
 "status": "ok",
 "error": null,
 "score_total": 100.0,
 "score_tests": 1.0,
 "score_deliverables": 1.0,
 "score_content": 1.0,
 "tests_passed": 5,
 "tests_failed": 0,
 "wall_secs": 237.76245054100582,
 "slug": "run2-qwen3-30b-a3b-oneshot-lru-cache-s0",
 "challenge_title": "LRU cache",
 "spec": "Create lru.py with a class:\n\nclass LRUCache:\n    def __init__(self, capacity: int)\n    def get(self, key) -> value        # return the stored value, or -1 if absent\n    def put(self, key, value) -> None  # insert or update\n\nSemantics: the cache holds at most `capacity` entries. Both get() and put() count as a use of the key. When put() would exceed capacity, evict the least-recently-used key first. put() on an existing key updates its value and makes it most-recently-used.\n\nUse only the Python standard library.",
 "expected_files": [
  "lru.py"
 ],
 "content_checks": {
  "lru.py": [
   "class LRUCache",
   "def get",
   "def put"
  ]
 },
 "test_files": {
  "test_lru.py": "from lru import LRUCache\n\n\ndef test_basic_put_get():\n    c = LRUCache(2)\n    c.put(\"a\", 1)\n    assert c.get(\"a\") == 1\n    assert c.get(\"missing\") == -1\n\n\ndef test_eviction_order():\n    c = LRUCache(2)\n    c.put(\"a\", 1)\n    c.put(\"b\", 2)\n    c.put(\"c\", 3)\n    assert c.get(\"a\") == -1\n    assert c.get(\"b\") == 2\n    assert c.get(\"c\") == 3\n\n\ndef test_get_refreshes_recency():\n    c = LRUCache(2)\n    c.put(\"a\", 1)\n    c.put(\"b\", 2)\n    c.get(\"a\")\n    c.put(\"c\", 3)\n    assert c.get(\"b\") == -1\n    assert c.get(\"a\") == 1\n\n\ndef test_put_overwrite_refreshes():\n    c = LRUCache(2)\n    c.put(\"a\", 1)\n    c.put(\"b\", 2)\n    c.put(\"a\", 10)\n    c.put(\"c\", 3)\n    assert c.get(\"b\") == -1\n    assert c.get(\"a\") == 10\n\n\ndef test_capacity_one():\n    c = LRUCache(1)\n    c.put(\"a\", 1)\n    c.put(\"b\", 2)\n    assert c.get(\"a\") == -1\n    assert c.get(\"b\") == 2\n"
 },
 "events": [
  {
   "ts": "2026-07-17T20:24:17.643320+00:00",
   "event": "start",
   "run": 2,
   "model": "qwen3-30b-a3b",
   "mode": "oneshot",
   "challenge": "lru-cache",
   "sample": 0
  },
  {
   "ts": "2026-07-17T20:24:17.643459+00:00",
   "event": "prompt",
   "mode": "oneshot",
   "content": "You are completing a coding task in one shot. Write complete files that satisfy the spec below. Tests (pytest) will be run against your files; you cannot run them yourself.\n\nReply with ONE JSON object and nothing else:\n{\"files\": {\"<relative path>\": \"<complete file content>\", ...}}\n\nRequired deliverable files: lru.py\n\nSPEC:\nCreate lru.py with a class:\n\nclass LRUCache:\n    def __init__(self, capacity: int)\n    def get(self, key) -> value        # return the stored value, or -1 if absent\n    def put(self, key, value) -> None  # insert or update\n\nSemantics: the cache holds at most `capacity` entries. Both get() and put() count as a use of the key. When put() would exceed capacity, evict the least-recently-used key first. put() on an existing key updates its value and makes it most-recently-used.\n\nUse only the Python standard library.\n"
  },
  {
   "ts": "2026-07-17T20:28:13.719719+00:00",
   "event": "completion",
   "content": "{\"files\": {\"lru.py\": \"from collections import OrderedDict\\n\\nclass LRUCache:\\n    def __init__(self, capacity: int):\\n        self.capacity = capacity\\n        self.cache = OrderedDict()\\n    \\n    def get(self, key):\\n        if key in self.cache:\\n            self.cache.move_to_end(key)\\n            return self.cache[key]\\n        return -1\\n    \\n    def put(self, key, value):\\n        if key in self.cache:\\n            self.cache[key] = value\\n            self.cache.move_to_end(key)\\n        else:\\n            if len(self.cache) == self.capacity:\\n                self.cache.popitem(last=False)\\n            self.cache[key] = value\"}}",
   "tokens": 1777
  },
  {
   "ts": "2026-07-17T20:28:13.722742+00:00",
   "event": "write_file",
   "path": "lru.py",
   "bytes": 599
  },
  {
   "ts": "2026-07-17T20:28:15.405475+00:00",
   "event": "graded",
   "total": 100.0,
   "tests_passed": 5,
   "tests_failed": 0,
   "output": ".....                                                                    [100%]\n5 passed in 0.07s\n"
  }
 ],
 "files": {
  "lru.py": "from collections import OrderedDict\n\nclass LRUCache:\n    def __init__(self, capacity: int):\n        self.capacity = capacity\n        self.cache = OrderedDict()\n    \n    def get(self, key):\n        if key in self.cache:\n            self.cache.move_to_end(key)\n            return self.cache[key]\n        return -1\n    \n    def put(self, key, value):\n        if key in self.cache:\n            self.cache[key] = value\n            self.cache.move_to_end(key)\n        else:\n            if len(self.cache) == self.capacity:\n                self.cache.popitem(last=False)\n            self.cache[key] = value"
 },
 "file_metrics": [
  {
   "path": "lru.py",
   "loc": 21,
   "sloc": 18,
   "chars": 599,
   "is_python": true,
   "functions": 3,
   "classes": 1,
   "complexity": 4,
   "max_complexity": 3,
   "max_depth": 4,
   "imports": [
    "collections"
   ],
   "avg_function_len": 5.3,
   "parse_error": false
  }
 ],
 "code": {
  "files": 1,
  "loc": 21,
  "sloc": 18,
  "chars": 599,
  "functions": 3,
  "classes": 1,
  "complexity": 4,
  "max_complexity": 3,
  "max_depth": 4,
  "imports": [
   "collections"
  ],
  "avg_function_len": 5.3,
  "parse_errors": 0
 },
 "session": {
  "model_calls": 1,
  "actions": {},
  "bad_actions": 0,
  "test_runs": 0,
  "tokens_out": 1777,
  "tokens_in": 0,
  "turns": 0
 },
 "test_output": ".....                                                                    [100%]\n5 passed in 0.07s\n"
}