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 |
|---|---|---|---|---|---|---|---|---|---|
meeting-rooms-b0-s14 | meeting-rooms | baseline | 20,371,874 | 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": [[[3, 6], [7, 11], [5, 8], [8, 15], [11, 12], [13, 16], [1, 3], [5, 8], [13, 16... | def solve(intervals):
return len(intervals)
| train | true | 117 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[12,15],[6,7],[2,4],[16,19],[8,15],[8,14],[8,10],[17,18],[9,13],[7,12],[12,19],[12,14]]],"expected":6},{"args":[[[14,15],[12,18]]],"expected":2},{"args":[[[16,19],[10,12],[14,18],[15,23]]],"expected":... |
meeting-rooms-b1-s14 | meeting-rooms | tie-order | 20,371,874 | 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": [[[2, 7], [13, 17]]], "expected": 1}, {"args": [[[10, 18], [11, 13], [12, 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,key=lambda item:(item[0],-item[1])):
active += d
best = max(best,active)
return best
| train | false | 117 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[12,15],[6,7],[2,4],[16,19],[8,15],[8,14],[8,10],[17,18],[9,13],[7,12],[12,19],[12,14]]],"expected":6},{"args":[[[14,15],[12,18]]],"expected":2},{"args":[[[16,19],[10,12],[14,18],[15,23]]],"expected":... |
meeting-rooms-b2-s14 | meeting-rooms | peak-tracking | 20,371,874 | 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, 9], [2, 4], [3, 8]]], "expected": 3}, {"args": [[[-7, 1], [-6, -4], [-5, ... | 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 | 117 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[12,15],[6,7],[2,4],[16,19],[8,15],[8,14],[8,10],[17,18],[9,13],[7,12],[12,19],[12,14]]],"expected":6},{"args":[[[14,15],[12,18]]],"expected":2},{"args":[[[16,19],[10,12],[14,18],[15,23]]],"expected":... |
meeting-rooms-b3-s14 | meeting-rooms | end-event-sign | 20,371,874 | 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": [[[16, 19], [18, 25], [2, 9], [5, 8], [19, 25], [16, 23], [10, 14], [6, 9], [4,... | 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 | 117 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[12,15],[6,7],[2,4],[16,19],[8,15],[8,14],[8,10],[17,18],[9,13],[7,12],[12,19],[12,14]]],"expected":6},{"args":[[[14,15],[12,18]]],"expected":2},{"args":[[[16,19],[10,12],[14,18],[15,23]]],"expected":... |
nearest-percentile-b0-s14 | nearest-percentile | baseline | 20,371,874 | 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": [[-38, 36, 48, 44, -99, -18, -27, 16, -54, -14, 45, 28, -96, -39, 31, -7, -84, 28], 100], "expected": 4... | 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":[[43,47,83,40,21,-48,-95,-18,99,-87,-83,32],50],"expected":21},{"args":[[-14,-92,28,22,73,47,14,10,90,10,1,-37,-64,-77,39,-68,-11,50,-8,41,53,16,57,69,-59,-30],100],"expecte... |
nearest-percentile-b1-s14 | nearest-percentile | floor-not-ceiling | 20,371,874 | 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": [[-19, 29, -61, -66, 92, 22, 31, 40, 56, 73, 8, -53, -55, -67, -96, -97, 38, 99, 45, -7, -22, 5, -3, 4,... | 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":[[43,47,83,40,21,-48,-95,-18,99,-87,-83,32],50],"expected":21},{"args":[[-14,-92,28,22,73,47,14,10,90,10,1,-37,-64,-77,39,-68,-11,50,-8,41,53,16,57,69,-59,-30],100],"expecte... |
nearest-percentile-b2-s14 | nearest-percentile | rank-index | 20,371,874 | 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": [[-27, -25, -14, -19, -16, -10, -20, -26, -23, -17, -15, -6, -11, -22, -9, -24, -7, -5, -28, -13, -21, ... | 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":[[43,47,83,40,21,-48,-95,-18,99,-87,-83,32],50],"expected":21},{"args":[[-14,-92,28,22,73,47,14,10,90,10,1,-37,-64,-77,39,-68,-11,50,-8,41,53,16,57,69,-59,-30],100],"expecte... |
nearest-percentile-b3-s14 | nearest-percentile | descending-order | 20,371,874 | 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": [[26, 23, 25, 24, 22, 27, 28], 50], "expected": 25}, {"args": [[20, -12, 78, -92, 95, -68, 20, -100, -1... | 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":[[43,47,83,40,21,-48,-95,-18,99,-87,-83,32],50],"expected":21},{"args":[[-14,-92,28,22,73,47,14,10,90,10,1,-37,-64,-77,39,-68,-11,50,-8,41,53,16,57,69,-59,-30],100],"expecte... |
fifo-inventory-b0-s14 | fifo-inventory | baseline | 20,371,874 | 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":[[[7,699]],0],"expected":[0,[[7,699]]]},{"args":[[[7,835],[4,321],[5,260],[5,255]],34],"expected":null},{"args":[[[0,55],[0,764],[4,73... |
fifo-inventory-b1-s14 | fifo-inventory | zero-lot-retention | 20,371,874 | 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":[[[7,699]],0],"expected":[0,[[7,699]]]},{"args":[[[7,835],[4,321],[5,260],[5,255]],34],"expected":null},{"args":[[[0,55],[0,764],[4,73... |
fifo-inventory-b2-s14 | fifo-inventory | over-consumption | 20,371,874 | 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":[[[7,699]],0],"expected":[0,[[7,699]]]},{"args":[[[7,835],[4,321],[5,260],[5,255]],34],"expected":null},{"args":[[[0,55],[0,764],[4,73... |
fifo-inventory-b3-s14 | fifo-inventory | unit-cost-not-quantity | 20,371,874 | 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":[[[7,699]],0],"expected":[0,[[7,699]]]},{"args":[[[7,835],[4,321],[5,260],[5,255]],34],"expected":null},{"args":[[[0,55],[0,764],[4,73... |
csv-row-b0-s14 | csv-row | baseline | 20,371,874 | 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猫b猫,\" a猫\"\"a\",\"aab ,\""], "expected": [... | 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":["\"猫a,,\",b,bbb,\"猫猫猫猫a, \""],"expected":["猫a,,","b","bbb","猫猫猫猫a, "]},{... |
csv-row-b1-s14 | csv-row | quoted-comma | 20,371,874 | 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\"\"\"\"\"\"\""], "expected": [... | 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":["\"猫a,,\",b,bbb,\"猫猫猫猫a, \""],"expected":["猫a,,","b","bbb","猫猫猫猫a, "]},{... |
csv-row-b2-s14 | csv-row | escaped-quote | 20,371,874 | 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,y\",z"], "expected": ["x2,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":["\"猫a,,\",b,bbb,\"猫猫猫猫a, \""],"expected":["猫a,,","b","bbb","猫猫猫猫a, "]},{... |
csv-row-b3-s14 | csv-row | lost-final-field | 20,371,874 | 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": ["\"x7\"\"y\",z"], "expected": ["x7\"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":["\"猫a,,\",b,bbb,\"猫猫猫猫a, \""],"expected":["猫a,,","b","bbb","猫猫猫猫a, "]},{... |
shortest-path-b0-s14 | shortest-path | baseline | 20,371,874 | 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", 9]], "1"... | def solve(graph,start,target):
return 0 if start == target else None
| train | false | 98 | [{"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":[["2",8]],"2":[],"3":[],"4":[["2",5]]},"0","4"],"expected":null},{"args":[{"0":[["1",9],["2",4]],"1":[["4",6]],"2":[["1",7],["3",1]],"3":[],"4":[["0",2],["... |
shortest-path-b1-s14 | shortest-path | farthest-first | 20,371,874 | 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": [["3",... | 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 | 98 | [{"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":[["2",8]],"2":[],"3":[],"4":[["2",5]]},"0","4"],"expected":null},{"args":[{"0":[["1",9],["2",4]],"1":[["4",6]],"2":[["1",7],["3",1]],"3":[],"4":[["0",2],["... |
shortest-path-b2-s14 | shortest-path | lost-path-prefix | 20,371,874 | 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", 444], ["... | 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 | 98 | [{"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":[["2",8]],"2":[],"3":[],"4":[["2",5]]},"0","4"],"expected":null},{"args":[{"0":[["1",9],["2",4]],"1":[["4",6]],"2":[["1",7],["3",1]],"3":[],"4":[["0",2],["... |
shortest-path-b3-s14 | shortest-path | missing-relaxation | 20,371,874 | 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", 3], ["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 | 98 | [{"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":[["2",8]],"2":[],"3":[],"4":[["2",5]]},"0","4"],"expected":null},{"args":[{"0":[["1",9],["2",4]],"1":[["4",6]],"2":[["1",7],["3",1]],"3":[],"4":[["0",2],["... |
merge-intervals-b0-s15 | merge-intervals | baseline | 20,379,793 | 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": [[[24, 30], [9, 12], [19, 21], [-16, -11], [15, 15], [17, 17]]], "expected": [[-1... | def solve(intervals):
return sorted(intervals)
| train | false | 110 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-11,-4],[1,4],[23,28],[1,3],[-15,-12],[10,11],[-9,-7]]],"expected":[[-15,-12],[-11,-4],[1,4],[10,11],[23,28]]},{"args":[[[-17,-16],[-13,-9],[-14,-12],[-1,6],[11,18]]],"expected":[[-17,-16],[-14,-9],[-1,6],[11,18]]},{"args":[[[-2,4... |
merge-intervals-b1-s15 | merge-intervals | touching-boundary | 20,379,793 | 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": [[[-2, 0], [20, 21], [-16, -11], [-9, -5], [10, 12], [8, 14], [-11, -9], [-6, 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 | 110 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-11,-4],[1,4],[23,28],[1,3],[-15,-12],[10,11],[-9,-7]]],"expected":[[-15,-12],[-11,-4],[1,4],[10,11],[23,28]]},{"args":[[[-17,-16],[-13,-9],[-14,-12],[-1,6],[11,18]]],"expected":[[-17,-16],[-14,-9],[-1,6],[11,18]]},{"args":[[[-2,4... |
merge-intervals-b2-s15 | merge-intervals | nested-endpoint | 20,379,793 | 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": [[[-29, -24], [-32, -29]]], "expected": [[-32, -24]]}, {"args": [[[-1, 5], [-3, 2... | 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":[[[-11,-4],[1,4],[23,28],[1,3],[-15,-12],[10,11],[-9,-7]]],"expected":[[-15,-12],[-11,-4],[1,4],[10,11],[23,28]]},{"args":[[[-17,-16],[-13,-9],[-14,-12],[-1,6],[11,18]]],"expected":[[-17,-16],[-14,-9],[-1,6],[11,18]]},{"args":[[[-2,4... |
merge-intervals-b3-s15 | merge-intervals | unsorted-input | 20,379,793 | 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, -17], [16, 23], [-9, -6]]], "expected": [[-19, -17], [-9, -6], [16, 23]]}... | 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 | true | 110 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-11,-4],[1,4],[23,28],[1,3],[-15,-12],[10,11],[-9,-7]]],"expected":[[-15,-12],[-11,-4],[1,4],[10,11],[23,28]]},{"args":[[[-17,-16],[-13,-9],[-14,-12],[-1,6],[11,18]]],"expected":[[-17,-16],[-14,-9],[-1,6],[11,18]]},{"args":[[[-2,4... |
moving-sums-b0-s15 | moving-sums | baseline | 20,379,793 | 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": [[-9, 17, 28, -30, 20, -19, -20, -23], 0], "expected": []}, {"args": [[-24, 79, 62, -72, -94], 10], "expected": []}, {"args": [[8, 26, -5, -17, -14, -16, 9... | 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":[[-2,-36,-56,-22,-56,-22,-2,42,39,-65],2],"expected":[-38,-92,-78,-78,-78,-24,40,81,-26]},{"args":[[70,-5,100,-27,-9,18,-20,-27,91,-27,-96,-55,19,27],20],"expected":[]},{"args":[[3... |
moving-sums-b1-s15 | moving-sums | zero-window | 20,379,793 | 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": [[-8, -2, 19, 27, -1, -8, 16, 11, -29], 2], "expected": [-10, 17, 46, 26, -9, 8, 27, -18]}, {"args": [[-4, 6, -22, 27, 29, -20, -19, 22], 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 | 143 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-2,-36,-56,-22,-56,-22,-2,42,39,-65],2],"expected":[-38,-92,-78,-78,-78,-24,40,81,-26]},{"args":[[70,-5,100,-27,-9,18,-20,-27,91,-27,-96,-55,19,27],20],"expected":[]},{"args":[[3... |
moving-sums-b2-s15 | moving-sums | window-width | 20,379,793 | 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": [[-9, 17, 28, -30, 20, -19, -20, -23], 1], "expected": [-9, 17, 28, -30, 20, -19, -20, -23]}, {"args": [[], 16], "expected": []}, {"args": [[8, 26, -5, -17... | 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":[[-2,-36,-56,-22,-56,-22,-2,42,39,-65],2],"expected":[-38,-92,-78,-78,-78,-24,40,81,-26]},{"args":[[70,-5,100,-27,-9,18,-20,-27,91,-27,-96,-55,19,27],20],"expected":[]},{"args":[[3... |
moving-sums-b3-s15 | moving-sums | missing-first-window | 20,379,793 | 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": [[-6, -24, -8, -5, 7, 23, 7, 8, 24, 30], 2], "expected": [-30, -32, -13, 2, 30, 30, 15, 32, 54]}, {"args": [[-19, 33, 42, 2, -55, -2, -51, -37, 15], 8], "e... | 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":[[-2,-36,-56,-22,-56,-22,-2,42,39,-65],2],"expected":[-38,-92,-78,-78,-78,-24,40,81,-26]},{"args":[[70,-5,100,-27,-9,18,-20,-27,91,-27,-96,-55,19,27],20],"expected":[]},{"args":[[3... |
weighted-mean-b0-s15 | weighted-mean | baseline | 20,379,793 | 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": [[-31, 20, -39, 42, 43, -22, -44, -46, 48, -39, -14, 46, -22], [5, 2, 2, 5, 3, 4, 0, 2, 4,... | 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":[[-10,42,11,35,-18,-4,-25,-27,-6,-10,-46,-47,-27,4,-31,-24],[2,3,1,0,1,5,2,4,1,2,0,2,1,2,2,4]],"expected":-11.75},{"args":[[5,46,22,26,-7,47,-32,7,-1,-11],[5,5,4,3,1,5,3,3,2,1]],"expected":17.53125},{"ar... |
weighted-mean-b1-s15 | weighted-mean | unweighted-numerator | 20,379,793 | 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": [[-28], [3]], "expected": -28.0}, {"args": [[-30, 33, 16, -26, -28, -42, 28, 33, 24], [1, ... | 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":[[-10,42,11,35,-18,-4,-25,-27,-6,-10,-46,-47,-27,4,-31,-24],[2,3,1,0,1,5,2,4,1,2,0,2,1,2,2,4]],"expected":-11.75},{"args":[[5,46,22,26,-7,47,-32,7,-1,-11],[5,5,4,3,1,5,3,3,2,1]],"expected":17.53125},{"ar... |
weighted-mean-b2-s15 | weighted-mean | wrong-denominator | 20,379,793 | 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, 3], [1, 5]], "expected": 1.8333333333333333}, {"args": [[42, -1, 23, 20, -27, 19, -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 | 119 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[-10,42,11,35,-18,-4,-25,-27,-6,-10,-46,-47,-27,4,-31,-24],[2,3,1,0,1,5,2,4,1,2,0,2,1,2,2,4]],"expected":-11.75},{"args":[[5,46,22,26,-7,47,-32,7,-1,-11],[5,5,4,3,1,5,3,3,2,1]],"expected":17.53125},{"ar... |
weighted-mean-b3-s15 | weighted-mean | zero-weight-result | 20,379,793 | 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": [[43, 42, 30, 32, 40, 9, -17, -5, 29, -48, -38, -6], [2, 0, 4, 4, 5, 2, 4, 4, 4, 4, 4, 5]]... | 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":[[-10,42,11,35,-18,-4,-25,-27,-6,-10,-46,-47,-27,4,-31,-24],[2,3,1,0,1,5,2,4,1,2,0,2,1,2,2,4]],"expected":-11.75},{"args":[[5,46,22,26,-7,47,-32,7,-1,-11],[5,5,4,3,1,5,3,3,2,1]],"expected":17.53125},{"ar... |
stable-unique-b0-s15 | stable-unique | baseline | 20,379,793 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[0]], "expected": [0]}, {"args": [[-5, -4, 5, -1, -5]], "expected": [-5, -4, 5, -1]}, {"args": [[-3, 1, -3, -8, -8, 10, 5, 7, 3, 6, -8, 5, -5, 0, 10, ... | def solve(values):
return sorted(set(values))
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-6,-9,9,-10,-9,6,4,-3,-3,9,7,5,-5,9,0,-9,3,0,5,1,-3,-7,-10,-9,-2,9,3,1,8]],"expected":[-6,-9,9,-10,6,4,-3,7,5,-5,0,3,1,-7,-2,8]},{"args":[[9,-10,6,-4,-10,10,-10,-3,-6,7,7,-10,-2,-7,-8,5,-2,9,-4,-10,-5,5,7,-5,10,7,-3,-7,-2]],"expected":[9,-... |
stable-unique-b1-s15 | stable-unique | reverse-traversal | 20,379,793 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-2, -3, 1, 5]], "expected": [-2, -3, 1, 5]}, {"args": [[0, 10, -4, 3, -3, 5, 2, 10, -2, 1, -7, -5, -10, -1, 8, -7, 4, 6, -7, 10, -4]], "expected": [0... | 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,-9,9,-10,-9,6,4,-3,-3,9,7,5,-5,9,0,-9,3,0,5,1,-3,-7,-10,-9,-2,9,3,1,8]],"expected":[-6,-9,9,-10,6,4,-3,7,5,-5,0,3,1,-7,-2,8]},{"args":[[9,-10,6,-4,-10,10,-10,-3,-6,7,7,-10,-2,-7,-8,5,-2,9,-4,-10,-5,5,7,-5,10,7,-3,-7,-2]],"expected":[9,-... |
stable-unique-b2-s15 | stable-unique | reverse-output | 20,379,793 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[10, 7, 6, -9]], "expected": [10, 7, 6, -9]}, {"args": [[2, 0, 2, 1, 0]], "expected": [2, 0, 1]}, {"args": [[-1, -3, 7, 6, -5, -5, -1, 7, -1, 9, 6, -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 | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-6,-9,9,-10,-9,6,4,-3,-3,9,7,5,-5,9,0,-9,3,0,5,1,-3,-7,-10,-9,-2,9,3,1,8]],"expected":[-6,-9,9,-10,6,4,-3,7,5,-5,0,3,1,-7,-2,8]},{"args":[[9,-10,6,-4,-10,10,-10,-3,-6,7,7,-10,-2,-7,-8,5,-2,9,-4,-10,-5,5,7,-5,10,7,-3,-7,-2]],"expected":[9,-... |
stable-unique-b3-s15 | stable-unique | wrong-seen-value | 20,379,793 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[4, 2, -10, 2, 5, 3, 4, -4, 5, -3, 8, -6]], "expected": [4, 2, -10, 5, 3, -4, -3, 8, -6]}, {"args": [[6, 4, -9, 0, 2, 7, -5, 9, 5, -10, 7, 5, 6, 9, -8... | 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,-9,9,-10,-9,6,4,-3,-3,9,7,5,-5,9,0,-9,3,0,5,1,-3,-7,-10,-9,-2,9,3,1,8]],"expected":[-6,-9,9,-10,6,4,-3,7,5,-5,0,3,1,-7,-2,8]},{"args":[[9,-10,6,-4,-10,10,-10,-3,-6,7,7,-10,-2,-7,-8,5,-2,9,-4,-10,-5,5,7,-5,10,7,-3,-7,-2]],"expected":[9,-... |
run-length-b0-s15 | run-length | baseline | 20,379,793 | 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], [" ", 1], ["🙂", 1], ["b", 1]]}, {"args": ["c"], "expected"... | def solve(text):
return [[c,text.count(c)] for c in sorted(set(text))]
| train | false | 102 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":[" c ca猫b🙂b 🙂猫acc🙂c 🙂ac猫"],"expected":[[" ",1],["c",1],[" ",1],["c",1],["a",1],["猫",1],["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["a",1],["c",2],["🙂",1],[... |
run-length-b1-s15 | run-length | inverted-grouping | 20,379,793 | 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": ["🙂ab🙂b a🙂 bcaaaccc猫b aa🙂b🙂cba b "], "expected": [["🙂", 1], ["a", 1], ["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 | 102 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":[" c ca猫b🙂b 🙂猫acc🙂c 🙂ac猫"],"expected":[[" ",1],["c",1],[" ",1],["c",1],["a",1],["猫",1],["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["a",1],["c",2],["🙂",1],[... |
run-length-b2-s15 | run-length | double-increment | 20,379,793 | 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": ["猫猫猫bcc c猫cc abbca猫c🙂 猫 b🙂a🙂"], "expected": [["猫", 3], ["b", 1], ["c", 2], [" ", 2], ["c"... | 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 | 102 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":[" c ca猫b🙂b 🙂猫acc🙂c 🙂ac猫"],"expected":[[" ",1],["c",1],[" ",1],["c",1],["a",1],["猫",1],["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["a",1],["c",2],["🙂",1],[... |
run-length-b3-s15 | run-length | zero-initial-count | 20,379,793 | 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": ["caaa猫 ab猫 🙂cb猫 aaa🙂 "], "expected": [["c", 1], ["a", 3], ["猫", 1], [" ", 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,0])
return out
| train | false | 102 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":[" c ca猫b🙂b 🙂猫acc🙂c 🙂ac猫"],"expected":[[" ",1],["c",1],[" ",1],["c",1],["a",1],["猫",1],["b",1],["🙂",1],["b",1],[" ",1],["🙂",1],["猫",1],["a",1],["c",2],["🙂",1],[... |
luhn-b0-s15 | luhn | baseline | 20,379,793 | 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": ["94707"], "expected": false}, {"a... | 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":["167069500"],"expected":false},... |
luhn-b1-s15 | luhn | wrong-parity | 20,379,793 | 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": ["209"], "expected": false}, {"arg... | 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 | 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":["167069500"],"expected":false},... |
luhn-b2-s15 | luhn | wrong-reduction | 20,379,793 | 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": ["01301522"], "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":["167069500"],"expected":false},... |
luhn-b3-s15 | luhn | wrong-modulus | 20,379,793 | 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": ["1715366"], "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 -= 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":["167069500"],"expected":false},... |
edit-distance-b0-s15 | edit-distance | baseline | 20,379,793 | 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": ["bbb猫aa猫c", ""], "expected": 8}, {"args": ["ca猫caadaaaa", "adbcad猫a猫bc"], "expected": 8}, {"args": ["bbbcbcbc", "bbbcbcbc"], "expected... | 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":["c猫daa猫cb","d猫"],"expected":6},{"args":["bc","abad"],"expected":3},{"args":["bbd","dbaca"],"expected":4},{"args":["猫猫ba猫c猫aab","猫"],"expected":9},{"args":["baddadbaca","c"],"expected":9},{"args":["db猫猫","猫... |
edit-distance-b1-s15 | edit-distance | row-boundary | 20,379,793 | 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": ["abbc猫aabbc", "cbbaa猫cbba"], "expected": 6}, {"args": ["acc猫cbcbbaa猫", ""], "expected": 12}, {"args": ["猫aa猫cb猫cc", ""], "expected": 9... | 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":["c猫daa猫cb","d猫"],"expected":6},{"args":["bc","abad"],"expected":3},{"args":["bbd","dbaca"],"expected":4},{"args":["猫猫ba猫c猫aab","猫"],"expected":9},{"args":["baddadbaca","c"],"expected":9},{"args":["db猫猫","猫... |
edit-distance-b2-s15 | edit-distance | inverted-substitution | 20,379,793 | 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": ["bbb猫aa猫c", "bbb猫aa猫c"], "expected": 0}, {"args": ["猫ddcb猫dbcab", "c"], "expected": 10}, {"args": ["bbbcbcbc", "bbbcbcbc"], "expected"... | 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":["c猫daa猫cb","d猫"],"expected":6},{"args":["bc","abad"],"expected":3},{"args":["bbd","dbaca"],"expected":4},{"args":["猫猫ba猫c猫aab","猫"],"expected":9},{"args":["baddadbaca","c"],"expected":9},{"args":["db猫猫","猫... |
edit-distance-b3-s15 | edit-distance | diagonal-index | 20,379,793 | 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": ["aa猫猫cb猫猫ac", "ca猫猫bc猫猫aa"], "expected": 4}, {"args": ["d猫bd", "bcdaadbaba"], "expected": 8}, {"args": ["caa猫aacbcabc", ""], "expected... | 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":["c猫daa猫cb","d猫"],"expected":6},{"args":["bc","abad"],"expected":3},{"args":["bbd","dbaca"],"expected":4},{"args":["猫猫ba猫c猫aab","猫"],"expected":9},{"args":["baddadbaca","c"],"expected":9},{"args":["db猫猫","猫... |
meeting-rooms-b0-s15 | meeting-rooms | baseline | 20,379,793 | 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, 22], [15, 22], [13, 19], [5, 6], [2, 6], [10, 13], [0, 6], [17, 23], [19... | def solve(intervals):
return len(intervals)
| train | false | 114 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,24],[10,18],[19,20],[17,23],[9,13]]],"expected":3},{"args":[[[11,19],[7,14],[12,18],[18,26],[14,22],[8,16],[3,6],[7,10]]],"expected":4},{"args":[[[5,9],[15,23],[2,9],[6,7],[13,18]]],"expected":3},... |
meeting-rooms-b1-s15 | meeting-rooms | tie-order | 20,379,793 | 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], [5, 7], [14, 18], [14, 15], [2, 4], [6, 7], [13, 20], [10, 13]]], "e... | 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 | 114 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,24],[10,18],[19,20],[17,23],[9,13]]],"expected":3},{"args":[[[11,19],[7,14],[12,18],[18,26],[14,22],[8,16],[3,6],[7,10]]],"expected":4},{"args":[[[5,9],[15,23],[2,9],[6,7],[13,18]]],"expected":3},... |
meeting-rooms-b2-s15 | meeting-rooms | peak-tracking | 20,379,793 | 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, -9], [-9, -7]]], "expected": 1}, {"args": [[[17, 19], [8, 9], [1, 8], [... | 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 | 114 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,24],[10,18],[19,20],[17,23],[9,13]]],"expected":3},{"args":[[[11,19],[7,14],[12,18],[18,26],[14,22],[8,16],[3,6],[7,10]]],"expected":4},{"args":[[[5,9],[15,23],[2,9],[6,7],[13,18]]],"expected":3},... |
meeting-rooms-b3-s15 | meeting-rooms | end-event-sign | 20,379,793 | 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, 20], [13, 19], [17, 24], [12, 13], [7, 8], [9, 10], [12, 17], [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 = max(best,active)
return best
| train | false | 114 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[16,24],[10,18],[19,20],[17,23],[9,13]]],"expected":3},{"args":[[[11,19],[7,14],[12,18],[18,26],[14,22],[8,16],[3,6],[7,10]]],"expected":4},{"args":[[[5,9],[15,23],[2,9],[6,7],[13,18]]],"expected":3},... |
nearest-percentile-b0-s15 | nearest-percentile | baseline | 20,379,793 | 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": [[0, 3, 2, -7, -6, -5, -9, -3, -2, -4, 1, -1, -8], 99], "expected": 3}, {"args": [[11, -34, -21, 32, 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":[[-51,-87,-69,39,8,-96,20,-50],50],"expected":-51},{"args":[[97,-31,-17,-63,-72,12,-37,3,-4,-48,-86,95,20,-87,-1,-52,72,-69,9,78,69,6,90,-74,-56,-61],100],"expected":97},{"a... |
nearest-percentile-b1-s15 | nearest-percentile | floor-not-ceiling | 20,379,793 | 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": [[-29, -16, -28, -25, -27, -12, -18, -23, -8, -22, -13, -26, -19, -14, -21, -24, -17, -6, -11, -15, -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":[[-51,-87,-69,39,8,-96,20,-50],50],"expected":-51},{"args":[[97,-31,-17,-63,-72,12,-37,3,-4,-48,-86,95,20,-87,-1,-52,72,-69,9,78,69,6,90,-74,-56,-61],100],"expected":97},{"a... |
nearest-percentile-b2-s15 | nearest-percentile | rank-index | 20,379,793 | 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": [[-27, -23, -20, -26, -25, -21, -24, -19, -22, -29, -30, -28, -18], 33], "expected": -26}, {"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":[[-51,-87,-69,39,8,-96,20,-50],50],"expected":-51},{"args":[[97,-31,-17,-63,-72,12,-37,3,-4,-48,-86,95,20,-87,-1,-52,72,-69,9,78,69,6,90,-74,-56,-61],100],"expected":97},{"a... |
nearest-percentile-b3-s15 | nearest-percentile | descending-order | 20,379,793 | 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, -13, -16, -5, -8, -10, -17, -4, -3, -14, -9, -6, -11, -15, -7], 50], "expected": -10}, {"args": ... | 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":[[-51,-87,-69,39,8,-96,20,-50],50],"expected":-51},{"args":[[97,-31,-17,-63,-72,12,-37,3,-4,-48,-86,95,20,-87,-1,-52,72,-69,9,78,69,6,90,-74,-56,-61],100],"expected":97},{"a... |
fifo-inventory-b0-s15 | fifo-inventory | baseline | 20,379,793 | 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":[[[3,306],[2,223],[3,652],[4,495],[6,563],[3,926]],8],"expected":[3320,[[4,495],[6,563],[3,926]]]},{"args":[[[5,587],[0,141],[4,459]],... |
fifo-inventory-b1-s15 | fifo-inventory | zero-lot-retention | 20,379,793 | 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":[[[3,306],[2,223],[3,652],[4,495],[6,563],[3,926]],8],"expected":[3320,[[4,495],[6,563],[3,926]]]},{"args":[[[5,587],[0,141],[4,459]],... |
fifo-inventory-b2-s15 | fifo-inventory | over-consumption | 20,379,793 | 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":[[[3,306],[2,223],[3,652],[4,495],[6,563],[3,926]],8],"expected":[3320,[[4,495],[6,563],[3,926]]]},{"args":[[[5,587],[0,141],[4,459]],... |
fifo-inventory-b3-s15 | fifo-inventory | unit-cost-not-quantity | 20,379,793 | 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":[[[3,306],[2,223],[3,652],[4,495],[6,563],[3,926]],8],"expected":[3320,[[4,495],[6,563],[3,926]]]},{"args":[[[5,587],[0,141],[4,459]],... |
csv-row-b0-s15 | csv-row | baseline | 20,379,793 | 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": ["x7,"], "expected": ["x7", ""]}, {"args": ["\"... | 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":["\"\"\"猫\",\" 猫,猫,\""],"expected":["\"猫"," 猫,猫,"]},{"args":["\"\"\", 猫b\... |
csv-row-b1-s15 | csv-row | quoted-comma | 20,379,793 | 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": ["\"x17\"\"y\",z"], "expected": ["x17\"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":["\"\"\"猫\",\" 猫,猫,\""],"expected":["\"猫"," 猫,猫,"]},{"args":["\"\"\", 猫b\... |
csv-row-b2-s15 | csv-row | escaped-quote | 20,379,793 | 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": ["\"x7,y\",z"], "expected": ["x7,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":["\"\"\"猫\",\" 猫,猫,\""],"expected":["\"猫"," 猫,猫,"]},{"args":["\"\"\", 猫b\... |
csv-row-b3-s15 | csv-row | lost-final-field | 20,379,793 | 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": ["\"x8\"\"y\",z"], "expected": ["x8\"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":["\"\"\"猫\",\" 猫,猫,\""],"expected":["\"猫"," 猫,猫,"]},{"args":["\"\"\", 猫b\... |
shortest-path-b0-s15 | shortest-path | baseline | 20,379,793 | 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]], "1"... | def solve(graph,start,target):
return 0 if start == target else None
| train | false | 93 | [{"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":[],"2":[["1",7]]},"0","2"],"expected":null},{"args":[{"0":[],"1":[]},"0","1"],"expected":null},{"args":[{"0":[],"1":[["0",6]]},"0","1"],"expected":n... |
shortest-path-b1-s15 | shortest-path | farthest-first | 20,379,793 | 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": [["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 = max(candidates,key=lambda x:dist[x])
if n == target: return dist[n]
visited.add(n)
for nxt,w in gr... | train | false | 93 | [{"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":[],"2":[["1",7]]},"0","2"],"expected":null},{"args":[{"0":[],"1":[]},"0","1"],"expected":null},{"args":[{"0":[],"1":[["0",6]]},"0","1"],"expected":n... |
shortest-path-b2-s15 | shortest-path | lost-path-prefix | 20,379,793 | 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", 5], ["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 | 93 | [{"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":[],"2":[["1",7]]},"0","2"],"expected":null},{"args":[{"0":[],"1":[]},"0","1"],"expected":null},{"args":[{"0":[],"1":[["0",6]]},"0","1"],"expected":n... |
shortest-path-b3-s15 | shortest-path | missing-relaxation | 20,379,793 | 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", 1], ["3"... | 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 | 93 | [{"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":[],"2":[["1",7]]},"0","2"],"expected":null},{"args":[{"0":[],"1":[]},"0","1"],"expected":null},{"args":[{"0":[],"1":[["0",6]]},"0","1"],"expected":n... |
merge-intervals-b0-s16 | merge-intervals | baseline | 20,387,712 | 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": [[[20, 28], [21, 22]]], "expected": [[20, 28]]}, {"args": [[[-10, -5], [-13, -10]... | def solve(intervals):
return sorted(intervals)
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[26,26],[-9,-8],[3,7],[2,6],[20,27],[5,6],[7,8],[-9,-6],[9,9],[-20,-13],[3,4],[-11,-8],[2,4]]],"expected":[[-20,-13],[-11,-6],[2,8],[9,9],[20,27]]},{"args":[[[0,1],[-16,-9],[29,29],[-16,-11],[3,7],[-14,-11]]],"expected":[[-16,-9],[... |
merge-intervals-b1-s16 | merge-intervals | touching-boundary | 20,387,712 | 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": [[[2, 6], [-9, -6], [-14, -7]]], "expected": [[-14, -6], [2, 6]]}, {"args": [[[-5... | 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":[[[26,26],[-9,-8],[3,7],[2,6],[20,27],[5,6],[7,8],[-9,-6],[9,9],[-20,-13],[3,4],[-11,-8],[2,4]]],"expected":[[-20,-13],[-11,-6],[2,8],[9,9],[20,27]]},{"args":[[[0,1],[-16,-9],[29,29],[-16,-11],[3,7],[-14,-11]]],"expected":[[-16,-9],[... |
merge-intervals-b2-s16 | merge-intervals | nested-endpoint | 20,387,712 | 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": [[[-16, -8], [-15, -14]]], "expected": [[-16, -8]]}, {"args": [[[28, 31], [-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":[[[26,26],[-9,-8],[3,7],[2,6],[20,27],[5,6],[7,8],[-9,-6],[9,9],[-20,-13],[3,4],[-11,-8],[2,4]]],"expected":[[-20,-13],[-11,-6],[2,8],[9,9],[20,27]]},{"args":[[[0,1],[-16,-9],[29,29],[-16,-11],[3,7],[-14,-11]]],"expected":[[-16,-9],[... |
merge-intervals-b3-s16 | merge-intervals | unsorted-input | 20,387,712 | 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, 11], [16, 19], [-20, -19], [0, 0], [-9, -9], [-19, -19], [-12, -6], [4, 6],... | 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":[[[26,26],[-9,-8],[3,7],[2,6],[20,27],[5,6],[7,8],[-9,-6],[9,9],[-20,-13],[3,4],[-11,-8],[2,4]]],"expected":[[-20,-13],[-11,-6],[2,8],[9,9],[20,27]]},{"args":[[[0,1],[-16,-9],[29,29],[-16,-11],[3,7],[-14,-11]]],"expected":[[-16,-9],[... |
moving-sums-b0-s16 | moving-sums | baseline | 20,387,712 | 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": [[70, -16, 32, -32, 75, -11, -10, -10, -52], 6], "expected": [118, 38, 44, -40]}, {"args": [[24, -26, -4, -14, -18, 4], 2], "expected": [-2, -30, -18, -32,... | 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":[[98,1,55,27],13],"expected":[]},{"args":[[-48,17,14,80],10],"expected":[]},{"args":[[2,73,-100,2,-23,-44,-68,53,18,18,-1,9,-32,64,60,-67],20],"expected":[]},{"args":[[-40,-83,99,-... |
moving-sums-b1-s16 | moving-sums | zero-window | 20,387,712 | 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, 23, -6, -1, 12, 2, 18], 0], "expected": []}, {"args": [[-6, 67, 6, -31, 70, 31, 74, 28, 81], 13], "expected": []}, {"args": [[-76, 70, -6, -94, -86, 2... | 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":[[98,1,55,27],13],"expected":[]},{"args":[[-48,17,14,80],10],"expected":[]},{"args":[[2,73,-100,2,-23,-44,-68,53,18,18,-1,9,-32,64,60,-67],20],"expected":[]},{"args":[[-40,-83,99,-... |
moving-sums-b2-s16 | moving-sums | window-width | 20,387,712 | 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": [[24, -26, -4, -14, -18, 4], 0], "expected": []}, {"args": [[-78, 20, 0, 17, -12, 27, 59, -45, -16, 19, 80, 13, 12, 27, 19, 83, 61], 7], "expected": [33, 6... | 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":[[98,1,55,27],13],"expected":[]},{"args":[[-48,17,14,80],10],"expected":[]},{"args":[[2,73,-100,2,-23,-44,-68,53,18,18,-1,9,-32,64,60,-67],20],"expected":[]},{"args":[[-40,-83,99,-... |
moving-sums-b3-s16 | moving-sums | missing-first-window | 20,387,712 | 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": [[22, 21, -17, -6, -18, -27, 5], 1], "expected": [22, 21, -17, -6, -18, -27, 5]}, {"args": [[14, 13, -30, -13, -16, -11, 9, 5, -22, 5, -2], 2], "expected":... | 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":[[98,1,55,27],13],"expected":[]},{"args":[[-48,17,14,80],10],"expected":[]},{"args":[[2,73,-100,2,-23,-44,-68,53,18,18,-1,9,-32,64,60,-67],20],"expected":[]},{"args":[[-40,-83,99,-... |
weighted-mean-b0-s16 | weighted-mean | baseline | 20,387,712 | 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, -11], [0, 0]], "expected": null}, {"args": [[-27, -20], [1, 5]], "expected": -21.16... | 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":[[-33,-25,22,-11,47,-23],[5,5,3,1,0,2]],"expected":-17.5625},{"args":[[14,45,-10,15,-28,34,12,-44,40,-39,18],[5,1,0,2,0,3,4,2,4,3,3]],"expected":11.25925925925926},{"args":[[-25,-1],[2,3]],"expected":-10... |
weighted-mean-b1-s16 | weighted-mean | unweighted-numerator | 20,387,712 | 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": [[-12, -47, 37, -47, 44, -33, -48, -1, -1, 39, -33, -39, -30, -16, -30, 27, -47], [3, 2, 1... | 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":[[-33,-25,22,-11,47,-23],[5,5,3,1,0,2]],"expected":-17.5625},{"args":[[14,45,-10,15,-28,34,12,-44,40,-39,18],[5,1,0,2,0,3,4,2,4,3,3]],"expected":11.25925925925926},{"args":[[-25,-1],[2,3]],"expected":-10... |
weighted-mean-b2-s16 | weighted-mean | wrong-denominator | 20,387,712 | 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": [[21, 28], [0, 0]], "expected": null}, {"args": [[3, 10], [1, 5]], "expected": 8.833333333... | 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":[[-33,-25,22,-11,47,-23],[5,5,3,1,0,2]],"expected":-17.5625},{"args":[[14,45,-10,15,-28,34,12,-44,40,-39,18],[5,1,0,2,0,3,4,2,4,3,3]],"expected":11.25925925925926},{"args":[[-25,-1],[2,3]],"expected":-10... |
weighted-mean-b3-s16 | weighted-mean | zero-weight-result | 20,387,712 | 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": [[-17, -36, 35, -2, 21, -25], [2, 5, 4, 1, 2, 5]], "expected": -8.368421052631579}, {"args... | 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 | 121 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[-33,-25,22,-11,47,-23],[5,5,3,1,0,2]],"expected":-17.5625},{"args":[[14,45,-10,15,-28,34,12,-44,40,-39,18],[5,1,0,2,0,3,4,2,4,3,3]],"expected":11.25925925925926},{"args":[[-25,-1],[2,3]],"expected":-10... |
stable-unique-b0-s16 | stable-unique | baseline | 20,387,712 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[5, 3, 5, 4, 3]], "expected": [5, 3, 4]}, {"args": [[6]], "expected": [6]}, {"args": [[9, -6, 5, -7, 3, -6, -8, -10, -1, -1, 7, -5, -2, 10, -5, 9, 7, ... | def solve(values):
return sorted(set(values))
| train | false | 97 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-9,7,8,-5,6,10,10,-9,-4,-10,-10,-9,7,8,-6,4,-5,-9,1,-8,3,3]],"expected":[-9,7,8,-5,6,10,-4,-10,-6,4,1,-8,3]},{"args":[[4,4,-3,-7,3,8,-7,-1,-6,-9,-2,2]],"expected":[4,-3,-7,3,8,-1,-6,-9,-2,2]},{"args":[[6,2,3,-8,-8,6,-8,8,-10,-5,-2,5,4,2,-5... |
stable-unique-b1-s16 | stable-unique | reverse-traversal | 20,387,712 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-10, -3, 5, 4, -6, -9, 8, -3, 1, 8, -1, -2, 3, 6, -2, 5, 6, -6, -6]], "expected": [-10, -3, 5, 4, -6, -9, 8, 1, -1, -2, 3, 6]}, {"args": [[-4, 8, 9, ... | 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 | 97 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-9,7,8,-5,6,10,10,-9,-4,-10,-10,-9,7,8,-6,4,-5,-9,1,-8,3,3]],"expected":[-9,7,8,-5,6,10,-4,-10,-6,4,1,-8,3]},{"args":[[4,4,-3,-7,3,8,-7,-1,-6,-9,-2,2]],"expected":[4,-3,-7,3,8,-1,-6,-9,-2,2]},{"args":[[6,2,3,-8,-8,6,-8,8,-10,-5,-2,5,4,2,-5... |
stable-unique-b2-s16 | stable-unique | reverse-output | 20,387,712 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[6, 6, 10, -1, -6, -1, 0, 8, 6, -1, -4, 9, -5, 9, 0, 1, -3, 7, 6, -8, -3, -3, 1, -5, -6]], "expected": [6, 10, -1, -6, 0, 8, -4, 9, -5, 1, -3, 7, -8]}... | 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 | true | 97 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-9,7,8,-5,6,10,10,-9,-4,-10,-10,-9,7,8,-6,4,-5,-9,1,-8,3,3]],"expected":[-9,7,8,-5,6,10,-4,-10,-6,4,1,-8,3]},{"args":[[4,4,-3,-7,3,8,-7,-1,-6,-9,-2,2]],"expected":[4,-3,-7,3,8,-1,-6,-9,-2,2]},{"args":[[6,2,3,-8,-8,6,-8,8,-10,-5,-2,5,4,2,-5... |
stable-unique-b3-s16 | stable-unique | wrong-seen-value | 20,387,712 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-10, 0, 2, -4, -8, -9, 7, 5, -5, -8, 6, 0, -8, 8]], "expected": [-10, 0, 2, -4, -8, -9, 7, 5, -5, 6, 8]}, {"args": [[-37, -39, -37, -38, -39]], "expe... | 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 | 97 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-9,7,8,-5,6,10,10,-9,-4,-10,-10,-9,7,8,-6,4,-5,-9,1,-8,3,3]],"expected":[-9,7,8,-5,6,10,-4,-10,-6,4,1,-8,3]},{"args":[[4,4,-3,-7,3,8,-7,-1,-6,-9,-2,2]],"expected":[4,-3,-7,3,8,-1,-6,-9,-2,2]},{"args":[[6,2,3,-8,-8,6,-8,8,-10,-5,-2,5,4,2,-5... |
run-length-b0-s16 | run-length | baseline | 20,387,712 | 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": ["猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫猫ccccccccccccccccccc"], "expected": [["猫", 20], ["c", 19]]}, {"args": ["b... | 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":["猫cbcca🙂c🙂 cc🙂🙂ca猫bba猫c🙂cccab"],"expected":[["猫",1],["c",1],["b",1],["c",2],["a",1],["🙂",1],["c",1],["🙂",1],[" ",1],["c",2],["🙂",2],["c",1],["a",1],["猫",1],["... |
run-length-b1-s16 | run-length | inverted-grouping | 20,387,712 | 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猫猫 🙂ccb 🙂 bba🙂 猫bb猫猫 猫b🙂a"], "expected": [["🙂", 1], ["c", 1], ["猫", 2], [" ", 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":["猫cbcca🙂c🙂 cc🙂🙂ca猫bba猫c🙂cccab"],"expected":[["猫",1],["c",1],["b",1],["c",2],["a",1],["🙂",1],["c",1],["🙂",1],[" ",1],["c",2],["🙂",2],["c",1],["a",1],["猫",1],["... |
run-length-b2-s16 | run-length | double-increment | 20,387,712 | 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": [" abccb猫caa猫猫a🙂cc猫🙂c bb abcaaa猫猫猫"], "expected": [[" ", 2], ["a", 1], ["b", 1], ["c", 2], ... | 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":["猫cbcca🙂c🙂 cc🙂🙂ca猫bba猫c🙂cccab"],"expected":[["猫",1],["c",1],["b",1],["c",2],["a",1],["🙂",1],["c",1],["🙂",1],[" ",1],["c",2],["🙂",2],["c",1],["a",1],["猫",1],["... |
run-length-b3-s16 | run-length | zero-initial-count | 20,387,712 | 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🙂 a猫🙂🙂acc🙂"], "expected": [["b", 1], ["猫", 1], ["b", 1], ["🙂", 1], [" ", 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,0])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["猫cbcca🙂c🙂 cc🙂🙂ca猫bba猫c🙂cccab"],"expected":[["猫",1],["c",1],["b",1],["c",2],["a",1],["🙂",1],["c",1],["🙂",1],[" ",1],["c",2],["🙂",2],["c",1],["a",1],["猫",1],["... |
luhn-b0-s16 | luhn | baseline | 20,387,712 | 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": ["413783283"], "expected": true}, ... | 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":["6194402"],"expected":false},{"... |
luhn-b1-s16 | luhn | wrong-parity | 20,387,712 | 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": ["05220646"], "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":["6194402"],"expected":false},{"... |
luhn-b2-s16 | luhn | wrong-reduction | 20,387,712 | 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": ["828"], "expected": true}, {"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 -= 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":["6194402"],"expected":false},{"... |
luhn-b3-s16 | luhn | wrong-modulus | 20,387,712 | 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": ["636373"], "expected": true}, {"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 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":["6194402"],"expected":false},{"... |
edit-distance-b0-s16 | edit-distance | baseline | 20,387,712 | 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": ["accaddda", ""], "expected": 8}, {"args": ["c猫a猫猫猫猫", "c猫a猫猫猫猫"], "expected": 0}, {"args": ["c猫a猫猫猫猫", ""], "expected": 7}] | 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":["abca猫","d猫"],"expected":4},{"args":["bbbbdca猫b","d猫bbccddbc"],"expected":6},{"args":["bcddb猫b猫cc","c猫c"],"expected":7},{"args":["dabcadd","猫bb猫"],"expected":6},{"args":["ba猫",""],"expected":3},{"args":["c... |
edit-distance-b1-s16 | edit-distance | row-boundary | 20,387,712 | 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": ["acaabab猫ba", "ab猫babaaca"], "expected": 6}, {"args": ["a猫bbcdb猫", "d猫cbb"], "expected": 5}, {"args": ["baddbd", "猫cdcacbaab猫"], "expe... | 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":["abca猫","d猫"],"expected":4},{"args":["bbbbdca猫b","d猫bbccddbc"],"expected":6},{"args":["bcddb猫b猫cc","c猫c"],"expected":7},{"args":["dabcadd","猫bb猫"],"expected":6},{"args":["ba猫",""],"expected":3},{"args":["c... |
edit-distance-b2-s16 | edit-distance | inverted-substitution | 20,387,712 | 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": ["caaaabbc猫", "猫cbbaaaac"], "expected": 6}, {"args": ["猫d猫猫cc猫", "a猫"], "expected": 6}, {"args": ["caaaabbc猫", "caaaabbc猫"], "expected"... | 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":["abca猫","d猫"],"expected":4},{"args":["bbbbdca猫b","d猫bbccddbc"],"expected":6},{"args":["bcddb猫b猫cc","c猫c"],"expected":7},{"args":["dabcadd","猫bb猫"],"expected":6},{"args":["ba猫",""],"expected":3},{"args":["c... |
edit-distance-b3-s16 | edit-distance | diagonal-index | 20,387,712 | 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": ["acaabab猫ba", "acaabab猫ba"], "expected": 0}, {"args": ["aa猫", "c猫bcd猫d猫猫"], "expected": 8}, {"args": ["adb", "dbd猫acab"], "expected": ... | 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":["abca猫","d猫"],"expected":4},{"args":["bbbbdca猫b","d猫bbccddbc"],"expected":6},{"args":["bcddb猫b猫cc","c猫c"],"expected":7},{"args":["dabcadd","猫bb猫"],"expected":6},{"args":["ba猫",""],"expected":3},{"args":["c... |
meeting-rooms-b0-s16 | meeting-rooms | baseline | 20,387,712 | 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, 9], [9, 11]]], "expected": 1}, {"args": [[[-23, -15], [-22, -20], [-21, -... | def solve(intervals):
return len(intervals)
| train | false | 115 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[9,11],[3,4],[14,16],[15,18],[11,17],[11,17],[16,22],[9,16],[4,6],[4,9]]],"expected":5},{"args":[[[19,22],[6,11],[12,14],[13,16],[4,11],[10,11],[5,9],[9,13],[13,15],[17,21],[10,12],[17,21],[11,14],[19... |
meeting-rooms-b1-s16 | meeting-rooms | tie-order | 20,387,712 | 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, 13], [11, 16], [4, 7], [17, 21], [0, 3], [13, 16], [8, 11], [6, 10], [15,... | 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 | 115 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[9,11],[3,4],[14,16],[15,18],[11,17],[11,17],[16,22],[9,16],[4,6],[4,9]]],"expected":5},{"args":[[[19,22],[6,11],[12,14],[13,16],[4,11],[10,11],[5,9],[9,13],[13,15],[17,21],[10,12],[17,21],[11,14],[19... |
meeting-rooms-b2-s16 | meeting-rooms | peak-tracking | 20,387,712 | 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, 10], [10, 12]]], "expected": 1}, {"args": [[[14, 21], [16, 24], [6, 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 = min(best,active)
return best
| train | false | 115 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[9,11],[3,4],[14,16],[15,18],[11,17],[11,17],[16,22],[9,16],[4,6],[4,9]]],"expected":5},{"args":[[[19,22],[6,11],[12,14],[13,16],[4,11],[10,11],[5,9],[9,13],[13,15],[17,21],[10,12],[17,21],[11,14],[19... |
meeting-rooms-b3-s16 | meeting-rooms | end-event-sign | 20,387,712 | 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": [[[0, 5], [0, 6], [16, 17], [11, 18], [6, 8], [17, 23]]], "expected": 2}, {"arg... | 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 | 115 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[9,11],[3,4],[14,16],[15,18],[11,17],[11,17],[16,22],[9,16],[4,6],[4,9]]],"expected":5},{"args":[[[19,22],[6,11],[12,14],[13,16],[4,11],[10,11],[5,9],[9,13],[13,15],[17,21],[10,12],[17,21],[11,14],[19... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.