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
run-length-b0-s08
run-length
baseline
20,324,360
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猫 猫 猫🙂猫"], "expected": [["猫", 1], ["c", 1], ["猫", 1], [" ", 1], ["猫", 1], [" ", 1], ["猫",...
def solve(text): return [[c,text.count(c)] for c in sorted(set(text))]
train
true
101
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["猫b猫ca 猫🙂 猫猫猫🙂a a🙂 🙂🙂🙂cb猫猫c"],"expected":[["猫",1],["b",1],["猫",1],["c",1],["a",1],[" ",1],["猫",1],["🙂",1],[" ",1],["猫",3],["🙂",1],["a",1],[" ",2],["a",1],["...
run-length-b1-s08
run-length
inverted-grouping
20,324,360
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": ["bbbbbbbbbbccccccccc"], "expected": [["b", 10], ["c", 9]]}, {"args": ["猫猫baca"], "expected": ...
def solve(text): out = [] for c in text: if out and out[-1][0] != c: out[-1][1] += 1 else: out.append([c,1]) return out
train
false
101
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["猫b猫ca 猫🙂 猫猫猫🙂a a🙂 🙂🙂🙂cb猫猫c"],"expected":[["猫",1],["b",1],["猫",1],["c",1],["a",1],[" ",1],["猫",1],["🙂",1],[" ",1],["猫",3],["🙂",1],["a",1],[" ",2],["a",1],["...
run-length-b2-s08
run-length
double-increment
20,324,360
Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate. Examples (JSON args and expected result): [{"args": ["猫ac aa ba猫🙂猫cab🙂ba猫🙂b"], "expected": [["猫", 1], ["a", 1], ["c", 1], [" ", 1], ["a", 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":["猫b猫ca 猫🙂 猫猫猫🙂a a🙂 🙂🙂🙂cb猫猫c"],"expected":[["猫",1],["b",1],["猫",1],["c",1],["a",1],[" ",1],["猫",1],["🙂",1],[" ",1],["猫",3],["🙂",1],["a",1],[" ",2],["a",1],["...
run-length-b3-s08
run-length
zero-initial-count
20,324,360
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🙂bbcb cb "], "expected": [["b", 2], ["🙂", 1], ["b", 2], ["c", 1], ["b", 1], [" ", 2], [...
def solve(text): out = [] for c in text: if out and out[-1][0] == c: out[-1][1] += 1 else: out.append([c,0]) return out
train
false
101
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["猫b猫ca 猫🙂 猫猫猫🙂a a🙂 🙂🙂🙂cb猫猫c"],"expected":[["猫",1],["b",1],["猫",1],["c",1],["a",1],[" ",1],["猫",1],["🙂",1],[" ",1],["猫",3],["🙂",1],["a",1],[" ",2],["a",1],["...
luhn-b0-s08
luhn
baseline
20,324,360
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": ["972885"], "expected": true}, {"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":["180695910059732"],"expected":f...
luhn-b1-s08
luhn
wrong-parity
20,324,360
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": ["898119350"], "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":["180695910059732"],"expected":f...
luhn-b2-s08
luhn
wrong-reduction
20,324,360
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": ["959971385834"], "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
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":["180695910059732"],"expected":f...
luhn-b3-s08
luhn
wrong-modulus
20,324,360
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": ["04268"], "expected": false}, {"a...
def solve(text): if not text or any(c not in '0123456789' for c in text): return False total = 0 for i,c in enumerate(reversed(text)): v = int(c) if 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":["180695910059732"],"expected":f...
edit-distance-b0-s08
edit-distance
baseline
20,324,360
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": ["bca猫cba猫da", "a"], "expected": 9}, {"args": ["", "ddb猫猫db"], "expected": 7}, {"args": ["c猫cbccbba猫猫猫", ""], "expected": 12}]
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":["猫猫猫猫b猫","猫c猫"],"expected":4},{"args":["dabaccabb","dd猫"],"expected":8},{"args":["c猫db猫ca猫","猫猫"],"expected":6},{"args":["","a猫猫猫ca"],"expected":6},{"args":["a猫aaca猫",""],"expected":7},{"args":["daddbbbdd"...
edit-distance-b1-s08
edit-distance
row-boundary
20,324,360
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猫cbb猫猫", "dcbabbdbd"], "expected": 6}, {"args": ["d猫c", "猫cc猫acda猫"], "expected": 7}, {"args": ["猫aac", "dbdcb猫bd"], "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
142
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["猫猫猫猫b猫","猫c猫"],"expected":4},{"args":["dabaccabb","dd猫"],"expected":8},{"args":["c猫db猫ca猫","猫猫"],"expected":6},{"args":["","a猫猫猫ca"],"expected":6},{"args":["a猫aaca猫",""],"expected":7},{"args":["daddbbbdd"...
edit-distance-b2-s08
edit-distance
inverted-substitution
20,324,360
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": ["cbbb猫bbb猫猫猫猫", "猫猫猫猫bbb猫bbbc"], "expected": 8}, {"args": ["猫猫猫猫b猫", "猫c猫"], "expected": 4}, {"args": ["abbcbb猫ca", ""], "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
142
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["猫猫猫猫b猫","猫c猫"],"expected":4},{"args":["dabaccabb","dd猫"],"expected":8},{"args":["c猫db猫ca猫","猫猫"],"expected":6},{"args":["","a猫猫猫ca"],"expected":6},{"args":["a猫aaca猫",""],"expected":7},{"args":["daddbbbdd"...
edit-distance-b3-s08
edit-distance
diagonal-index
20,324,360
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猫猫cca猫cdb", "猫c"], "expected": 9}, {"args": ["bbac猫", ""], "expected": 5}, {"args": ["b猫", "bacdb猫猫"], "expected": 5}]
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":["猫猫猫猫b猫","猫c猫"],"expected":4},{"args":["dabaccabb","dd猫"],"expected":8},{"args":["c猫db猫ca猫","猫猫"],"expected":6},{"args":["","a猫猫猫ca"],"expected":6},{"args":["a猫aaca猫",""],"expected":7},{"args":["daddbbbdd"...
meeting-rooms-b0-s08
meeting-rooms
baseline
20,324,360
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, 15], [8, 9], [3, 10], [11, 19], [4, 7], [8, 9]]], "expected": 3}, {"args...
def solve(intervals): return len(intervals)
train
false
116
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,15],[1,7],[8,12],[8,12],[11,13],[16,18],[2,9],[7,11],[10,14],[16,21],[0,1],[0,7],[16,18],[18,26],[4,9],[17,22],[2,5],[4,10],[9,14]]],"expected":7},{"args":[[[19,25],[17,25],[9,10],[19,22],[12,17],[...
meeting-rooms-b1-s08
meeting-rooms
tie-order
20,324,360
Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0. Examples (JSON args and expected result): [{"args": [[[-25, -17], [-24, -22], [-23, -18]]], "expected": 3}, {"args": [[[15, 17], [1...
def solve(intervals): events = [] for a,b in intervals: events.append([a,1]) events.append([b,-1]) active = best = 0 for t,d in sorted(events,key=lambda item:(item[0],-item[1])): active += d best = max(best,active) return best
train
false
116
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,15],[1,7],[8,12],[8,12],[11,13],[16,18],[2,9],[7,11],[10,14],[16,21],[0,1],[0,7],[16,18],[18,26],[4,9],[17,22],[2,5],[4,10],[9,14]]],"expected":7},{"args":[[[19,25],[17,25],[9,10],[19,22],[12,17],[...
meeting-rooms-b2-s08
meeting-rooms
peak-tracking
20,324,360
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, 17], [19, 23], [13, 20], [1, 6], [0, 1], [16, 19], [7, 9]]], "expected":...
def solve(intervals): events = [] for a,b in intervals: events.append([a,1]) events.append([b,-1]) active = best = 0 for t,d in sorted(events): active += d best = min(best,active) return best
train
false
116
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,15],[1,7],[8,12],[8,12],[11,13],[16,18],[2,9],[7,11],[10,14],[16,21],[0,1],[0,7],[16,18],[18,26],[4,9],[17,22],[2,5],[4,10],[9,14]]],"expected":7},{"args":[[[19,25],[17,25],[9,10],[19,22],[12,17],[...
meeting-rooms-b3-s08
meeting-rooms
end-event-sign
20,324,360
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, 10], [5, 6], [9, 11], [12, 14], [12, 17], [5, 13]]], "expected": 3}, {"ar...
def solve(intervals): events = [] for a,b in intervals: events.append([a,1]) events.append([b,1]) active = best = 0 for t,d in sorted(events): active += d best = max(best,active) return best
train
false
116
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,15],[1,7],[8,12],[8,12],[11,13],[16,18],[2,9],[7,11],[10,14],[16,21],[0,1],[0,7],[16,18],[18,26],[4,9],[17,22],[2,5],[4,10],[9,14]]],"expected":7},{"args":[[[19,25],[17,25],[9,10],[19,22],[12,17],[...
nearest-percentile-b0-s08
nearest-percentile
baseline
20,324,360
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": [[-99, 45, 68, 50, 91, 71, -41, -97, -70, 35, 42, -4, -26, -22], 0], "expected": -99}, {"args": [[-61, ...
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":[[-18,22,42,48,-82,49],50],"expected":22},{"args":[[-25,14,-52,-11,14,81,92,-19,-73,-49,39,-29,-50,-11],100],"expected":92},{"args":[[-46,72,-56,92,-44,56,-92,36,-70,4,-99,1...
nearest-percentile-b1-s08
nearest-percentile
floor-not-ceiling
20,324,360
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": [[-48, -8, -12, -19], 100], "expected": -8}, {"args": [[3, -50, 52, -28, 10, -51, -50, -68, -73, -90, -...
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":[[-18,22,42,48,-82,49],50],"expected":22},{"args":[[-25,14,-52,-11,14,81,92,-19,-73,-49,39,-29,-50,-11],100],"expected":92},{"args":[[-46,72,-56,92,-44,56,-92,36,-70,4,-99,1...
nearest-percentile-b2-s08
nearest-percentile
rank-index
20,324,360
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": [[-30, -18, -26, -22, -31, -20, -16, -23, -32, -17, -24, -29, -19, -28, -21, -25, -27], 33], "expected"...
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":[[-18,22,42,48,-82,49],50],"expected":22},{"args":[[-25,14,-52,-11,14,81,92,-19,-73,-49,39,-29,-50,-11],100],"expected":92},{"args":[[-46,72,-56,92,-44,56,-92,36,-70,4,-99,1...
nearest-percentile-b3-s08
nearest-percentile
descending-order
20,324,360
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": [[96, -70, 74, -11, 89, -82, -1, 13, -41, 60, 36, 44, -47, 57], 0], "expected": -82}, {"args": [[-27, -...
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":[[-18,22,42,48,-82,49],50],"expected":22},{"args":[[-25,14,-52,-11,14,81,92,-19,-73,-49,39,-29,-50,-11],100],"expected":92},{"args":[[-46,72,-56,92,-44,56,-92,36,-70,4,-99,1...
fifo-inventory-b0-s08
fifo-inventory
baseline
20,324,360
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,426],[2,345],[0,231],[7,905],[5,565],[0,827],[4,916],[3,587]],33],"expected":null},{"args":[[[2,116],[2,287],[6,858],[7,230],[2,5...
fifo-inventory-b1-s08
fifo-inventory
zero-lot-retention
20,324,360
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,426],[2,345],[0,231],[7,905],[5,565],[0,827],[4,916],[3,587]],33],"expected":null},{"args":[[[2,116],[2,287],[6,858],[7,230],[2,5...
fifo-inventory-b2-s08
fifo-inventory
over-consumption
20,324,360
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,426],[2,345],[0,231],[7,905],[5,565],[0,827],[4,916],[3,587]],33],"expected":null},{"args":[[[2,116],[2,287],[6,858],[7,230],[2,5...
fifo-inventory-b3-s08
fifo-inventory
unit-cost-not-quantity
20,324,360
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
true
124
[{"args":[[],0],"expected":[0,[]]},{"args":[[],1],"expected":null},{"args":[[[2,100],[3,200]],3],"expected":[400,[[2,200]]]},{"args":[[[0,50],[2,80]],0],"expected":[0,[[2,80]]]},{"args":[[[4,426],[2,345],[0,231],[7,905],[5,565],[0,827],[4,916],[3,587]],33],"expected":null},{"args":[[[2,116],[2,287],[6,858],[7,230],[2,5...
csv-row-b0-s08
csv-row
baseline
20,324,360
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": ["\",aa \"\"\",\"b \"\"ab,\",\"a b \"\"猫 \""],...
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":["\"\"\"bb ba\",,\",猫 a\"\",\""],"expected":["\"bb ba","",",猫 a\","]},{"a...
csv-row-b1-s08
csv-row
quoted-comma
20,324,360
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 \",bba,,\"b 猫bb\"\"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
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":["\"\"\"bb ba\",,\",猫 a\"\",\""],"expected":["\"bb ba","",",猫 a\","]},{"a...
csv-row-b2-s08
csv-row
escaped-quote
20,324,360
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": ["\"x9,y\",z"], "expected": ["x9,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":["\"\"\"bb ba\",,\",猫 a\"\",\""],"expected":["\"bb ba","",",猫 a\","]},{"a...
csv-row-b3-s08
csv-row
lost-final-field
20,324,360
Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports. Examples (JSON args and expected result): [{"args": ["\"b猫猫,\""], "expected": ["b猫猫,"]}, {"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
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":["\"\"\"bb ba\",,\",猫 a\"\",\""],"expected":["\"bb ba","",",猫 a\","]},{"a...
shortest-path-b0-s08
shortest-path
baseline
20,324,360
Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges. Examples (JSON args and expected result): [{"args": [{"0": [], "1": [], "2...
def solve(graph,start,target): return 0 if start == target else None
train
false
100
[{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",4]],"1":[["0",2],["2",7]],"2":[["4",5]],"3":[["0",0],["1",9],["2",3]],"4":[["0",7]]},"0","4"],"expected":16},{"args":[{"0":[["1",5],["2",8],["3",1],["5",3]]...
shortest-path-b1-s08
shortest-path
farthest-first
20,324,360
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", 102], ["...
def solve(graph,start,target): dist = {start:0} visited = set() while True: candidates = [n for n in dist if n not in visited] if not candidates: return None n = max(candidates,key=lambda x:dist[x]) if n == target: return dist[n] visited.add(n) for nxt,w in gr...
train
false
100
[{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",4]],"1":[["0",2],["2",7]],"2":[["4",5]],"3":[["0",0],["1",9],["2",3]],"4":[["0",7]]},"0","4"],"expected":16},{"args":[{"0":[["1",5],["2",8],["3",1],["5",3]]...
shortest-path-b2-s08
shortest-path
lost-path-prefix
20,324,360
Implement solve(graph,start,target). graph maps string nodes to lists of [neighbor,nonnegative_integer_weight] directed edges. Return shortest distance, or None if unreachable. start==target returns 0. Nodes without a key have no outgoing edges. Examples (JSON args and expected result): [{"args": [{"0": [["1", 2], ["4"...
def solve(graph,start,target): dist = {start:0} visited = set() while True: candidates = [n for n in dist if n not in visited] if not candidates: return None n = min(candidates,key=lambda x:dist[x]) if n == target: return dist[n] visited.add(n) for nxt,w in gr...
train
false
100
[{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",4]],"1":[["0",2],["2",7]],"2":[["4",5]],"3":[["0",0],["1",9],["2",3]],"4":[["0",7]]},"0","4"],"expected":16},{"args":[{"0":[["1",5],["2",8],["3",1],["5",3]]...
shortest-path-b3-s08
shortest-path
missing-relaxation
20,324,360
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], ["2"...
def solve(graph,start,target): dist = {start:0} visited = set() while True: candidates = [n for n in dist if n not in visited] if not candidates: return None n = min(candidates,key=lambda x:dist[x]) if n == target: return dist[n] visited.add(n) for nxt,w in gr...
train
false
100
[{"args":[{},"a","a"],"expected":0},{"args":[{},"a","b"],"expected":null},{"args":[{"a":[["b",5],["c",1]],"c":[["b",1]]},"a","b"],"expected":2},{"args":[{"0":[["1",4]],"1":[["0",2],["2",7]],"2":[["4",5]],"3":[["0",0],["1",9],["2",3]],"4":[["0",7]]},"0","4"],"expected":16},{"args":[{"0":[["1",5],["2",8],["3",1],["5",3]]...
merge-intervals-b0-s09
merge-intervals
baseline
20,332,279
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, 37], [30, 31]]], "expected": [[29, 37]]}, {"args": [[[7, 9]]], "expected":...
def solve(intervals): return sorted(intervals)
train
false
108
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-6,-4],[13,15],[4,6],[-4,-4],[-15,-11],[15,15],[22,23],[20,26],[-4,-1],[-10,-8],[-19,-12],[14,21],[-15,-10]]],"expected":[[-19,-8],[-6,-1],[4,6],[13,26]]},{"args":[[[6,8],[-15,-13],[-18,-15],[24,29],[26,29],[7,10],[1,3],[21,24]]],...
merge-intervals-b1-s09
merge-intervals
touching-boundary
20,332,279
Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns []. Examples (JSON args and expected result): [{"args": [[[27, 35], [28, 29]]], "expected": [[27, 35]]}, {"args": [[[-11, -5], [-9, -2], ...
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":[[[-6,-4],[13,15],[4,6],[-4,-4],[-15,-11],[15,15],[22,23],[20,26],[-4,-1],[-10,-8],[-19,-12],[14,21],[-15,-10]]],"expected":[[-19,-8],[-6,-1],[4,6],[13,26]]},{"args":[[[6,8],[-15,-13],[-18,-15],[24,29],[26,29],[7,10],[1,3],[21,24]]],...
merge-intervals-b2-s09
merge-intervals
nested-endpoint
20,332,279
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, 19], [4, 11], [2, 9], [-11, -4], [-1, 5], [5, 6], [-7, -5], [-12, -9], [7,...
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":[[[-6,-4],[13,15],[4,6],[-4,-4],[-15,-11],[15,15],[22,23],[20,26],[-4,-1],[-10,-8],[-19,-12],[14,21],[-15,-10]]],"expected":[[-19,-8],[-6,-1],[4,6],[13,26]]},{"args":[[[6,8],[-15,-13],[-18,-15],[24,29],[26,29],[7,10],[1,3],[21,24]]],...
merge-intervals-b3-s09
merge-intervals
unsorted-input
20,332,279
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": [[[-25, -17], [-24, -23]]], "expected": [[-25, -17]]}, {"args": [[[-20, -17], [-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":[[[-6,-4],[13,15],[4,6],[-4,-4],[-15,-11],[15,15],[22,23],[20,26],[-4,-1],[-10,-8],[-19,-12],[14,21],[-15,-10]]],"expected":[[-19,-8],[-6,-1],[4,6],[13,26]]},{"args":[[[6,8],[-15,-13],[-18,-15],[24,29],[26,29],[7,10],[1,3],[21,24]]],...
moving-sums-b0-s09
moving-sums
baseline
20,332,279
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": [[19, 3, -21, -92, -3, -24, 38, 23, -58, -50, -84, -88, -57, -40, 99, -14, -65], 9], "expected": [-115, -184, -271, -338, -303, -340, -217, -269, -357]}, {...
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":[[98,-30,-44,6,-12,29,-53,21,14,-10],9],"expected":[29,-79]},{"args":[[51,42,99,96,-85,77,50,-56,45],9],"expected":[319]},{"args":[[-88,-81,55,67,-62,-76,30,48,28,-97,-97,29,-32],-...
moving-sums-b1-s09
moving-sums
zero-window
20,332,279
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": [[-19, 25, 22, 3], 2], "expected": [6, 47, 25]}, {"args": [[-6, 26, 4, -20, -30], 2], "expected": [20, 30, -16, -50]}, {"args": [[-29, -33, -10], 18], "exp...
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":[[98,-30,-44,6,-12,29,-53,21,14,-10],9],"expected":[29,-79]},{"args":[[51,42,99,96,-85,77,50,-56,45],9],"expected":[319]},{"args":[[-88,-81,55,67,-62,-76,30,48,28,-97,-97,29,-32],-...
moving-sums-b2-s09
moving-sums
window-width
20,332,279
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, 1, 1, 65, -5, 76, 53, -49, 79, -8], 10], "expected": [212]}, {"args": [[4, 5, 29, 17, 17, 19, 13, 1, 12, -12], 0], "expected": []}, {"args": [[-19, -...
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":[[98,-30,-44,6,-12,29,-53,21,14,-10],9],"expected":[29,-79]},{"args":[[51,42,99,96,-85,77,50,-56,45],9],"expected":[319]},{"args":[[-88,-81,55,67,-62,-76,30,48,28,-97,-97,29,-32],-...
moving-sums-b3-s09
moving-sums
missing-first-window
20,332,279
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, 64, 64, -21, 83, 44, 39, 15, 63, 25, 92, -94, 93, 85, -71, 25, -52], 20], "expected": []}, {"args": [[42, -51, -23, -39, -51, 64, -87, -19, -81, -13...
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":[[98,-30,-44,6,-12,29,-53,21,14,-10],9],"expected":[29,-79]},{"args":[[51,42,99,96,-85,77,50,-56,45],9],"expected":[319]},{"args":[[-88,-81,55,67,-62,-76,30,48,28,-97,-97,29,-32],-...
weighted-mean-b0-s09
weighted-mean
baseline
20,332,279
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, -13], [0, 0]], "expected": null}, {"args": [[9, -11, 39, -12, 48, -30, 49, -34, 40,...
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":[[37,-45],[2,0]],"expected":37.0},{"args":[[25,-35,7,48,32,-24],[4,3,2,2,5,1]],"expected":14.176470588235293},{"args":[[45,-22,15,-17,13,27,8,33,-20,-38,-11],[5,4,4,5,4,4,3,3,1,4,4]],"expected":4.3658536...
weighted-mean-b1-s09
weighted-mean
unweighted-numerator
20,332,279
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": [[11], [0]], "expected": null}, {"args": [[39, -14, -41, 2, 43, 30, 29, -1, 36, 0, 50, 0, ...
def solve(values,weights): total = sum(weights) return sum(x for x,w in zip(values,weights))/total if total else None
train
true
121
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[37,-45],[2,0]],"expected":37.0},{"args":[[25,-35,7,48,32,-24],[4,3,2,2,5,1]],"expected":14.176470588235293},{"args":[[45,-22,15,-17,13,27,8,33,-20,-38,-11],[5,4,4,5,4,4,3,3,1,4,4]],"expected":4.3658536...
weighted-mean-b2-s09
weighted-mean
wrong-denominator
20,332,279
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": [[-44], [2]], "expected": -44.0}, {"args": [[-10, -3], [1, 5]], "expected": -4.16666666666...
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":[[37,-45],[2,0]],"expected":37.0},{"args":[[25,-35,7,48,32,-24],[4,3,2,2,5,1]],"expected":14.176470588235293},{"args":[[45,-22,15,-17,13,27,8,33,-20,-38,-11],[5,4,4,5,4,4,3,3,1,4,4]],"expected":4.3658536...
weighted-mean-b3-s09
weighted-mean
zero-weight-result
20,332,279
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, 31, 11, -7, -14, 40, -41, -46, -16, 41, 24], [2, 3, 1, 4, 1, 1, 2, 2, 5, 2, 0]], "ex...
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":[[37,-45],[2,0]],"expected":37.0},{"args":[[25,-35,7,48,32,-24],[4,3,2,2,5,1]],"expected":14.176470588235293},{"args":[[45,-22,15,-17,13,27,8,33,-20,-38,-11],[5,4,4,5,4,4,3,3,1,4,4]],"expected":4.3658536...
stable-unique-b0-s09
stable-unique
baseline
20,332,279
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[7, -4, -10, 10, 7, 1, 2, 1, -5, 8, 8, 9, 3, -9]], "expected": [7, -4, -10, 10, 1, 2, -5, 8, 9, 3, -9]}, {"args": [[-8, -6, -3, -6, -5, 0, -9, -4, -3,...
def solve(values): return sorted(set(values))
train
false
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-10,2,-1,1,-7,-9,6,6,-4,-7,-9,4,1,-5,5,0,1,6]],"expected":[-10,2,-1,1,-7,-9,6,-4,4,-5,5,0]},{"args":[[-9,-10,-9,-1,-7,8,-10,7,-10,-1,6,-6,-5,-9,-1,-6,-2,10,5,3,1,6,7,6]],"expected":[-9,-10,-1,-7,8,7,6,-6,-5,-2,10,5,3,1]},{"args":[[0,-2,-8,...
stable-unique-b1-s09
stable-unique
reverse-traversal
20,332,279
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[7, -5, 2]], "expected": [7, -5, 2]}, {"args": [[-8, -2, 5, 2, -3, -2, -9, 7, -6, 8, 2, -10, -2, 10, 0, -6]], "expected": [-8, -2, 5, 2, -3, -9, 7, -6...
def solve(values): seen = set() out = [] for x in reversed(values): if x not in seen: seen.add(x) out.append(x) return out
train
false
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-10,2,-1,1,-7,-9,6,6,-4,-7,-9,4,1,-5,5,0,1,6]],"expected":[-10,2,-1,1,-7,-9,6,-4,4,-5,5,0]},{"args":[[-9,-10,-9,-1,-7,8,-10,7,-10,-1,6,-6,-5,-9,-1,-6,-2,10,5,3,1,6,7,6]],"expected":[-9,-10,-1,-7,8,7,6,-6,-5,-2,10,5,3,1]},{"args":[[0,-2,-8,...
stable-unique-b2-s09
stable-unique
reverse-output
20,332,279
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-8, 2, 1, -4, -4, 1, 4, -9, 9, -4, 2, 2, -2, 6, 3, 9, 0]], "expected": [-8, 2, 1, -4, 4, -9, 9, -2, 6, 3, 0]}, {"args": [[13, 11, 13, 12, 11]], "expe...
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":[[-10,2,-1,1,-7,-9,6,6,-4,-7,-9,4,1,-5,5,0,1,6]],"expected":[-10,2,-1,1,-7,-9,6,-4,4,-5,5,0]},{"args":[[-9,-10,-9,-1,-7,8,-10,7,-10,-1,6,-6,-5,-9,-1,-6,-2,10,5,3,1,6,7,6]],"expected":[-9,-10,-1,-7,8,7,6,-6,-5,-2,10,5,3,1]},{"args":[[0,-2,-8,...
stable-unique-b3-s09
stable-unique
wrong-seen-value
20,332,279
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-7, -10, -7, 8, -4, 2, 2, -8]], "expected": [-7, -10, 8, -4, 2, -8]}, {"args": [[-10, -7, 8, 5, -2, 10, -3, -1, 6, 6, 3, -8, -1]], "expected": [-10, ...
def solve(values): seen = set() out = [] for x in values: if x not in seen: seen.add(-x) out.append(x) return out
train
false
98
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[-10,2,-1,1,-7,-9,6,6,-4,-7,-9,4,1,-5,5,0,1,6]],"expected":[-10,2,-1,1,-7,-9,6,-4,4,-5,5,0]},{"args":[[-9,-10,-9,-1,-7,8,-10,7,-10,-1,6,-6,-5,-9,-1,-6,-2,10,5,3,1,6,7,6]],"expected":[-9,-10,-1,-7,8,7,6,-6,-5,-2,10,5,3,1]},{"args":[[0,-2,-8,...
run-length-b0-s09
run-length
baseline
20,332,279
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": ["猫bc🙂 "], "expected": [["猫", 1], ["b", 1], ["c", 1], ["🙂", 1], [" ", 2]]}, {"args": ["b猫🙂...
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":["cabc c猫🙂aac猫 a猫"],"expected":[["c",1],["a",1],["b",1],["c",1],[" ",1],["c",1],["猫",1],["🙂",1],["a",2],["c",1],["猫",1],[" ",2],["a",1],["猫",1]]},{"args":["b猫 aa"],...
run-length-b1-s09
run-length
inverted-grouping
20,332,279
Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate. Examples (JSON args and expected result): [{"args": [" c猫猫c猫cc猫caa🙂acb🙂猫b abb"], "expected": [[" ", 2], ["c", 1], ["猫", 2], ["c", 1], ["猫", 1],...
def solve(text): out = [] for c in text: if out and out[-1][0] != c: out[-1][1] += 1 else: out.append([c,1]) return out
train
false
102
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["cabc c猫🙂aac猫 a猫"],"expected":[["c",1],["a",1],["b",1],["c",1],[" ",1],["c",1],["猫",1],["🙂",1],["a",2],["c",1],["猫",1],[" ",2],["a",1],["猫",1]]},{"args":["b猫 aa"],...
run-length-b2-s09
run-length
double-increment
20,332,279
Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate. Examples (JSON args and expected result): [{"args": [" 🙂c 猫🙂🙂猫c🙂c猫c猫b🙂c猫猫aa"], "expected": [[" ", 1], ["🙂", 1], ["c", 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
102
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["cabc c猫🙂aac猫 a猫"],"expected":[["c",1],["a",1],["b",1],["c",1],[" ",1],["c",1],["猫",1],["🙂",1],["a",2],["c",1],["猫",1],[" ",2],["a",1],["猫",1]]},{"args":["b猫 aa"],...
run-length-b3-s09
run-length
zero-initial-count
20,332,279
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 猫cbbca🙂a🙂🙂cb猫cc猫bcbbc猫"], "expected": [["猫", 1], ["🙂", 3], ["c", 1], [" ", 2],...
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":["cabc c猫🙂aac猫 a猫"],"expected":[["c",1],["a",1],["b",1],["c",1],[" ",1],["c",1],["猫",1],["🙂",1],["a",2],["c",1],["猫",1],[" ",2],["a",1],["猫",1]]},{"args":["b猫 aa"],...
luhn-b0-s09
luhn
baseline
20,332,279
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": ["49731198948"], "expected": true}...
def solve(text): return bool(text) and text.isdigit() and sum(int(c) for c in text)%10 == 0
train
false
186
[{"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":["70266017671614"],"expected":fa...
luhn-b1-s09
luhn
wrong-parity
20,332,279
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": ["187250147"], "expected": true}, ...
def solve(text): if not text or any(c not in '0123456789' for c in text): return False total = 0 for i,c in enumerate(reversed(text)): v = int(c) if not i%2: v *= 2 if v > 9: v -= 9 total += v return total%10 == 0
train
false
186
[{"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":["70266017671614"],"expected":fa...
luhn-b2-s09
luhn
wrong-reduction
20,332,279
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": ["69517220355284"], "expected": tr...
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
186
[{"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":["70266017671614"],"expected":fa...
luhn-b3-s09
luhn
wrong-modulus
20,332,279
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": ["722587392"], "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
186
[{"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":["70266017671614"],"expected":fa...
edit-distance-b0-s09
edit-distance
baseline
20,332,279
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": ["aaa", "dbcbcb猫db"], "expected": 9}, {"args": ["aacc", "ccaa"], "expected": 4}, {"args": ["cb猫猫babccac", "cb猫猫babccac"], "expected": 0...
def solve(a,b): return abs(len(a)-len(b))
train
false
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["db猫猫猫猫猫b",""],"expected":8},{"args":["a猫","ba猫ab"],"expected":3},{"args":["猫b","a"],"expected":2},{"args":["cd","猫cbbdabc猫"],"expected":7},{"args":["cabca猫add","b猫bbc"],"expected":7},{"args":["bad猫d猫bda",...
edit-distance-b1-s09
edit-distance
row-boundary
20,332,279
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": ["猫猫猫cac", "cac猫猫猫"], "expected": 6}, {"args": ["cb猫猫babccac", "caccbab猫猫bc"], "expected": 6}, {"args": ["ab猫d", ""], "expected": 4}]
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
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["db猫猫猫猫猫b",""],"expected":8},{"args":["a猫","ba猫ab"],"expected":3},{"args":["猫b","a"],"expected":2},{"args":["cd","猫cbbdabc猫"],"expected":7},{"args":["cabca猫add","b猫bbc"],"expected":7},{"args":["bad猫d猫bda",...
edit-distance-b2-s09
edit-distance
inverted-substitution
20,332,279
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": ["ccb猫bcd猫b", "abb猫"], "expected": 6}, {"args": ["aacc", ""], "expected": 4}, {"args": ["b猫cc猫a", ""], "expected": 6}]
def solve(a,b): row = list(range(len(b)+1)) for i,x in enumerate(a,1): nxt = [i] for j,y in enumerate(b,1): nxt.append(min(nxt[-1]+1,row[j]+1,row[j-1]+(x == y))) row = nxt return row[-1]
train
false
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["db猫猫猫猫猫b",""],"expected":8},{"args":["a猫","ba猫ab"],"expected":3},{"args":["猫b","a"],"expected":2},{"args":["cd","猫cbbdabc猫"],"expected":7},{"args":["cabca猫add","b猫bbc"],"expected":7},{"args":["bad猫d猫bda",...
edit-distance-b3-s09
edit-distance
diagonal-index
20,332,279
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": ["aaaa", "猫c猫"], "expected": 4}, {"args": ["", "aadd"], "expected": 4}, {"args": ["bac猫猫cc", "bac猫猫cc"], "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]+(x != y))) row = nxt return row[-1]
train
false
140
[{"args":["",""],"expected":0},{"args":["kitten","sitting"],"expected":3},{"args":["猫","狗"],"expected":1},{"args":["db猫猫猫猫猫b",""],"expected":8},{"args":["a猫","ba猫ab"],"expected":3},{"args":["猫b","a"],"expected":2},{"args":["cd","猫cbbdabc猫"],"expected":7},{"args":["cabca猫add","b猫bbc"],"expected":7},{"args":["bad猫d猫bda",...
meeting-rooms-b0-s09
meeting-rooms
baseline
20,332,279
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": [[[13, 18], [7, 8], [19, ...
def solve(intervals): return len(intervals)
train
false
106
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,14],[4,8],[16,22],[2,9],[16,23],[5,10]]],"expected":3},{"args":[[[14,18],[19,21]]],"expected":1},{"args":[[[15,16],[3,9],[5,9],[8,15],[12,20],[2,9],[1,4],[4,8],[15,19],[6,8],[10,13],[9,16],[1,6],[1...
meeting-rooms-b1-s09
meeting-rooms
tie-order
20,332,279
Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0. Examples (JSON args and expected result): [{"args": [[[17, 24], [8, 14]]], "expected": 1}, {"args": [[[14, 21], [9, 13]]], "expecte...
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
106
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,14],[4,8],[16,22],[2,9],[16,23],[5,10]]],"expected":3},{"args":[[[14,18],[19,21]]],"expected":1},{"args":[[[15,16],[3,9],[5,9],[8,15],[12,20],[2,9],[1,4],[4,8],[15,19],[6,8],[10,13],[9,16],[1,6],[1...
meeting-rooms-b2-s09
meeting-rooms
peak-tracking
20,332,279
Implement solve(intervals). Return minimum rooms for positive-length half-open meetings [start,end). A meeting ending at time t frees its room for one starting at t. Empty input returns 0. Examples (JSON args and expected result): [{"args": [[[19, 20], [15, 16], [0, 7], [13, 19], [2, 4], [19, 26], [1, 3], [5, 8], [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
106
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,14],[4,8],[16,22],[2,9],[16,23],[5,10]]],"expected":3},{"args":[[[14,18],[19,21]]],"expected":1},{"args":[[[15,16],[3,9],[5,9],[8,15],[12,20],[2,9],[1,4],[4,8],[15,19],[6,8],[10,13],[9,16],[1,6],[1...
meeting-rooms-b3-s09
meeting-rooms
end-event-sign
20,332,279
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, 12], [3, 11], [0, 1], [4, 5], [0, 7], [3, 7], [7, 15], [2, 4], [4, 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 = max(best,active) return best
train
false
106
[{"args":[[]],"expected":0},{"args":[[[0,1],[1,2]]],"expected":1},{"args":[[[0,5],[1,3],[2,4]]],"expected":3},{"args":[[[8,14],[4,8],[16,22],[2,9],[16,23],[5,10]]],"expected":3},{"args":[[[14,18],[19,21]]],"expected":1},{"args":[[[15,16],[3,9],[5,9],[8,15],[12,20],[2,9],[1,4],[4,8],[15,19],[6,8],[10,13],[9,16],[1,6],[1...
nearest-percentile-b0-s09
nearest-percentile
baseline
20,332,279
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": [[86, -51, -90, 49, -35, -49, -92, -76, 95, -25, -72, 17, -50, -31, 35, 7, 93, -71, -46, 47, 70, -41, -...
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":[[-47,92,66,52,26,87,59,97,42,-5,74,-94,-32,-21,64,-40,-23,-21],50],"expected":26},{"args":[[38,-37,-61,-91],100],"expected":38},{"args":[[-94,-36,63,75,-1,75,-35,100,62,-61...
nearest-percentile-b1-s09
nearest-percentile
floor-not-ceiling
20,332,279
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": [[-8, -2, 6, 3, -7, -4, 0, -1, 4, 1, 7, 2, 8, -6, 5, -3, -5], 50], "expected": 0}, {"args": [[3, 2, -1,...
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":[[-47,92,66,52,26,87,59,97,42,-5,74,-94,-32,-21,64,-40,-23,-21],50],"expected":26},{"args":[[38,-37,-61,-91],100],"expected":38},{"args":[[-94,-36,63,75,-1,75,-35,100,62,-61...
nearest-percentile-b2-s09
nearest-percentile
rank-index
20,332,279
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": [[100, -21, 46, -61, -40, -6, 35, 31, -75, 14, -80, -82, -4, -35], 50], "expected": -21}, {"args": [[-8...
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":[[-47,92,66,52,26,87,59,97,42,-5,74,-94,-32,-21,64,-40,-23,-21],50],"expected":26},{"args":[[38,-37,-61,-91],100],"expected":38},{"args":[[-94,-36,63,75,-1,75,-35,100,62,-61...
nearest-percentile-b3-s09
nearest-percentile
descending-order
20,332,279
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": [[1, -65, -13, 68, 58, -45, 92, 4, -65, 22], 100], "expected": 92}, {"args": [[53, 46, 23, -56, -41, 11...
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":[[-47,92,66,52,26,87,59,97,42,-5,74,-94,-32,-21,64,-40,-23,-21],50],"expected":26},{"args":[[38,-37,-61,-91],100],"expected":38},{"args":[[-94,-36,63,75,-1,75,-35,100,62,-61...
fifo-inventory-b0-s09
fifo-inventory
baseline
20,332,279
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,955],[7,25]],19],"expected":null},{"args":[[[3,266],[0,786],[2,573],[1,195],[5,63],[0,544],[2,121]],33],"expected":null},{"args":...
fifo-inventory-b1-s09
fifo-inventory
zero-lot-retention
20,332,279
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,955],[7,25]],19],"expected":null},{"args":[[[3,266],[0,786],[2,573],[1,195],[5,63],[0,544],[2,121]],33],"expected":null},{"args":...
fifo-inventory-b2-s09
fifo-inventory
over-consumption
20,332,279
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,955],[7,25]],19],"expected":null},{"args":[[[3,266],[0,786],[2,573],[1,195],[5,63],[0,544],[2,121]],33],"expected":null},{"args":...
fifo-inventory-b3-s09
fifo-inventory
unit-cost-not-quantity
20,332,279
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,955],[7,25]],19],"expected":null},{"args":[[[3,266],[0,786],[2,573],[1,195],[5,63],[0,544],[2,121]],33],"expected":null},{"args":...
csv-row-b0-s09
csv-row
baseline
20,332,279
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": ["猫,\" \"\"猫\"\"猫\",bb ,\"b,猫b 猫 猫 \", 猫 bb猫,...
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":[" ,\"b,,,猫b\"\"a\""],"expected":[" ","b,,,猫b\"a"]},{"args":["\"b 猫 ,\",\...
csv-row-b1-s09
csv-row
quoted-comma
20,332,279
Implement solve(row). Parse one valid CSV record into strings, comma delimiter, double-quote quoting, and doubled quotes inside quoted fields. No embedded newlines. Empty row means []. Do not trim spaces. Use no imports. Examples (JSON args and expected result): [{"args": ["\"x6\"\"y\",z"], "expected": ["x6\"y", "z"]},...
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":[" ,\"b,,,猫b\"\"a\""],"expected":[" ","b,,,猫b\"a"]},{"args":["\"b 猫 ,\",\...
csv-row-b2-s09
csv-row
escaped-quote
20,332,279
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\""], "expected": ["猫\" \"猫ba...
def solve(row): if not row: return [] out = [] field = '' quoted = False i = 0 while i < len(row): c = row[i] if c == '"': if quoted and i+1 < len(row) and row[i+1] == '"': field += '""' i += 1 else: quoted = not quoted ...
train
false
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":[" ,\"b,,,猫b\"\"a\""],"expected":[" ","b,,,猫b\"a"]},{"args":["\"b 猫 ,\",\...
csv-row-b3-s09
csv-row
lost-final-field
20,332,279
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": ["\"aa\"\"ba,\"\"b猫,b\",猫bb,\"猫 , 猫 猫b猫\",\",,\...
def solve(row): if not row: return [] out = [] field = '' quoted = False i = 0 while i < len(row): c = row[i] if c == '"': if quoted and i+1 < len(row) and row[i+1] == '"': field += '"' i += 1 else: quoted = not quoted ...
train
false
146
[{"args":[""],"expected":[]},{"args":["a,b"],"expected":["a","b"]},{"args":["\"a,b\",c"],"expected":["a,b","c"]},{"args":["\"a\"\"b\",,c"],"expected":["a\"b","","c"]},{"args":[",,"],"expected":["","",""]},{"args":["\"\""],"expected":[""]},{"args":[" ,\"b,,,猫b\"\"a\""],"expected":[" ","b,,,猫b\"a"]},{"args":["\"b 猫 ,\",\...
shortest-path-b0-s09
shortest-path
baseline
20,332,279
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", 6]], "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":[["1",4]],"3":[["1",3],["4",1]],"4":[["2",7]]},"0","4"],"expected":null},{"args":[{"0":[],"1":[["3",8]],"2":[["1",0]],"3":[["2",0]],"4":[]},"0","4"]...
shortest-path-b1-s09
shortest-path
farthest-first
20,332,279
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], ["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
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":[["1",4]],"3":[["1",3],["4",1]],"4":[["2",7]]},"0","4"],"expected":null},{"args":[{"0":[],"1":[["3",8]],"2":[["1",0]],"3":[["2",0]],"4":[]},"0","4"]...
shortest-path-b2-s09
shortest-path
lost-path-prefix
20,332,279
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": [["0",...
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":[["1",4]],"3":[["1",3],["4",1]],"4":[["2",7]]},"0","4"],"expected":null},{"args":[{"0":[],"1":[["3",8]],"2":[["1",0]],"3":[["2",0]],"4":[]},"0","4"]...
shortest-path-b3-s09
shortest-path
missing-relaxation
20,332,279
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": [["4", 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
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":[["1",4]],"3":[["1",3],["4",1]],"4":[["2",7]]},"0","4"],"expected":null},{"args":[{"0":[],"1":[["3",8]],"2":[["1",0]],"3":[["2",0]],"4":[]},"0","4"]...
merge-intervals-b0-s10
merge-intervals
baseline
20,340,198
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": [[[23, 27], [-17, -11]]], "expected": [[-17, -11], [23, 27]]}, {"args": [[[42, 47...
def solve(intervals): return sorted(intervals)
train
false
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-11,-5],[-20,-14],[12,16],[7,13]]],"expected":[[-20,-14],[-11,-5],[7,16]]},{"args":[[[10,17],[22,22],[26,31],[3,4],[3,6],[19,26],[29,31],[19,24],[25,26],[-16,-13],[28,31],[15,16],[-19,-12],[18,18]]],"expected":[[-19,-12],[3,6],[10...
merge-intervals-b1-s10
merge-intervals
touching-boundary
20,340,198
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, 27], [-11, -6], [-11, -9], [-12, -10], [-1, -1]]], "expected": [[-12, -6],...
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,-5],[-20,-14],[12,16],[7,13]]],"expected":[[-20,-14],[-11,-5],[7,16]]},{"args":[[[10,17],[22,22],[26,31],[3,4],[3,6],[19,26],[29,31],[19,24],[25,26],[-16,-13],[28,31],[15,16],[-19,-12],[18,18]]],"expected":[[-19,-12],[3,6],[10...
merge-intervals-b2-s10
merge-intervals
nested-endpoint
20,340,198
Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns []. Examples (JSON args and expected result): [{"args": [[[-37, -29], [-36, -35]]], "expected": [[-37, -29]]}, {"args": [[[23, 26]]], "ex...
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
true
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-11,-5],[-20,-14],[12,16],[7,13]]],"expected":[[-20,-14],[-11,-5],[7,16]]},{"args":[[[10,17],[22,22],[26,31],[3,4],[3,6],[19,26],[29,31],[19,24],[25,26],[-16,-13],[28,31],[15,16],[-19,-12],[18,18]]],"expected":[[-19,-12],[3,6],[10...
merge-intervals-b3-s10
merge-intervals
unsorted-input
20,340,198
Implement solve(intervals). Merge closed intervals that overlap or touch, sort by start, and return lists [start,end]. Inputs may be unsorted; do not mutate them. Empty input returns []. Examples (JSON args and expected result): [{"args": [[[15, 17], [-10, -10], [-1, 0], [-16, -14], [19, 25], [-10, -8], [-1, 5], [9, 10...
def solve(intervals): out = [] for a,b in intervals: if out and a <= out[-1][1]: out[-1][1] = max(b, out[-1][1]) else: out.append([a,b]) return out
train
false
110
[{"args":[[]],"expected":[]},{"args":[[[1,4],[2,3],[4,8]]],"expected":[[1,8]]},{"args":[[[-11,-5],[-20,-14],[12,16],[7,13]]],"expected":[[-20,-14],[-11,-5],[7,16]]},{"args":[[[10,17],[22,22],[26,31],[3,4],[3,6],[19,26],[29,31],[19,24],[25,26],[-16,-13],[28,31],[15,16],[-19,-12],[18,18]]],"expected":[[-19,-12],[3,6],[10...
moving-sums-b0-s10
moving-sums
baseline
20,340,198
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": [[62, -91, -47], 21], "expected": []}, {"args": [[-7, -95, 74, 2, -92, 26, -79, 8, -85, -46, 46, -59, -39, 43, 91], 1], "expected": [-7, -95, 74, 2, -92, 2...
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":[[50,-76,-50,-63],-2],"expected":[]},{"args":[[69,-35,28,-15,-96,-23,-14,19],8],"expected":[-67]},{"args":[[95,-77,48,57,12,-61,-69,-78,-36,-35,16,-78,15,89,-63,-77],9],"expected":...
moving-sums-b1-s10
moving-sums
zero-window
20,340,198
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": [[-17, -19, 98, -1, 92, 13, -41, -68, 19, 7, 79, -71, 54, 37, -61, -74, -42], 6], "expected": [166, 142, 93, 14, 22, 9, -75, 20, 125, 45, -36, -157]}, {"ar...
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":[[50,-76,-50,-63],-2],"expected":[]},{"args":[[69,-35,28,-15,-96,-23,-14,19],8],"expected":[-67]},{"args":[[95,-77,48,57,12,-61,-69,-78,-36,-35,16,-78,15,89,-63,-77],9],"expected":...
moving-sums-b2-s10
moving-sums
window-width
20,340,198
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": [[21, 29, 11, 25], 1], "expected": [21, 29, 11, 25]}, {"args": [[93, 43, -84, 95, 30, 51, -18, 82, -42], 8], "expected": [292, 157]}, {"args": [[12, 25, 16...
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":[[50,-76,-50,-63],-2],"expected":[]},{"args":[[69,-35,28,-15,-96,-23,-14,19],8],"expected":[-67]},{"args":[[95,-77,48,57,12,-61,-69,-78,-36,-35,16,-78,15,89,-63,-77],9],"expected":...
moving-sums-b3-s10
moving-sums
missing-first-window
20,340,198
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], "expected": []}, {"args": [[-15, -40, 42, -63, 80, 5, -3, -32, 10, 62, 44, 56, 18, -77, 82, -47, -37, -87, 13], -2], "expected": []}, {"args": [[6...
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":[[50,-76,-50,-63],-2],"expected":[]},{"args":[[69,-35,28,-15,-96,-23,-14,19],8],"expected":[-67]},{"args":[[95,-77,48,57,12,-61,-69,-78,-36,-35,16,-78,15,89,-63,-77],9],"expected":...
weighted-mean-b0-s10
weighted-mean
baseline
20,340,198
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": [[-37, -46, 0, 4, -29, -17, -13, 40], [5, 4, 3, 4, 3, 5, 1, 0]], "expected": -21.52}, {"ar...
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":[[9,-7,-2,40,39,0,-24,-31,10,-29,-39],[5,4,1,4,5,3,3,1,1,4,4]],"expected":0.14285714285714285},{"args":[[-27,-31,-32,-7,-13,-29,-8,16,34,14,22,-37,-16],[0,0,3,3,2,3,0,5,5,5,4,4,2]],"expected":-0.05555555...
weighted-mean-b1-s10
weighted-mean
unweighted-numerator
20,340,198
Implement solve(values,weights). Inputs have equal length and nonnegative weights. Return weighted arithmetic mean; return None if total weight is zero (including empty inputs). Examples (JSON args and expected result): [{"args": [[-6, -47, 20, -37], [3, 4, 5, 0]], "expected": -8.833333333333334}, {"args": [[-18, 8, 48...
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":[[9,-7,-2,40,39,0,-24,-31,10,-29,-39],[5,4,1,4,5,3,3,1,1,4,4]],"expected":0.14285714285714285},{"args":[[-27,-31,-32,-7,-13,-29,-8,16,34,14,22,-37,-16],[0,0,3,3,2,3,0,5,5,5,4,4,2]],"expected":-0.05555555...
weighted-mean-b2-s10
weighted-mean
wrong-denominator
20,340,198
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, 35], [1, 5]], "expected": 33.833333333333336}, {"args": [[-29, -22], [1, 5]], "expec...
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":[[9,-7,-2,40,39,0,-24,-31,10,-29,-39],[5,4,1,4,5,3,3,1,1,4,4]],"expected":0.14285714285714285},{"args":[[-27,-31,-32,-7,-13,-29,-8,16,34,14,22,-37,-16],[0,0,3,3,2,3,0,5,5,5,4,4,2]],"expected":-0.05555555...
weighted-mean-b3-s10
weighted-mean
zero-weight-result
20,340,198
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": [[41, 26, 7, -34, -36, -20, -16, 40, -44, 14, -2, 37, 40, -31, 12], [4, 1, 2, 3, 3, 4, 0, ...
def solve(values,weights): total = sum(weights) return sum(x*w for x,w in zip(values,weights))/total if total else 0
train
false
121
[{"args":[[],[]],"expected":null},{"args":[[2,10],[0,1]],"expected":10.0},{"args":[[2],[0]],"expected":null},{"args":[[9,-7,-2,40,39,0,-24,-31,10,-29,-39],[5,4,1,4,5,3,3,1,1,4,4]],"expected":0.14285714285714285},{"args":[[-27,-31,-32,-7,-13,-29,-8,16,34,14,22,-37,-16],[0,0,3,3,2,3,0,5,5,5,4,4,2]],"expected":-0.05555555...
stable-unique-b0-s10
stable-unique
baseline
20,340,198
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[0, 3, -8, -9, -1, 10, 2, 8, -3, 4, -7, 0, -2, 6]], "expected": [0, 3, -8, -9, -1, 10, 2, 8, -3, 4, -7, -2, 6]}, {"args": [[7, -8, 10, -2, -2, 3, -3, ...
def solve(values): return sorted(set(values))
train
false
96
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7,10,6]],"expected":[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7]},{"args":[[4,-3,2,-8,1,-6,-8,-3,7,-2,2,-10,8,5,3,0,-8,-2,-1,10,1,-4,-10,8,-1,-1,-10,8,0]],"expected":[4,-3,2,-8,1,-6,7,-2,-10,8,5,3,0,-1,10,-4]},{"args":...
stable-unique-b1-s10
stable-unique
reverse-traversal
20,340,198
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[6, -2, 0, 10, 2, 7, -2, 4, -4, -5, 8, -7, -3, -8, -3, -10, 3, -4, 10, -8, -5, 7, -5, -8, 3, -10]], "expected": [6, -2, 0, 10, 2, 7, 4, -4, -5, 8, -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":[[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7,10,6]],"expected":[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7]},{"args":[[4,-3,2,-8,1,-6,-8,-3,7,-2,2,-10,8,5,3,0,-8,-2,-1,10,1,-4,-10,8,-1,-1,-10,8,0]],"expected":[4,-3,2,-8,1,-6,7,-2,-10,8,5,3,0,-1,10,-4]},{"args":...
stable-unique-b2-s10
stable-unique
reverse-output
20,340,198
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-9, 4, 8, -2, -7, -9, 10, 10, -5, -5, -6, 10, 7, -4, 9, -10, 6, 1, -8, -7, -1, -4, -6, 4, -7]], "expected": [-9, 4, 8, -2, -7, 10, -5, -6, 7, -4, 9, ...
def solve(values): seen = set() out = [] for x in values: if x not in seen: seen.add(x) out.insert(0,x) return out
train
false
96
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7,10,6]],"expected":[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7]},{"args":[[4,-3,2,-8,1,-6,-8,-3,7,-2,2,-10,8,5,3,0,-8,-2,-1,10,1,-4,-10,8,-1,-1,-10,8,0]],"expected":[4,-3,2,-8,1,-6,7,-2,-10,8,5,3,0,-1,10,-4]},{"args":...
stable-unique-b3-s10
stable-unique
wrong-seen-value
20,340,198
Implement solve(values). Deduplicate integer values while preserving first occurrence order. Empty list stays empty. Examples (JSON args and expected result): [{"args": [[-2, -6, -2, 2, 4, 6, 6, -4, 2, 10, 9, 8, -6, 0, -3, 3, -9, -7, 3, 8, -2, -6, 7, 3]], "expected": [-2, -6, 2, 4, 6, -4, 10, 9, 8, 0, -3, 3, -9, -7, 7]...
def solve(values): seen = set() out = [] for x in values: if x not in seen: seen.add(-x) out.append(x) return out
train
false
96
[{"args":[[]],"expected":[]},{"args":[[3,1,3,2,1]],"expected":[3,1,2]},{"args":[[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7,10,6]],"expected":[10,-6,-1,0,-10,6,-4,-9,8,5,-8,-7]},{"args":[[4,-3,2,-8,1,-6,-8,-3,7,-2,2,-10,8,5,3,0,-8,-2,-1,10,1,-4,-10,8,-1,-1,-10,8,0]],"expected":[4,-3,2,-8,1,-6,7,-2,-10,8,5,3,0,-1,10,-4]},{"args":...
run-length-b0-s10
run-length
baseline
20,340,198
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猫 🙂"], "expected": [["🙂", 3], ["c", 1], ["猫", 1], [" ", 1], ["🙂", 1]]}, {"args": [...
def solve(text): return [[c,text.count(c)] for c in sorted(set(text))]
train
false
100
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["🙂a"],"expected":[["🙂",1],["a",1]]},{"args":["c猫 b aaa🙂c猫"],"expected":[["c",1],["猫",1],[" ",2],["b",1],[" ",1],["a",3],["🙂",1],["c",1],["猫",1]]},{"args":[" c🙂 ...
run-length-b1-s10
run-length
inverted-grouping
20,340,198
Implement solve(text). Run-length encode consecutive Unicode characters as a list of [character,count] pairs. Empty text returns []. Nonadjacent occurrences remain separate. Examples (JSON args and expected result): [{"args": ["🙂aaa🙂acbbbcb"], "expected": [["🙂", 1], ["a", 3], ["🙂", 1], ["a", 1], ["c", 1], ["b", 3],...
def solve(text): out = [] for c in text: if out and out[-1][0] != c: out[-1][1] += 1 else: out.append([c,1]) return out
train
false
100
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["🙂a"],"expected":[["🙂",1],["a",1]]},{"args":["c猫 b aaa🙂c猫"],"expected":[["c",1],["猫",1],[" ",2],["b",1],[" ",1],["a",3],["🙂",1],["c",1],["猫",1]]},{"args":[" c🙂 ...
run-length-b2-s10
run-length
double-increment
20,340,198
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": ["bbacc猫猫 猫"], "expected": [["b", 2], ["a", 1], ["c", 2], ["猫", 2], [" ", 2], ["猫", 1]]}, {"a...
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
100
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["🙂a"],"expected":[["🙂",1],["a",1]]},{"args":["c猫 b aaa🙂c猫"],"expected":[["c",1],["猫",1],[" ",2],["b",1],[" ",1],["a",3],["🙂",1],["c",1],["猫",1]]},{"args":[" c🙂 ...
run-length-b3-s10
run-length
zero-initial-count
20,340,198
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 🙂猫ccc猫猫猫"], "expected": [["猫", 1], ["🙂", 1], ["猫", 1], ["🙂", 1], ["b", 1], ["a",...
def solve(text): out = [] for c in text: if out and out[-1][0] == c: out[-1][1] += 1 else: out.append([c,0]) return out
train
false
100
[{"args":[""],"expected":[]},{"args":["aabbaa"],"expected":[["a",2],["b",2],["a",2]]},{"args":["猫猫🙂🙂猫"],"expected":[["猫",2],["🙂",2],["猫",1]]},{"args":["🙂a"],"expected":[["🙂",1],["a",1]]},{"args":["c猫 b aaa🙂c猫"],"expected":[["c",1],["猫",1],[" ",2],["b",1],[" ",1],["a",3],["🙂",1],["c",1],["猫",1]]},{"args":[" c🙂 ...