{
  "name": "quixbugs-python-sieve",
  "description": "Fix bug in: sieve",
  "dataset": "quixbugs",
  "instruction": "There is a Python file called sieve.py in the current directory. It contains a buggy implementation of the sieve algorithm. Find and fix the bug. The fix should be minimal - typically a single line change. Do not rewrite the entire function.",
  "setup_files": {
    "sieve.py": "def sieve(max):\n    primes = []\n    for n in range(2, max + 1):\n        if any(n % p > 0 for p in primes):\n            primes.append(n)\n    return primes\n\n\"\"\"\nSieve of Eratosthenes\nprime-sieve\n\nInput:\n    max: A positive int representing an upper bound.\n\nOutput:\n    A list containing all primes up to and including max\n\"\"\"\n",
    "test_sieve.py": "import sys\n\nfrom sieve import sieve\n\nFUNC_NAME = \"sieve\"\ntest_cases = [[[1], []], [[2], [2]], [[4], [2, 3]], [[7], [2, 3, 5, 7]], [[20], [2, 3, 5, 7, 11, 13, 17, 19]], [[50], [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]]]\n\npassed = 0\nfailed = 0\nfor tc in test_cases:\n    inputs = tc[0]\n    expected = tc[1]\n    try:\n        result = sieve(*inputs)\n        if result == expected:\n            passed += 1\n        else:\n            print(f\"FAIL: {FUNC_NAME}({inputs}) = {result}, expected {expected}\")\n            failed += 1\n    except Exception as e:\n        print(f\"ERROR: {FUNC_NAME}({inputs}) raised {e}\")\n        failed += 1\n\nprint(f\"{passed}/{passed+failed} tests passed\")\nif failed > 0:\n    sys.exit(1)\n"
  },
  "verify": "cd $BENCH_WORK_DIR && python3 test_sieve.py",
  "timeout": 180000,
  "tags": [
    "quixbugs",
    "python",
    "bug-fix"
  ]
}