Commit ·
03beb0e
1
Parent(s): 651a747
Standardize naming (off-by-one -> value misuse)
Browse files5 unmodified lines67891011123 unmodified lines1617181920212238 unmodified lines616263646566678 unmodified lines767778798081828 unmodified lines919293949596973 unmodified lines1011021031041051061071081091101111123 unmodified lines1161171181191201211221231241251261273 unmodified lines13113213313413513613713 unmodified lines15115215315415515615715815916016116213 unmodified lines1761771781791801811821831841851861878 unmodified lines19619719819920020120213 unmodified lines2162172182192202212222232242252262278 unmodified lines23623723823924024124224324424524624713 unmodified lines26126226326426526626713 unmodified lines2812822832842852862872882892902912923 unmodified lines29629729829930030130230330430530630730830931031131231331431531631731831932032132213 unmodified lines3363373383393403413423 unmodified lines3463473483493503513523533543553563573 unmodified lines3613623633643653663678 unmodified lines3763773783793803813828 unmodified lines3913923933943953963973 unmodified lines4014024034044054064073 unmodified lines4114124134144154164173 unmodified lines4214224234244254264274284294304314328 unmodified lines44144244344444544644723 unmodified lines4714724734744754764774784794804814828 unmodified lines49149249349449549649718 unmodified lines51651751851952052152213 unmodified lines53653753853954054154213 unmodified lines55655755855956056156256356456556656718 unmodified lines58658758858959059159213 unmodified lines6066076086096106116123 unmodified lines61661761861962062162243 unmodified lines666667668669670671672143 unmodified lines8168178188198208218225 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{38 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{8 unmodified lines},{"buggy_solution": " return ' '.join([str(x) for x in range(n)])\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{3 unmodified lines},{"buggy_solution": " return len(string) - 1\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"buggy_solution": " for i in reversed(range(n)):\n if n - i == 0:\n return i\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{3 unmodified lines},{"buggy_solution": " import collections\n c = collections.Counter(numbers)\n return [n for n in numbers if c[n] < 1]\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " return [e for e in l if e < 0]\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " m = l[0]\n for e in l:\n if e < m:\n m = e\n return m\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"buggy_solution": " ret = \"\"\n while x > 0:\n ret = str(x % base) + ret\n x -= base\n return ret\n","bug_type": "binary operator","failure_symptoms": "infinite loop"},{8 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"buggy_solution": " for i in range(len(text)):\n if text[i] != text[len(text) - i]:\n return False\n return True\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " for e in l:\n if e >= t:\n return True\n return False\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"buggy_solution": " if l == sorted(l) or l == sorted(l, reverse=True):\n return False\n return True\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"buggy_solution": " return sum(range(n))\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"buggy_solution": " return [(i * x) for i, x in enumerate(xs)]\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{3 unmodified lines},{"buggy_solution": " return bin([int(i) for i in str(N)][-1])[2:]\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"buggy_solution": " return sum([lst[i] for i in range(1, len(lst), 1) if lst[i]%2 == 0])\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{8 unmodified lines},{"buggy_solution": " return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 != 0) \n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{23 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{18 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{"buggy_solution": " s = ''.join([char for char in s if char not in c])\n return (s,s[::-1] != s)\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{18 unmodified lines},{"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","bug_type": "binary operator","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " return sum([x for idx, x in enumerate(lst) if idx%2==1 and x%2==1])\n","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"},{43 unmodified lines},{"buggy_solution": " import math\n squared = 0\n for i in lst:\n squared += math.ceil(i)*2\n return squared\n","bug_type": "binary operator","failure_symptoms": "incorrect output"},{143 unmodified lines},{"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","bug_type": "off-by-one","failure_symptoms": "incorrect output"}]5 unmodified lines67891011123 unmodified lines1617181920212238 unmodified lines616263646566678 unmodified lines767778798081828 unmodified lines919293949596973 unmodified lines1011021031041051061071081091101111123 unmodified lines1161171181191201211221231241251261273 unmodified lines13113213313413513613713 unmodified lines15115215315415515615715815916016116213 unmodified lines1761771781791801811821831841851861878 unmodified lines19619719819920020120213 unmodified lines2162172182192202212222232242252262278 unmodified lines23623723823924024124224324424524624713 unmodified lines26126226326426526626713 unmodified lines2812822832842852862872882892902912923 unmodified lines29629729829930030130230330430530630730830931031131231331431531631731831932032132213 unmodified lines3363373383393403413423 unmodified lines3463473483493503513523533543553563573 unmodified lines3613623633643653663678 unmodified lines3763773783793803813828 unmodified lines3913923933943953963973 unmodified lines4014024034044054064073 unmodified lines4114124134144154164173 unmodified lines4214224234244254264274284294304314328 unmodified lines44144244344444544644723 unmodified lines4714724734744754764774784794804814828 unmodified lines49149249349449549649718 unmodified lines51651751851952052152213 unmodified lines53653753853954054154213 unmodified lines55655755855956056156256356456556656718 unmodified lines58658758858959059159213 unmodified lines6066076086096106116123 unmodified lines61661761861962062162243 unmodified lines666667668669670671672143 unmodified lines8168178188198208218225 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{38 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"buggy_solution": " return ' '.join([str(x) for x in range(n)])\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"buggy_solution": " return len(string) - 1\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " for i in reversed(range(n)):\n if n - i == 0:\n return i\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"buggy_solution": " import collections\n c = collections.Counter(numbers)\n return [n for n in numbers if c[n] < 1]\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " return [e for e in l if e < 0]\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " m = l[0]\n for e in l:\n if e < m:\n m = e\n return m\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " ret = \"\"\n while x > 0:\n ret = str(x % base) + ret\n x -= base\n return ret\n","bug_type": "operator misuse","failure_symptoms": "infinite loop"},{8 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " for i in range(len(text)):\n if text[i] != text[len(text) - i]:\n return False\n return True\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " for e in l:\n if e >= t:\n return True\n return False\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " if l == sorted(l) or l == sorted(l, reverse=True):\n return False\n return True\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " return sum(range(n))\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " return [(i * x) for i, x in enumerate(xs)]\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"buggy_solution": " return bin([int(i) for i in str(N)][-1])[2:]\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " return sum([lst[i] for i in range(1, len(lst), 1) if lst[i]%2 == 0])\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"buggy_solution": " return [] if len(array) == 0 else sorted(array, reverse= (array[0]+array[-1]) % 2 != 0) \n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{23 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{8 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{18 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{"buggy_solution": " s = ''.join([char for char in s if char not in c])\n return (s,s[::-1] != s)\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{18 unmodified lines},{"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","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{13 unmodified lines},{"buggy_solution": " return sum([x for idx, x in enumerate(lst) if idx%2==1 and x%2==1])\n","bug_type": "value misuse","failure_symptoms": "incorrect output"},{3 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"},{43 unmodified lines},{"buggy_solution": " import math\n squared = 0\n for i in lst:\n squared += math.ceil(i)*2\n return squared\n","bug_type": "operator misuse","failure_symptoms": "incorrect output"},{143 unmodified lines},{"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","bug_type": "value misuse","failure_symptoms": "incorrect output"}]
data/python/data/humanevalbugs.json+50-50