Commit
·
03beb0e
1
Parent(s):
651a747
Standardize naming (off-by-one -> value misuse)
Browse files
data/python/data/humanevalbugs.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
},
|
| 7 |
{
|
| 8 |
"buggy_solution": " result = []\n current_string = []\n current_depth = 0\n\n for c in paren_string:\n if c == '(':\n current_depth += 1\n current_string.append(c)\n elif c == ')':\n current_depth -= 1\n current_string.append(c)\n\n if current_depth < 0:\n result.append(''.join(current_string))\n current_string.clear()\n\n return result\n",
|
| 9 |
-
"bug_type": "
|
| 10 |
"failure_symptoms": "incorrect output"
|
| 11 |
},
|
| 12 |
{
|
|
@@ -16,7 +16,7 @@
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
"buggy_solution": " balance = 0\n\n for op in operations:\n balance += op\n if balance == 0:\n return True\n\n return False\n",
|
| 19 |
-
"bug_type": "
|
| 20 |
"failure_symptoms": "incorrect output"
|
| 21 |
},
|
| 22 |
{
|
|
@@ -61,7 +61,7 @@
|
|
| 61 |
},
|
| 62 |
{
|
| 63 |
"buggy_solution": " if not strings:\n return None\n\n maxlen = max(len(x) for x in strings)\n for s in strings:\n if len(s) > maxlen:\n return s\n",
|
| 64 |
-
"bug_type": "
|
| 65 |
"failure_symptoms": "incorrect output"
|
| 66 |
},
|
| 67 |
{
|
|
@@ -76,7 +76,7 @@
|
|
| 76 |
},
|
| 77 |
{
|
| 78 |
"buggy_solution": " return ' '.join([str(x) for x in range(n)])\n",
|
| 79 |
-
"bug_type": "
|
| 80 |
"failure_symptoms": "incorrect output"
|
| 81 |
},
|
| 82 |
{
|
|
@@ -91,7 +91,7 @@
|
|
| 91 |
},
|
| 92 |
{
|
| 93 |
"buggy_solution": " times = 0\n\n for i in range(len(string) - len(substring)):\n if string[i:i+len(substring)] == substring:\n times += 1\n\n return times\n",
|
| 94 |
-
"bug_type": "
|
| 95 |
"failure_symptoms": "incorrect output"
|
| 96 |
},
|
| 97 |
{
|
|
@@ -101,12 +101,12 @@
|
|
| 101 |
},
|
| 102 |
{
|
| 103 |
"buggy_solution": " closest_pair = None\n distance = None\n\n for idx, elem in enumerate(numbers):\n for idx2, elem2 in enumerate(numbers):\n if idx != idx2:\n if distance is None:\n distance = abs(elem - elem2)\n closest_pair = tuple(sorted([elem, elem2]))\n else:\n new_distance = abs(elem - elem2)\n if new_distance > distance:\n distance = new_distance\n closest_pair = tuple(sorted([elem, elem2]))\n\n return closest_pair\n",
|
| 104 |
-
"bug_type": "
|
| 105 |
"failure_symptoms": "incorrect output"
|
| 106 |
},
|
| 107 |
{
|
| 108 |
"buggy_solution": " min_number = min(numbers)\n max_number = max(numbers)\n return [(x - min_number) / (max_number + min_number) for x in numbers]\n",
|
| 109 |
-
"bug_type": "
|
| 110 |
"failure_symptoms": "incorrect output"
|
| 111 |
},
|
| 112 |
{
|
|
@@ -116,12 +116,12 @@
|
|
| 116 |
},
|
| 117 |
{
|
| 118 |
"buggy_solution": " return len(string) - 1\n",
|
| 119 |
-
"bug_type": "
|
| 120 |
"failure_symptoms": "incorrect output"
|
| 121 |
},
|
| 122 |
{
|
| 123 |
"buggy_solution": " for i in reversed(range(n)):\n if n - i == 0:\n return i\n",
|
| 124 |
-
"bug_type": "
|
| 125 |
"failure_symptoms": "incorrect output"
|
| 126 |
},
|
| 127 |
{
|
|
@@ -131,7 +131,7 @@
|
|
| 131 |
},
|
| 132 |
{
|
| 133 |
"buggy_solution": " import collections\n c = collections.Counter(numbers)\n return [n for n in numbers if c[n] < 1]\n",
|
| 134 |
-
"bug_type": "
|
| 135 |
"failure_symptoms": "incorrect output"
|
| 136 |
},
|
| 137 |
{
|
|
@@ -151,12 +151,12 @@
|
|
| 151 |
},
|
| 152 |
{
|
| 153 |
"buggy_solution": " return [e for e in l if e < 0]\n",
|
| 154 |
-
"bug_type": "
|
| 155 |
"failure_symptoms": "incorrect output"
|
| 156 |
},
|
| 157 |
{
|
| 158 |
"buggy_solution": " if n < 1:\n return False\n for k in range(1, n - 1):\n if n % k == 0:\n return False\n return True\n",
|
| 159 |
-
"bug_type": "
|
| 160 |
"failure_symptoms": "incorrect output"
|
| 161 |
},
|
| 162 |
{
|
|
@@ -176,12 +176,12 @@
|
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"buggy_solution": " m = l[0]\n for e in l:\n if e < m:\n m = e\n return m\n",
|
| 179 |
-
"bug_type": "
|
| 180 |
"failure_symptoms": "incorrect output"
|
| 181 |
},
|
| 182 |
{
|
| 183 |
"buggy_solution": " ns = []\n for i in range(n):\n if i % 11 == 0 and i % 13 == 0:\n ns.append(i)\n s = ''.join(list(map(str, ns)))\n ans = 0\n for c in s:\n ans += (c == '7')\n return ans\n",
|
| 184 |
-
"bug_type": "
|
| 185 |
"failure_symptoms": "incorrect output"
|
| 186 |
},
|
| 187 |
{
|
|
@@ -196,7 +196,7 @@
|
|
| 196 |
},
|
| 197 |
{
|
| 198 |
"buggy_solution": " import math\n\n def is_prime(p):\n if p < 2:\n return False\n for k in range(2, min(int(math.sqrt(p)), p)):\n if p % k == 0:\n return False\n return True\n f = [0, 1]\n while True:\n f.append(f[-1] + f[-2])\n if is_prime(f[-1]):\n n -= 1\n if n == 0:\n return f[-1]\n",
|
| 199 |
-
"bug_type": "
|
| 200 |
"failure_symptoms": "incorrect output"
|
| 201 |
},
|
| 202 |
{
|
|
@@ -216,12 +216,12 @@
|
|
| 216 |
},
|
| 217 |
{
|
| 218 |
"buggy_solution": " for i, l1 in enumerate(l):\n for j in range(i, len(l)):\n if l1 + l[j] == 0:\n return True\n return False\n",
|
| 219 |
-
"bug_type": "
|
| 220 |
"failure_symptoms": "incorrect output"
|
| 221 |
},
|
| 222 |
{
|
| 223 |
"buggy_solution": " ret = \"\"\n while x > 0:\n ret = str(x % base) + ret\n x -= base\n return ret\n",
|
| 224 |
-
"bug_type": "
|
| 225 |
"failure_symptoms": "infinite loop"
|
| 226 |
},
|
| 227 |
{
|
|
@@ -236,12 +236,12 @@
|
|
| 236 |
},
|
| 237 |
{
|
| 238 |
"buggy_solution": " l = sorted(l)\n if len(l) % 2 == 1:\n return l[len(l) // 2]\n else:\n return (l[len(l) - 1 // 2] + l[len(l) // 2]) / 2.0\n",
|
| 239 |
-
"bug_type": "
|
| 240 |
"failure_symptoms": "incorrect output"
|
| 241 |
},
|
| 242 |
{
|
| 243 |
"buggy_solution": " for i in range(len(text)):\n if text[i] != text[len(text) - i]:\n return False\n return True\n",
|
| 244 |
-
"bug_type": "
|
| 245 |
"failure_symptoms": "incorrect output"
|
| 246 |
},
|
| 247 |
{
|
|
@@ -261,7 +261,7 @@
|
|
| 261 |
},
|
| 262 |
{
|
| 263 |
"buggy_solution": " for e in l:\n if e >= t:\n return True\n return False\n",
|
| 264 |
-
"bug_type": "
|
| 265 |
"failure_symptoms": "incorrect output"
|
| 266 |
},
|
| 267 |
{
|
|
@@ -281,12 +281,12 @@
|
|
| 281 |
},
|
| 282 |
{
|
| 283 |
"buggy_solution": " depth = 0\n for b in brackets:\n if b == \">\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0\n",
|
| 284 |
-
"bug_type": "
|
| 285 |
"failure_symptoms": "incorrect output"
|
| 286 |
},
|
| 287 |
{
|
| 288 |
"buggy_solution": " if l == sorted(l) or l == sorted(l, reverse=True):\n return False\n return True\n",
|
| 289 |
-
"bug_type": "
|
| 290 |
"failure_symptoms": "incorrect output"
|
| 291 |
},
|
| 292 |
{
|
|
@@ -296,27 +296,27 @@
|
|
| 296 |
},
|
| 297 |
{
|
| 298 |
"buggy_solution": " def is_prime(k):\n if k < 2:\n return False\n for i in range(2, k - 1):\n if k % i == 0:\n return False\n return True\n largest = 1\n for j in range(2, n):\n if n % j == 0 and is_prime(j):\n largest = max(largest, j)\n return largest\n",
|
| 299 |
-
"bug_type": "
|
| 300 |
"failure_symptoms": "incorrect output"
|
| 301 |
},
|
| 302 |
{
|
| 303 |
"buggy_solution": " return sum(range(n))\n",
|
| 304 |
-
"bug_type": "
|
| 305 |
"failure_symptoms": "incorrect output"
|
| 306 |
},
|
| 307 |
{
|
| 308 |
"buggy_solution": " depth = 0\n for b in brackets:\n if b == \"(\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return True\n return depth == 0\n",
|
| 309 |
-
"bug_type": "
|
| 310 |
"failure_symptoms": "incorrect output"
|
| 311 |
},
|
| 312 |
{
|
| 313 |
"buggy_solution": " return [(i * x) for i, x in enumerate(xs)]\n",
|
| 314 |
-
"bug_type": "
|
| 315 |
"failure_symptoms": "incorrect output"
|
| 316 |
},
|
| 317 |
{
|
| 318 |
"buggy_solution": " if n == 0:\n return 0\n if n == 1:\n return 1\n if n == 2:\n return 2\n return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)\n",
|
| 319 |
-
"bug_type": "
|
| 320 |
"failure_symptoms": "incorrect output"
|
| 321 |
},
|
| 322 |
{
|
|
@@ -336,7 +336,7 @@
|
|
| 336 |
},
|
| 337 |
{
|
| 338 |
"buggy_solution": " lis = list()\n for i in s.split(' '):\n if i.isdigit():\n lis.append(int(i))\n return n - sum(lis) - 1\n",
|
| 339 |
-
"bug_type": "
|
| 340 |
"failure_symptoms": "incorrect output"
|
| 341 |
},
|
| 342 |
{
|
|
@@ -346,12 +346,12 @@
|
|
| 346 |
},
|
| 347 |
{
|
| 348 |
"buggy_solution": " frq = [0] * (max(lst) + 1)\n for i in lst:\n frq[i] += 1;\n\n ans = 0\n for i in range(1, len(frq)):\n if frq[i] >= i:\n ans = i\n \n return ans\n",
|
| 349 |
-
"bug_type": "
|
| 350 |
"failure_symptoms": "incorrect output"
|
| 351 |
},
|
| 352 |
{
|
| 353 |
"buggy_solution": " res, switch = [], False\n while lst:\n res.append(min(lst) if switch else max(lst))\n lst.remove(res[-1])\n switch = not switch\n return res\n",
|
| 354 |
-
"bug_type": "
|
| 355 |
"failure_symptoms": "incorrect output"
|
| 356 |
},
|
| 357 |
{
|
|
@@ -361,7 +361,7 @@
|
|
| 361 |
},
|
| 362 |
{
|
| 363 |
"buggy_solution": " if sum(q) > w:\n return False\n\n i, j = 0, len(q)-1\n while i<j:\n if q[i] == q[j]:\n return False\n i+=1\n j-=1\n return True\n",
|
| 364 |
-
"bug_type": "
|
| 365 |
"failure_symptoms": "incorrect output"
|
| 366 |
},
|
| 367 |
{
|
|
@@ -376,7 +376,7 @@
|
|
| 376 |
},
|
| 377 |
{
|
| 378 |
"buggy_solution": " def is_prime(n):\n for j in range(0,n):\n if n%j == 0:\n return False\n return True\n\n for i in range(2,101):\n if not is_prime(i): continue\n for j in range(2,101):\n if not is_prime(j): continue\n for k in range(2,101):\n if not is_prime(k): continue\n if i*j*k == a: return True\n return False\n",
|
| 379 |
-
"bug_type": "
|
| 380 |
"failure_symptoms": "incorrect output"
|
| 381 |
},
|
| 382 |
{
|
|
@@ -391,7 +391,7 @@
|
|
| 391 |
},
|
| 392 |
{
|
| 393 |
"buggy_solution": " primes = ('2', '3', '5', '7', 'B', 'D')\n total = 1\n for i in range(0, len(num)):\n if num[i] in primes:\n total += 1\n return total\n",
|
| 394 |
-
"bug_type": "
|
| 395 |
"failure_symptoms": "incorrect output"
|
| 396 |
},
|
| 397 |
{
|
|
@@ -401,7 +401,7 @@
|
|
| 401 |
},
|
| 402 |
{
|
| 403 |
"buggy_solution": " if len(s) < 3:\n return False\n\n for i in range(len(s) - 2):\n \n if s[i] == s[i+1] and s[i+1] == s[i+2] and s[i] == s[i+2]:\n return False\n return True\n",
|
| 404 |
-
"bug_type": "
|
| 405 |
"failure_symptoms": "incorrect output"
|
| 406 |
},
|
| 407 |
{
|
|
@@ -411,7 +411,7 @@
|
|
| 411 |
},
|
| 412 |
{
|
| 413 |
"buggy_solution": " l = len(string)\n if l == 0 or l == 1:\n return False\n for i in range(3, l):\n if l % i == 0:\n return False\n return True\n",
|
| 414 |
-
"bug_type": "
|
| 415 |
"failure_symptoms": "incorrect output"
|
| 416 |
},
|
| 417 |
{
|
|
@@ -421,12 +421,12 @@
|
|
| 421 |
},
|
| 422 |
{
|
| 423 |
"buggy_solution": " return bin([int(i) for i in str(N)][-1])[2:]\n",
|
| 424 |
-
"bug_type": "
|
| 425 |
"failure_symptoms": "incorrect output"
|
| 426 |
},
|
| 427 |
{
|
| 428 |
"buggy_solution": " return sum([lst[i] for i in range(1, len(lst), 1) if lst[i]%2 == 0])\n",
|
| 429 |
-
"bug_type": "
|
| 430 |
"failure_symptoms": "incorrect output"
|
| 431 |
},
|
| 432 |
{
|
|
@@ -441,7 +441,7 @@
|
|
| 441 |
},
|
| 442 |
{
|
| 443 |
"buggy_solution": " return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 != 0) \n",
|
| 444 |
-
"bug_type": "
|
| 445 |
"failure_symptoms": "incorrect output"
|
| 446 |
},
|
| 447 |
{
|
|
@@ -471,12 +471,12 @@
|
|
| 471 |
},
|
| 472 |
{
|
| 473 |
"buggy_solution": " def isPrime(n):\n for i in range(2,int(n**0.5)+1):\n if n%i==0:\n return True\n\n return False\n maxx = 0\n i = 0\n while i < len(lst):\n if(lst[i] > maxx and isPrime(lst[i])):\n maxx = lst[i]\n i+=1\n result = sum(int(digit) for digit in str(maxx))\n return result\n\n",
|
| 474 |
-
"bug_type": "
|
| 475 |
"failure_symptoms": "incorrect output"
|
| 476 |
},
|
| 477 |
{
|
| 478 |
"buggy_solution": " if len(dict.keys()) == 0:\n return False\n else:\n state = \"start\"\n for key in dict.keys():\n\n if isinstance(key, str) == False:\n state = \"mixed\"\n break\n if state == \"start\":\n if key.isupper():\n state = \"upper\"\n elif key.islower():\n state = \"lower\"\n else:\n break\n elif (state == \"upper\" and not key.isupper()) and (state == \"lower\" and not key.islower()):\n state = \"mixed\"\n break\n else:\n break\n return state == \"upper\" or state == \"lower\" \n",
|
| 479 |
-
"bug_type": "
|
| 480 |
"failure_symptoms": "incorrect output"
|
| 481 |
},
|
| 482 |
{
|
|
@@ -491,7 +491,7 @@
|
|
| 491 |
},
|
| 492 |
{
|
| 493 |
"buggy_solution": " count = 0\n for i in range(0,len(s),2):\n if s[i] in \"AEIOU\":\n count += 2\n return count\n",
|
| 494 |
-
"bug_type": "
|
| 495 |
"failure_symptoms": "incorrect output"
|
| 496 |
},
|
| 497 |
{
|
|
@@ -516,7 +516,7 @@
|
|
| 516 |
},
|
| 517 |
{
|
| 518 |
"buggy_solution": " if m < n:\n return -1\n summation = 0\n for i in range(n, m+1):\n summation += i\n return bin(round(summation/(m - n)))\n",
|
| 519 |
-
"bug_type": "
|
| 520 |
"failure_symptoms": "incorrect output"
|
| 521 |
},
|
| 522 |
{
|
|
@@ -536,7 +536,7 @@
|
|
| 536 |
},
|
| 537 |
{
|
| 538 |
"buggy_solution": " def is_palindrome(n):\n return str(n) == str(n)[::-1]\n\n even_palindrome_count = 0\n odd_palindrome_count = 0\n\n for i in range(1, n):\n if i%2 == 1 and is_palindrome(i):\n odd_palindrome_count += 1\n elif i%2 == 0 and is_palindrome(i):\n even_palindrome_count += 1\n return (even_palindrome_count, odd_palindrome_count)\n",
|
| 539 |
-
"bug_type": "
|
| 540 |
"failure_symptoms": "incorrect output"
|
| 541 |
},
|
| 542 |
{
|
|
@@ -556,12 +556,12 @@
|
|
| 556 |
},
|
| 557 |
{
|
| 558 |
"buggy_solution": " dict1={}\n list1=test.split(\" \")\n t=1\n\n for i in list1:\n if(list1.count(i)>t) and i!='':\n t=list1.count(i)\n if t>0:\n for i in list1:\n if(list1.count(i)==t):\n \n dict1[i]=t\n return dict1\n",
|
| 559 |
-
"bug_type": "
|
| 560 |
"failure_symptoms": "incorrect output"
|
| 561 |
},
|
| 562 |
{
|
| 563 |
"buggy_solution": " s = ''.join([char for char in s if char not in c])\n return (s,s[::-1] != s)\n",
|
| 564 |
-
"bug_type": "
|
| 565 |
"failure_symptoms": "incorrect output"
|
| 566 |
},
|
| 567 |
{
|
|
@@ -586,7 +586,7 @@
|
|
| 586 |
},
|
| 587 |
{
|
| 588 |
"buggy_solution": " result = []\n for word in s.split():\n n_consonants = 0\n for i in range(0, len(word)):\n if word[i].lower() in [\"a\",\"e\",\"i\",\"o\",\"u\"]:\n n_consonants += 1 \n if n_consonants == n:\n result.append(word)\n return result\n\n",
|
| 589 |
-
"bug_type": "
|
| 590 |
"failure_symptoms": "incorrect output"
|
| 591 |
},
|
| 592 |
{
|
|
@@ -606,7 +606,7 @@
|
|
| 606 |
},
|
| 607 |
{
|
| 608 |
"buggy_solution": " return sum([x for idx, x in enumerate(lst) if idx%2==1 and x%2==1])\n",
|
| 609 |
-
"bug_type": "
|
| 610 |
"failure_symptoms": "incorrect output"
|
| 611 |
},
|
| 612 |
{
|
|
@@ -616,7 +616,7 @@
|
|
| 616 |
},
|
| 617 |
{
|
| 618 |
"buggy_solution": " if n%2==0:\n odd_collatz = [] \n else:\n odd_collatz = [n]\n while n > 1:\n if n % 2 == 0:\n n = n/2\n else:\n n = n*2 + 1\n \n if n%2 == 1:\n odd_collatz.append(int(n))\n\n return sorted(odd_collatz)\n",
|
| 619 |
-
"bug_type": "
|
| 620 |
"failure_symptoms": "incorrect output"
|
| 621 |
},
|
| 622 |
{
|
|
@@ -666,7 +666,7 @@
|
|
| 666 |
},
|
| 667 |
{
|
| 668 |
"buggy_solution": " import math\n squared = 0\n for i in lst:\n squared += math.ceil(i)*2\n return squared\n",
|
| 669 |
-
"bug_type": "
|
| 670 |
"failure_symptoms": "incorrect output"
|
| 671 |
},
|
| 672 |
{
|
|
@@ -816,7 +816,7 @@
|
|
| 816 |
},
|
| 817 |
{
|
| 818 |
"buggy_solution": " lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n\n return [i for i in range(lower, upper) if i % 2 == 0]\n",
|
| 819 |
-
"bug_type": "
|
| 820 |
"failure_symptoms": "incorrect output"
|
| 821 |
}
|
| 822 |
]
|
|
|
|
| 6 |
},
|
| 7 |
{
|
| 8 |
"buggy_solution": " result = []\n current_string = []\n current_depth = 0\n\n for c in paren_string:\n if c == '(':\n current_depth += 1\n current_string.append(c)\n elif c == ')':\n current_depth -= 1\n current_string.append(c)\n\n if current_depth < 0:\n result.append(''.join(current_string))\n current_string.clear()\n\n return result\n",
|
| 9 |
+
"bug_type": "operator misuse",
|
| 10 |
"failure_symptoms": "incorrect output"
|
| 11 |
},
|
| 12 |
{
|
|
|
|
| 16 |
},
|
| 17 |
{
|
| 18 |
"buggy_solution": " balance = 0\n\n for op in operations:\n balance += op\n if balance == 0:\n return True\n\n return False\n",
|
| 19 |
+
"bug_type": "operator misuse",
|
| 20 |
"failure_symptoms": "incorrect output"
|
| 21 |
},
|
| 22 |
{
|
|
|
|
| 61 |
},
|
| 62 |
{
|
| 63 |
"buggy_solution": " if not strings:\n return None\n\n maxlen = max(len(x) for x in strings)\n for s in strings:\n if len(s) > maxlen:\n return s\n",
|
| 64 |
+
"bug_type": "operator misuse",
|
| 65 |
"failure_symptoms": "incorrect output"
|
| 66 |
},
|
| 67 |
{
|
|
|
|
| 76 |
},
|
| 77 |
{
|
| 78 |
"buggy_solution": " return ' '.join([str(x) for x in range(n)])\n",
|
| 79 |
+
"bug_type": "value misuse",
|
| 80 |
"failure_symptoms": "incorrect output"
|
| 81 |
},
|
| 82 |
{
|
|
|
|
| 91 |
},
|
| 92 |
{
|
| 93 |
"buggy_solution": " times = 0\n\n for i in range(len(string) - len(substring)):\n if string[i:i+len(substring)] == substring:\n times += 1\n\n return times\n",
|
| 94 |
+
"bug_type": "value misuse",
|
| 95 |
"failure_symptoms": "incorrect output"
|
| 96 |
},
|
| 97 |
{
|
|
|
|
| 101 |
},
|
| 102 |
{
|
| 103 |
"buggy_solution": " closest_pair = None\n distance = None\n\n for idx, elem in enumerate(numbers):\n for idx2, elem2 in enumerate(numbers):\n if idx != idx2:\n if distance is None:\n distance = abs(elem - elem2)\n closest_pair = tuple(sorted([elem, elem2]))\n else:\n new_distance = abs(elem - elem2)\n if new_distance > distance:\n distance = new_distance\n closest_pair = tuple(sorted([elem, elem2]))\n\n return closest_pair\n",
|
| 104 |
+
"bug_type": "operator misuse",
|
| 105 |
"failure_symptoms": "incorrect output"
|
| 106 |
},
|
| 107 |
{
|
| 108 |
"buggy_solution": " min_number = min(numbers)\n max_number = max(numbers)\n return [(x - min_number) / (max_number + min_number) for x in numbers]\n",
|
| 109 |
+
"bug_type": "operator misuse",
|
| 110 |
"failure_symptoms": "incorrect output"
|
| 111 |
},
|
| 112 |
{
|
|
|
|
| 116 |
},
|
| 117 |
{
|
| 118 |
"buggy_solution": " return len(string) - 1\n",
|
| 119 |
+
"bug_type": "value misuse",
|
| 120 |
"failure_symptoms": "incorrect output"
|
| 121 |
},
|
| 122 |
{
|
| 123 |
"buggy_solution": " for i in reversed(range(n)):\n if n - i == 0:\n return i\n",
|
| 124 |
+
"bug_type": "operator misuse",
|
| 125 |
"failure_symptoms": "incorrect output"
|
| 126 |
},
|
| 127 |
{
|
|
|
|
| 131 |
},
|
| 132 |
{
|
| 133 |
"buggy_solution": " import collections\n c = collections.Counter(numbers)\n return [n for n in numbers if c[n] < 1]\n",
|
| 134 |
+
"bug_type": "operator misuse",
|
| 135 |
"failure_symptoms": "incorrect output"
|
| 136 |
},
|
| 137 |
{
|
|
|
|
| 151 |
},
|
| 152 |
{
|
| 153 |
"buggy_solution": " return [e for e in l if e < 0]\n",
|
| 154 |
+
"bug_type": "operator misuse",
|
| 155 |
"failure_symptoms": "incorrect output"
|
| 156 |
},
|
| 157 |
{
|
| 158 |
"buggy_solution": " if n < 1:\n return False\n for k in range(1, n - 1):\n if n % k == 0:\n return False\n return True\n",
|
| 159 |
+
"bug_type": "value misuse",
|
| 160 |
"failure_symptoms": "incorrect output"
|
| 161 |
},
|
| 162 |
{
|
|
|
|
| 176 |
},
|
| 177 |
{
|
| 178 |
"buggy_solution": " m = l[0]\n for e in l:\n if e < m:\n m = e\n return m\n",
|
| 179 |
+
"bug_type": "operator misuse",
|
| 180 |
"failure_symptoms": "incorrect output"
|
| 181 |
},
|
| 182 |
{
|
| 183 |
"buggy_solution": " ns = []\n for i in range(n):\n if i % 11 == 0 and i % 13 == 0:\n ns.append(i)\n s = ''.join(list(map(str, ns)))\n ans = 0\n for c in s:\n ans += (c == '7')\n return ans\n",
|
| 184 |
+
"bug_type": "operator misuse",
|
| 185 |
"failure_symptoms": "incorrect output"
|
| 186 |
},
|
| 187 |
{
|
|
|
|
| 196 |
},
|
| 197 |
{
|
| 198 |
"buggy_solution": " import math\n\n def is_prime(p):\n if p < 2:\n return False\n for k in range(2, min(int(math.sqrt(p)), p)):\n if p % k == 0:\n return False\n return True\n f = [0, 1]\n while True:\n f.append(f[-1] + f[-2])\n if is_prime(f[-1]):\n n -= 1\n if n == 0:\n return f[-1]\n",
|
| 199 |
+
"bug_type": "value misuse",
|
| 200 |
"failure_symptoms": "incorrect output"
|
| 201 |
},
|
| 202 |
{
|
|
|
|
| 216 |
},
|
| 217 |
{
|
| 218 |
"buggy_solution": " for i, l1 in enumerate(l):\n for j in range(i, len(l)):\n if l1 + l[j] == 0:\n return True\n return False\n",
|
| 219 |
+
"bug_type": "value misuse",
|
| 220 |
"failure_symptoms": "incorrect output"
|
| 221 |
},
|
| 222 |
{
|
| 223 |
"buggy_solution": " ret = \"\"\n while x > 0:\n ret = str(x % base) + ret\n x -= base\n return ret\n",
|
| 224 |
+
"bug_type": "operator misuse",
|
| 225 |
"failure_symptoms": "infinite loop"
|
| 226 |
},
|
| 227 |
{
|
|
|
|
| 236 |
},
|
| 237 |
{
|
| 238 |
"buggy_solution": " l = sorted(l)\n if len(l) % 2 == 1:\n return l[len(l) // 2]\n else:\n return (l[len(l) - 1 // 2] + l[len(l) // 2]) / 2.0\n",
|
| 239 |
+
"bug_type": "value misuse",
|
| 240 |
"failure_symptoms": "incorrect output"
|
| 241 |
},
|
| 242 |
{
|
| 243 |
"buggy_solution": " for i in range(len(text)):\n if text[i] != text[len(text) - i]:\n return False\n return True\n",
|
| 244 |
+
"bug_type": "value misuse",
|
| 245 |
"failure_symptoms": "incorrect output"
|
| 246 |
},
|
| 247 |
{
|
|
|
|
| 261 |
},
|
| 262 |
{
|
| 263 |
"buggy_solution": " for e in l:\n if e >= t:\n return True\n return False\n",
|
| 264 |
+
"bug_type": "operator misuse",
|
| 265 |
"failure_symptoms": "incorrect output"
|
| 266 |
},
|
| 267 |
{
|
|
|
|
| 281 |
},
|
| 282 |
{
|
| 283 |
"buggy_solution": " depth = 0\n for b in brackets:\n if b == \">\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return False\n return depth == 0\n",
|
| 284 |
+
"bug_type": "operator misuse",
|
| 285 |
"failure_symptoms": "incorrect output"
|
| 286 |
},
|
| 287 |
{
|
| 288 |
"buggy_solution": " if l == sorted(l) or l == sorted(l, reverse=True):\n return False\n return True\n",
|
| 289 |
+
"bug_type": "operator misuse",
|
| 290 |
"failure_symptoms": "incorrect output"
|
| 291 |
},
|
| 292 |
{
|
|
|
|
| 296 |
},
|
| 297 |
{
|
| 298 |
"buggy_solution": " def is_prime(k):\n if k < 2:\n return False\n for i in range(2, k - 1):\n if k % i == 0:\n return False\n return True\n largest = 1\n for j in range(2, n):\n if n % j == 0 and is_prime(j):\n largest = max(largest, j)\n return largest\n",
|
| 299 |
+
"bug_type": "value misuse",
|
| 300 |
"failure_symptoms": "incorrect output"
|
| 301 |
},
|
| 302 |
{
|
| 303 |
"buggy_solution": " return sum(range(n))\n",
|
| 304 |
+
"bug_type": "value misuse",
|
| 305 |
"failure_symptoms": "incorrect output"
|
| 306 |
},
|
| 307 |
{
|
| 308 |
"buggy_solution": " depth = 0\n for b in brackets:\n if b == \"(\":\n depth += 1\n else:\n depth -= 1\n if depth < 0:\n return True\n return depth == 0\n",
|
| 309 |
+
"bug_type": "operator misuse",
|
| 310 |
"failure_symptoms": "incorrect output"
|
| 311 |
},
|
| 312 |
{
|
| 313 |
"buggy_solution": " return [(i * x) for i, x in enumerate(xs)]\n",
|
| 314 |
+
"bug_type": "value misuse",
|
| 315 |
"failure_symptoms": "incorrect output"
|
| 316 |
},
|
| 317 |
{
|
| 318 |
"buggy_solution": " if n == 0:\n return 0\n if n == 1:\n return 1\n if n == 2:\n return 2\n return fibfib(n - 1) + fibfib(n - 2) + fibfib(n - 3)\n",
|
| 319 |
+
"bug_type": "value misuse",
|
| 320 |
"failure_symptoms": "incorrect output"
|
| 321 |
},
|
| 322 |
{
|
|
|
|
| 336 |
},
|
| 337 |
{
|
| 338 |
"buggy_solution": " lis = list()\n for i in s.split(' '):\n if i.isdigit():\n lis.append(int(i))\n return n - sum(lis) - 1\n",
|
| 339 |
+
"bug_type": "value misuse",
|
| 340 |
"failure_symptoms": "incorrect output"
|
| 341 |
},
|
| 342 |
{
|
|
|
|
| 346 |
},
|
| 347 |
{
|
| 348 |
"buggy_solution": " frq = [0] * (max(lst) + 1)\n for i in lst:\n frq[i] += 1;\n\n ans = 0\n for i in range(1, len(frq)):\n if frq[i] >= i:\n ans = i\n \n return ans\n",
|
| 349 |
+
"bug_type": "value misuse",
|
| 350 |
"failure_symptoms": "incorrect output"
|
| 351 |
},
|
| 352 |
{
|
| 353 |
"buggy_solution": " res, switch = [], False\n while lst:\n res.append(min(lst) if switch else max(lst))\n lst.remove(res[-1])\n switch = not switch\n return res\n",
|
| 354 |
+
"bug_type": "operator misuse",
|
| 355 |
"failure_symptoms": "incorrect output"
|
| 356 |
},
|
| 357 |
{
|
|
|
|
| 361 |
},
|
| 362 |
{
|
| 363 |
"buggy_solution": " if sum(q) > w:\n return False\n\n i, j = 0, len(q)-1\n while i<j:\n if q[i] == q[j]:\n return False\n i+=1\n j-=1\n return True\n",
|
| 364 |
+
"bug_type": "operator misuse",
|
| 365 |
"failure_symptoms": "incorrect output"
|
| 366 |
},
|
| 367 |
{
|
|
|
|
| 376 |
},
|
| 377 |
{
|
| 378 |
"buggy_solution": " def is_prime(n):\n for j in range(0,n):\n if n%j == 0:\n return False\n return True\n\n for i in range(2,101):\n if not is_prime(i): continue\n for j in range(2,101):\n if not is_prime(j): continue\n for k in range(2,101):\n if not is_prime(k): continue\n if i*j*k == a: return True\n return False\n",
|
| 379 |
+
"bug_type": "value misuse",
|
| 380 |
"failure_symptoms": "incorrect output"
|
| 381 |
},
|
| 382 |
{
|
|
|
|
| 391 |
},
|
| 392 |
{
|
| 393 |
"buggy_solution": " primes = ('2', '3', '5', '7', 'B', 'D')\n total = 1\n for i in range(0, len(num)):\n if num[i] in primes:\n total += 1\n return total\n",
|
| 394 |
+
"bug_type": "value misuse",
|
| 395 |
"failure_symptoms": "incorrect output"
|
| 396 |
},
|
| 397 |
{
|
|
|
|
| 401 |
},
|
| 402 |
{
|
| 403 |
"buggy_solution": " if len(s) < 3:\n return False\n\n for i in range(len(s) - 2):\n \n if s[i] == s[i+1] and s[i+1] == s[i+2] and s[i] == s[i+2]:\n return False\n return True\n",
|
| 404 |
+
"bug_type": "operator misuse",
|
| 405 |
"failure_symptoms": "incorrect output"
|
| 406 |
},
|
| 407 |
{
|
|
|
|
| 411 |
},
|
| 412 |
{
|
| 413 |
"buggy_solution": " l = len(string)\n if l == 0 or l == 1:\n return False\n for i in range(3, l):\n if l % i == 0:\n return False\n return True\n",
|
| 414 |
+
"bug_type": "value misuse",
|
| 415 |
"failure_symptoms": "incorrect output"
|
| 416 |
},
|
| 417 |
{
|
|
|
|
| 421 |
},
|
| 422 |
{
|
| 423 |
"buggy_solution": " return bin([int(i) for i in str(N)][-1])[2:]\n",
|
| 424 |
+
"bug_type": "operator misuse",
|
| 425 |
"failure_symptoms": "incorrect output"
|
| 426 |
},
|
| 427 |
{
|
| 428 |
"buggy_solution": " return sum([lst[i] for i in range(1, len(lst), 1) if lst[i]%2 == 0])\n",
|
| 429 |
+
"bug_type": "value misuse",
|
| 430 |
"failure_symptoms": "incorrect output"
|
| 431 |
},
|
| 432 |
{
|
|
|
|
| 441 |
},
|
| 442 |
{
|
| 443 |
"buggy_solution": " return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 != 0) \n",
|
| 444 |
+
"bug_type": "operator misuse",
|
| 445 |
"failure_symptoms": "incorrect output"
|
| 446 |
},
|
| 447 |
{
|
|
|
|
| 471 |
},
|
| 472 |
{
|
| 473 |
"buggy_solution": " def isPrime(n):\n for i in range(2,int(n**0.5)+1):\n if n%i==0:\n return True\n\n return False\n maxx = 0\n i = 0\n while i < len(lst):\n if(lst[i] > maxx and isPrime(lst[i])):\n maxx = lst[i]\n i+=1\n result = sum(int(digit) for digit in str(maxx))\n return result\n\n",
|
| 474 |
+
"bug_type": "operator misuse",
|
| 475 |
"failure_symptoms": "incorrect output"
|
| 476 |
},
|
| 477 |
{
|
| 478 |
"buggy_solution": " if len(dict.keys()) == 0:\n return False\n else:\n state = \"start\"\n for key in dict.keys():\n\n if isinstance(key, str) == False:\n state = \"mixed\"\n break\n if state == \"start\":\n if key.isupper():\n state = \"upper\"\n elif key.islower():\n state = \"lower\"\n else:\n break\n elif (state == \"upper\" and not key.isupper()) and (state == \"lower\" and not key.islower()):\n state = \"mixed\"\n break\n else:\n break\n return state == \"upper\" or state == \"lower\" \n",
|
| 479 |
+
"bug_type": "operator misuse",
|
| 480 |
"failure_symptoms": "incorrect output"
|
| 481 |
},
|
| 482 |
{
|
|
|
|
| 491 |
},
|
| 492 |
{
|
| 493 |
"buggy_solution": " count = 0\n for i in range(0,len(s),2):\n if s[i] in \"AEIOU\":\n count += 2\n return count\n",
|
| 494 |
+
"bug_type": "value misuse",
|
| 495 |
"failure_symptoms": "incorrect output"
|
| 496 |
},
|
| 497 |
{
|
|
|
|
| 516 |
},
|
| 517 |
{
|
| 518 |
"buggy_solution": " if m < n:\n return -1\n summation = 0\n for i in range(n, m+1):\n summation += i\n return bin(round(summation/(m - n)))\n",
|
| 519 |
+
"bug_type": "value misuse",
|
| 520 |
"failure_symptoms": "incorrect output"
|
| 521 |
},
|
| 522 |
{
|
|
|
|
| 536 |
},
|
| 537 |
{
|
| 538 |
"buggy_solution": " def is_palindrome(n):\n return str(n) == str(n)[::-1]\n\n even_palindrome_count = 0\n odd_palindrome_count = 0\n\n for i in range(1, n):\n if i%2 == 1 and is_palindrome(i):\n odd_palindrome_count += 1\n elif i%2 == 0 and is_palindrome(i):\n even_palindrome_count += 1\n return (even_palindrome_count, odd_palindrome_count)\n",
|
| 539 |
+
"bug_type": "value misuse",
|
| 540 |
"failure_symptoms": "incorrect output"
|
| 541 |
},
|
| 542 |
{
|
|
|
|
| 556 |
},
|
| 557 |
{
|
| 558 |
"buggy_solution": " dict1={}\n list1=test.split(\" \")\n t=1\n\n for i in list1:\n if(list1.count(i)>t) and i!='':\n t=list1.count(i)\n if t>0:\n for i in list1:\n if(list1.count(i)==t):\n \n dict1[i]=t\n return dict1\n",
|
| 559 |
+
"bug_type": "value misuse",
|
| 560 |
"failure_symptoms": "incorrect output"
|
| 561 |
},
|
| 562 |
{
|
| 563 |
"buggy_solution": " s = ''.join([char for char in s if char not in c])\n return (s,s[::-1] != s)\n",
|
| 564 |
+
"bug_type": "operator misuse",
|
| 565 |
"failure_symptoms": "incorrect output"
|
| 566 |
},
|
| 567 |
{
|
|
|
|
| 586 |
},
|
| 587 |
{
|
| 588 |
"buggy_solution": " result = []\n for word in s.split():\n n_consonants = 0\n for i in range(0, len(word)):\n if word[i].lower() in [\"a\",\"e\",\"i\",\"o\",\"u\"]:\n n_consonants += 1 \n if n_consonants == n:\n result.append(word)\n return result\n\n",
|
| 589 |
+
"bug_type": "operator misuse",
|
| 590 |
"failure_symptoms": "incorrect output"
|
| 591 |
},
|
| 592 |
{
|
|
|
|
| 606 |
},
|
| 607 |
{
|
| 608 |
"buggy_solution": " return sum([x for idx, x in enumerate(lst) if idx%2==1 and x%2==1])\n",
|
| 609 |
+
"bug_type": "value misuse",
|
| 610 |
"failure_symptoms": "incorrect output"
|
| 611 |
},
|
| 612 |
{
|
|
|
|
| 616 |
},
|
| 617 |
{
|
| 618 |
"buggy_solution": " if n%2==0:\n odd_collatz = [] \n else:\n odd_collatz = [n]\n while n > 1:\n if n % 2 == 0:\n n = n/2\n else:\n n = n*2 + 1\n \n if n%2 == 1:\n odd_collatz.append(int(n))\n\n return sorted(odd_collatz)\n",
|
| 619 |
+
"bug_type": "value misuse",
|
| 620 |
"failure_symptoms": "incorrect output"
|
| 621 |
},
|
| 622 |
{
|
|
|
|
| 666 |
},
|
| 667 |
{
|
| 668 |
"buggy_solution": " import math\n squared = 0\n for i in lst:\n squared += math.ceil(i)*2\n return squared\n",
|
| 669 |
+
"bug_type": "operator misuse",
|
| 670 |
"failure_symptoms": "incorrect output"
|
| 671 |
},
|
| 672 |
{
|
|
|
|
| 816 |
},
|
| 817 |
{
|
| 818 |
"buggy_solution": " lower = max(2, min(a, b))\n upper = min(8, max(a, b))\n\n return [i for i in range(lower, upper) if i % 2 == 0]\n",
|
| 819 |
+
"bug_type": "value misuse",
|
| 820 |
"failure_symptoms": "incorrect output"
|
| 821 |
}
|
| 822 |
]
|