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 |
|---|---|---|---|---|---|---|---|---|---|
stable-unique-b0-s06 | stable-unique | baseline | 20,308,522 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[9, -10, 0, 3, -5, 10, -1, 10]], "expected": [9, -10, 0, 3, -5, 10, -1]}, {"args": [[3, 1, 3, 2, 1]], "expected": [3, 1, 2]}, {"args": [[8, 6, 9, 0, -... | def solve(values):
return sorted(set(values))
| train | true | 98 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[2,-1,-3,6,-2,-5,10,7,-1,5,10,8,4,1,-9,-9,-1,4,-3,4,-7,-5,3]],"expected":[2,-1,-3,6,-2,-5,10,7,5,8,4,1,-9,-7,3]},{"args":[[7,3,-6,4,6,10,-1,1,0,0,7,-10,-7,6,-1,3]],"expected":[7,3,-6,4,6,10,-1,1,0,-10,-7]},{"args":[[8,6,9,0,-4,0,-7,2,-2,2,-... |
stable-unique-b1-s06 | stable-unique | reverse-traversal | 20,308,522 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-23, -25, -23, -24, -25]], "expected": [-23, -25, -24]}, {"args": [[-7, 10, 3, -4, -1, -10, -10, -4]], "expected": [-7, 10, 3, -4, -1, -10]}, {"args"... | 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":[[2,-1,-3,6,-2,-5,10,7,-1,5,10,8,4,1,-9,-9,-1,4,-3,4,-7,-5,3]],"expected":[2,-1,-3,6,-2,-5,10,7,5,8,4,1,-9,-7,3]},{"args":[[7,3,-6,4,6,10,-1,1,0,0,7,-10,-7,6,-1,3]],"expected":[7,3,-6,4,6,10,-1,1,0,-10,-7]},{"args":[[8,6,9,0,-4,0,-7,2,-2,2,-... |
stable-unique-b2-s06 | stable-unique | reverse-output | 20,308,522 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-2, -5, -8, 8, 2, 4, 10, -2, -7, -10, 7, -1, -1, 10, 8, 8, 5, -1, -3]], "expected": [-2, -5, -8, 8, 2, 4, 10, -7, -10, 7, -1, 5, -3]}, {"args": [[2, ... | 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":[[2,-1,-3,6,-2,-5,10,7,-1,5,10,8,4,1,-9,-9,-1,4,-3,4,-7,-5,3]],"expected":[2,-1,-3,6,-2,-5,10,7,5,8,4,1,-9,-7,3]},{"args":[[7,3,-6,4,6,10,-1,1,0,0,7,-10,-7,6,-1,3]],"expected":[7,3,-6,4,6,10,-1,1,0,-10,-7]},{"args":[[8,6,9,0,-4,0,-7,2,-2,2,-... |
stable-unique-b3-s06 | stable-unique | wrong-seen-value | 20,308,522 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-10, -8, -10, -5, -8, 4, 7, 4, 2, -4, -2, -9, 5, 1, 2, -8, 9, -2, 0, -6, -4, -2, 0, 9, -10, -1, -10, -3, 4]], "expected": [-10, -8, -5, 4, 7, 2, -4, ... | 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":[[2,-1,-3,6,-2,-5,10,7,-1,5,10,8,4,1,-9,-9,-1,4,-3,4,-7,-5,3]],"expected":[2,-1,-3,6,-2,-5,10,7,5,8,4,1,-9,-7,3]},{"args":[[7,3,-6,4,6,10,-1,1,0,0,7,-10,-7,6,-1,3]],"expected":[7,3,-6,4,6,10,-1,1,0,-10,-7]},{"args":[[8,6,9,0,-4,0,-7,2,-2,2,-... |
run-length-b0-s06 | run-length | baseline | 20,308,522 | 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": ["猫猫猫猫猫ba猫bcb猫猫ab c 猫 acb🙂 bc猫 a猫"], "expected": [["猫", 5], ["b", 1], ["a", 1], ["猫", 1], ["b... | def solve(text):
return [[c,text.count(c)] for c in sorted(set(text))]
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca猫 bcab猫🙂"],"expected":[["c",1],["a",1],["猫",1],[" ",1],["b",1],["c",1],["a",1],["b",1],["猫",1],["🙂",1]]},{"args":["🙂 aaa猫a猫c🙂猫a猫猫"],"expected":[["🙂",1],[" ",1... |
run-length-b1-s06 | run-length | inverted-grouping | 20,308,522 | 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": ["bbbbbbbbbbbbbbbbddddddddddddddd"], "expected": [["b", 16], ["d", 15]]}, {"args": ["c猫b🙂 ccb... | def solve(text):
out = []
for c in text:
if out and out[-1][0] != c: out[-1][1] += 1
else: out.append([c,1])
return out
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca猫 bcab猫🙂"],"expected":[["c",1],["a",1],["猫",1],[" ",1],["b",1],["c",1],["a",1],["b",1],["猫",1],["🙂",1]]},{"args":["🙂 aaa猫a猫c🙂猫a猫猫"],"expected":[["🙂",1],[" ",1... |
run-length-b2-s06 | run-length | double-increment | 20,308,522 | 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猫aa猫🙂ba bcca🙂猫b猫b🙂c猫猫cba猫🙂猫 aa🙂"], "expected": [["c", 1], ["猫", 1], ["a", 2], ["猫", 1... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 2
else: out.append([c,1])
return out
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca猫 bcab猫🙂"],"expected":[["c",1],["a",1],["猫",1],[" ",1],["b",1],["c",1],["a",1],["b",1],["猫",1],["🙂",1]]},{"args":["🙂 aaa猫a猫c🙂猫a猫猫"],"expected":[["🙂",1],[" ",1... |
run-length-b3-s06 | run-length | zero-initial-count | 20,308,522 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["🙂bb🙂 猫 c猫猫🙂猫c猫🙂ca🙂ac🙂c猫b 🙂猫🙂猫"], "expected": [["🙂", 1], ["b", 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,0])
return out
| train | false | 99 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca猫 bcab猫🙂"],"expected":[["c",1],["a",1],["猫",1],[" ",1],["b",1],["c",1],["a",1],["b",1],["猫",1],["🙂",1]]},{"args":["🙂 aaa猫a猫c🙂猫a猫猫"],"expected":[["🙂",1],[" ",1... |
luhn-b0-s06 | luhn | baseline | 20,308,522 | 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": ["391114517799166"], "expected": f... | def solve(text):
return bool(text) and text.isdigit() and sum(int(c) for c in text)%10 == 0
| train | false | 188 | [{"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":["274457"],"expected":false},{"a... |
luhn-b1-s06 | luhn | wrong-parity | 20,308,522 | 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": ["83870379"], "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 | 188 | [{"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":["274457"],"expected":false},{"a... |
luhn-b2-s06 | luhn | wrong-reduction | 20,308,522 | 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": ["123343722369623561"], "expected"... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if i%2:
v *= 2
if v > 9: v -= 8
total += v
return total%10 == 0
| train | false | 188 | [{"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":["274457"],"expected":false},{"a... |
luhn-b3-s06 | luhn | wrong-modulus | 20,308,522 | 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": ["035949"], "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 | 188 | [{"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":["274457"],"expected":false},{"a... |
edit-distance-b0-s06 | edit-distance | baseline | 20,308,522 | 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": ["cbb", "cbb"], "expected": 0}, {"args": ["猫", "狗"], "expected": 1}, {"args": ["cba", "cddbadb猫cc猫"], "expected": 8}] | def solve(a,b):
return abs(len(a)-len(b))
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["da猫bdaca猫a猫","cb猫bbab"],"expected":8},{"args":["猫dcdbddddc",""],"expected":10},{"args":["猫bd猫acad","bda猫猫adba"],"expected":6},{"args":["bd","b猫ac猫aaac"],"expected":8},{"args":["cacbd猫dacb","猫aaa猫d猫"],"exp... |
edit-distance-b1-s06 | edit-distance | row-boundary | 20,308,522 | 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": ["bbcaaaaa猫bb", ""], "expected": 11}, {"args": ["accbab猫a猫", "猫a猫babcca"], "expected": 6}, {"args": ["bc猫", "猫猫dab猫猫b"], "expected": 6}... | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [0]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x != y)))
row = nxt
return row[-1]
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["da猫bdaca猫a猫","cb猫bbab"],"expected":8},{"args":["猫dcdbddddc",""],"expected":10},{"args":["猫bd猫acad","bda猫猫adba"],"expected":6},{"args":["bd","b猫ac猫aaac"],"expected":8},{"args":["cacbd猫dacb","猫aaa猫d猫"],"exp... |
edit-distance-b2-s06 | edit-distance | inverted-substitution | 20,308,522 | 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": ["b猫猫aa猫b猫猫", ""], "expected": 9}, {"args": ["", "猫b猫b猫db猫b猫c"], "expected": 11}, {"args": ["cbb", "cbb"], "expected": 0}] | def solve(a,b):
row = list(range(len(b)+1))
for i,x in enumerate(a,1):
nxt = [i]
for j,y in enumerate(b,1):
nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x == y)))
row = nxt
return row[-1]
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["da猫bdaca猫a猫","cb猫bbab"],"expected":8},{"args":["猫dcdbddddc",""],"expected":10},{"args":["猫bd猫acad","bda猫猫adba"],"expected":6},{"args":["bd","b猫ac猫aaac"],"expected":8},{"args":["cacbd猫dacb","猫aaa猫d猫"],"exp... |
edit-distance-b3-s06 | edit-distance | diagonal-index | 20,308,522 | 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": ["", "猫adbdcdb"], "expected": 8}, {"args": ["b猫猫aa猫b猫猫", "b猫猫aa猫b猫猫"], "expected": 0}, {"args": ["bacab", "猫bcbd"], "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]+(x != y)))
row = nxt
return row[-1]
| train | false | 141 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["da猫bdaca猫a猫","cb猫bbab"],"expected":8},{"args":["猫dcdbddddc",""],"expected":10},{"args":["猫bd猫acad","bda猫猫adba"],"expected":6},{"args":["bd","b猫ac猫aaac"],"expected":8},{"args":["cacbd猫dacb","猫aaa猫d猫"],"exp... |
meeting-rooms-b0-s06 | meeting-rooms | baseline | 20,308,522 | 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": [[[-20, -12], [-19, -17], [-18, -13]]], "expected": 3}, {"args": [[[14, 15], [1... | def solve(intervals):
return len(intervals)
| train | false | 117 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[3,7],[7,14],[18,25],[9,16]]],"expected":2},{"args":[[[17,19],[4,12],[5,8],[6,8]]],"expected":3},{"args":[[[3,7],[18,25],[14,21],[14,17],[6,14],[16,22],[14,16],[0,2],[16,21],[2,3],[19,21],[10,18],[16,... |
meeting-rooms-b1-s06 | meeting-rooms | tie-order | 20,308,522 | 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": [[[-22, -20], [-20, -18]]], "expected": 1}, {"args": [[[5, 8], [14, 16], [19, 2... | 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":[[[3,7],[7,14],[18,25],[9,16]]],"expected":2},{"args":[[[17,19],[4,12],[5,8],[6,8]]],"expected":3},{"args":[[[3,7],[18,25],[14,21],[14,17],[6,14],[16,22],[14,16],[0,2],[16,21],[2,3],[19,21],[10,18],[16,... |
meeting-rooms-b2-s06 | meeting-rooms | peak-tracking | 20,308,522 | 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, 16]]], "expected": 1}, {"args": [[[2, 8], [16, 17], [13, 16], [16, 23], ... | 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":[[[3,7],[7,14],[18,25],[9,16]]],"expected":2},{"args":[[[17,19],[4,12],[5,8],[6,8]]],"expected":3},{"args":[[[3,7],[18,25],[14,21],[14,17],[6,14],[16,22],[14,16],[0,2],[16,21],[2,3],[19,21],[10,18],[16,... |
meeting-rooms-b3-s06 | meeting-rooms | end-event-sign | 20,308,522 | 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": [[[12, 20], [18, 23], [4, 7], [13, 21], [16, 23], [15, 17], [13, 14], [8, 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):
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":[[[3,7],[7,14],[18,25],[9,16]]],"expected":2},{"args":[[[17,19],[4,12],[5,8],[6,8]]],"expected":3},{"args":[[[3,7],[18,25],[14,21],[14,17],[6,14],[16,22],[14,16],[0,2],[16,21],[2,3],[19,21],[10,18],[16,... |
nearest-percentile-b0-s06 | nearest-percentile | baseline | 20,308,522 | 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": [[-6, 7, -9, -2, 6, 3, -14, 5, -7, -3, -5, -13, -15, -12, -8, -1, 4, 2, -11, -10, 1, -4, 0], 99], "expe... | 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":[[24,-49,-18,-51,-14,89,-16,4,-58,81,-95,40,-76,8,-88,-36,11,37],50],"expected":-16},{"args":[[-68,52,-88,-81],100],"expected":52},{"args":[[87,91,78,92,6,21,100,-96,93,-21,... |
nearest-percentile-b1-s06 | nearest-percentile | floor-not-ceiling | 20,308,522 | 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": [[10, 8, 14, 9, 16, 12, 11, 17, 18, 13, 20, 15, 19], 50], "expected": 14}, {"args": [[-13, -16, -12, 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":[[24,-49,-18,-51,-14,89,-16,4,-58,81,-95,40,-76,8,-88,-36,11,37],50],"expected":-16},{"args":[[-68,52,-88,-81],100],"expected":52},{"args":[[87,91,78,92,6,21,100,-96,93,-21,... |
nearest-percentile-b2-s06 | nearest-percentile | rank-index | 20,308,522 | 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": [[-4, 1, -12, 3, -18, -3, 4, 0, -5, -15, -8, -19, -13, 2, -10, -17, -6, -1, 5, -11, -7, -2, -14, -16, -... | 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":[[24,-49,-18,-51,-14,89,-16,4,-58,81,-95,40,-76,8,-88,-36,11,37],50],"expected":-16},{"args":[[-68,52,-88,-81],100],"expected":52},{"args":[[87,91,78,92,6,21,100,-96,93,-21,... |
nearest-percentile-b3-s06 | nearest-percentile | descending-order | 20,308,522 | 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": [[-93, 42, 40, -4, 41, -5], 0], "expected": -93}, {"args": [[-4, 1, -12, 3, -18, -3, 4, 0, -5, -15, -8,... | 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 | 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":[[24,-49,-18,-51,-14,89,-16,4,-58,81,-95,40,-76,8,-88,-36,11,37],50],"expected":-16},{"args":[[-68,52,-88,-81],100],"expected":52},{"args":[[87,91,78,92,6,21,100,-96,93,-21,... |
fifo-inventory-b0-s06 | fifo-inventory | baseline | 20,308,522 | 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":[[[4,607],[3,408],[0,595],[4,962],[7,545],[5,672],[3,910],[2,298],[4,958]],18],"expected":[11315,[[5,672],[3,910],[2,298],[4,958]]]},{... |
fifo-inventory-b1-s06 | fifo-inventory | zero-lot-retention | 20,308,522 | 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":[[[4,607],[3,408],[0,595],[4,962],[7,545],[5,672],[3,910],[2,298],[4,958]],18],"expected":[11315,[[5,672],[3,910],[2,298],[4,958]]]},{... |
fifo-inventory-b2-s06 | fifo-inventory | over-consumption | 20,308,522 | 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":[[[4,607],[3,408],[0,595],[4,962],[7,545],[5,672],[3,910],[2,298],[4,958]],18],"expected":[11315,[[5,672],[3,910],[2,298],[4,958]]]},{... |
fifo-inventory-b3-s06 | fifo-inventory | unit-cost-not-quantity | 20,308,522 | 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":[[[4,607],[3,408],[0,595],[4,962],[7,545],[5,672],[3,910],[2,298],[4,958]],18],"expected":[11315,[[5,672],[3,910],[2,298],[4,958]]]},{... |
csv-row-b0-s06 | csv-row | baseline | 20,308,522 | 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": ["\"x4,y\",z"], "expected": ["x4,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":["\"\"\"猫b\"\"\""],"expected":["\"猫b\""]},{"args":["a猫猫,\",\""],"expected... |
csv-row-b1-s06 | csv-row | quoted-comma | 20,308,522 | 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": ["x12,"], "expected": ["x12", ""]}, {"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":["\"\"\"猫b\"\"\""],"expected":["\"猫b\""]},{"args":["a猫猫,\",\""],"expected... |
csv-row-b2-s06 | csv-row | escaped-quote | 20,308,522 | 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": ["x14,"], "expected": ["x14", ""]}, {"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":["\"\"\"猫b\"\"\""],"expected":["\"猫b\""]},{"args":["a猫猫,\",\""],"expected... |
csv-row-b3-s06 | csv-row | lost-final-field | 20,308,522 | 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,\",\"\"\",\"猫\"\"a\"\"猫a 猫a\"\"猫\",\"猫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 | 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":["\"\"\"猫b\"\"\""],"expected":["\"猫b\""]},{"args":["a猫猫,\",\""],"expected... |
shortest-path-b0-s06 | shortest-path | baseline | 20,308,522 | 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": [["6", 0]], "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",3]],"1":[],"2":[["0",3]]},"0","2"],"expected":null},{"args":[{"0":[["1",8],["3",6],["7",8]],"1":[["0",5],["2",5],["7",4]],"2":[["1",8],["4",8],["5",3],["6",... |
shortest-path-b1-s06 | shortest-path | farthest-first | 20,308,522 | 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):
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",3]],"1":[],"2":[["0",3]]},"0","2"],"expected":null},{"args":[{"0":[["1",8],["3",6],["7",8]],"1":[["0",5],["2",5],["7",4]],"2":[["1",8],["4",8],["5",3],["6",... |
shortest-path-b2-s06 | shortest-path | lost-path-prefix | 20,308,522 | 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):
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",3]],"1":[],"2":[["0",3]]},"0","2"],"expected":null},{"args":[{"0":[["1",8],["3",6],["7",8]],"1":[["0",5],["2",5],["7",4]],"2":[["1",8],["4",8],["5",3],["6",... |
shortest-path-b3-s06 | shortest-path | missing-relaxation | 20,308,522 | 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", 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",3]],"1":[],"2":[["0",3]]},"0","2"],"expected":null},{"args":[{"0":[["1",8],["3",6],["7",8]],"1":[["0",5],["2",5],["7",4]],"2":[["1",8],["4",8],["5",3],["6",... |
merge-intervals-b0-s07 | merge-intervals | baseline | 20,316,441 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[22, 26], [-7, -6], [15, 16], [-9, -9], [28, 32], [1, 2], [-9, -2], [26, 33], [... | def solve(intervals):
return sorted(intervals)
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[2,5],[-10,-8],[-13,-12],[3,3],[17,21]]],"expected":[[-13,-12],[-10,-8],[2,5],[17,21]]},{"args":[[[-17,-14],[-12,-11],[13,17],[-1,3],[-18,-11],[8,9],[15,20],[-1,2],[3,7],[12,16],[28,30],[-9,-9],[3,9],[-7,-3]]],"expected":[[-18,-11]... |
merge-intervals-b1-s07 | merge-intervals | touching-boundary | 20,316,441 | 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": [[[13, 17], [19, 26], [-11, -9], [-20, -20], [23, 23], [-19, -16], [-14, -13], [-... | 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":[[[2,5],[-10,-8],[-13,-12],[3,3],[17,21]]],"expected":[[-13,-12],[-10,-8],[2,5],[17,21]]},{"args":[[[-17,-14],[-12,-11],[13,17],[-1,3],[-18,-11],[8,9],[15,20],[-1,2],[3,7],[12,16],[28,30],[-9,-9],[3,9],[-7,-3]]],"expected":[[-18,-11]... |
merge-intervals-b2-s07 | merge-intervals | nested-endpoint | 20,316,441 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[-4, -1], [17, 18], [12, 17], [20, 23], [-6, 1], [-14, -13], [-15, -9], [5, 6],... | 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":[[[2,5],[-10,-8],[-13,-12],[3,3],[17,21]]],"expected":[[-13,-12],[-10,-8],[2,5],[17,21]]},{"args":[[[-17,-14],[-12,-11],[13,17],[-1,3],[-18,-11],[8,9],[15,20],[-1,2],[3,7],[12,16],[28,30],[-9,-9],[3,9],[-7,-3]]],"expected":[[-18,-11]... |
merge-intervals-b3-s07 | merge-intervals | unsorted-input | 20,316,441 | 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": [[[-14, -9], [-17, -14]]], "expected": [[-17, -9]]}, {"args": [[[-10, -3], [-17, ... | 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":[[[2,5],[-10,-8],[-13,-12],[3,3],[17,21]]],"expected":[[-13,-12],[-10,-8],[2,5],[17,21]]},{"args":[[[-17,-14],[-12,-11],[13,17],[-1,3],[-18,-11],[8,9],[15,20],[-1,2],[3,7],[12,16],[28,30],[-9,-9],[3,9],[-7,-3]]],"expected":[[-18,-11]... |
moving-sums-b0-s07 | moving-sums | baseline | 20,316,441 | 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": [[84, -87, 36, 9, -74, -49, -5, 46, -18, 77, 40, -12, -44, -60, 87, 80, -65], 22], "expected": []}, {"args": [[23, 4, 19, -7, -2, 16], 1], "expected": [23,... | 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":[[-47,-69,99,21,-34],20],"expected":[]},{"args":[[12,-32,-3,48,-51,88,32,-44,88,14],0],"expected":[]},{"args":[[-86,-61,79,48,-56,42,-23,44],20],"expected":[]},{"args":[[-36,-39,82... |
moving-sums-b1-s07 | moving-sums | zero-window | 20,316,441 | 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": [[-5, -17, 63, -82, -75, -59, -81, -68, 7, 19], 19], "expected": []}, {"args": [[-20, 1, 5, -15, 15, -6, -11, 27, 10, 3, 28, -14], 2], "expected": [-19, 6,... | 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 | true | 144 | [{"args":[[],1],"expected":[]},{"args":[[1,2,3],2],"expected":[3,5]},{"args":[[5],1],"expected":[5]},{"args":[[1],0],"expected":[]},{"args":[[-47,-69,99,21,-34],20],"expected":[]},{"args":[[12,-32,-3,48,-51,88,32,-44,88,14],0],"expected":[]},{"args":[[-86,-61,79,48,-56,42,-23,44],20],"expected":[]},{"args":[[-36,-39,82... |
moving-sums-b2-s07 | moving-sums | window-width | 20,316,441 | 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": [[-31, -37, -17, 79, -77, 70, 34, 89, -69, 23, 52, -36, -69, 81], 1], "expected": [-31, -37, -17, 79, -77, 70, 34, 89, -69, 23, 52, -36, -69, 81]}, {"args"... | 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":[[-47,-69,99,21,-34],20],"expected":[]},{"args":[[12,-32,-3,48,-51,88,32,-44,88,14],0],"expected":[]},{"args":[[-86,-61,79,48,-56,42,-23,44],20],"expected":[]},{"args":[[-36,-39,82... |
moving-sums-b3-s07 | moving-sums | missing-first-window | 20,316,441 | 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": [[64], 15], "expected": []}, {"args": [[13, -22, 22, -18], 2], "expected": [-9, 0, 4]}, {"args": [[-86, -61, 79, 48, -56, 42, -23, 44], 20], "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":[[-47,-69,99,21,-34],20],"expected":[]},{"args":[[12,-32,-3,48,-51,88,32,-44,88,14],0],"expected":[]},{"args":[[-86,-61,79,48,-56,42,-23,44],20],"expected":[]},{"args":[[-36,-39,82... |
weighted-mean-b0-s07 | weighted-mean | baseline | 20,316,441 | 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, -50, -32, 0, -4, 22, -23, 35, 2, -12, -45, 48, 28], [2, 1, 1, 0, 4, 2, 5, 3, 2, 3, ... | def solve(values,weights):
return sum(values)/len(values) if values else None
| train | false | 123 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[17,26,12,23,-22,-26,-7,-13,25,-23,-10,-4,-11,-22,-48,30,18,5,-16],[1,0,1,1,1,2,2,4,0,1,0,1,4,5,3,4,3,4,2]],"expected":-6.435897435897436},{"args":[[5,-10,-7,15,-8,-3,44,-24,-37,-6,-21,-27,2,-32,37,-25,... |
weighted-mean-b1-s07 | weighted-mean | unweighted-numerator | 20,316,441 | 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, -5, 47, 3, 15, 14, -31], [1, 0, 3, 4, 2, 3, 0]], "expected": 17.0}, {"args": [[-19, ... | def solve(values,weights):
total = sum(weights)
return sum(x for x,w in zip(values,weights))/total if total else None
| train | false | 123 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[17,26,12,23,-22,-26,-7,-13,25,-23,-10,-4,-11,-22,-48,30,18,5,-16],[1,0,1,1,1,2,2,4,0,1,0,1,4,5,3,4,3,4,2]],"expected":-6.435897435897436},{"args":[[5,-10,-7,15,-8,-3,44,-24,-37,-6,-21,-27,2,-32,37,-25,... |
weighted-mean-b2-s07 | weighted-mean | wrong-denominator | 20,316,441 | 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": [[32, -29, 35, 22, 13, 19, -40, 22, -35], [5, 3, 5, 2, 1, 4, 3, 4, 4]], "expected": 6.7419... | 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 | 123 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[17,26,12,23,-22,-26,-7,-13,25,-23,-10,-4,-11,-22,-48,30,18,5,-16],[1,0,1,1,1,2,2,4,0,1,0,1,4,5,3,4,3,4,2]],"expected":-6.435897435897436},{"args":[[5,-10,-7,15,-8,-3,44,-24,-37,-6,-21,-27,2,-32,37,-25,... |
weighted-mean-b3-s07 | weighted-mean | zero-weight-result | 20,316,441 | 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": [[20, 27], [1, 5]], "expected": 25.833333333333332}, {"args": [[31, 39, 4, 5, -3, 43, 25, ... | 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 | 123 | [{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[17,26,12,23,-22,-26,-7,-13,25,-23,-10,-4,-11,-22,-48,30,18,5,-16],[1,0,1,1,1,2,2,4,0,1,0,1,4,5,3,4,3,4,2]],"expected":-6.435897435897436},{"args":[[5,-10,-7,15,-8,-3,44,-24,-37,-6,-21,-27,2,-32,37,-25,... |
stable-unique-b0-s07 | stable-unique | baseline | 20,316,441 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-4, 10, -3, 6, 5, -3, -5]], "expected": [-4, 10, -3, 6, 5, -5]}, {"args": [[6, -4, 7, -7, -10, -8, 4, 9, -10, 6, 1, -1, -9, 10, -7, 7, -8, -7]], "exp... | def solve(values):
return sorted(set(values))
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[8,2,8,1,-1,10,8,10,9,-5,-7,8,-10,9,2,1,-8,-8]],"expected":[8,2,1,-1,10,9,-5,-7,-10,-8]},{"args":[[7,-2,-1,-9,-3,7,3,-3,9,6,-7,-8,-6,-7,-10,4,8]],"expected":[7,-2,-1,-9,-3,3,9,6,-7,-8,-6,-10,4,8]},{"args":[[8,-7,6,9,0,-7,-9,-8,3,-7,-5,0,-8,... |
stable-unique-b1-s07 | stable-unique | reverse-traversal | 20,316,441 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-10, 0, 1, -5, 10, -9, -10, -6, -3]], "expected": [-10, 0, 1, -5, 10, -9, -6, -3]}, {"args": [[10, 4, 1, -6, 8, -3, -5, 10, -5, -4, -7, -2, 1, 10, 7,... | 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":[[8,2,8,1,-1,10,8,10,9,-5,-7,8,-10,9,2,1,-8,-8]],"expected":[8,2,1,-1,10,9,-5,-7,-10,-8]},{"args":[[7,-2,-1,-9,-3,7,3,-3,9,6,-7,-8,-6,-7,-10,4,8]],"expected":[7,-2,-1,-9,-3,3,9,6,-7,-8,-6,-10,4,8]},{"args":[[8,-7,6,9,0,-7,-9,-8,3,-7,-5,0,-8,... |
stable-unique-b2-s07 | stable-unique | reverse-output | 20,316,441 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-10, -9, 4, -8, -3, -10, 0, -9, 4, 6, -7, -3, -8, 10, 6, 5, 1, 3, 9, -3, 4, 0, 6, 7, -5, -10]], "expected": [-10, -9, 4, -8, -3, 0, 6, -7, 10, 5, 1, ... | def solve(values):
seen = set()
out = []
for x in values:
if x not in seen:
seen.add(x)
out.insert(0,x)
return out
| train | false | 96 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[8,2,8,1,-1,10,8,10,9,-5,-7,8,-10,9,2,1,-8,-8]],"expected":[8,2,1,-1,10,9,-5,-7,-10,-8]},{"args":[[7,-2,-1,-9,-3,7,3,-3,9,6,-7,-8,-6,-7,-10,4,8]],"expected":[7,-2,-1,-9,-3,3,9,6,-7,-8,-6,-10,4,8]},{"args":[[8,-7,6,9,0,-7,-9,-8,3,-7,-5,0,-8,... |
stable-unique-b3-s07 | stable-unique | wrong-seen-value | 20,316,441 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-19, -21, -19, -20, -21]], "expected": [-19, -21, -20]}, {"args": [[-2, 8, 8, -7, 4, -4, -7, -9, -5, 2, 8, -7, -9, -8, 0, -10, 3, 4]], "expected": [-... | 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":[[8,2,8,1,-1,10,8,10,9,-5,-7,8,-10,9,2,1,-8,-8]],"expected":[8,2,1,-1,10,9,-5,-7,-10,-8]},{"args":[[7,-2,-1,-9,-3,7,3,-3,9,6,-7,-8,-6,-7,-10,4,8]],"expected":[7,-2,-1,-9,-3,3,9,6,-7,-8,-6,-10,4,8]},{"args":[[8,-7,6,9,0,-7,-9,-8,3,-7,-5,0,-8,... |
run-length-b0-s07 | run-length | baseline | 20,316,441 | 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猫a猫猫猫b猫猫b猫ca cba🙂c🙂c🙂"], "expected": [["c", 1], ["猫", 1], ["a", 1], ["猫", 3], ["b", 1], ... | 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":["ca a"],"expected":[["c",1],["a",1],[" ",2],["a",1]]},{"args":["a猫🙂c c🙂a猫bb🙂猫 a🙂a🙂bcb"],"expected":[["a",1],["猫",1],["🙂",1],["c",1],[" ",1],["c",1],["🙂",1],["... |
run-length-b1-s07 | run-length | inverted-grouping | 20,316,441 | Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate.
Examples (JSON args and expected result): [{"args": ["🙂a猫ba 🙂cc猫猫a猫猫🙂cbbac"], "expected": [["🙂", 1], ["a", 1], ["猫", 1], ["b", 1], ["a", 1], [... | def solve(text):
out = []
for c in text:
if out and out[-1][0] != c: out[-1][1] += 1
else: out.append([c,1])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca a"],"expected":[["c",1],["a",1],[" ",2],["a",1]]},{"args":["a猫🙂c c🙂a猫bb🙂猫 a🙂a🙂bcb"],"expected":[["a",1],["猫",1],["🙂",1],["c",1],[" ",1],["c",1],["🙂",1],["... |
run-length-b2-s07 | run-length | double-increment | 20,316,441 | 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 猫🙂🙂 aaab猫🙂acc猫 a猫"], "expected": [["c", 1], [" ", 1], ["猫", 1], ["🙂", 2], [" ", 1], ["... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 2
else: out.append([c,1])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca a"],"expected":[["c",1],["a",1],[" ",2],["a",1]]},{"args":["a猫🙂c c🙂a猫bb🙂猫 a🙂a🙂bcb"],"expected":[["a",1],["猫",1],["🙂",1],["c",1],[" ",1],["c",1],["🙂",1],["... |
run-length-b3-s07 | run-length | zero-initial-count | 20,316,441 | 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": ["猫猫猫猫猫猫猫dddddd"], "expected": [["猫", 7], ["d", 6]]}, {"args": ["🙂猫🙂cbc c🙂bcaba猫 a猫🙂b🙂a... | def solve(text):
out = []
for c in text:
if out and out[-1][0] == c: out[-1][1] += 1
else: out.append([c,0])
return out
| train | false | 101 | [{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["ca a"],"expected":[["c",1],["a",1],[" ",2],["a",1]]},{"args":["a猫🙂c c🙂a猫bb🙂猫 a🙂a🙂bcb"],"expected":[["a",1],["猫",1],["🙂",1],["c",1],[" ",1],["c",1],["🙂",1],["... |
luhn-b0-s07 | luhn | baseline | 20,316,441 | 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": ["620543"], "expected": false}, {"... | def solve(text):
return bool(text) and text.isdigit() and sum(int(c) for c in text)%10 == 0
| train | false | 188 | [{"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":["6134435730447"],"expected":fal... |
luhn-b1-s07 | luhn | wrong-parity | 20,316,441 | 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": ["0628548097748330"], "expected": ... | def solve(text):
if not text or any(c not in '0123456789' for c in text): return False
total = 0
for i,c in enumerate(reversed(text)):
v = int(c)
if not i%2:
v *= 2
if v > 9: v -= 9
total += v
return total%10 == 0
| train | false | 188 | [{"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":["6134435730447"],"expected":fal... |
luhn-b2-s07 | luhn | wrong-reduction | 20,316,441 | 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": ["040990908433"], "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 -= 8
total += v
return total%10 == 0
| train | false | 188 | [{"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":["6134435730447"],"expected":fal... |
luhn-b3-s07 | luhn | wrong-modulus | 20,316,441 | 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": ["251315397"], "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 -= 9
total += v
return total%9 == 0
| train | false | 188 | [{"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":["6134435730447"],"expected":fal... |
edit-distance-b0-s07 | edit-distance | baseline | 20,316,441 | 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": 2}, {"args": ["bbc猫a猫ccb猫猫b", "b猫猫bcc猫a猫cbb"], "expected": 6}, {"args": ["", "ad猫baa"], "expected": 6}] | 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":["aabbdccccd","cc"],"expected":8},{"args":["bacdcacdc","猫a"],"expected":8},{"args":["bb","猫dcd猫a"],"expected":6},{"args":["c猫猫ddaab",""],"expected":8},{"args":["c猫bbadbbcab","d猫dbba"],"expected":6},{"args":... |
edit-distance-b1-s07 | edit-distance | row-boundary | 20,316,441 | 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": ["ccd", "bccc猫d"], "expected": 3}, {"args": ["caccba猫", ""], "expected": 7}, {"args": ["猫aaacc猫bdd", "猫c猫猫bccc"], "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 | false | 143 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["aabbdccccd","cc"],"expected":8},{"args":["bacdcacdc","猫a"],"expected":8},{"args":["bb","猫dcd猫a"],"expected":6},{"args":["c猫猫ddaab",""],"expected":8},{"args":["c猫bbadbbcab","d猫dbba"],"expected":6},{"args":... |
edit-distance-b2-s07 | edit-distance | inverted-substitution | 20,316,441 | 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": ["ccddba", "猫d猫abddbc"], "expected": 6}, {"args": ["a猫ccad", "adaddc"], "expected": 5}, {"args": ["aba猫bbb猫b", ""], "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 | 143 | [{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["aabbdccccd","cc"],"expected":8},{"args":["bacdcacdc","猫a"],"expected":8},{"args":["bb","猫dcd猫a"],"expected":6},{"args":["c猫猫ddaab",""],"expected":8},{"args":["c猫bbadbbcab","d猫dbba"],"expected":6},{"args":... |
edit-distance-b3-s07 | edit-distance | diagonal-index | 20,316,441 | 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": ["cba猫cbc", "猫ac猫cadcb"], "expected": 6}, {"args": ["bacac", ""], "expected": 5}, {"args": ["c猫猫ddaab", ""], "expected": 8}] | 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":["aabbdccccd","cc"],"expected":8},{"args":["bacdcacdc","猫a"],"expected":8},{"args":["bb","猫dcd猫a"],"expected":6},{"args":["c猫猫ddaab",""],"expected":8},{"args":["c猫bbadbbcab","d猫dbba"],"expected":6},{"args":... |
meeting-rooms-b0-s07 | meeting-rooms | baseline | 20,316,441 | 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": [[[4, 8], [12, 13], [16, 21], [11, 16], [9, 15], [3, 7], [1, 2], [17, 19], [16,... | 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":[[[8,15],[7,12],[7,14],[1,6],[18,20],[14,17],[8,14],[11,17],[10,18],[12,18],[11,18],[13,14]]],"expected":8},{"args":[[[12,19],[11,15],[8,12],[10,15]]],"expected":3},{"args":[[[15,20],[6,8],[1,9],[4,11],... |
meeting-rooms-b1-s07 | meeting-rooms | tie-order | 20,316,441 | 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": [[[10, 14], [17, 25], [12, 13], [14, 21], [5, 9], [14, 21], [3, 11], [13, 20], ... | 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":[[[8,15],[7,12],[7,14],[1,6],[18,20],[14,17],[8,14],[11,17],[10,18],[12,18],[11,18],[13,14]]],"expected":8},{"args":[[[12,19],[11,15],[8,12],[10,15]]],"expected":3},{"args":[[[15,20],[6,8],[1,9],[4,11],... |
meeting-rooms-b2-s07 | meeting-rooms | peak-tracking | 20,316,441 | 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, 24], [5, 10], [0, 4], [15, 20], [11, 18], [16, 18], [10, 16], [8, 10], [... | def solve(intervals):
events = []
for a,b in intervals:
events.append([a,1])
events.append([b,-1])
active = best = 0
for t,d in sorted(events):
active += d
best = min(best,active)
return best
| train | false | 119 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,15],[7,12],[7,14],[1,6],[18,20],[14,17],[8,14],[11,17],[10,18],[12,18],[11,18],[13,14]]],"expected":8},{"args":[[[12,19],[11,15],[8,12],[10,15]]],"expected":3},{"args":[[[15,20],[6,8],[1,9],[4,11],... |
meeting-rooms-b3-s07 | meeting-rooms | end-event-sign | 20,316,441 | 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, 7], [0, 2], [1, 6]]], "expected": 3}, {"args": [[[3, 4], [0, 3], [1, 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 | 119 | [{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,15],[7,12],[7,14],[1,6],[18,20],[14,17],[8,14],[11,17],[10,18],[12,18],[11,18],[13,14]]],"expected":8},{"args":[[[12,19],[11,15],[8,12],[10,15]]],"expected":3},{"args":[[[15,20],[6,8],[1,9],[4,11],... |
nearest-percentile-b0-s07 | nearest-percentile | baseline | 20,316,441 | 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": [[78, -23, 45, -1, 80, -18, -18, 5, -61, 95, -90, -62, 94, -41, 6, -39, 24, 58, -19, 46], 50], "expecte... | 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":[[26,-68],50],"expected":-68},{"args":[[23,-37,64,37],100],"expected":64},{"args":[[38,58],0],"expected":38},{"args":[[88,63,-5,6,15,-97,23,-64,97,53,-26,85,-54,-19,-1,-17,6... |
nearest-percentile-b1-s07 | nearest-percentile | floor-not-ceiling | 20,316,441 | 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": [[45, 72], 0], "expected": 45}, {"args": [[-22, -38, -23, -40, -39, -31, -36, -34, -37, -35, -33, -24, ... | 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":[[26,-68],50],"expected":-68},{"args":[[23,-37,64,37],100],"expected":64},{"args":[[38,58],0],"expected":38},{"args":[[88,63,-5,6,15,-97,23,-64,97,53,-26,85,-54,-19,-1,-17,6... |
nearest-percentile-b2-s07 | nearest-percentile | rank-index | 20,316,441 | 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": [[-45, -9, -35, 19, 2, 1, -92, -95, -94, -72, 95, 10, -13, -76, 82, 67], 50], "expected": -13}, {"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":[[26,-68],50],"expected":-68},{"args":[[23,-37,64,37],100],"expected":64},{"args":[[38,58],0],"expected":38},{"args":[[88,63,-5,6,15,-97,23,-64,97,53,-26,85,-54,-19,-1,-17,6... |
nearest-percentile-b3-s07 | nearest-percentile | descending-order | 20,316,441 | Implement solve(values,p). Return nearest-rank percentile: sort ascending and take 1-based rank max(1,ceil(p/100*n)). p is integer 0..100. Empty input returns None.
Examples (JSON args and expected result): [{"args": [[-11, -3, -10, 35, -26, -86, 70, -29, -45, -76, -19, 29, 99, 40, -28, -4, -51, 9], 50], "expected": -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":[[26,-68],50],"expected":-68},{"args":[[23,-37,64,37],100],"expected":64},{"args":[[38,58],0],"expected":38},{"args":[[88,63,-5,6,15,-97,23,-64,97,53,-26,85,-54,-19,-1,-17,6... |
fifo-inventory-b0-s07 | fifo-inventory | baseline | 20,316,441 | 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":[[[0,136],[0,657],[6,718],[6,827],[0,828],[1,297],[5,373],[0,698]],1],"expected":[718,[[5,718],[6,827],[1,297],[5,373]]]},{"args":[[[3... |
fifo-inventory-b1-s07 | fifo-inventory | zero-lot-retention | 20,316,441 | 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":[[[0,136],[0,657],[6,718],[6,827],[0,828],[1,297],[5,373],[0,698]],1],"expected":[718,[[5,718],[6,827],[1,297],[5,373]]]},{"args":[[[3... |
fifo-inventory-b2-s07 | fifo-inventory | over-consumption | 20,316,441 | 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":[[[0,136],[0,657],[6,718],[6,827],[0,828],[1,297],[5,373],[0,698]],1],"expected":[718,[[5,718],[6,827],[1,297],[5,373]]]},{"args":[[[3... |
fifo-inventory-b3-s07 | fifo-inventory | unit-cost-not-quantity | 20,316,441 | 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":[[[0,136],[0,657],[6,718],[6,827],[0,828],[1,297],[5,373],[0,698]],1],"expected":[718,[[5,718],[6,827],[1,297],[5,373]]]},{"args":[[[3... |
csv-row-b0-s07 | csv-row | baseline | 20,316,441 | 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": ["\",,\""], "expected": [",,"]}, {"args": ["x2,... | 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":["\"ab,\",\"\"\"b\",,\" 猫\"\"猫,\",\"猫 aa\"\"\"\"\""],"expected":["ab,","... |
csv-row-b1-s07 | csv-row | quoted-comma | 20,316,441 | 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": ["ab,\",猫\"\"\",\"a ab\"\" \",\"猫a猫,b, a猫b\",\... | def solve(row):
if not row: return []
out = []
field = ''
quoted = False
i = 0
while i < len(row):
c = row[i]
if c == '"':
if quoted and i+1 < len(row) and row[i+1] == '"':
field += '"'
i += 1
else: quoted = not quoted
... | train | false | 145 | [{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":["\"ab,\",\"\"\"b\",,\" 猫\"\"猫,\",\"猫 aa\"\"\"\"\""],"expected":["ab,","... |
csv-row-b2-s07 | csv-row | escaped-quote | 20,316,441 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\"猫a猫\"\"b \"\"\",\"b\"\"\"\" b\"\"猫,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 | 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":["\"ab,\",\"\"\"b\",,\" 猫\"\"猫,\",\"猫 aa\"\"\"\"\""],"expected":["ab,","... |
csv-row-b3-s07 | csv-row | lost-final-field | 20,316,441 | Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports.
Examples (JSON args and expected result): [{"args": ["\",\"\"\"\"\"\"bab,\",\"b猫\"\"猫a \",猫b b猫bb猫 ... | 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":["\"ab,\",\"\"\"b\",,\" 猫\"\"猫,\",\"猫 aa\"\"\"\"\""],"expected":["ab,","... |
shortest-path-b0-s07 | shortest-path | baseline | 20,316,441 | 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", 2], ["4"... | def solve(graph,start,target):
return 0 if start == target else None
| train | false | 95 | [{"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":[["3",4]],"3":[]},"0","3"],"expected":null},{"args":[{"0":[["1",0]],"1":[]},"0","1"],"expected":0},{"args":[{"0":[],"1":[["4",6],["5",2],["6",1]],"2... |
shortest-path-b1-s07 | shortest-path | farthest-first | 20,316,441 | Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges.
Examples (JSON args and expected result): [{"args": [{"0": [["3", 6], ["6"... | 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 | 95 | [{"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":[["3",4]],"3":[]},"0","3"],"expected":null},{"args":[{"0":[["1",0]],"1":[]},"0","1"],"expected":0},{"args":[{"0":[],"1":[["4",6],["5",2],["6",1]],"2... |
shortest-path-b2-s07 | shortest-path | lost-path-prefix | 20,316,441 | 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]], "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 | true | 95 | [{"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":[["3",4]],"3":[]},"0","3"],"expected":null},{"args":[{"0":[["1",0]],"1":[]},"0","1"],"expected":0},{"args":[{"0":[],"1":[["4",6],["5",2],["6",1]],"2... |
shortest-path-b3-s07 | shortest-path | missing-relaxation | 20,316,441 | 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", 226], ["... | 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 | 95 | [{"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":[["3",4]],"3":[]},"0","3"],"expected":null},{"args":[{"0":[["1",0]],"1":[]},"0","1"],"expected":0},{"args":[{"0":[],"1":[["4",6],["5",2],["6",1]],"2... |
merge-intervals-b0-s08 | merge-intervals | baseline | 20,324,360 | 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, -16], [22, 27], [22, 24], [-19, -18], [21, 25], [19, 21], [16, 22]]], "ex... | def solve(intervals):
return sorted(intervals)
| train | false | 108 | [{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-15,-15],[13,16],[-13,-6],[-18,-15]]],"expected":[[-18,-15],[-13,-6],[13,16]]},{"args":[[[18,22],[-1,0]]],"expected":[[-1,0],[18,22]]},{"args":[[[2,3],[-10,-7],[-1,2],[-9,-8],[-14,-10],[9,14],[-8,-8],[16,23],[24,30],[7,9]]],"expec... |
merge-intervals-b1-s08 | merge-intervals | touching-boundary | 20,324,360 | 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": [[[9, 17], [10, 11]]], "expected": [[9, 17]]}, {"args": [[[-8, -6]]], "expected":... | 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":[[[-15,-15],[13,16],[-13,-6],[-18,-15]]],"expected":[[-18,-15],[-13,-6],[13,16]]},{"args":[[[18,22],[-1,0]]],"expected":[[-1,0],[18,22]]},{"args":[[[2,3],[-10,-7],[-1,2],[-9,-8],[-14,-10],[9,14],[-8,-8],[16,23],[24,30],[7,9]]],"expec... |
merge-intervals-b2-s08 | merge-intervals | nested-endpoint | 20,324,360 | 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": [[[-9, -5], [28, 32], [21, 25], [12, 12]]], "expected": [[-9, -5], [12, 12], [21,... | 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":[[[-15,-15],[13,16],[-13,-6],[-18,-15]]],"expected":[[-18,-15],[-13,-6],[13,16]]},{"args":[[[18,22],[-1,0]]],"expected":[[-1,0],[18,22]]},{"args":[[[2,3],[-10,-7],[-1,2],[-9,-8],[-14,-10],[9,14],[-8,-8],[16,23],[24,30],[7,9]]],"expec... |
merge-intervals-b3-s08 | merge-intervals | unsorted-input | 20,324,360 | Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns [].
Examples (JSON args and expected result): [{"args": [[[1, 8], [20, 21], [-13, -11], [-15, -8], [16, 19], [11, 16], [16, 18], [-18, -1... | 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":[[[-15,-15],[13,16],[-13,-6],[-18,-15]]],"expected":[[-18,-15],[-13,-6],[13,16]]},{"args":[[[18,22],[-1,0]]],"expected":[[-1,0],[18,22]]},{"args":[[[2,3],[-10,-7],[-1,2],[-9,-8],[-14,-10],[9,14],[-8,-8],[16,23],[24,30],[7,9]]],"expec... |
moving-sums-b0-s08 | moving-sums | baseline | 20,324,360 | 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, 11, 6, -85, 18, -32, -51, -91, 59, 18, -42, -61, 88], 9], "expected": [-154, -147, -200, -267, -94]}, {"args": [[13, -94, 51, -34, -78, 1, 27, 59, -9... | 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":[[-10,84,60,98,76,61,-47,-71,-32],18],"expected":[]},{"args":[[-42,-2,84,37,-25,26,-86,77],-2],"expected":[]},{"args":[[-92,64,19,84,-44,91,-49],20],"expected":[]},{"args":[[],9],"... |
moving-sums-b1-s08 | moving-sums | zero-window | 20,324,360 | 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": [[1, -37, 32, -43, -61, 42, 0, -59, -89, 2], 10], "expected": [-212]}, {"args": [[22, 79, -93, -69, 100, -90, -90, -16, -51, -93, -62, 79, 36, -79], 8], "e... | 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":[[-10,84,60,98,76,61,-47,-71,-32],18],"expected":[]},{"args":[[-42,-2,84,37,-25,26,-86,77],-2],"expected":[]},{"args":[[-92,64,19,84,-44,91,-49],20],"expected":[]},{"args":[[],9],"... |
moving-sums-b2-s08 | moving-sums | window-width | 20,324,360 | 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, 5, 1, 22, -6, -12, -13, -8, -14, -9], 0], "expected": []}, {"args": [[1], 0], "expected": []}, {"args": [[15, -21, -9, -27, 14, 20, 0, -15, 3, -23, -... | 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":[[-10,84,60,98,76,61,-47,-71,-32],18],"expected":[]},{"args":[[-42,-2,84,37,-25,26,-86,77],-2],"expected":[]},{"args":[[-92,64,19,84,-44,91,-49],20],"expected":[]},{"args":[[],9],"... |
moving-sums-b3-s08 | moving-sums | missing-first-window | 20,324,360 | 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": [[35, -40, -79], 12], "expected": []}, {"args": [[-6, 12, -10, -29, -20, 12, -12, -20, -15, 7], 1], "expected": [-6, 12, -10, -29, -20, 12, -12, -20, -15, ... | 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":[[-10,84,60,98,76,61,-47,-71,-32],18],"expected":[]},{"args":[[-42,-2,84,37,-25,26,-86,77],-2],"expected":[]},{"args":[[-92,64,19,84,-44,91,-49],20],"expected":[]},{"args":[[],9],"... |
weighted-mean-b0-s08 | weighted-mean | baseline | 20,324,360 | 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, 9, 18, -42, 14, -6, 49, -34, 42, 49, 47, -47, 32, -22], [3, 0, 4, 0, 3, 0, 5, 0, 0, ... | 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":[[-45,37,38,-46,-15,-22,-19,11,-25,-37],[5,2,0,4,1,5,1,2,2,4]],"expected":-25.192307692307693},{"args":[[-33,-28,37,-44,28,-41,-16,-47],[2,2,0,4,2,1,4,3]],"expected":-27.11111111111111},{"args":[[39,16,-... |
weighted-mean-b1-s08 | weighted-mean | unweighted-numerator | 20,324,360 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[30, 37], [0, 0]], "expected": null}, {"args": [[28, 47, 19, 38, -37, -13, -13, -5, 20, -... | 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":[[-45,37,38,-46,-15,-22,-19,11,-25,-37],[5,2,0,4,1,5,1,2,2,4]],"expected":-25.192307692307693},{"args":[[-33,-28,37,-44,28,-41,-16,-47],[2,2,0,4,2,1,4,3]],"expected":-27.11111111111111},{"args":[[39,16,-... |
weighted-mean-b2-s08 | weighted-mean | wrong-denominator | 20,324,360 | 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, 28], [3, 5]], "expected": 24.25}, {"args": [[2, 10], [0, 1]], "expected": 10.0}, {"a... | 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":[[-45,37,38,-46,-15,-22,-19,11,-25,-37],[5,2,0,4,1,5,1,2,2,4]],"expected":-25.192307692307693},{"args":[[-33,-28,37,-44,28,-41,-16,-47],[2,2,0,4,2,1,4,3]],"expected":-27.11111111111111},{"args":[[39,16,-... |
weighted-mean-b3-s08 | weighted-mean | zero-weight-result | 20,324,360 | Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs).
Examples (JSON args and expected result): [{"args": [[33, -37, -7, 45, 25], [3, 4, 4, 2, 5]], "expected": 7.666666666666667}, {"args": [[-41, ... | 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":[[-45,37,38,-46,-15,-22,-19,11,-25,-37],[5,2,0,4,1,5,1,2,2,4]],"expected":-25.192307692307693},{"args":[[-33,-28,37,-44,28,-41,-16,-47],[2,2,0,4,2,1,4,3]],"expected":-27.11111111111111},{"args":[[39,16,-... |
stable-unique-b0-s08 | stable-unique | baseline | 20,324,360 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-5, 3, -9, 5, 0, -2, 0, -3, -8, 4, 9, -7, -7, -2, -1, -6, 2, -2]], "expected": [-5, 3, -9, 5, 0, -2, -3, -8, 4, 9, -7, -1, -6, 2]}, {"args": [[9, 10,... | def solve(values):
return sorted(set(values))
| train | false | 95 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[1,10,-8,6,2,2,-10,4,10,-1,7,-4,0,9,3,-3,-9,-4]],"expected":[1,10,-8,6,2,-10,4,-1,7,-4,0,9,3,-3,-9]},{"args":[[-3]],"expected":[-3]},{"args":[[-2,5,-6,-1,8,-5]],"expected":[-2,5,-6,-1,8,-5]},{"args":[[5,-4,0,0,4,-10,-5,-9,-4,-5]],"expected"... |
stable-unique-b1-s08 | stable-unique | reverse-traversal | 20,324,360 | 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": [[1, 4, 3, -2, -4, 4, -6, 6, 7, -4, -6, 0, 5, 0, -7, -3]], "expected": [1, 4, 3, -2... | 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 | 95 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[1,10,-8,6,2,2,-10,4,10,-1,7,-4,0,9,3,-3,-9,-4]],"expected":[1,10,-8,6,2,-10,4,-1,7,-4,0,9,3,-3,-9]},{"args":[[-3]],"expected":[-3]},{"args":[[-2,5,-6,-1,8,-5]],"expected":[-2,5,-6,-1,8,-5]},{"args":[[5,-4,0,0,4,-10,-5,-9,-4,-5]],"expected"... |
stable-unique-b2-s08 | stable-unique | reverse-output | 20,324,360 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[-7, -10, 0, 9, 8, -4, 10, 7, 3, -9, -5, 3, 6, 1, -9, -9, -4, 4, -3, -5, -7]], "expected": [-7, -10, 0, 9, 8, -4, 10, 7, 3, -9, -5, 6, 1, 4, -3]}, {"a... | 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 | 95 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[1,10,-8,6,2,2,-10,4,10,-1,7,-4,0,9,3,-3,-9,-4]],"expected":[1,10,-8,6,2,-10,4,-1,7,-4,0,9,3,-3,-9]},{"args":[[-3]],"expected":[-3]},{"args":[[-2,5,-6,-1,8,-5]],"expected":[-2,5,-6,-1,8,-5]},{"args":[[5,-4,0,0,4,-10,-5,-9,-4,-5]],"expected"... |
stable-unique-b3-s08 | stable-unique | wrong-seen-value | 20,324,360 | Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty.
Examples (JSON args and expected result): [{"args": [[8, 7, 9, -6, -7, 6, 10, -5, -10, 6, 7, 6]], "expected": [8, 7, 9, -6, -7, 6, 10, -5, -10]}, {"args": [[-3, -6, -3, -6, 5, 8, 4, -10, -8, 5, 9]], "exp... | 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 | 95 | [{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[1,10,-8,6,2,2,-10,4,10,-1,7,-4,0,9,3,-3,-9,-4]],"expected":[1,10,-8,6,2,-10,4,-1,7,-4,0,9,3,-3,-9]},{"args":[[-3]],"expected":[-3]},{"args":[[-2,5,-6,-1,8,-5]],"expected":[-2,5,-6,-1,8,-5]},{"args":[[5,-4,0,0,4,-10,-5,-9,-4,-5]],"expected"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.