question
stringlengths
716
2.93k
options
listlengths
4
8
answer
stringclasses
8 values
id
stringlengths
24
24
source_question_id
stringlengths
30
30
num_choices
int64
4
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "min_position = 0\n for i in range(1, n):\n if arr[i] < arr[i-1]:\n min_position = i-1\n break\n else:\n min_position = 0", "min_position = 0\n for i in range(1, n):\n if arr[i] > arr[i-1]:\n min_position = i\n break\n else:\n min...
E
code-159226-aa149499fc66
code-question-ef291c9e67b7656a
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "pre_sum = [0] + list(itertools.accumulate(arr))\n for L, R in queries:\n res = sum(arr[L:R])\n print(res)", "pre_sum = [0] + list(itertools.accumulate(arr))\n for L, R in queries:\n res = pre_sum[R] - pre_sum[L - 1]\n print(res)", "pre_sum = list(itertools.accumulate(arr))\n ...
G
code-257392-b76c94f2c240
code-question-70ab8a0498a33494
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "max_mod = 0\n for i in range(1, M):\n sumA = prefix[i]\n sumB = total - sumA\n product = sumA * sumB\n current_mod = product % q\n if current_mod > max_mod:\n max_mod = current_mod\n print(max_mod)", "max_mod = 0\n for i in range(1, M):\n sumA = prefi...
A
code-043583-d13cf1c74b59
code-question-6af3c6dc8fc23553
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "r = total % 3\n if r == 0:\n print(total)\n return\n candidates = []\n if r == 1:\n if len(rem1) >= 1:\n candidates.append(rem1[0])\n if len(rem2) >= 2:\n candidates.append(rem2[0] + rem2[1])\n else:\n if len(rem2) >= 1:\n candidates.a...
G
code-053957-9de18fb12d8a
code-question-d16f51530c6422c5
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "while j < N and packs[j][0] <= req:\n t2 = packs[j][1]\n heapq.heappush(heap, t2)\n j += 1\n while heap and heap[0] < req:\n heapq.heappop(heap)\n if heap:\n heapq.heappop(heap)\n count += 1", "while j...
G
code-195865-cb68d9dcb070
code-question-fb148919e6425982
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for num in a:\n if num == 1:\n if current_length != 0:\n groups.append(current_length)\n current_length = 1\n else:\n current_length = 1\n else:\n if num == current_length + 1:\n current_length += 1", "for num in a:\n if num == 1 and curre...
A
code-118347-2b731406cef2
code-question-c66b740a9b43fe67
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "substrings = set()\nn = len(t)\nfor i in range(n):\n for j in range(i + 1, n + 1):\n substrings.add(t[j:i])", "substrings = []\nn = len(t)\nfor i in range(n):\n for j in range(i + 1, n + 1):\n substrings.append(t[i:j])", "substrings = set()\nn = len(t)\nfor i in range(n):\n for j in rang...
F
code-175215-4a6792032979
code-question-0ff465042def929e
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "numbers = [2 * i + 1 for i in range(N * N)]\n for row in range(N):\n start = row\n end = start + N\n current_row = numbers[start:end]\n print(''.join(map(str, current_row)))", "numbers = [2 * i + 1 for i in range(N * N)]\n for row in range(N):\n ...
F
code-028686-a08ca90308e4
code-question-feec0a2af503d34e
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if k ==0:\n delta = 0\n elif k == N-1:\n delta = 0\n else:\n a_prev = abs(arr[k] - arr[k-1])\n a_after = abs(arr[k+1] - arr[k])\n a_cross = abs(arr[k+1] - arr[k-1])\n delta = a_cross", "if k ==0:\n ...
D
code-013815-d8ba7cccf35d
code-question-3e117923e4d10f7e
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "k = mid - l\n last = P + (mid)*Q\n sum_ = k * (a_l + last) // 2\n if sum_ <= m:\n best = mid\n low = mid + 1\n else:\n high = mid - 1", "k = mid - l + 1\n last = P + (mid -1)*Q\n sum_ = k * (a_l + last)...
D
code-203823-341e654e2d16
code-question-34539d37b56423a1
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "a, b, c = 0, 1, 1\n for _ in range(2, n):\n next_val = a + b + c\n a, b, c = next_val, a, b\n print(next_val)", "a, b, c = 1, 1, 2\n for _ in range(3, n + 1):\n next_val = a + b\n a, b, c = b, c, next_val\n print(c)", "a, b, c = 0, 1, 1\n for _ in range(3, n + 1):\n ...
D
code-148085-0d34e6e7a9b8
code-question-063aba79f6c2ed79
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if a == 0:\n result = 0\n for x in freq:\n if x == 0:\n result += freq[x] * total_subarrays\nelse:\n result = 0\n for x in freq:\n if x == 0:\n continue\n if a % x != 0:\n continue\n y = a // x\n result += freq.get(x * y, 0)", "if a ...
H
code-174711-e7f2abfd7956
code-question-43624f55d3b75c1c
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "total_comfort = 0\nfor skill in s_list:\n frequency = count[skill]\n groups = frequency // k\n total_comfort += groups * skill * k", "total_comfort = 0\nfor skill, frequency in count.items():\n groups = min(frequency, k)\n total_comfort += groups * skill * k", "total_comfort = 0\nfor skill, freq...
D
code-047997-4fab011c1a39
code-question-8e655a51547e4269
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "valid = True\nfor i in range(1, n):\n if marbles[i] <= marbles[i - 1]:\n valid = False\n break\nif valid:\n print(' '.join(map(str, marbles)))\nelse:\n print(-1)", "valid = True\nfor i in range(1, n):\n if marbles[i] < marbles[i - 1]:\n valid = False\n break\nif valid:\n ...
B
code-253574-70797b0b70f1
code-question-1ab101c2d94ba0f2
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "a = ord(s[i])\n b = ord(s[i+1])\n diff = min(abs(a - b), 26 - abs(a - b))\n if diff != 24:\n balanced = False\n break", "a = ord(s[i])\n b = ord(s[i+1])\n diff = abs(a - b)\n if diff not in (1, 25):\n balanced = False\n break",...
E
code-172186-f762613c78ad
code-question-502a99fa7633400b
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "remainder = H % 2\n if remainder != 0:\n count += 1\n if remainder == 0:\n count += 1\n H = H // 2", "remainder = H % 3\n if remainder != 0:\n count += 1\n if remainder == 1:\n count += 1\n H = (H + remainder) // 3", "remaind...
F
code-051824-e335db4e0a55
code-question-154e179d76493355
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "inv_fact = [1] * (max_n + 1)\ninv_fact[max_n] = pow(fact[max_n], MOD - 2, MOD)\nfor i in range(max_n - 1, -1, -1):\n inv_fact[i] = inv_fact[i + 1] // (i + 1)", "inv_fact = [0] * (max_n + 1)\ninv_fact[max_n] = pow(fact[max_n], MOD - 2, MOD)\nfor i in range(max_n - 1, -1, -1):\n inv_fact[i] = (inv_fact[i + 1...
D
code-081931-57ccd636a9cf
code-question-2af19368c5d5465e
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "group3 = []\nif len(s) >= 2:\n group3.append(s[:2])\n start = 2\nelse:\n group3.append(s)\n start = 2\nfor i in range(start, len(s), 4):\n group3.append(s[i-1:i+3])", "group3 = []\nif len(s) >= 2:\n group3.append(s[:2])\n start = 2\nelse:\n group3.append(s)\n start = 0\nfor i in range(...
D
code-090020-697fe2aba82c
code-question-249a9c08fb75d95f
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if n % 2 == 0:\n print(0)\n else:\n m = n // 2\n print(pow(2, m, MOD))", "if n % 2 != 0:\n print(1)\n else:\n m = n // 2\n print(pow(2, m-1, MOD))", "if n & 1:\n print(0)\n else:\n m = n // 2\n ...
D
code-258277-ffbb9a9ea0fc
code-question-aa22d9d5f34a6bda
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for i in range(n - 2):\n for j in range(i + 1, n - 1):\n for k in range(j + 1, n):\n if i + j + k < t:\n count += 1", "for i in range(n):\n for j in range(i, n):\n for k in range(j, n):\n if arr[i] + arr[j] + arr[k] < t:\n count += 1", "fo...
C
code-016339-1e6763cd18eb
code-question-4013fb75014d9615
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "max_val = max(arr)\n min_val = min(arr)\n sorted_arr = sorted(arr)\n max_diff = max(sorted_arr[i+1] - sorted_arr[i] for i in range(len(sorted_arr)-1))\n if N == 2:\n min_diff = max_diff\n else:\n min_diff = sorted_arr[1] - sorted_arr[0]", "max_val = max(arr)\n min_val = min(arr)\n...
E
code-179811-e845a0e67fe2
code-question-267946b38d46ebb9
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "s1 = max_w / d_w\ns2 = max_h / d_h\ns = s1\nscaled_w = int(d_w * s)\nscaled_h = int(d_h * s)\nprint(scaled_w, scaled_h)", "s1 = max_w / d_h\ns2 = max_h / d_w\ns = min(s1, s2)\nscaled_w = int(d_w * s)\nscaled_h = int(d_h * s)\nprint(scaled_w, scaled_h)", "s1 = max_w / d_w\ns2 = max_h / d_h\ns = min(s1, s2)\nsca...
D
code-034760-ad8f8571a90e
code-question-1f62ef296f69acc9
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if p > 2 * N:\n break\n a_min = 1\n a_max = min(N, p // 2)\n if a_max >= a_min:\n total += a_max - a_min + 1", "if p > 2 * N:\n break\n a_min = max(1, p - N)\n a_max = min(N, (p + 1) // 2)\n if a_max >=...
E
code-083249-6d34e56712b4
code-question-1b8bfb3e003a5d77
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "max_char = max(combined)\n base = (ord(max_char) - ord('a') + 1) + 1\n V = 0\n for c in combined:\n digit = ord(c) - ord('a')\n V = V * base + digit\n if V == 0:\n print(1)\n else:\n digits = 0\n while V > 0:\n V = V // base\n digits += 1\n ...
F
code-059321-465342052f00
code-question-8d71684063b21c97
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "plots = length * width\nprint(width)", "plots = length ** 2\nprint(plots)", "total = length * width\nprint(plots)", "plots = width * width\nprint(plots)", "plots = length * width\nprint(plots)", "plots = length // width\nprint(plots)", "plots = length + width\nprint(plots)" ]
E
code-215963-7ec5c55ba756
code-question-e9adb5e86b72abc1
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "f.sort(reverse=True)\n alice = 0\n bob = 0\n turn = 0\n i = 0\n while i < len(f):\n bench = f[i]\n if turn == 0:\n bob += bench\n turn = 1\n else:\n alice += bench\n turn = 0\n i += 1", "f.sort()\n alice = 0\n bob = 0\n ...
E
code-117181-e88412b67ed6
code-question-1feb475e42d1dedd
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "min_sandwich = min(sandwiches)\nmin_drink = min(drinks)\nminimum_combo = min_sandwich + min_drink + 100", "min_sandwich = sum(sandwiches)\nmin_drink = sum(drinks)\nminimum_combo = min_sandwich + min_drink - 100", "min_sandwich = min(sandwiches)\nmin_drink = min(drinks)\nminimum_combo = min_sandwich + min_drink...
C
code-149929-77475d9d76a6
code-question-4846632a8be19180
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for j in range(m - k + 1):\n for i in range(n):\n valid = True\n for y in range(k):\n if grid[i + y][j] == '#':\n valid = False\n break\n if valid:\n for y in range(k):\n count[i + y][j] += 1", "for i in range(n):\n for...
G
code-194774-02560490bdd2
code-question-d163d7e609714585
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "max_i = min(n, current_j - 1)\n for i in range(1, max_i + 1):\n temp = i * current_j - a[i-1]\n if temp in value_to_idx:\n idx_i = value_to_idx[temp]\n if idx_i == i and i < current_j:\n count += 1", "max_i = (2...
G
code-182459-523b24634070
code-question-361e655aec9ceffa
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "product = 0\n current = n\n while current > 0:\n digit = current % 10\n product += digit\n current = current // 10\n n = product", "product = 1\n current = n\n while current > 0:\n digit = current %...
F
code-207554-679dee3cfa8e
code-question-bb432680f65c276d
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "p, x = booster\n p_idx = p - 1\n new_val = x - T[p_idx]\n new_S = S_original - v[p_idx] + new_val\n orig_contribution = 0\n new_contrib = 0\n results.append(new_S)", "p, x = booster\n p_idx = p - 1\n new_val = x - T[p_idx]\n orig_contribution = v[p_i...
F
code-261963-d937f66a00c4
code-question-69ddfcbb1e62422a
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "total_distance = 0\nfor i in range(1, n):\n total_distance += abs((pos[i + 1] - pos[i]) - 1)", "total_distance = 0\nfor i in range(n - 1):\n total_distance += abs(pi[i] - pi[i + 1])", "total_distance = 0\nfor i in range(1, n + 1):\n total_distance += abs(pos[i] - pos[i - 1])", "total_distance = 0\nf...
F
code-119931-3745821bc5ad
code-question-db7e194efd4760df
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "first_block = R[0:T]\n ok = True\n for i in range(T, N, T):\n current_block = R[i:i+T]\n if current_block != first_block:\n continue\n else:\n ok = False\n break\n if ok:\n ...
C
code-264261-aaea5d253125
code-question-ab75475fb61a646e
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "current_gcd = max(p)\nfor num in p[1:]:\n current_gcd = math.gcd(num, max(p))\n if current_gcd == 1:\n break", "current_gcd = sum(p)\nfor num in p:\n current_gcd = math.gcd(current_gcd, num)\n if current_gcd == 1:\n break", "current_gcd = (p[0] + p[1]) if len(p) > 1 else p[0]\nfor num...
D
code-279759-492045f06b65
code-question-895f9b7514d822e3
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for i in range(len(rows)):\n for j in range(i + 1, len(rows)):\n common = len(set(rows[i]) ^ set(rows[j]))\n total += common * (common - 1) // 2", "for i in range(len(rows)):\n for j in range(i + 1, len(rows)):\n common = len(set(rows[i]) & set(rows[j]))\n total += common", "f...
C
code-161030-e5287f5c8df1
code-question-04e40c45859a02ba
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for j in queries:\n xj = x[j]\n k = bisect.bisect_left(y_sorted, xj)\n if k+1 < len(y_sorted):\n results.append(suffix_sums[k+1])\n else:\n results.append(0)", "for j in queries:\n xj = x[j]\n k = bisect.bisect_left(y_sorted, xj)\n if k < len(y_sorted):\n results.append(...
F
code-189443-a2397b9ad7fd
code-question-4c42c41608981895
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if 1 <= num <= n and used[num] < 1:\n result.append(num)\n used[num] += 1\n else:\n result.append(m)\n m += 1", "if 1 <= num <= n and used[num] < 1:\n result.append(num)\n used[num] += 1\n m += 1\n else:\n resul...
E
code-039082-da861baecceb
code-question-346cbc141e7a6686
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if task in todo:\n continue\nelse:\n if len(todo) == k:\n todo.pop()\n todo.insert(0, task)", "if task in todo:\n continue\nelse:\n if len(todo) == k:\n todo.pop(0)\n todo.append(task)", "if task in todo:\n continue\nelse:\n if len(todo) >= k:\n todo.pop()\n todo...
A
code-244282-7aba221638d7
code-question-8ff915b2431d7526
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "k_min = 0\n while (1 << k_min) < a:\n k_min += 1\n k_max = 0\n while (1 << (k_max + 1)) <= b:\n k_max += 1\n if k_max <= k_min:\n print(0)\n else:\n print(k_max - k_min)", "k_min = (a).bit_length()\n k_max = (b).bit_length()\n if (1 << k_min) > b:\n print(0...
G
code-191042-aa70c1c9ce04
code-question-5ea3f117c9750b04
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = 0\n current = K\n while current >= 1:\n if current % 2 == 1:\n count += 1\n current //= 2\n print(count % 2)", "count = 0\n current = K\n while current > 1:\n if current % 2 == 1:\n count ^= 1\n c...
G
code-269291-cacc7dcb5feb
code-question-a0228b2ba1cdca90
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for m in range(mod):\n for r in a_mod:\n needed_s = (m - r) % mod\n if needed_s in a_set:\n print(m)\n exit()", "for m in range(mod):\n for s in b_mod:\n needed_r = (m - s) % mod\n if needed_r in b_mod:\n print(m)\n exit()", "for m i...
D
code-243018-a42da9dfbcfe
code-question-951f1a2fd0992549
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for a in range(1, max_a + 1):\n part1 = M[0:a]\n part2 = M[a:2*a]\n if part1 != part2:\n continue\n b = half_L - a\n start_third = 2 * a\n third_part = M[start_third : start_third + b]\n fourth_part = M[start_third + b : st...
B
code-226783-d828b66e8739
code-question-80e50f50094f0844
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "phi_b = euler_phi(b)\n E_mod_phi_b = pow(3, x, phi_b)\n R_mod_b = pow(3, E_mod_phi_b, b)\n a_inv = modinv(a, b)\n if a_inv is None:\n a_inv = 1\n k = (R_mod_b * a_inv) % b\n R = (k + a) % b\n return R_mod_b % y", "phi_b = euler_phi(b)\n E_mod_phi_b = (3 ** x)\n R_mod_b = pow(3, ...
D
code-191051-879e3a635d3c
code-question-43b01cada7d2798c
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for c in s:\n upper_c = c.upper()\n pos = ord(upper_c) - ord('A')\n if pos >= cutoff:\n result.append(upper_c)\n else:\n result.append(upper_c.lower())", "for c in s:\n upper_c = c.upper()\n pos = ord(upper_c) - ord('A')\n if pos <= cutoff:\n result.append(c)\n else:\...
F
code-173951-551223ce95b0
code-question-e713944bd66ffdfd
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "current = s\n for i in range(n - k + 1):\n first = current[i]\n for j in range(i, i + k - 1):\n current[j] = current[j + 1]\n current[i + k - 1] = first\n current_str = ''.join(current)\n if current_str < ''.join(min_s...
E
code-088769-f31f2f6e4e54
code-question-419417c31fe41539
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "counts = [0] * 26\n for c in s:\n counts[ord(c) - 97] += 1\n if ref is None:\n ref = sorted(counts)\n else:\n if sorted(counts) != ref:\n possible = False\n break", "counts = [0] * 26\n for c in s:\n counts[ord(...
E
code-150922-158aac743fdb
code-question-be287ec8148229cb
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "next_states = []\n if ce > 0 and cd > 0:\n next_states.append((ce - 1, cd - 1, cg))\n if ce > 0 and cg > 0:\n next_states.append((ce - 1, cd, cg - 1))\n if cd > 0 and cg > 0:\n next_states.append((ce, cd - 1, cg - 1))", "next_states = []\n if ce > 0 an...
B
code-018096-292cb206a7db
code-question-863d196933ffc16e
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "total = 0\nfor r in range(k):\n for s in range(k):\n if (r + s) % k == 0:\n total += counts[r] * counts[s]", "total = 0\nif counts[0] > 1:\n total += counts[0]\nfor r in range(1, k // 2 + 1):\n comp = k - r\n if r != comp:\n total += counts[r] * counts[r]\n else:\n ...
D
code-223656-b30896e1da75
code-question-8c1c7d875a4eae7c
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "else:\n x = n\n if (x & (x - 1)) == 0:\n print(1)\n else:\n print(0)", "else:\n x = n + 2\n if (x & (x - 1)) == 0:\n print(1)\n else:\n print(0)", "else:\n x = n ^ 1\n if (x & (x - 1)) == 0:\n print(1...
D
code-101846-d44fc35fa84e
code-question-9178aff3f3c1f823
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "same_type = (sum_a // k) + (sum_b // k)\nsame_tree = 0\nfor a, b in trees:\n same_tree += (a + b) // k\nprint(same_tree)", "same_type = (sum_a // k) + (sum_b // k)\nsame_tree = 0\nfor a, b in trees:\n same_tree += (a + b) // k\nprint(max(same_type, same_tree))", "same_type = 0\nfor a, b in trees:\n sa...
B
code-144264-eb3ab2932b8c
code-question-d32148f3df3cff10
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "prefix = []\n current = 0\n for s in students:\n current += 1\n prefix.append(current)", "prefix = []\n current = 0\n for s in students:\n current += s\n prefix.append(current)", "prefix = []\n current = -1\n for s in students:\n current += s\n prefix...
B
code-263256-6695c891abfa
code-question-9e62c8b181e1473e
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "pass_flag = True\n for i in range(m):\n if (total / m) <= thresholds[i]:\n pass_flag = False\n break\n if pass_flag:\n count += 1", "pass_flag = True\n for i in range(n):\n if scores[i] < thresholds[i]:\n pass_flag...
G
code-076767-b29bdeb34505
code-question-5209443edd9c567b
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for p, c in projects:\n if current_rep >= p:\n new_rep = current_rep + c\n if new_rep >= 0:\n current_rep = new_rep\n else:\n count += 1", "for p, c in projects:\n if p <= current_rep + c:\n count += 1\n current_rep += c\n else:\n break", ...
C
code-044262-0829b5880f3d
code-question-8aac1e7f7d4bd0a9
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "prefix_set = set()\n current_sum = 0\n prefix_set.add(0)\n found = False\n for num in costs:\n current_sum = max(current_sum + num, num)\n if (current_sum == Y):\n found = True\n break\n prefix_set.add(current_sum)", "pref...
G
code-254952-8bdcf4e168f4
code-question-24d5a630198951d6
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for a_i, key_mask in keys:\n if (mask & key_mask) == key_mask:\n continue\n new_mask = mask ^ key_mask\n new_cost = cost + a_i\n if new_cost < dp[new_mask]:\n dp[new_mask] = new_cost\n heapq.heappush(heap, (new_cost, new_mask)...
G
code-151748-a980ba585299
code-question-39c6f86bcc8b9005
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "runs = 1\n for i in range(1, len(lst)):\n if lst[i] != lst[i-1]:\n runs += 1\n print(runs + 1)", "runs = 0\n for i in range(1, len(lst)):\n if lst[i] != lst[i-1]:\n runs += 1\n print(runs * 2)", "runs = 1\n for i in range(len(lst)):\n if i > 0 and lst[i...
D
code-157927-9de789b0bc47
code-question-7e228cbe3263aabb
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "s1 = b[0] + b[1]\n s2 = b[0] + 2 * b[2]\n s3 = 2 * b[1] + b[2]\n current_gcd = math.gcd(math.gcd(s1, s2), s3)\n for i in range(3, m):\n s = b[0] + 2 * b[i]\n current_gcd = math.gcd(current_gcd, s)\n if current_gcd == 1:\n break", "s1 = b[0] + b[1]\n s2 = b[0] + b[2]...
F
code-076197-6402dc0a5e1b
code-question-27b9b90bae5602f7
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "a = 0\n b = 0\n for i in range(n):\n if x[i] != y[i]:\n if x[i] == '0':\n a += 1\n else:\n b += 1\n if a != b:\n print(-1)\n else:\n x_a_positions = []\n for i in range(n):\n if x[i] == '0' and y[i] == '1':\n ...
D
code-122984-cb07c3954238
code-question-3b80836dbfbf81ca
5
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "max_divisor = math.isqrt(n) - 1\n for i in range(3, max_divisor + 1, 2):\n if n % i == 0:\n return False", "max_divisor = math.isqrt(n)\n for i in range(2, max_divisor + 1, 2):\n if n % i == 0:\n return False", "max_divisor = math.isqrt(n)\n for i in range(3, max_di...
E
code-271138-64913565f01c
code-question-7626d2d354f91b79
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for c in coefficients:\n term = (c * x_pow) % MOD\n result = (result + term) % MOD\n x_pow = (x_pow * x) % MOD", "for c in coefficients:\n term = (abs(c) * x_pow) % MOD\n result = (result + term) % MOD\n x_pow = (x_pow * x) % MOD", "for c in coefficients:\n x_pow = (x_pow * x) % MOD\n t...
A
code-078790-597b96c0ab40
code-question-6bd01a8604e972d7
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for op in operands:\n modified = []\n for ch in op:\n d = int(ch)\n mod_d = (d + 1) % 10\n modified.append(str(mod_d))\n modified_operands.append(int(''.join(modified)))", "for op in operands:\n modified = []\n for ch in op:\n d = int(ch)\n mod_d = 9 - d\n ...
A
code-221025-b6f03ec2549d
code-question-eb55fface875a686
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for c in s:\n if c.isalpha():\n count += 1\n else:\n if c in even_digits:\n count += 1", "for c in s:\n if c.isalpha():\n if c in vowels:\n count += 1\n else:\n if c in even_digits:\n count += 1", "for c in s:\n if c.isalpha():\n ...
C
code-200823-144bce3f3fc5
code-question-682fe0028a52d693
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for idx, c in enumerate(S):\n if is_prime(idx):\n prime_sum += int(S)\n else:\n non_prime_sum += int(S)", "for idx, c in enumerate(S):\n if idx % 2 == 0:\n prime_sum += int(c)\n else:\n non_prime_sum += int(c)", "for idx, c in enumerate(S):\n if is_prime(idx):\n ...
E
code-081611-6d77531fa7cd
code-question-4243887c2d00b984
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if S > 0:\n S -= 1\n elif D > 0:\n D -= 1\n H += 1\n elif H > 0:\n H -= 1\n else:\n denied += 2", "if S > 0:\n S -= 1\n elif D > 0:\n D -= 1\n H += 1\n elif H > 0:\n H += 1\n ...
D
code-115238-43b20f9347d8
code-question-eee868c376d11236
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if a[i] * k > current_sum:\n print(\"Yes\")\n else:\n print(\"No\")\n current_sum += a[i] - a[i - k - 1]", "if a[i] * k < current_sum:\n print(\"Yes\")\n else:\n print(\"No\")\n current_sum += a[i] - a[i - k]", "if a[i] * k > current_sum:\n print(\"Yes\")\n els...
C
code-228315-80f37953e973
code-question-4f299e0c7cc83851
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "lcm_val = compute_lcm(stones)\nsum_mod = sum(stones) % MOD\nif lcm_val == 0:\n print(1)\nelse:\n exp = lcm_val % (MOD - 1)\n result = pow(sum_mod, exp, MOD)\n print(result)", "lcm_val = compute_lcm(stones)\nsum_mod = sum(stones) // MOD\nif lcm_val == 0:\n if sum_mod == 0:\n print(0)\n el...
G
code-040119-56ea76729c52
code-question-ac740e5cde3d3337
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for _ in range(m):\n c, p = input().split()\n p = int(p)\n if p in max_prices:\n if p > max_prices[p]:\n max_prices[p] = p\n else:\n max_prices[p] = p", "for _ in range(m):\n p, c = input().split()\n p = int(p)\n if c in max_prices:\n if p > max_prices[c]:\n ...
D
code-009773-ed6a64a55862
code-question-4c840810f9d59c3c
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if count_y > 0:\n print(\"NO\")\nelse:\n if count_x > 0:\n print(\"YES\")\n else:\n print(\"NO\")", "if 'Y' not in s:\n print(\"NO\")\nelse:\n if count_y % count_x == 0:\n print(\"YES\")\n else:\n print(\"NO\")", "if count_y == 0:\n print(\"NO\")\nelse:\n if ...
G
code-037895-0af2f2b5e38c
code-question-2ff2b5e1c57296ab
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = 0\n for age in ages:\n if 18 <= age < 50:\n count += 1", "count = 0\n for age in ages:\n if 19 <= age <= 50:\n count += 1", "count = 0\n for age in ages:\n if age >= 18 or age <= 50:\n count += 1", "count = 0\n for age in ages:\n ...
D
code-002648-58b63100c5c6
code-question-c713641986e67233
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "w_sorted = sorted(w)\n prefix = [0]\n current_sum = 0\n for num in w_sorted:\n prefix.append(num)\n current_sum += num", "w_sorted = w[:]\n prefix = [0]\n current_sum = 0\n for num in w_sorted:\n current_sum += num\n prefix.app...
G
code-057737-a4022c16fa67
code-question-7c946fc7b579aed8
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "path = []\n current = i\n hops = 0\n while current > 1:\n current = parent[current]\n hops += 1\n if current == 0:\n break\n if current == 1:\n continue\n path.append((current, hops))", "path = []\n c...
E
code-071326-ae0525b40b03
code-question-82a0d56e743a5bbc
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "dp = [0] * (max_N + 1)\n dp[0] = 1\n if max_N >= 1:\n dp[1] = 1\n if max_N >= 2:\n dp[2] = 2\n for i in range(3, max_N + 1):\n dp[i] = dp[i-1] + dp[i-2] + (dp[i-3] % MOD)", "dp = [0] * (max_N + 1)\n dp[0] = 1\n if max_N >= 1:\n ...
D
code-136232-1a1a2acdb316
code-question-8326fcd1b820bb99
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "possible_sums = {0}\nfor w in weights:\n possible_sums |= {abs(s - w) for s in possible_sums}\nmax_half = total // 2\nbest = 0\nfor s in possible_sums:\n if s <= max_half and s > best:\n best = s", "possible_sums = {0}\nfor w in weights:\n possible_sums |= {w}\nmax_half = total // 2\nbest = 0\nfo...
F
code-236112-66879bc8261d
code-question-a9c5d5420a7a1878
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "parts = sys.stdin.readline().split()\n d = int(parts[0]); k = int(parts[1]); x = int(parts[2])\n total_added += (k * x) if d == 1 else -(k * x)\n print(\"YES\" if total_added >= 0 else \"NO\")", "parts = sys.stdin.readline().split()\n d = int(parts[0])\n k =...
B
code-127152-a1f9b63f4185
code-question-7922e2697aafc614
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for i in range(2, m + 1):\n if i % 2 == 0:\n term = \"order\"\n verb = \"bring\"\n else:\n term = \"chaos\"\n verb = \"cause\"\n s += f\" to {term} {verb}\"", "for i in range(2, m + 1):\n if i % 2 == 1:\n term = \"order\"\n verb = \"bring\"\n else:\n ...
F
code-208572-61429b2b9425
code-question-dafce87043e28377
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if present[x]:\n total -= pages[x]\n else:\n total += pages[x]\n present[x] = present[x]\n print(total)", "if present[x]:\n total -= pages[x]\n else:\n total += pages[x]\n present[x] = not present[x]\n print(pages[x])", "if p...
C
code-064149-955a5ee53499
code-question-5574890aec71f632
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "new_sums = set()\n for s in current_sums:\n new_sums.add(s * b)\n new_sums.add(-s * b)\n current_sums = new_sums", "new_sums = set()\n for s in current_sums:\n new_sums.add(s)\n new_sums.add(s + b)\n current_sums = new_sums", "new_sums = s...
D
code-102224-877738ef2f6a
code-question-60e2402b202ca73e
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "number_of_free = n // 3\nfree = 0\nfor i in range(number_of_free):\n free += costs_sorted[3 * i] // 2\ntotal = sum(costs_sorted) - free", "number_of_free = n // 3\nfree = 0\nfor i in range(number_of_free):\n free += costs_sorted[-(i + 1)]\ntotal = sum(costs_sorted) - free", "number_of_free = n // 3\nfree...
F
code-265842-40087ba8f7f9
code-question-1d94e74e7ab37279
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count_a = compute_mod_counts(a)\ncount_b = compute_mod_counts(b)\ntotal = (count_a[0] + count_a[1] + count_a[2]) * (count_b[0] + count_b[1] + count_b[2])\nprint(total)", "count_a = compute_mod_counts(a)\ncount_b = compute_mod_counts(b)\ntotal = sum(min(x, y) for x, y in zip(count_a, count_b))\nprint(total)", "...
D
code-128855-827881842c9f
code-question-321d2eb9cfff78d7
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "selected = []\nfor r in rating_to_indices:\n if len(selected) >= m:\n break\n break\n selected.append(rating_to_indices[r][0])\nprint(\"POSSIBLE\")\nprint(' '.join(map(str, selected)))", "selected = []\nfor r in rating_to_indices:\n if len(selected) >= m:\n break\n selected.append(ra...
B
code-140412-05fef4b7d077
code-question-2e8093203f03ba02
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = Counter(colors)\nhalf = m // 2\ncandidates = [color for color, cnt in count.items() if cnt == half]", "count = Counter(colors)\nhalf = m // 2\ncandidates = [color for color, cnt in count.items() if cnt >= half]", "count = Counter(colors)\nhalf = len(count) // 2\ncandidates = [color for color, cnt in co...
A
code-040820-3216c791acd8
code-question-0433fd4a26b71976
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for customer_c in c:\n h = groups.get(customer_c, [])\n while h:\n current_p, current_i = h[0]\n if not sold[current_i]:\n res.append(current_p)\n heapq.heappop(h)\n break\n else:\n heapq.heappop(h)\n ...
E
code-001147-91fcae40fcd4
code-question-ca65bd99b6292cc4
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "if x < min_x:\n min_x = x\n if x < max_x:\n max_x = x\n if y < min_y:\n min_y = y\n if y < max_y:\n max_y = y", "if x < min_x:\n min_x = x\n if x > max_x:\n max_x = x\n if y < min_y:\n min_y = x\n ...
E
code-021920-be057551118f
code-question-c3d86b65becd921b
6
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = 0\nfor i in range(N):\n for j in range(i + 1, N):\n if not adj[i][j] and not adj[j][i]:\n if (masks[i] & masks[j]) != 0:\n count += 1\nprint(count)", "count = 0\nfor i in range(N):\n for j in range(N):\n if i != j and not adj[i][j]:\n if (masks[i] ...
F
code-261930-f40fd4086317
code-question-aab762469874552a
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "current_sum += num\n mod = current_sum % 3\n result += mod_counts.get(mod, 0)\n mod_counts[mod] = mod_counts.get(mod, 0) + 1", "current_sum += num\n mod = current_sum % 5\n result += 1 if mod == 0 else 0\n mod_counts[mod] = mod_counts.get(mod, 0) + 1", "current_sum = num\n mod = current_su...
F
code-182131-52b007a1e9f1
code-question-df661c707a39bec4
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "a = (2 * r * (n - (l - 1)) ) / (n * (n + 1))\n term = pow(1.0 - a, k)\n if s == 1:\n sum_inversion += term\n else:\n sum_noninversion += term", "a = (2 * l * (n - (r - 1)) ) / (n * (n + 1))\n term = pow(1.0 - a, k)\n if s == 1:\...
E
code-236862-b608f0ec7cf6
code-question-44b8a326b6088b2f
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "odd_count = 0\n for count in freq.values():\n if count > 1:\n odd_count += 1\n if len(s) % 2 == 0:\n print(\"Yes\" if odd_count == 0 else \"No\")\n else:\n print(\"Yes\" if odd_count == 1 else \"No\")", "odd_count = 0\n for ch in freq:\n if freq[ch] & 1 == 0:\n ...
C
code-048397-26f95e4da122
code-question-57c255d12a38e7ad
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "missed = []\nfor color, name in objects_list:\n if color in observed:\n missed.append(name)", "missed = []\nfor color, name in objects_list:\n if color not in observed:\n missed.append(name)", "missed = []\nfor color, name in color_to_name.items():\n if name not in observed:\n mis...
G
code-149922-5e0fef6b004d
code-question-380b78fdba9144eb
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "heapq.heappush(heap, x)\n if len(heap) > 3:\n heap.pop()\n if len(heap) >= 3:\n product = heap[0] * heap[1] * heap[2]\n print(product)\n else:\n print(-1)", "heapq.heappush(heap, x)\n if len(heap) > 3:\n pass\n arr = sorted...
D
code-001664-bce263c793cc
code-question-e225aff30539eb19
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "cross_x = b[1] * c[2] + b[2] * c[1]\n cross_y = b[2] * c[0] + b[0] * c[2]\n cross_z = b[0] * c[1] + b[1] * c[0]\n dot = a[0] * cross_x + a[1] * cross_y + a[2] * cross_z\n vol = abs(dot) / 6.0", "cross_x = b[1] * c[2] - b[2] * c[1]\n cross_y = b[2] * c[0] - b[0] * c[2]\n ...
F
code-169216-0b475d8c9338
code-question-4e9488b393abf197
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "transformed = []\nfor num in nums:\n if num % 2 == 0:\n transformed.append(num - 6)\n else:\n transformed.append(num + 10)\nresult = ' '.join(map(str, transformed))\nprint(result", "transformed = []\nfor num in nums:\n if num % 2 == 0:\n transformed.append(num - 7)\n else:\n ...
B
code-014833-99caf5e4d687
code-question-bece8e5b27630729
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "cube_m = M ** 3\n cube_n = N ** 3\n reversed_cube_m = int(str(cube_m)[::-1])\n if reversed_cube_m == cube_n:\n print(N)\n else:\n print(\"No\")", "cube_m = M ** 3\n cube_n = N ** 3\n reversed_cube_m = str(cube_m)[::-1]\n if reversed_cube_m ==...
G
code-219465-1e1c50ab7870
code-question-8a25061381afd82f
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "mat = multiply(mat, mat)\n if power % 2 == 1:\n result = multiply(result, mat)\n power //= 2", "if power % 2 == 0:\n result = multiply(result, mat)\n mat = multiply(mat, mat)\n power //= 2", "if power % 2 == 1:\n result = multiply(result, mat)\n ...
E
code-211229-e925f58727ad
code-question-c6d80adde5c31657
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "results = []\n for xi, yi in queries:\n a = xi\n b = yi - 1\n if a >= b:\n results.append(0)\n else:\n res = pre[b] - pre[a]\n results.append(res)", "results = []\n for xi, yi in queries:\n a = xi - 1\n b = yi - 2\n if a > b:...
G
code-172488-8eed7368fed7
code-question-e77bc051b2f57416
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "first = s.find('a')\n last = s.rfind('a')\n segment = s[first:last+1]\n return all(c == 'a' for c in segment)", "first = s.find('a')\n last = s.rfind('a')\n segment = s[first:last+1]\n return 'b' not in s", "first = s.find('a')\n last = s.rfind('a')\n segment = s[first:last+1]\n retu...
A
code-172968-63e8ae4d319f
code-question-9bc7a6447c38c3b0
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "i = j = 0\ncount_b = n\nwhile i < n and j < n:\n if B[j] >= A[i]:\n count_b -= 1\n i += 1\n j += 1\n else:\n j += 1\nmin_bob = count_b", "i = j = count_b = 0\nwhile i < n and j < n:\n if B[j] >= A[i]:\n count_b += 1\n i += 1\n j += 1\n else:\n j...
D
code-051463-ae450db0b177
code-question-60d7a48eb0125a81
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for c in s:\n if c == ' ':\n translated.append(' ')\n else:\n shifted_char = chr((ord(c) - ord('b') + 1) % 26 + ord('a'))\n translated.append(shifted_char)", "for c in s:\n if c == ' ':\n translated.append(' ')\n else:\n shifted_c...
F
code-146089-d055f56198e0
code-question-1cb5c8185290258d
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "distance = xj - xi\n denominator = vi\n time = distance / denominator\n if time < min_time:\n min_time = time", "distance = xj - xi\n denominator = vi - vj\n time = distance / denominator\n if time < min_time:\n min_t...
B
code-263732-649b4d5586e9
code-question-b0158a67b05a48e1
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "start = steps.index(next_val)\n loop = step - start\n if M < start:\n return steps[M]\n else:\n return steps[start + (M % loop)]", "first_occurrence = steps.index(next_val)\n cycle_length = step - first_occurrence\n if M < first...
H
code-272038-e10c09af6aad
code-question-ab38e85d16f68685
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "while left < right:\n if a[left] - b[right] > b[left] - a[right]:\n count += right - left\n right -= 1\n else:\n left += 1", "while left < right:\n if c[left] + c[right] > 0:\n count += right - left\n left += 1\n else:\n ...
E
code-119609-9bebd0638d0b
code-question-14be583dbd8a8511
7