file_name
stringlengths 32
36
| content
stringlengths 44
898
|
|---|---|
benchmark_functions_edited/f10263.py
|
def f(observationVector, theta):
observationVector.insert(0, 1) # add the intercept value
return sum([observationVector[i] * theta[i] for i in range(len(theta))])
assert f( [2, 2, 2], [0, 0, 0] ) == 0
|
benchmark_functions_edited/f12045.py
|
def f(obs: dict) -> int:
if len(obs["geese"][0]) == 0:
pos = 4 - sum([1 if len(i) == 0 else 0 for i in obs["geese"][1:]])
else:
geese = [0, 1, 2, 3]
length = [len(i) for i in obs["geese"]]
order = list(zip(*sorted(zip(length, geese))))[1]
pos = 4 - order.index(0)
return pos
assert f(
{"geese": [{"a": 1, "b": 2, "c": 3}, {"d": 4, "e": 5, "f": 6}, {"g": 7}], "food": []}
) == 3
|
benchmark_functions_edited/f13072.py
|
def f(pos):
if pos < 4 / 11.0:
return (121 * pos * pos) / 16.0
if pos < 8 / 11.0:
return (363 / 40.0 * pos * pos) - (99 / 10.0 * pos) + (17 / 5.0)
if pos < 9 / 10.0:
return (4356 / 361.0 * pos * pos) - (35442 / 1805.0 * pos) + 16061 / 1805.0
return (54 / 5.0 * pos * pos) - (513 / 25.0 * pos) + 268 / 25.0
assert f(0.0) == 0
|
benchmark_functions_edited/f4499.py
|
def f(args):
gene, function, scoring_args = args
score = function(gene, scoring_args)
return score
assert f(
("foo", lambda gene, scoring_args: gene == scoring_args, "foo")) == 1
|
benchmark_functions_edited/f5095.py
|
def f( x, y = 0, z = 1):
r = ( x **2 + y **2 + z **2 ) **0.5
return r
assert f(0, 1, 0) == 1
|
benchmark_functions_edited/f11329.py
|
def f(lst, search_term):
d = {}
for x in lst:
if x in d:
d[x] = d[x] + 1
else:
d[x] = 1
if search_term in d:
return d[search_term]
return 0
assert f(range(10), 6) == 1
|
benchmark_functions_edited/f3423.py
|
def f(minimum: float, value: float, maximum: float) -> float:
return max(minimum, min(value, maximum))
assert f(0, 1, 2) == 1
|
benchmark_functions_edited/f8299.py
|
def f(lines, line_index):
while line_index < len(lines):
if lines[line_index].strip().endswith('*/'):
return line_index
line_index += 1
return len(lines)
assert f(
['/*', 'test', 'test', '*/', 'test'], 0) == 3
|
benchmark_functions_edited/f13786.py
|
def f(n_size):
total = []
for i, d in enumerate(n_size):
if i == 0:
total.append(d)
else:
total.append(total[-1] * d)
return sum(total) + 1
assert f([]) == 1
|
benchmark_functions_edited/f6534.py
|
def f(value):
for converter in (int, float):
try:
return converter(value)
except (ValueError, TypeError):
pass
return value
assert f(1) == 1
|
benchmark_functions_edited/f2005.py
|
def f(gamma, x, f, g):
return f(x - gamma * g(x))
assert f(2, 0, lambda x: x**2, lambda x: 2*x) == 0
|
benchmark_functions_edited/f14256.py
|
def f(c, f1, f2):
return c * (f2 - f1) / (f2 + f1)
assert f(1, 1, 1) == 0
|
benchmark_functions_edited/f5614.py
|
def f(seq, name):
if seq and isinstance(seq[0], dict):
return sum(i[name] for i in seq)
return sum(getattr(i, name) for i in seq)
assert f(
[
{'x': 1, 'y': 2},
{'x': 3, 'y': 4}
],
'y'
) == 6
|
benchmark_functions_edited/f10981.py
|
def f(s):
if len(s) == 0:
return 0
my_dict = dict()
my_max = 0
j = 0
for i in range(len(s)):
if s[i] in my_dict.keys():
j = max(j, my_dict[s[i]] + 1)
my_dict[s[i]] = i
my_max = max(my_max, i-j+1)
return my_max
assert f("abcabcbb") == 3
|
benchmark_functions_edited/f10703.py
|
def f(n, m):
rabbits = [0] * m
rabbits[0] = 1
for i in range(n - 1):
tmp, total = rabbits[0], 0
for j in range(1, m):
total += rabbits[j]
rabbits[j], tmp = tmp, rabbits[j]
rabbits[0] = total
return sum(rabbits)
assert f(2, 2) == 1
|
benchmark_functions_edited/f11869.py
|
def f(ufuncs, curr_state, state):
utility = 0
for attr, value in state.items():
if attr in ufuncs:
new_state_utility = ufuncs[attr](value)
current_state_utility = ufuncs[attr](curr_state[attr])
utility += new_state_utility - current_state_utility
return utility
assert f(
{"a": lambda a: a * 2, "b": lambda b: b + 1},
{"a": 2, "b": 3},
{"a": 2, "b": 3},
) == 0
|
benchmark_functions_edited/f6346.py
|
def f(node, neighbors):
edges = [(n, len(neighbors[n])) for n in neighbors[node]]
edges.sort(key=lambda n: n[1])
return edges[0][0]
assert f(2, {1: [2, 3], 2: [1, 3], 3: [2, 1], 4: [1, 2]}) == 1
|
benchmark_functions_edited/f4549.py
|
def f(r):
return 4 * r + 4
assert f(0) == 4
|
benchmark_functions_edited/f6557.py
|
def f(x,y):
def power_tail_helper(x, y, accum):
if(y==0):
return accum
return power_tail_helper(x, y-1, x*accum)
return power_tail_helper(x, y, 1)
assert f(2,0) == 1
|
benchmark_functions_edited/f11560.py
|
def f(nums):
nums = str(nums)
cache = [1, 1] # sol(n-2), sol(n-1)
for i in range(1, len(nums)):
if 9 < int(nums[i-1:i+1]) < 26:
cache[1], cache[0] = cache[0] + cache[1], cache[1]
else:
cache[0] = cache[1]
return cache[1]
assert f(1) == 1
|
benchmark_functions_edited/f11423.py
|
def f(n,a0,a1,x,y):
s=0;
for i in range(n):
s+=(a0+a1*x[i]-y[i])
return s/n
assert f(3, 1, 2, [1, 2, 3], [2, 3, 4]) == 2
|
benchmark_functions_edited/f9644.py
|
def f(old_value, added_value, n):
return old_value + ((added_value - old_value) / n)
assert f(0, 4, 2) == 2
|
benchmark_functions_edited/f9437.py
|
def f(guess, answer, turns):
if guess > answer:
print("Too high.")
return turns - 1
elif guess < answer:
print("Too low.")
return turns - 1
else:
print(f"You got it! The answer was {answer}.")
assert f(3, 4, 2) == 1
|
benchmark_functions_edited/f1768.py
|
def f(X):
if hasattr(X, "values"):
X = X.values
return X
assert f(1) == 1
|
benchmark_functions_edited/f4161.py
|
def f(n, off):
if n < 0:
while n < 0:
n += off
elif n > off:
while n > off:
n -= off
return n
assert f(0, 4) == 0
|
benchmark_functions_edited/f7242.py
|
def f(value, max_value, max_width):
ratio = float(value) / float(max_value)
return int(round(ratio * max_width))
assert f(0, 100, -10) == 0
|
benchmark_functions_edited/f3829.py
|
def f(n):
fib = [0,1]
for i in range(2,n+1):
fib.append(fib[i-2] + fib[i-1])
return fib[-1]
assert f(5) == 5
|
benchmark_functions_edited/f4359.py
|
def f(data, shift, length):
bitmask = ((1 << length) - 1) << shift
return ((data & bitmask) >> shift)
assert f(5, 4, 1) == 0
|
benchmark_functions_edited/f14504.py
|
def f(obj1, obj2) -> int:
edit = [[i + j for j in range(len(obj2) + 1)] for i in range(len(obj1) + 1)]
for i in range(1, len(obj1) + 1):
for j in range(1, len(obj2) + 1):
if obj1[i - 1] == obj2[j - 1]:
d = 0
else:
d = 1
edit[i][j] = min(edit[i - 1][j] + 1, edit[i][j - 1] + 1, edit[i - 1][j - 1] + d)
return edit[len(obj1)][len(obj2)]
assert f('intention', 'execution') == 5
|
benchmark_functions_edited/f3599.py
|
def f(kappa_i, p_1, p_2, g):
return (p_1 - p_2) / g * kappa_i
assert f(1, 1, 0, 1) == 1
|
benchmark_functions_edited/f10083.py
|
def f(needle, p):
length = 0
j = len(needle) - 1
for i in reversed(range(p + 1)):
if needle[i] == needle[j]:
length += 1
else:
break
j -= 1
return length
assert f('abcabc', 4) == 0
|
benchmark_functions_edited/f11916.py
|
def f(trajectory):
num_fails = 0
for bbox in trajectory:
if len(bbox) == 1 and bbox[0] == 2.:
num_fails += 1
return num_fails
assert f(
[[1.], [1.], [1.]]) == 0
|
benchmark_functions_edited/f370.py
|
def f(a):
return 1 + a % 12
assert f(20) == 9
|
benchmark_functions_edited/f4376.py
|
def f(binary):
prefix_count = 0
for i in binary:
if i == '1':
prefix_count += 1
return prefix_count
assert f(bin(254)) == 7
|
benchmark_functions_edited/f11312.py
|
def f(values):
# Write the f() function
midpoint = int(len(values) / 2)
if len(values) % 2 == 0:
median = (values[midpoint - 1] + values[midpoint]) / 2
else:
median = values[midpoint]
return float(median)
assert f([1, 1, 5, 5, 10]) == 5
|
benchmark_functions_edited/f12329.py
|
def f(xs, predicate):
for x in xs:
if predicate(x):
return x
return None
assert f([1,2,3], lambda x: x == 3) == 3
|
benchmark_functions_edited/f3885.py
|
def f(velocity):
speed = 0
for i in velocity:
speed += abs(i)
return speed
assert f([0, -3]) == 3
|
benchmark_functions_edited/f9596.py
|
def f(oper, left_op, right_op):
if oper == '+':
return left_op + right_op
elif oper == '-':
return left_op - right_op
elif oper == '*':
return left_op * right_op
else:
return left_op / right_op
assert f('*', 2, 3) == 6
|
benchmark_functions_edited/f2943.py
|
def f(dist):
mean = 0
for k, v in dist.items():
mean += k * v
return mean
assert f(dict()) == 0
|
benchmark_functions_edited/f6037.py
|
def f(n):
if n == 1:
return 1
cycle, rem = divmod(n - 1, 4)
adjustment = cycle * 3 - 1
result = pow(2, n - 2) + pow(2, adjustment + rem)
return result
assert f(2) == 2
|
benchmark_functions_edited/f14260.py
|
def f(array):
original_zeroes = 0
current_sum, max_sum = 0, 0
for value in array:
if not value:
value = -1
original_zeroes += 1
current_sum = max(0, current_sum + value)
max_sum = max(max_sum, current_sum)
return original_zeroes + max_sum
assert f([]) == 0
|
benchmark_functions_edited/f9853.py
|
def f(tp,fp,tn,fn):
return 2*tp/float(2*tp + fn + fp)
assert f(1,0,1,0) == 1
|
benchmark_functions_edited/f5476.py
|
def f(iterable, item):
index = -1
for i, thing in enumerate(iterable):
if thing == item:
index = i
return index
assert f("abcde", "b") == 1
|
benchmark_functions_edited/f12800.py
|
def f(n):
result = 1
while n >= 128:
result += 1
n >>= 7
return result
assert f(1 << 35) == 6
|
benchmark_functions_edited/f9530.py
|
def f(m,s,b,n):
result = 0
y = pow(b,m,n)
for j in range(s):
if (y==1 and j==0) or (y==n-1):
result = 1
break
y = pow(y,2,n)
return result
assert f(2,3,5,7)==0
|
benchmark_functions_edited/f12011.py
|
def f(s, charset):
if not isinstance(s, (str)):
raise ValueError("s must be a string.")
if (set(s) - set(charset)):
raise ValueError("s has chars that aren't in the charset.")
output = 0
for char in s:
output = output * len(charset) + charset.index(char)
return output
assert f(
'abc', 'abc') == 5
|
benchmark_functions_edited/f5615.py
|
def f(dictOfElements, valueToFind):
for key, value in dictOfElements.items():
if value == valueToFind:
return key
assert f(
{0: "Elie", 1: "Schoppik", 2: "McCoy"}, "McCoy"
) == 2
|
benchmark_functions_edited/f11025.py
|
def f(word):
reserved_keywords = ["from"]
if word in reserved_keywords:
return f"_{word}"
return word
assert f(1) == 1
|
benchmark_functions_edited/f9860.py
|
def f(string, reference):
answer = 0
if (len(string) == len(reference)):
for i in range(len(string)):
if string[i] != reference[i]:
answer += 1
else:
answer = -1
return answer
assert f("TCCTAAAGTGGTTTGTATGGG", "TCCGAAAGTGGTTTGTATGGG") == 1
|
benchmark_functions_edited/f10642.py
|
def f(policies, weights):
total = 0
for p in policies:
if p == "nan":
continue
if p not in weights.keys():
raise ValueError(f"Missing intensity group: {p}")
else:
total += weights[p]
return total
assert f(
["1", "2", "3"], {"1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6}
) == 6
|
benchmark_functions_edited/f9159.py
|
def f(T, VL, VDL, VH, VDH):
# print('cubic int')
t2 = T * T
t3 = t2 * T
p0 = (2 * t3 - 3 * t2 + 1) * VL
m0 = (t3 - 2 * t2 + T) * VDL
p1 = (-2 * t3 + 3 * t2) * VH
m1 = (t3 - t2) * VDH
return p0 + m0 + p1 + m1
assert f(0, 0, 0, 0, 0) == 0
|
benchmark_functions_edited/f923.py
|
def f(value, none_result):
return value if value is not None else none_result
assert f(5, None) == 5
|
benchmark_functions_edited/f8721.py
|
def f(pixel_part, bit):
pixel_part_binary = bin(pixel_part)
last_bit = int(pixel_part_binary[-1])
calculated_last_bit = last_bit & bit
return int(pixel_part_binary[:-1]+str(calculated_last_bit), 2)
assert f(2, 1) == 2
|
benchmark_functions_edited/f1125.py
|
def f(x,xtrue):
return 100.0*(x-xtrue)/xtrue
assert f(1,1) == 0
|
benchmark_functions_edited/f3818.py
|
def f(x, x0, k):
return 2 * k * (x0 - x)
assert f(0, 0, 0) == 0
|
benchmark_functions_edited/f2185.py
|
def f(x):
if int(x) != x:
return int(x) + 1
return int(x)
assert f(1.0) == 1
|
benchmark_functions_edited/f12069.py
|
def f(seq, N):
sLen = 0
# todo: use Alex's xrange pattern from the cbook for efficiency
for (word, ind) in zip(seq, list(range(len(seq)))):
sLen += len(word) + 1 # +1 to account for the len(' ')
if sLen >= N: return ind
return len(seq)
assert f(list("a b c d e f g h i j k"), 17) == 8
|
benchmark_functions_edited/f455.py
|
def f(n):
sum = int((n * (n + 1)) / 2)
return sum
assert f(0) == 0
|
benchmark_functions_edited/f7277.py
|
def f(pos: int, step: int, width: int) -> int:
new_pos = (pos + step) % width
return new_pos
assert f(4, -13, 5) == 1
|
benchmark_functions_edited/f7102.py
|
def f(S):
fahrenheit = float(S)
celsius = (fahrenheit - 32) * 5 / 9
return celsius
print (celsius)
assert f(32) == 0
|
benchmark_functions_edited/f6604.py
|
def f(data,key):
try:
value = data[key]
except KeyError:
value = ''
return value
assert f( {'a':1, 'b':2}, 'b' ) == 2
|
benchmark_functions_edited/f4379.py
|
def f(n, epsilon=0.0001):
guess = 1.0
while abs(guess*guess - n) > epsilon:
guess = (n/guess + guess) / 2.0
return guess
assert f(1) == 1
|
benchmark_functions_edited/f6454.py
|
def f(n):
# Base case.
if n <= 1:
return 1
return n * f(n - 1)
assert f(0) == 1
|
benchmark_functions_edited/f5791.py
|
def f(blocks, key):
keys = [i for i in range(len(blocks)) if blocks[i]['key'] == key]
return keys[0] if keys else -1
assert f(
[
{'key': 'a', 'value': 1},
{'key': 'b', 'value': 2},
{'key': 'c', 'value': 3}
],
'a'
) == 0
|
benchmark_functions_edited/f14292.py
|
def f(word):
result = 0
for char in word.upper():
if char in "AEIOULNRST":
result += 1
elif char in "DG":
result += 2
elif char in "BCMP":
result += 3
elif char in "FHVWY":
result += 4
elif char == "K":
result += 5
elif char in "JX":
result += 8
else:
result += 10
return result
assert f("N") == 1
|
benchmark_functions_edited/f5819.py
|
def f(value):
return float(value) if '.' in value else int(value)
assert f('1') == 1
|
benchmark_functions_edited/f3035.py
|
def f(a):
try:
return len(a)
except TypeError:
return 1
assert f(range(0)) == 0
|
benchmark_functions_edited/f12932.py
|
def f(sorted_list, element):
idxLeft = 0
idxRight = len(sorted_list) - 1
while idxLeft < idxRight:
idxMiddle = (idxLeft + idxRight) // 2
middle = sorted_list[idxMiddle]
if middle <= element:
idxLeft = idxMiddle + 1
elif middle > element:
idxRight = idxMiddle
return idxRight
assert f(sorted([1, 3, 5, 7]), 2) == 1
|
benchmark_functions_edited/f8163.py
|
def f(num_of_cities, distance_matrix, tour):
cost = 0
for i in range(num_of_cities):
cost += distance_matrix[tour[i]][tour[(i+1) % num_of_cities]]
return cost
assert f(3, [[0, 2, 3], [2, 0, 1], [3, 1, 0]], [1, 0, 2]) == 6
|
benchmark_functions_edited/f9683.py
|
def f(filename):
if filename.endswith(".smc.gz"):
filename = filename[:-len(".smc.gz")]
elif filename.endswith(".gz"):
filename = filename[:-len(".gz")]
i = filename.rindex(".")
return int(filename[i+1:])
assert f(r"foo/bar/baz.0.smc.gz") == 0
|
benchmark_functions_edited/f3037.py
|
def f(B, E):
out = E * (B**(E-1))
return out
assert f(0, 3) == 0
|
benchmark_functions_edited/f11089.py
|
def f(inBool: bool):
if inBool:
return 1
else:
return 0
assert f(not True and False) == 0
|
benchmark_functions_edited/f1133.py
|
def f(a,b,c,d):
return max(a*b, a*c, a*d, b*c, b*d, c*d)
assert f(0, 1, -1, 0) == 0
|
benchmark_functions_edited/f10371.py
|
def f(d):
v = list(d.values())
k = list(d.keys())
return k[v.index(min(v))]
assert f({1:100, 2:200, 3:300}) == 1
|
benchmark_functions_edited/f13745.py
|
def f(a, b):
a = set(a)
b = set(b)
# Calculate Jaccard similarity
jSimilarity = len(a & b) / len(a | b)
jDistance = 1 - jSimilarity
return jDistance
assert f(set([1, 2, 3, 4]), set([1, 2, 3, 4])) == 0
|
benchmark_functions_edited/f6104.py
|
def f(list, target):
for i in range(0, len(list)):
if list[i] == target:
return i
return None
assert f(list('abc'), 'c') == 2
|
benchmark_functions_edited/f6243.py
|
def f(int_val):
length = 0
count = 0
while (int_val):
count += (int_val & 1)
length += 1
int_val >>= 1
return length - 1
assert f(22) == 4
|
benchmark_functions_edited/f3367.py
|
def f(a, p):
ret = 0
ed = (p + 1)>>1
for i in range(ed):
ret += a * i // p
return ret
assert f(1, 2) == 0
|
benchmark_functions_edited/f5490.py
|
def f(year):
golden_num = (year + 1) % 19
if golden_num == 0:
golden_num = 19
return golden_num
assert f(1998) == 4
|
benchmark_functions_edited/f6603.py
|
def f(c, D_params):
a, b = D_params
return a*c + b
assert f(2, (1, 1)) == 3
|
benchmark_functions_edited/f12965.py
|
def f(distances, left, right):
if left == right:
return distances[left][right]
score = 0
count = 0
for i in range(left, right):
for j in range(i+1, right+1):
score += distances[i][j]
count += 1
return score / count
assert f(
[
[0, 5, 5, 2],
[5, 0, 5, 3],
[5, 5, 0, 3],
[2, 3, 3, 0],
],
0,
1,
) == 5
|
benchmark_functions_edited/f3180.py
|
def f(n, mult):
extra = n % mult
if extra > 0:
n = n + mult - extra
return n
assert f(0, 4) == 0
|
benchmark_functions_edited/f12950.py
|
def f(number, numBits, position):
return ( (1 << numBits) - 1 & (number >> (position-1)) )
assert f(0x0000000000000000, 1, 1) == 0
|
benchmark_functions_edited/f10913.py
|
def f(value):
if value is not None:
value = int(value)
if value == -1:
return None
return value
assert f(1) == 1
|
benchmark_functions_edited/f1864.py
|
def f(x, y):
return (1 - x) ** 2 + 100 * (y - x ** 2) ** 2
assert f(1, 1) == 0
|
benchmark_functions_edited/f123.py
|
def f(x):
return (x + 1) / 2.0
assert f(1) == 1
|
benchmark_functions_edited/f11717.py
|
def f(config, default_config, parameter, default_value=None):
value = config.get(parameter)
if (value is None or value == '') and default_config is not None:
value = default_config.get(parameter, default_value)
return value
assert f({'a': 1}, {'a': 10}, 'a', 10) == 1
|
benchmark_functions_edited/f6785.py
|
def f(letter):
assert isinstance(letter, str) and len(letter) == 1
u = letter.upper()
return 'KJI'.index(u)
assert f('J') == 1
|
benchmark_functions_edited/f4497.py
|
def f(frequency):
# if frequency in VALID_FREQ:
# return 0
# else:
# return 0
return 0
assert f(23) == 0
|
benchmark_functions_edited/f13652.py
|
def f(A, B, C):
a_mod_c = A % C
b_mod_c = B % C
result = (a_mod_c * b_mod_c) % C
return result
assert f(10, 6, 10) == 0
|
benchmark_functions_edited/f3299.py
|
def f(value, min_value, max_value):
return max(min_value, min(value, max_value))
assert f(2, 2, 1) == 2
|
benchmark_functions_edited/f14452.py
|
def f(box1, box2):
xmin = max(box1[0], box2[0])
ymin = max(box1[1], box2[1])
xmax = min(box1[2], box2[2])
ymax = min(box1[3], box2[3])
if xmin >= xmax or ymin >= ymax:
return 0
box1area = (box1[2] - box1[0]) * (box1[3] - box1[1])
box2area = (box2[2] - box2[0]) * (box2[3] - box2[1])
intersection = (xmax - xmin) * (ymax - ymin)
union = box1area + box2area - intersection
return intersection / union
assert f([0, 0, 1, 1], [0, 0, 0, 0]) == 0
|
benchmark_functions_edited/f3191.py
|
def f(cigartuples):
return sum([item[1] for item in cigartuples if item[0] == 1])
assert f(list(zip([0,0,0,0], [3, 5, 7, 9]))) == 0
|
benchmark_functions_edited/f9966.py
|
def f(nums):
max = sub_sum = float('-inf')
for n in nums:
if sub_sum + n <= n:
sub_sum = n
else:
sub_sum += n
if sub_sum > max:
max = sub_sum
return max
assert f([1]) == 1
|
benchmark_functions_edited/f10136.py
|
def f(last_user_stats):
total_time_sec = 0
for song in last_user_stats:
try:
total_time_sec += int(song['play_count']) * (int(song['duration_millis']) / 1000)
except:
continue
return total_time_sec
assert f(
[{'play_count': 0, 'duration_millis': 150000},
{'play_count': 0, 'duration_millis': 185000}]) == 0
|
benchmark_functions_edited/f3762.py
|
def f(token):
try:
return int(token)
except ValueError:
return 0
assert f("1.2a") == 0
|
benchmark_functions_edited/f8744.py
|
def f(x0, x):
return abs(x0 - x)
assert f(-1, 0.0) == 1
|
benchmark_functions_edited/f5870.py
|
def f(d):
n = 0
for di in d.values():
n += len(di)
return n
assert f({}) == 0
|
benchmark_functions_edited/f371.py
|
def f(xs):
return sum(1 for _ in xs)
assert f(range(5)) == 5
|
benchmark_functions_edited/f4667.py
|
def f(sub1, sub2):
return min(abs(sub1['end_time'] - sub2['start_time']), abs(sub2['end_time'] - sub1['start_time']))
assert f(
{'start_time': 10, 'end_time': 15},
{'start_time': 20, 'end_time': 25}) == 5
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.