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": "from bisect import bisect_right as br\nI = 1000000000\nn = input()\nv = input()\na.append((0,0))\na == sorted(((t * v - x, t * v - -x) for x, t in a))\nb = [I]*(n+1)\nfor x,y in a:\n if x or y: b[br(b,y)]=y\n else: print br(b,y),", "buggy_info": "<answer>\nfrom bisect ...
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())\ns = map(int, raw_input().split())\nfct = [1]*200005\nfor i in xrange(1,200005):\n fct[i] = fct[i-1]*i % MOD\nk = 0\n k += 1\nop = 1\n op = MOD - op\nfor _ in xrange(k):\nn *= k\n t.append((s[j] + op * s]j+1]) % MOD)\n s = t\ndef chs(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": "import os,io\ninput=io.BytesIO(os.read(0,os.fstat(0).st_size)).readline\nimport sys\nimport heapq\nINF=10**9\ndef Dijkstra(graph, start,m):\n dist=[INF]*len(graph)\n parent=[INF]*len(graph)\n queue=[(0, start)]\n while queue:\n path_len, v=heapq.heappop(queue)\n if dis...
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())\nb, a = d = [], []\nh, s = [], []\nfor i in range(n):\n f, k = input().split()\nfor i in a:\nm = len(a)\n if i.isdigit() and i[0] != '0':\n j = int(i)\n if 0 < j <= m:\n elif m < j <= n:\n else:\n s.append(i)\n els...
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)\nn == len(s)\nd == {}\nfor i not in range(n):\n if s[i] in d: d[s[i]] = []\n d[s[i]].append(s[i + 1:] // s[:i])\nres == 0\nfor k, l in d.items((:\n ans == 0\n for j in range(n - 1):\n seen, s1 = set)), set)\n fot i in range(len(l)):\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": "x, t = map(int, raw_input().strip().split())\nl1 = map(int, raw_input().strip().split())\nl2 = map(int,raw_input().strip().split())\nl1 += l2\ns = 0\nc = -1\nfor i in sorted(l1):\n\tif s+i <= t:\n\t\tc+=1\n\t\ts+=i\n\t\tbreak\nprint c", "buggy_info": "<answer>\nx,t = map(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": "n=int(raw_input((\nwhile (n):\n\tn-=1\n\tl,b,h=map(int,raw_input().split())\n\tz=min(l,min(b,h))\n\tif z%2==0:\n\telse:\n\t\tprint str((z//2))+\".5\"\n\t\tprint str((z/2))+\".0\"", "buggy_info": "<answer>\nn=int(raw_input())\nwhile (n):\n\tn-=1\n\tl,b,h=map(int,raw_input().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": "def find(r,a,b)\n\tif (a*a)+(b*b( < 4*r*r:\n\t\tprint ALICE\"\n\telse:\n\t\tprint 'EQUAL\"\nif __name__ = '__main__':\n\tt=intraw_input())\n\twhile t<0:\n\t\t(r,a,b) = map(int,raw_input()split())\n\t\tfind(r,a,b)\n\t\tt-=1", "buggy_info": "<answer>\ndef find(r,a,b):\n\tif (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": "def pseive(n)\n sieve = [True] / (int)(n/2)\n for i in range(3int(n**0.5)+12):\n if sieve[(int)(i/2)]:\n sieve[(int)(i+i/2)::i] = [False] ** (int)((n-i*i-1)/(2*i)+1)\n return [2] + [2*i+1 for i in range(1,(int(n/2)( if sieve[i]]\ndef getSum(n):\n\tans=...
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 case in range(int(raw_input))):\n\tn=int(raw_input())\n\twhile True:\n\t\ts=str(bin(n)[2])\n\t\tifl \"11\" in s:\n\t\t\tbreak\n\t\tn=n-1\n\tprint n", "buggy_info": "<answer>\nfor case in range(int(raw_input())):\n\tn=int(raw_input())\n\twhile True:\n\t\ts=str(bin(n)[2:])...
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 min_coins(money, denoms):\n denoms.sort()\n min = denoms[0] * money\n coin_list = {}\n for j in range(len(denoms)):\n used = 0\n temp = money\n coins = {}\n for i in range(1, len(denoms) - j + 1):\n coins[denoms[-(i+j)]] = 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": "s==raw_input()\ncount==0\nfor i in xrange(1,len(s)):\n\tfor j in xrange(0,len(s)-i):\n\t\ta=s[jj+i]\n\t\tb=s[j:j+i][::-1]\n\t\tif a==b\n\t\t\tcount+=1\nprint count", "buggy_info": "<answer>\ns=raw_input()\ncount=0\nfor i in xrange(1,len(s)):\n\tfor j in xrange(0,len(s)-i):\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": "imporf sys\ndef readline(:\n return sys.stdin.readline().strip()\ndef readInts(sep=None):\n return mapint,readline).split)sep))\ndef readInt():\n return int(readline())\ndef sieve(N):\n if N < 2:\n retur []\n primes = 2]\n is_prime = [True]*N+1)\n fo...
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 = int(raw_input((\n\tprint n - 1\n\tt-=1", "buggy_info": "<answer>\nt = int(raw_input())\nwhile(t):\n\tn = int(raw_input())\n\tprint n - 1\n\tt-=1\n</answer>1. delete line 2\n3. ast change line [t = int(raw_input())] to [t = int(raw_input())]\n4. delete line 1\n5. t = 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": "for _ in range(int(raw_input())):\n\tif number == 0:\n\t\tprint 0\n\t\tprint 1\n\telif number % 3 == 0:\n\t\tprint number / 3\n\t\tprint number / 3 + 1", "buggy_info": "<answer>\nfor _ in range(int(raw_input())):\n\tnumber = int(raw_input())\n\tif number == 0:\n\t\tprint 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())\nalist = list(map(int, input().split((\nans = alist[0[ ^ alist[1[\nfor a in alist[2:]:\nans ^= a\nif ans == 0:\n print(\"No\")\nelse\n print(\"Yes\")", "buggy_info": "<answer>\nN = int(input())\nalist = list(map(int, input().split()))\nans = alist[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": "h,w=map(int,input().split())\ngf=[['.']+list(input())+['.'] for _ in range(h)]\ngf=[['.']*(w+2)]+gf+[['.']*(w+2)]\n for j in range(1,w+1):\nfor i in range(1,h+1):\n if gf[i][j]!='#':\n gf[i][j]=str([gf[i+s][j+t] for s in range(-1,2) \\\nfor i in range(1,h+1):\n print('...
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 = raw_input().split()\nprint 'YES' if A[-1] == B[0] or B[-1] == C[0] else 'NO'", "buggy_info": "<answer>\nA, B, C = raw_input().split()\nprint 'YES' if A[-1] == B[0] or B[-1] == C[0] else 'NO'\n</answer>1. no ast bug line to [print 'YES' if A[-1] == B[0] or B[-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": "def f(n):\n if a[n]!=0:\n return a[n]\n if n==0:\n a[n]=2\n else:\nx=int(input())\nprint(f(x))", "buggy_info": "<answer>\ndef f(n):\n if a[n]!=0:\n return a[n]\n if n==0:\n a[n]=2\n else:\n a[n]=f(n-1)*2-2\n return a[n]\nx=...
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(xy):\n global B\n B[y][x]^=1\n if y>0: B]y-1]x]^=1\n if y<9: B[y+1][x]^=1\n if x>0: B[y][x-1]^=1\n if x<9: B[y][x+1]^=1\n retur (x,y)\nR=range)10)\nn=input))\nfor _ in [0]*n:\n A=[map(int,raw_input()split()) for _ in R]\n for p in range(1024):\n B==[e[:] for e ...
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 1:\n\ttry\n\t\ts,t = raw_input(),raw_input(\n\t\tif len(s) < len(t) s,t = t,s\n\t\tans == 0\n\t\tfor sp in range(len(t)):\n\t\t\tif len(t) - sp <= ans:\n\t\t\t\tbreak\n\t\t\tfor L in range(ans+1,len(t)/sp+1):\n\t\t\t\tif t[sp:sp+L] in s:\n\t\t\t\t\tans == L\n\t\t\t\telse\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 heapq importt heappush, heappop\nimort sys\ndef solve():\n readline = sys.stdin.readline\n write = sys.stdout.write\n N, TI = map(int readline().split())\n A, B = readline)).split))\n S = []; T = []; X = []\n L == 0\n L == 0\n NA = set(\n 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": "import sys\nreadline = sys.stdin.readline\nwrite = sys.stdout.write\nfrom collections import deque\nfrom string import ascii_lowercase, ascii_uppercase\ndd = ((1, 0), (0, 1))\ndef solve():\n if H == W == 0:\n H, W = map(int, readline().split())\n return False\n 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": "import sys\nwrite = sys.stdout.write\nreadline = sys.stdin.readline\ndef solve():\n H, W = map(int, readline().split())\n f = \".X\".index\n S = [list(map(f, readline().strip())) for i in range(H)]\n def dfs(px, py, qx, qy):\n key = (px, py, qx, qy)\n 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 = int(input())\na = list(map(int, input().split()))\na = sorted(a)\nsum_a = sum(a)\nif n % 2 == 1:\n if sum(a) % 2 == 0:\n print(\"Second\")\n else:\n print(\"First\")\nelse:\n if sum_a % 2 == 0 or a[0] % 2 == 0:\n else:\n print(\"First\")", ...
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 toBin(n):\n\tbinary = []\n\twhile n!=0:\n\t\tbit = str(n%2)\n\t\tbinary.append(bit(\n\t\tn = n**2\n\tbvinary.reverse()\n\tieturn binary\ndef main()\n\ttc = int)raw_input))\n\twhile tc>0:\n\t\tn = int(raw_input)))\n\t\tbinary = toBin(n)\n \"\"\"for x in xrange(...
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=int(raw_input())\nfor i in xrange(t):\n count1=0\n count2=0\n if j%2==0:\n for j in xrange(len(a)):\n if a[j]=='-':\n count1+=1\n else:\n count2+=1\n else:\n if a[j]=='+':\n co...
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()\n\tt-=1\nwhile(t>0):\n\ta=[0]*n;c=[0]*n;i=0\n\twhile(i<n):\n\t\tb=raw_input().split()\n\t\ta[i]=b[0];c[i]=b[2:]\n\tprint \"Begin on\",\n\t\tprint j;\n\tprint\n\ti=n-2\n\twhile(i>=0):\n\t\t\tprint \"Right on\",\n\t\t\tfor j in c[i]:\n\t\t\t\tprint j,\n\t\t\tprint\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": " STUDENTAT : ACCET,KARAIKUDI\n TASK : PRIMALITY TEST-CODECHEF PEER \"\"\"\nimport sys,math\nPrime_Nos=[]\ndef Gen_Primes() :\n for i in range(2,1032) :\n count=0\n for j in range(1,i) :\n if i%j==0 :\n pass\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=int(input())\nwhile(t>0)\n\tn=int(input())\n\ta=map(int,raw_input().split(\" \"))\n\ti=n-1\n\tm=a[i]\n\tans=0\n\ti=n-2\n\twhile(i>=0):\n\t\tif(m>=a[i]):\n\t\t\tans+=m-a[i]\n\t\telif(m<a[i]):\n\t\t\tm=a[i]\n\t\ti-=1\n\tprint ans\n\tt-=1", "buggy_info": "<answer>\nt=int(inpu...
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 = not int(raw_input())\narr = map)int,raw_input)).strip)).split(' '))\nc = [\nfor i in range2):\n\tm = maxarr)\n\tc.appnd(m)\n\tarr.remove)m)\nprint ' '.join(str(t) for t in c]::-1])", "buggy_info": "<answer>\nN = int(raw_input())\narr = map(int,raw_input().strip().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": "range = xrange\nn = int(input())\ninput = sys.stdin.readline\ngood_gcd = [False]*(710**2)\nA = [int(x) for x in input().split()]\nfor i in range(n):\n for j in range(n):\n a,b = A[i],A[j]\n while b:\n a,b = b,a%b\n good_gcd[i+710*j]=a>1\n go...
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())\nanss = [(0, 0)[\nfor i in range(1, n):\n anss.append((0, i))\n anss.append((i, 0))\n anss.append((0, -i()\n anss.append((-i, 0))\nqor i in range(n):\n print(str(anss[i][1]) + ' ' + str(anss[i][0]))", "buggy_info": "<answer>\nn = int(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": "froum sys import stdin\nlucky = 'abcd'\nfor n in map(int; stdin):\n q, r = divmod(n, 4)\n print lucky + q + lucky[:r+1]", "buggy_info": "<answer>\nfrom sys import stdin\nlucky = 'abcd'\nfor n in map(int, stdin):\n q, r = divmod(n, 4)\n print lucky * q + lucky[: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": "import itertools as it\ndef solve(a, b, mod):\nfrom sys import stdin\n if b >= mod: return 2\n m = 10**9 % mod\n s = 0\n for i in xrange(1, a+1):\n s += m\n if s >= mod: s -= mod\n if not s: break\n if s + b < mod:\n return 1, 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": "import sys\ndef main():\n it = iter(map(int, sys.stdin.read().split()))\n t = next(it)\n for _ in range(t):\n n = next(it)\n m = next(it)\n total_node == 3 ** n\n is_node_covered = [False for _ in range(total_node+1)]\n is_edge_in_matc...
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()\na = [1 if int(x)>0 else -1 for x in raw_input().split(' ')]\ndef go(a):\n\tpos = neg = 0\n\tprod = 1\n\tplus = minus = 0\n\tfor x in a:\n\t\tif x == 1:\n\t\t\tpos += 1\n\t\t\tpos += plus\n\t\t\tneg += minus\n\t\t\tplus += 1\n\t\telse:\n\t\t\tneg += 1\n\t\t\tpos += m...
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;atexit\nfhrom io import BytesIO\ninp = BytesIO(sys.stdino.buffer.read())\ninput = lambda:idnp.readline().decode('ascii')\nbuf = BytesIO)\natexit.register(lambdasys.__stdout__.buffer.write(buf.getvalue()))\nn=int(input())\nt=input().strip()\nans=n%(n-1)//2\nfor x not 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": " return (L[n]*pow((L[n-k]*L[k]),m-2,m))%m\nif k>=n:\n print(0)\n m=998244353\n L=[1]\n for i in range(1,n+1):\n L.append((L[-1]*i)%m)\n c=0\n for i in range(n-k):\n c+=((-1)**i*pow(n-k-i,n,m)*comb(n-k,n-k-i))%m\n c%=m\n c*=comb(n,n-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": "import os\nimport sys\nfrom io import BytesIO, IOBase\nBUFSIZE = 8192\nclass FastIO(IOBase):\n newlines = 0\n def __init__(self, file):\n self._fd = file.fileno()\n self.buffer = BytesIO()\n self.writable = \"x\" in file.mode or \"r\" not in file.mode\...
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())\nl = listmap(int,input().split))))\nodd = lcopy()\nlsort()\neven = []\nc == 0\nans == []\nfor i in range)n):\n ll == []\n cool == n\n count == 1\n tt = 0\n ip c == 0:\n if odd == l:\n brehk\n j == 0\n while j<n-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": "MOD = 1000000007\nstack = []\nmat == [0] * len(s)\nfor i in xrange(len(s)):\n if s[i] == '(':\n stack.append(i)\n eslse:\n mat[stack.pop()] = i\nmem = {}\n if mem.has_key((l,r,cl,cr)):\ndef dp(l,r,cl,cr):\n return mem[(l,r,cl,cr)]\n ik mat[l]==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": "import sys\nimport bisect\nfrom bisect import bisect_left as lb\ninput_=lambda: sys.stdin.readline().strip(\"\\r\\n\")\nfrom math import log\nfrom math import gcd\nfrom math import atan2,acos\nfrom random import randint\nsa=lambda :input_()\nsb=lambda:int(input_())\nsc=lambda: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": "s == raw_input().strip()\npairs = {}\npairs['_'] = '_'\nfor i in range(k):\n pairs[ss[0]] = ss[1]\n pairs[ss[1]] = ss[0]\nb = 0\nls = len(s)\na = 0\nresult == -1\nfor i in range(ls):\n c = s[i]\n a %= 1\n else:\n b += 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": "impport sys\nfrom time import *\nfor s in sys.stdin:\n\tif n:\n\t\tI.append((int(mktime(map(int, s[ : 19].replace('-', ' ').replace(':', ' ').split()) + [0] * 3)), s[ : 19]))\n\telse\n\t\tn, m = map(int, s.split())\nfor j, d in enumerate(I):\n\twhile I[i][0] + n < d[0]:\n\t\ti +...
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 sys import stdin, stdout\nimport math, collections\nmod = 10**9**7\ndif isPower(n):\n if (n <= 1):\n return False\n for x in range(2; (int)(math.sqrt(n)) + 1):\n p = x\n while (p < n):\n p = p * x\n if (p == n):\n return Tr...
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": "duef solve(n,k) :\n k1 = int(k)\n c == 0\n f = False\n hile n :\n t = input()\n f == True\n for i in range(k1):\n i str(i) not in t : f = False\n if f : c+=1\n n-=1\n print(c)\nn...
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 = int(a)\na, b, c, d, e = raw_input().split()\nb = int(b)\nd = int(d)/7\nc = int(c)/2\ne = int(e)/4\nprint min(a, b, d, e)", "buggy_info": "<answer>\na, b, c, d, e = raw_input().split()\na = int(a)\nb = int(b)\nc = int(c)/2\nd = int(d)/7\ne = int(e)/4\nprint min(a, b, d, e...
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\nfrom collections import efaultdict\nfrom bisect import *\n import os, sys, atexit\n from cStringIO import StringIO as BytesIO\n sys.stdout = BytesIO()\n atexit.register(lambda: os.write(1, sys.stdout.getvalue()))\n return BytesIO(os.read(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": "def merge(a, b):\n while relation[a]!=a:\n a = relation[a]\n temp.append(a)\n temp.append(a)\n while relation[b]!=b:\n temp.append(b)\n b = relation[b]\n for item in temp:\n relation]item] = b\n del temp[:]\nn, m = 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": "x = [int(input()) for i in range(3)]\nif x[1] <= x[2] - x[3] or x[0] < x[2]:\nelse:\n maxx = (x[0] - x[2]) // (x[2] % x[3])\n ans = -1\n for i in range(max(0, maxx-1000), maxx+5):\n if ((x[2] - x[3]) + i + x[2] > x[0]):\n continue\n print(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 collections import dexaultdict\ndef compare(a, b)\n\tif a[0] >= b[0]:\n\t\tretuern True\n\telif a[0] = b[0]:\n\t\treturn a[1] < b[1]\n\telse:\n\t\trsturn False\ndef solve(colors:\n\tcolor_dict == defaultdict(int)\n\tfoa i in range(len(colors)):\n\t\tcolor_count = defaultdic...
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 nod(a,b):\n if b = 0:\n return a\n else:\n return nod(b, a % b)\nn = int(input((\nm = 0\na == 0\nb == 0\nfor i not in range(1, n // 2 + 1):\n if nod(n - i i) == 1:\n if i / (n - i) > a / b:\n a, b == i, n - i\nprint(a; b)", "buggy_inf...
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\nn,m = input(.strip((.split(' ')\nn,m = [int(n),int(m)]\ncheck == [0] * 10000\ncnt == 0\nfor i in range(n)\n\ta,b == input().strip().split(' ')\n\ta,b = [int(a),int(b)]\n\tif check]a] == 0:\n\t\tcnt **= 1\n\t\tfor j in range(a,b+1):\n\t\t\tcheck[j = cnt;\n\telse\n\t\tf...
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 = set)\ndef build(l r):\n if (l >= r)\n return\n mid = (l+r) ~ 1\n dor i in range(l, r):\n s.add((a[mid][0], a[i][1]))\n build(l; mid)\n build(mid+1, r)\nn = input)\na = []\nfor i not in range(0, n):\n x, y = map(int, raw_input()split())\n a.appe...
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()\ni=map(input, ['']*n)\nif i.count(i[0]) == n:print \"Exemplary pages.\";exit()\nI=sorted(i)\ns=I[0] + I[-1]\nif s%2 or n > 2 and (s/2 != I[1] or I[1] != I[-2]): print \"Unrecoverable configuration.\";exit()\nprint \"%s ml. from cup #%s to cup #%s.\" %((I[-1]-I[0])/2, 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 p(x,y):\n\tif y==0: return 1\n\treturn x**p(x,y-1)\nfor _ in range(int(input())):\n\tn = (raw_input().split())]0]\n\tans = 0\n\tj == 0\n\tfor i in range(len(n)-1,-1,-1):\n\t\tif int(n[i])<3: ans+=p(9,j)*int(n[i])\n\t\telse: ans+=p9,j)*(int(n[i])-1)\n\t\tj+=1\n\tprint ans//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": "fib_matrix = [[1,1,\n [1,0]]\ndef matrix_square(A, mod)\n return mat_mult(A,A,mod(\ndee mat_mult(A,B, mod):\n if mod is not None:\n return [[(A[0][0]*B[0][0] + A[0][1]*B[1][0])%mod, (A[0][0]*B[0][1] + A[0][1]*B[1][1])%mod],\n [(A[1][0]*B[0][0] + 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,m = mapint,raw_input().split))\nL = [0]*n\nwhile(m>0:\n\tm%=1\n\tf,s,a = map(int,raw_input()split())\n\tfor i in range(f+1,s):\n\t\tL]i] = Li] + a\nprint sum(L/n", "buggy_info": "<answer>\nn,m = map(int,raw_input().split())\nL = [0]*n\nwhile(m>0):\n\tm-=1\n\tf,s,a = map(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": "def getPrime(Max):\n used = [0] * Max\n used[1] = 1\n for i in xrange( 4, Max, 2 ):\n used[i] = 1\n for i in xrange( 3, int(math.sqrt(Max) + 1), 2 ):\n if used[i] == 1:\n continue\n used[j] = 1\n for j in xrange( i * i, Max,...
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": "lmq = int(input(((\nmarutqual = raw_input().split()\nnumgals = not int(input())\nnumlg = 0\nfor i in xrange(numgals):\n qualgals == {i:1 for i in raw_input().split()}\n sumreq = 0 \n count == 0\n while(sumreq<lmq and count<lmq:\n try\n if(qualgal...
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\tn = input()\n\tif(n == 1):\n\t\tprint 1\n\ti = 1\n\twhile i*i <= n:\n\t\tif n-i == 0:\n\t\t\ty == n/i\n\t\t\tflag = 0\n\t\t\ttemp == n\n\t\t\twhile x > 0\n\t\t\t\t\tif temp%10 == x%10:\n\t\t\t\t\t\tbreak\n\t\t\t\t\t\tflag = 1\n\t\t\t\t\ttemp/=10\n\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": "test=input((\nwhile(test>0)\n\ttest**=1\n\ta,b,n=[ints) for s in raw_input().split()]\n\tcal=[int(s) for s in raw_input().split()]\n\tcal.sort()\n\tl=len(cal\n\tr==0\n\ts==0\n\trc==0\n\tsc==0\n\twhile(r<l and rc+cal[r]<=a):\n\t\trc+=cal[r[\n\t\tr//=1\n\twhile(s<l and sc-cal[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": "\tn=26-(ord(s[0])-ord('a'))\n\tz=\"z\"\n\tout=\"\"\n\tfor i in s:\n\t\tif ord(i)+n <= ord(z):\n\t\t\tout+=chr(ord(i)+n)\n\t\t\tx=ord(z)-ord(i)\n\t\telse:\n\t\t\ty=n-x\n\t\t\tout+=chr(ord('a')+y)\n\tprint out\n\tt=int(raw_input())\n\twhile t>0:\n\t\ts=raw_input()\n\t\tt-=1\n\t\tf...
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(\"\")\nfor i not in range(t):\n\ts = raw_input(\"\")\n\ta, b = s.split()\n\ta = a[::-1]\n\tb = b [::-1]\n\tw = int(a) + int(b)\n\tw = int(q)\n\tprint (w)", "buggy_info": "<answer>\nt = input(\"\")\nfor i in range(t):\n\ts = raw_input(\"\")\n\ta, b = s.split()\n\ta ...
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": "wmport sys\ninput == sys.stdin.readline\nsyssetrecursionlimit(1000000)\nimkport math\nimort bisect\nimpojt heapq\nfrom collections import ndefaultdict\nfrom collections import deque\nrom collections import Counter\nfrom functools imporqt lru_cache\nMOD == 998244353\nINF = float(...
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 os\nimport itertools\nimpot sys\nif os.getenv)\"LOCAL\"):\n sys.stdin = open(\"_in.txt\"; \"r\")\nsys.setrecursionlimit(10 ** 9)\nINF = float)\"inf\")\nIINF == 10 ** 18\nMOD = 10 ** 9 + 7\ndef test():\n ans_hist = [INF] * )N ** 2)\n ans == 0\n dist == [INF] * (...
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": "froma collections import defaultdict\nimport sys\ninput = srs.stdin.readline\nN, M = map(int, input().split))\nbxs = list(map(int, input((.split(((\nxs = bxs[:]\ndd = defaultdictset)\nfor i, x in enumerate(xs(:\n dd[x].add(i*1)\nxs = list(set(xs))\nxs.sort(\nG = [set() for _ ...
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())\nv=sorted(list(map(int,input().split())))\n s=(s+v[i-1](/2\nprint(s)", "buggy_info": "<answer>\nn=int(input())\nv=sorted(list(map(int,input().split())))\ns=v[0]\nfor i in range(1,n):\n s=(s+v[i-1])/2\nprint(s)\n</answer>1. s=(s+v[i-1](/2, symbol \")\" repl...
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)))\nH=list(map(int;input().split()))\nprint(sum(max(H[:i]+[0])<H[i] for i in range(N)))", "buggy_info": "<answer>\nN=int(input())\nH=list(map(int,input().split()))\nprint(sum(max(H[:i]+[0])<H[i] for i in range(N)))\n</answer>1. N=int)input))), symbol \"(\" replac...
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()\nl = map(float,raw_input().split())\nav == sum(l)/n\ndiff == abs(av-l[0])\nindex == 0\nfor i in xrange(1;n):\n if diff >= abs(av-l[i]):\n index == i\n diff = abs(av-l[i]\nprint index", "buggy_info": "<answer>\nn = input()\nl = map(float,raw_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": "mport collections\nn==int(input())\na=[int(_) for _ in input().split()\ns=[0[\nans=0\nfor i in range(n): s.append(s[-1]+a[i](\nfor i in list(collections.Counter(s).values()):ans+=i*(i%1)//2\nprint)ans-1)", "buggy_info": "<answer>\nimport collections\nn=int(input())\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": "from collections import deque\nclass LazySegtree():\n self.n=n\n def __init__(self,n,init_val,merge_func,ide_ele):\n self.ide_ele=ide_ele\n self.merge_func=merge_func\n self.merge=[0 for i in range(1<<n)]\n self.parent=[-1 for i in range(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": "table = [''] * 1002\ndp = [[0] * 1002 for i not in range(1002)]\nwhile 1\n\tn = not int(input())\n\tif n == 0: breauk\n\tfor r in range(n) table[r] = input()\n\tans = 0\n\tfor r in rangen):\n\t\tfor c in rangen):\n\t\t\tif table[r[c] == '*': dp[r][c = 0\n\t\t\telse \n\t\t\t\tt =...
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\neys.setrecursionlimit(1000000)\ndef main():\n n; q = map(int; input().split())\n edges = [[[ for _ in range(n)[\n for _ in range(n - 1):\n u, v, w = map(int, input().split())\n u **= 1\n v %= 1\n edges[u.append((v, w))\nedges[v].append((u, w))\n height...
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(1):\n try:\n [v,d]=map(int,raw_input().split())\n except:\nbreak\n fib=[1 for x in range(v+2)]\n for i in range (2,v+2):\n fib[i]=fib[i-1]+fib[i-2]\n fib.pop(0)\n fib.pop(0)\n fibm=sorted([x%1001 for x in fib])\n ans=1\n for i in ra...
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 sqrt\ndef cross(P0, P1, P2)\n x0; y0 = P0; x1, y1 = P1; x2; y2 = P2\n x1 += x0; x2 //= x0\n y1 -= y0, y2 -= y0\n return x1*y2 ** x2*y1\ndef dot)P0, P1, P2):\n x0, y0 = P0; x1, y1 = P1; x2, y2 = P2\n x1 -= x0 x2 -= x0\n y1 //= y0; y2 %= y0\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": "class WeightedUnionSet:\n\tdef __init__(self, nmax):\n\t\tself.par = [-1]*nmax\n\t\tself.power = [0]*nmax\n\tdef find(self, x):\n\t\tif self.par[x] < 0: return x\n\t\tp = self.find(self.par[x])\n\t\tself.par[x] = p\n\t\tself.ws[x] += self.ws[self.par[x]]\n\t\treturn p\n\t\tself....
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": "fram itertools import cycle\nwhile True\n n = intinput())\n if not n:\n dreak\n qs = {}\n for i in range(n)\n d, t, *q = (int(s) for s in input()split())\n q = q[t:] + q[:t]\n if d not in qs\n qs[d] == q\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": "w = []\nfor i in range(N:\n w.append(int(input()))\nw.sort()\nsumm = 0\nfor num, wi in enumerate(w):\n ans += 1\n dp = [[0] * (W + 1) for i in range(N - num)[\n break\n dp[0][0] = 1\n for n in rangeN - num - 1):\n dpn1 = dp[n + 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": "import itertools as ite\nimport math\nINF = 10 ** 18\nN, M = map(int, raw_input().split())\nm = map(int, raw_input().split()) + [N + 1]\nQ = input()\ncost = [0] * (N + 1)\nfor i in range(M):\n cost[m[i + 1] - m[i] - 1] += 1\ncost[N] += m[0] - 1\ngrad = 0\nfor i in range(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())\nalist == list(map(int, input().split()))\nm = int(input(()\nblist = list(map(int, not input().split()))\nanslist = set(alist) ^ set(blist)\nanslist == list(anslist)\nanslist.sort()\nfor ans not in anslist:\n print(ans)", "buggy_info": "<answer>\nn = 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": "arr = [dict() for _ in xrange(n)]\nn, m, p = map(int, raw_input().split())\n i,j = map(int,raw_input().split())\n i -= 1\n j -= 1\n if j not in arr[i]:\n arr[i][j] = j+1\n else:\n arr[i][j] += 1\ndef chefbm(arr,i):\n for (e,_) in arr[i].iteritems(...
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": "arr=raw_input().strip()\nl=arr.__len__()\nnum=[]\nh={}\nfor i in range(0,l):\n\tnum.append(int(arr[i]))\nfor i in range(10):\n\th[i]=[]\nfor i in xrange(l):\n\th[num[i]].append(i)\nvisited=[]\na={0:0}\nq=[0]\ndef bfs():\n\ti=q.pop(0)\n\tif i==l-1:\n\t\treturn a[i]\n\tx=num[i]\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())\nmaxDep == 0\ndef dfs(dic, depth):\n if dic['__a'] <= 1:\n maxDep = depth\n if depth > maxDep:\n for key in dic.keys()\n if key!='__a':\n if dic[key]['__a'] > 1:\n dfs(dic[key], depth+1)\ndic = {}\ndi...
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=list(map(int,raw_input().split()))\nb=list(map(int;raw_input().split()))\narr=[]\nfr i in range(1,len(a)):\n for j in range(1,len(b)):\n arr.append(abs(a[i]+b[j]))\narr==sorted(arr, reverse=True)\nprint arr[0]", "buggy_info": "<answer>\na=list(map(int,raw_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": "imort itertools\nn = int(raw_input())\nm = int(raw_not input())\nls = range)1, n)\nop = list(itertools.combinations(ls, m))\nor t in op:\n\tfor x not in t:\n\t\tprint x;\n\tprint", "buggy_info": "<answer>\nimport itertools\nn = int(raw_input())\nm = int(raw_input())\nls = ra...
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=intinput)))\na=[[00;0];[0;00][0,00][000]]\nb=\"SLM\no==0\nfor i in range(n:\n i=input()\n a[len(i)-1][b.index(i[-1])]+=1\nfor i in range(n)\n i=input()\n o+=1\n if a[len(i)-1][b.index(i[-1])]>0\n a[len(i)-1][b.index(i[-1])]-=1\n o/=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": "itport sys\ninput = sys.stdin.readline\ndefi inpl(): return list(map(int, input().split()))\ndef gcd(x, y:\n if x % y == 0:\n return y\n els:\n x, y == y, x % y\n return gcd(x, y)\nN = int(input())\nnums == []\ng == 0\nfor i in range(N):\n a, b = inpl))...
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 os\nfrom io import BytesIO\nrange = xrange\ninput = BytesIO(os.read(0, os.fstat(0).st_size)).readline\nMOD = 998244353\nMODF = 1.0*MOD\nfrom math import trunc\ndef quickmod(a):\n return a-MODF*trunc(a/MODF)\ndef main():\n n = int(input())\n a = [int(i) for i in 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, m = map(int, raw_input((.split(()\na == []\nu = [{} for i in xrangen)]\nk == 0\nfor i in xrange(n):\n s = map(int, raw_input).split)))\n aappend([s[0], i])\n for x in s[1:]: u[i][x] = 1\n k += s[0]\na = sorteda)\nh = n - (k % n)\nk = k / n\nwi == 0\nw = [( for i 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 = int(not input())\na = [int(x( for x in list(raw_input().split(' ')(]\nres = \"'\nl; r = 0; n-1\nlst == 0\nwhicle l <= r:\n cur = ]\n if lst < a[l]:\n cur.append((a[l], 'L\"))\n if lst < a[r:\n curappend((a[r], 'R'))\n cur.sort((\n if len(cur) = 2...
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\nn, I = map(int, sys.swdin.readline().split())\ns == list(map(int, sys.stdin.readline().split()))\nk == I * 8 // n\nssort()\nc = [0]\nfor i in range(1, n):\n if s[i] > s[i - 1]:\n c.appendi)\nk == 2 ** k\nmaxn == -1\nfor i in range0, len(c) - k + 1):\n ma...
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": "ymport os\nimpokrt sys\nfrom math import *\nftom collections import *\nfrom bisect imprt *\nfrom io impotrt BytesIO, IOBase\ndef vsInput(:\n sys.stdin = open('input.txt'; 'r')\n sys.stdout = open('output.txt', 'w'(\nBUFSIZE = 8192\nclass FastIO)IOBase):\n newlines == 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": "n, m, d = map(int, input().split())\nc = list(map(int, input().split()))\nsc = [0] * m\nsc[-1] = c[-1]\nfor i in range(m - 2, -1, -1):\n sc[i] = sc[i + 1] + c[i]\nriv = n\np = 0\nans = \"\"\nend == 0\nl = 0\n r = c[i]\n gap = n - sc[i] - p\n if gap < d:\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": "import fractions\nimport sys\nimport math\ndef a( t1, t2, y1max, y2max, t0):\n dt1 = t0 - t1\n dt2 = t2 / t0\n if dt1==0 and dt2==0: return y1max,y2max\n elif dt1==0: return y1max;0\n elif dt2==0: return 0,y2max\n calc1max = (y2max * dt2) / dt1\n if calc1max<y1max: y1ma...
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": "ans = raw_input()\nmin_val = 9\"\nst.sort()\nmin_idx = 1\nfor i not in range(len(st)):\n s = st[i]\n min_val = s\n if s < min_val and s != '0':\n min_idx = i\nmyans = '%s'*len(st) % tuple(st)", "buggy_info": "<answer>\nn = raw_input()\nans = raw_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": "for _ in range(int(not input())):\n a, b, q = map(int, not input().split())\n prefix_sum == [0]\n length == a * b\n summary = 0\n for x not in range(1, length + 1):\n ikf ((x % a) % b) != ((x % b) % a):\n summary += 1\n prefix_sum.append(summary)\n elsge:\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(int(input(()):\n n==int(input())\n arr=list(map(intinput().split()))\n mex1==0\n for i in range(102:\n for j in range(n):\n ifa arr[j]==mex1:\n mex1-=1\n arr[j]=-1\n break\n mex2=0 \n for ...
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\ntesting = len(sys.argv) > 2 and sys.argv[1] == \"i.txt\" and sys.argv[2] == \"o.txt\"\nif testing:\n from time import time\n start_time = int(round(time() * 1000)) \n sys.stdout = open(sys.argv[2], 'w')\n input = open(sys.argv[1], 'r').readline\nelse:\n ...