id stringlengths 19 19 | question_id int64 3.56k 4.03k | function_name stringlengths 6 31 | code stringlengths 87 3.7k | input stringlengths 16 112 | output stringclasses 62
values | correct_condition stringlengths 21 153 | contest_id stringclasses 37
values | contest_date stringdate 2025-01-05 00:00:00 2025-09-14 00:00:00 | difficulty stringclasses 3
values | metrics dict | submission_id int64 1.5B 1.77B | mutated_code stringlengths 85 3.26k | mutated_output stringlengths 1 108 | has_mutation bool 1
class | mutation_info dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
contest431_q3702_s0 | 3,702 | maxLength | def maxLength(nums: List[int]) -> int:
n = len(nums)
ans = 0
for l in range(n):
a = 1
b = 1
c = 0
for r in range(l, n):
a *= nums[r]
b = lcm(b, nums[r])
c = gcd(c, nums[r])
if a == b *... | maxLength(nums=[1,2,1,2,1,1,1]) | 5 | maxLength(nums=[1,2,1,2,1,1,1]) == 5 | weekly-contest-431 | 2025-01-05T00:00:00.000 | easy | {
"coverage": null,
"loc": 16
} | 1,497,983,046 | def maxLength(nums: List[int]) -> int:
n = len(nums)
ans = 0
for l in range(n):
a = 1
b = 1
c = 0
for r in range(l, n):
a *= nums[r]
b = lcm(b, nums[r])
c = gcd(c, nums[r])
if a == b * c:
ans = max(ans, r - l - 1... | 3 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest431_q3702_s1 | 3,702 | maxLength | def maxLength(nums: List[int]) -> int:
ans = 1
run = 1
for l in range(len(nums)):
for r in range(l, len(nums)):
a = nums[l:r+1]
prod = 1
g = nums[l]
lc = nums[l]
for v in a:
g = gcd(g,... | maxLength(nums=[1,2,1,2,1,1,1]) | 5 | maxLength(nums=[1,2,1,2,1,1,1]) == 5 | weekly-contest-431 | 2025-01-05T00:00:00.000 | easy | {
"coverage": null,
"loc": 16
} | 1,497,983,616 | def maxLength(nums: List[int]) -> int:
ans = 1
run = 1
for l in range(len(nums)):
for r in range(l, len(nums)):
a = nums[l:r + 1]
prod = 1
g = nums[l]
lc = nums[l]
for v in a:
g = gcd(g, v)
lc = lcm(lc, v)
... | 3 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest431_q3634_s0 | 3,634 | calculateScore | def calculateScore(s: str) -> int:
g = [[] for _ in range(26)]
ans = 0
for i, x in enumerate(s):
x = ord(x) - 97
if g[25 - x]:
ans += i - g[25 - x].pop()
else:
g[x].append(i)
return ans
| calculateScore(s="aczzx") | 5 | calculateScore(s="aczzx") == 5 | weekly-contest-431 | 2025-01-05T00:00:00.000 | medium | {
"coverage": null,
"loc": 11
} | 1,497,985,461 | def calculateScore(s: str) -> int:
g = [[] for _ in range(26)]
ans = 0
for i, x in enumerate(s):
x = ord(x) - 97
if g[25 - x]:
ans += i + g[25 - x].pop()
else:
g[x].append(i)
return ans | 7 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest431_q3634_s1 | 3,634 | calculateScore | def calculateScore(s: str) -> int:
def mir(c):
return chr(ord('a') + (25 - (ord(c) - ord('a'))))
seen = defaultdict(list)
ans = 0
for i in range(len(s)):
c1 = mir(s[i])
if seen[c1]:
ans += i - seen[c1][-1]
seen[c1].pop()... | calculateScore(s="aczzx") | 5 | calculateScore(s="aczzx") == 5 | weekly-contest-431 | 2025-01-05T00:00:00.000 | medium | {
"coverage": null,
"loc": 12
} | 1,497,985,549 | def calculateScore(s: str) -> int:
def mir(c):
return chr(ord('a') - (25 - (ord(c) - ord('a'))))
seen = defaultdict(list)
ans = 0
for i in range(len(s)):
c1 = mir(s[i])
if seen[c1]:
ans += i - seen[c1][-1]
seen[c1].pop()
else:
seen[s[i... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest431_q3715_s0 | 3,715 | maximumCoins | def maximumCoins(coins: List[List[int]], k: int) -> int:
coins.sort()
n = len(coins)
def f(p):
ret = tot = 0
j = 0
for i in range(n):
while j < n and p[j][1] - p[i][0] + 1 <= k:
tot += (p[j][1] - p[j][0] + 1) * p[j][2]
... | maximumCoins(coins=[[8,10,1],[1,3,2],[5,6,4]], k=4) | 10 | maximumCoins(coins=[[8,10,1],[1,3,2],[5,6,4]], k=4) == 10 | weekly-contest-431 | 2025-01-05T00:00:00.000 | medium | {
"coverage": null,
"loc": 29
} | 1,498,002,559 | def maximumCoins(coins: List[List[int]], k: int) -> int:
coins.sort()
n = len(coins)
def f(p):
ret = tot = 0
j = 0
for i in range(n):
while j < n and p[j][1] - p[i][0] - 1 <= k:
tot += (p[j][1] - p[j][0] + 1) * p[j][2]
j += 1
c... | 14 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest431_q3715_s1 | 3,715 | maximumCoins | def maximumCoins(coins: List[List[int]], k: int) -> int:
coins.sort()
ans = 0
for _ in range(2):
cnt = 0
r = 0
# print(coins)
for l in range(len(coins)):
while r+1 < len(coins) and coins[r][1]-coins[l][0]+1 <= k:
... | maximumCoins(coins=[[8,10,1],[1,3,2],[5,6,4]], k=4) | 10 | maximumCoins(coins=[[8,10,1],[1,3,2],[5,6,4]], k=4) == 10 | weekly-contest-431 | 2025-01-05T00:00:00.000 | medium | {
"coverage": null,
"loc": 24
} | 1,498,001,804 | def maximumCoins(coins: List[List[int]], k: int) -> int:
coins.sort()
ans = 0
for _ in range(2):
cnt = 0
r = 0
for l in range(len(coins)):
while r + 1 < len(coins) and coins[r][1] - coins[l][0] - 1 <= k:
cnt += (coins[r][1] - coins[r][0] + 1) * coins[r][2]... | 14 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest431_q3562_s0 | 3,562 | maximumWeight | def maximumWeight(p: List[List[int]]) -> List[int]:
a = []
for i, it in enumerate(p):
it.append(i)
a += [it[0], it[1]]
mp = {x: i + 1 for i, x in enumerate(sorted(set(a)))}
p.sort(key=lambda it:it[1])
for it in p:
it[0] = mp[it[0]]
... | maximumWeight(p=[[1,3,2],[4,5,2],[1,5,5],[6,9,3],[6,7,1],[8,9,1]]) | [2, 3] | maximumWeight(p=[[1,3,2],[4,5,2],[1,5,5],[6,9,3],[6,7,1],[8,9,1]]) == [2, 3] | weekly-contest-431 | 2025-01-05T00:00:00.000 | hard | {
"coverage": null,
"loc": 24
} | 1,498,025,769 | def maximumWeight(p: List[List[int]]) -> List[int]:
a = []
for i, it in enumerate(p):
it.append(i)
a += [it[0], it[1]]
mp = {x: i + 1 for i, x in enumerate(sorted(set(a)))}
p.sort(key=lambda it: it[1])
for it in p:
it[0] = mp[it[0]]
it[1] = mp[it[1]]
f = [[[0, []]... | [0, 0, 2, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest431_q3562_s1 | 3,562 | maximumWeight | def maximumWeight(intervals: List[List[int]]) -> List[int]:
locations = set()
for l, r, w in intervals:
locations.add(l)
locations.add(r+1)
locations = sorted(list(locations))
to_idx = dict()
for i, x in enumerate(locations):
to_idx[x] = i
... | maximumWeight(intervals=[[1,3,2],[4,5,2],[1,5,5],[6,9,3],[6,7,1],[8,9,1]]) | [2, 3] | maximumWeight(intervals=[[1,3,2],[4,5,2],[1,5,5],[6,9,3],[6,7,1],[8,9,1]]) == [2, 3] | weekly-contest-431 | 2025-01-05T00:00:00.000 | hard | {
"coverage": null,
"loc": 29
} | 1,498,015,639 | def maximumWeight(intervals: List[List[int]]) -> List[int]:
locations = set()
for l, r, w in intervals:
locations.add(l)
locations.add(r + 1)
locations = sorted(list(locations))
to_idx = dict()
for i, x in enumerate(locations):
to_idx[x] = i
nxt = [[] for i in range(len(l... | [] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest432_q3708_s0 | 3,708 | zigzagTraversal | def zigzagTraversal(grid: List[List[int]]) -> List[int]:
R, C = len(grid), len(grid[0])
ans = []
i, j = 0, 0
def connected(i, j, ii, jj):
return (i == ii and abs(j - jj) == 1) or (j == jj and abs(i - ii) == 1)
dir = 1
while 0 <= i < R and 0 <= j < C:
... | zigzagTraversal(grid=[[1,2],[3,4]]) | [1, 4] | zigzagTraversal(grid=[[1,2],[3,4]]) == [1, 4] | weekly-contest-432 | 2025-01-12T00:00:00.000 | easy | {
"coverage": null,
"loc": 28
} | 1,505,653,842 | def zigzagTraversal(grid: List[List[int]]) -> List[int]:
R, C = (len(grid), len(grid[0]))
ans = []
i, j = (0, 0)
def connected(i, j, ii, jj):
return i == ii and abs(j - jj) == 1 or (j == jj and abs(i - ii) == 1)
dir = 1
while 0 <= i < R and 0 <= j < C:
ans.append(grid[i][j])
... | [1] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest432_q3708_s1 | 3,708 | zigzagTraversal | def zigzagTraversal(grid: List[List[int]]) -> List[int]:
m, n = len(grid), len(grid[0])
r = 1
i, j = 0, 0
res = []
while i < m:
res.append(grid[i][j])
if r:
j += 2
if j >= n:
i += 1
... | zigzagTraversal(grid=[[1,2],[3,4]]) | [1, 4] | zigzagTraversal(grid=[[1,2],[3,4]]) == [1, 4] | weekly-contest-432 | 2025-01-12T00:00:00.000 | easy | {
"coverage": null,
"loc": 23
} | 1,505,650,015 | def zigzagTraversal(grid: List[List[int]]) -> List[int]:
m, n = (len(grid), len(grid[0]))
r = 1
i, j = (1, 0)
res = []
while i < m:
res.append(grid[i][j])
if r:
j += 2
if j >= n:
i += 1
j = n - 1 - (j - n)
r = 1 ... | [3] | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "number"
} |
contest432_q3708_s2 | 3,708 | zigzagTraversal | def zigzagTraversal(grid: List[List[int]]) -> List[int]:
ans = []
for i, row in enumerate(grid):
if i % 2:
ans += row[::-1]
else:
ans += row
return ans[::2]
| zigzagTraversal(grid=[[1,2],[3,4]]) | [1, 4] | zigzagTraversal(grid=[[1,2],[3,4]]) == [1, 4] | weekly-contest-432 | 2025-01-12T00:00:00.000 | easy | {
"coverage": null,
"loc": 10
} | 1,505,643,478 | def zigzagTraversal(grid: List[List[int]]) -> List[int]:
ans = []
for i, row in enumerate(grid):
if i // 2:
ans += row[::-1]
else:
ans += row
return ans[::2] | [1, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest432_q3677_s0 | 3,677 | maximumAmount | def maximumAmount(coins: List[List[int]]) -> int:
R, C = len(coins), len(coins[0])
@cache
def f(i, j, magic):
if (i, j) in ((R, C - 1), (R - 1, C)):
return 0
if i >= R or j >= C:
return -inf
value = coins[i][j] + max(f(i + 1, ... | maximumAmount(coins=[[0,1,-1],[1,-2,3],[2,-3,4]]) | 8 | maximumAmount(coins=[[0,1,-1],[1,-2,3],[2,-3,4]]) == 8 | weekly-contest-432 | 2025-01-12T00:00:00.000 | medium | {
"coverage": null,
"loc": 18
} | 1,505,662,274 | def maximumAmount(coins: List[List[int]]) -> int:
R, C = (len(coins), len(coins[0]))
@cache
def f(i, j, magic):
if (i, j) in ((R, C - 1), (R - 1, C)):
return 0
if i >= R or j >= C:
return -inf
value = coins[i][j] - max(f(i + 1, j, magic), f(i, j + 1, magic))
... | 10 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest432_q3677_s1 | 3,677 | maximumAmount | def maximumAmount(coins: List[List[int]]) -> int:
m, n = len(coins), len(coins[0])
dp0 = [[float('-inf')] * n for _ in range(m)]
dp1 = [[float('-inf')] * n for _ in range(m)]
dp2 = [[float('-inf')] * n for _ in range(m)]
dp0[0][0] = coins[0][0]
if coins[0][0] < ... | maximumAmount(coins=[[0,1,-1],[1,-2,3],[2,-3,4]]) | 8 | maximumAmount(coins=[[0,1,-1],[1,-2,3],[2,-3,4]]) == 8 | weekly-contest-432 | 2025-01-12T00:00:00.000 | medium | {
"coverage": null,
"loc": 30
} | 1,505,663,966 | def maximumAmount(coins: List[List[int]]) -> int:
m, n = (len(coins), len(coins[0]))
dp0 = [[float('-inf')] * n for _ in range(m)]
dp1 = [[float('-inf')] * n for _ in range(m)]
dp2 = [[float('-inf')] * n for _ in range(m)]
dp0[0][0] = coins[0][0]
if coins[0][0] < 0:
dp1[0][0] = 0
for... | 10 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest432_q3677_s2 | 3,677 | maximumAmount | def maximumAmount(g: List[List[int]]) -> int:
n = len(g)
m = len(g[0])
f = [[[-inf] * 3 for j in range(m)] for i in range(n)]
f[0][0][0] = g[0][0]
f[0][0][1] = f[0][0][2] = max(g[0][0], 0)
for i in range(n):
for j in range(m):
if i == 0 and j =... | maximumAmount(g=[[0,1,-1],[1,-2,3],[2,-3,4]]) | 8 | maximumAmount(g=[[0,1,-1],[1,-2,3],[2,-3,4]]) == 8 | weekly-contest-432 | 2025-01-12T00:00:00.000 | medium | {
"coverage": null,
"loc": 22
} | 1,505,655,943 | def maximumAmount(g: List[List[int]]) -> int:
n = len(g)
m = len(g[0])
f = [[[-inf] * 3 for j in range(m)] for i in range(n)]
f[0][0][0] = g[0][0]
f[0][0][1] = f[0][0][2] = max(g[0][0], 0)
for i in range(n):
for j in range(m):
if i == 0 and j == 0:
continue
... | 10 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest432_q3720_s0 | 3,720 | minMaxWeight | def minMaxWeight(n: int, edges: List[List[int]], threshold: int) -> int:
G = [[] for _ in range(n)]
for u, v, w in edges:
G[v].append((u, w))
def dfs(u, visited, cap):
visited[u] = True
for v, w in G[u]:
if w <= cap and not visited[v]:
... | minMaxWeight(n=5, edges=[[1,0,1],[2,0,2],[3,0,1],[4,3,1],[2,1,1]], threshold=2) | 1 | minMaxWeight(n=5, edges=[[1,0,1],[2,0,2],[3,0,1],[4,3,1],[2,1,1]], threshold=2) == 1 | weekly-contest-432 | 2025-01-12T00:00:00.000 | medium | {
"coverage": null,
"loc": 34
} | 1,505,695,158 | def minMaxWeight(n: int, edges: List[List[int]], threshold: int) -> int:
G = [[] for _ in range(n)]
for u, v, w in edges:
G[v].append((u, w))
def dfs(u, visited, cap):
visited[u] = True
for v, w in G[u]:
if w < cap and (not visited[v]):
dfs(v, visited, ca... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest432_q3720_s1 | 3,720 | minMaxWeight | def minMaxWeight(n: int, edges: List[List[int]], threshold: int) -> int:
ws = set()
graph = {}
rev = {}
for u, v, w in edges:
ws.add(w)
if u not in graph:
graph[u] = defaultdict(lambda: float('inf'))
if v not in rev:
... | minMaxWeight(n=5, edges=[[1,0,1],[2,0,2],[3,0,1],[4,3,1],[2,1,1]], threshold=2) | 1 | minMaxWeight(n=5, edges=[[1,0,1],[2,0,2],[3,0,1],[4,3,1],[2,1,1]], threshold=2) == 1 | weekly-contest-432 | 2025-01-12T00:00:00.000 | medium | {
"coverage": null,
"loc": 48
} | 1,505,688,956 | def minMaxWeight(n: int, edges: List[List[int]], threshold: int) -> int:
ws = set()
graph = {}
rev = {}
for u, v, w in edges:
ws.add(w)
if u not in graph:
graph[u] = defaultdict(lambda: float('inf'))
if v not in rev:
rev[v] = defaultdict(lambda: float('inf... | -1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest432_q3720_s2 | 3,720 | minMaxWeight | def minMaxWeight(n: int, edges: List[List[int]], threshold: int) -> int:
g = [[] for _ in range(n)]
m = 1
for u, v, w in edges:
g[v].append((u, w))
if w > m:
m = w
def check(mid):
vis = [0] * n
vis[0] = 1
Q = deq... | minMaxWeight(n=5, edges=[[1,0,1],[2,0,2],[3,0,1],[4,3,1],[2,1,1]], threshold=2) | 1 | minMaxWeight(n=5, edges=[[1,0,1],[2,0,2],[3,0,1],[4,3,1],[2,1,1]], threshold=2) == 1 | weekly-contest-432 | 2025-01-12T00:00:00.000 | medium | {
"coverage": null,
"loc": 28
} | 1,505,677,494 | def minMaxWeight(n: int, edges: List[List[int]], threshold: int) -> int:
g = [[] for _ in range(n)]
m = 1
for u, v, w in edges:
g[v].append((u, w))
if w > m:
m = w
def check(mid):
vis = [0] * n
vis[0] = 1
Q = deque([0])
while Q:
u ... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest432_q3674_s1 | 3,674 | countNonDecreasingSubarrays | def countNonDecreasingSubarrays(nums: List[int], k: int) -> int:
n = len(nums)
j = n
total = 0
stack = deque()
res = 0
for i in range(n-1, -1, -1):
num = nums[i]
inc = 0
while stack and nums[stack[-1]] <= nums[i]:
... | countNonDecreasingSubarrays(nums=[6,3,1,2,4,4], k=7) | 17 | countNonDecreasingSubarrays(nums=[6,3,1,2,4,4], k=7) == 17 | weekly-contest-432 | 2025-01-12T00:00:00.000 | hard | {
"coverage": null,
"loc": 28
} | 1,505,713,317 | def countNonDecreasingSubarrays(nums: List[int], k: int) -> int:
n = len(nums)
j = n
total = 0
stack = deque()
res = 0
for i in range(n - 1, -1, -1):
num = nums[i]
inc = 0
while stack and nums[stack[-1]] <= nums[i]:
cur = stack.pop()
prev = stack[-... | 21 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest432_q3674_s2 | 3,674 | countNonDecreasingSubarrays | def countNonDecreasingSubarrays(nums: List[int], k: int) -> int:
ans = 0
n = len(nums)
nextlargestidx = [None] * n # strictly larger
st = []
for i in range(len(nums)):
while len(st) != 0 and nums[st[-1]] < nums[i]:
nextlargestidx[st[-1]] = i
... | countNonDecreasingSubarrays(nums=[6,3,1,2,4,4], k=7) | 17 | countNonDecreasingSubarrays(nums=[6,3,1,2,4,4], k=7) == 17 | weekly-contest-432 | 2025-01-12T00:00:00.000 | hard | {
"coverage": null,
"loc": 43
} | 1,505,705,811 | def countNonDecreasingSubarrays(nums: List[int], k: int) -> int:
ans = 0
n = len(nums)
nextlargestidx = [None] * n
st = []
for i in range(len(nums)):
while len(st) != 0 and nums[st[-1]] < nums[i]:
nextlargestidx[st[-1]] = i
st.pop()
st.append(i)
start = 0
... | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 7,
"mutation_type": "arithmetic"
} |
contest433_q3731_s0 | 3,731 | subarraySum | def subarraySum(nums):
n=len(nums)
p=[0]*(n+1)
for i in range(n):
p[i+1]=p[i]+nums[i]
s1=0
s2=0
for i in range(n):
st=i-nums[i]
if st<0: st=0
s1+=p[i+1]
s2+=p[st]
return s1-s2 | subarraySum(nums=[2,3,1]) | 11 | subarraySum(nums=[2,3,1]) == 11 | weekly-contest-433 | 2025-01-19T00:00:00.000 | easy | {
"coverage": null,
"loc": 13
} | 1,513,087,537 | def subarraySum(nums):
n = len(nums)
p = [0] * (n + 1)
for i in range(n):
p[i - 1] = p[i] + nums[i]
s1 = 0
s2 = 0
for i in range(n):
st = i - nums[i]
if st < 0:
st = 0
s1 += p[i + 1]
s2 += p[st]
return s1 - s2 | -4 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest433_q3731_s2 | 3,731 | subarraySum | def subarraySum(nums: List[int]) -> int:
n = len(nums)
ans = 0
for i in range(n):
start = max(0, i - nums[i])
s = 0
for j in range(start, i + 1):
s += nums[j]
ans += s
return ans | subarraySum(nums=[2,3,1]) | 11 | subarraySum(nums=[2,3,1]) == 11 | weekly-contest-433 | 2025-01-19T00:00:00.000 | easy | {
"coverage": null,
"loc": 10
} | 1,513,080,952 | def subarraySum(nums: List[int]) -> int:
n = len(nums)
ans = 0
for i in range(n):
start = max(0, i + nums[i])
s = 0
for j in range(start, i + 1):
s += nums[j]
ans += s
return ans | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest433_q3714_s0 | 3,714 | minMaxSums | def minMaxSums(nums: List[int], k: int) -> int:
import sys
sys.setrecursionlimit(10**7)
M=10**9+7
n=len(nums)
f=[1]*(n+1)
invf=[1]*(n+1)
for i in range(1,n+1):
f[i]=(f[i-1]*i)%M
def p(b,e):
r=1
while e>0:
... | minMaxSums(nums=[1,2,3], k=2) | 24 | minMaxSums(nums=[1,2,3], k=2) == 24 | weekly-contest-433 | 2025-01-19T00:00:00.000 | medium | {
"coverage": null,
"loc": 35
} | 1,513,088,015 | def minMaxSums(nums: List[int], k: int) -> int:
import sys
sys.setrecursionlimit(10 ** 7)
M = 10 ** 9 - 7
n = len(nums)
f = [1] * (n + 1)
invf = [1] * (n + 1)
for i in range(1, n + 1):
f[i] = f[i - 1] * i % M
def p(b, e):
r = 1
while e > 0:
if e & 1:
... | 880765893 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest433_q3714_s2 | 3,714 | minMaxSums | def minMaxSums(nums: List[int], k: int) -> int:
MOD = 10**9+7
n = len(nums)
nums.sort()
fact = [1] * (n+1)
inv_fact = [1] * (n+1)
for i in range(1,n+1):
fact[i] = fact[i-1] * i % MOD
inv_fact[n] = pow(fact[n], MOD-2, MOD)
for ... | minMaxSums(nums=[1,2,3], k=2) | 24 | minMaxSums(nums=[1,2,3], k=2) == 24 | weekly-contest-433 | 2025-01-19T00:00:00.000 | medium | {
"coverage": null,
"loc": 30
} | 1,513,086,962 | def minMaxSums(nums: List[int], k: int) -> int:
MOD = 10 ** 9 - 7
n = len(nums)
nums.sort()
fact = [1] * (n + 1)
inv_fact = [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = fact[i - 1] * i % MOD
inv_fact[n] = pow(fact[n], MOD - 2, MOD)
for i in range(n - 1, -1, -1):
inv_... | 880765893 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest433_q3737_s0 | 3,737 | minCost | def minCost(n: int, cost: List[List[int]]) -> int:
s=[(0,1),(0,2),(1,0),(1,2),(2,0),(2,1)]
dp1=[cost[0][x[0]]+cost[n-1][x[1]] for x in s]
v=[[False]*6 for _ in range(6)]
for i in range(6):
for j in range(6):
v[i][j]=(s[i][0]!=s[j][0] and s[i][1]!=s[j][1])
... | minCost(n=4, cost=[[3,5,7],[6,2,9],[4,8,1],[7,3,5]]) | 9 | minCost(n=4, cost=[[3,5,7],[6,2,9],[4,8,1],[7,3,5]]) == 9 | weekly-contest-433 | 2025-01-19T00:00:00.000 | medium | {
"coverage": null,
"loc": 14
} | 1,513,082,546 | def minCost(n: int, cost: List[List[int]]) -> int:
s = [(0, 1), (0, 2), (1, 0), (1, 2), (2, 0), (2, 1)]
dp1 = [cost[0][x[0]] - cost[n - 1][x[1]] for x in s]
v = [[False] * 6 for _ in range(6)]
for i in range(6):
for j in range(6):
v[i][j] = s[i][0] != s[j][0] and s[i][1] != s[j][1]
... | 3 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest433_q3737_s2 | 3,737 | minCost | def minCost(n: int, cost: List[List[int]]) -> int:
dp = [[[float('inf')] * 3 for _ in range(3)] for __ in range(n//2+1)]
for cl in range(3):
for cr in range(3):
dp[0][cl][cr] = 0
for nl in range(3):
for nr in range(3):
if n... | minCost(n=4, cost=[[3,5,7],[6,2,9],[4,8,1],[7,3,5]]) | 9 | minCost(n=4, cost=[[3,5,7],[6,2,9],[4,8,1],[7,3,5]]) == 9 | weekly-contest-433 | 2025-01-19T00:00:00.000 | medium | {
"coverage": null,
"loc": 35
} | 1,513,091,870 | def minCost(n: int, cost: List[List[int]]) -> int:
dp = [[[float('inf')] * 3 for _ in range(3)] for __ in range(n // 2 + 1)]
for cl in range(3):
for cr in range(3):
dp[0][cl][cr] = 0
for nl in range(3):
for nr in range(3):
if nl != nr:
for cl in range(... | 3 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest433_q3725_s0 | 3,725 | minMaxSubarraySum | def minMaxSubarraySum(nums, k):
def p(L,R,M):
u=min(L,M-1)
if u<=0:return 0
if R>=M-1:return M*u - u*(u+1)//2
x=M-R
if x>u:return R*u
s=R*(x-1)
s+=M*(u-x+1)-((u*(u+1))//2-((x-1)*x)//2)
return s
def s(a,k,m):
... | minMaxSubarraySum(nums=[1,2,3], k=2) | 20 | minMaxSubarraySum(nums=[1,2,3], k=2) == 20 | weekly-contest-433 | 2025-01-19T00:00:00.000 | hard | {
"coverage": null,
"loc": 31
} | 1,513,090,643 | def minMaxSubarraySum(nums, k):
def p(L, R, M):
u = min(L, M - 1)
if u <= 0:
return 0
if R >= M - 1:
return M * u + u * (u + 1) // 2
x = M - R
if x > u:
return R * u
s = R * (x - 1)
s += M * (u - x + 1) - (u * (u + 1) // 2 ... | 26 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest433_q3725_s2 | 3,725 | minMaxSubarraySum | def minMaxSubarraySum(nums: List[int], k: int) -> int:
n = len(nums)
lSmall = [-1]*n
rSmall = [n]*n
stack = []
for i in range(n):
while stack and nums[stack[-1]]>nums[i]:
stack.pop()
lSmall[i] = stack[-1] if stack else -1
stack.... | minMaxSubarraySum(nums=[1,2,3], k=2) | 20 | minMaxSubarraySum(nums=[1,2,3], k=2) == 20 | weekly-contest-433 | 2025-01-19T00:00:00.000 | hard | {
"coverage": null,
"loc": 59
} | 1,513,104,348 | def minMaxSubarraySum(nums: List[int], k: int) -> int:
n = len(nums)
lSmall = [-1] * n
rSmall = [n] * n
stack = []
for i in range(n):
while stack and nums[stack[-1]] > nums[i]:
stack.pop()
lSmall[i] = stack[-1] if stack else -1
stack.append(i)
stack.clear()
... | 24 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest434_q3704_s0 | 3,704 | countPartitions | def countPartitions(nums: List[int]) -> int:
S = sum(nums)
n = len(nums)
answer = 0
S1 = 0
for i in range(n-1):
S1+=nums[i]
S-=nums[i]
if (S-S1) % 2==0:
answer+=1
return answer
| countPartitions(nums=[10,10,3,7,6]) | 4 | countPartitions(nums=[10,10,3,7,6]) == 4 | weekly-contest-434 | 2025-01-26T00:00:00.000 | easy | {
"coverage": null,
"loc": 12
} | 1,520,578,515 | def countPartitions(nums: List[int]) -> int:
S = sum(nums)
n = len(nums)
answer = 0
S1 = 0
for i in range(n - 1):
S1 += nums[i]
S -= nums[i]
if (S - S1) // 2 == 0:
answer += 1
return answer | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest434_q3704_s2 | 3,704 | countPartitions | def countPartitions(nums: List[int]) -> int:
total = sum(nums)
if total % 2 != 0:
return 0
return len(nums) - 1 | countPartitions(nums=[10,10,3,7,6]) | 4 | countPartitions(nums=[10,10,3,7,6]) == 4 | weekly-contest-434 | 2025-01-26T00:00:00.000 | easy | {
"coverage": null,
"loc": 5
} | 1,520,580,436 | def countPartitions(nums: List[int]) -> int:
total = sum(nums)
if total // 2 != 0:
return 0
return len(nums) - 1 | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest434_q3721_s0 | 3,721 | countMentions | def countMentions(numberOfUsers: int, events: List[List[str]]) -> List[int]:
m = numberOfUsers
n = len(events)
L = []
for event in events:
if event[0]=='MESSAGE':
t = int(event[1])
L.append([t, 2, event[2]])
else:
t ... | countMentions(numberOfUsers=2, events=[["MESSAGE","10","id1 id0"],["OFFLINE","11","0"],["MESSAGE","71","HERE"]]) | [2, 2] | countMentions(numberOfUsers=2, events=[["MESSAGE","10","id1 id0"],["OFFLINE","11","0"],["MESSAGE","71","HERE"]]) == [2, 2] | weekly-contest-434 | 2025-01-26T00:00:00.000 | medium | {
"coverage": null,
"loc": 38
} | 1,520,610,644 | def countMentions(numberOfUsers: int, events: List[List[str]]) -> List[int]:
m = numberOfUsers
n = len(events)
L = []
for event in events:
if event[0] == 'MESSAGE':
t = int(event[1])
L.append([t, 2, event[2]])
else:
t = int(event[1])
L.appe... | [1, 2] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest434_q3721_s2 | 3,721 | countMentions | def countMentions(numberOfUsers: int, events: List[List[str]]) -> List[int]:
mentions = [0] * numberOfUsers
offline_until = [0] * numberOfUsers
def sort_events(events: List[List[str]]) -> List[List[str]]:
def sort_key(event):
ts = int(event[1])
... | countMentions(numberOfUsers=2, events=[["MESSAGE","10","id1 id0"],["OFFLINE","11","0"],["MESSAGE","71","HERE"]]) | [2, 2] | countMentions(numberOfUsers=2, events=[["MESSAGE","10","id1 id0"],["OFFLINE","11","0"],["MESSAGE","71","HERE"]]) == [2, 2] | weekly-contest-434 | 2025-01-26T00:00:00.000 | medium | {
"coverage": null,
"loc": 50
} | 1,520,595,169 | def countMentions(numberOfUsers: int, events: List[List[str]]) -> List[int]:
mentions = [0] * numberOfUsers
offline_until = [0] * numberOfUsers
def sort_events(events: List[List[str]]) -> List[List[str]]:
def sort_key(event):
ts = int(event[1])
event_type_priority = 0 if ev... | [3, 3] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest434_q3751_s0 | 3,751 | maxFrequency | def maxFrequency(nums: List[int], k: int) -> int:
n = len(nums)
k_count = 0
for x in nums:
if x==k:
k_count+=1
answer = k_count
for x in range(1, 51):
curr_k = 0
my_min = 0
x_count = 0
for i in range(n... | maxFrequency(nums=[1,2,3,4,5,6], k=1) | 2 | maxFrequency(nums=[1,2,3,4,5,6], k=1) == 2 | weekly-contest-434 | 2025-01-26T00:00:00.000 | medium | {
"coverage": null,
"loc": 24
} | 1,520,594,425 | def maxFrequency(nums: List[int], k: int) -> int:
n = len(nums)
k_count = 0
for x in nums:
if x == k:
k_count += 1
answer = k_count
for x in range(1, 51):
curr_k = 0
my_min = 0
x_count = 0
for i in range(n):
if nums[i] == x:
... | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest434_q3751_s2 | 3,751 | maxFrequency | def maxFrequency(nums: List[int], k: int) -> int:
import sys
def count_k_occurrences(nums: List[int], k: int) -> int:
return sum(1 for x in nums if x == k)
def build_array(nums: List[int], k: int, v: int) -> List[int]:
return [1 if x == v else -1 if ... | maxFrequency(nums=[1,2,3,4,5,6], k=1) | 2 | maxFrequency(nums=[1,2,3,4,5,6], k=1) == 2 | weekly-contest-434 | 2025-01-26T00:00:00.000 | medium | {
"coverage": null,
"loc": 40
} | 1,520,602,804 | def maxFrequency(nums: List[int], k: int) -> int:
import sys
def count_k_occurrences(nums: List[int], k: int) -> int:
return sum((1 for x in nums if x == k))
def build_array(nums: List[int], k: int, v: int) -> List[int]:
return [1 if x == v else -1 if x == k else 0 for x in nums]
def ... | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest435_q3753_s0 | 3,753 | maxDifference | def maxDifference(s: str) -> int:
freq = Counter(s)
odd = [c for c in freq.values() if c % 2]
even = [c for c in freq.values() if c % 2 == 0]
return max(odd) - min(even) if odd and even else -1 | maxDifference(s="aaaaabbc") | 3 | maxDifference(s="aaaaabbc") == 3 | weekly-contest-435 | 2025-02-02T00:00:00.000 | easy | {
"coverage": null,
"loc": 5
} | 1,528,081,228 | def maxDifference(s: str) -> int:
freq = Counter(s)
odd = [c for c in freq.values() if c % 2]
even = [c for c in freq.values() if c // 2 == 0]
return max(odd) - min(even) if odd and even else -1 | 4 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest435_q3753_s1 | 3,753 | maxDifference | def maxDifference(s: str) -> int:
count = [0] * 26
for c in s:
count[ord(c) - ord('a')] += 1
odd = -1
even = float('inf')
for x in count:
if x:
if x % 2 == 0:
even = min(even, x)
else:
... | maxDifference(s="aaaaabbc") | 3 | maxDifference(s="aaaaabbc") == 3 | weekly-contest-435 | 2025-02-02T00:00:00.000 | easy | {
"coverage": null,
"loc": 14
} | 1,528,102,981 | def maxDifference(s: str) -> int:
count = [0] * 26
for c in s:
count[ord(c) - ord('a')] += 1
odd = -1
even = float('inf')
for x in count:
if x:
if x // 2 == 0:
even = min(even, x)
else:
odd = max(odd, x)
return odd - even | 4 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest435_q3754_s0 | 3,754 | maxDistance | def maxDistance(s: str, k: int) -> int:
res = 0
e = w = n = s_count = 0
for i, ch in enumerate(s, 1):
if ch == 'E': e += 1
elif ch == 'W': w += 1
elif ch == 'N': n += 1
else: s_count += 1
bx = abs(e - w)
hx = min(e, w)
... | maxDistance(s="NWSE", k=1) | 3 | maxDistance(s="NWSE", k=1) == 3 | weekly-contest-435 | 2025-02-02T00:00:00.000 | medium | {
"coverage": null,
"loc": 16
} | 1,528,089,568 | def maxDistance(s: str, k: int) -> int:
res = 0
e = w = n = s_count = 0
for i, ch in enumerate(s, 1):
if ch == 'E':
e += 1
elif ch == 'W':
w += 1
elif ch == 'N':
n += 1
else:
s_count += 1
bx = abs(e + w)
hx = min... | 4 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest435_q3754_s1 | 3,754 | maxDistance | def maxDistance(s: str, k: int) -> int:
n, a, c = len(s), 0, Counter()
u = lambda x: c.update(x)
d = lambda x, y: abs(c[x] - c[y])
f = lambda x, y: min(c[x], c[y])
for i, x in enumerate(s):
u(x)
dx, dy = d('E', 'W'), d('N', 'S')
... | maxDistance(s="NWSE", k=1) | 3 | maxDistance(s="NWSE", k=1) == 3 | weekly-contest-435 | 2025-02-02T00:00:00.000 | medium | {
"coverage": null,
"loc": 15
} | 1,528,113,622 | def maxDistance(s: str, k: int) -> int:
n, a, c = (len(s), 0, Counter())
u = lambda x: c.update(x)
d = lambda x, y: abs(c[x] + c[y])
f = lambda x, y: min(c[x], c[y])
for i, x in enumerate(s):
u(x)
dx, dy = (d('E', 'W'), d('N', 'S'))
fc = f('E', 'W') + f('N', 'S')
cand... | 4 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest435_q3697_s0 | 3,697 | minimumIncrements | def minimumIncrements(nums: List[int], target: List[int]) -> int:
m = len(target)
full = (1 << m) - 1
subs = []
for s in range(1, 1 << m):
lcm_val = 1
for i in range(m):
if s >> i & 1:
lcm_val = lcm_val * target[i] // gcd(lcm_va... | minimumIncrements(nums=[1,2,3], target=[4]) | 1 | minimumIncrements(nums=[1,2,3], target=[4]) == 1 | weekly-contest-435 | 2025-02-02T00:00:00.000 | hard | {
"coverage": null,
"loc": 24
} | 1,528,091,022 | def minimumIncrements(nums: List[int], target: List[int]) -> int:
m = len(target)
full = (1 << m) - 1
subs = []
for s in range(1, 1 << m):
lcm_val = 1
for i in range(m):
if s >> i & 1:
lcm_val = lcm_val * target[i] // gcd(lcm_val, target[i])
subs.appen... | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 4,
"mutation_type": "arithmetic"
} |
contest435_q3761_s0 | 3,761 | maxDifference | def maxDifference(s: str, k: int) -> int:
INF = 10**9
n = len(s)
ans = -10**9
for x in range(5):
for y in range(5):
if x == y:
continue
N = n + 1
D = [0] * N
PX = [0] * N
PY = ... | maxDifference(s="12233", k=4) | -1 | maxDifference(s="12233", k=4) == -1 | weekly-contest-435 | 2025-02-02T00:00:00.000 | hard | {
"coverage": null,
"loc": 49
} | 1,528,104,807 | def maxDifference(s: str, k: int) -> int:
INF = 10 ** 9
n = len(s)
ans = -10 ** 9
for x in range(5):
for y in range(5):
if x == y:
continue
N = n + 1
D = [0] * N
PX = [0] * N
PY = [0] * N
CNT = [0] * N
... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 5,
"mutation_type": "arithmetic"
} |
contest436_q3748_s0 | 3,748 | sortMatrix | def sortMatrix(grid: List[List[int]]) -> List[List[int]]:
n = len(grid)
x = 0
y = n - 1
while True:
pos = []
cur = 0
while x + cur < n and y + cur < n:
pos.append(grid[x + cur][y + cur])
cur += 1
cur = 0
... | sortMatrix(grid=[[1,7,3],[9,8,2],[4,5,6]]) | [[8, 2, 3], [9, 6, 7], [4, 5, 1]] | sortMatrix(grid=[[1,7,3],[9,8,2],[4,5,6]]) == [[8, 2, 3], [9, 6, 7], [4, 5, 1]] | weekly-contest-436 | 2025-02-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 29
} | 1,536,399,828 | def sortMatrix(grid: List[List[int]]) -> List[List[int]]:
n = len(grid)
x = 0
y = n - 1
while True:
pos = []
cur = 0
while x + cur < n and y + cur < n:
pos.append(grid[x - cur][y + cur])
cur += 1
cur = 0
if y > 0:
pos.sort()
... | [[7, 6, 3], [9, 5, 7], [4, 6, 1]] | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest436_q3748_s1 | 3,748 | sortMatrix | def sortMatrix(grid: List[List[int]]) -> List[List[int]]:
graph = collections.defaultdict(list)
for i in range(len(grid)):
for j in range(len(grid[0])):
graph[i-j].append(grid[i][j])
for key in graph:
if key >= 0:
graph[ke... | sortMatrix(grid=[[1,7,3],[9,8,2],[4,5,6]]) | [[8, 2, 3], [9, 6, 7], [4, 5, 1]] | sortMatrix(grid=[[1,7,3],[9,8,2],[4,5,6]]) == [[8, 2, 3], [9, 6, 7], [4, 5, 1]] | weekly-contest-436 | 2025-02-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 20
} | 1,536,396,372 | def sortMatrix(grid: List[List[int]]) -> List[List[int]]:
graph = collections.defaultdict(list)
for i in range(len(grid)):
for j in range(len(grid[0])):
graph[i - j].append(grid[i][j])
for key in graph:
if key > 0:
graph[key].sort()
else:
graph[key... | [[1, 2, 3], [9, 6, 7], [4, 5, 8]] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest436_q3748_s2 | 3,748 | sortMatrix | def sortMatrix(grid: List[List[int]]) -> List[List[int]]:
n = len(grid)
c = defaultdict(list)
for i in range(n):
for j in range(n):
c[i - j].append(grid[i][j])
for k in c.keys():
if k >= 0:
c[k].sort()
else:
... | sortMatrix(grid=[[1,7,3],[9,8,2],[4,5,6]]) | [[8, 2, 3], [9, 6, 7], [4, 5, 1]] | sortMatrix(grid=[[1,7,3],[9,8,2],[4,5,6]]) == [[8, 2, 3], [9, 6, 7], [4, 5, 1]] | weekly-contest-436 | 2025-02-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 19
} | 1,536,461,192 | def sortMatrix(grid: List[List[int]]) -> List[List[int]]:
n = len(grid)
c = defaultdict(list)
for i in range(n):
for j in range(n):
c[i - j].append(grid[i][j])
for k in c.keys():
if k > 0:
c[k].sort()
else:
c[k].sort(reverse=True)
for i in ... | [[1, 2, 3], [9, 6, 7], [4, 5, 8]] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest436_q3760_s0 | 3,760 | assignElements | def assignElements(groups: List[int], elements: List[int]) -> List[int]:
s = set()
dic = defaultdict(int)
for i, e in enumerate(elements):
if e in s:
continue
t = 1
while e * t <= 100000:
if e * t not in dic:
... | assignElements(groups=[8,4,3,2,4], elements=[4,2]) | [0, 0, -1, 1, 0] | assignElements(groups=[8,4,3,2,4], elements=[4,2]) == [0, 0, -1, 1, 0] | weekly-contest-436 | 2025-02-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 23
} | 1,536,410,003 | def assignElements(groups: List[int], elements: List[int]) -> List[int]:
s = set()
dic = defaultdict(int)
for i, e in enumerate(elements):
if e in s:
continue
t = 1
while e * t <= 100000:
if e // t not in dic:
dic[e * t] = i
t += 1
... | [1, 1, -1, 1, 1] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest436_q3760_s1 | 3,760 | assignElements | def assignElements(groups: List[int], elements: List[int]) -> List[int]:
res = [-1]*len(groups)
max_value = max(groups)
mapper = collections.defaultdict(list)
for i,x in enumerate(groups):
mapper[x].append(i)
seen = set()
... | assignElements(groups=[8,4,3,2,4], elements=[4,2]) | [0, 0, -1, 1, 0] | assignElements(groups=[8,4,3,2,4], elements=[4,2]) == [0, 0, -1, 1, 0] | weekly-contest-436 | 2025-02-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 24
} | 1,536,400,600 | def assignElements(groups: List[int], elements: List[int]) -> List[int]:
res = [-1] * len(groups)
max_value = max(groups)
mapper = collections.defaultdict(list)
for i, x in enumerate(groups):
mapper[x].append(i)
seen = set()
for j in range(len(elements)):
if elements[j] in seen:
... | [-1, 0, -1, 1, 0] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest436_q3760_s2 | 3,760 | assignElements | def assignElements(groups: List[int], elements: List[int]) -> List[int]:
seen = set()
T = max(groups)
pre = [-1] * (T + 1)
for u, e in enumerate(elements):
if e in seen:
continue
seen.add(e)
i = e
while i <= T:
... | assignElements(groups=[8,4,3,2,4], elements=[4,2]) | [0, 0, -1, 1, 0] | assignElements(groups=[8,4,3,2,4], elements=[4,2]) == [0, 0, -1, 1, 0] | weekly-contest-436 | 2025-02-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 18
} | 1,536,457,071 | def assignElements(groups: List[int], elements: List[int]) -> List[int]:
seen = set()
T = max(groups)
pre = [-1] * (T + 1)
for u, e in enumerate(elements):
if e in seen:
continue
seen.add(e)
i = e
while i < T:
if pre[i] == -1:
pre[i... | [-1, 0, -1, 1, 0] | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest436_q3696_s0 | 3,696 | countSubstrings | def countSubstrings(s: str) -> int:
n = len(s)
res = 0
mod3 = [1, 0, 0]
sum3 = 0
mod9 = [1] + [0] * 8
sum9 = 0
mod7 = [1] + [0] * 6
sum7 = 0
pow5 = 1
for i, c in enumerate(s):
d = int(c)
... | countSubstrings(s="12936") | 11 | countSubstrings(s="12936") == 11 | weekly-contest-436 | 2025-02-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 64
} | 1,536,442,634 | def countSubstrings(s: str) -> int:
n = len(s)
res = 0
mod3 = [1, 0, 0]
sum3 = 0
mod9 = [1] + [0] * 8
sum9 = 0
mod7 = [1] + [0] * 6
sum7 = 0
pow5 = 1
for i, c in enumerate(s):
d = int(c)
sum3 = (sum3 + d) % 3
sum9 = (sum9 + d) // 9
sum7 = (sum7 * 1... | 10 | true | {
"coverage_similarity": 0,
"mutation_id": 6,
"mutation_type": "arithmetic"
} |
contest436_q3696_s1 | 3,696 | countSubstrings | def countSubstrings(s: str) -> int:
debug = False
ans = 0
hash_table_3 = collections.defaultdict(int)
hash_table_3[0] += 1
hash_table_9 = collections.defaultdict(int)
hash_table_9[0] += 1
digit_sum_3 = 0
digit_sum_9 = 0
for i,char in enumerate(s... | countSubstrings(s="12936") | 11 | countSubstrings(s="12936") == 11 | weekly-contest-436 | 2025-02-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 77
} | 1,536,459,645 | def countSubstrings(s: str) -> int:
debug = False
ans = 0
hash_table_3 = collections.defaultdict(int)
hash_table_3[0] += 1
hash_table_9 = collections.defaultdict(int)
hash_table_9[0] += 1
digit_sum_3 = 0
digit_sum_9 = 0
for i, char in enumerate(s):
digit_sum_3 += int(char)
... | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest436_q3696_s2 | 3,696 | countSubstrings | def countSubstrings(s: str) -> int:
ans = 0
dp = [[0] * i for i in range(10)]
for i in range(1, 10):
dp[i][0] = 1
for c in s:
num = int(c)
newdp = [[0] * i for i in range(10)]
for i in range(1, 10):
for j in range(i):
... | countSubstrings(s="12936") | 11 | countSubstrings(s="12936") == 11 | weekly-contest-436 | 2025-02-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 18
} | 1,536,441,757 | def countSubstrings(s: str) -> int:
ans = 0
dp = [[0] * i for i in range(10)]
for i in range(1, 10):
dp[i][0] = 1
for c in s:
num = int(c)
newdp = [[0] * i for i in range(10)]
for i in range(1, 10):
for j in range(i):
newdp[i][(j // 10 + num) %... | 15 | true | {
"coverage_similarity": 0,
"mutation_id": 4,
"mutation_type": "arithmetic"
} |
contest436_q3762_s0 | 3,762 | maxScore | def maxScore(points: List[int], m: int) -> int:
n = len(points)
def check(threshold):
needs = [0] * n
for i in range(n):
if threshold == 0:
needs[i] = 0
else:
needs[i] = (threshold - 1) // points[i] + 1
... | maxScore(points=[2,4], m=3) | 4 | maxScore(points=[2,4], m=3) == 4 | weekly-contest-436 | 2025-02-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 36
} | 1,536,475,077 | def maxScore(points: List[int], m: int) -> int:
n = len(points)
def check(threshold):
needs = [0] * n
for i in range(n):
if threshold == 0:
needs[i] = 0
else:
needs[i] = (threshold - 1) // points[i] - 1
count = 0
for i in r... | 6 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest436_q3762_s1 | 3,762 | maxScore | def maxScore(points: List[int], m: int) -> int:
l = 1
r = 10**15
def check(target):
used = 0
forward_count = 0
for i in range(len(points)):
needed = target-forward_count #-points[i]
if needed > 0 o... | maxScore(points=[2,4], m=3) | 4 | maxScore(points=[2,4], m=3) == 4 | weekly-contest-436 | 2025-02-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 42
} | 1,536,483,553 | def maxScore(points: List[int], m: int) -> int:
l = 1
r = 10 ** 15
def check(target):
used = 0
forward_count = 0
for i in range(len(points)):
needed = target + forward_count
if needed > 0 or i + 1 < len(points):
used += 1
neede... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest436_q3762_s2 | 3,762 | maxScore | def maxScore(points: List[int], m: int) -> int:
ans = 0
n = len(points)
left, right = 1, min(points) * (m // 2 + 1)
def ok(num):
index = 0
count = 1
needs = [ (num - 1) // points[i] + 1 for i in range(n)]
needs.append(0)
needs[... | maxScore(points=[2,4], m=3) | 4 | maxScore(points=[2,4], m=3) == 4 | weekly-contest-436 | 2025-02-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 40
} | 1,536,485,434 | def maxScore(points: List[int], m: int) -> int:
ans = 0
n = len(points)
left, right = (1, min(points) // (m // 2 + 1))
def ok(num):
index = 0
count = 1
needs = [(num - 1) // points[i] + 1 for i in range(n)]
needs.append(0)
needs[0] -= 1
fake = 0
w... | 1 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest437_q3709_s0 | 3,709 | hasSpecialSubstring | def hasSpecialSubstring(s: str, k: int) -> bool:
n = len(s)
for i in range(n - k + 1):
if s[i:i+k] == s[i] * k:
if (i == 0 or s[i-1] != s[i]) and (i+k == n or s[i+k] != s[i]):
return True
return False | hasSpecialSubstring(s="aaabaaa", k=3) | True | hasSpecialSubstring(s="aaabaaa", k=3) == True | weekly-contest-437 | 2025-02-16T00:00:00.000 | easy | {
"coverage": null,
"loc": 7
} | 1,544,505,653 | def hasSpecialSubstring(s: str, k: int) -> bool:
n = len(s)
for i in range(n - k + 1):
if s[i:i - k] == s[i] * k:
if (i == 0 or s[i - 1] != s[i]) and (i + k == n or s[i + k] != s[i]):
return True
return False | False | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest437_q3709_s2 | 3,709 | hasSpecialSubstring | def hasSpecialSubstring(s: str, k: int) -> bool:
n = len(s)
for i in range(n - k + 1):
c = s[i]
if all(s[i + j] == c for j in range(k)):
if (i == 0 or s[i - 1] != c) and (i + k == n or s[i + k] != c):
return True
return False | hasSpecialSubstring(s="aaabaaa", k=3) | True | hasSpecialSubstring(s="aaabaaa", k=3) == True | weekly-contest-437 | 2025-02-16T00:00:00.000 | easy | {
"coverage": null,
"loc": 8
} | 1,544,547,904 | def hasSpecialSubstring(s: str, k: int) -> bool:
n = len(s)
for i in range(n - k + 1):
c = s[i]
if all((s[i + j] != c for j in range(k))):
if (i == 0 or s[i - 1] != c) and (i + k == n or s[i + k] != c):
return True
return False | False | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "relational"
} |
contest437_q3779_s0 | 3,779 | maxWeight | def maxWeight(p: List[int]) -> int:
p.sort(reverse=True)
m = len(p) // 4
m1 = (m + 1) // 2
m2 = m - m1
s = sum(p[:m1])
for i in range(m2):
s += p[m1 + 2 * i + 1]
return s | maxWeight(p=[1,2,3,4,5,6,7,8]) | 14 | maxWeight(p=[1,2,3,4,5,6,7,8]) == 14 | weekly-contest-437 | 2025-02-16T00:00:00.000 | medium | {
"coverage": null,
"loc": 9
} | 1,544,509,185 | def maxWeight(p: List[int]) -> int:
p.sort(reverse=True)
m = len(p) // 4
m1 = (m + 1) * 2
m2 = m - m1
s = sum(p[:m1])
for i in range(m2):
s += p[m1 + 2 * i + 1]
return s | 33 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest437_q3779_s2 | 3,779 | maxWeight | def maxWeight(pizzas: List[int]) -> int:
n = len(pizzas)
m = n // 4
if m == 0:
return sum(pizzas)
ocnt = (m + 1) // 2
ecnt = m // 2
d = sorted(pizzas, reverse=True)
tot = 0
p = 0
for _ in range(ocnt):
if p < n:... | maxWeight(pizzas=[1,2,3,4,5,6,7,8]) | 14 | maxWeight(pizzas=[1,2,3,4,5,6,7,8]) == 14 | weekly-contest-437 | 2025-02-16T00:00:00.000 | medium | {
"coverage": null,
"loc": 25
} | 1,544,559,496 | def maxWeight(pizzas: List[int]) -> int:
n = len(pizzas)
m = n * 4
if m == 0:
return sum(pizzas)
ocnt = (m + 1) // 2
ecnt = m // 2
d = sorted(pizzas, reverse=True)
tot = 0
p = 0
for _ in range(ocnt):
if p < n:
tot += d[p]
p += 1
for _ in ra... | 36 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest437_q3771_s0 | 3,771 | maxSubstringLength | def maxSubstringLength(s: str, k: int) -> bool:
if k == 0:
return True
n = len(s)
v = {}
f = {}
l = {}
for i, c in enumerate(s):
v[c] = v.get(c, 0) + 1
if c not in f:
f[c] = i
l[c] = i
ar = []
... | maxSubstringLength(s="abcdbaefab", k=2) | True | maxSubstringLength(s="abcdbaefab", k=2) == True | weekly-contest-437 | 2025-02-16T00:00:00.000 | medium | {
"coverage": null,
"loc": 35
} | 1,544,514,997 | def maxSubstringLength(s: str, k: int) -> bool:
if k == 0:
return True
n = len(s)
v = {}
f = {}
l = {}
for i, c in enumerate(s):
v[c] = v.get(c, 0) + 1
if c not in f:
f[c] = i
l[c] = i
ar = []
for i in range(n):
if i == f[s[i]]:
... | False | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest437_q3771_s2 | 3,771 | maxSubstringLength | def maxSubstringLength(s: str, k: int) -> bool:
n = len(s)
if k == 0:
return True
first = [-1] * 26
last = [-1] * 26
for i in range(n):
c = ord(s[i]) - ord('a')
if first[c] == -1:
first[c] = i
last[c] = i
... | maxSubstringLength(s="abcdbaefab", k=2) | True | maxSubstringLength(s="abcdbaefab", k=2) == True | weekly-contest-437 | 2025-02-16T00:00:00.000 | medium | {
"coverage": null,
"loc": 40
} | 1,544,552,595 | def maxSubstringLength(s: str, k: int) -> bool:
n = len(s)
if k == 0:
return True
first = [-1] * 26
last = [-1] * 26
for i in range(n):
c = ord(s[i]) - ord('a')
if first[c] != -1:
first[c] = i
last[c] = i
ivals = []
for i in range(n):
if i ... | False | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest437_q3733_s0 | 3,733 | lenOfVDiagonal | def lenOfVDiagonal(g: List[List[int]]) -> int:
n = len(g)
m = len(g[0])
ds = [(1, 1), (1, -1), (-1, -1), (-1, 1)]
t = [1, 2, 3, 0]
nx = [1, 2, 1]
ex = [1, 2, 0]
dp = [[[[0] * m for _ in range(n)] for _ in range(3)] for _ in range(4)]
for i, (a, b) in enume... | lenOfVDiagonal(g=[[2,2,1,2,2],[2,0,2,2,0],[2,0,1,1,0],[1,0,2,2,2],[2,0,0,2,2]]) | 5 | lenOfVDiagonal(g=[[2,2,1,2,2],[2,0,2,2,0],[2,0,1,1,0],[1,0,2,2,2],[2,0,0,2,2]]) == 5 | weekly-contest-437 | 2025-02-16T00:00:00.000 | hard | {
"coverage": null,
"loc": 67
} | 1,544,524,131 | def lenOfVDiagonal(g: List[List[int]]) -> int:
n = len(g)
m = len(g[0])
ds = [(1, 1), (1, -1), (-1, -1), (-1, 1)]
t = [1, 2, 3, 0]
nx = [1, 2, 1]
ex = [1, 2, 0]
dp = [[[[0] * m for _ in range(n)] for _ in range(3)] for _ in range(4)]
for i, (a, b) in enumerate(ds):
rr = range(n -... | 4 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest437_q3733_s2 | 3,733 | lenOfVDiagonal | def lenOfVDiagonal(grid: List[List[int]]) -> int:
n, m = len(grid), len(grid[0])
dirs = [(1, 1), (1, -1), (-1, 1), (-1, -1)]
dp = [[[[0] * m for i in range(n)] for j in range(3)] for k in range(4)]
for d in range(4):
dr, dc = dirs[d]
si, ei, sti = (n - 1,... | lenOfVDiagonal(grid=[[2,2,1,2,2],[2,0,2,2,0],[2,0,1,1,0],[1,0,2,2,2],[2,0,0,2,2]]) | 5 | lenOfVDiagonal(grid=[[2,2,1,2,2],[2,0,2,2,0],[2,0,1,1,0],[1,0,2,2,2],[2,0,0,2,2]]) == 5 | weekly-contest-437 | 2025-02-16T00:00:00.000 | hard | {
"coverage": null,
"loc": 47
} | 1,544,546,030 | def lenOfVDiagonal(grid: List[List[int]]) -> int:
n, m = (len(grid), len(grid[0]))
dirs = [(1, 1), (1, -1), (-1, 1), (-1, -1)]
dp = [[[[0] * m for i in range(n)] for j in range(3)] for k in range(4)]
for d in range(4):
dr, dc = dirs[d]
si, ei, sti = (n - 1, -1, -1) if dr == 1 else (0, n,... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest438_q3768_s0 | 3,768 | hasSameDigits | def hasSameDigits(s: str) -> bool:
n = len(s)
if n == 2:
return (s[0] == s[1])
digits = list(map(int, s))
N = n - 2
binom_mod5 = [[0]*5 for _ in range(5)]
for i in range(5):
binom_mod5[i][0] = 1
for j in range(1, i+1):
... | hasSameDigits(s="3902") | True | hasSameDigits(s="3902") == True | weekly-contest-438 | 2025-02-23T00:00:00.000 | easy | {
"coverage": null,
"loc": 50
} | 1,552,284,205 | def hasSameDigits(s: str) -> bool:
n = len(s)
if n == 2:
return s[0] == s[1]
digits = list(map(int, s))
N = n - 2
binom_mod5 = [[0] * 5 for _ in range(5)]
for i in range(5):
binom_mod5[i][0] = 1
for j in range(1, i - 1):
from math import comb
binom... | False | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest438_q3768_s1 | 3,768 | hasSameDigits | def hasSameDigits(s: str) -> bool:
while len(s)!=2:
res=""
for i in range(1,len(s)):
res+=str(int(s[i])+int(s[i-1]))[-1]
s=res
return len(set(s))==1 | hasSameDigits(s="3902") | True | hasSameDigits(s="3902") == True | weekly-contest-438 | 2025-02-23T00:00:00.000 | easy | {
"coverage": null,
"loc": 7
} | 1,552,268,304 | def hasSameDigits(s: str) -> bool:
while len(s) != 2:
res = ''
for i in range(1, len(s)):
res += str(int(s[i]) - int(s[i - 1]))[-1]
s = res
return len(set(s)) == 1 | False | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest438_q3768_s2 | 3,768 | hasSameDigits | def hasSameDigits(s: str) -> bool:
while len(s) > 2:
s = "".join(
str((int(s[i]) + int(s[i + 1])) % 10) for i in range(len(s) - 1)
)
return s[0] == s[1]
| hasSameDigits(s="3902") | True | hasSameDigits(s="3902") == True | weekly-contest-438 | 2025-02-23T00:00:00.000 | easy | {
"coverage": null,
"loc": 6
} | 1,552,267,009 | def hasSameDigits(s: str) -> bool:
while len(s) > 2:
s = ''.join((str((int(s[i]) - int(s[i + 1])) % 10) for i in range(len(s) - 1)))
return s[0] == s[1] | False | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest438_q3764_s0 | 3,764 | maxSum | def maxSum(grid: List[List[int]], limits: List[int], k: int) -> int:
n, m = len(grid), len(grid[0])
sorted_rows = []
for i in range(n):
row = [(val, j) for j, val in enumerate(grid[i])]
row.sort(reverse=True)
sorted_rows.append(r... | maxSum(grid=[[1,2],[3,4]], limits=[1,2], k=2) | 7 | maxSum(grid=[[1,2],[3,4]], limits=[1,2], k=2) == 7 | weekly-contest-438 | 2025-02-23T00:00:00.000 | medium | {
"coverage": null,
"loc": 35
} | 1,552,280,360 | def maxSum(grid: List[List[int]], limits: List[int], k: int) -> int:
n, m = (len(grid), len(grid[0]))
sorted_rows = []
for i in range(n):
row = [(val, j) for j, val in enumerate(grid[i])]
row.sort(reverse=True)
sorted_rows.append(row)
heap = []
for i in range(n):
if l... | 9 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest438_q3764_s1 | 3,764 | maxSum | def maxSum(grid: List[List[int]], limits: List[int], k: int) -> int:
a = [(sorted(x,reverse=True)[:limits[i]]) for i,x in enumerate(grid)]
b=[]
for x in a:b.extend(x)
a=b.copy()
# print(a)
return sum(sorted(a,reverse=True)[:k]) | maxSum(grid=[[1,2],[3,4]], limits=[1,2], k=2) | 7 | maxSum(grid=[[1,2],[3,4]], limits=[1,2], k=2) == 7 | weekly-contest-438 | 2025-02-23T00:00:00.000 | medium | {
"coverage": null,
"loc": 7
} | 1,552,272,249 | def maxSum(grid: List[List[int]], limits: List[int], k: int) -> int:
a = [sorted(x, reverse=True)[:limits[i]] for i, x in enumerate(grid)]
b = []
for x in a:
b.extend(x)
a = b.copy()
return sum(sorted(a, reverse=False)[:k]) | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "keyword"
} |
contest438_q3764_s2 | 3,764 | maxSum | def maxSum(grid: List[List[int]], limits: List[int], k: int) -> int:
arr = []
for i, r in enumerate(grid):
t = sorted(r, reverse=True)[:limits[i]]
arr += t
arr.sort(reverse=True)
ans = sum(arr[:k])
# print(arr)
return ans | maxSum(grid=[[1,2],[3,4]], limits=[1,2], k=2) | 7 | maxSum(grid=[[1,2],[3,4]], limits=[1,2], k=2) == 7 | weekly-contest-438 | 2025-02-23T00:00:00.000 | medium | {
"coverage": null,
"loc": 14
} | 1,552,278,791 | def maxSum(grid: List[List[int]], limits: List[int], k: int) -> int:
arr = []
for i, r in enumerate(grid):
t = sorted(r, reverse=True)[:limits[i]]
arr += t
arr.sort(reverse=False)
ans = sum(arr[:k])
return ans | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "keyword"
} |
contest438_q3774_s0 | 3,774 | hasSameDigits | def hasSameDigits(s: str) -> bool:
n = len(s)
if n == 2:
return (s[0] == s[1])
digits = list(map(int, s))
N = n - 2
binom_mod5 = [[0]*5 for _ in range(5)]
for i in range(5):
binom_mod5[i][0] = 1
for j in range(1, i+1):
... | hasSameDigits(s="3902") | True | hasSameDigits(s="3902") == True | weekly-contest-438 | 2025-02-23T00:00:00.000 | hard | {
"coverage": null,
"loc": 50
} | 1,552,283,804 | def hasSameDigits(s: str) -> bool:
n = len(s)
if n == 2:
return s[0] == s[1]
digits = list(map(int, s))
N = n - 2
binom_mod5 = [[0] * 5 for _ in range(5)]
for i in range(5):
binom_mod5[i][0] = 1
for j in range(1, i - 1):
from math import comb
binom... | False | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest438_q3774_s2 | 3,774 | hasSameDigits | def hasSameDigits(s: str) -> bool:
arr = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 1, 4, 1]]
def c2(n, k):
return 1 if (n & k) == k else 0
def c5(n, k):
if k > n:
return 0
if n < 5:
return arr[n][k]
if k % 5 ... | hasSameDigits(s="3902") | True | hasSameDigits(s="3902") == True | weekly-contest-438 | 2025-02-23T00:00:00.000 | hard | {
"coverage": null,
"loc": 36
} | 1,552,295,122 | def hasSameDigits(s: str) -> bool:
arr = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 1, 4, 1]]
def c2(n, k):
return 1 if n & k == k else 0
def c5(n, k):
if k > n:
return 0
if n < 5:
return arr[n][k]
if k % 5 > n % 5:
return 0
re... | False | true | {
"coverage_similarity": 0,
"mutation_id": 8,
"mutation_type": "arithmetic"
} |
contest438_q3781_s1 | 3,781 | maxDistance | def maxDistance(s: int, p: List[List[int]], k: int) -> int:
peri = 4 * s
arr = []
for x, y in p:
if x == 0: pos = y
elif y == s: pos = s + x
elif x == s: pos = 3 * s - y
else: pos = 4 * s - x
arr.append(pos)
arr.sort()
l... | maxDistance(s=2, p=[[0,2],[2,0],[2,2],[0,0]], k=4) | 2 | maxDistance(s=2, p=[[0,2],[2,0],[2,2],[0,0]], k=4) == 2 | weekly-contest-438 | 2025-02-23T00:00:00.000 | hard | {
"coverage": null,
"loc": 31
} | 1,552,295,764 | def maxDistance(s: int, p: List[List[int]], k: int) -> int:
peri = 4 // s
arr = []
for x, y in p:
if x == 0:
pos = y
elif y == s:
pos = s + x
elif x == s:
pos = 3 * s - y
else:
pos = 4 * s - x
arr.append(pos)
arr.sor... | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest438_q3781_s2 | 3,781 | maxDistance | def maxDistance(side: int, points: List[List[int]], k: int) -> int:
_side = side
arr = []
for x, y in points:
if y == 0:
arr.append(x)
elif x == _side:
arr.append(_side + y)
elif y == _side:
arr.append(3 * _side... | maxDistance(side=2, points=[[0,2],[2,0],[2,2],[0,0]], k=4) | 2 | maxDistance(side=2, points=[[0,2],[2,0],[2,2],[0,0]], k=4) == 2 | weekly-contest-438 | 2025-02-23T00:00:00.000 | hard | {
"coverage": null,
"loc": 58
} | 1,552,312,689 | def maxDistance(side: int, points: List[List[int]], k: int) -> int:
_side = side
arr = []
for x, y in points:
if y == 0:
arr.append(x)
elif x == _side:
arr.append(_side - y)
elif y == _side:
arr.append(3 * _side - x)
else:
arr.a... | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest439_q3705_s1 | 3,705 | largestInteger | def largestInteger(nums: List[int], k: int) -> int:
count = {}
for i in range(len(nums)-k+1):
n = set(nums[i:i+k])
for x in n:
count[x] = count.get(x,0)+1
seq = [x for x,v in count.items() if v == 1]
return max(seq) if len(seq)>0 else -1 | largestInteger(nums=[3,9,2,1,7], k=3) | 7 | largestInteger(nums=[3,9,2,1,7], k=3) == 7 | weekly-contest-439 | 2025-03-02T00:00:00.000 | easy | {
"coverage": null,
"loc": 8
} | 1,559,815,348 | def largestInteger(nums: List[int], k: int) -> int:
count = {}
for i in range(len(nums) - k - 1):
n = set(nums[i:i + k])
for x in n:
count[x] = count.get(x, 0) + 1
seq = [x for x, v in count.items() if v == 1]
return max(seq) if len(seq) > 0 else -1 | 9 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest439_q3705_s2 | 3,705 | largestInteger | def largestInteger(nums: List[int], k: int) -> int:
freq = defaultdict(int)
n = len(nums)
for i in range(n - k + 1):
subarray = nums[i:i + k]
unique_elements = set(subarray)
for num in unique_elements:
freq[num] += 1
result = -1
... | largestInteger(nums=[3,9,2,1,7], k=3) | 7 | largestInteger(nums=[3,9,2,1,7], k=3) == 7 | weekly-contest-439 | 2025-03-02T00:00:00.000 | easy | {
"coverage": null,
"loc": 16
} | 1,559,813,970 | def largestInteger(nums: List[int], k: int) -> int:
freq = defaultdict(int)
n = len(nums)
for i in range(n - k - 1):
subarray = nums[i:i + k]
unique_elements = set(subarray)
for num in unique_elements:
freq[num] += 1
result = -1
for num, count in freq.items():
... | 9 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest439_q3786_s1 | 3,786 | longestPalindromicSubsequence | def longestPalindromicSubsequence(s: str, k: int) -> int:
from functools import lru_cache
def cost(a: str, b: str) -> int:
diff = abs(ord(a) - ord(b))
return min(diff, 26 - diff)
n = len(s)
@lru_cache(maxsize=None)
def dp(i: int,... | longestPalindromicSubsequence(s="abced", k=2) | 3 | longestPalindromicSubsequence(s="abced", k=2) == 3 | weekly-contest-439 | 2025-03-02T00:00:00.000 | medium | {
"coverage": null,
"loc": 22
} | 1,559,826,888 | def longestPalindromicSubsequence(s: str, k: int) -> int:
from functools import lru_cache
def cost(a: str, b: str) -> int:
diff = abs(ord(a) + ord(b))
return min(diff, 26 - diff)
n = len(s)
@lru_cache(maxsize=None)
def dp(i: int, j: int, t: int) -> int:
if i > j:
... | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest439_q3786_s2 | 3,786 | longestPalindromicSubsequence | def longestPalindromicSubsequence(s: str, k: int) -> int:
n = len(s)
d = lambda x,y:min((x-y)%26,(y-x)%26)
pc = [[0]*26 for _ in range(26)]
for x in range(26):
for y in range(26):
pc[x][y] = min(d(x,c)+d(y,c) for c in range(26))
... | longestPalindromicSubsequence(s="abced", k=2) | 3 | longestPalindromicSubsequence(s="abced", k=2) == 3 | weekly-contest-439 | 2025-03-02T00:00:00.000 | medium | {
"coverage": null,
"loc": 26
} | 1,559,817,253 | def longestPalindromicSubsequence(s: str, k: int) -> int:
n = len(s)
d = lambda x, y: min((x - y) % 26, (y - x) % 26)
pc = [[0] * 26 for _ in range(26)]
for x in range(26):
for y in range(26):
pc[x][y] = min((d(x, c) + d(y, c) for c in range(26)))
dp = [[[0] * (k + 1) for _ in ra... | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 9,
"mutation_type": "arithmetic"
} |
contest439_q3722_s1 | 3,722 | maxSum | def maxSum(nums: List[int], k: int, m: int) -> int:
n = len(nums)
P = [0] * (n + 1)
for i in range(1, n + 1):
P[i] = P[i - 1] + nums[i - 1]
dp = [[float('-inf')] * (k + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for j in range(1,... | maxSum(nums=[1,2,-1,3,3,4], k=2, m=2) | 13 | maxSum(nums=[1,2,-1,3,3,4], k=2, m=2) == 13 | weekly-contest-439 | 2025-03-02T00:00:00.000 | medium | {
"coverage": null,
"loc": 15
} | 1,559,833,753 | def maxSum(nums: List[int], k: int, m: int) -> int:
n = len(nums)
P = [0] * (n + 1)
for i in range(1, n - 1):
P[i] = P[i - 1] + nums[i - 1]
dp = [[float('-inf')] * (k + 1) for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = 0
for j in range(1, k + 1):
best = float('-... | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest439_q3722_s2 | 3,722 | maxSum | def maxSum(nums: List[int], k: int, m: int) -> int:
n = len(nums)
prefix = [0] * (n + 1)
for i in range(1, n + 1):
prefix[i] = prefix[i - 1] + nums[i - 1]
dp = [[float("-inf")] * (k + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i ... | maxSum(nums=[1,2,-1,3,3,4], k=2, m=2) | 13 | maxSum(nums=[1,2,-1,3,3,4], k=2, m=2) == 13 | weekly-contest-439 | 2025-03-02T00:00:00.000 | medium | {
"coverage": null,
"loc": 27
} | 1,559,828,565 | def maxSum(nums: List[int], k: int, m: int) -> int:
n = len(nums)
prefix = [0] * (n + 1)
for i in range(1, n - 1):
prefix[i] = prefix[i - 1] + nums[i - 1]
dp = [[float('-inf')] * (k + 1) for _ in range(n + 1)]
dp[0][0] = 0
for i in range(1, n + 1):
dp[i][0] = 0
for j in range... | 5 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest439_q3770_s1 | 3,770 | generateString | def generateString(str1: str, str2: str) -> str:
n, m = len(str1), len(str2)
L = n + m - 1
word = [None] * L
fixed = [False] * L
for i in range(n):
if str1[i] == 'T':
for j in range(m):
pos = i + j
if word[pos] ... | generateString(str1="TFTF", str2="ab") | 'ababa' | generateString(str1="TFTF", str2="ab") == 'ababa' | weekly-contest-439 | 2025-03-02T00:00:00.000 | hard | {
"coverage": null,
"loc": 36
} | 1,559,842,202 | def generateString(str1: str, str2: str) -> str:
n, m = (len(str1), len(str2))
L = n + m + 1
word = [None] * L
fixed = [False] * L
for i in range(n):
if str1[i] == 'T':
for j in range(m):
pos = i + j
if word[pos] is not None and word[pos] != str2[j... | 'ababaaa' | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest439_q3770_s2 | 3,770 | generateString | def generateString(str1: str, str2: str) -> str:
n, m = len(str1), len(str2)
L = n + m - 1
res = [None] * L
free = [True] * L
for i in range(n):
if str1[i] == 'T':
for j in range(m):
pos = i + j
c = str2... | generateString(str1="TFTF", str2="ab") | 'ababa' | generateString(str1="TFTF", str2="ab") == 'ababa' | weekly-contest-439 | 2025-03-02T00:00:00.000 | hard | {
"coverage": null,
"loc": 42
} | 1,559,848,310 | def generateString(str1: str, str2: str) -> str:
n, m = (len(str1), len(str2))
L = n + m + 1
res = [None] * L
free = [True] * L
for i in range(n):
if str1[i] == 'T':
for j in range(m):
pos = i + j
c = str2[j]
if res[pos] is None:
... | 'ababaaa' | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "arithmetic"
} |
contest440_q3790_s0 | 3,790 | numOfUnplacedFruits | def numOfUnplacedFruits(f: List[int], b: List[int]) -> int:
n = len(f)
u = [0]*n
c = 0
for x in f:
p = 0
for i in range(n):
if not u[i] and b[i] >= x:
u[i] = 1
p = 1
break
if n... | numOfUnplacedFruits(f=[4,2,5], b=[3,5,4]) | 1 | numOfUnplacedFruits(f=[4,2,5], b=[3,5,4]) == 1 | weekly-contest-440 | 2025-03-09T00:00:00.000 | easy | {
"coverage": null,
"loc": 14
} | 1,567,562,189 | def numOfUnplacedFruits(f: List[int], b: List[int]) -> int:
n = len(f)
u = [0] * n
c = 0
for x in f:
p = 0
for i in range(n):
if not u[i] or b[i] >= x:
u[i] = 1
p = 1
break
if not p:
c += 1
return c | 0 | true | {
"coverage_similarity": 0,
"mutation_id": 0,
"mutation_type": "logical"
} |
contest440_q3790_s1 | 3,790 | numOfUnplacedFruits | def numOfUnplacedFruits(fruits: List[int], baskets: List[int]) -> int:
n = len(fruits)
usedBaskets = [False] * n
placedFruits = [False] * n
for i in range(n):
fruitQty = fruits[i]
leftmostBasket = -1
for j in range(n):
... | numOfUnplacedFruits(fruits=[4,2,5], baskets=[3,5,4]) | 1 | numOfUnplacedFruits(fruits=[4,2,5], baskets=[3,5,4]) == 1 | weekly-contest-440 | 2025-03-09T00:00:00.000 | easy | {
"coverage": null,
"loc": 21
} | 1,567,552,337 | def numOfUnplacedFruits(fruits: List[int], baskets: List[int]) -> int:
n = len(fruits)
usedBaskets = [False] * n
placedFruits = [False] * n
for i in range(n):
fruitQty = fruits[i]
leftmostBasket = -1
for j in range(n):
if not usedBaskets[j] and baskets[j] >= fruitQty:... | 3 | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "relational"
} |
contest440_q3790_s2 | 3,790 | numOfUnplacedFruits | def numOfUnplacedFruits(a: List[int], b: List[int]) -> int:
n = len(a)
m = 1 << ((n - 1).bit_length())
t = [-1] * (2 * m)
for i in range(n):
t[m + i] = b[i]
for i in range(m - 1, 0, -1):
t[i] = max(t[2 * i], t[2 * i + 1])
def ... | numOfUnplacedFruits(a=[4,2,5], b=[3,5,4]) | 1 | numOfUnplacedFruits(a=[4,2,5], b=[3,5,4]) == 1 | weekly-contest-440 | 2025-03-09T00:00:00.000 | easy | {
"coverage": null,
"loc": 32
} | 1,567,581,598 | def numOfUnplacedFruits(a: List[int], b: List[int]) -> int:
n = len(a)
m = 1 << (n - 1).bit_length()
t = [-1] * (2 * m)
for i in range(n):
t[m - i] = b[i]
for i in range(m - 1, 0, -1):
t[i] = max(t[2 * i], t[2 * i + 1])
def u(i, v):
i += m
t[i] = v
i //= ... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest440_q3759_s0 | 3,759 | findMaxSum | def findMaxSum(a: List[int], b: List[int], k: int) -> List[int]:
import heapq
n=len(a)
L=[(a[i],b[i],i) for i in range(n)]
L.sort(key=lambda x:x[0])
r=[0]*n
h=[]
s=0
i=0
while i<n:
v=L[i][0]
j=i
while j<n and L[j... | findMaxSum(a=[4,2,1,5,3], b=[10,20,30,40,50], k=2) | [80, 30, 0, 80, 50] | findMaxSum(a=[4,2,1,5,3], b=[10,20,30,40,50], k=2) == [80, 30, 0, 80, 50] | weekly-contest-440 | 2025-03-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 25
} | 1,567,561,194 | def findMaxSum(a: List[int], b: List[int], k: int) -> List[int]:
import heapq
n = len(a)
L = [(a[i], b[i], i) for i in range(n)]
L.sort(key=lambda x: x[0])
r = [0] * n
h = []
s = 0
i = 0
while i < n:
v = L[i][0]
j = i
while j < n and L[j][0] == v:
... | [120, 30, 0, 120, 50] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest440_q3759_s1 | 3,759 | findMaxSum | def findMaxSum(nums1, nums2, k):
n = len(nums1)
pairArr = []
i = 0
while i < n:
pairArr.append((nums1[i], nums2[i], i))
i += 1
pairArr.sort(key=lambda x: x[0])
ans = [0] * n
heap = []
currentSum = 0
i = 0
while i < n... | findMaxSum(nums1=[4,2,1,5,3], nums2=[10,20,30,40,50], k=2) | [80, 30, 0, 80, 50] | findMaxSum(nums1=[4,2,1,5,3], nums2=[10,20,30,40,50], k=2) == [80, 30, 0, 80, 50] | weekly-contest-440 | 2025-03-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 32
} | 1,567,558,204 | def findMaxSum(nums1, nums2, k):
n = len(nums1)
pairArr = []
i = 0
while i < n:
pairArr.append((nums1[i], nums2[i], i))
i += 1
pairArr.sort(key=lambda x: x[0])
ans = [0] * n
heap = []
currentSum = 0
i = 0
while i < n:
j = i
while j < n and pairArr[... | [50, 30, 0, 50, 30] | true | {
"coverage_similarity": 0,
"mutation_id": 6,
"mutation_type": "relational"
} |
contest440_q3759_s2 | 3,759 | findMaxSum | def findMaxSum(a: List[int], b: List[int], k: int) -> List[int]:
n = len(a)
P = sorted(zip(a, b, range(n)), key=lambda x: x[0])
R = [0] * n
h, s = [], 0
i = 0
while i < n:
j = i
while j < n and P[j][0] == P[i][0]:
R[P[j][2]] = s
... | findMaxSum(a=[4,2,1,5,3], b=[10,20,30,40,50], k=2) | [80, 30, 0, 80, 50] | findMaxSum(a=[4,2,1,5,3], b=[10,20,30,40,50], k=2) == [80, 30, 0, 80, 50] | weekly-contest-440 | 2025-03-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 20
} | 1,567,577,211 | def findMaxSum(a: List[int], b: List[int], k: int) -> List[int]:
n = len(a)
P = sorted(zip(a, b, range(n)), key=lambda x: x[0])
R = [0] * n
h, s = ([], 0)
i = 0
while i < n:
j = i
while j < n and P[j][0] == P[i][0]:
R[P[j][2]] = s
j += 1
for _, y, ... | [120, 30, 0, 120, 50] | true | {
"coverage_similarity": 0,
"mutation_id": 1,
"mutation_type": "arithmetic"
} |
contest440_q3791_s0 | 3,791 | numOfUnplacedFruits | def numOfUnplacedFruits(f: List[int], b: List[int]) -> int:
n = len(b)
s = 1
while s < n: s *= 2
t = [0]*(2*s)
for i in range(n): t[s+i] = b[i]
for i in range(s-1, 0, -1): t[i] = max(t[2*i], t[2*i+1])
c = 0
for x in f:
if t[1] < x:
... | numOfUnplacedFruits(f=[4,2,5], b=[3,5,4]) | 1 | numOfUnplacedFruits(f=[4,2,5], b=[3,5,4]) == 1 | weekly-contest-440 | 2025-03-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 25
} | 1,567,552,448 | def numOfUnplacedFruits(f: List[int], b: List[int]) -> int:
n = len(b)
s = 1
while s < n:
s *= 2
t = [0] * (2 * s)
for i in range(n):
t[s - i] = b[i]
for i in range(s - 1, 0, -1):
t[i] = max(t[2 * i], t[2 * i + 1])
c = 0
for x in f:
if t[1] < x:
... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest440_q3791_s1 | 3,791 | numOfUnplacedFruits | def numOfUnplacedFruits(fruits, baskets):
n = len(baskets)
treeSize = 1
while treeSize < n:
treeSize *= 2
tree = [0] * (2 * treeSize)
i = 0
while i < n:
tree[treeSize + i] = baskets[i]
i += 1
i = n
while i < treeSize:
... | numOfUnplacedFruits(fruits=[4,2,5], baskets=[3,5,4]) | 1 | numOfUnplacedFruits(fruits=[4,2,5], baskets=[3,5,4]) == 1 | weekly-contest-440 | 2025-03-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 57
} | 1,567,569,757 | def numOfUnplacedFruits(fruits, baskets):
n = len(baskets)
treeSize = 1
while treeSize < n:
treeSize *= 2
tree = [0] * (2 * treeSize)
i = 0
while i < n:
tree[treeSize - i] = baskets[i]
i += 1
i = n
while i < treeSize:
tree[treeSize + i] = 0
i += 1
... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 2,
"mutation_type": "arithmetic"
} |
contest440_q3791_s2 | 3,791 | numOfUnplacedFruits | def numOfUnplacedFruits(a: List[int], b: List[int]) -> int:
n = len(a)
m = 1 << ((n - 1).bit_length())
t = [-1] * (2 * m)
for i in range(n):
t[m + i] = b[i]
for i in range(m - 1, 0, -1):
t[i] = max(t[2 * i], t[2 * i + 1])
def ... | numOfUnplacedFruits(a=[4,2,5], b=[3,5,4]) | 1 | numOfUnplacedFruits(a=[4,2,5], b=[3,5,4]) == 1 | weekly-contest-440 | 2025-03-09T00:00:00.000 | medium | {
"coverage": null,
"loc": 32
} | 1,567,582,045 | def numOfUnplacedFruits(a: List[int], b: List[int]) -> int:
n = len(a)
m = 1 << (n - 1).bit_length()
t = [-1] * (2 * m)
for i in range(n):
t[m - i] = b[i]
for i in range(m - 1, 0, -1):
t[i] = max(t[2 * i], t[2 * i + 1])
def u(i, v):
i += m
t[i] = v
i //= ... | 2 | true | {
"coverage_similarity": 0,
"mutation_id": 3,
"mutation_type": "arithmetic"
} |
contest440_q3789_s0 | 3,789 | maxSubarrays | def maxSubarrays(n: int, r: List[List[int]]) -> int:
for i in range(len(r)):
a, b = r[i]
if a > b:
r[i] = [b, a]
M = [[] for _ in range(n+1)]
for a, b in r:
M[a].append(b)
for i in range(1, n+1):
M[i].sort()
D = [Non... | maxSubarrays(n=4, r=[[2,3],[1,4]]) | 9 | maxSubarrays(n=4, r=[[2,3],[1,4]]) == 9 | weekly-contest-440 | 2025-03-09T00:00:00.000 | hard | {
"coverage": null,
"loc": 53
} | 1,567,558,598 | def maxSubarrays(n: int, r: List[List[int]]) -> int:
for i in range(len(r)):
a, b = r[i]
if a > b:
r[i] = [b, a]
M = [[] for _ in range(n + 1)]
for a, b in r:
M[a].append(b)
for i in range(1, n + 1):
M[i].sort()
D = [None] * (n + 2)
D[n + 1] = (n + 1, ... | 7 | true | {
"coverage_similarity": 0,
"mutation_id": 7,
"mutation_type": "arithmetic"
} |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4