{
 "name": "TechFuelHQ coding-eval",
 "version": "techfuelhq-coding-eval-v1",
 "license": "https://creativecommons.org/licenses/by/4.0/",
 "canonical": "https://techfuelhq.com/data/rtx-5080-llm-throughput/",
 "method": {
  "api": "ollama /api/chat",
  "options": {
   "temperature": 0,
   "seed": 42,
   "num_ctx": 8192,
   "num_predict": 4096
  },
  "reps": 2,
  "scoring": "mechanical (executed checkers, exact rows, fullmatch lists, tool-call JSON); no judge model"
 },
 "tasks": [
  {
   "id": "t1-bugfix-binary-search",
   "family": "bugfix",
   "prompt": "The following Python function is supposed to do what its docstring says, but it has a bug.\n\n```python\ndef find_first_ge(arr, target):\n    \"\"\"Return the index of the FIRST element in sorted list arr that is\n    greater than or equal to target, or len(arr) if no such element exists.\"\"\"\n    lo, hi = 0, len(arr)\n    while lo < hi:\n        mid = (lo + hi) // 2\n        if arr[mid] <= target:\n            lo = mid + 1\n        else:\n            hi = mid\n    return lo\n```\n\nFix the bug. Reply with the complete corrected function in a single ```python code block. Keep the same function name and signature."
  },
  {
   "id": "t2-implement-parse-duration",
   "family": "implement-from-spec",
   "prompt": "Write a Python function `parse_duration(text)` that converts a duration string into total seconds (int).\n\nSpec:\n- Components: hours `h`, minutes `m`, seconds `s`, each an integer with no sign.\n- Any subset may appear, but each at most once, and they must appear in h, m, s order. Examples: `\"2h45m\"` -> 9900, `\"90s\"` -> 90, `\"1h30m15s\"` -> 5415.\n- At least one component is required.\n- For anything else (empty string, missing unit, unknown unit, wrong order, decimals, negatives), raise `ValueError`.\n\nReply with the complete function in a single ```python code block."
  },
  {
   "id": "t3-write-tests-lru",
   "family": "test-writing",
   "prompt": "Here is an LRU cache implementation:\n\n```python\nclass LRUCache:\n    def __init__(self, capacity):\n        self.capacity = capacity\n        self._data = {}\n\n    def get(self, key):\n        if key not in self._data:\n            return -1\n        value = self._data.pop(key)\n        self._data[key] = value\n        return value\n\n    def put(self, key, value):\n        if self.capacity <= 0:\n            return\n        if key in self._data:\n            self._data.pop(key)\n        elif len(self._data) >= self.capacity:\n            oldest = next(iter(self._data))\n            self._data.pop(oldest)\n        self._data[key] = value\n```\n\nWrite a thorough test for it as a single Python function `check(cache_class)` that instantiates `cache_class` and raises `AssertionError` if the implementation is wrong. Cover eviction order, the recency effect of `get`, updating an existing key, and the missing-key return value. A weak test that only checks basic put/get will not count.\n\nReply with only the `check` function (plus imports if needed) in a single ```python code block. Do not call `check` at module level."
  },
  {
   "id": "t4-refactor-summarize",
   "family": "refactor",
   "prompt": "Refactor this Python function to remove the copy-paste duplication by extracting the repeated per-sensor logic into ONE helper function. The public function `summarize(readings_a, readings_b, readings_c)` must keep exactly the same name, signature, and return value for every input.\n\n```python\ndef summarize(readings_a, readings_b, readings_c):\n    \"\"\"Return a dict of per-sensor stats for three reading lists.\"\"\"\n    result = {}\n    total_a = 0\n    for value in readings_a:\n        total_a += value\n    if len(readings_a) > 0:\n        mean_a = total_a / len(readings_a)\n        peak_a = max(readings_a)\n    else:\n        mean_a = 0.0\n        peak_a = None\n    result[\"sensor_a\"] = {\"mean\": round(mean_a, 2), \"peak\": peak_a,\n                          \"count\": len(readings_a)}\n    total_b = 0\n    for value in readings_b:\n        total_b += value\n    if len(readings_b) > 0:\n        mean_b = total_b / len(readings_b)\n        peak_b = max(readings_b)\n    else:\n        mean_b = 0.0\n        peak_b = None\n    result[\"sensor_b\"] = {\"mean\": round(mean_b, 2), \"peak\": peak_b,\n                          \"count\": len(readings_b)}\n    total_c = 0\n    for value in readings_c:\n        total_c += value\n    if len(readings_c) > 0:\n        mean_c = total_c / len(readings_c)\n        peak_c = max(readings_c)\n    else:\n        mean_c = 0.0\n        peak_c = None\n    result[\"sensor_c\"] = {\"mean\": round(mean_c, 2), \"peak\": peak_c,\n                          \"count\": len(readings_c)}\n    return result\n```\n\nReply with the complete refactored code (helper + `summarize`) in a single ```python code block."
  },
  {
   "id": "t5-explain-legacy",
   "family": "explain-legacy",
   "prompt": "What algorithm does this function implement, and what is it commonly used for? Answer in 2-3 sentences.\n\n```python\ndef f(s):\n    d = [int(c) for c in s if c.isdigit()][::-1]\n    t = 0\n    for i, x in enumerate(d):\n        if i % 2:\n            x *= 2\n            if x > 9:\n                x -= 9\n        t += x\n    return t % 10 == 0\n```"
  },
  {
   "id": "t6-sql-revenue",
   "family": "sql",
   "prompt": "Given this SQLite schema:\n\n```sql\nCREATE TABLE customers (id INTEGER PRIMARY KEY, name TEXT, country TEXT);\nCREATE TABLE orders (id INTEGER PRIMARY KEY, customer_id INTEGER REFERENCES customers(id),\n                     amount_cents INTEGER, created_at TEXT);\n```\n\nWrite ONE SQL query that returns total order revenue per customer country for orders created in July 2026 (created_at is an ISO `YYYY-MM-DD` text column), only including countries whose July total is at least 50000 cents, sorted by total descending (ties: any order). Return columns: country, total_cents.\n\nReply with only the query in a single ```sql code block."
  },
  {
   "id": "t7-regex-semver",
   "family": "regex",
   "prompt": "Write a single Python `re` pattern that matches semantic version strings of the form MAJOR.MINOR.PATCH with an optional -prerelease suffix:\n- MAJOR, MINOR, PATCH: non-negative integers, no leading zeros (a lone `0` is fine)\n- optional prerelease: `-` followed by one or more dot-separated identifiers of letters, digits, or hyphens (at least one character each)\n- no `v` prefix, no build metadata, nothing else before or after\nThe pattern will be used with `re.fullmatch`.\n\nReply with ONLY the regex pattern inside a single fenced code block."
  },
  {
   "id": "t8-agentic-tool-calls",
   "family": "tool-calling",
   "prompt": "Create a directory at `reports/2026`, then write a file at `reports/2026/status.txt` whose content is exactly `OK`. Use the available tools.",
   "tools": [
    {
     "type": "function",
     "function": {
      "name": "create_directory",
      "description": "Create a directory (and any missing parents) at the given path.",
      "parameters": {
       "type": "object",
       "properties": {
        "path": {
         "type": "string",
         "description": "Directory path to create"
        }
       },
       "required": [
        "path"
       ]
      }
     }
    },
    {
     "type": "function",
     "function": {
      "name": "write_file",
      "description": "Write text content to a file, overwriting if it exists.",
      "parameters": {
       "type": "object",
       "properties": {
        "path": {
         "type": "string"
        },
        "content": {
         "type": "string"
        }
       },
       "required": [
        "path",
        "content"
       ]
      }
     }
    }
   ]
  }
 ]
}