{
 "run_id": 2,
 "model": "llama3.2-3b",
 "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": 5.795666916994378,
 "slug": "run2-llama3.2-3b-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-17T16:11:14.229125+00:00",
   "event": "start",
   "run": 2,
   "model": "llama3.2-3b",
   "mode": "oneshot",
   "challenge": "lru-cache",
   "sample": 0
  },
  {
   "ts": "2026-07-17T16:11:14.229157+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-17T16:11:19.870646+00:00",
   "event": "completion",
   "content": "{\"files\": {\"lru.py\": \"import collections\\nclass LRUCache:\\n    def __init__(self, capacity: int):\\n        self.capacity = capacity\\n        self.cache = collections.OrderedDict()\\n\\n    def get(self, key) -> int:\\n        if key in self.cache:\\n            value = self.cache.pop(key)\\n            self.cache[key] = value\\n            return value\\n        else:\\n            return -1\\n\\n    def put(self, key, value) -> None:\\n        if key in self.cache:\\n            self.cache.pop(key)\\n        elif len(self.cache) == self.capacity:\\n            self.cache.popitem(last=False)\\n        \\n        self.cache[key] = value\"}}",
   "tokens": 157
  },
  {
   "ts": "2026-07-17T16:11:19.871705+00:00",
   "event": "write_file",
   "path": "lru.py",
   "bytes": 585
  },
  {
   "ts": "2026-07-17T16:11:20.024620+00:00",
   "event": "graded",
   "total": 100.0,
   "tests_passed": 5,
   "tests_failed": 0,
   "output": ".....                                                                    [100%]\n5 passed in 0.01s\n"
  }
 ],
 "files": {
  "lru.py": "import collections\nclass LRUCache:\n    def __init__(self, capacity: int):\n        self.capacity = capacity\n        self.cache = collections.OrderedDict()\n\n    def get(self, key) -> int:\n        if key in self.cache:\n            value = self.cache.pop(key)\n            self.cache[key] = value\n            return value\n        else:\n            return -1\n\n    def put(self, key, value) -> None:\n        if key in self.cache:\n            self.cache.pop(key)\n        elif len(self.cache) == self.capacity:\n            self.cache.popitem(last=False)\n        \n        self.cache[key] = value"
 },
 "file_metrics": [
  {
   "path": "lru.py",
   "loc": 21,
   "sloc": 18,
   "chars": 585,
   "is_python": true,
   "functions": 3,
   "classes": 1,
   "complexity": 4,
   "max_complexity": 3,
   "max_depth": 4,
   "imports": [
    "collections"
   ],
   "avg_function_len": 5.7,
   "parse_error": false
  }
 ],
 "code": {
  "files": 1,
  "loc": 21,
  "sloc": 18,
  "chars": 585,
  "functions": 3,
  "classes": 1,
  "complexity": 4,
  "max_complexity": 3,
  "max_depth": 4,
  "imports": [
   "collections"
  ],
  "avg_function_len": 5.7,
  "parse_errors": 0
 },
 "session": {
  "model_calls": 1,
  "actions": {},
  "bad_actions": 0,
  "test_runs": 0,
  "tokens_out": 157,
  "tokens_in": 0,
  "turns": 0
 },
 "test_output": ".....                                                                    [100%]\n5 passed in 0.01s\n"
}