task_id stringlengths 4 25 | family stringclasses 12
values | bug_pattern stringclasses 37
values | case_seed int64 20.3M 20.5M | prompt stringlengths 299 1.09k | starter stringclasses 48
values | split stringclasses 1
value | arena_selected bool 2
classes | num_cases int64 92 188 | cases_json stringlengths 5.75k 15.3k |
|---|---|---|---|---|---|---|---|---|---|
fifo-inventory-b0-s18 | fifo-inventory | baseline | 20,403,550 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
return [0,lots]
| train | true | 124 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,941]],21],"expected":null},{"args":[[[3,353],[5,746],[7,766],[7,589],[4,606],[7,738],[7,930],[4,536]],22],"expected":[14274,[[4,6... |
fifo-inventory-b1-s18 | fifo-inventory | zero-lot-retention | 20,403,550 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = min(q,demand)
demand -= used
cost += used*p
if q >= used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 124 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,941]],21],"expected":null},{"args":[[[3,353],[5,746],[7,766],[7,589],[4,606],[7,738],[7,930],[4,536]],22],"expected":[14274,[[4,6... |
fifo-inventory-b2-s18 | fifo-inventory | over-consumption | 20,403,550 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = max(q,demand)
demand -= used
cost += used*p
if q-used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 124 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,941]],21],"expected":null},{"args":[[[3,353],[5,746],[7,766],[7,589],[4,606],[7,738],[7,930],[4,536]],22],"expected":[14274,[[4,6... |
fifo-inventory-b3-s18 | fifo-inventory | unit-cost-not-quantity | 20,403,550 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = min(q,demand)
demand -= used
cost += p
if q-used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 124 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,941]],21],"expected":null},{"args":[[[3,353],[5,746],[7,766],[7,589],[4,606],[7,738],[7,930],[4,536]],22],"expected":[14274,[[4,6... |
csv-row-b0-s18 | csv-row | baseline | 20,403,550 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\"\"\" a ab\"\"\"\"\",\"猫\"\"b,,a\",\",aba\"\... | def solve(row):
return row.split(',') if row else []
| train | false | 145 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":[",\"bb ,a \",\"\"\" ,\"\",a猫ab\"\"\",,\"aab\"\"bb\",\" 猫a \"\"猫aa,猫猫\""... |
csv-row-b1-s18 | csv-row | quoted-comma | 20,403,550 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\"\"\"bab\",\"a\"\",a\""], "expected": ["\"ba... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '"'
i += 1
else: quoted = not quoted
... | train | false | 145 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":[",\"bb ,a \",\"\"\" ,\"\",a猫ab\"\"\",,\"aab\"\"bb\",\" 猫a \"\"猫aa,猫猫\""... |
csv-row-b2-s18 | csv-row | escaped-quote | 20,403,550 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\",a,\", a猫猫b"], "expected": [",a,", " a猫猫b"]... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '""'
i += 1
else: quoted = not quoted
... | train | false | 145 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":[",\"bb ,a \",\"\"\" ,\"\",a猫ab\"\"\",,\"aab\"\"bb\",\" 猫a \"\"猫aa,猫猫\""... |
csv-row-b3-s18 | csv-row | lost-final-field | 20,403,550 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["a猫b ,\"b,, bb\"\"a猫a猫\""], "expected": ["a猫b ... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '"'
i += 1
else: quoted = not quoted
... | train | false | 145 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":[",\"bb ,a \",\"\"\" ,\"\",a猫ab\"\"\",,\"aab\"\"bb\",\" 猫a \"\"猫aa,猫猫\""... |
shortest-path-b0-s18 | shortest-path | baseline | 20,403,550 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [["5", 4]], "1"... | def solve(graph,start,target):
return 0 if start == target else None
| train | false | 100 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["3",9],["4",5],["5",9],["6",1],["7",5]],"1":[["4",5],["6",4]],"2":[["5",0],["6",0],["7",1]],"3":[["0",8],["1",0],["7",2]],"4":[["0",2],["5",3]],"5":[["2",5],["3... |
shortest-path-b1-s18 | shortest-path | farthest-first | 20,403,550 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [], "1": [["2",... | def solve(graph,start,target):
dist = {start:0}
visited = set()
while True:
candidates = [n for n in dist if n not in visited]
if not candidates: return None
n = max(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 100 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["3",9],["4",5],["5",9],["6",1],["7",5]],"1":[["4",5],["6",4]],"2":[["5",0],["6",0],["7",1]],"3":[["0",8],["1",0],["7",2]],"4":[["0",2],["5",3]],"5":[["2",5],["3... |
shortest-path-b2-s18 | shortest-path | lost-path-prefix | 20,403,550 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"a": [["b", 141], ["... | def solve(graph,start,target):
dist = {start:0}
visited = set()
while True:
candidates = [n for n in dist if n not in visited]
if not candidates: return None
n = min(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 100 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["3",9],["4",5],["5",9],["6",1],["7",5]],"1":[["4",5],["6",4]],"2":[["5",0],["6",0],["7",1]],"3":[["0",8],["1",0],["7",2]],"4":[["0",2],["5",3]],"5":[["2",5],["3... |
shortest-path-b3-s18 | shortest-path | missing-relaxation | 20,403,550 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [["3", 6], ["5"... | def solve(graph,start,target):
dist = {start:0}
visited = set()
while True:
candidates = [n for n in dist if n not in visited]
if not candidates: return None
n = min(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 100 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["3",9],["4",5],["5",9],["6",1],["7",5]],"1":[["4",5],["6",4]],"2":[["5",0],["6",0],["7",1]],"3":[["0",8],["1",0],["7",2]],"4":[["0",2],["5",3]],"5":[["2",5],["3... |
merge-intervals-b0-s19 | merge-intervals | baseline | 20,411,469 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[22, 27], [-4, 3], [0, 6], [-15, -11], [10, 10], [1, 4]]], "expected": [[-15, -... | def solve(intervals):
return sorted(intervals)
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[22,29],[12,15],[-6,-3],[1,5],[-1,0],[25,26]]],"expected":[[-6,-3],[-1,0],[1,5],[12,15],[22,29]]},{"args":[[[18,19],[3,8],[-8,-6],[28,30],[-17,-11]]],"expected":[[-17,-11],[-8,-6],[3,8],[18,19],[28,30]]},{"args":[[[6,11],[-8,-7],[1... |
merge-intervals-b1-s19 | merge-intervals | touching-boundary | 20,411,469 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[41, 46], [38, 41]]], "expected": [[38, 46]]}, {"args": [[[-8, -3], [-4, 1], [1... | def solve(intervals):
out = []
for a,b in sorted(intervals):
if out and a < out[-1][1]:
out[-1][1] = max(b, out[-1][1])
else:
out.append([a,b])
return out
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[22,29],[12,15],[-6,-3],[1,5],[-1,0],[25,26]]],"expected":[[-6,-3],[-1,0],[1,5],[12,15],[22,29]]},{"args":[[[18,19],[3,8],[-8,-6],[28,30],[-17,-11]]],"expected":[[-17,-11],[-8,-6],[3,8],[18,19],[28,30]]},{"args":[[[6,11],[-8,-7],[1... |
merge-intervals-b2-s19 | merge-intervals | nested-endpoint | 20,411,469 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-8, 0], [-7, -6]]], "expected": [[-8, 0]]}, {"args": [[[-3, -1], [3, 5], [-17,... | def solve(intervals):
out = []
for a,b in sorted(intervals):
if out and a <= out[-1][1]:
out[-1][1] = min(b, out[-1][1])
else:
out.append([a,b])
return out
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[22,29],[12,15],[-6,-3],[1,5],[-1,0],[25,26]]],"expected":[[-6,-3],[-1,0],[1,5],[12,15],[22,29]]},{"args":[[[18,19],[3,8],[-8,-6],[28,30],[-17,-11]]],"expected":[[-17,-11],[-8,-6],[3,8],[18,19],[28,30]]},{"args":[[[6,11],[-8,-7],[1... |
merge-intervals-b3-s19 | merge-intervals | unsorted-input | 20,411,469 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-1, 2], [-16, -9], [13, 15], [9, 9], [-20, -19], [9, 11], [-5, -4], [9, 13], [... | def solve(intervals):
out = []
for a,b in intervals:
if out and a <= out[-1][1]:
out[-1][1] = max(b, out[-1][1])
else:
out.append([a,b])
return out
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[22,29],[12,15],[-6,-3],[1,5],[-1,0],[25,26]]],"expected":[[-6,-3],[-1,0],[1,5],[12,15],[22,29]]},{"args":[[[18,19],[3,8],[-8,-6],[28,30],[-17,-11]]],"expected":[[-17,-11],[-8,-6],[3,8],[18,19],[28,30]]},{"args":[[[6,11],[-8,-7],[1... |
moving-sums-b0-s19 | moving-sums | baseline | 20,411,469 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[-30, 19, -29, 20, -14, -19, -9, 16, 25, 7, -9], 0], "expected": []}, {"args": [[-7, -15, 25, -28, -18, -7, 6], 1], "expected": [-7, -15, 25, -28, -18, -7... | def solve(values,k):
return [sum(values[i:i+k]) for i in range(len(values)-k)]
| train | false | 142 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[35,-40,92,77,-74,95,99,91,-15,-29],7],"expected":[284,340,365,244]},{"args":[[-81,29,34,-23,-9,-15,36,-45,-92,-69,-5,8,25,31],17],"expected":[]},{"args":[[72,32,0,80,-15,35,-100,... |
moving-sums-b1-s19 | moving-sums | zero-window | 20,411,469 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[15, 27, 24, 8, -25, 6, -4, 5], 2], "expected": [42, 51, 32, -17, -19, 2, 1]}, {"args": [[-26, -27, -2, 21, 1, 16, -27, -18, 2, 4, -12, 30], 0], "expected... | def solve(values,k):
if k < 0 or k > len(values): return []
return [sum(values[i:i+k]) for i in range(len(values)-k+1)]
| train | false | 142 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[35,-40,92,77,-74,95,99,91,-15,-29],7],"expected":[284,340,365,244]},{"args":[[-81,29,34,-23,-9,-15,36,-45,-92,-69,-5,8,25,31],17],"expected":[]},{"args":[[72,32,0,80,-15,35,-100,... |
moving-sums-b2-s19 | moving-sums | window-width | 20,411,469 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[67, -49, 29, -78, 100, -24, -81, 74, -31, -100, 9, -22, 22, -63], 10], "expected": [-93, -151, -124, -131, -116]}, {"args": [[12, -23, 30, -15, -4, -28, ... | def solve(values,k):
if k <= 0 or k > len(values): return []
return [sum(values[i:i+k-1]) for i in range(len(values)-k+1)]
| train | false | 142 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[35,-40,92,77,-74,95,99,91,-15,-29],7],"expected":[284,340,365,244]},{"args":[[-81,29,34,-23,-9,-15,36,-45,-92,-69,-5,8,25,31],17],"expected":[]},{"args":[[72,32,0,80,-15,35,-100,... |
moving-sums-b3-s19 | moving-sums | missing-first-window | 20,411,469 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[-26, -27, -2, 21, 1, 16, -27, -18, 2, 4, -12, 30], 2], "expected": [-53, -29, 19, 22, 17, -11, -45, -16, 6, -8, 18]}, {"args": [[-38, -21, 67, -41, 5, -3... | def solve(values,k):
if k <= 0 or k > len(values): return []
return [sum(values[i:i+k]) for i in range(1,len(values)-k+1)]
| train | false | 142 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[35,-40,92,77,-74,95,99,91,-15,-29],7],"expected":[284,340,365,244]},{"args":[[-81,29,34,-23,-9,-15,36,-45,-92,-69,-5,8,25,31],17],"expected":[]},{"args":[[72,32,0,80,-15,35,-100,... |
weighted-mean-b0-s19 | weighted-mean | baseline | 20,411,469 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[1, 48, 41, -1, 33], [1, 1, 4, 0, 1]], "expected": 35.142857142857146}, {"args": [[15, 22... | def solve(values,weights):
return sum(values)/len(values) if values else None
| train | false | 121 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[29,47,26,-28,-22,25,-3,3,24,9],[0,1,2,3,2,2,5,0,1,5]],"expected":3.5714285714285716},{"args":[[-14,-42,0,50,-4,-44,20,-46,11,-18,-37,40,34],[5,1,1,5,5,4,3,3,1,4,2,1,0]],"expected":-6.6},{"args":[[9,-12... |
weighted-mean-b1-s19 | weighted-mean | unweighted-numerator | 20,411,469 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[-19, -12], [1, 5]], "expected": -13.166666666666666}, {"args": [[-15, 25], [0, 5]], "exp... | def solve(values,weights):
total = sum(weights)
return sum(x for x,w in zip(values,weights))/total if total else None
| train | false | 121 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[29,47,26,-28,-22,25,-3,3,24,9],[0,1,2,3,2,2,5,0,1,5]],"expected":3.5714285714285716},{"args":[[-14,-42,0,50,-4,-44,20,-46,11,-18,-37,40,34],[5,1,1,5,5,4,3,3,1,4,2,1,0]],"expected":-6.6},{"args":[[9,-12... |
weighted-mean-b2-s19 | weighted-mean | wrong-denominator | 20,411,469 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[-19, -12], [0, 0]], "expected": null}, {"args": [[32, -21, 20, -18, 29, -22, -36, -38, 4... | def solve(values,weights):
total = len(weights)
return sum(x*w for x,w in zip(values,weights))/total if total else None
| train | false | 121 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[29,47,26,-28,-22,25,-3,3,24,9],[0,1,2,3,2,2,5,0,1,5]],"expected":3.5714285714285716},{"args":[[-14,-42,0,50,-4,-44,20,-46,11,-18,-37,40,34],[5,1,1,5,5,4,3,3,1,4,2,1,0]],"expected":-6.6},{"args":[[9,-12... |
weighted-mean-b3-s19 | weighted-mean | zero-weight-result | 20,411,469 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[-25, 50, 21, -2, 13, 30, 26, 35, -23, -46, 47, 0, -32, 33, 27, 43], [0, 0, 4, 3, 1, 5, 4... | def solve(values,weights):
total = sum(weights)
return sum(x*w for x,w in zip(values,weights))/total if total else 0
| train | true | 121 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[29,47,26,-28,-22,25,-3,3,24,9],[0,1,2,3,2,2,5,0,1,5]],"expected":3.5714285714285716},{"args":[[-14,-42,0,50,-4,-44,20,-46,11,-18,-37,40,34],[5,1,1,5,5,4,3,3,1,4,2,1,0]],"expected":-6.6},{"args":[[9,-12... |
stable-unique-b0-s19 | stable-unique | baseline | 20,411,469 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-5]], "expected": [-5]}, {"args": [[-7, -9, -7, -8, -9]], "expected": [-7, -9, -8]}, {"args": [[2, -4, 9, 9, -10, -6, -3, -7, -9, 4, -4, -5, -2, 8, -... | def solve(values):
return sorted(set(values))
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[6,-5,1,8,0,-5,-9,-4,1,2,-1,0,-7,8,-10,-8,0,-10,-5,5,-6,-3,3,-2,7,8,6,7]],"expected":[6,-5,1,8,0,-9,-4,2,-1,-7,-10,-8,5,-6,-3,3,-2,7]},{"args":[[-5,4,3,4,-1,-9,0,9,-10,-6,-3,-9]],"expected":[-5,4,3,-1,-9,0,9,-10,-6,-3]},{"args":[[-3,9,-6,7,... |
stable-unique-b1-s19 | stable-unique | reverse-traversal | 20,411,469 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-7, 6, 2, -7, 4, -9, -6]], "expected": [-7, 6, 2, 4, -9, -6]}, {"args": [[-9, 3, -7, 0, 9, 6, 0, 7, -7, -1]], "expected": [-9, 3, -7, 0, 9, 6, 7, -1]... | def solve(values):
seen = set()
out = []
for x in reversed(values):
if x not in seen:
seen.add(x)
out.append(x)
return out
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[6,-5,1,8,0,-5,-9,-4,1,2,-1,0,-7,8,-10,-8,0,-10,-5,5,-6,-3,3,-2,7,8,6,7]],"expected":[6,-5,1,8,0,-9,-4,2,-1,-7,-10,-8,5,-6,-3,3,-2,7]},{"args":[[-5,4,3,4,-1,-9,0,9,-10,-6,-3,-9]],"expected":[-5,4,3,-1,-9,0,9,-10,-6,-3]},{"args":[[-3,9,-6,7,... |
stable-unique-b2-s19 | stable-unique | reverse-output | 20,411,469 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-1, 2, -8, -5, -2, 1, 2, -1, -2, -5, -5, 2]], "expected": [-1, 2, -8, -5, -2, 1]}, {"args": [[-6, 7, 6, 1, 9, -2, -8]], "expected": [-6, 7, 6, 1, 9, ... | def solve(values):
seen = set()
out = []
for x in values:
if x not in seen:
seen.add(x)
out.insert(0,x)
return out
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[6,-5,1,8,0,-5,-9,-4,1,2,-1,0,-7,8,-10,-8,0,-10,-5,5,-6,-3,3,-2,7,8,6,7]],"expected":[6,-5,1,8,0,-9,-4,2,-1,-7,-10,-8,5,-6,-3,3,-2,7]},{"args":[[-5,4,3,4,-1,-9,0,9,-10,-6,-3,-9]],"expected":[-5,4,3,-1,-9,0,9,-10,-6,-3]},{"args":[[-3,9,-6,7,... |
stable-unique-b3-s19 | stable-unique | wrong-seen-value | 20,411,469 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[7, -1, -2, 2, 9, -5, -9, 10]], "expected": [7, -1, -2, 2, 9, -5, -9, 10]}, {"args": [[21, 19, 21, 20, 19]], "expected": [21, 19, 20]}, {"args": [[-10... | def solve(values):
seen = set()
out = []
for x in values:
if x not in seen:
seen.add(-x)
out.append(x)
return out
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[6,-5,1,8,0,-5,-9,-4,1,2,-1,0,-7,8,-10,-8,0,-10,-5,5,-6,-3,3,-2,7,8,6,7]],"expected":[6,-5,1,8,0,-9,-4,2,-1,-7,-10,-8,5,-6,-3,3,-2,7]},{"args":[[-5,4,3,4,-1,-9,0,9,-10,-6,-3,-9]],"expected":[-5,4,3,-1,-9,0,9,-10,-6,-3]},{"args":[[-3,9,-6,7,... |
run-length-b0-s19 | run-length | baseline | 20,411,469 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": [" 🙂a猫c猫🙂 猫 c🙂🙂b 猫 caba"], "expected": [[" ", 1], ["🙂", 1], ["a", 1], ["猫", 1], ["c", ... | def solve(text):
return [[c,text.count(c)] for c in sorted(set(text))]
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["abb ccaba🙂b 🙂"],"expected":[["a",1],["b",2],[" ",1],["c",2],["a",1],["b",1],["a",1],["🙂",1],["b",1],[" ",1],["🙂",1]]},{"args":["a 猫a a🙂 b 🙂a "],"expected":[["a... |
run-length-b1-s19 | run-length | inverted-grouping | 20,411,469 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": [" 🙂aaa🙂ab 猫 🙂caab b "], "expected": [[" ", 1], ["🙂", 1], ["a", 3], ["🙂", 1], ["a", 1]... | def solve(text):
out = []
for c in text:
if out and out[-1][0] != c: out[-1][1] += 1
else: out.append([c,1])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["abb ccaba🙂b 🙂"],"expected":[["a",1],["b",2],[" ",1],["c",2],["a",1],["b",1],["a",1],["🙂",1],["b",1],[" ",1],["🙂",1]]},{"args":["a 猫a a🙂 b 🙂a "],"expected":[["a... |
run-length-b2-s19 | run-length | double-increment | 20,411,469 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["ac cba ccaab cc🙂 🙂🙂bcac 猫🙂猫a "], "expected": [["a", 1], ["c", 1], [" ", 1], ["c", 1], ["... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 2
else: out.append([c,1])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["abb ccaba🙂b 🙂"],"expected":[["a",1],["b",2],[" ",1],["c",2],["a",1],["b",1],["a",1],["🙂",1],["b",1],[" ",1],["🙂",1]]},{"args":["a 猫a a🙂 b 🙂a "],"expected":[["a... |
run-length-b3-s19 | run-length | zero-initial-count | 20,411,469 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["c猫c b猫aab猫ca"], "expected": [["c", 1], ["猫", 1], ["c", 1], [" ", 1], ["b", 1], ["猫", 1], ["a... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 1
else: out.append([c,0])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["abb ccaba🙂b 🙂"],"expected":[["a",1],["b",2],[" ",1],["c",2],["a",1],["b",1],["a",1],["🙂",1],["b",1],[" ",1],["🙂",1]]},{"args":["a 猫a a🙂 b 🙂a "],"expected":[["a... |
luhn-b0-s19 | luhn | baseline | 20,411,469 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["8343920493805567"], "expected": ... | def solve(text):
return bool(text) and text.isdigit() and sum(int(c) for c in text)%10 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["299862673"],"expected":false},... |
luhn-b1-s19 | luhn | wrong-parity | 20,411,469 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["87792"], "expected": false}, {"a... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if not i%2:
v *= 2
if v > 9: v -= 9
total += v
return total%10 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["299862673"],"expected":false},... |
luhn-b2-s19 | luhn | wrong-reduction | 20,411,469 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["552712577319043366"], "expected"... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if i%2:
v *= 2
if v > 9: v -= 8
total += v
return total%10 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["299862673"],"expected":false},... |
luhn-b3-s19 | luhn | wrong-modulus | 20,411,469 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["4122337345952"], "expected": fal... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if i%2:
v *= 2
if v > 9: v -= 9
total += v
return total%9 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["299862673"],"expected":false},... |
edit-distance-b0-s19 | edit-distance | baseline | 20,411,469 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["baccc", "cccab"], "expected": 4}, {"args": ["abb", ""], "expected": 3}, {"args": ["", "ddcddaccbad"], "expected": 11}] | def solve(a,b):
return abs(len(a)-len(b))
| train | false | 143 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["ac猫cb猫bb猫a","ccd猫"],"expected":7},{"args":["猫","c"],"expected":1},{"args":["dc猫aca猫c","cabcdddc"],"expected":6},{"args":["dacb","aabcd"],"expected":3},{"args":["猫cbaadb","猫a猫猫dacbaa猫"],"expected":7},{"arg... |
edit-distance-b1-s19 | edit-distance | row-boundary | 20,411,469 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["c猫c猫aa猫猫猫ca", "c猫c猫aa猫猫猫ca"], "expected": 0}, {"args": ["aca猫ab猫a猫ca猫", "猫ac猫a猫ba猫aca"], "expected": 6}, {"args": ["c猫猫bca", ""], "ex... | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [0]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x != y)))
row = nxt
return row[-1]
| train | false | 143 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["ac猫cb猫bb猫a","ccd猫"],"expected":7},{"args":["猫","c"],"expected":1},{"args":["dc猫aca猫c","cabcdddc"],"expected":6},{"args":["dacb","aabcd"],"expected":3},{"args":["猫cbaadb","猫a猫猫dacbaa猫"],"expected":7},{"arg... |
edit-distance-b2-s19 | edit-distance | inverted-substitution | 20,411,469 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["", "猫猫a猫bdcaba"], "expected": 10}, {"args": ["猫caca", ""], "expected": 5}, {"args": ["ac猫cb猫bb猫a", "ccd猫"], "expected": 7}] | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [i]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x == y)))
row = nxt
return row[-1]
| train | false | 143 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["ac猫cb猫bb猫a","ccd猫"],"expected":7},{"args":["猫","c"],"expected":1},{"args":["dc猫aca猫c","cabcdddc"],"expected":6},{"args":["dacb","aabcd"],"expected":3},{"args":["猫cbaadb","猫a猫猫dacbaa猫"],"expected":7},{"arg... |
edit-distance-b3-s19 | edit-distance | diagonal-index | 20,411,469 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["accbabc", "accbabc"], "expected": 0}, {"args": ["dcbd猫d猫猫ac", "a猫猫dada猫猫d"], "expected": 7}, {"args": ["aca猫ab猫a猫ca猫", "aca猫ab猫a猫ca猫"... | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [i]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j]+(x != y)))
row = nxt
return row[-1]
| train | false | 143 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["ac猫cb猫bb猫a","ccd猫"],"expected":7},{"args":["猫","c"],"expected":1},{"args":["dc猫aca猫c","cabcdddc"],"expected":6},{"args":["dacb","aabcd"],"expected":3},{"args":["猫cbaadb","猫a猫猫dacbaa猫"],"expected":7},{"arg... |
meeting-rooms-b0-s19 | meeting-rooms | baseline | 20,411,469 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[11, 18], [7, 10], [16, 19], [16, 20], [12, 19], [13, 14], [13, 17]]], "expec... | def solve(intervals):
return len(intervals)
| train | false | 118 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[0,6],[9,15],[3,9],[1,4],[1,2],[12,16],[0,8]]],"expected":4},{"args":[[[6,10],[1,7],[3,10],[10,16],[15,22],[11,18],[10,14],[5,9],[18,19],[15,21],[16,20],[6,13],[11,12],[9,17]]],"expected":6},{"args":[... |
meeting-rooms-b1-s19 | meeting-rooms | tie-order | 20,411,469 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[-7, -5], [-5, -3]]], "expected": 1}, {"args": [[[14, 15], [11, 17]]], "expec... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,-1])
active = best = 0
for t,d in sorted(events,key=lambda item:(item[0],-item[1])):
active += d
best = max(best,active)
return best
| train | true | 118 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[0,6],[9,15],[3,9],[1,4],[1,2],[12,16],[0,8]]],"expected":4},{"args":[[[6,10],[1,7],[3,10],[10,16],[15,22],[11,18],[10,14],[5,9],[18,19],[15,21],[16,20],[6,13],[11,12],[9,17]]],"expected":6},{"args":[... |
meeting-rooms-b2-s19 | meeting-rooms | peak-tracking | 20,411,469 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[39, 47], [40, 42], [41, 46]]], "expected": 3}, {"args": [[[4, 8], [7, 10], [... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,-1])
active = best = 0
for t,d in sorted(events):
active += d
best = min(best,active)
return best
| train | false | 118 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[0,6],[9,15],[3,9],[1,4],[1,2],[12,16],[0,8]]],"expected":4},{"args":[[[6,10],[1,7],[3,10],[10,16],[15,22],[11,18],[10,14],[5,9],[18,19],[15,21],[16,20],[6,13],[11,12],[9,17]]],"expected":6},{"args":[... |
meeting-rooms-b3-s19 | meeting-rooms | end-event-sign | 20,411,469 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[9, 17], [3, 9], [12, 17], [15, 22], [12, 13], [13, 17], [9, 13], [17, 18], [... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,1])
active = best = 0
for t,d in sorted(events):
active += d
best = max(best,active)
return best
| train | false | 118 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[0,6],[9,15],[3,9],[1,4],[1,2],[12,16],[0,8]]],"expected":4},{"args":[[[6,10],[1,7],[3,10],[10,16],[15,22],[11,18],[10,14],[5,9],[18,19],[15,21],[16,20],[6,13],[11,12],[9,17]]],"expected":6},{"args":[... |
nearest-percentile-b0-s19 | nearest-percentile | baseline | 20,411,469 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[-20, -23, -18, -33, -26, -21, -19, -31, -27, -24, -29, -25, -28, -34, -32, -30, -22], 50], "expected"... | def solve(values,p):
return sorted(values)[int(p/100*len(values))] if values else None
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[33,-42,-28,11,55,-46,99,-58,-94,84,5,30,13,16,35,12,-64,-44,-39,52],50],"expected":11},{"args":[[-51,-43,35,43,-30,46,-69,-86,-34,-13,-47,-50,30,84,42,-96,-32,85,86,-61,-7... |
nearest-percentile-b1-s19 | nearest-percentile | floor-not-ceiling | 20,411,469 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[18, 21, 7, 16, 14, 20, 5, 9, 12, 15, 19, 11, 24, 23, 25, 13, 4, 6, 8, 22, 10, 17, 3], 33], "expected"... | def solve(values,p):
if not values: return None
rank = max(1,(p*len(values)+0)//100)
return sorted(values)[rank-1]
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[33,-42,-28,11,55,-46,99,-58,-94,84,5,30,13,16,35,12,-64,-44,-39,52],50],"expected":11},{"args":[[-51,-43,35,43,-30,46,-69,-86,-34,-13,-47,-50,30,84,42,-96,-32,85,86,-61,-7... |
nearest-percentile-b2-s19 | nearest-percentile | rank-index | 20,411,469 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[3, 7, 6, 52, 92, 100, 43, 65, 89, -41, 36, -9, -33, -95, -2, -52], 100], "expected": 100}, {"args": [... | def solve(values,p):
if not values: return None
rank = max(1,(p*len(values)+99)//100)
return sorted(values)[rank-2]
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[33,-42,-28,11,55,-46,99,-58,-94,84,5,30,13,16,35,12,-64,-44,-39,52],50],"expected":11},{"args":[[-51,-43,35,43,-30,46,-69,-86,-34,-13,-47,-50,30,84,42,-96,-32,85,86,-61,-7... |
nearest-percentile-b3-s19 | nearest-percentile | descending-order | 20,411,469 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[-3, -7, -10, -6, -14, -5, -4, -11, -9, -12, -2, -8, -13], 33], "expected": -10}, {"args": [[10, -49, ... | def solve(values,p):
if not values: return None
rank = max(1,(p*len(values)+99)//100)
return sorted(values,reverse=True)[rank-1]
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[33,-42,-28,11,55,-46,99,-58,-94,84,5,30,13,16,35,12,-64,-44,-39,52],50],"expected":11},{"args":[[-51,-43,35,43,-30,46,-69,-86,-34,-13,-47,-50,30,84,42,-96,-32,85,86,-61,-7... |
fifo-inventory-b0-s19 | fifo-inventory | baseline | 20,411,469 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
return [0,lots]
| train | false | 121 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[2,265],[2,947],[4,17],[2,123],[0,731],[5,832],[3,608],[0,464],[4,823]],3],"expected":[1477,[[1,947],[4,17],[2,123],[5,832],[3,608],... |
fifo-inventory-b1-s19 | fifo-inventory | zero-lot-retention | 20,411,469 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = min(q,demand)
demand -= used
cost += used*p
if q >= used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 121 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[2,265],[2,947],[4,17],[2,123],[0,731],[5,832],[3,608],[0,464],[4,823]],3],"expected":[1477,[[1,947],[4,17],[2,123],[5,832],[3,608],... |
fifo-inventory-b2-s19 | fifo-inventory | over-consumption | 20,411,469 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = max(q,demand)
demand -= used
cost += used*p
if q-used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 121 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[2,265],[2,947],[4,17],[2,123],[0,731],[5,832],[3,608],[0,464],[4,823]],3],"expected":[1477,[[1,947],[4,17],[2,123],[5,832],[3,608],... |
fifo-inventory-b3-s19 | fifo-inventory | unit-cost-not-quantity | 20,411,469 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = min(q,demand)
demand -= used
cost += p
if q-used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 121 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[2,265],[2,947],[4,17],[2,123],[0,731],[5,832],[3,608],[0,464],[4,823]],3],"expected":[1477,[[1,947],[4,17],[2,123],[5,832],[3,608],... |
csv-row-b0-s19 | csv-row | baseline | 20,411,469 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["a"], "expected": ["a"]}, {"args": ["x14,"], "... | def solve(row):
return row.split(',') if row else []
| train | false | 146 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":["\"\"\"abb\",\" b\"\" 猫\",\"a猫 ,猫a, \",\" , 猫\"\"\",\"aa,\",\"aa猫b, ... |
csv-row-b1-s19 | csv-row | quoted-comma | 20,411,469 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\"x6,y\",z"], "expected": ["x6,y", "z"]}, {"a... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '"'
i += 1
else: quoted = not quoted
... | train | false | 146 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":["\"\"\"abb\",\" b\"\" 猫\",\"a猫 ,猫a, \",\" , 猫\"\"\",\"aa,\",\"aa猫b, ... |
csv-row-b2-s19 | csv-row | escaped-quote | 20,411,469 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\"\"\"a\",\"\"\"aa 猫猫 猫\",\"\"\"a,猫bb,\"\"b\"... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '""'
i += 1
else: quoted = not quoted
... | train | false | 146 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":["\"\"\"abb\",\" b\"\" 猫\",\"a猫 ,猫a, \",\" , 猫\"\"\",\"aa,\",\"aa猫b, ... |
csv-row-b3-s19 | csv-row | lost-final-field | 20,411,469 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\"x18,y\",z"], "expected": ["x18,y", "z"]}, {... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '"'
i += 1
else: quoted = not quoted
... | train | false | 146 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":["\"\"\"abb\",\" b\"\" 猫\",\"a猫 ,猫a, \",\" , 猫\"\"\",\"aa,\",\"aa猫b, ... |
shortest-path-b0-s19 | shortest-path | baseline | 20,411,469 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [["2", 1], ["3"... | def solve(graph,start,target):
return 0 if start == target else None
| train | false | 94 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",0]],"1":[["0",6]],"2":[]},"0","2"],"expected":null},{"args":[{"0":[["6",1],["7",6]],"1":[["7",3]],"2":[["7",8]],"3":[["0",8],["4",4]],"4":[["7",8]],"5":[["0... |
shortest-path-b1-s19 | shortest-path | farthest-first | 20,411,469 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [["2", 8]], "1"... | def solve(graph,start,target):
dist = {start:0}
visited = set()
while True:
candidates = [n for n in dist if n not in visited]
if not candidates: return None
n = max(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 94 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",0]],"1":[["0",6]],"2":[]},"0","2"],"expected":null},{"args":[{"0":[["6",1],["7",6]],"1":[["7",3]],"2":[["7",8]],"3":[["0",8],["4",4]],"4":[["7",8]],"5":[["0... |
shortest-path-b2-s19 | shortest-path | lost-path-prefix | 20,411,469 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [], "1": [], "2... | def solve(graph,start,target):
dist = {start:0}
visited = set()
while True:
candidates = [n for n in dist if n not in visited]
if not candidates: return None
n = min(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 94 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",0]],"1":[["0",6]],"2":[]},"0","2"],"expected":null},{"args":[{"0":[["6",1],["7",6]],"1":[["7",3]],"2":[["7",8]],"3":[["0",8],["4",4]],"4":[["7",8]],"5":[["0... |
shortest-path-b3-s19 | shortest-path | missing-relaxation | 20,411,469 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [["2", 6]], "1"... | def solve(graph,start,target):
dist = {start:0}
visited = set()
while True:
candidates = [n for n in dist if n not in visited]
if not candidates: return None
n = min(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 94 | [{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",0]],"1":[["0",6]],"2":[]},"0","2"],"expected":null},{"args":[{"0":[["6",1],["7",6]],"1":[["7",3]],"2":[["7",8]],"3":[["0",8],["4",4]],"4":[["7",8]],"5":[["0... |
merge-intervals-b0-s20 | merge-intervals | baseline | 20,419,388 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-15, -9], [-15, -15]]], "expected": [[-15, -9]]}, {"args": [[[-1, -1], [-13, -... | def solve(intervals):
return sorted(intervals)
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-13,-6],[10,12],[29,34],[-9,-5],[16,23],[12,19],[22,22],[-10,-8]]],"expected":[[-13,-5],[10,23],[29,34]]},{"args":[[[20,24],[-18,-12],[-20,-17],[-16,-16],[25,27]]],"expected":[[-20,-12],[20,24],[25,27]]},{"args":[[[8,11],[-6,-4],[... |
merge-intervals-b1-s20 | merge-intervals | touching-boundary | 20,419,388 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-4, -3], [18, 22], [-7, -2]]], "expected": [[-7, -2], [18, 22]]}, {"args": [[[... | def solve(intervals):
out = []
for a,b in sorted(intervals):
if out and a < out[-1][1]:
out[-1][1] = max(b, out[-1][1])
else:
out.append([a,b])
return out
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-13,-6],[10,12],[29,34],[-9,-5],[16,23],[12,19],[22,22],[-10,-8]]],"expected":[[-13,-5],[10,23],[29,34]]},{"args":[[[20,24],[-18,-12],[-20,-17],[-16,-16],[25,27]]],"expected":[[-20,-12],[20,24],[25,27]]},{"args":[[[8,11],[-6,-4],[... |
merge-intervals-b2-s20 | merge-intervals | nested-endpoint | 20,419,388 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-1, 3], [18, 23], [17, 17], [0, 6]]], "expected": [[-1, 6], [17, 17], [18, 23]... | def solve(intervals):
out = []
for a,b in sorted(intervals):
if out and a <= out[-1][1]:
out[-1][1] = min(b, out[-1][1])
else:
out.append([a,b])
return out
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-13,-6],[10,12],[29,34],[-9,-5],[16,23],[12,19],[22,22],[-10,-8]]],"expected":[[-13,-5],[10,23],[29,34]]},{"args":[[[20,24],[-18,-12],[-20,-17],[-16,-16],[25,27]]],"expected":[[-20,-12],[20,24],[25,27]]},{"args":[[[8,11],[-6,-4],[... |
merge-intervals-b3-s20 | merge-intervals | unsorted-input | 20,419,388 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-15, -12], [0, 3], [-19, -17], [-6, -1], [12, 15], [26, 32], [28, 35], [8, 9],... | def solve(intervals):
out = []
for a,b in intervals:
if out and a <= out[-1][1]:
out[-1][1] = max(b, out[-1][1])
else:
out.append([a,b])
return out
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-13,-6],[10,12],[29,34],[-9,-5],[16,23],[12,19],[22,22],[-10,-8]]],"expected":[[-13,-5],[10,23],[29,34]]},{"args":[[[20,24],[-18,-12],[-20,-17],[-16,-16],[25,27]]],"expected":[[-20,-12],[20,24],[25,27]]},{"args":[[[8,11],[-6,-4],[... |
moving-sums-b0-s20 | moving-sums | baseline | 20,419,388 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[-14, 24, 7, -28, 9, -18, 3, -1], 1], "expected": [-14, 24, 7, -28, 9, -18, 3, -1]}, {"args": [[89, -60, -100, -25, -63, 24], 12], "expected": []}, {"args... | def solve(values,k):
return [sum(values[i:i+k]) for i in range(len(values)-k)]
| train | false | 143 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-29,-12,-22,-69,99],15],"expected":[]},{"args":[[-65,35,97],3],"expected":[67]},{"args":[[-80,-41,56,-32,18,-23,5,-15,56,-48,-77,56,-85],13],"expected":[-210]},{"args":[[-79,90,-... |
moving-sums-b1-s20 | moving-sums | zero-window | 20,419,388 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[33], 3], "expected": []}, {"args": [[-82, -17, 89, 0, 13, 15, 80, -23, -50, -81], 9], "expected": [25, 26]}, {"args": [[-29, -7, -50, -63], 9], "expected... | def solve(values,k):
if k < 0 or k > len(values): return []
return [sum(values[i:i+k]) for i in range(len(values)-k+1)]
| train | false | 143 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-29,-12,-22,-69,99],15],"expected":[]},{"args":[[-65,35,97],3],"expected":[67]},{"args":[[-80,-41,56,-32,18,-23,5,-15,56,-48,-77,56,-85],13],"expected":[-210]},{"args":[[-79,90,-... |
moving-sums-b2-s20 | moving-sums | window-width | 20,419,388 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[23, -7, -11, 28, -21, -2, 30, 28, -25], 2], "expected": [16, -18, 17, 7, -23, 28, 58, 3]}, {"args": [[-19, -87, -81, -82, 48, -37, 75, 21, -3, -34, -32],... | def solve(values,k):
if k <= 0 or k > len(values): return []
return [sum(values[i:i+k-1]) for i in range(len(values)-k+1)]
| train | false | 143 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-29,-12,-22,-69,99],15],"expected":[]},{"args":[[-65,35,97],3],"expected":[67]},{"args":[[-80,-41,56,-32,18,-23,5,-15,56,-48,-77,56,-85],13],"expected":[-210]},{"args":[[-79,90,-... |
moving-sums-b3-s20 | moving-sums | missing-first-window | 20,419,388 | Implement solve(values,k). Return sums of every contiguous window of length k. k<=0 or k>len(values) returns [].
Examples (JSON args and expected result): [{"args": [[-39, -27, -18, 29, -22, -54, -85, 90], 8], "expected": [-126]}, {"args": [[18, 11, -4, 27, 8], 0], "expected": []}, {"args": [[14, -34, -36, 46, -50, 75,... | def solve(values,k):
if k <= 0 or k > len(values): return []
return [sum(values[i:i+k]) for i in range(1,len(values)-k+1)]
| train | false | 143 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-29,-12,-22,-69,99],15],"expected":[]},{"args":[[-65,35,97],3],"expected":[67]},{"args":[[-80,-41,56,-32,18,-23,5,-15,56,-48,-77,56,-85],13],"expected":[-210]},{"args":[[-79,90,-... |
weighted-mean-b0-s20 | weighted-mean | baseline | 20,419,388 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[47, 37, -29, 15, 37], [2, 1, 5, 0, 3]], "expected": 8.818181818181818}, {"args": [[-15, ... | def solve(values,weights):
return sum(values)/len(values) if values else None
| train | false | 113 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[7,-23,10,-17,8,-38,-14,-4,35,-36,-39,22,3,19,-47],[2,4,5,1,2,5,5,3,0,4,4,3,4,2,4]],"expected":-14.020833333333334},{"args":[[1,4,-45,38,-1,33,-18,-44,24,34,50,2,11,28,9,29],[5,2,3,4,1,0,2,0,2,5,0,5,2,3... |
weighted-mean-b1-s20 | weighted-mean | unweighted-numerator | 20,419,388 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[33, 0, 24, 27, 37, -24, 41, -27, -2, -12, -35, 14, -3, 1, 34, -19, -14, 8], [0, 0, 2, 3,... | def solve(values,weights):
total = sum(weights)
return sum(x for x,w in zip(values,weights))/total if total else None
| train | false | 113 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[7,-23,10,-17,8,-38,-14,-4,35,-36,-39,22,3,19,-47],[2,4,5,1,2,5,5,3,0,4,4,3,4,2,4]],"expected":-14.020833333333334},{"args":[[1,4,-45,38,-1,33,-18,-44,24,34,50,2,11,28,9,29],[5,2,3,4,1,0,2,0,2,5,0,5,2,3... |
weighted-mean-b2-s20 | weighted-mean | wrong-denominator | 20,419,388 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[-30, -16, 7, 45, -20, 28, -9, 44, 5, -31, 41], [1, 0, 0, 0, 2, 2, 1, 2, 5, 0, 3]], "expe... | def solve(values,weights):
total = len(weights)
return sum(x*w for x,w in zip(values,weights))/total if total else None
| train | false | 113 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[7,-23,10,-17,8,-38,-14,-4,35,-36,-39,22,3,19,-47],[2,4,5,1,2,5,5,3,0,4,4,3,4,2,4]],"expected":-14.020833333333334},{"args":[[1,4,-45,38,-1,33,-18,-44,24,34,50,2,11,28,9,29],[5,2,3,4,1,0,2,0,2,5,0,5,2,3... |
weighted-mean-b3-s20 | weighted-mean | zero-weight-result | 20,419,388 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[26, -7, -24, 43, 39, -11, -30, -23, -4, -32, -10], [5, 5, 5, 1, 3, 5, 4, 1, 2, 4, 0]], "... | def solve(values,weights):
total = sum(weights)
return sum(x*w for x,w in zip(values,weights))/total if total else 0
| train | false | 113 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[7,-23,10,-17,8,-38,-14,-4,35,-36,-39,22,3,19,-47],[2,4,5,1,2,5,5,3,0,4,4,3,4,2,4]],"expected":-14.020833333333334},{"args":[[1,4,-45,38,-1,33,-18,-44,24,34,50,2,11,28,9,29],[5,2,3,4,1,0,2,0,2,5,0,5,2,3... |
stable-unique-b0-s20 | stable-unique | baseline | 20,419,388 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[2, 8, -7, 1, 10, -7, 8, 0, -8, -10, -7, 10, -6, -2, 2, 9, -10, 1, 1, -6, 3, 8, 9, 7]], "expected": [2, 8, -7, 1, 10, 0, -8, -10, -6, -2, 9, 3, 7]}, {... | def solve(values):
return sorted(set(values))
| train | false | 92 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-3,10,3,-10,6,2,6,-7,9,-1,-4,7,10,8,-3,10,1]],"expected":[10,-3,3,-10,6,2,-7,9,-1,-4,7,8,1]},{"args":[[-3,3,-1,9,-5,-2,5,-10,-7,-10,-6,0,7,0,-1,-10,5,1]],"expected":[-3,3,-1,9,-5,-2,5,-10,-7,-6,0,7,1]},{"args":[[9,-3,-3,-1,-9,-8,9,-10,-... |
stable-unique-b1-s20 | stable-unique | reverse-traversal | 20,419,388 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[0, 10, 7, 4, 1, -8, -3, 9, -7, -2, -7, -7, 5, 8, 2, 2, 4, 5, -2, -4]], "expected": [0, 10, 7, 4, 1, -8, -3, 9, -7, -2, 5, 8, 2, -4]}, {"args": [[-6, ... | def solve(values):
seen = set()
out = []
for x in reversed(values):
if x not in seen:
seen.add(x)
out.append(x)
return out
| train | false | 92 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-3,10,3,-10,6,2,6,-7,9,-1,-4,7,10,8,-3,10,1]],"expected":[10,-3,3,-10,6,2,-7,9,-1,-4,7,8,1]},{"args":[[-3,3,-1,9,-5,-2,5,-10,-7,-10,-6,0,7,0,-1,-10,5,1]],"expected":[-3,3,-1,9,-5,-2,5,-10,-7,-6,0,7,1]},{"args":[[9,-3,-3,-1,-9,-8,9,-10,-... |
stable-unique-b2-s20 | stable-unique | reverse-output | 20,419,388 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-6, -5, -5, -9]], "expected": [-6, -5, -9]}, {"args": [[14, 12, 14, 13, 12]], "expected": [14, 12, 13]}, {"args": [[4, -2, 6, 2, 8, 9, 3, 4, -9, 5, 1... | def solve(values):
seen = set()
out = []
for x in values:
if x not in seen:
seen.add(x)
out.insert(0,x)
return out
| train | false | 92 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-3,10,3,-10,6,2,6,-7,9,-1,-4,7,10,8,-3,10,1]],"expected":[10,-3,3,-10,6,2,-7,9,-1,-4,7,8,1]},{"args":[[-3,3,-1,9,-5,-2,5,-10,-7,-10,-6,0,7,0,-1,-10,5,1]],"expected":[-3,3,-1,9,-5,-2,5,-10,-7,-6,0,7,1]},{"args":[[9,-3,-3,-1,-9,-8,9,-10,-... |
stable-unique-b3-s20 | stable-unique | wrong-seen-value | 20,419,388 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[4, 1, 7, 1, 9, -3, 1, -7, -4, 8]], "expected": [4, 1, 7, 9, -3, -7, -4, 8]}, {"args": [[-10, -5, -3, 3, 9, 3, 0, -9, 4, -2, 4, 0]], "expected": [-10,... | def solve(values):
seen = set()
out = []
for x in values:
if x not in seen:
seen.add(-x)
out.append(x)
return out
| train | false | 92 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-3,10,3,-10,6,2,6,-7,9,-1,-4,7,10,8,-3,10,1]],"expected":[10,-3,3,-10,6,2,-7,9,-1,-4,7,8,1]},{"args":[[-3,3,-1,9,-5,-2,5,-10,-7,-10,-6,0,7,0,-1,-10,5,1]],"expected":[-3,3,-1,9,-5,-2,5,-10,-7,-6,0,7,1]},{"args":[[9,-3,-3,-1,-9,-8,9,-10,-... |
run-length-b0-s20 | run-length | baseline | 20,419,388 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["🙂猫bb🙂猫🙂 猫a猫猫 a猫 ba🙂bc🙂 a c"], "expected": [["🙂", 1], ["猫", 1], ["b", 2], ["🙂", 1], ... | def solve(text):
return [[c,text.count(c)] for c in sorted(set(text))]
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["aa🙂🙂猫🙂猫b b 🙂c猫b 猫 a a🙂ac🙂🙂 "],"expected":[["a",2],["🙂",2],["猫",1],["🙂",1],["猫",1],["b",1],[" ",1],["b",1],[" ",1],["🙂",1],["c",1],["猫",1],["b",1],[" ",1],... |
run-length-b1-s20 | run-length | inverted-grouping | 20,419,388 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["b猫b猫猫"], "expected": [["b", 1], ["猫", 1], ["b", 1], ["猫", 2]]}, {"args": ["aa猫c🙂猫ac猫 ca🙂猫�... | def solve(text):
out = []
for c in text:
if out and out[-1][0] != c: out[-1][1] += 1
else: out.append([c,1])
return out
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["aa🙂🙂猫🙂猫b b 🙂c猫b 猫 a a🙂ac🙂🙂 "],"expected":[["a",2],["🙂",2],["猫",1],["🙂",1],["猫",1],["b",1],[" ",1],["b",1],[" ",1],["🙂",1],["c",1],["猫",1],["b",1],[" ",1],... |
run-length-b2-s20 | run-length | double-increment | 20,419,388 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["a 猫cb猫猫ba猫"], "expected": [["a", 1], [" ", 1], ["猫", 1], ["c", 1], ["b", 1], ["猫", 2], ["b",... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 2
else: out.append([c,1])
return out
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["aa🙂🙂猫🙂猫b b 🙂c猫b 猫 a a🙂ac🙂🙂 "],"expected":[["a",2],["🙂",2],["猫",1],["🙂",1],["猫",1],["b",1],[" ",1],["b",1],[" ",1],["🙂",1],["c",1],["猫",1],["b",1],[" ",1],... |
run-length-b3-s20 | run-length | zero-initial-count | 20,419,388 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["猫🙂 a猫 ca 猫b🙂b bbb猫猫cca c"], "expected": [["猫", 1], ["🙂", 1], [" ", 1], ["a", 1], ["猫", 1]... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 1
else: out.append([c,0])
return out
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["aa🙂🙂猫🙂猫b b 🙂c猫b 猫 a a🙂ac🙂🙂 "],"expected":[["a",2],["🙂",2],["猫",1],["🙂",1],["猫",1],["b",1],[" ",1],["b",1],[" ",1],["🙂",1],["c",1],["猫",1],["b",1],[" ",1],... |
luhn-b0-s20 | luhn | baseline | 20,419,388 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["5082876626591229"], "expected": ... | def solve(text):
return bool(text) and text.isdigit() and sum(int(c) for c in text)%10 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["650275630"],"expected":false},... |
luhn-b1-s20 | luhn | wrong-parity | 20,419,388 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["50748343"], "expected": false}, ... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if not i%2:
v *= 2
if v > 9: v -= 9
total += v
return total%10 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["650275630"],"expected":false},... |
luhn-b2-s20 | luhn | wrong-reduction | 20,419,388 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["679884380040"], "expected": true... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if i%2:
v *= 2
if v > 9: v -= 8
total += v
return total%10 == 0
| train | true | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["650275630"],"expected":false},... |
luhn-b3-s20 | luhn | wrong-modulus | 20,419,388 | Implement solve(text). Return whether a nonempty ASCII digit string satisfies the Luhn checksum: starting from right, double every second digit, subtract 9 if >9, and require total divisible by 10. Nondigits/empty input return False.
Examples (JSON args and expected result): [{"args": ["35"], "expected": false}, {"args... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if i%2:
v *= 2
if v > 9: v -= 9
total += v
return total%9 == 0
| train | false | 187 | [{"args":[""],"expected":false},{"args":["0"],"expected":true},{"args":["79927398713"],"expected":true},{"args":["79927398714"],"expected":false},{"args":["12x"],"expected":false},{"args":[" 0"],"expected":false},{"args":["12"],"expected":false},{"args":["0000"],"expected":true},{"args":["650275630"],"expected":false},... |
edit-distance-b0-s20 | edit-distance | baseline | 20,419,388 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["caacbb猫aa猫猫c", ""], "expected": 12}, {"args": ["c猫b猫c", "猫"], "expected": 4}, {"args": ["caacbb猫aa猫猫c", "c猫猫aa猫bbcaac"], "expected": ... | def solve(a,b):
return abs(len(a)-len(b))
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["c","dda猫猫猫a猫"],"expected":8},{"args":["b猫","aa"],"expected":2},{"args":["d","baa"],"expected":3},{"args":["cdb猫猫","a"],"expected":5},{"args":["猫cac猫da猫a猫a","cbdddaadcc猫"],"expected":9},{"args":["bdcb","猫猫... |
edit-distance-b1-s20 | edit-distance | row-boundary | 20,419,388 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["bdacadab", "aa猫a猫aca猫c"], "expected": 7}, {"args": ["adccc", ""], "expected": 5}, {"args": ["aa", "dcdd猫ccad"], "expected": 8}] | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [0]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x != y)))
row = nxt
return row[-1]
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["c","dda猫猫猫a猫"],"expected":8},{"args":["b猫","aa"],"expected":2},{"args":["d","baa"],"expected":3},{"args":["cdb猫猫","a"],"expected":5},{"args":["猫cac猫da猫a猫a","cbdddaadcc猫"],"expected":9},{"args":["bdcb","猫猫... |
edit-distance-b2-s20 | edit-distance | inverted-substitution | 20,419,388 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["猫猫baaaa", ""], "expected": 7}, {"args": ["b", ""], "expected": 1}, {"args": ["ac猫猫猫bbc", "cbb猫猫猫ca"], "expected": 6}] | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [i]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x == y)))
row = nxt
return row[-1]
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["c","dda猫猫猫a猫"],"expected":8},{"args":["b猫","aa"],"expected":2},{"args":["d","baa"],"expected":3},{"args":["cdb猫猫","a"],"expected":5},{"args":["猫cac猫da猫a猫a","cbdddaadcc猫"],"expected":9},{"args":["bdcb","猫猫... |
edit-distance-b3-s20 | edit-distance | diagonal-index | 20,419,388 | Implement solve(a,b). Return Levenshtein edit distance with unit-cost insertion, deletion, and substitution over Unicode characters.
Examples (JSON args and expected result): [{"args": ["bcbdad猫d猫", "猫caa猫"], "expected": 6}, {"args": ["猫猫猫ac猫aa猫猫ba", "猫猫猫ac猫aa猫猫ba"], "expected": 0}, {"args": ["猫a猫", "dcdbc猫adcc"], "exp... | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [i]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j]+(x != y)))
row = nxt
return row[-1]
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["c","dda猫猫猫a猫"],"expected":8},{"args":["b猫","aa"],"expected":2},{"args":["d","baa"],"expected":3},{"args":["cdb猫猫","a"],"expected":5},{"args":["猫cac猫da猫a猫a","cbdddaadcc猫"],"expected":9},{"args":["bdcb","猫猫... |
meeting-rooms-b0-s20 | meeting-rooms | baseline | 20,419,388 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[19, 26], [2, 5], [3, 10], [1, 5], [17, 22], [8, 12], [9, 10]]], "expected": ... | def solve(intervals):
return len(intervals)
| train | false | 116 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[10,13],[19,26],[9,13],[9,17],[12,13],[14,22],[16,24],[1,4]]],"expected":4},{"args":[[[14,16],[10,18],[10,15],[4,10],[15,17],[16,22],[2,9],[13,17],[3,11],[4,7],[15,20],[19,24],[18,26],[12,13],[13,17],... |
meeting-rooms-b1-s20 | meeting-rooms | tie-order | 20,419,388 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[15, 19], [14, 17], [3, 10], [18, 21], [5, 7], [2, 6], [15, 21], [15, 16]]], ... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,-1])
active = best = 0
for t,d in sorted(events,key=lambda item:(item[0],-item[1])):
active += d
best = max(best,active)
return best
| train | false | 116 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[10,13],[19,26],[9,13],[9,17],[12,13],[14,22],[16,24],[1,4]]],"expected":4},{"args":[[[14,16],[10,18],[10,15],[4,10],[15,17],[16,22],[2,9],[13,17],[3,11],[4,7],[15,20],[19,24],[18,26],[12,13],[13,17],... |
meeting-rooms-b2-s20 | meeting-rooms | peak-tracking | 20,419,388 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[15, 19], [9, 13], [12, 15], [5, 8]]], "expected": 2}, {"args": [[[5, 13], [6... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,-1])
active = best = 0
for t,d in sorted(events):
active += d
best = min(best,active)
return best
| train | false | 116 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[10,13],[19,26],[9,13],[9,17],[12,13],[14,22],[16,24],[1,4]]],"expected":4},{"args":[[[14,16],[10,18],[10,15],[4,10],[15,17],[16,22],[2,9],[13,17],[3,11],[4,7],[15,20],[19,24],[18,26],[12,13],[13,17],... |
meeting-rooms-b3-s20 | meeting-rooms | end-event-sign | 20,419,388 | Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0.
Examples (JSON args and expected result): [{"args": [[[8, 14], [12, 16], [18, 22], [1, 5], [1, 8], [16, 17], [6, 8]]], "expected": ... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,1])
active = best = 0
for t,d in sorted(events):
active += d
best = max(best,active)
return best
| train | false | 116 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[10,13],[19,26],[9,13],[9,17],[12,13],[14,22],[16,24],[1,4]]],"expected":4},{"args":[[[14,16],[10,18],[10,15],[4,10],[15,17],[16,22],[2,9],[13,17],[3,11],[4,7],[15,20],[19,24],[18,26],[12,13],[13,17],... |
nearest-percentile-b0-s20 | nearest-percentile | baseline | 20,419,388 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[43, 50, 45, 48, 58, 57, 60, 44, 51, 47, 42, 41, 61, 52, 40, 39, 55, 46, 59, 49, 54, 53, 56], 33], "ex... | def solve(values,p):
return sorted(values)[int(p/100*len(values))] if values else None
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[75,-15,-88,64,95,37,-6,-89,-34,-36,-95,-86,15,-79,-90,-38,-10,-8,12,-37,-73,-68],50],"expected":-36},{"args":[[-4,-61,-44,83,24,90,-79,42,-59,-78,34,-45,34,-29,-63,8,-18,-... |
nearest-percentile-b1-s20 | nearest-percentile | floor-not-ceiling | 20,419,388 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[-92, -90, 99, -36, -96, 55, 22, 87, -54, 26, 57, 93, 56, 50], 50], "expected": 26}, {"args": [[91, 6,... | def solve(values,p):
if not values: return None
rank = max(1,(p*len(values)+0)//100)
return sorted(values)[rank-1]
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[75,-15,-88,64,95,37,-6,-89,-34,-36,-95,-86,15,-79,-90,-38,-10,-8,12,-37,-73,-68],50],"expected":-36},{"args":[[-4,-61,-44,83,24,90,-79,42,-59,-78,34,-45,34,-29,-63,8,-18,-... |
nearest-percentile-b2-s20 | nearest-percentile | rank-index | 20,419,388 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[11, 15, 12, 10, 8, 23, 13, 18, 6, 16, 5, 14, 4, 9, 24, 7, 20, 19, 21, 17, 22], 50], "expected": 14}, ... | def solve(values,p):
if not values: return None
rank = max(1,(p*len(values)+99)//100)
return sorted(values)[rank-2]
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[75,-15,-88,64,95,37,-6,-89,-34,-36,-95,-86,15,-79,-90,-38,-10,-8,12,-37,-73,-68],50],"expected":-36},{"args":[[-4,-61,-44,83,24,90,-79,42,-59,-78,34,-45,34,-29,-63,8,-18,-... |
nearest-percentile-b3-s20 | nearest-percentile | descending-order | 20,419,388 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[17, -91, -10, -71, -35, 97, -99, -9], 0], "expected": -99}, {"args": [[-25, -29, -24, -22, -14, -33, ... | def solve(values,p):
if not values: return None
rank = max(1,(p*len(values)+99)//100)
return sorted(values,reverse=True)[rank-1]
| train | false | 144 | [{"args":[[],50],"expected":null},{"args":[[1,2,3,4],100],"expected":4},{"args":[[1,2,3,4],50],"expected":2},{"args":[[4],0],"expected":4},{"args":[[75,-15,-88,64,95,37,-6,-89,-34,-36,-95,-86,15,-79,-90,-38,-10,-8,12,-37,-73,-68],50],"expected":-36},{"args":[[-4,-61,-44,83,24,90,-79,42,-59,-78,34,-45,34,-29,-63,8,-18,-... |
fifo-inventory-b0-s20 | fifo-inventory | baseline | 20,419,388 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
return [0,lots]
| train | false | 122 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,352]],17],"expected":null},{"args":[[[2,536],[5,747],[7,1],[4,796]],2],"expected":[1072,[[5,747],[7,1],[4,796]]]},{"args":[[[7,18... |
fifo-inventory-b1-s20 | fifo-inventory | zero-lot-retention | 20,419,388 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = min(q,demand)
demand -= used
cost += used*p
if q >= used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 122 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,352]],17],"expected":null},{"args":[[[2,536],[5,747],[7,1],[4,796]],2],"expected":[1072,[[5,747],[7,1],[4,796]]]},{"args":[[[7,18... |
fifo-inventory-b2-s20 | fifo-inventory | over-consumption | 20,419,388 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = max(q,demand)
demand -= used
cost += used*p
if q-used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 122 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,352]],17],"expected":null},{"args":[[[2,536],[5,747],[7,1],[4,796]],2],"expected":[1072,[[5,747],[7,1],[4,796]]]},{"args":[[[7,18... |
fifo-inventory-b3-s20 | fifo-inventory | unit-cost-not-quantity | 20,419,388 | Implement solve(lots,demand). lots are [quantity,unit_price_cents] in purchase order with nonnegative integers. Return [cost_cents,remaining_lots] after fulfilling demand FIFO, dropping zero-quantity lots. If inventory cannot cover demand, return None. Do not mutate input; demand>=0.
Examples (JSON args and expected re... | def solve(lots,demand):
if sum(q for q,p in lots) < demand: return None
remaining = []
cost = 0
for q,p in lots:
used = min(q,demand)
demand -= used
cost += p
if q-used: remaining.append([q-used,p])
return [cost,remaining]
| train | false | 122 | [{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[5,352]],17],"expected":null},{"args":[[[2,536],[5,747],[7,1],[4,796]],2],"expected":[1072,[[5,747],[7,1],[4,796]]]},{"args":[[[7,18... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.