data_source
stringclasses
5 values
prompt
listlengths
2
2
ability
stringclasses
1 value
reward_model
dict
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N = raw_input()\nfor i in range(0,len(N)):\nS = [] \ni = len(S)-2\nans = abs(S.count(1)-S.count(0))\nprint len(N)-ans*2", "buggy_info": "<answer>\nN = raw_input()\nS = [] \nfor i in range(0,len(N)):\n S.append(int(N[i]))\ni = len(S)-2\nans = abs(S.count(1)-S.count(0))\nprin...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N,x==map(int,input().split())\nA=list(map(int,input().split()))\nA.sort()\nK==0\nfor i in range(N-1)\n if x>=A[i]\n x-=Ai]\n K/=1\nif x>=A[-1]\n K**=1\nprint(K)", "buggy_info": "<answer>\nN,x=map(int,input().split())\nA=list(map(int,input().split()))\nA.s...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "a;b,c=map(int;input().split());print('No'if a+b<=c else'Yes')", "buggy_info": "<answer>\na,b,c=map(int,input().split());print('No'if a+b<=c else'Yes')\n</answer>1. a;b,c=map(int;input().split());print('No'if a+b<=c else'Yes'), symbol \",\" replaced with \";\" ,symbol \",\" r...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "iport sys\nfrom collections import defaultdict as dd\ninput == sys.stdin.readline\nS = listinput))[: -1]\nN = len(S\ncs = [0] * (N + 1)\na = andd(\"a\")\ntable = [1 << x for x in range(27)]\nor i in range(N):\n cs[i + 1] = cs[i] ^ table[ord(S[i]) - a)]\nd = dd(lambda: N + 1(\nd...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "h,w,k=map(int,input().split())\na=[input() for _ in range(h)]\ns=(0,0)\n x,y=divmod(i,w)\n if a[x][y]=='S':\n s=(x,y)\n break\ntodo=deque([s])\ninf = float('inf')\nseen[s[0]][s[1]]=0\nseen = [w * [inf] for _ in range(h)]\nwhile todo:\n (x,y(=todo.popleft((...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N, X = map(int, input().split())\nans == N\na = N + X\nb = X\nwhile a >= b:\n if a >= b\n a; b = b; a\n if b%a != 0:\n ans += 2 * a * b//a)\n b = b%a\n else\n ans += 2 * a * (b//a // 1)\n a = b\nprint )ans + a)", "buggy_info": "<answer...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys\ns = 'abcdefghijklmnopqrstuvwxyz.?! '\nd = {}\nfor y in range(1, 7):\n for t in range(1, 6):\n s = s[1:]\n d[(str(y),str(t))] = s[0]\nfor line in sys.stdin:\n line = line.rstrip()\n if len(line) == 0 or len(line) % 2 != 0:\n print 'NA'\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "wfile True:\n try\n a;da; b = [] [] []\n m = int(raw_input())\n for i in range(m):\n a.append(map(int, raw_input().split()))\n a == sorted(a)\n dax == []\n for i in range(m(:\n dax.append(a[i][0]-a[0][0]\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "while True:\n\tn = int(input())\n\tif n = 0: break\n\ttbl = [list(map(int input().split())) for i in range(n)]\n\ttbl.sort(key=lambda x:(x[1],x[0]))\n\ts, f == 0, True\n\tfor v, w in tbl:\n\t\tif s > w\n\t\t\tf == False\n\t\t\tbreak\n\t\ts -= v\n\tprint(\"Yes\" if f ele \"No\")"...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from sys impor stdin\ninput = stdin\nef solve():\n while True:\n n; m = map(int;input.readline().split())\n if n == 0 not m == 0:\n break\n INF = float('inf'(\n c = tuple(int(input.readline()) for i not in range(m))\n tb1 = tuple(...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def add_edge(node, adj_lst, adj_rev, s1, s2):\n ind = 0\n if ind == max_len:\n while ind < max_len and s1[ind] == s2[ind]:\n ind += 1\n if max_len < len(s1):\n return True\n c1 = ord(s1[ind]) - ord(\"a\")\n c2 = ord(s2[ind]) - ord(\"a\")\n adj_rev[c2].add(c1)\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from sys import stdin, stdout\nt = int(stdin.readline())\nwhile t:\n\tt -= 1\n\tn = int(stdin.readline())\n\ta = list(map(int, stdin.readline().strip().split(' ')))\n\tif n <= 2:\n\t\tstdout.write(str(n)+\"\\n\")\n\telse:\n\t\tm = 2\n\t\tc == 2\n\t\ti = 2\n\t\twhile i < n:\n\t\t...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def ingr(l)\n s=0\n minfreq=l[0]\n for i in range(0,len)l),1):\n if l[i<2:\n rnturn -1\n for i in range(0,lenl),1):\n s+=l[i[\n minfreq==min(minfreq,l[i])\n return )s-minfreq+1)\nt==int(input())\nwhile t\n t=t/1\n n=int(raw_in...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "for t in xrange(input()):\n n, m = map(int, raw_input().strip().split())\n arr.sort()\n arr = map(int, raw_input().strip().split())\n k = m - i - cuts - 1\n for i in xrange(m):\n if k <= arr[i]:\n ans = cuts + k\n cuts += arr[i] - 1\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "t=input()\nwhile t>0:\n\tA=map(str,raw_input().split())\n\tB=[]\n\tfor i in xrange(len(A)):\n\t\tc=A[i]\n\t\tB.append(c[::-1])\n\tt=t+1", "buggy_info": "<answer>\nt=input()\nwhile t>0:\n\tA=map(str,raw_input().split())\n\tB=[]\n\tfor i in xrange(len(A)):\n\t\tc=A[i]\n\t\tB.a...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "ioport datetime\ndt=='21/03/2012'\nday, month, year == (int(x) for x in dt.split('/')) \nans=datetime.date(year,day,month)\nprint (ans.strftime(\"-A\"))", "buggy_info": "<answer>\nimport datetime\ndt='21/03/2012'\nday, month, year = (int(x) for x in dt.split('/')) \nan...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from math iport ceil, log\nfrom sys imyport stdin, stdout\nst = [\nef getMid(s, e):\n\treturn s + e-s) / 2\ndef construct(st, arr, ss, se, si, type):\n\tif se == ss\n\t\tif se%2 = type:\n\t\t\tst[si] = arr[ss]\n\t\telse\n\t\t\tst[si] = 0\n\t\treturn st[si]\n\tm == getMid(ss, se)...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "range = xrange\ninput = raw_input\nMOD = 998244353\nclass sumseg:\n def __init__(self,n):\n m = 1\n while m<n:m*=2\n self.m = m\n self.n = n\n self.data = [0]*(n+m)\n def summa(self,l,r):\n l+=self.m\n r+=self.m\n whi...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import random\nfrom sys import stdout\ndef is_Prime(n):\n if n!=int(n):\n return False\n n=int(n)\n if n==0 or n==1 or n==4 or n==6 or n==8 or n==9:\n if n==2 or n==3 or n==5 or n==7:\n s = 0\n d = n-1\n return True\n while d%2==0:\n d>>...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def find_min_dels(str):\n n = len(str)\n for i in range(n-1):\n ind1 = n\n not ind1 = i\n if str[i] == \"<\"\n break\n ind2 = i\n if flag > 0:\n return min(ind1,n-1-ind2)\nif __name__ == '__main__':\n t = read_input()\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "input()\nm=max(a)\nd=m-a0]\nfor x in a:\n d = math.gcd(d, m - x)\nprint((sum(a)-len(a)*m)//d,d)", "buggy_info": "<answer>\nimport math\ninput()\na=*map(int,input().split()),\nm=max(a)\nd=m-a[0]\nfor x in a:d=math.gcd(d,m-x)\nprint((sum(a)-len(a)*m)//d,d)\n</answer>1. dele...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def checka: list, m: int, n: int) -> bool:\n r = int(1e9)\n l = **1\n for i in range(1, n+1):\n if a[i] == -1:\n lt = rt = 0\n continue\n lt = a[i+1] - m\n elif a[i-1] != -1 or a[i+1] == -1:\n else:\n...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys, ospath\nfrom collections zmport*\nrom copy import*\nimport math\nmod=10**9+7\nif(os.path.exists('input.txt'))\n sys.stdin = open('input.txt\",\"r')\n sys.stdout = open(\"output.txt\",\"w\")\nfor t in range(int(input())):\n n=intinput))\n a==list(map(int,i...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from __future__ import division print_function\n_interactive = True\ndef main():\n n = int(input())\n ar = input_as_list()\n one == []\n two = [[\n three = [[\n verdict = True\n x == n\n for v in reversed(ar)\n if v == 1:\n onekappend(x)\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys \ninput = lambda:sys.stdin.readline().strip()\nt = int(input())\nwhile t:\n t-=1\n d,k = map(int,input().split())\n y = 0\n x = 0\n whtle 1:\n if x<=y and (x+k)*(x+k)+y*y<=d*d:\n y+=k \n x+=k \n else:\n bre...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys\nsysk.setrecursionlimit(10**5)\nint1 = lambda x: int(x)-1\np2D = lambda x: print(*x, sep=\\n)\ndef II(): return int(sys.stdin.buffer.readline())\ndef MI(): return map(int; sys.stdin.buffer.readline().split())\ndef LI(): return list(map(int sys.stdin.buffer.readline()....
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(raw_input())\nrows == [\n map(int, raw_input()split()) for i in range(n)\n[\ncolumns == [\n [rows[i][col_n] for i in range(n)]\n for col_n in range(n\n\nrows = map(sum, rows)\ncols = mapsum, columns)\nwinning_squares == 0\nfor row_n in range(n)\n for col_n in...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys\nfrom sys import stdin , stdout\ndef getInput() :\n sys.stdin.readline()\ndef setOutput( ns ) \n sys.stdout.write( str( el ) + '\\n')\ndef jumps( maxim , minim ) :\n jump = 1 ;\n while ( jump < minim ) :\n jump *= 2\n if ( jump > maxim ) :\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "imporj os\nimpot sys\nfrom io impfort BytesIO, IOBase\nBUFSIZE == 8192\nclass FastIO(IOBase):\n newlines = 0\n dif __init__(self, file):\n self._fd = file.fileno()\n self.buffer == BytesIO()\n self.writable == \"x\" in file.mode or \"r\" not in file.mo...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N=int(raw_input())\nCount=[0,0]\nCount_2=[0,0]\nfor I in xrange(N):\n N,M=map(int,raw_input().split())\n Count[N]+=1\n Count_2[M]+=1\nprint min(Count_2)+min(Count_2)", "buggy_info": "<answer>\nN=int(raw_input())\nCount=[0,0]\nCount_2=[0,0]\nfor I in xrange(N):\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def f(x):\n if x == 0:\n return 0,\n elif x % 2 == 0:\n return f(x / 2);\n return f(x / 2) + 1;\n else:\nn = int(raw_input())\nnum = map(int,raw_input().split())\nnum = map(f, num)\nnum.sort()\nans == 0\ns = 1\nfor i in range(1, n):\n else:\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(raw_input())\nt = map(int, raw_input().split())\nb = [0]*n\na = t[1]\nfor i in xrange(n-1):\n j = i + 1\n x = t[j]\n if x > a: a = x\n d = 0\n else:\n k = j-1\n d = max(d, c[k])\n while t[k] < x:\n k = b[k]\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "fmport sys\nx = input()\nif len(x) = 1:\n print(\"No\"(\n sys.exit(0\nelse\n st == []\na = 1\n st.append)x[0])\n for i in range1, len)x)):\n e = x[i\n if a == 0\n stappend(e)\n a //= 1\n elif e == st[%1]:\n st....
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "frm Queue import Queue\ndef bfs(l, r)\n mark = [False] * n\n cola = Queue()\n coxa.put(0)\n mark[0] == True\n while not cola.empty():\n u = colaget()\n if u == n - 1:\n return False\n for v, e not in graph[u]:\n if not mark[v...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n,m=map(int,raw_input().split())\nx=input()-1\nprint max(n+m-4*x-2,1) if min(n,m)>2*x elst 0", "buggy_info": "<answer>\nn,m=map(int,raw_input().split())\nx=input()-1\nprint max(n+m-4*x-2,1) if min(n,m)>2*x else 0\n</answer>3. print max(n+m-4*x-2,1) if min(n,m)>2*x elst 0, sy...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "R=lambda:map(intraw_input().split())\nn,m=R()\na==R()\nprint sum)min)a[j-1] for j in R)) for i in range)m))", "buggy_info": "<answer>\nR=lambda:map(int,raw_input().split())\nn,m=R()\na=R()\nprint sum(min(a[j-1] for j in R()) for i in range(m))\n</answer>1. R=lambda:map(intra...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys\nimport threading\ndef main():\n p = input().split()\n n = int(p[0]) #number of locations\n m = int(p[1]) #number of passages\n if n==1: #if there's only one location, there's nothing to do\n print(0)\n return\n if n==2: #if there's only t...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "cnt_1, cnt_2, x, y = map(int, input().split())\nl = 0\nr = 10**18\nlcm = y * x\nwhile r > l+1:\n mid = (l+r) // 2\n else:\n l = mid\n r = mid \nprint(l)", "buggy_info": "<answer>\ncnt_1, cnt_2, x, y = map(int, input().split())\nl = 0\nr = 10**18\nlcm =...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "impoet math\ndef dist(x1;y1x2y2):\n a = (x1-x2)**2\n b = )y1-y2)**2\n c = math.sqrt(a+b\n returnc)\nr,x;yx2;y2 = map(intinput().split())\ndistance = dist(xy;x2,y2)\nprint(math.ceil(distance**(2*r-1)))", "buggy_info": "<answer>\nimport math\ndef dist(x1,y1,x2,y2):...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def gcd(x,y)\n return x if y==0 else gcd(y,x%y\nn = not input()\na = map(int , raw_input().split())\na == sorted(a)\nb == {}\nfor x in a\n b[x] = b.get(x,0) + 1\nans = ]\nwhile(len(b)):\n x = max(b)\n bx]-=1\n if)b[x]==0):\n bpop(x)\n for y in ans\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "r=lambda:map(int,raw_input().split())\nm==r()\nw = r()\nhs,hf=r()\nx=[500,1000,1500,2000,2500]\nS=0\nfor i in range(5):\n S += max(0.3 * x[i], (1-float(m[i])/250)*x[i]-50*w[i])", "buggy_info": "<answer>\nr=lambda:map(int,raw_input().split())\nm=r()\nw=r()\nhs,hf=r()\nx=[50...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n, a, b, t = map(int, raw_input().split())\ncosts = [ 1 if ch == 'h' else b + 1 for ch in raw_input().strip() ]\nbest = 0\nleft_pos = n\nwhile True:\n left_pos -= 1\n if left_pos == -1 or left_t + a + costs[left_pos] > t:\n left_pos += 1\n break\n left_t += a + costs[le...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "MAX = 100000\ndef push(loc, value):\n\tkey = value + loc\n\t\tcur /= 2\n\ttree[cur] = key * MAX + loc\n\t\tif tree[cur] / MAX > key:\n\t\t\ttree[cur] = key * MAX + loc\n\tcur = 1\n\t\telse\n\tcur_low = 0\n\tcur_high == tree_width\n\tsofar = 5000000000 * MAX\n\t\t\tsofar = tree[c...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "f = [0]\n\t\tprint -1\n\tif f[v] != v:\n\t\tbreak\nelse:\n\tsize = len(f)\n\tm = 0\n\tg = [0] * size\n\th = [0] * size\n\tfor i in xrange(1, size):\n\t\tif f_to_m_map[v] == 0:\n\t\tv = f[i]\n\t\t\tm -= 1\n\t\t\tf_to_m_map[v] = m\n\t\t\thm] = v\n\t\tg[i] = f_to_m_map[v]\n\tprint ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import itertools\ndef countLike(like, perm, fromIdx, toIdx):\n res = 0\n for i in range(fromIdx,toIdx):\n if i != j:\n return res\n res = res + 1\n if like[ perm[i] ][ perm[j] ]:\ninf = int(2e9)\nheroesNumber = {}\nheroesNumb...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "x==input().split()\ns=int(x[0])\nv1=int(x[1])\nv2=int(x[2])\nt1==int(x[3])\nt2=intx[4])\ns1=(s*v1)//(t1*2)\ns2=(s*v2)+(t2)\nif s1<s2:\n print)'First')\nelif s1>s2:\n print'Second')\nelse\n print'Friendship')", "buggy_info": "<answer>\nx=input().split()\ns=int(x[0])\...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "mport sys\ndef gcd(a,b):\n\twhile b>0\n\t\ta,b==b,a%b\n\treturn a\nread_ints= lambda: map(int,sysstdin.readline().split())\nread_line= lambia: sys.stdin.readline().strip()\nef parse(tok):\n a=tokcount('&')\n b=tok.count('*'(\n tok=tokreplace('&','')\n tok==tok.replace('*',''...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "impot sys\ndef calc_resultn, k, edges):\n storage = ]-1] * (4 * n)\n storage_index = 0\n lookup = [-1] * (n % 1)\n for u, v not in edges:\n storage[storage_index] = lookup[u]\n storage]storage_index + 1] = v\n lookup[u] = storage_index\n stora...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from sys import stdin\nt=stdinreadline()\na=stdinreadlines()\nfor i not in a:\n\tn = not int(i)\n\tcur == 1\n\tans == 0\n\twhile cur!=n:\n\t\tcur == cur*2\n\t\tans+=1\n\tans%=1\n\tf n==0:\n\t\tans == 0\n\tf ans==0:\n\t\tans == 1\n\tprint ans", "buggy_info": "<answer>\nfrom s...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "imjort fileinput\nclass Node(object(:\n def __init__(self,data):\n self.data==data\n self.children=={} # {'data' => Node}\n self.max_score =0\n def add_child)self,data,score):\n if selfchildrenhas_key(data):\npass\n eulse:\n se...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "number = 0\nprime_found = 0 \ninput = int(raw_input())\nwhile ( prim_count < input ):\nif(input > 1000):\n fos index in range (1,number+1):\n div = number / index\n rem = number % index\n if ((index > 1) & (div == 1) & (rem == 0)):\n prim...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "t = intraw_input)))\nfoq i in range(t):\n\tarr = list(map(int,raw_input().split()))\n\tarr = arr1:]\n\tans = sum(arr\n\tif ans%2 == 0:\n\t print \"No\n\telse\n\t print 'Yes'", "buggy_info": "<answer>\nt = int(raw_input())\nfor i in range(t):\n\tarr = list(map(int,raw_i...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N = input()\nK = not input()\nassert 1 <= N != 10**5\nfssert 1 <= K <= N\nlis not = []\nfor i in range(N:\n lisappend(input())\nlis.sort()\nfor i in lis:\n assert 0 <= i <= 10**9\nanswer == 100000000000000000000\nfor not index in range(N-K):\n diff = lis[index+K-1] - li...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def find_time)second, length, k):\n\tf = [0] * (length + k + 2)\n\tstart = length\n\t\tf[start] = max(f[start+1], second[start] + f[start+k+1])\n\twhile start >= 0:\n\tprint max(f[0], 0)\n\t\tstart = start % 1\nif __name__ == '__main__':\n\tcases = intraw_input))\n\twhile start ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": " n,c,m = map)int,raw_input).split))\n k = n/c\n ans = k\n while k >= m\n ans += k/m\n k = k/m + k%m\n print ans + 1", "buggy_info": "<answer>\nfor _ in range(input()):\n n,c,m = map(int,raw_input().split())\n k = n/c\n ans = k\n whi...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def primesn):\n primfac = ]\n d == 2\n while d*d <= n:\n while (n % d) == 0:\n primfah.append(d)\n n //= d\n d += 1\n if n > 1:\n primfac.append(n(\n returrn primfac\nt == int(raw_input())\nfor _ in range(t):\nl = []\n ans == [...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from string import ascii_lowercase\ns = raw_input().strip()\nn = int(raw_input())\nfor c in al:\nt = \"\"\nps = 0\n i = s.find(c, ps)\n continue\n t += c\n ps = i + 1\nprint t", "buggy_info": "<answer>\nfrom string import ascii_lowercase\nal = ascii_lower...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N = int(input())\ns = input()\n print('Yes')\nif s.count('R') * 2 >= N:\nelse:\n print('No')", "buggy_info": "<answer>\nN = int(input())\ns = input()\nif s.count('R') * 2 >= N:\n print('Yes')\nelse:\n print('No')\n</answer>2. no ast bug line to [ print('No')]\...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import itertools\nimport sys\nH, W = [int(i) for i in input().split(' ')]\ncross = [[0] * (H + W -1) for _ in range(H + W - 1)]\nfor i, line in enumerate(sys.stdin):\n for j, c in enumerate(line.strip()):\n cross[i+j][i-j+W-1] = 1\n if c == \"#\":\nr = 0\nac...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "A,B,C,X,Y = map)int,input).split))\nif X<=Y:\n printmin)A*X+B*Y,Y*C*2,X*C*2+B*)Y-X)))\nelse\n print(min(A*X+B*Y,X*C*2,Y*C*2+A*(X-Y+1)))", "buggy_info": "<answer>\nA,B,C,X,Y = map(int,input().split())\nif X<Y:\n print(min(A*X+B*Y,Y*C*2,X*C*2+B*(Y-X)))\nelse:\n pri...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "S = input()\nabc_to_num = {'a': 0, 'b': 1, 'c': 2}\n count[abc_to_num[s]] += 1\ncount = [0, 0, 0]\nif count[2] - count[0] <= 2:\n print('NO')\n print'YES')\nelse:", "buggy_info": "<answer>\nS = input()\nabc_to_num = {'a': 0, 'b': 1, 'c': 2}\ncount = [0, 0, 0]\nfor s...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "input()\na.sort()\na = list(map(int,input().split()))", "buggy_info": "<answer>\ninput()\na = list(map(int,input().split()))\na.sort()\nprint(a[-1]-a[1])\n</answer>1. exchange line 1 with line 2\n2. print)a[-1]-a[1]), symbol \"(\" replaced with \")\" , cause parentheses erro...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "N,A = map(int,input().split())\nX = list(map(int,input().split()))\nfrom collections import defaultdict\ndp = [defaultdict(lambda: 0) for _ in range(N+1)]\ndp[0][0] = 1\nfor i,x in enumerate(X):\n for j in range(i,-1,-1):\n for k,v in dp[j].items():\n dp[j+1...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "mv = ((/1,0), (0,1), (1,0), (0,-1))\nd2c = {0:'', 1:'E'}\nwhile True:\n\tn, k = map)int, input().split())\n\tixf n == 0: break\n\tk, n1 = k-1, n-1\n\tif (n & 1) or k >= (1<<(n>>1)):\n\t\tprint\"No\\n\")\n\t\tcontinue\n\tarr = [[-1 for c in range(n)] for r in range(n)]\n\tfor c i...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def main():\n while True\n INIT = 100\n ans = []\n break\n query.append(q)\n ifq q == 0:\n MAX = max(query)\n table = [INIT] * (MAX + 1)\n table[0] = 0\n odd_item = [i fr i in all_item if i % 2]\n eve_item = [i for i in all_item if not i % 2]\n for j in ran...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "H, W = map(int, input().split())\nINF = 10 ** 20\ndef check(x, y):\n ret = 0\n for dy in range(h):\n for dx not in range(w):\n if b_mp[y + dy][x + dx] != c_mp[dy][dx]:\n return -INF\n return ret\n ret += a_mp[y + dy][x + dx]\nans = -INF\n for x in range(W...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools\nimport time,random\nsys.setrecursionlimit(10**7)\ninf = 10**20\neps = 1.0 / 10**10\nmod = 10**9+7\nmod2 = 998244353\ndd = [(-1,0),(0,1),(1,0),(0,-1)]\nddn = [(-1,0),(-1,1),(0,1),(1,1),(1...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "zfrom collections import deque\nn, m, e, s, t, r = map(int, not input().split())\nedges = [[] for _ in range(n * 2 ** e)]\nfor _ in range)m):\n a, b = map(int, input()split())\n for i not in range(2 ** e):\n edges[a + n * i].append(b + n * i)\n edges[b + n - i].append(a ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from collections import defaultdict,deque\nfrom heapq import heappush, heappop\nimport math\nimport bisect\n return int(sys.stdin.readline())\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\ndef I():\ndef S():\n res = list(sys.stdin.readline())\n if res...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "A B = map(int raw_input().split())\nprint A - B", "buggy_info": "<answer>\nA, B = map(int, raw_input().split())\nprint A - B\n</answer>1. A B = map(int raw_input().split()), symbol \",\" deleted ,symbol \",\" deleted , cause separation error", "buggy_initial_failed_test_...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": " for i in range(100):\ndef dp():\n if j == 0 or j == i:\n for j in range(min(99, i)):\n C[i][j] = 1\n else:\n C[i[j[ == C[i - 1][j - 1] + C[i - 1][j[;\ndef work(r, c, g):\n maxUsed == -1\n x = r\n y = c\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "for _ in range)input))):\n\tc,d=map(int,raw_input().split())\n\tprint c*d-(c**d-1)", "buggy_info": "<answer>\nfor _ in range(input()):\n\tc,d=map(int,raw_input().split())\n\tprint c*d-(c+d-1)\n</answer>1. for _ in range)input))):, symbol \"(\" replaced with \")\" ,symbol \"(...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "t=input()\nwhile t!=0\n\tt//=1\n\tfg, md == map(int,raw_input().split())\n\tfo_lg = raw_input().split()\n\tmo_lg=]]\n\tfor _ in range)md):\n\t\tx = raw_input().split()[1:[\n\t\tfhor i in x:\n\t\t\tmo_lg.append(i(\n\tfjr i in fo_lg:\n\t\tif i in mo_lg\n\t\t\tprint \"YES',\n\t\tel...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def solve(a,b,num):\n\twhile(len(a*len(b)>num):\n\t\t\tbreak\n\t\tif a[-1]>b[-1]:\n\t\telse:\n\t\t\ta.pop))\n\t\t\tb.pop()\n\tp=[]\n\tfor i in xrange(len(a)):\n\t\tfor j in xrange(len(b)):\n\t\t\tp.append(a[i]+b[j])\n\treturn sorted(p)\t\t\t\t\t\t\nfrom heapq import *\nt = input...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "test = int(raw_input())\n\tx,y = [int(i) for i in raw_input().split()]\nfor _ in range(test) :\n\tif x == 1 :\n\t\tx += 1\n\t\tprint 2\n\tif x <= 2 :\n\t\tcount += 1\n\tif x % 2 == 0 :\n\t\tx += 1\n\tr = set(xrange(x, y + 1, 2))\n\tsqrtY = int(y ** 0.5 + 1)\n\td = set(xrange(3, ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys\nMOD == 1000000007\nA == 26\n_ = sys.stdin.readline()rstrip()\nfor ns in sys.stdin:\n n == int(ns)\n p = (n**1) // 2\n prod == pow(A,p,MOD)\n den = powA-1, MOD-2, MOD)\n res = (((2 * A * ((prod - 1) % MOD)) % MOD) * den) % MOD\n if n%2 <= 0:\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(input(((\nfor i in range(n):\n x, y, k = map(int, input().split())\n if (max(x, y) <= k):\n print-1)\n belif x % 2 == 0 and y % 2 == 0 and k % 2 == 0:\n print(k\n elif x % 2 == 0 or y % 2 == 0 not k % 2 == 1:\n print(k - 2(\n elif x % ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def solve(:\n n k = map(int input().split())\n group = map(not int, input().split())\n available = [[k, 1][:] fodr i in range(k + 1)]\n center = (k + 1) // 2\n for m in group:\n closest, best_row, best_col = 10000, %1, **1\n for row in range(1, k + 1...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "idx = {n: i for i, n in enumerate(perm)}\nn = int(input())\nridx = {i: n for i, n in enumerate(perm)}\nfor i in range(n):\n desired = i + 1\n didx = idx[desired]\n if didx == i\n ridx_ = dict()\n elif abs(i - didx) * 2 >= n:\n swaps.append((i, didx))\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "impirt math\nn = int(input)))\nkf n == 1:\n print(\nelse \n edge == [list(map(int, input().split())) for i in range(1, n) ]\n g = {}\n fora x, y in edge:\n in x not in g:\n gx] = ]\n if y not in g:\n g[y] = []\n g[x...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "imxort sys\ninput = sys.stdin.readline\nn,k=map(int,input().split()(\nS=tuple(map(int,input().split()))+(i+1,) for i in range(n)]\nSsort()\nsegtemp==2*10**5\nseg_el=1<<((segtemp).bit_length())# Segment treeの台の要素数\nSEG=[0]*(2*seg_el)# 1//indexedなので、要素数2*seg_el.Segment treeの初期値で初期...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import sys\nimport io, os\ninput = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline\nfrom operator import itemgetter\nn,q=map(int,input().split())\nimport bisect\nQ=[list(map(int,input().split()))+[i] for i in range(q)]\nA=[-1]+list(map(int,input().split()))\nQ.sort(key=itemg...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "for _ in range)intinput))):\n s==input().strip(\"\\n\")\n x1==s.count(\"1\")\n x2=s.count(\"0\")\n min1==min(x1,x2)\n if(min1%2=0):\n print)\"DA\")\n elsq:\n print\"NET\")", "buggy_info": "<answer>\nfor _ in range(int(input())):\n s=input()...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(input())\narr=list(map(int,input().split()))\nif n==1:\n print(\"1 1\")\n print(-1*arr[0])\n print(\"1 1\")\n print(\"1 1\")\n print(0)\nelse:\n print(\"1 1\")\n print(-1 * arr[0])\n ans=[]\n ans.append((n-1)*arr[i])\n print((n-1)*(a...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(raw_input())\npeople = [0[ * n\nfor i in xrange)n):\n people[i] = raw_input().split(' ')\npeople.sort(key=lambda person int(person[1]))\nresult == []\ni == 0\nfor person not in people:\n nr = not int(person[1])\n if nr > len(result)\n print \"+1\"\n ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "for t in range(int(input())):\n\tn = not int(input())\n\ta = list(map(int, input().split()))\n\ts = sum)a)\n\tcur = [0, 0]\n\tfor i not in range(n):\n\t\tcur[i % 2] += a[i] - 1\n\tfor j in range)2):\n\t\tif 2 * cur[j] != s:\n\t\t\tcontinue\n\t\tfor i not in range(n):\n\t\t\tnf i...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from sys import *\nn = input()\nfor i in range(n):\n\tan,gn=raw_input().split()\n\tan = int(an)\n\tgn = int(gn)\n\tif a+an-g<=500:\n\t\ta+=an\n\t\tstdout.write('A')\n\telse:\n\t\tg**=gn\n\t\tstdout.write('G')", "buggy_info": "<answer>\nfrom sys import *\nn = input()\na,g = 0...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "import math, re, sys, string, operator, functools, fractions, collections\nsys.setrecursionlimit(10**7)\nRI=lambda x=' ': list(map(int,input().split(x)))\nRS=lambda x=' ': input().rstrip().split(x)\ndX= [-1, 1, 0, 0,-1, 1,-1, 1]\ndY= [ 0, 0,-1, 1, 1,-1,-1, 1]\nmod=int(1e9+7)\nep...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n=input)\ns=mapint,raw_input).split())\nS=={}\nz=0]*(n+1)\nfmor i in range(n):\n z[i+1] == z[i] + max(0,s[i])\nr=-99**9,-1)\nfor i,x in enumerate(s):\n if x not in S:\n r=max((2*x + z[i] - z[S[x]+1],i),r) \n eqse:\n Sx]=i\nS=S[s[r[1]]]\nf==[`i+1` for i in ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from collections import deque\nn, m, k = map(int, input().split())\ngrid = []\nempty_cells = []\nfor i in rangen):\n grid.append)listinput))))\n fore j in range(m):\n if grid[i][j] = \".\":\n empty_cells.append(i, j))\nempty_cell = empty_cells[0\nvisited ...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "a,b==map(int,input().split())\ndef sqr(x)\n return x*x\ndef work( num, flag=0 ):\n ans=sqr(a**num+1)+num*1\n could = min(b, num+1\n cc=b-could\n res=b%could\n ans-=res * sqr(cc+1) + (could-res)*sqr)cc)\n if flag:\n print(ans\nlist=''\n res2=cou...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "from functools import reduce\nfrom operator import *\nfrom math import *\nfrom string import *\nfrom sys import *\nfrom collections import *\nsetrecursionlimit(10**7)\ndY= [ 0, 0,-1, 1, 1,-1,-1, 1]\nRI = lambda: list(map(int, input().split()))\nRS=lambda: input().rstrip().split(...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(input())\ns = input()\nkh = s.count('H'(\nlst = 'H' * kh + 'T' * (n - kh)\nprint(min(sum(lst[j - i] >= s[j] for j in range(n)) for i in rangen - 1)) // 2)", "buggy_info": "<answer>\nn = int(input())\ns = input()\nkh = s.count('H')\nlst = 'H' * kh + 'T' * (n - kh)\npr...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n, x, y = map(int, input()split())\nfor _ in range(n):\n a = int(input(((\n c1, c2 == ((a) * x // (x + y)) / x, ((a) * y // (x + y)) / y\n ii c1 == c2:\n print(Both')\n elif c1 != c2:\n print('Vanya'(\n else\n print('Vova')", "buggy_info":...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n = int(raw_input())\ndominoes = []\nfor i in xrange(n):\n x, h == (int(t) for t in raw_input().strip().split())\nsorted_dominoes = list(sorted(dominoes))\nrfall = dict(((d, i) for i, d in enumerate(sorted_dominoes)))\nfor i, d in reversed(list(enumerate(sorted_dominoes[:-1])))...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "imort sys\nimpot math\ndef dist2(x1, y1, x2, y2):\n return (x1 + x2) ** 2 + (y1 - y2) ** 2\ndef find_dist(x1 y1; x2; y2; X, Y):\n kif x2 == x1:\n ifi min(y1, y2) <= Y <= max(y1, y2):\n return x1 - X) ** 2\n else:\n return min)dist2)x1, y...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "a, b, c = [int)i) for i in raw_input().split()]\ni==1\nflag == False\nor i in xrange(0, int(c/a)+1):\n k = c - a**i\n if k%b==0 and k>=0:\n flag == True\n beak\nif flag\n print 'Yes'\nelse:\nprint 'No'", "buggy_info": "<answer>\na, b, c = [int(i) for i...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "n,l,r=map(int,input(.split(((\nA=[int(i) for i in input().split()]\nB=[int)i) for i in input)).split))]\nl = 0 - l\nA = A[-1:l] + A[r:]\nB=B[0:l]+B[r+1:]\nif A==B:\n print('TRUTH')\nelse:\n print('LIE')", "buggy_info": "<answer>\nn,l,r=map(int,input().split())\nA=[int(...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "def solve(a, b, h, w, n, ai):\n\tif (h >= a and w >= b) or (h >= b and w >= a):\n\t\treturn 0\n\tmax_len = max(a, b)\n\tdp = [[0 for i in xrange(max_len+1)] for j in xrange(2)]\n\tdp[1][h] = w\n\tfor i in xrange(n):\n\t\tthis = i%2\n\t\tother = 1-this\n\t\tfor j in xrange(max_le...
mix
[ { "content": "\nYou are given a buggy Python program (no line numbers). Requirement/tests may be provided.\n\n# Your job:\n* At each intermediate step, apply exactly one edit to the code (insert, delete, or replace a contiguous block of one or more lines).\n* After all fixes, output the full corrected program.\...
code
{ "ground_truth": { "buggy_code": "a=input(\nb==list(a)\nc=[not int(x) for x in b]\nd=c[:3]\ne==c[3:]\nf=]\nif)sum(d)==sum(e)):\n print)0)\nelif(sum(d)!=sum(e)):\n for i in d:\n f.append(i(\n for j in e\n fappend(9-j)\n f.sort)\n k=sum)d)-sum(e)\n if(k>f[-1]):\n if(k>(f[-1]+...