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
nearest-percentile-b0-s16
nearest-percentile
baseline
20,387,712
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": [[81, 4, -7, 57], 100], "expected": 81}, {"args": [[51, 37, 39, 53, 36, 43, 34, 49, 47, 46, 40, 44, 45,...
def solve(values,p): return sorted(values)[int(p/100*len(values))] if values else None
train
true
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":[[-2,77,-3,-20,20,-100,21,40,-35,42,47,13,-12,13,99,42,41,37,-56,-68,86,74,2,-23,-22,69,91,-100],50],"expected":13},{"args":[[8,7],100],"expected":8},{"args":[[3,-78],0],"ex...
nearest-percentile-b1-s16
nearest-percentile
floor-not-ceiling
20,387,712
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": [[44, 37, 43, 41, 33, 34, 47, 49, 38, 35, 39, 36, 45, 40, 42, 46, 48], 33], "expected": 38}, {"args": [...
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":[[-2,77,-3,-20,20,-100,21,40,-35,42,47,13,-12,13,99,42,41,37,-56,-68,86,74,2,-23,-22,69,91,-100],50],"expected":13},{"args":[[8,7],100],"expected":8},{"args":[[3,-78],0],"ex...
nearest-percentile-b2-s16
nearest-percentile
rank-index
20,387,712
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": [[51, 37, 39, 53, 36, 43, 34, 49, 47, 46, 40, 44, 45, 55, 48, 35, 50, 54, 38, 33, 52, 41, 42], 33], "ex...
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":[[-2,77,-3,-20,20,-100,21,40,-35,42,47,13,-12,13,99,42,41,37,-56,-68,86,74,2,-23,-22,69,91,-100],50],"expected":13},{"args":[[8,7],100],"expected":8},{"args":[[3,-78],0],"ex...
nearest-percentile-b3-s16
nearest-percentile
descending-order
20,387,712
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": [[-35, -34, -31, -29, -33, -32, -30], 50], "expected": -32}, {"args": [[32, 27, 36, 33, 35, 31, 28, 34,...
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":[[-2,77,-3,-20,20,-100,21,40,-35,42,47,13,-12,13,99,42,41,37,-56,-68,86,74,2,-23,-22,69,91,-100],50],"expected":13},{"args":[[8,7],100],"expected":8},{"args":[[3,-78],0],"ex...
fifo-inventory-b0-s16
fifo-inventory
baseline
20,387,712
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
123
[{"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":[[[4,142],[6,633],[0,869],[5,840],[2,240],[7,203],[7,760]],24],"expected":[10467,[[7,760]]]},{"args":[[[1,768],[7,802],[1,538],[6,332]...
fifo-inventory-b1-s16
fifo-inventory
zero-lot-retention
20,387,712
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
123
[{"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":[[[4,142],[6,633],[0,869],[5,840],[2,240],[7,203],[7,760]],24],"expected":[10467,[[7,760]]]},{"args":[[[1,768],[7,802],[1,538],[6,332]...
fifo-inventory-b2-s16
fifo-inventory
over-consumption
20,387,712
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
123
[{"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":[[[4,142],[6,633],[0,869],[5,840],[2,240],[7,203],[7,760]],24],"expected":[10467,[[7,760]]]},{"args":[[[1,768],[7,802],[1,538],[6,332]...
fifo-inventory-b3-s16
fifo-inventory
unit-cost-not-quantity
20,387,712
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
123
[{"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":[[[4,142],[6,633],[0,869],[5,840],[2,240],[7,203],[7,760]],24],"expected":[10467,[[7,760]]]},{"args":[[[1,768],[7,802],[1,538],[6,332]...
csv-row-b0-s16
csv-row
baseline
20,387,712
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": ["\"猫aab猫,\"\",\""], "expected": ["猫aab猫,\","]}...
def solve(row): return row.split(',') if row else []
train
false
144
[{"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":["\"猫 ,a\"\"\"\"b\",a猫 aaa,\", b,\"\"\"\"a\",\"\"\",b\"\"猫a \",\"a,aa 猫...
csv-row-b1-s16
csv-row
quoted-comma
20,387,712
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": ["x1,"], "expected": ["x1", ""]}, {"args": ["\"...
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
144
[{"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":["\"猫 ,a\"\"\"\"b\",a猫 aaa,\", b,\"\"\"\"a\",\"\"\",b\"\"猫a \",\"a,aa 猫...
csv-row-b2-s16
csv-row
escaped-quote
20,387,712
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": ["x2,"], "expected": ["x2", ""]}, {"args": ["\"...
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
144
[{"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":["\"猫 ,a\"\"\"\"b\",a猫 aaa,\", b,\"\"\"\"a\",\"\"\",b\"\"猫a \",\"a,aa 猫...
csv-row-b3-s16
csv-row
lost-final-field
20,387,712
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": ["\"x19,y\",z"], "expected": ["x19,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
144
[{"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":["\"猫 ,a\"\"\"\"b\",a猫 aaa,\", b,\"\"\"\"a\",\"\"\",b\"\"猫a \",\"a,aa 猫...
shortest-path-b0-s16
shortest-path
baseline
20,387,712
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", 150], ["...
def solve(graph,start,target): return 0 if start == target else None
train
false
96
[{"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",4]]},"0","1"],"expected":null},{"args":[{"0":[["5",2]],"1":[["3",0]],"2":[["4",1],["5",1]],"3":[["0",0],["4",6]],"4":[["0",3]],"5":[["2",9],["3",2]],...
shortest-path-b1-s16
shortest-path
farthest-first
20,387,712
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
96
[{"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",4]]},"0","1"],"expected":null},{"args":[{"0":[["5",2]],"1":[["3",0]],"2":[["4",1],["5",1]],"3":[["0",0],["4",6]],"4":[["0",3]],"5":[["2",9],["3",2]],...
shortest-path-b2-s16
shortest-path
lost-path-prefix
20,387,712
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", 7]], "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
96
[{"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",4]]},"0","1"],"expected":null},{"args":[{"0":[["5",2]],"1":[["3",0]],"2":[["4",1],["5",1]],"3":[["0",0],["4",6]],"4":[["0",3]],"5":[["2",9],["3",2]],...
shortest-path-b3-s16
shortest-path
missing-relaxation
20,387,712
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", 0], ["4"...
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
96
[{"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",4]]},"0","1"],"expected":null},{"args":[{"0":[["5",2]],"1":[["3",0]],"2":[["4",1],["5",1]],"3":[["0",0],["4",6]],"4":[["0",3]],"5":[["2",9],["3",2]],...
merge-intervals-b0-s17
merge-intervals
baseline
20,395,631
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": [[[38, 46], [39, 40]]], "expected": [[38, 46]]}, {"args": [[[-6, 0], [25, 29], [0...
def solve(intervals): return sorted(intervals)
train
false
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[3,5],[27,29],[15,20],[20,20],[3,8],[-14,-11],[7,13],[-1,5],[28,31],[-20,-14],[7,11],[25,29],[10,17],[14,19]]],"expected":[[-20,-11],[-1,20],[25,31]]},{"args":[[[-19,-12],[-3,0],[-16,-9]]],"expected":[[-19,-9],[-3,0]]},{"args":[[[1...
merge-intervals-b1-s17
merge-intervals
touching-boundary
20,395,631
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, 9], [12, 13], [-17, -17], [-13, -9], [-14, -7]]], "expected": [[-17, -17], ...
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
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[3,5],[27,29],[15,20],[20,20],[3,8],[-14,-11],[7,13],[-1,5],[28,31],[-20,-14],[7,11],[25,29],[10,17],[14,19]]],"expected":[[-20,-11],[-1,20],[25,31]]},{"args":[[[-19,-12],[-3,0],[-16,-9]]],"expected":[[-19,-9],[-3,0]]},{"args":[[[1...
merge-intervals-b2-s17
merge-intervals
nested-endpoint
20,395,631
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": [[[-37, -32], [-40, -37]]], "expected": [[-40, -32]]}, {"args": [[[-4, 4], [-3, -...
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
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[3,5],[27,29],[15,20],[20,20],[3,8],[-14,-11],[7,13],[-1,5],[28,31],[-20,-14],[7,11],[25,29],[10,17],[14,19]]],"expected":[[-20,-11],[-1,20],[25,31]]},{"args":[[[-19,-12],[-3,0],[-16,-9]]],"expected":[[-19,-9],[-3,0]]},{"args":[[[1...
merge-intervals-b3-s17
merge-intervals
unsorted-input
20,395,631
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, 19], [-19, -19], [25, 25], [-14, -8], [3, 6], [-16, -16]]], "expected": [[...
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
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[3,5],[27,29],[15,20],[20,20],[3,8],[-14,-11],[7,13],[-1,5],[28,31],[-20,-14],[7,11],[25,29],[10,17],[14,19]]],"expected":[[-20,-11],[-1,20],[25,31]]},{"args":[[[-19,-12],[-3,0],[-16,-9]]],"expected":[[-19,-9],[-3,0]]},{"args":[[[1...
moving-sums-b0-s17
moving-sums
baseline
20,395,631
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": [[-3, -14, -30, -14, -12], 2], "expected": [-17, -44, -44, -26]}, {"args": [[-25, -4, 27, -18, -7], 2], "expected": [-29, 23, 9, -25]}, {"args": [[-3, -14,...
def solve(values,k): return [sum(values[i:i+k]) for i in range(len(values)-k)]
train
false
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-55,-42,-78,-82,25],7],"expected":[]},{"args":[[],-1],"expected":[]},{"args":[[75,-95,66,17,63,42,29,13],21],"expected":[]},{"args":[[2,-13,39,97],12],"expected":[]},{"args":[[-9...
moving-sums-b1-s17
moving-sums
zero-window
20,395,631
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": [[-2, 20, 5, -12], 1], "expected": [-2, 20, 5, -12]}, {"args": [[15, 13, 47, -56, 52, -25, 58, -1, 24, -41, -20, 39, -59, 52, -65], 2], "expected": [28, 60...
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
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-55,-42,-78,-82,25],7],"expected":[]},{"args":[[],-1],"expected":[]},{"args":[[75,-95,66,17,63,42,29,13],21],"expected":[]},{"args":[[2,-13,39,97],12],"expected":[]},{"args":[[-9...
moving-sums-b2-s17
moving-sums
window-width
20,395,631
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": [[-78, -44, -11, -40, 30, -66, 63, 65, 63, 48, -87, 32, 24, 21, 91, 17, -94], -1], "expected": []}, {"args": [[30, -18, 15, -23, 9, 13, 2, -13, -9, 30], 0]...
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
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-55,-42,-78,-82,25],7],"expected":[]},{"args":[[],-1],"expected":[]},{"args":[[75,-95,66,17,63,42,29,13],21],"expected":[]},{"args":[[2,-13,39,97],12],"expected":[]},{"args":[[-9...
moving-sums-b3-s17
moving-sums
missing-first-window
20,395,631
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": [[-7, 18, 2, -12, -12, 18], 2], "expected": [11, 20, -10, -24, 6]}, {"args": [[-25, -4, 27, -18, -7], 0], "expected": []}, {"args": [[62, 78, -33, -53, -14...
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
true
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-55,-42,-78,-82,25],7],"expected":[]},{"args":[[],-1],"expected":[]},{"args":[[75,-95,66,17,63,42,29,13],21],"expected":[]},{"args":[[2,-13,39,97],12],"expected":[]},{"args":[[-9...
weighted-mean-b0-s17
weighted-mean
baseline
20,395,631
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": [[36, 43], [0, 0]], "expected": null}, {"args": [[9, -24, -24, 39, -20], [3, 0, 4, 3, 2]],...
def solve(values,weights): return sum(values)/len(values) if values else None
train
false
119
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[-3,35,39,-9],[0,2,3,3]],"expected":20.0},{"args":[[8,-18,-15,-9,-42],[2,0,3,5,3]],"expected":-15.384615384615385},{"args":[[41,-9,30],[1,1,1]],"expected":20.666666666666668},{"args":[[-27,-28,4],[1,5,1...
weighted-mean-b1-s17
weighted-mean
unweighted-numerator
20,395,631
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": [[8, -17, 17, 23, 25, 39, 43, -28, -49, -33, 10], [2, 5, 4, 4, 5, 1, 2, 5, 1, 1, 1]], "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
119
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[-3,35,39,-9],[0,2,3,3]],"expected":20.0},{"args":[[8,-18,-15,-9,-42],[2,0,3,5,3]],"expected":-15.384615384615385},{"args":[[41,-9,30],[1,1,1]],"expected":20.666666666666668},{"args":[[-27,-28,4],[1,5,1...
weighted-mean-b2-s17
weighted-mean
wrong-denominator
20,395,631
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": [[4, 11], [1, 5]], "expected": 9.833333333333334}, {"args": [[-30, -23], [1, 5]], "expecte...
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
119
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[-3,35,39,-9],[0,2,3,3]],"expected":20.0},{"args":[[8,-18,-15,-9,-42],[2,0,3,5,3]],"expected":-15.384615384615385},{"args":[[41,-9,30],[1,1,1]],"expected":20.666666666666668},{"args":[[-27,-28,4],[1,5,1...
weighted-mean-b3-s17
weighted-mean
zero-weight-result
20,395,631
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": [[-5, -42, -7, -34, 42, 31, -8, 22, 27, -11, 49, 23, -41, 21, 13, -21], [3, 4, 0, 1, 0, 1,...
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
119
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[-3,35,39,-9],[0,2,3,3]],"expected":20.0},{"args":[[8,-18,-15,-9,-42],[2,0,3,5,3]],"expected":-15.384615384615385},{"args":[[41,-9,30],[1,1,1]],"expected":20.666666666666668},{"args":[[-27,-28,4],[1,5,1...
stable-unique-b0-s17
stable-unique
baseline
20,395,631
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-4, -10, 8, 4, 2, 0, -4, 8, -6, 3, -2, 8, 5, 9, 10, 8, 5, -7, 0, 5, -2, 9, 0, 3]], "expected": [-4, -10, 8, 4, 2, 0, -6, 3, -2, 5, 9, 10, -7]}, {"arg...
def solve(values): return sorted(set(values))
train
false
96
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[0,2,1,-10,-9,-5,10,2,7,8,-10,-4,-1,-7,5,5,8,-3,-2,-8,9,9]],"expected":[0,2,1,-10,-9,-5,10,7,8,-4,-1,-7,5,-3,-2,-8,9]},{"args":[[8,10,-1,1,3,9,1,8,7]],"expected":[8,10,-1,1,3,9,7]},{"args":[[-8,1,10]],"expected":[-8,1,10]},{"args":[[7,-7,7,...
stable-unique-b1-s17
stable-unique
reverse-traversal
20,395,631
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[5, 3, -3]], "expected": [5, 3, -3]}, {"args": [[-2, -4, 2, -10, -4, 5, -6, -10, 9, 8, -5, 6, -1, 6, 6]], "expected": [-2, -4, 2, -10, 5, -6, 9, 8, -5...
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":[[0,2,1,-10,-9,-5,10,2,7,8,-10,-4,-1,-7,5,5,8,-3,-2,-8,9,9]],"expected":[0,2,1,-10,-9,-5,10,7,8,-4,-1,-7,5,-3,-2,-8,9]},{"args":[[8,10,-1,1,3,9,1,8,7]],"expected":[8,10,-1,1,3,9,7]},{"args":[[-8,1,10]],"expected":[-8,1,10]},{"args":[[7,-7,7,...
stable-unique-b2-s17
stable-unique
reverse-output
20,395,631
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-35, -37, -35, -36, -37]], "expected": [-35, -37, -36]}, {"args": [[-7, -6, -5, -6, 7, -7, -10, -5, -7, 3, -8, 0, 7, -2, -9, -7]], "expected": [-7, -...
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":[[0,2,1,-10,-9,-5,10,2,7,8,-10,-4,-1,-7,5,5,8,-3,-2,-8,9,9]],"expected":[0,2,1,-10,-9,-5,10,7,8,-4,-1,-7,5,-3,-2,-8,9]},{"args":[[8,10,-1,1,3,9,1,8,7]],"expected":[8,10,-1,1,3,9,7]},{"args":[[-8,1,10]],"expected":[-8,1,10]},{"args":[[7,-7,7,...
stable-unique-b3-s17
stable-unique
wrong-seen-value
20,395,631
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-5, -9, -3]], "expected": [-5, -9, -3]}, {"args": [[4, 2, 4, 3, 2]], "expected": [4, 2, 3]}, {"args": [[-6]], "expected": [-6]}]
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":[[0,2,1,-10,-9,-5,10,2,7,8,-10,-4,-1,-7,5,5,8,-3,-2,-8,9,9]],"expected":[0,2,1,-10,-9,-5,10,7,8,-4,-1,-7,5,-3,-2,-8,9]},{"args":[[8,10,-1,1,3,9,1,8,7]],"expected":[8,10,-1,1,3,9,7]},{"args":[[-8,1,10]],"expected":[-8,1,10]},{"args":[[7,-7,7,...
run-length-b0-s17
run-length
baseline
20,395,631
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": ["aa猫猫b "], "expected": [["a", 2], ["猫", 2], ["b", 1], [" ", 1]]}, {"args": ["猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫狗...
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":["b🙂b 🙂猫c ac🙂a🙂 猫 baa🙂猫acbacab"],"expected":[["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["c",1],[" ",1],["a",1],["c",1],["🙂",1],["a",1],["🙂",1],[" ",1],[...
run-length-b1-s17
run-length
inverted-grouping
20,395,631
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": ["ca猫a猫 aa猫 🙂a"], "expected": [["c", 1], ["a", 1], ["猫", 1], ["a", 1], ["猫", 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,1]) return out
train
false
101
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["b🙂b 🙂猫c ac🙂a🙂 猫 baa🙂猫acbacab"],"expected":[["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["c",1],[" ",1],["a",1],["c",1],["🙂",1],["a",1],["🙂",1],[" ",1],[...
run-length-b2-s17
run-length
double-increment
20,395,631
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": ["猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫狗狗狗狗狗狗狗狗狗狗狗狗狗狗狗狗"], "expected": [["猫", 17], ["狗", 16]]}, {"args": ["aaaaaaa...
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":["b🙂b 🙂猫c ac🙂a🙂 猫 baa🙂猫acbacab"],"expected":[["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["c",1],[" ",1],["a",1],["c",1],["🙂",1],["a",1],["🙂",1],[" ",1],[...
run-length-b3-s17
run-length
zero-initial-count
20,395,631
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": ["猫🙂猫"], "expected": [["猫", 1], ["🙂", 1], ["猫", 1]]}, {"args": ["猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫dddddd...
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":["b🙂b 🙂猫c ac🙂a🙂 猫 baa🙂猫acbacab"],"expected":[["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["c",1],[" ",1],["a",1],["c",1],["🙂",1],["a",1],["🙂",1],[" ",1],[...
luhn-b0-s17
luhn
baseline
20,395,631
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": ["1674790207267691"], "expected": ...
def solve(text): return bool(text) and text.isdigit() and sum(int(c) for c in text)%10 == 0
train
false
185
[{"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":["0399"],"expected":false},{"arg...
luhn-b1-s17
luhn
wrong-parity
20,395,631
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": ["056888"], "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
185
[{"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":["0399"],"expected":false},{"arg...
luhn-b2-s17
luhn
wrong-reduction
20,395,631
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": ["302063640"], "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 i%2: v *= 2 if v > 9: v -= 8 total += v return total%10 == 0
train
false
185
[{"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":["0399"],"expected":false},{"arg...
luhn-b3-s17
luhn
wrong-modulus
20,395,631
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": ["3469097808898"], "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
185
[{"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":["0399"],"expected":false},{"arg...
edit-distance-b0-s17
edit-distance
baseline
20,395,631
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": ["猫baccab", ""], "expected": 7}, {"args": ["aac猫猫", "aac猫猫"], "expected": 0}, {"args": ["猫猫baac", "bbbadca"], "expected": 4}]
def solve(a,b): return abs(len(a)-len(b))
train
false
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["dbccddbaaac","b猫猫ab猫ccc"],"expected":8},{"args":["cacd猫cbb","猫猫ca猫c"],"expected":5},{"args":["b","d猫b"],"expected":2},{"args":["","daa猫bd猫ca"],"expected":9},{"args":["daac","b猫dcdcb"],"expected":5},{"args...
edit-distance-b1-s17
edit-distance
row-boundary
20,395,631
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": ["猫aaabab猫猫", "猫猫babaaa猫"], "expected": 4}, {"args": ["猫", "猫cbd"], "expected": 3}, {"args": ["ad猫猫猫ca猫c", "a猫"], "expected": 7}]
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
true
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["dbccddbaaac","b猫猫ab猫ccc"],"expected":8},{"args":["cacd猫cbb","猫猫ca猫c"],"expected":5},{"args":["b","d猫b"],"expected":2},{"args":["","daa猫bd猫ca"],"expected":9},{"args":["daac","b猫dcdcb"],"expected":5},{"args...
edit-distance-b2-s17
edit-distance
inverted-substitution
20,395,631
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": ["猫caddbdd猫", ""], "expected": 9}, {"args": ["bbbbc", "bbbbc"], "expected": 0}, {"args": ["ccdbc猫cccca", "b猫d"], "expected": 9}]
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
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["dbccddbaaac","b猫猫ab猫ccc"],"expected":8},{"args":["cacd猫cbb","猫猫ca猫c"],"expected":5},{"args":["b","d猫b"],"expected":2},{"args":["","daa猫bd猫ca"],"expected":9},{"args":["daac","b猫dcdcb"],"expected":5},{"args...
edit-distance-b3-s17
edit-distance
diagonal-index
20,395,631
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": ["acabcca猫猫猫a猫", ""], "expected": 12}, {"args": ["猫猫aba", "猫猫aba"], "expected": 0}, {"args": ["ad猫猫猫ca猫c", "a猫"], "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]+(x != y))) row = nxt return row[-1]
train
false
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["dbccddbaaac","b猫猫ab猫ccc"],"expected":8},{"args":["cacd猫cbb","猫猫ca猫c"],"expected":5},{"args":["b","d猫b"],"expected":2},{"args":["","daa猫bd猫ca"],"expected":9},{"args":["daac","b猫dcdcb"],"expected":5},{"args...
meeting-rooms-b0-s17
meeting-rooms
baseline
20,395,631
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, 13], [13, 15]]], "expected": 1}, {"args": [[[19, 27]]], "expected": 1}, ...
def solve(intervals): return len(intervals)
train
false
119
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,19],[17,23],[13,16],[11,18],[19,27],[13,19],[18,23]]],"expected":4},{"args":[[[19,21],[0,8],[14,18],[18,21],[7,13],[5,10],[13,14],[3,7],[7,11],[1,9],[2,10],[14,18]]],"expected":6},{"args":[[[0,3],...
meeting-rooms-b1-s17
meeting-rooms
tie-order
20,395,631
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": [[[18, 26], [16, 18], [0, 3], [12, 13], [18, 20], [11, 13], [11, 13], [9, 14], ...
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
119
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,19],[17,23],[13,16],[11,18],[19,27],[13,19],[18,23]]],"expected":4},{"args":[[[19,21],[0,8],[14,18],[18,21],[7,13],[5,10],[13,14],[3,7],[7,11],[1,9],[2,10],[14,18]]],"expected":6},{"args":[[[0,3],...
meeting-rooms-b2-s17
meeting-rooms
peak-tracking
20,395,631
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": [[[13, 21], [14, 16], [15, 20]]], "expected": 3}, {"args": [[[-18, -10], [-17, ...
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
119
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,19],[17,23],[13,16],[11,18],[19,27],[13,19],[18,23]]],"expected":4},{"args":[[[19,21],[0,8],[14,18],[18,21],[7,13],[5,10],[13,14],[3,7],[7,11],[1,9],[2,10],[14,18]]],"expected":6},{"args":[[[0,3],...
meeting-rooms-b3-s17
meeting-rooms
end-event-sign
20,395,631
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], [18, 19], [2, 4], [19, 22], [2, 7], [16, 17], [17, 24], [19, 22], [...
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
119
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,19],[17,23],[13,16],[11,18],[19,27],[13,19],[18,23]]],"expected":4},{"args":[[[19,21],[0,8],[14,18],[18,21],[7,13],[5,10],[13,14],[3,7],[7,11],[1,9],[2,10],[14,18]]],"expected":6},{"args":[[[0,3],...
nearest-percentile-b0-s17
nearest-percentile
baseline
20,395,631
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, 5, 19, 20, 8, 14, 9, 22, 18, 10, 7, 24, 11, 21, 12, 16, 23, 13, 3, 15, 6, 4, 2], 99], "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":[[34,-33,100,-96,8,22,-84,99,-85,94,52,-47,-6,48,-37,65,2,-51],50],"expected":2},{"args":[[37,63,-22,-32,-39,5,33,-2,15,-26,-36,-35,40,79,-53,-80,-75,69,-65,-50],100],"expec...
nearest-percentile-b1-s17
nearest-percentile
floor-not-ceiling
20,395,631
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": [[-7, 3, 4, -11, -12, -8, 2, 5, -6, -15, -2, -17, -19, 0, -9, -5, 1, -16, -13, -1, -10, -14, -18, -3, -...
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":[[34,-33,100,-96,8,22,-84,99,-85,94,52,-47,-6,48,-37,65,2,-51],50],"expected":2},{"args":[[37,63,-22,-32,-39,5,33,-2,15,-26,-36,-35,40,79,-53,-80,-75,69,-65,-50],100],"expec...
nearest-percentile-b2-s17
nearest-percentile
rank-index
20,395,631
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": [[12, -89, 16, -48, 87, 30, -9, 95, -17, 71, 22, -63, -42, -69, -83, 27, -63, -88], 0], "expected": -89...
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":[[34,-33,100,-96,8,22,-84,99,-85,94,52,-47,-6,48,-37,65,2,-51],50],"expected":2},{"args":[[37,63,-22,-32,-39,5,33,-2,15,-26,-36,-35,40,79,-53,-80,-75,69,-65,-50],100],"expec...
nearest-percentile-b3-s17
nearest-percentile
descending-order
20,395,631
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, 28, 21, 15, 30, 32, 14, 24, 11, 16, 22, 27, 13, 10, 12, 20, 17, 23, 29, 31, 25, 19, 26], 99], "ex...
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":[[34,-33,100,-96,8,22,-84,99,-85,94,52,-47,-6,48,-37,65,2,-51],50],"expected":2},{"args":[[37,63,-22,-32,-39,5,33,-2,15,-26,-36,-35,40,79,-53,-80,-75,69,-65,-50],100],"expec...
fifo-inventory-b0-s17
fifo-inventory
baseline
20,395,631
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
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":[[[2,753],[0,979],[6,727],[6,916]],8],"expected":[5868,[[6,916]]]},{"args":[[[1,167],[0,320],[3,654]],8],"expected":null},{"args":[[[1...
fifo-inventory-b1-s17
fifo-inventory
zero-lot-retention
20,395,631
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":[[[2,753],[0,979],[6,727],[6,916]],8],"expected":[5868,[[6,916]]]},{"args":[[[1,167],[0,320],[3,654]],8],"expected":null},{"args":[[[1...
fifo-inventory-b2-s17
fifo-inventory
over-consumption
20,395,631
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":[[[2,753],[0,979],[6,727],[6,916]],8],"expected":[5868,[[6,916]]]},{"args":[[[1,167],[0,320],[3,654]],8],"expected":null},{"args":[[[1...
fifo-inventory-b3-s17
fifo-inventory
unit-cost-not-quantity
20,395,631
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":[[[2,753],[0,979],[6,727],[6,916]],8],"expected":[5868,[[6,916]]]},{"args":[[[1,167],[0,320],[3,654]],8],"expected":null},{"args":[[[1...
csv-row-b0-s17
csv-row
baseline
20,395,631
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": ["\"x3,y\",z"], "expected": ["x3,y", "z"]}, {"a...
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":["\"a,\",\"\"\"a\"\"猫猫a\",\"a,猫\",\"aa,a ,b\"\"\"\"\",\" ,,\",\"\"\"\"\"\...
csv-row-b1-s17
csv-row
quoted-comma
20,395,631
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": ["x10,"], "expected": ["x10", ""]}, {"args": ["...
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":["\"a,\",\"\"\"a\"\"猫猫a\",\"a,猫\",\"aa,a ,b\"\"\"\"\",\" ,,\",\"\"\"\"\"\...
csv-row-b2-s17
csv-row
escaped-quote
20,395,631
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": ["\", b,\",\",,\"\"\""], "expected": [", 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":["\"a,\",\"\"\"a\"\"猫猫a\",\"a,猫\",\"aa,a ,b\"\"\"\"\",\" ,,\",\"\"\"\"\"\...
csv-row-b3-s17
csv-row
lost-final-field
20,395,631
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": ["\"x15,y\",z"], "expected": ["x15,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
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":["\"a,\",\"\"\"a\"\"猫猫a\",\"a,猫\",\"aa,a ,b\"\"\"\"\",\" ,,\",\"\"\"\"\"\...
shortest-path-b0-s17
shortest-path
baseline
20,395,631
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): 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":[["5",0],["6",0]],"1":[["0",6],["5",2]],"2":[["3",9],["4",0],["6",2]],"3":[["4",0],["6",9],["7",5]],"4":[["6",6],["7",5]],"5":[["2",4],["4",2],["7",9]],"6":[["1",...
shortest-path-b1-s17
shortest-path
farthest-first
20,395,631
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 = 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":[["5",0],["6",0]],"1":[["0",6],["5",2]],"2":[["3",9],["4",0],["6",2]],"3":[["4",0],["6",9],["7",5]],"4":[["6",6],["7",5]],"5":[["2",4],["4",2],["7",9]],"6":[["1",...
shortest-path-b2-s17
shortest-path
lost-path-prefix
20,395,631
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", 391], ["...
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":[["5",0],["6",0]],"1":[["0",6],["5",2]],"2":[["3",9],["4",0],["6",2]],"3":[["4",0],["6",9],["7",5]],"4":[["6",6],["7",5]],"5":[["2",4],["4",2],["7",9]],"6":[["1",...
shortest-path-b3-s17
shortest-path
missing-relaxation
20,395,631
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
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":[["5",0],["6",0]],"1":[["0",6],["5",2]],"2":[["3",9],["4",0],["6",2]],"3":[["4",0],["6",9],["7",5]],"4":[["6",6],["7",5]],"5":[["2",4],["4",2],["7",9]],"6":[["1",...
merge-intervals-b0-s18
merge-intervals
baseline
20,403,550
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, -8], [-10, -4], [-15, -11], [-8, -6], [2, 3], [15, 18], [-13, -12], [-2, ...
def solve(intervals): return sorted(intervals)
train
false
106
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-16,-14],[15,22],[18,19],[1,4],[23,24],[-10,-8],[-6,-5],[-15,-12],[-5,0],[10,17],[0,0],[3,7],[21,21],[25,32],[0,2]]],"expected":[[-16,-12],[-10,-8],[-6,7],[10,22],[23,24],[25,32]]},{"args":[[[8,14],[23,29],[-13,-13],[7,7],[28,34],...
merge-intervals-b1-s18
merge-intervals
touching-boundary
20,403,550
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": [[[-19, -14], [-18, -12], [-2, 0], [-4, -4], [-19, -19], [19, 23], [-3, 3], [-10,...
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
106
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-16,-14],[15,22],[18,19],[1,4],[23,24],[-10,-8],[-6,-5],[-15,-12],[-5,0],[10,17],[0,0],[3,7],[21,21],[25,32],[0,2]]],"expected":[[-16,-12],[-10,-8],[-6,7],[10,22],[23,24],[25,32]]},{"args":[[[8,14],[23,29],[-13,-13],[7,7],[28,34],...
merge-intervals-b2-s18
merge-intervals
nested-endpoint
20,403,550
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": [[[-27, -22], [-30, -27]]], "expected": [[-30, -22]]}, {"args": [[[-18, -17], [19...
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
106
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-16,-14],[15,22],[18,19],[1,4],[23,24],[-10,-8],[-6,-5],[-15,-12],[-5,0],[10,17],[0,0],[3,7],[21,21],[25,32],[0,2]]],"expected":[[-16,-12],[-10,-8],[-6,7],[10,22],[23,24],[25,32]]},{"args":[[[8,14],[23,29],[-13,-13],[7,7],[28,34],...
merge-intervals-b3-s18
merge-intervals
unsorted-input
20,403,550
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": [[[0, 0], [-15, -11], [27, 32]]], "expected": [[-15, -11], [0, 0], [27, 32]]}, {"...
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
106
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-16,-14],[15,22],[18,19],[1,4],[23,24],[-10,-8],[-6,-5],[-15,-12],[-5,0],[10,17],[0,0],[3,7],[21,21],[25,32],[0,2]]],"expected":[[-16,-12],[-10,-8],[-6,7],[10,22],[23,24],[25,32]]},{"args":[[[8,14],[23,29],[-13,-13],[7,7],[28,34],...
moving-sums-b0-s18
moving-sums
baseline
20,403,550
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": [[-11, -10, 25, -42, 46], 6], "expected": []}, {"args": [[-2, -25, 4, 16, -19, -7, 15, -11, -8, 27], 2], "expected": [-27, -21, 20, -3, -26, 8, 4, -19, 19]...
def solve(values,k): return [sum(values[i:i+k]) for i in range(len(values)-k)]
train
false
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-99,9,-91,31,96,68,15,-99,-84,-60,82,-93,70],19],"expected":[]},{"args":[[83,-33,-97,-91,-38,59,-78],4],"expected":[-138,-259,-167,-148]},{"args":[[72,-88,0],18],"expected":[]},{...
moving-sums-b1-s18
moving-sums
zero-window
20,403,550
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": [[-40, -88], 2], "expected": [-128]}, {"args": [[25, 6, -3, -25, -7, -11, -27, 2, 11, -26, 0], 0], "expected": []}, {"args": [[7, -16, 3, -30, 28, -6, 2, 8...
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
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-99,9,-91,31,96,68,15,-99,-84,-60,82,-93,70],19],"expected":[]},{"args":[[83,-33,-97,-91,-38,59,-78],4],"expected":[-138,-259,-167,-148]},{"args":[[72,-88,0],18],"expected":[]},{...
moving-sums-b2-s18
moving-sums
window-width
20,403,550
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": [[-32, -57, -78, -16, -46, 46, -39, 100, 40, -35, 62, 99], 3], "expected": [-167, -151, -140, -16, -39, 107, 101, 105, 67, 126]}, {"args": [[7, -16, 3, -30...
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
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-99,9,-91,31,96,68,15,-99,-84,-60,82,-93,70],19],"expected":[]},{"args":[[83,-33,-97,-91,-38,59,-78],4],"expected":[-138,-259,-167,-148]},{"args":[[72,-88,0],18],"expected":[]},{...
moving-sums-b3-s18
moving-sums
missing-first-window
20,403,550
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": [[78, -90, 74, -90, -38, 97, -85, -82, 64, 87, -35, -80, 75, 98, 73, 0, -70], 10], "expected": [15, -98, -88, -87, 101, 212, 115, 130]}, {"args": [[9, -8, ...
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
144
[{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-99,9,-91,31,96,68,15,-99,-84,-60,82,-93,70],19],"expected":[]},{"args":[[83,-33,-97,-91,-38,59,-78],4],"expected":[-138,-259,-167,-148]},{"args":[[72,-88,0],18],"expected":[]},{...
weighted-mean-b0-s18
weighted-mean
baseline
20,403,550
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": [[35, 42], [0, 0]], "expected": null}, {"args": [[-29, 16, 38, -41, -32, -2, 15, 40, 1, 27...
def solve(values,weights): return sum(values)/len(values) if values else None
train
false
117
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[49],[2]],"expected":49.0},{"args":[[33,0,31,-1],[3,1,0,0]],"expected":24.75},{"args":[[-47,39,-31,-43,31,-27,-38,4,-15,-22,48,-5],[4,4,5,1,4,2,1,2,0,2,2,3]],"expected":-5.1},{"args":[[-1,-14,9,4,36,-14...
weighted-mean-b1-s18
weighted-mean
unweighted-numerator
20,403,550
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": [[-18, 45, 35, 17, 29, -29, 31, -9, 3, -48, 13, 31, 7, 17, 11, -50, -16, -12], [5, 5, 1, 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
117
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[49],[2]],"expected":49.0},{"args":[[33,0,31,-1],[3,1,0,0]],"expected":24.75},{"args":[[-47,39,-31,-43,31,-27,-38,4,-15,-22,48,-5],[4,4,5,1,4,2,1,2,0,2,2,3]],"expected":-5.1},{"args":[[-1,-14,9,4,36,-14...
weighted-mean-b2-s18
weighted-mean
wrong-denominator
20,403,550
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": [[6, 13], [1, 5]], "expected": 11.833333333333334}, {"args": [[6, 38, -44, 15, -42, 11, 45...
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
117
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[49],[2]],"expected":49.0},{"args":[[33,0,31,-1],[3,1,0,0]],"expected":24.75},{"args":[[-47,39,-31,-43,31,-27,-38,4,-15,-22,48,-5],[4,4,5,1,4,2,1,2,0,2,2,3]],"expected":-5.1},{"args":[[-1,-14,9,4,36,-14...
weighted-mean-b3-s18
weighted-mean
zero-weight-result
20,403,550
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": [[-34, 25, 32, 45], [3, 0, 3, 2]], "expected": 10.5}, {"args": [[45, -31, 9, -2, 30, 16, 1...
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
117
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[49],[2]],"expected":49.0},{"args":[[33,0,31,-1],[3,1,0,0]],"expected":24.75},{"args":[[-47,39,-31,-43,31,-27,-38,4,-15,-22,48,-5],[4,4,5,1,4,2,1,2,0,2,2,3]],"expected":-5.1},{"args":[[-1,-14,9,4,36,-14...
stable-unique-b0-s18
stable-unique
baseline
20,403,550
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[10, 1, 4, 0, -1, 3, -3, -2, -7, -1, 5, -7, -9, 0, 3, 4]], "expected": [10, 1, 4, 0, -1, 3, -3, -2, -7, 5, -9]}, {"args": [[-9, 10, 0, 10, 0, 3, -6, 5...
def solve(values): return sorted(set(values))
train
false
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-5,10,-9,-5,-5,-8,5,10,9,-9,-5,-6,1,-5,6,8,-4,1,-4]],"expected":[-5,10,-9,-8,5,9,-6,1,6,8,-4]},{"args":[[-6,-8,-10,2,0,-10]],"expected":[-6,-8,-10,2,0]},{"args":[[-8,-10,2,-6,-9,-4,-1,7,-5,2,-2,5,10,1,-1,7,-10,10,-8]],"expected":[-8,-10,2,...
stable-unique-b1-s18
stable-unique
reverse-traversal
20,403,550
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[0, -4, -4, 0, -10, -7, 8, 8, 7]], "expected": [0, -4, -10, -7, 8, 7]}, {"args": [[-3, -10, -8, 7, 0, 6, -6, 4, -2, -4, 3, -3, 2, 9, 10, -7, 8, -6, -4...
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
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-5,10,-9,-5,-5,-8,5,10,9,-9,-5,-6,1,-5,6,8,-4,1,-4]],"expected":[-5,10,-9,-8,5,9,-6,1,6,8,-4]},{"args":[[-6,-8,-10,2,0,-10]],"expected":[-6,-8,-10,2,0]},{"args":[[-8,-10,2,-6,-9,-4,-1,7,-5,2,-2,5,10,1,-1,7,-10,10,-8]],"expected":[-8,-10,2,...
stable-unique-b2-s18
stable-unique
reverse-output
20,403,550
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-29, -31, -29, -30, -31]], "expected": [-29, -31, -30]}, {"args": [[8, 1, -3, 1, -6, 10, -9, -3, 6, -7, 10, -9, 2, -2, -8, -7, -8, -9, -10, 6, -3]], ...
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
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-5,10,-9,-5,-5,-8,5,10,9,-9,-5,-6,1,-5,6,8,-4,1,-4]],"expected":[-5,10,-9,-8,5,9,-6,1,6,8,-4]},{"args":[[-6,-8,-10,2,0,-10]],"expected":[-6,-8,-10,2,0]},{"args":[[-8,-10,2,-6,-9,-4,-1,7,-5,2,-2,5,10,1,-1,7,-10,10,-8]],"expected":[-8,-10,2,...
stable-unique-b3-s18
stable-unique
wrong-seen-value
20,403,550
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-1, 4]], "expected": [-1, 4]}, {"args": [[8, 7, -1, 7, 7, -4, -8, -1, -1, 6, 8, -5, -1, 2, -7, 7, -7]], "expected": [8, 7, -1, -4, -8, 6, -5, 2, -7]}...
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
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-5,10,-9,-5,-5,-8,5,10,9,-9,-5,-6,1,-5,6,8,-4,1,-4]],"expected":[-5,10,-9,-8,5,9,-6,1,6,8,-4]},{"args":[[-6,-8,-10,2,0,-10]],"expected":[-6,-8,-10,2,0]},{"args":[[-8,-10,2,-6,-9,-4,-1,7,-5,2,-2,5,10,1,-1,7,-10,10,-8]],"expected":[-8,-10,2,...
run-length-b0-s18
run-length
baseline
20,403,550
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": ["🙂"], "expected": [["🙂", 1]]}, {"args": ["b🙂🙂bba 🙂a猫abc c猫c🙂b🙂 🙂cb🙂b猫acb"], "expecte...
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":["b🙂🙂a🙂 c c b猫b🙂a c猫猫c"],"expected":[["b",1],["🙂",2],["a",1],["🙂",1],[" ",1],["c",1],[" ",1],["c",1],[" ",1],["b",1],["猫",1],["b",1],["🙂",1],["a",1],[" ",1],["c...
run-length-b1-s18
run-length
inverted-grouping
20,403,550
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": [" babb猫猫b🙂 b猫ac"], "expected": [[" ", 1], ["b", 1], ["a", 1], ["b", 2], ["猫", 2], ["b", 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":["b🙂🙂a🙂 c c b猫b🙂a c猫猫c"],"expected":[["b",1],["🙂",2],["a",1],["🙂",1],[" ",1],["c",1],[" ",1],["c",1],[" ",1],["b",1],["猫",1],["b",1],["🙂",1],["a",1],[" ",1],["c...
run-length-b2-s18
run-length
double-increment
20,403,550
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": ["bbbbbbbbbbbcccccccccc"], "expected": [["b", 11], ["c", 10]]}, {"args": ["b猫baa🙂🙂cabcb bac猫...
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
true
101
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["b🙂🙂a🙂 c c b猫b🙂a c猫猫c"],"expected":[["b",1],["🙂",2],["a",1],["🙂",1],[" ",1],["c",1],[" ",1],["c",1],[" ",1],["b",1],["猫",1],["b",1],["🙂",1],["a",1],[" ",1],["c...
run-length-b3-s18
run-length
zero-initial-count
20,403,550
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 🙂🙂bcbbba🙂猫猫c"], "expected": [["b", 1], [" ", 1], ["🙂", 2], ["b", 1], ["c", 1], ["b", 3...
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":["b🙂🙂a🙂 c c b猫b🙂a c猫猫c"],"expected":[["b",1],["🙂",2],["a",1],["🙂",1],[" ",1],["c",1],[" ",1],["c",1],[" ",1],["b",1],["猫",1],["b",1],["🙂",1],["a",1],[" ",1],["c...
luhn-b0-s18
luhn
baseline
20,403,550
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": ["9137393062288"], "expected": fal...
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":["2205869669"],"expected":false}...
luhn-b1-s18
luhn
wrong-parity
20,403,550
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": ["9957222384"], "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 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":["2205869669"],"expected":false}...
luhn-b2-s18
luhn
wrong-reduction
20,403,550
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": ["282408343"], "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
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":["2205869669"],"expected":false}...
luhn-b3-s18
luhn
wrong-modulus
20,403,550
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": ["286870367055"], "expected": fals...
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":["2205869669"],"expected":false}...
edit-distance-b0-s18
edit-distance
baseline
20,403,550
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": ["", "猫cc"], "expected": 3}, {"args": ["猫bc猫cbbc", "cbbc猫cb猫"], "expected": 4}, {"args": ["ddddd", "dbdcbbc"], "expected": 5}]
def solve(a,b): return abs(len(a)-len(b))
train
false
142
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["bc猫b猫猫adaa","cdbdcd猫d猫bb"],"expected":9},{"args":["c猫猫aabcdbb",""],"expected":10},{"args":["aabc猫猫d","猫猫ada"],"expected":6},{"args":["ab","d猫"],"expected":2},{"args":["猫dd猫c猫猫猫dc","c"],"expected":9},{"arg...
edit-distance-b1-s18
edit-distance
row-boundary
20,403,550
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": ["dc", "d猫aaaa"], "expected": 5}, {"args": ["aa猫accca猫a猫猫", "猫猫a猫accca猫aa"], "expected": 4}, {"args": ["c猫a猫猫aab猫b猫a", "a猫b猫baa猫猫a猫c"],...
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
142
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["bc猫b猫猫adaa","cdbdcd猫d猫bb"],"expected":9},{"args":["c猫猫aabcdbb",""],"expected":10},{"args":["aabc猫猫d","猫猫ada"],"expected":6},{"args":["ab","d猫"],"expected":2},{"args":["猫dd猫c猫猫猫dc","c"],"expected":9},{"arg...
edit-distance-b2-s18
edit-distance
inverted-substitution
20,403,550
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": ["aacbdac", "bb猫"], "expected": 6}, {"args": ["cb猫a猫", "cb猫a猫"], "expected": 0}, {"args": ["dadd", "aaabb"], "expected": 4}]
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
142
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["bc猫b猫猫adaa","cdbdcd猫d猫bb"],"expected":9},{"args":["c猫猫aabcdbb",""],"expected":10},{"args":["aabc猫猫d","猫猫ada"],"expected":6},{"args":["ab","d猫"],"expected":2},{"args":["猫dd猫c猫猫猫dc","c"],"expected":9},{"arg...
edit-distance-b3-s18
edit-distance
diagonal-index
20,403,550
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": ["bcc猫acc", ""], "expected": 7}, {"args": ["abcccccba猫c猫", "猫c猫abcccccba"], "expected": 6}, {"args": ["abbaddd猫caa", "addcc猫d"], "expec...
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
142
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["bc猫b猫猫adaa","cdbdcd猫d猫bb"],"expected":9},{"args":["c猫猫aabcdbb",""],"expected":10},{"args":["aabc猫猫d","猫猫ada"],"expected":6},{"args":["ab","d猫"],"expected":2},{"args":["猫dd猫c猫猫猫dc","c"],"expected":9},{"arg...
meeting-rooms-b0-s18
meeting-rooms
baseline
20,403,550
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": [[[31, 39], [32, 34], [33, 38]]], "expected": 3}, {"args": [[[14, 22], [3, 10],...
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":[[[11,18],[15,20],[3,11],[1,7],[10,17],[17,19],[8,13],[9,11],[3,11],[2,7],[1,9],[18,22]]],"expected":5},{"args":[[[7,9],[18,26],[10,17],[19,20],[11,13],[2,3],[8,11],[13,15],[7,8],[19,27]]],"expected":3}...
meeting-rooms-b1-s18
meeting-rooms
tie-order
20,403,550
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": [[[17, 20], [10, 11], [9, 11], [6, 9], [2, 9], [7, 13], [15, 21], [6, 8], [12, ...
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":[[[11,18],[15,20],[3,11],[1,7],[10,17],[17,19],[8,13],[9,11],[3,11],[2,7],[1,9],[18,22]]],"expected":5},{"args":[[[7,9],[18,26],[10,17],[19,20],[11,13],[2,3],[8,11],[13,15],[7,8],[19,27]]],"expected":3}...
meeting-rooms-b2-s18
meeting-rooms
peak-tracking
20,403,550
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": [[[-25, -23], [-23, -21]]], "expected": 1}, {"args": [[[6, 11], [7, 11], [15, 1...
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":[[[11,18],[15,20],[3,11],[1,7],[10,17],[17,19],[8,13],[9,11],[3,11],[2,7],[1,9],[18,22]]],"expected":5},{"args":[[[7,9],[18,26],[10,17],[19,20],[11,13],[2,3],[8,11],[13,15],[7,8],[19,27]]],"expected":3}...
meeting-rooms-b3-s18
meeting-rooms
end-event-sign
20,403,550
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": [[[1, 3], [1, 2], [8, 12], [10, 17], [14, 17], [17, 24], [14, 18], [9, 15], [13...
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":[[[11,18],[15,20],[3,11],[1,7],[10,17],[17,19],[8,13],[9,11],[3,11],[2,7],[1,9],[18,22]]],"expected":5},{"args":[[[7,9],[18,26],[10,17],[19,20],[11,13],[2,3],[8,11],[13,15],[7,8],[19,27]]],"expected":3}...
nearest-percentile-b0-s18
nearest-percentile
baseline
20,403,550
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": [[16, 5, -30, 42, 56, 68, -41, -27, -39, 20, -42, -10, -78, 64, 18, 58, -71, -62, 93, -9, 21, 93, 20, -...
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":[[-62,-15,-77,36,-94,-65,-70,14,-48,-95,-16,83,-81,46,37,-59,-11,72,39,87,-88,97,-64,-34,-7,-53],50],"expected":-34},{"args":[[32,37,41,73,-43,50,4,-22,-66,-5,81,-15],100],"...
nearest-percentile-b1-s18
nearest-percentile
floor-not-ceiling
20,403,550
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": [[-41, -78, -37, 38, 95, 30, 39, -37, -78, -87, -88, -15, 66, 77, 24, -11, 98, 18, 16, 34, 44, 88, -9, ...
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":[[-62,-15,-77,36,-94,-65,-70,14,-48,-95,-16,83,-81,46,37,-59,-11,72,39,87,-88,97,-64,-34,-7,-53],50],"expected":-34},{"args":[[32,37,41,73,-43,50,4,-22,-66,-5,81,-15],100],"...
nearest-percentile-b2-s18
nearest-percentile
rank-index
20,403,550
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": [[15, -66, -39, -94, -98, -95, 54, -38, -72, -58, -38, -32, 8, -29, 24, -59], 100], "expected": 54}, {"...
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":[[-62,-15,-77,36,-94,-65,-70,14,-48,-95,-16,83,-81,46,37,-59,-11,72,39,87,-88,97,-64,-34,-7,-53],50],"expected":-34},{"args":[[32,37,41,73,-43,50,4,-22,-66,-5,81,-15],100],"...
nearest-percentile-b3-s18
nearest-percentile
descending-order
20,403,550
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": [[68, -62, 86, -9, -5, -65, -58, -38, -16, -68, 85, -38, -19, -87, -25, 60, 68, 88, 30, 53, -49, 90], 5...
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":[[-62,-15,-77,36,-94,-65,-70,14,-48,-95,-16,83,-81,46,37,-59,-11,72,39,87,-88,97,-64,-34,-7,-53],50],"expected":-34},{"args":[[32,37,41,73,-43,50,4,-22,-66,-5,81,-15],100],"...