code stringlengths 51 912 | input stringlengths 11 330 | output stringlengths 0 266 | prompt_token_length int64 59 615 | execution_time float64 0.04 6.03k | prompt stringlengths 255 1.16k |
|---|---|---|---|---|---|
def function(n: int, mines: List[List[int]]) -> int:
dp = [[n] * n for _ in range(n)]
for x, y in mines:
dp[x][y] = 0
for i in range(n):
left = right = up = down = 0
for j, k in zip(range(n), reversed(range(n))):
left = left + 1 if dp[i][j] else 0
right = righ... | function(1, [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]) | 0 | 323 | 2.756155 |
Code:
def function(n: int, mines: List[List[int]]) -> int:
dp = [[n] * n for _ in range(n)]
for x, y in mines:
dp[x][y] = 0
for i in range(n):
left = right = up = down = 0
for j, k in zip(range(n), reversed(range(n))):
left = left + 1 if dp[i][j] else 0
right... |
def function(arr: List[int]) -> int:
mx = ans = 0
for i, v in enumerate(arr):
mx = max(mx, v)
if i == mx:
ans += 1
return ans | function([3, 7, 4, 5, 8, 6, 2, 0, 9, 1]) | 1 | 122 | 1.451536 |
Code:
def function(arr: List[int]) -> int:
mx = ans = 0
for i, v in enumerate(arr):
mx = max(mx, v)
if i == mx:
ans += 1
return ans
Evaluate this code with the following inputs :
function([3, 7, 4, 5, 8, 6, 2, 0, 9, 1])
Please evaluate the code with the given inputs and provid... |
def function(n: int, k: int) -> int:
return (k - 1).bit_count() & 1 | function(30, 247860610) | 0 | 77 | 0.081804 |
Code:
def function(n: int, k: int) -> int:
return (k - 1).bit_count() & 1
Evaluate this code with the following inputs :
function(30, 247860610)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output or excecute code.
|
def function(poured: int, query_row: int, query_glass: int) -> float:
f = [[0] * 101 for _ in range(101)]
f[0][0] = poured
for i in range(query_row + 1):
for j in range(i + 1):
if f[i][j] > 1:
half = (f[i][j] - 1) / 2
f[i][j] = 1
f[i + 1][j... | function(66, 29, 28) | 0 | 194 | 61.17784 |
Code:
def function(poured: int, query_row: int, query_glass: int) -> float:
f = [[0] * 101 for _ in range(101)]
f[0][0] = poured
for i in range(query_row + 1):
for j in range(i + 1):
if f[i][j] > 1:
half = (f[i][j] - 1) / 2
f[i][j] = 1
f[i... |
def function(nums1: List[int], nums2: List[int]) -> int:
a, b = 0, 1
for i in range(1, len(nums1)):
x, y = a, b
if nums1[i - 1] >= nums1[i] or nums2[i - 1] >= nums2[i]:
a, b = y, x + 1
else:
b = y + 1
if nums1[i - 1] < nums2[i] and nums2[i - 1] < nums1... | function([33776, 48778, 19310, 3970, 34293, 97966, 54230, 29560, 30903, 28341], [17704, 43296, 89973, 82548, 66898, 72316, 51665, 40455, 96730, 87689]) | 4 | 272 | 1.55236 |
Code:
def function(nums1: List[int], nums2: List[int]) -> int:
a, b = 0, 1
for i in range(1, len(nums1)):
x, y = a, b
if nums1[i - 1] >= nums1[i] or nums2[i - 1] >= nums2[i]:
a, b = y, x + 1
else:
b = y + 1
if nums1[i - 1] < nums2[i] and nums2[i - 1] ... |
def function(grid: List[List[int]]) -> int:
rmx = [max(row) for row in grid]
cmx = [max(col) for col in zip(*grid)]
return sum(
(min(rmx[i], cmx[j]) - grid[i][j])
for i in range(len(grid))
for j in range(len(grid[0]))
) | function([[23, 88, 74, 22, 49, 78], [68, 48, 80, 7, 32, 93], [41, 38, 51, 66, 56, 73], [89, 100, 13, 55, 17, 37], [8, 43, 57, 3, 34, 25], [62, 94, 70, 72, 13, 61]]) | 850 | 229 | 10.102377 |
Code:
def function(grid: List[List[int]]) -> int:
rmx = [max(row) for row in grid]
cmx = [max(col) for col in zip(*grid)]
return sum(
(min(rmx[i], cmx[j]) - grid[i][j])
for i in range(len(grid))
for j in range(len(grid[0]))
)
Evaluate this code with the following inputs :
funct... |
def function(arr: List[int]) -> int:
mod = 10**9 + 7
n = len(arr)
arr.sort()
idx = {v: i for i, v in enumerate(arr)}
f = [1] * n
for i, a in enumerate(arr):
for j in range(i):
b = arr[j]
if a % b == 0 and (c := (a // b)) in idx:
f[i] = (f[i] + f[j]... | function([234496704, 237744866, 267125838, 283186556, 287504080, 396525072, 659771819, 684854197, 989145421, 990101069]) | 10 | 217 | 4.425739 |
Code:
def function(arr: List[int]) -> int:
mod = 10**9 + 7
n = len(arr)
arr.sort()
idx = {v: i for i, v in enumerate(arr)}
f = [1] * n
for i, a in enumerate(arr):
for j in range(i):
b = arr[j]
if a % b == 0 and (c := (a // b)) in idx:
f[i] = (f[i]... |
def function(s: str) -> int:
d = defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
ans = 0
for v in d.values():
v = [-1] + v + [len(s)]
for i in range(1, len(v) - 1):
ans += (v[i] - v[i - 1]) * (v[i + 1] - v[i])
return ans | function('FMFLWPGNIP') | 192 | 151 | 4.799116 |
Code:
def function(s: str) -> int:
d = defaultdict(list)
for i, c in enumerate(s):
d[c].append(i)
ans = 0
for v in d.values():
v = [-1] + v + [len(s)]
for i in range(1, len(v) - 1):
ans += (v[i] - v[i - 1]) * (v[i + 1] - v[i])
return ans
Evaluate this code with ... |
def function(dominoes: str) -> str:
n = len(dominoes)
q = deque()
time = [-1] * n
force = defaultdict(list)
for i, f in enumerate(dominoes):
if f != '.':
q.append(i)
time[i] = 0
force[i].append(f)
ans = ['.'] * n
while q:
i = q.popleft()
... | function(['.', '.', 'L', '.', 'R', '.', 'L', 'L', '.', 'L']) | LLL.R.LLLL | 268 | 3.970719 |
Code:
def function(dominoes: str) -> str:
n = len(dominoes)
q = deque()
time = [-1] * n
force = defaultdict(list)
for i, f in enumerate(dominoes):
if f != '.':
q.append(i)
time[i] = 0
force[i].append(f)
ans = ['.'] * n
while q:
i = q.pople... |
def function(arr: List[int]) -> int:
n = len(arr)
ans = l = 0
while l + 2 < n:
r = l + 1
if arr[l] < arr[r]:
while r + 1 < n and arr[r] < arr[r + 1]:
r += 1
if r < n - 1 and arr[r] > arr[r + 1]:
while r < n - 1 and arr[r] > arr[r + 1]:
... | function([47, 100, 48, 83, 27, 96, 58, 22, 72, 68]) | 4 | 221 | 1.495178 |
Code:
def function(arr: List[int]) -> int:
n = len(arr)
ans = l = 0
while l + 2 < n:
r = l + 1
if arr[l] < arr[r]:
while r + 1 < n and arr[r] < arr[r + 1]:
r += 1
if r < n - 1 and arr[r] > arr[r + 1]:
while r < n - 1 and arr[r] > arr[r... |
def function(grid: List[List[int]]) -> int:
m, n = len(grid), len(grid[0])
for i in range(m):
if grid[i][0] == 0:
for j in range(n):
grid[i][j] ^= 1
ans = 0
for j in range(n):
cnt = sum(grid[i][j] for i in range(m))
ans += max(cnt, m - cnt) * (1 << (n ... | function([[1, 1, 1, 0, 1, 0], [1, 0, 1, 1, 0, 0], [1, 0, 1, 0, 0, 0], [1, 0, 1, 0, 1, 1], [1, 0, 1, 0, 0, 1], [1, 0, 0, 0, 0, 1]]) | 343 | 262 | 5.522343 |
Code:
def function(grid: List[List[int]]) -> int:
m, n = len(grid), len(grid[0])
for i in range(m):
if grid[i][0] == 0:
for j in range(n):
grid[i][j] ^= 1
ans = 0
for j in range(n):
cnt = sum(grid[i][j] for i in range(m))
ans += max(cnt, m - cnt) * (1... |
def function(n: int) -> int:
ans, j = 0, -1
for i in range(32):
if n & 1:
if j != -1:
ans = max(ans, i - j)
j = i
n >>= 1
return ans | function(926349811) | 3 | 113 | 4.260477 |
Code:
def function(n: int) -> int:
ans, j = 0, -1
for i in range(32):
if n & 1:
if j != -1:
ans = max(ans, i - j)
j = i
n >>= 1
return ans
Evaluate this code with the following inputs :
function(926349811)
Please evaluate the code with the given inp... |
def function(nums1: List[int], nums2: List[int]) -> List[int]:
nums1.sort()
t = sorted((v, i) for i, v in enumerate(nums2))
n = len(nums2)
ans = [0] * n
i, j = 0, n - 1
for v in nums1:
if v <= t[i][0]:
ans[t[j][1]] = v
j -= 1
else:
ans[t[i][1]]... | function([23, 27, 28, 46, 49, 70, 79, 86, 91, 98], [99, 80, 22, 45, 64, 37, 83, 1, 100, 92]) | [79, 86, 27, 49, 70, 46, 91, 23, 28, 98] | 226 | 2.254488 |
Code:
def function(nums1: List[int], nums2: List[int]) -> List[int]:
nums1.sort()
t = sorted((v, i) for i, v in enumerate(nums2))
n = len(nums2)
ans = [0] * n
i, j = 0, n - 1
for v in nums1:
if v <= t[i][0]:
ans[t[j][1]] = v
j -= 1
else:
ans[t... |
def function(arr: List[int]) -> int:
mp = {v: i for i, v in enumerate(arr)}
n = len(arr)
dp = [[0] * n for _ in range(n)]
for i in range(n):
for j in range(i):
dp[j][i] = 2
ans = 0
for i in range(n):
for j in range(i):
d = arr[i] - arr[j]
if d ... | function([25, 29, 42, 45, 55, 57, 68, 69, 77, 95]) | 0 | 222 | 7.943552 |
Code:
def function(arr: List[int]) -> int:
mp = {v: i for i, v in enumerate(arr)}
n = len(arr)
dp = [[0] * n for _ in range(n)]
for i in range(n):
for j in range(i):
dp[j][i] = 2
ans = 0
for i in range(n):
for j in range(i):
d = arr[i] - arr[j]
... |
def function(people: List[int], limit: int) -> int:
people.sort()
ans = 0
i, j = 0, len(people) - 1
while i <= j:
if people[i] + people[j] <= limit:
i += 1
j -= 1
ans += 1
return ans | function([12, 14, 31, 34, 35, 46, 62, 76, 94, 99], 102) | 6 | 155 | 0.555232 |
Code:
def function(people: List[int], limit: int) -> int:
people.sort()
ans = 0
i, j = 0, len(people) - 1
while i <= j:
if people[i] + people[j] <= limit:
i += 1
j -= 1
ans += 1
return ans
Evaluate this code with the following inputs :
function([12, 14, 31, 34, ... |
def function(aliceSizes: List[int], bobSizes: List[int]) -> List[int]:
diff = (sum(aliceSizes) - sum(bobSizes)) >> 1
s = set(bobSizes)
for a in aliceSizes:
target = a - diff
if target in s:
return [a, target] | function([84, 97, 82, 11, 80, 28, 33, 46, 70], [20, 62, 43, 57, 37, 59, 45, 31, 27, 44]) | [84, 31] | 171 | 0.681833 |
Code:
def function(aliceSizes: List[int], bobSizes: List[int]) -> List[int]:
diff = (sum(aliceSizes) - sum(bobSizes)) >> 1
s = set(bobSizes)
for a in aliceSizes:
target = a - diff
if target in s:
return [a, target]
Evaluate this code with the following inputs :
function([84, 97... |
def function(nums: List[int]) -> int:
mod = 10**9 + 7
nums.sort()
ans, p = 0, 1
for i, v in enumerate(nums):
ans = (ans + (v - nums[-i - 1]) * p) % mod
p = (p << 1) % mod
return ans | function([13, 16, 26, 35, 37, 49, 51, 63, 68, 78]) | 52099 | 154 | 1.835061 |
Code:
def function(nums: List[int]) -> int:
mod = 10**9 + 7
nums.sort()
ans, p = 0, 1
for i, v in enumerate(nums):
ans = (ans + (v - nums[-i - 1]) * p) % mod
p = (p << 1) % mod
return ans
Evaluate this code with the following inputs :
function([13, 16, 26, 35, 37, 49, 51, 63, 68, 7... |
def function(arr: List[int]) -> int:
s = {0}
ans = set()
for x in arr:
s = {x | y for y in s} | {x}
ans |= s
return len(ans) | function([91, 37, 50, 53, 86, 48, 18, 75, 100, 78]) | 17 | 124 | 4.980898 |
Code:
def function(arr: List[int]) -> int:
s = {0}
ans = set()
for x in arr:
s = {x | y for y in s} | {x}
ans |= s
return len(ans)
Evaluate this code with the following inputs :
function([91, 37, 50, 53, 86, 48, 18, 75, 100, 78])
Please evaluate the code with the given inputs and prov... |
def function(s: str) -> int:
mod = 10**9 + 7
n = len(s)
f = [1] + [0] * n
for i, c in enumerate(s, 1):
pre = 0
g = [0] * (n + 1)
if c == "D":
for j in range(i, -1, -1):
pre = (pre + f[j]) % mod
g[j] = pre
else:
for j... | function('DDDIIIDDIIIIDDIDIDIDIDDDIIDDDIDDIIDDDDDDIDDDIDDDIIIIDDDDDDDIIIIIIIDIDIDIDDDIIIDIDDIIIIIDDIIDIDIIDIIIDIDDDIIIIIIIDDDDIDIIDIDDIIIIDIIIDDDIDIIIDDDIIIIIIIDIIIDIDIDDDDIDDIDIDDDDDDIIIIIDIDIIDIIIDIIIDIIDIIDI') | 688396850 | 287 | 1,619.575585 |
Code:
def function(s: str) -> int:
mod = 10**9 + 7
n = len(s)
f = [1] + [0] * n
for i, c in enumerate(s, 1):
pre = 0
g = [0] * (n + 1)
if c == "D":
for j in range(i, -1, -1):
pre = (pre + f[j]) % mod
g[j] = pre
else:
... |
def function(fruits: List[int]) -> int:
cnt = Counter()
j = 0
for x in fruits:
cnt[x] += 1
if len(cnt) > 2:
y = fruits[j]
cnt[y] -= 1
if cnt[y] == 0:
cnt.pop(y)
j += 1
return len(fruits) - j | function([2, 2, 5, 4, 3, 2, 3, 4, 5, 4]) | 3 | 159 | 4.294845 |
Code:
def function(fruits: List[int]) -> int:
cnt = Counter()
j = 0
for x in fruits:
cnt[x] += 1
if len(cnt) > 2:
y = fruits[j]
cnt[y] -= 1
if cnt[y] == 0:
cnt.pop(y)
j += 1
return len(fruits) - j
Evaluate this code with t... |
def function(nums: List[int], k: int) -> int:
nums.sort()
ans = nums[-1] - nums[0]
for i in range(1, len(nums)):
mi = min(nums[0] + k, nums[i] - k)
mx = max(nums[i - 1] + k, nums[-1] - k)
ans = min(ans, mx - mi)
return ans | function([19, 22, 29, 33, 35, 62, 84, 91, 93, 99], 100) | 80 | 166 | 3.808221 |
Code:
def function(nums: List[int], k: int) -> int:
nums.sort()
ans = nums[-1] - nums[0]
for i in range(1, len(nums)):
mi = min(nums[0] + k, nums[i] - k)
mx = max(nums[i - 1] + k, nums[-1] - k)
ans = min(ans, mx - mi)
return ans
Evaluate this code with the following inputs :
fu... |
def function(n: int, goal: int, k: int) -> int:
mod = 10**9 + 7
f = [[0] * (n + 1) for _ in range(goal + 1)]
f[0][0] = 1
for i in range(1, goal + 1):
for j in range(1, n + 1):
f[i][j] = f[i - 1][j - 1] * (n - j + 1)
if j > k:
f[i][j] += f[i - 1][j] * (j - ... | function(10, 11, 4) | 76204800 | 208 | 20.951202 |
Code:
def function(n: int, goal: int, k: int) -> int:
mod = 10**9 + 7
f = [[0] * (n + 1) for _ in range(goal + 1)]
f[0][0] = 1
for i in range(1, goal + 1):
for j in range(1, n + 1):
f[i][j] = f[i - 1][j - 1] * (n - j + 1)
if j > k:
f[i][j] += f[i - 1][j] ... |
def function(s: str) -> int:
ans = cnt = 0
for c in s:
if c == '(':
cnt += 1
elif cnt:
cnt -= 1
else:
ans += 1
ans += cnt
return ans | function("())(())()(") | 2 | 111 | 0.373872 |
Code:
def function(s: str) -> int:
ans = cnt = 0
for c in s:
if c == '(':
cnt += 1
elif cnt:
cnt -= 1
else:
ans += 1
ans += cnt
return ans
Evaluate this code with the following inputs :
function("())(())()(")
Please evaluate the code with th... |
def function(s: str) -> int:
n = len(s)
left, right = [0] * (n + 1), [0] * (n + 1)
ans = 0x3F3F3F3F
for i in range(1, n + 1):
left[i] = left[i - 1] + (1 if s[i - 1] == '1' else 0)
for i in range(n - 1, -1, -1):
right[i] = right[i + 1] + (1 if s[i] == '0' else 0)
for i in range(0,... | function('1100011100') | 4 | 216 | 3.337378 |
Code:
def function(s: str) -> int:
n = len(s)
left, right = [0] * (n + 1), [0] * (n + 1)
ans = 0x3F3F3F3F
for i in range(1, n + 1):
left[i] = left[i - 1] + (1 if s[i - 1] == '1' else 0)
for i in range(n - 1, -1, -1):
right[i] = right[i + 1] + (1 if s[i] == '0' else 0)
for i in r... |
def function(n: int) -> int:
if n == 1:
return 10
f = [1] * 10
for _ in range(n - 1):
t = [0] * 10
t[0] = f[4] + f[6]
t[1] = f[6] + f[8]
t[2] = f[7] + f[9]
t[3] = f[4] + f[8]
t[4] = f[0] + f[3] + f[9]
t[6] = f[0] + f[1] + f[7]
t[7] = f[... | function(10) | 14912 | 259 | 3.756653 |
Code:
def function(n: int) -> int:
if n == 1:
return 10
f = [1] * 10
for _ in range(n - 1):
t = [0] * 10
t[0] = f[4] + f[6]
t[1] = f[6] + f[8]
t[2] = f[7] + f[9]
t[3] = f[4] + f[8]
t[4] = f[0] + f[3] + f[9]
t[6] = f[0] + f[1] + f[7]
t[... |
def function(s: str) -> int:
mod = 10**9 + 7
dp = [0] * 26
ans = 0
for c in s:
i = ord(c) - ord('a')
add = ans - dp[i] + 1
ans = (ans + add) % mod
dp[i] += add
return ans | function('nzfiylrgyr') | 927 | 135 | 1.388965 |
Code:
def function(s: str) -> int:
mod = 10**9 + 7
dp = [0] * 26
ans = 0
for c in s:
i = ord(c) - ord('a')
add = ans - dp[i] + 1
ans = (ans + add) % mod
dp[i] += add
return ans
Evaluate this code with the following inputs :
function('nzfiylrgyr')
Please evaluate th... |
def function(s: str) -> List[int]:
n = len(s)
low, high = 0, n
ans = []
for i in range(n):
if s[i] == 'I':
ans.append(low)
low += 1
else:
ans.append(high)
high -= 1
ans.append(low)
return ans | function("IDIDDDDIDD") | [0, 10, 1, 9, 8, 7, 6, 2, 5, 4, 3] | 127 | 0.785713 |
Code:
def function(s: str) -> List[int]:
n = len(s)
low, high = 0, n
ans = []
for i in range(n):
if s[i] == 'I':
ans.append(low)
low += 1
else:
ans.append(high)
high -= 1
ans.append(low)
return ans
Evaluate this code with the foll... |
def function(nums: List[int]) -> int:
nums.sort()
ans = 0
for i in range(1, len(nums)):
if nums[i] <= nums[i - 1]:
d = nums[i - 1] - nums[i] + 1
nums[i] += d
ans += d
return ans | function([26, 27, 39, 50, 65, 74, 84, 85, 92, 93]) | 0 | 147 | 0.611078 |
Code:
def function(nums: List[int]) -> int:
nums.sort()
ans = 0
for i in range(1, len(nums)):
if nums[i] <= nums[i - 1]:
d = nums[i - 1] - nums[i] + 1
nums[i] += d
ans += d
return ans
Evaluate this code with the following inputs :
function([26, 27, 39, 50, 6... |
def function(tokens: List[int], power: int) -> int:
tokens.sort()
i, j = 0, len(tokens) - 1
ans = t = 0
while i <= j:
if power >= tokens[i]:
power -= tokens[i]
i, t = i + 1, t + 1
ans = max(ans, t)
elif t:
power += tokens[j]
j, ... | function([13, 17, 41, 59, 63, 75, 80, 85, 88, 95], 199) | 5 | 192 | 1.575992 |
Code:
def function(tokens: List[int], power: int) -> int:
tokens.sort()
i, j = 0, len(tokens) - 1
ans = t = 0
while i <= j:
if power >= tokens[i]:
power -= tokens[i]
i, t = i + 1, t + 1
ans = max(ans, t)
elif t:
power += tokens[j]
... |
def function(deck: List[int]) -> List[int]:
q = deque()
for v in sorted(deck, reverse=True):
if q:
q.appendleft(q.pop())
q.appendleft(v)
return list(q) | function([84, 79, 4, 34, 40, 22, 42, 100, 71, 52, 13]) | [4, 79, 13, 52, 22, 100, 34, 71, 40, 84, 42] | 122 | 1.264032 |
Code:
def function(deck: List[int]) -> List[int]:
q = deque()
for v in sorted(deck, reverse=True):
if q:
q.appendleft(q.pop())
q.appendleft(v)
return list(q)
Evaluate this code with the following inputs :
function([84, 79, 4, 34, 40, 22, 42, 100, 71, 52, 13])
Please evaluate t... |
def function(points: List[List[int]], k: int) -> List[List[int]]:
points.sort(key=lambda p: p[0] * p[0] + p[1] * p[1])
return points[:k] | function([[1588, 2272], [-5524, 2695], [-5935, -2982], [6412, 2076], [5200, -5123], [3723, -8441], [-9828, -2392], [-5553, -8583], [6187, -9765], [9991, -6397]], 6) | [[1588, 2272], [-5524, 2695], [-5935, -2982], [6412, 2076], [5200, -5123], [3723, -8441]] | 173 | 1.633523 |
Code:
def function(points: List[List[int]], k: int) -> List[List[int]]:
points.sort(key=lambda p: p[0] * p[0] + p[1] * p[1])
return points[:k]
Evaluate this code with the following inputs :
function([[1588, 2272], [-5524, 2695], [-5935, -2982], [6412, 2076], [5200, -5123], [3723, -8441], [-9828, -2392], [-555... |
def function(nums: List[int]) -> int:
nums.sort()
for i in range(len(nums) - 1, 1, -1):
if (c := nums[i - 1] + nums[i - 2]) > nums[i]:
return c + nums[i]
return 0 | function([142224, 202373, 316583, 482517, 700753, 707226, 788111, 789361, 868900, 879026]) | 2537287 | 147 | 0.372862 |
Code:
def function(nums: List[int]) -> int:
nums.sort()
for i in range(len(nums) - 1, 1, -1):
if (c := nums[i - 1] + nums[i - 2]) > nums[i]:
return c + nums[i]
return 0
Evaluate this code with the following inputs :
function([142224, 202373, 316583, 482517, 700753, 707226, 788111, 7893... |
def function(nums: List[int]) -> List[int]:
n = len(nums)
res = [0] * n
i, j, k = 0, n - 1, n - 1
while i <= j:
if nums[i] * nums[i] > nums[j] * nums[j]:
res[k] = nums[i] * nums[i]
i += 1
else:
res[k] = nums[j] * nums[j]
j -= 1
k -=... | function([-9195, -8783, -8589, -7560, -4852, -4588, -4266, 1797, 3107, 9610]) | [3229209, 9653449, 18198756, 21049744, 23541904, 57153600, 73770921, 77141089, 84548025, 92352100] | 199 | 1.439642 |
Code:
def function(nums: List[int]) -> List[int]:
n = len(nums)
res = [0] * n
i, j, k = 0, n - 1, n - 1
while i <= j:
if nums[i] * nums[i] > nums[j] * nums[j]:
res[k] = nums[i] * nums[i]
i += 1
else:
res[k] = nums[j] * nums[j]
j -= 1
... |
def function(a: int, b: int) -> str:
ans = []
while a and b:
if a > b:
ans.append('aab')
a, b = a - 2, b - 1
elif a < b:
ans.append('bba')
a, b = a - 1, b - 2
else:
ans.append('ab')
a, b = a - 1, b - 1
if a:
... | function(44, 100) | bbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbabbbbbbbbbbbb | 181 | 3.249963 |
Code:
def function(a: int, b: int) -> str:
ans = []
while a and b:
if a > b:
ans.append('aab')
a, b = a - 2, b - 1
elif a < b:
ans.append('bba')
a, b = a - 1, b - 2
else:
ans.append('ab')
a, b = a - 1, b - 1
if ... |
def function(startValue: int, target: int) -> int:
ans = 0
while startValue < target:
if target & 1:
target += 1
else:
target >>= 1
ans += 1
ans += startValue - target
return ans | function(97, 100) | 48 | 114 | 0.12099 |
Code:
def function(startValue: int, target: int) -> int:
ans = 0
while startValue < target:
if target & 1:
target += 1
else:
target >>= 1
ans += 1
ans += startValue - target
return ans
Evaluate this code with the following inputs :
function(97, 100)
Ple... |
def function(nums: List[int], k: int) -> int:
n = len(nums)
d = [0] * (n + 1)
ans = s = 0
for i, x in enumerate(nums):
s += d[i]
if x % 2 == s % 2:
if i + k > n:
return -1
d[i] += 1
d[i + k] -= 1
s += 1
ans += 1
... | function([0, 1, 1, 1, 1, 1, 0, 1, 0, 1], 10) | -1 | 189 | 0.550652 |
Code:
def function(nums: List[int], k: int) -> int:
n = len(nums)
d = [0] * (n + 1)
ans = s = 0
for i, x in enumerate(nums):
s += d[i]
if x % 2 == s % 2:
if i + k > n:
return -1
d[i] += 1
d[i + k] -= 1
s += 1
an... |
def function(nums: List[int], k: int) -> int:
l = r = -1
while r < len(nums) - 1:
r += 1
if nums[r] == 0:
k -= 1
if k < 0:
l += 1
if nums[l] == 0:
k += 1
return r - l | function([1, 1, 0, 1, 0, 1, 0, 0, 0, 1], 1) | 4 | 162 | 0.886004 |
Code:
def function(nums: List[int], k: int) -> int:
l = r = -1
while r < len(nums) - 1:
r += 1
if nums[r] == 0:
k -= 1
if k < 0:
l += 1
if nums[l] == 0:
k += 1
return r - l
Evaluate this code with the following inputs :
function([... |
def function(nums: List[int], k: int) -> int:
cnt = Counter(nums)
for x in range(-100, 0):
if cnt[x]:
m = min(cnt[x], k)
cnt[x] -= m
cnt[-x] += m
k -= m
if k == 0:
break
if k & 1 and cnt[0] == 0:
for x in range(1, 10... | function([-71, -30, -73, -91, -83, -73, -89, -66, -89, -53], 46) | 718 | 214 | 19.58439 |
Code:
def function(nums: List[int], k: int) -> int:
cnt = Counter(nums)
for x in range(-100, 0):
if cnt[x]:
m = min(cnt[x], k)
cnt[x] -= m
cnt[-x] += m
k -= m
if k == 0:
break
if k & 1 and cnt[0] == 0:
for x in rang... |
def function(n: int) -> int:
if n == 0:
return 1
ans = 0
find = False
for i in range(30, -1, -1):
b = n & (1 << i)
if not find and b == 0:
continue
find = True
if b == 0:
ans |= 1 << i
return ans | function(156369708) | 112065747 | 139 | 2.812572 |
Code:
def function(n: int) -> int:
if n == 0:
return 1
ans = 0
find = False
for i in range(30, -1, -1):
b = n & (1 << i)
if not find and b == 0:
continue
find = True
if b == 0:
ans |= 1 << i
return ans
Evaluate this code with the foll... |
def function(values: List[int]) -> int:
ans, mx = 0, values[0]
for j in range(1, len(values)):
ans = max(ans, values[j] - j + mx)
mx = max(mx, values[j] + j)
return ans | function([930, 961, 691, 481, 783, 330, 683, 720, 322, 809]) | 1890 | 134 | 2.678362 |
Code:
def function(values: List[int]) -> int:
ans, mx = 0, values[0]
for j in range(1, len(values)):
ans = max(ans, values[j] - j + mx)
mx = max(mx, values[j] + j)
return ans
Evaluate this code with the following inputs :
function([930, 961, 691, 481, 783, 330, 683, 720, 322, 809])
Please... |
def function(nums: List[int]) -> int:
n = len(nums)
f = [[1] * 1001 for _ in range(n)]
ans = 0
for i in range(1, n):
for k in range(i):
j = nums[i] - nums[k] + 500
f[i][j] = max(f[i][j], f[k][j] + 1)
ans = max(ans, f[i][j])
return ans | function([131, 329, 490, 336, 305, 38, 348, 415, 225, 352]) | 2 | 177 | 34.595058 |
Code:
def function(nums: List[int]) -> int:
n = len(nums)
f = [[1] * 1001 for _ in range(n)]
ans = 0
for i in range(1, n):
for k in range(i):
j = nums[i] - nums[k] + 500
f[i][j] = max(f[i][j], f[k][j] + 1)
ans = max(ans, f[i][j])
return ans
Evaluate this... |
def function(nums1: List[int], nums2: List[int]) -> int:
m, n = len(nums1), len(nums2)
dp = [[0] * (n + 1) for i in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if nums1[i - 1] == nums2[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
... | function([197, 67, 166, 57, 191, 33, 60, 168, 126, 185], [168, 158, 184, 16, 40, 110, 164, 183, 179, 18]) | 1 | 252 | 21.552909 |
Code:
def function(nums1: List[int], nums2: List[int]) -> int:
m, n = len(nums1), len(nums2)
dp = [[0] * (n + 1) for i in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if nums1[i - 1] == nums2[j - 1]:
dp[i][j] = dp[i - 1][j - 1] + 1
else:
... |
def function(stones: List[int]) -> List[int]:
stones.sort()
mi = n = len(stones)
mx = max(stones[-1] - stones[1] + 1, stones[-2] - stones[0] + 1) - (n - 1)
i = 0
for j, x in enumerate(stones):
while x - stones[i] + 1 > n:
i += 1
if j - i + 1 == n - 1 and x - stones[i] == ... | function([19, 24, 32, 37, 46, 66, 85, 86, 89, 98]) | [7, 66] | 229 | 2.773476 |
Code:
def function(stones: List[int]) -> List[int]:
stones.sort()
mi = n = len(stones)
mx = max(stones[-1] - stones[1] + 1, stones[-2] - stones[0] + 1) - (n - 1)
i = 0
for j, x in enumerate(stones):
while x - stones[i] + 1 > n:
i += 1
if j - i + 1 == n - 1 and x - stones... |
def function(arr: List[int], k: int) -> int:
n = len(arr)
f = [0] * (n + 1)
for i in range(1, n + 1):
mx = 0
for j in range(i, max(0, i - k), -1):
mx = max(mx, arr[j - 1])
f[i] = max(f[i], f[j - 1] + mx * (i - j + 1))
return f[n] | function([456264235, 875303310, 373016857, 362596550, 859241137, 199645340, 383503337, 321189848, 698876438, 494921318, 755451716], 11) | 9628336410 | 212 | 23.533678 |
Code:
def function(arr: List[int], k: int) -> int:
n = len(arr)
f = [0] * (n + 1)
for i in range(1, n + 1):
mx = 0
for j in range(i, max(0, i - k), -1):
mx = max(mx, arr[j - 1])
f[i] = max(f[i], f[j - 1] + mx * (i - j + 1))
return f[n]
Evaluate this code with th... |
def function(stones: List[int]) -> int:
s = sum(stones)
m, n = len(stones), s >> 1
dp = [0] * (n + 1)
for v in stones:
for j in range(n, v - 1, -1):
dp[j] = max(dp[j], dp[j - v] + v)
return s - dp[-1] * 2 | function([7, 98, 19, 60, 40, 26, 71, 20, 94, 25, 2, 97, 74, 48, 80, 47, 32, 92, 51, 1, 28, 49, 61, 55, 57, 38, 70, 90, 34, 21]) | 1 | 226 | 3,081.633787 |
Code:
def function(stones: List[int]) -> int:
s = sum(stones)
m, n = len(stones), s >> 1
dp = [0] * (n + 1)
for v in stones:
for j in range(n, v - 1, -1):
dp[j] = max(dp[j], dp[j - v] + v)
return s - dp[-1] * 2
Evaluate this code with the following inputs :
function([7, 98, 19,... |
def function(arr: List[int]) -> List[int]:
n = len(arr)
for i in range(n - 1, 0, -1):
if arr[i - 1] > arr[i]:
for j in range(n - 1, i - 1, -1):
if arr[j] < arr[i - 1] and arr[j] != arr[j - 1]:
arr[i - 1], arr[j] = arr[j], arr[i - 1]
ret... | function([72, 49, 60, 37, 96, 71, 81, 27, 18, 100]) | [72, 49, 60, 37, 96, 71, 81, 18, 27, 100] | 185 | 0.589636 |
Code:
def function(arr: List[int]) -> List[int]:
n = len(arr)
for i in range(n - 1, 0, -1):
if arr[i - 1] > arr[i]:
for j in range(n - 1, i - 1, -1):
if arr[j] < arr[i - 1] and arr[j] != arr[j - 1]:
arr[i - 1], arr[j] = arr[j], arr[i - 1]
... |
def function(prices: List[str], target: int) -> str:
mi = 0
arr = []
for p in prices:
p = float(p)
mi += int(p)
if d := p - int(p):
arr.append(d)
if not mi <= target <= mi + len(arr):
return "-1"
d = target - mi
arr.sort(reverse=True)
ans = d - sum... | function(['168.000', '573.000', '105.000', '572.000', '152.000', '471.000', '995.000', '581.000', '900.000', '982.000', '611.000'], 601603) | -1 | 212 | 2.859115 |
Code:
def function(prices: List[str], target: int) -> str:
mi = 0
arr = []
for p in prices:
p = float(p)
mi += int(p)
if d := p - int(p):
arr.append(d)
if not mi <= target <= mi + len(arr):
return "-1"
d = target - mi
arr.sort(reverse=True)
ans = ... |
def function(s: str) -> int:
n = len(s)
dp = [[0] * n for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i + 1, n):
if s[i] == s[j]:
dp[i][j] = dp[i - 1][j - 1] + 1 if i else 1
ans = max(ans, dp[i][j])
return ans | function("kxxuogtvju") | 1 | 154 | 5.331866 |
Code:
def function(s: str) -> int:
n = len(s)
dp = [[0] * n for _ in range(n)]
ans = 0
for i in range(n):
for j in range(i + 1, n):
if s[i] == s[j]:
dp[i][j] = dp[i - 1][j - 1] + 1 if i else 1
ans = max(ans, dp[i][j])
return ans
Evaluate this cod... |
def function(s: str) -> str:
last = {c: i for i, c in enumerate(s)}
stk = []
vis = set()
for i, c in enumerate(s):
if c in vis:
continue
while stk and stk[-1] > c and last[stk[-1]] > i:
vis.remove(stk.pop())
stk.append(c)
vis.add(c)
return "".j... | function('vxyeshedpv') | vxyeshdp | 143 | 2.032994 |
Code:
def function(s: str) -> str:
last = {c: i for i, c in enumerate(s)}
stk = []
vis = set()
for i, c in enumerate(s):
if c in vis:
continue
while stk and stk[-1] > c and last[stk[-1]] > i:
vis.remove(stk.pop())
stk.append(c)
vis.add(c)
retu... |
def function(str1: str, str2: str) -> str:
m, n = len(str1), len(str2)
f = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if str1[i - 1] == str2[j - 1]:
f[i][j] = f[i - 1][j - 1] + 1
else:
f[i][j] = ma... | function('rhwdxwloiq', 'rszmgkpiwhq') | rszmgkpiwhwdxwloiq | 352 | 28.415031 |
Code:
def function(str1: str, str2: str) -> str:
m, n = len(str1), len(str2)
f = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if str1[i - 1] == str2[j - 1]:
f[i][j] = f[i - 1][j - 1] + 1
else:
f[i][... |
def function(s: str, k: int) -> int:
n = len(s)
if k > n or k > 26:
return 0
ans = j = 0
cnt = Counter()
for i, c in enumerate(s):
cnt[c] += 1
while cnt[c] > 1 or i - j + 1 > k:
cnt[s[j]] -= 1
j += 1
ans += i - j + 1 == k
return ans | function('zqhhbstceiuuwiliwaqt', 10) | 0 | 170 | 9.613292 |
Code:
def function(s: str, k: int) -> int:
n = len(s)
if k > n or k > 26:
return 0
ans = j = 0
cnt = Counter()
for i, c in enumerate(s):
cnt[c] += 1
while cnt[c] > 1 or i - j + 1 > k:
cnt[s[j]] -= 1
j += 1
ans += i - j + 1 == k
return ans
... |
def function(arr1: List[int], arr2: List[int]) -> List[int]:
pos = {x: i for i, x in enumerate(arr2)}
return sorted(arr1, key=lambda x: pos.get(x, 1000 + x)) | function([255, 288, 36, 861, 772, 816, 662, 669, 813, 45], [255, 813, 45, 861, 772, 288, 662, 36, 816, 669]) | [255, 813, 45, 861, 772, 288, 662, 36, 816, 669] | 155 | 1.999653 |
Code:
def function(arr1: List[int], arr2: List[int]) -> List[int]:
pos = {x: i for i, x in enumerate(arr2)}
return sorted(arr1, key=lambda x: pos.get(x, 1000 + x))
Evaluate this code with the following inputs :
function([255, 288, 36, 861, 772, 816, 662, 669, 813, 45], [255, 813, 45, 861, 772, 288, 662, 36, 8... |
def function(arr: List[int]) -> int:
n = len(arr)
f = [[0] * n for _ in range(n)]
g = [[0] * n for _ in range(n)]
for i in range(n - 1, -1, -1):
g[i][i] = arr[i]
for j in range(i + 1, n):
g[i][j] = max(g[i][j - 1], arr[j])
f[i][j] = min(
f[i][k] + ... | function([7, 5, 10, 10, 12, 3, 10, 4, 8, 15, 13, 2, 4, 6, 7, 9, 9, 1, 9, 6, 13, 1, 3, 12, 2, 11, 9, 13, 6, 13, 15, 10, 12, 15, 12, 15, 8, 14, 14, 15]) | 4372 | 322 | 1,779.793304 |
Code:
def function(arr: List[int]) -> int:
n = len(arr)
f = [[0] * n for _ in range(n)]
g = [[0] * n for _ in range(n)]
for i in range(n - 1, -1, -1):
g[i][i] = arr[i]
for j in range(i + 1, n):
g[i][j] = max(g[i][j - 1], arr[j])
f[i][j] = min(
f[i... |
def function(text1: str, text2: str) -> int:
m, n = len(text1), len(text2)
f = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if text1[i - 1] == text2[j - 1]:
f[i][j] = f[i - 1][j - 1] + 1
else:
f[i][j... | function('vipjrkexhdv', 'imgvokrnxcz') | 3 | 206 | 28.12579 |
Code:
def function(text1: str, text2: str) -> int:
m, n = len(text1), len(text2)
f = [[0] * (n + 1) for _ in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if text1[i - 1] == text2[j - 1]:
f[i][j] = f[i - 1][j - 1] + 1
else:
... |
def function(nums: List[int]) -> int:
ans = [0, 0]
n = len(nums)
for i in range(2):
for j in range(i, n, 2):
d = 0
if j:
d = max(d, nums[j] - nums[j - 1] + 1)
if j < n - 1:
d = max(d, nums[j] - nums[j + 1] + 1)
ans[i] +=... | function([572, 452, 668, 665, 851, 358, 397, 328, 239, 783]) | 635 | 187 | 3.857655 |
Code:
def function(nums: List[int]) -> int:
ans = [0, 0]
n = len(nums)
for i in range(2):
for j in range(i, n, 2):
d = 0
if j:
d = max(d, nums[j] - nums[j - 1] + 1)
if j < n - 1:
d = max(d, nums[j] - nums[j + 1] + 1)
an... |
def function(text: str) -> int:
ans = 0
i, j = 0, len(text) - 1
while i <= j:
k = 1
ok = False
while i + k - 1 < j - k + 1:
if text[i : i + k] == text[j - k + 1 : j + 1]:
ans += 2
i += k
j -= k
ok = True
... | function('vtzvhpipsq') | 1 | 182 | 1.073243 |
Code:
def function(text: str) -> int:
ans = 0
i, j = 0, len(text) - 1
while i <= j:
k = 1
ok = False
while i + k - 1 < j - k + 1:
if text[i : i + k] == text[j - k + 1 : j + 1]:
ans += 2
i += k
j -= k
ok = Tr... |
def function(data: List[int]) -> int:
k = data.count(1)
t = sum(data[:k])
mx = t
for i in range(k, len(data)):
t += data[i]
t -= data[i - k]
mx = max(mx, t)
return k - mx | function([1, 0, 0, 0, 1, 1, 1, 1, 1, 0]) | 1 | 140 | 1.041787 |
Code:
def function(data: List[int]) -> int:
k = data.count(1)
t = sum(data[:k])
mx = t
for i in range(k, len(data)):
t += data[i]
t -= data[i - k]
mx = max(mx, t)
return k - mx
Evaluate this code with the following inputs :
function([1, 0, 0, 0, 1, 1, 1, 1, 1, 0])
Please e... |
def function(transactions: List[str]) -> List[str]:
d = defaultdict(list)
idx = set()
for i, x in enumerate(transactions):
name, time, amount, city = x.split(",")
time, amount = int(time), int(amount)
d[name].append((time, city, i))
if amount > 1000:
idx.add(i)
... | function(['jmznhxbr,242,1431,skwyrkbsv', 'weruhcxe,313,1854,ebtoygksj', 'wdgohiojsu,981,1984,ojpbwck', 'szsjupizvd,397,1666,tljamri', 'xohaxvgigv,493,1726,tysh', 'vhot,461,1702,frlafm', 'jv,738,562,tubebt', 'bvxh,809,1665,pjy', 'yvkzpo,146,57,ewvszqcp', 'spqqkbj,691,1594,ef']) | ['jmznhxbr,242,1431,skwyrkbsv', 'weruhcxe,313,1854,ebtoygksj', 'wdgohiojsu,981,1984,ojpbwck', 'szsjupizvd,397,1666,tljamri', 'xohaxvgigv,493,1726,tysh', 'vhot,461,1702,frlafm', 'bvxh,809,1665,pjy', 'spqqkbj,691,1594,ef'] | 323 | 7.0576 |
Code:
def function(transactions: List[str]) -> List[str]:
d = defaultdict(list)
idx = set()
for i, x in enumerate(transactions):
name, time, amount, city = x.split(",")
time, amount = int(time), int(amount)
d[name].append((time, city, i))
if amount > 1000:
idx.ad... |
def function(low: int, high: int) -> List[int]:
ans = []
if low == 0:
ans.append(0)
q = deque(range(1, 10))
while q:
v = q.popleft()
if v > high:
break
if v >= low:
ans.append(v)
x = v % 10
if x:
q.append(v * 10 + x - 1)... | function(100, 155) | [101, 121, 123] | 169 | 5.255139 |
Code:
def function(low: int, high: int) -> List[int]:
ans = []
if low == 0:
ans.append(0)
q = deque(range(1, 10))
while q:
v = q.popleft()
if v > high:
break
if v >= low:
ans.append(v)
x = v % 10
if x:
q.append(v * 10 +... |
def function(position: List[int]) -> int:
a = sum(p % 2 for p in position)
b = len(position) - a
return min(a, b) | function([69, 88, 68, 16, 78, 83, 12, 13, 96, 57]) | 4 | 110 | 0.84342 |
Code:
def function(position: List[int]) -> int:
a = sum(p % 2 for p in position)
b = len(position) - a
return min(a, b)
Evaluate this code with the following inputs :
function([69, 88, 68, 16, 78, 83, 12, 13, 96, 57])
Please evaluate the code with the given inputs and provide the expected output in \boxe... |
def function(n: int) -> float:
return 1 if n == 1 else 0.5 | function(70758) | 0.5 | 69 | 0.044962 |
Code:
def function(n: int) -> float:
return 1 if n == 1 else 0.5
Evaluate this code with the following inputs :
function(70758)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output or excecute code.
|
def function(prob: List[float], target: int) -> float:
f = [0] * (target + 1)
f[0] = 1
for p in prob:
for j in range(target, -1, -1):
f[j] *= 1 - p
if j:
f[j] += p * f[j - 1]
return f[target] | function([0.97, 0.55, 0.83, 0.61, 0.63, 0.66, 0.14, 0.38, 0.51, 0.71], 3) | 0.030701166328759893 | 181 | 5.658992 |
Code:
def function(prob: List[float], target: int) -> float:
f = [0] * (target + 1)
f[0] = 1
for p in prob:
for j in range(target, -1, -1):
f[j] *= 1 - p
if j:
f[j] += p * f[j - 1]
return f[target]
Evaluate this code with the following inputs :
function(... |
def function(folder: List[str]) -> List[str]:
folder.sort()
ans = [folder[0]]
for f in folder[1:]:
m, n = len(ans[-1]), len(f)
if m >= n or not (ans[-1] == f[:m] and f[m] == '/'):
ans.append(f)
return ans | function(['/cvebvnthn', '/dxuhnyw', '/eohpzyghf', '/fgewgawu', '/gqexjzjz', '/hirsibigq', '/ibup', '/icyid', '/imuhakz', '/kppejvwnq', '/nqvdxevon', '/onv', '/qrb', '/quwepv', '/rhriphkrv', '/seszawax', '/svtfqnw', '/vxh', '/wuzdqiqr', '/yfasf']) | ['/cvebvnthn', '/dxuhnyw', '/eohpzyghf', '/fgewgawu', '/gqexjzjz', '/hirsibigq', '/ibup', '/icyid', '/imuhakz', '/kppejvwnq', '/nqvdxevon', '/onv', '/qrb', '/quwepv', '/rhriphkrv', '/seszawax', '/svtfqnw', '/vxh', '/wuzdqiqr', '/yfasf'] | 240 | 2.552179 |
Code:
def function(folder: List[str]) -> List[str]:
folder.sort()
ans = [folder[0]]
for f in folder[1:]:
m, n = len(ans[-1]), len(f)
if m >= n or not (ans[-1] == f[:m] and f[m] == '/'):
ans.append(f)
return ans
Evaluate this code with the following inputs :
function(['/cveb... |
def function(s: str) -> int:
cnt = Counter(s)
n = len(s)
if all(v <= n // 4 for v in cnt.values()):
return 0
ans, j = n, 0
for i, c in enumerate(s):
cnt[c] -= 1
while j <= i and all(v <= n // 4 for v in cnt.values()):
ans = min(ans, i - j + 1)
cnt[s[j]... | function('QRQQQQWWRREQRWRWRWQQREWEQRQWQRQWREQEWQRWEWEREQEQEERQEQEQRWEQRREQWRWWRWRERWREWRRERQQQWEEQREWEREQRQRRW') | 7 | 218 | 148.649666 |
Code:
def function(s: str) -> int:
cnt = Counter(s)
n = len(s)
if all(v <= n // 4 for v in cnt.values()):
return 0
ans, j = n, 0
for i, c in enumerate(s):
cnt[c] -= 1
while j <= i and all(v <= n // 4 for v in cnt.values()):
ans = min(ans, i - j + 1)
c... |
def function(s1: str, s2: str) -> int:
xy = yx = 0
for a, b in zip(s1, s2):
xy += a < b
yx += a > b
if (xy + yx) % 2:
return -1
return xy // 2 + yx // 2 + xy % 2 + yx % 2 | function("yxxxxxxyxy", "xxxxxyyyxy") | -1 | 147 | 1.048478 |
Code:
def function(s1: str, s2: str) -> int:
xy = yx = 0
for a, b in zip(s1, s2):
xy += a < b
yx += a > b
if (xy + yx) % 2:
return -1
return xy // 2 + yx // 2 + xy % 2 + yx % 2
Evaluate this code with the following inputs :
function("yxxxxxxyxy", "xxxxxyyyxy")
Please evaluate ... |
def function(nums: List[int], k: int) -> int:
cnt = Counter({0: 1})
ans = t = 0
for v in nums:
t += v & 1
ans += cnt[t - k]
cnt[t] += 1
return ans | function([13, 1, 47, 24, 81, 100, 75, 83, 25, 59, 53, 41, 61, 73, 64, 97, 85, 62, 11, 31], 16) | 1 | 170 | 7.789297 |
Code:
def function(nums: List[int], k: int) -> int:
cnt = Counter({0: 1})
ans = t = 0
for v in nums:
t += v & 1
ans += cnt[t - k]
cnt[t] += 1
return ans
Evaluate this code with the following inputs :
function([13, 1, 47, 24, 81, 100, 75, 83, 25, 59, 53, 41, 61, 73, 64, 97, 85, ... |
def function(num: int) -> str:
return bin(num + 1)[3:] | function(232692803) | 101110111101001110001000100 | 65 | 0.143245 |
Code:
def function(num: int) -> str:
return bin(num + 1)[3:]
Evaluate this code with the following inputs :
function(232692803)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output or excecute code.
|
def function(s: str) -> int:
n = len(s)
f = [[0] * n for _ in range(n)]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
if s[i] == s[j]:
f[i][j] = f[i + 1][j - 1]
else:
f[i][j] = min(f[i + 1][j], f[i][j - 1]) + 1
return f[0][-1] | function('jfwauikaah') | 7 | 171 | 11.634416 |
Code:
def function(s: str) -> int:
n = len(s)
f = [[0] * n for _ in range(n)]
for i in range(n - 2, -1, -1):
for j in range(i + 1, n):
if s[i] == s[j]:
f[i][j] = f[i + 1][j - 1]
else:
f[i][j] = min(f[i + 1][j], f[i][j - 1]) + 1
return f[0]... |
def function(a: int, b: int, c: int) -> int:
ans = 0
for i in range(30):
x, y, z = a >> i & 1, b >> i & 1, c >> i & 1
if x | y != z:
ans += 2 if x == 1 and y == 1 else 1
return ans | function(27, 19, 100) | 10 | 140 | 3.619611 |
Code:
def function(a: int, b: int, c: int) -> int:
ans = 0
for i in range(30):
x, y, z = a >> i & 1, b >> i & 1, c >> i & 1
if x | y != z:
ans += 2 if x == 1 and y == 1 else 1
return ans
Evaluate this code with the following inputs :
function(27, 19, 100)
Please evaluate the c... |
def function(num: int) -> int:
return int(str(num).replace("6", "9", 1)) | function(6999) | 9999 | 70 | 0.24526 |
Code:
def function(num: int) -> int:
return int(str(num).replace("6", "9", 1))
Evaluate this code with the following inputs :
function(6999)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output or excecute code.
|
def function(mat: List[List[int]]) -> List[List[int]]:
m, n = len(mat), len(mat[0])
for k in range(min(m, n) - 1):
for i in range(m - 1):
for j in range(n - 1):
if mat[i][j] > mat[i + 1][j + 1]:
mat[i][j], mat[i + 1][j + 1] = mat[i + 1][j + 1], mat[i][j]
... | function([[38, 19, 64], [54, 39, 71], [43, 78, 96], [46, 48, 81], [60, 87, 56], [45, 100, 90]]) | [[38, 19, 64], [54, 39, 71], [43, 78, 96], [46, 48, 81], [60, 87, 56], [45, 100, 90]] | 212 | 2.983833 |
Code:
def function(mat: List[List[int]]) -> List[List[int]]:
m, n = len(mat), len(mat[0])
for k in range(min(m, n) - 1):
for i in range(m - 1):
for j in range(n - 1):
if mat[i][j] > mat[i + 1][j + 1]:
mat[i][j], mat[i + 1][j + 1] = mat[i + 1][j + 1], mat[... |
def function(arr: List[int]) -> int:
cnt = Counter(arr)
ans = m = 0
for _, v in cnt.most_common():
m += v
ans += 1
if m * 2 >= len(arr):
break
return ans | function([94, 39, 75, 29, 100, 94, 47, 51, 69, 59, 83, 61, 53, 95, 77, 53, 70, 75, 15, 60]) | 7 | 163 | 3.25287 |
Code:
def function(arr: List[int]) -> int:
cnt = Counter(arr)
ans = m = 0
for _, v in cnt.most_common():
m += v
ans += 1
if m * 2 >= len(arr):
break
return ans
Evaluate this code with the following inputs :
function([94, 39, 75, 29, 100, 94, 47, 51, 69, 59, 83, 61, ... |
def function(arr: List[int], d: int) -> int:
n = len(arr)
f = [1] * n
for x, i in sorted(zip(arr, range(n))):
for j in range(i - 1, -1, -1):
if i - j > d or arr[j] >= x:
break
f[i] = max(f[i], 1 + f[j])
for j in range(i + 1, n):
if j - i > ... | function([86, 78, 34, 82, 83, 14, 43, 100, 59, 13], 1) | 3 | 213 | 5.97736 |
Code:
def function(arr: List[int], d: int) -> int:
n = len(arr)
f = [1] * n
for x, i in sorted(zip(arr, range(n))):
for j in range(i - 1, -1, -1):
if i - j > d or arr[j] >= x:
break
f[i] = max(f[i], 1 + f[j])
for j in range(i + 1, n):
if j... |
def function(num: int) -> int:
ans = 0
while num:
if num & 1:
num -= 1
else:
num >>= 1
ans += 1
return ans | function(805037) | 28 | 96 | 1.65645 |
Code:
def function(num: int) -> int:
ans = 0
while num:
if num & 1:
num -= 1
else:
num >>= 1
ans += 1
return ans
Evaluate this code with the following inputs :
function(805037)
Please evaluate the code with the given inputs and provide the expected output i... |
def function(arr: List[int], k: int, threshold: int) -> int:
s = sum(arr[:k])
ans = int(s / k >= threshold)
for i in range(k, len(arr)):
s += arr[i]
s -= arr[i - k]
ans += int(s / k >= threshold)
return ans | function([8218, 8434, 3705, 1646, 8986, 1365, 6078, 6433, 3647, 3812], 5, 7445) | 0 | 162 | 1.270277 |
Code:
def function(arr: List[int], k: int, threshold: int) -> int:
s = sum(arr[:k])
ans = int(s / k >= threshold)
for i in range(k, len(arr)):
s += arr[i]
s -= arr[i - k]
ans += int(s / k >= threshold)
return ans
Evaluate this code with the following inputs :
function([8218, 84... |
def function(arr: List[int]) -> List[int]:
return sorted(arr, key=lambda x: (x.bit_count(), x)) | function([69, 67, 26, 54, 74, 20, 16, 41, 75, 21]) | [16, 20, 21, 26, 41, 67, 69, 74, 54, 75] | 98 | 1.403402 |
Code:
def function(arr: List[int]) -> List[int]:
return sorted(arr, key=lambda x: (x.bit_count(), x))
Evaluate this code with the following inputs :
function([69, 67, 26, 54, 74, 20, 16, 41, 75, 21])
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output ... |
def function(s: str) -> int:
d = {"a": -1, "b": -1, "c": -1}
ans = 0
for i, c in enumerate(s):
d[c] = i
ans += min(d["a"], d["b"], d["c"]) + 1
return ans | function('aabcbbaccb') | 29 | 124 | 2.4571 |
Code:
def function(s: str) -> int:
d = {"a": -1, "b": -1, "c": -1}
ans = 0
for i, c in enumerate(s):
d[c] = i
ans += min(d["a"], d["b"], d["c"]) + 1
return ans
Evaluate this code with the following inputs :
function('aabcbbaccb')
Please evaluate the code with the given inputs and prov... |
def function(n: int) -> int:
mod = 10**9 + 7
f = 1
for i in range(2, n + 1):
f = (f * i * (2 * i - 1)) % mod
return f | function(25) | 586091532 | 106 | 2.556762 |
Code:
def function(n: int) -> int:
mod = 10**9 + 7
f = 1
for i in range(2, n + 1):
f = (f * i * (2 * i - 1)) % mod
return f
Evaluate this code with the following inputs :
function(25)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not out... |
def function(grid: List[List[int]]) -> int:
m, n = len(grid), len(grid[0])
dirs = [[0, 0], [0, 1], [0, -1], [1, 0], [-1, 0]]
q = deque([(0, 0, 0)])
vis = set()
while q:
i, j, d = q.popleft()
if (i, j) in vis:
continue
vis.add((i, j))
if i == m - 1 and j ==... | function([[4, 1, 1, 1, 2], [1, 4, 3, 1, 3], [4, 4, 1, 3, 3], [2, 3, 3, 1, 3], [4, 3, 1, 3, 4]]) | 2 | 335 | 11.656958 |
Code:
def function(grid: List[List[int]]) -> int:
m, n = len(grid), len(grid[0])
dirs = [[0, 0], [0, 1], [0, -1], [1, 0], [-1, 0]]
q = deque([(0, 0, 0)])
vis = set()
while q:
i, j, d = q.popleft()
if (i, j) in vis:
continue
vis.add((i, j))
if i == m - 1 a... |
def function(nums: List[int]) -> List[int]:
ans = []
s, t = sum(nums), 0
for x in sorted(nums, reverse=True):
t += x
ans.append(x)
if t > s - t:
break
return ans | function([13, 94, 40, 47, 49, 32, 88, 61, 31, 60, 10]) | [94, 88, 61, 60] | 135 | 0.718407 |
Code:
def function(nums: List[int]) -> List[int]:
ans = []
s, t = sum(nums), 0
for x in sorted(nums, reverse=True):
t += x
ans.append(x)
if t > s - t:
break
return ans
Evaluate this code with the following inputs :
function([13, 94, 40, 47, 49, 32, 88, 61, 31, 60, 1... |
def function(s: str) -> int:
carry = False
ans = 0
for c in s[:0:-1]:
if carry:
if c == '0':
c = '1'
carry = False
else:
c = '0'
if c == '1':
ans += 1
carry = True
ans += 1
if carry:
... | function('1101000011') | 16 | 146 | 0.627463 |
Code:
def function(s: str) -> int:
carry = False
ans = 0
for c in s[:0:-1]:
if carry:
if c == '0':
c = '1'
carry = False
else:
c = '0'
if c == '1':
ans += 1
carry = True
ans += 1
if c... |
def function(n: int) -> int:
mod = 10**9 + 7
f0 = f1 = 6
for _ in range(n - 1):
g0 = (3 * f0 + 2 * f1) % mod
g1 = (2 * f0 + 2 * f1) % mod
f0, f1 = g0, g1
return (f0 + f1) % mod | function(644) | 634585042 | 147 | 139.493366 |
Code:
def function(n: int) -> int:
mod = 10**9 + 7
f0 = f1 = 6
for _ in range(n - 1):
g0 = (3 * f0 + 2 * f1) % mod
g1 = (2 * f0 + 2 * f1) % mod
f0, f1 = g0, g1
return (f0 + f1) % mod
Evaluate this code with the following inputs :
function(644)
Please evaluate the code with the... |
def function(num: int) -> int:
a, b = str(num), str(num)
for c in a:
if c != "9":
a = a.replace(c, "9")
break
if b[0] != "1":
b = b.replace(b[0], "1")
else:
for c in b[1:]:
if c not in "01":
b = b.replace(c, "0")
... | function(63376147) | 80008000 | 155 | 0.622122 |
Code:
def function(num: int) -> int:
a, b = str(num), str(num)
for c in a:
if c != "9":
a = a.replace(c, "9")
break
if b[0] != "1":
b = b.replace(b[0], "1")
else:
for c in b[1:]:
if c not in "01":
b = b.replace(c, "0")
... |
def function(mat: List[List[int]], k: int) -> int:
pre = [0]
for cur in mat:
pre = sorted(a + b for a in pre for b in cur[:k])[:k]
return pre[-1] | function([[10, 23, 62, 64, 90, 99], [33, 40, 78, 91, 96, 99], [29, 46, 47, 57, 67, 86], [16, 24, 27, 37, 68, 85], [4, 14, 34, 40, 56, 68], [11, 21, 38, 45, 51, 82]], 190) | 151 | 206 | 333.717059 |
Code:
def function(mat: List[List[int]], k: int) -> int:
pre = [0]
for cur in mat:
pre = sorted(a + b for a in pre for b in cur[:k])[:k]
return pre[-1]
Evaluate this code with the following inputs :
function([[10, 23, 62, 64, 90, 99], [33, 40, 78, 91, 96, 99], [29, 46, 47, 57, 67, 86], [16, 24, 27... |
def function(arr: List[int]) -> int:
n = len(arr)
pre = [0] * (n + 1)
for i in range(n):
pre[i + 1] = pre[i] ^ arr[i]
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
for k in range(j, n):
a, b = pre[j] ^ pre[i], pre[k + 1] ^ pre[j]
... | function([35215765, 66043150, 87363491, 95474451, 39969836, 61420546, 79589607, 54536682, 66514537, 31260613]) | 0 | 217 | 22.425539 |
Code:
def function(arr: List[int]) -> int:
n = len(arr)
pre = [0] * (n + 1)
for i in range(n):
pre[i + 1] = pre[i] ^ arr[i]
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
for k in range(j, n):
a, b = pre[j] ^ pre[i], pre[k + 1] ^ pre[j]
... |
def function(text: str) -> str:
words = text.split()
words[0] = words[0].lower()
words.sort(key=len)
words[0] = words[0].title()
return " ".join(words) | function('B J r d U k W J R R') | B J r d U k W J R R | 105 | 0.657702 |
Code:
def function(text: str) -> str:
words = text.split()
words[0] = words[0].lower()
words.sort(key=len)
words[0] = words[0].title()
return " ".join(words)
Evaluate this code with the following inputs :
function('B J r d U k W J R R')
Please evaluate the code with the given inputs and provide t... |
def function(arr: List[int], k: int) -> int:
cnt = Counter(arr)
for i, v in enumerate(sorted(cnt.values())):
k -= v
if k < 0:
return len(cnt) - i
return 0 | function([37, 39, 20, 49, 12, 55, 14, 23, 50, 46], 10) | 0 | 131 | 1.95818 |
Code:
def function(arr: List[int], k: int) -> int:
cnt = Counter(arr)
for i, v in enumerate(sorted(cnt.values())):
k -= v
if k < 0:
return len(cnt) - i
return 0
Evaluate this code with the following inputs :
function([37, 39, 20, 49, 12, 55, 14, 23, 50, 46], 10)
Please evaluat... |
def function(n: int, start: int) -> int:
ans = 0
for i in range(n):
ans ^= start + 2 * i
return ans | function(10, 46) | 110 | 87 | 0.516298 |
Code:
def function(n: int, start: int) -> int:
ans = 0
for i in range(n):
ans ^= start + 2 * i
return ans
Evaluate this code with the following inputs :
function(10, 46)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output or excecute co... |
def function(arr: List[int], target: int) -> int:
ans = abs(arr[0] - target)
s = {arr[0]}
for x in arr:
s = {x & y for y in s} | {x}
ans = min(ans, min(abs(y - target) for y in s))
return ans | function([462236, 272120, 697797, 340962, 933322, 822547, 255845, 359278, 328849, 712627], 6884779) | 5951457 | 162 | 11.880598 |
Code:
def function(arr: List[int], target: int) -> int:
ans = abs(arr[0] - target)
s = {arr[0]}
for x in arr:
s = {x & y for y in s} | {x}
ans = min(ans, min(abs(y - target) for y in s))
return ans
Evaluate this code with the following inputs :
function([462236, 272120, 697797, 340962,... |
def function(target: str) -> int:
ans = 0
for v in target:
if (ans & 1) ^ int(v):
ans += 1
return ans | function('1010110001') | 7 | 90 | 1.336166 |
Code:
def function(target: str) -> int:
ans = 0
for v in target:
if (ans & 1) ^ int(v):
ans += 1
return ans
Evaluate this code with the following inputs :
function('1010110001')
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not o... |
def function(arr: List[int], k: int) -> int:
if arr[0] > k:
return k
left, right = 0, len(arr)
while left < right:
mid = (left + right) >> 1
if arr[mid] - mid - 1 >= k:
right = mid
else:
left = mid + 1
return arr[left - 1] + k - (arr[left - 1] - (l... | function([156, 241, 300, 445, 523, 565, 598, 804, 811, 844], 730) | 737 | 188 | 0.518326 |
Code:
def function(arr: List[int], k: int) -> int:
if arr[0] > k:
return k
left, right = 0, len(arr)
while left < right:
mid = (left + right) >> 1
if arr[mid] - mid - 1 >= k:
right = mid
else:
left = mid + 1
return arr[left - 1] + k - (arr[left - ... |
def function(nums: List[int], target: int) -> int:
ans = 0
i, n = 0, len(nums)
while i < n:
s = 0
vis = {0}
while i < n:
s += nums[i]
if s - target in vis:
ans += 1
break
i += 1
vis.add(s)
i += 1
... | function([-6004, -6441, -6001, -4026, -3865, -9057, -4232, 868, -3828, -6707], 580483) | 0 | 183 | 1.170811 |
Code:
def function(nums: List[int], target: int) -> int:
ans = 0
i, n = 0, len(nums)
while i < n:
s = 0
vis = {0}
while i < n:
s += nums[i]
if s - target in vis:
ans += 1
break
i += 1
vis.add(s)
... |
def function(piles: List[int]) -> int:
piles.sort()
return sum(piles[-2 : len(piles) // 3 - 1 : -2]) | function([1228, 2096, 3165, 3567, 5266, 5363, 5581, 8359, 8383, 8780]) | 19230 | 118 | 0.334298 |
Code:
def function(piles: List[int]) -> int:
piles.sort()
return sum(piles[-2 : len(piles) // 3 - 1 : -2])
Evaluate this code with the following inputs :
function([1228, 2096, 3165, 3567, 5266, 5363, 5581, 8359, 8383, 8780])
Please evaluate the code with the given inputs and provide the expected output in \b... |
def function(boxes: List[int], warehouse: List[int]) -> int:
n = len(warehouse)
left = [warehouse[0]] * n
for i in range(1, n):
left[i] = min(left[i - 1], warehouse[i])
boxes.sort()
i, j = 0, n - 1
while i < len(boxes):
while j >= 0 and left[j] < boxes[i]:
j -= 1
... | function([14, 18, 20, 24, 55, 58, 79, 80], [24, 48, 30, 22, 36, 100, 65, 86, 11, 39]) | 4 | 228 | 2.187554 |
Code:
def function(boxes: List[int], warehouse: List[int]) -> int:
n = len(warehouse)
left = [warehouse[0]] * n
for i in range(1, n):
left[i] = min(left[i - 1], warehouse[i])
boxes.sort()
i, j = 0, n - 1
while i < len(boxes):
while j >= 0 and left[j] < boxes[i]:
j -=... |
def function(nums: List[int]) -> int:
f1 = 1 if nums[0] > 0 else 0
f2 = 1 if nums[0] < 0 else 0
res = f1
for num in nums[1:]:
pf1, pf2 = f1, f2
if num > 0:
f1 += 1
if f2 > 0:
f2 += 1
else:
f2 = 0
elif num < 0:
... | function([0, -1, -1, 0, -1, 1, -1, -1, 1, 1]) | 5 | 271 | 1.596695 |
Code:
def function(nums: List[int]) -> int:
f1 = 1 if nums[0] > 0 else 0
f2 = 1 if nums[0] < 0 else 0
res = f1
for num in nums[1:]:
pf1, pf2 = f1, f2
if num > 0:
f1 += 1
if f2 > 0:
f2 += 1
else:
f2 = 0
elif num ... |
def function(nums1: List[int], nums2: List[int]) -> int:
cnt1 = Counter(nums1)
cnt2 = Counter(nums2)
ans = 0
for a, x in cnt1.items():
for b, y in cnt2.items():
if a * a % b == 0:
c = a * a // b
if b == c:
ans += x * y * (y - 1)
... | function([99, 50, 11, 37, 76, 87, 72, 89, 41, 33], [55, 41, 29, 14, 95, 96, 2, 93, 40]) | 0 | 271 | 13.514551 |
Code:
def function(nums1: List[int], nums2: List[int]) -> int:
cnt1 = Counter(nums1)
cnt2 = Counter(nums2)
ans = 0
for a, x in cnt1.items():
for b, y in cnt2.items():
if a * a % b == 0:
c = a * a // b
if b == c:
ans += x * y * (y -... |
def function(colors: str, neededTime: List[int]) -> int:
ans = i = 0
n = len(colors)
while i < n:
j = i
s = mx = 0
while j < n and colors[j] == colors[i]:
s += neededTime[j]
if mx < neededTime[j]:
mx = neededTime[j]
j += 1
i... | function("ddnhzqzxyt", [6284, 1827, 5647, 7034, 7302, 4224, 9313, 2137, 7891, 1327]) | 1827 | 204 | 1.86358 |
Code:
def function(colors: str, neededTime: List[int]) -> int:
ans = i = 0
n = len(colors)
while i < n:
j = i
s = mx = 0
while j < n and colors[j] == colors[i]:
s += neededTime[j]
if mx < neededTime[j]:
mx = neededTime[j]
j += 1
... |
def function(nums: List[int], requests: List[List[int]]) -> int:
n = len(nums)
d = [0] * n
for l, r in requests:
d[l] += 1
if r + 1 < n:
d[r + 1] -= 1
for i in range(1, n):
d[i] += d[i - 1]
nums.sort()
d.sort()
mod = 10**9 + 7
return sum(a * b for a, b... | function([104, 142, 215, 250, 269, 455, 490, 619, 798, 801], [[3, 5], [9, 9], [7, 8], [7, 8], [0, 6], [6, 7], [6, 8], [0, 5], [6, 7], [5, 6]]) | 15431 | 257 | 3.104474 |
Code:
def function(nums: List[int], requests: List[List[int]]) -> int:
n = len(nums)
d = [0] * n
for l, r in requests:
d[l] += 1
if r + 1 < n:
d[r + 1] -= 1
for i in range(1, n):
d[i] += d[i - 1]
nums.sort()
d.sort()
mod = 10**9 + 7
return sum(a * b f... |
def function(n: int) -> int:
ans = 0
while n:
ans ^= n
n >>= 1
return ans | function(837942508) | 559851703 | 80 | 1.709952 |
Code:
def function(n: int) -> int:
ans = 0
while n:
ans ^= n
n >>= 1
return ans
Evaluate this code with the following inputs :
function(837942508)
Please evaluate the code with the given inputs and provide the expected output in \boxed{} format. Do not output or excecute code.
|
def function(arr: List[int]) -> float:
n = len(arr)
start, end = int(n * 0.05), int(n * 0.95)
arr.sort()
t = arr[start:end]
return round(sum(t) / len(t), 5) | function([13198, 16559, 19004, 30117, 30229, 34939, 41073, 41262, 43415, 46152, 57182, 65510, 67492, 80359, 90533, 92593, 92978, 93201, 96686, 98964]) | 57738.0 | 182 | 1.121952 |
Code:
def function(arr: List[int]) -> float:
n = len(arr)
start, end = int(n * 0.05), int(n * 0.95)
arr.sort()
t = arr[start:end]
return round(sum(t) / len(t), 5)
Evaluate this code with the following inputs :
function([13198, 16559, 19004, 30117, 30229, 34939, 41073, 41262, 43415, 46152, 57182, 6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.