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...
[ "for i in range(M):\n for task in preferences[i]:\n if task not in used_tasks:\n result[task] = i\n used_tasks.add(task)\n break", "for i in range(M):\n used_tasks = set()\n for task in preferences[i]:\n if task not in used_tasks:\n result[i] = ta...
F
code-032215-9ceacca5c999
code-question-452ab7a4f8bf9c46
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...
[ "all_lit = True\nfor i in range(1, n + 1):\n if i in covered:\n all_lit = False\n break", "all_lit = False\nfor i in range(1, n + 1):\n if i not in covered:\n all_lit = True\n break", "all_lit = True\nfor i in range(1, n + 1):\n if i not in covered:\n continue\n ...
E
code-137489-c7ac1c55bee6
code-question-be2fb73ebe22032e
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...
[ "s_new = s_prev + s\n if s_new >= v:\n continue\n new_states.append((s_new, t_prev + s))\n t_new = t_prev + s\n new_states.append((s_new, t_new))", "s_new = s_prev + s\n if s_new > v:\n s_new %= v\n new_states.append((...
G
code-228964-adddc490c683
code-question-182c910d30621217
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...
[ "used = [0] * (n + 1)\nptr = 0\nres = []\nfor num in b:\n if num < 1 or num > n:\n res.append(num)\n elif used[num] == 0:\n used[num] = 1\n res.append(num)\n else:\n res.append(missing[ptr])\n ptr += 1", "used = [0] * (n + 1)\nptr = 0\nres = []\nfor num in b:\n if 1 ...
C
code-037451-f9bf868c0de2
code-question-24626213370723dd
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...
[ "min_a = min(a)\n m = sum(1 for x in a if x >= min_a)\n power = pow(2, m, MOD)\n ans = (power - 1) % MOD", "min_a = min(a)\n m = a.count(min_a)\n power = pow(2, n, MOD)\n ans = (power - 1) % MOD", "min_a = min(a)\n m = a.count(min_a)\n power = pow(2, m, MOD)\n ans = power % MOD", "m...
G
code-216091-4fa175e2cd72
code-question-58060c9c591ee95c
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...
[ "counts = [0] * 10\nnum = start\nwhile num <= end - 1:\n s = str(abs(num))\n for c in s:\n if c.isdigit():\n counts[int(c)] += 1\n num += 1", "counts = [0] * 10\nfor num in range(start, end + 1):\n s = str(abs(num))\n if s:\n counts[int(s[-1])] += 1", "counts = [0] * 10\n...
G
code-031175-cb66a9b540be
code-question-393ae3ab24cd6cde
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(n-1):\n if i % 2 == 0:\n new_even = sum_even - f[i] + f[i+1]\n new_odd = sum_odd + f[i] - f[i+1]\n else:\n new_even = sum_even - f[i+1] + f[i]\n new_odd = sum_odd - f[i] + f[i+1]\n ...
A
code-066363-4d89172e2717
code-question-d1d7d99cd17d7005
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...
[ "expected = 2\nfor num in positives:\n if num < expected:\n continue\n elif num == expected:\n expected += 2\n else:\n break", "expected = 1\nfor num in positives:\n if num < expected:\n break\n elif num == expected:\n expected += 1\n else:\n expected = ...
C
code-220846-f872d148117b
code-question-b4b94b4b501b9ddb
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 n in range(2, max_n + 1):\n divisor = n - spf[n]\n length[n] = 1 + length[divisor]\n total = sum(length[A:B+1])", "for n in range(2, max_n + 1):\n divisor = n // spf[n]\n length[n] = length[divisor]\n total = sum(length[A:B+1])", "for n in range(2, max_n + 1):\n div...
C
code-125242-f6a2f2510a2d
code-question-c782c28a60b51a7e
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] * k\n dp[0] = 1\n for num in mods:\n new_dp = dp.copy()\n for r in range(k):\n new_r = (r - num) % k\n new_dp[new_r] = (new_dp[new_r] + dp[r]) % MOD\n dp = new_dp\n ans = (dp[0] - 1) % MOD\n...
F
code-095967-124475984af2
code-question-1e8a69f41a9bf4d3
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...
[ "rem = N % 5\n target = (rem * 4) % 5\n max_y = N // 9\n print(\"YES\" if target <= max_y else \"NO\")", "rem = N % 5\n target = (rem * 2) % 5\n max_y = N // 9\n print(\"YES\" if target <= max_y else \"NO\")", "rem = N % 9\n target = (rem * 4) % 5\n max_y = N // 9\n print(\"YES\" if t...
A
code-184338-f9e99ede090f
code-question-982fb4c203421371
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...
[ "c = (ord(s[i + j]) - ord('A') + 1) % 26\n t = target[j]\n diff = abs(c - t)\n total += min(diff, 26 - diff)", "c = ord(s[i + j]) - ord('A')\n t = target[j]\n diff = abs(c - t)\n total += min(diff, 26 - diff)", "c = ord(s[i + j]) - ord('A')\n t = target[(j + 1) %...
B
code-219581-a0b5c931dba3
code-question-ae30acbf0402a2fc
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...
[ "primes = sieve(n - 1)\n decryption_order = primes[::-1]\n current = list(s)\n for p in decryption_order:\n if p > 0:\n current[:p] = current[:p][::-1]", "primes = sieve(n)\n decryption_order = primes[::-1]\n current = list(s)\n for p in decryption_order:\n current = cur...
E
code-239885-3c9221a8a035
code-question-3d3bbd1f3ea05d17
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...
[ "s = sum_div[d]\n x_d = (current_a - s) % 2\n x[d] = x_d\n m = 2 * d\n while m <= N:\n sum_div[m] = (sum_div[m] + x_d) % 2\n m += m", "s = sum_div[d]\n x_d = (current_a ^ s)\n x[d] = 1 - x_d\n m = 2 * d\n while m <= N:\n sum_...
C
code-156620-0d6a83afc6aa
code-question-f6cba12d74b369a9
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...
[ "cnt = counts[b]\n r = max(initial_row[b] - cnt, 1)\n c_col = ((initial_col[b] - 1 + cnt) % c) + 1\n distance = abs(current_r - r) + abs(current_c - c_col)\n total += distance\n current_r, current_c = r, c_col\n counts[b] += 1", "cnt = counts[b]\n r = initial_row[b...
G
code-127224-acda1e9dce91
code-question-67f7eebc4dea593b
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...
[ "sum_w += w\nsum_xw -= w * x\nsum_yw -= w * y\nsum_x2 += w * x * x\nsum_y2 += w * y * y", "sum_w += w\nsum_xw += w * y\nsum_yw += w * x\nsum_x2 += w * x * x\nsum_y2 += w * y * y", "sum_w += w\nsum_xw += w * x\nsum_yw += w * y\nsum_x2 += x * x\nsum_y2 += y * y", "sum_w += w\nsum_xw += w * x\nsum_yw += w * y\ns...
D
code-076735-8cd1eb66abbe
code-question-1e15717898d3bcbd
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_divisor = int(n ** 0.5) + 1\n for i in range(3, max_divisor, 3):\n if n % i == 0:\n return \"No\"", "max_divisor = int(n ** 0.5) + 1\n for i in range(3, max_divisor, 2):\n if n % i == 0:\n return \"No\"", "max_divisor = int(n ** 0.5) + 1\n for i in range(3, max_...
B
code-071718-105f819a476d
code-question-fa2e1a50dfe8d3f1
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 d in range(1, 101):\n count = 0\n for num in a:\n product = num * d\n if product > 0:\n count += 1\n if count >= target:\n print(d)\n exit()\nfor d in range(-1, -101, -1):\n count = 0\n for num in a:\n product = num * d\n ...
A
code-182761-c8b06c21c205
code-question-ac0dec020b37c19f
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...
[ "candies = min(D, remaining)\nmax_points += candies * 3\nremaining -= candies\nif remaining > 0:\n chocolates = min(E, remaining)\n max_points -= chocolates * 3", "candies = min(D, remaining)\nmax_points += candies * 2\nremaining -= candies\nif remaining > 0:\n chocolates = min(E, remaining)\n max_poi...
F
code-203944-152971c7a361
code-question-9536ffb131647f23
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(n):\n if i > 0 and c[i] > 2 * c[current_left]:\n current_left = i\n window_size = i - current_left\n if window_size > max_len:\n max_len = window_size", "for i in range(1, n):\n if c[i] <= 2 * c[current_left]:\n pass\n else:\n current_left += 1\n windo...
H
code-157070-73a1558bf28b
code-question-4b9ac7fd693cad08
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...
[ "m11 = (N - 1) // 10\nsum11 = 11 * m11 * (m11 + 1) // 2\nm55 = (N - 1) // 55\nsum55 = 55 * m55 * (m55 + 1) // 2\ntotal = sum5 + sum11 - sum55", "m11 = N // 11\nsum11 = 11 * m11 * (m11 + 1) // 2\nm55 = N // 55\nsum55 = 55 * m55 * (m55 + 1) // 2\ntotal = sum5 + sum11 - sum55", "m11 = (N - 1) // 11\nsum11 = 11 * m...
D
code-083165-b448e913c8b1
code-question-cc7f8d36bc9a600d
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...
[ "operations = [lambda a, b: a + b,\n lambda a, b: a - b,\n lambda a, b: a * b,\n lambda a, b: a // b]\n op_index = 1\n for i in range(n - 1, 0, -1):\n res = operations[op_index % 4](res, i)\n op_index += 1", "operations = [lambda a, b: a + b,\...
C
code-184304-3e7e097ea60d
code-question-249412491aef4c47
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...
[ "x_candidates = set([0])\n for s, t in intervals:\n x_candidates.add((s + t) // 2)\n x_candidates.add(s)\n x_candidates.add(t)\n max_sum = 0\n for x in x_candidates:\n current = 0\n for s, t in intervals:\n start = max(x, s)\n end = min(x + T, t)\n ...
G
code-230309-01a4ab53cefa
code-question-7cd8a00129ede021
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 = frequency[num]\n take = min(count, remaining)\n sum_total += num * take\n remaining -= take\n if remaining == 0:\n break", "count = frequency[num]\n take = max(count, remaining)\n sum_total += num * take\n remaining -= count\n if remainin...
A
code-236202-83b2406ed3b6
code-question-9f2a182039220aea
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 c == 'A':\n res.append('A')\nelif c == 'B':\n res.append('B')\nelif c == 'X':\n if t:\n res.pop()", "if c == 'A':\n res.append('A')\nelif c == 'B':\n res.append('B')\nelif c == 'X':\n if res:\n res.pop()", "if c == 'A':\n res.append('A')\nelif c == 'B':\n res.append('B'...
B
code-047056-bbd4f7aaac89
code-question-9b3befd3fb0f0f0e
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 current_is_vowel = is_vowel(c)\n if current_is_vowel != expected_vowel:\n deletions += 1\n else:\n deletions += 1", "for c in s:\n current_is_vowel = is_vowel(c)\n if current_is_vowel == expected_vowel:\n ...
H
code-266957-749cdfb40b26
code-question-4b6fcc07616a94a4
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...
[ "sum_top3 = c_sorted[0] + c_sorted[1] + c_sorted[2]\n max_top3 = c_sorted[0]\n if sum_top3 >= sum_v and max_top3 >= max_v:\n print(\"YES\")\n else:\n print(\"NO\")", "sum_top3 = c_sorted[0] + c_sorted[1] + c_sorted[2]\n max_top3 = c_sorted[0]\n if sum_top3 >= sum_v and max_top3 >= sum...
A
code-063525-93f01415719e
code-question-3f1a90f3f7db8b85
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...
[ "time = (fi - si) / v\n print(\"{0:.6f}\".format(time))", "time = (fi - si) // v\n print(\"{0:.6f}\".format(time))", "time = (fi - si) / (v + d)\n print(\"{0:.6f}\".format(time))", "time = (fi - si - d) / v\n print(\"{0:.6f}\".format(time))", "time = (si - fi) / v\n print(...
A
code-130888-94969a48f113
code-question-22efb9341481c8f1
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 x in reversed(arr):\n r = bisect.bisect_left(sorted_arr, x)\n total_swaps += fen.query(r - 1)\n fen.update(r, 1)", "for x in reversed(arr):\n r = bisect.bisect_left(sorted_arr, x) + 1\n total_swaps += fen.query(r)\n fen.update(r, 1)", "for x in reversed(arr):\n r = bisect.bisect_left(s...
G
code-097747-a0cd372a26e8
code-question-bbe712c779639eeb
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...
[ "indices = [p[0] for p in primes]\nvalues = [p[1] for p in primes]\norder = sorted(range(len(values)), key=lambda k: values[k])\nsorted_values = sorted(values)\nsorted_indices = [indices[i] for i in order[::-1]]\nfor i in range(len(sorted_values)):\n b[sorted_indices[i]] = sorted_values[i]", "indices = [p[0] f...
C
code-000514-d9cc2a89a7bb
code-question-39825ff6a4125285
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 temp = A\n while temp % Y == 0:\n a += 1\n temp = temp / Y\n b = 0\n temp = B\n while temp % Y == 0:\n b += 1\n temp = temp / Y\n remaining_A = int(A / (Y ** a))\n remaining_B = int(B / (Y ** b))\n if remain...
F
code-191457-d47a5da33f66
code-question-f19f7ffc27469180
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...
[ "max_sum = 0\nfor i in range(n):\n max_sum = (max_sum + v[i] * pow2[i]) % MOD\nmin_sum = 0\nfor i in range(n):\n min_sum = (min_sum + v[i] * pow2[i]) % MOD\nresult = (max_sum - min_sum) % MOD", "max_sum = 0\nfor i in range(n):\n max_sum = (max_sum + v[i] * pow2[i]) % MOD\nmin_sum = 0\nexponent = n - 1\nf...
F
code-122609-b4af077cf6ed
code-question-47fcc2baa68a2c7e
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 _ in range(n):\n op, d = input().split()\n d = int(d)\n if op == '+':\n toys += d\n else:\n if toys > d:\n disappointed += 1\n else:\n toys -= d", "for _ in range(n):\n d, op = input().split()\n d = int(d)\n if op == '+':\n toys += d\n ...
E
code-040594-8a91d9107a50
code-question-ced12c83e83948a3
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...
[ "cnt = Counter(a)\n res = 0\n for f in cnt.values():\n if f < k:\n res += (k - f)\n else:\n res += 0", "cnt = Counter(a)\n res = 0\n for f in cnt.values():\n if f < k:\n res += 0\n else:\n ...
F
code-055261-35a3520107b3
code-question-59aae461a9abe1e6
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...
[ "original = ord(c) - ord('a')\n shifted = (original - 4) % 26\n decrypted.append(chr(shifted + ord('a')))", "original = ord(c) - ord('a')\n shifted = (original - 3)\n decrypted.append(chr(shifted + ord('a')))", "original = ord(c) - ord('a')\n shifted = (ori...
F
code-038373-f6e783d1b967
code-question-f2edba343a6cb6eb
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 n > 0:\n remainder = n % 26\n digits.append(remainder)\n n //= 26\n return ''.join(chr(ord('A') + d) for d in digits) if digits else 'A'", "while n > 0:\n remainder = n % 26\n digits.append(remainder)\n n //= 26\n digits = digits[::-1]\n return ''.join(chr...
D
code-253594-195d494c7fd1
code-question-8e38a6099bc15674
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...
[ "inverse = (-s, -t)\nif inverse in freq:\n a = freq[(s, t)]\n b = freq[inverse]\n group_factor = (pow(2, a + 1, mod) + pow(2, b + 1, mod) - 2) % mod\n result = (result * group_factor) % mod\n processed.add((s, t))\n processed.add(inverse)", "inverse = (t, s)\nif inverse in freq:\n a = freq[(s...
F
code-200085-ca2d85d98962
code-question-6b4134d8c42076cf
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 any(int(c) % 2 == 0 for c in s):\n result.append(str(i))", "all_odd = True\n for c in s:\n if int(c) % 2 == 0:\n all_odd = False\n break\n if all_odd:\n result.append(str(i))", "for c in s:\n if int(c) % 2 != 0:\n result.append(str(i))\n ...
C
code-148496-e8a6db7bcd79
code-question-3c225e8af212842f
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...
[ "Q = N // D\n M = N % D\n term1 = Q * (Q + 1) * (D - M)\n term2 = M * Q * Q\n sum_kr2 = term1 + term2\n result = (sum_kr2 - N) // 2", "Q = N // D\n M = N % D\n term1 = Q * Q * (D - M)\n term2 = M * (Q + 1) * (Q + 1)\n sum_kr2 = term1 + term2\n ...
D
code-184486-c2186e73c900
code-question-fd5cbde1a9e4af35
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...
[ "visited.add((newx, newy))\nif (newx, newy) in visited:\n steps += 1\n print(steps)\n exit()\nelse:\n x, y = newx, newy\n steps += 1", "if (newx, newy) in visited:\n print(steps)\n exit()\n else:\n x, y = newx, newy\n visited.add((newx, newy))\n steps += 1", ...
C
code-006610-aa039819bee3
code-question-9366f6bad06f2ab6
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...
[ "term1_part1 = E_mod\nterm2_part1 = (E_mod + 1) % MOD\nterm3_part1 = (2 * E_mod + 1) % MOD\nsum_part1 = (term1_part1 + term2_part1) % MOD\nsum_part1 = (sum_part1 + term3_part1) % MOD", "term1_part1 = (E_mod + 1) % MOD\nterm2_part1 = (E_mod + 2) % MOD\nterm3_part1 = (2 * E_mod + 3) % MOD\nsum_part1 = (term1_part1 ...
G
code-086245-0fde7c81e305
code-question-098775705a23231b
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(n // 2):\n j = i\n option1 = (a[i] != b[i]) + (a[j] != b[j])\n option2 = (a[i] != b[j]) + (a[j] != b[i])\n result += min(option1, option2)\nif n % 2 == 1:\n mid = n // 2\n if a[mid] != b[mid]:\n result += 0", "for i in range(n // 2):\n j = n - 1 - i\n option1 = (a[i]...
B
code-225024-9af69109df1b
code-question-31f712936135af66
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(t):\n s = input().strip()\n total = sum(segments[c] for c in s if c.isdigit())\n print(total)", "for _ in range(t):\n s = input().strip()\n total = sum(segments[c] for c in s) // len(s)\n print(total)", "for _ in range(t):\n s = input().strip()\n total = sum(segments[c] f...
D
code-032961-0bb842459371
code-question-b9fb36ba0637159e
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...
[ "L = []\n for e in range(a, b + 1):\n if (e & x) != 0:\n L.append(e)", "L = []\n for e in range(a, b + 1):\n if e == x:\n L.append(e)", "L = []\n for e in range(a, b + 1):\n if (e & (~x)) == 0:\n L.append(e)", "...
C
code-179136-98ae8b9d0ea8
code-question-1adb5138b848f9da
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\n count = 0\n needed = n\n for d, a, b in edges:\n if find(a) != find(b):\n total += d\n union(a, b)\n count += 1\n if count == needed:\n break\n print(total)", "total = 0\n coun...
G
code-018137-35197fcba1c5
code-question-9dc024c7330d0708
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_sum = A[i] + A[j]\n current_product = A[i] * A[j]\n if current_sum == current_product:\n length = j - i + 1\n if length > max_length:\n max_length = length", "current_sum += A[j]\n current_product *=...
D
code-097063-adb679121273
code-question-15a4846ed3f36322
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...
[ "powered = mid * p\n if powered >= y:\n best_b = mid\n high = mid - 1\n else:\n low = mid + 1", "powered = mid ** p\n if powered <= y:\n best_b = mid\n low = mid + 1\n else:\n high = mid - 1", "powered = mid ** p\n ...
C
code-162984-5de2b7594da0
code-question-93d19ac5b787ffc7
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 d in divisors:\n valid = True\n for (u, v) in edges:\n new_u = (u + d) % n\n new_v = (v + d) % n\n if new_u > new_v:\n new_u, new_v = new_v, new_u\n if (new_u, new_v) not in edge_set or (new_v, new_u) not in edge_set:\n val...
D
code-002065-1e3515a28b71
code-question-d06fa0c54e35e2f4
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 == 1:\n median = numbers[n // 2]\nelse:\n median = (numbers[n // 2 - 1] + numbers[n // 2]) / 2", "if n % 2 == 1:\n median = numbers[n // 2]\nelse:\n median = numbers[n // 2]", "if n % 2 == 1:\n median = numbers[n // 2 + 1]\nelse:\n median = (numbers[n // 2] + numbers[n // 2 + 1]) / 2...
A
code-078331-fa871bd6cd88
code-question-4c332aa94e702554
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(1, n + 1):\n total = 0\n for k in range(1, d + 1):\n if i >= k:\n total += dp[i - k]\n dp[i] = total % MOD", "for i in range(1, n + 1):\n total = 0\n for k in range(1, m + 1):\n if i > k:\n total += dp[i - k]\n ...
G
code-214438-4d7ba95ecbae
code-question-0761660ff14b806c
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...
[ "possible = {0}\nfor v in values:\n new_sums = set()\n for s in possible:\n new_sums.add(s + v)\n new_sums.add(v)\n possible = new_sums", "possible = {0}\nfor v in values:\n new_sums = set()\n for s in possible:\n new_sums.add(s)\n new_sums.add(s * v)\n possible = new...
C
code-251155-66bdd76b95b2
code-question-e4dfe7183ea590a0
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 x[right] - x[left] > 2 * k:\n left += 1\n current_sum = prefix[right + 1] - prefix[left]\n if current_sum > max_sum:\n max_sum = current_sum", "while x[right] - x[left] > 2 * k:\n left += 1\n current_sum = prefix[right + 1] - prefix[left + 1]\n if current_sum > max_sum:\n ...
A
code-130884-063cdc4d9c7e
code-question-93e763c3227d2419
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_end = a + length\n b_end = b + length\n if a_end > n or b_end > n:\n match = False\n break\n cnt_a = prefix[c][a_end - 1] - prefix[c][a - 1]\n cnt_b = prefix[c][b_end - 1] - prefix[c][b - 1]\n if cnt_a != cnt_b:\n ...
G
code-172304-2b37ae7fad85
code-question-75746d5109f32e15
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...
[ "sorted_nums = sorted(set(nums))\n left = 0\n right = len(sorted_nums) - 1\n result = []\n while left <= right:\n result.append(str(sorted_nums[left]))\n left += 1\n if left > right:\n break\n result.append(str(sorted_nums[right]...
E
code-264748-bee6063b00b5
code-question-b3230c76891198df
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_k = math.isqrt(L + 1)\nmax_k = math.isqrt(R + 1) + 1\nfor k in range(min_k, max_k):\n i = k * k - 1\n if i <= L:\n continue\n if i >= R:\n break\n total += euler_phi(i)", "min_k = max(1, math.isqrt(L))\nif min_k * min_k < L:\n min_k += 1\nmax_k = math.isqrt(R)\nfor k in range(min...
F
code-084442-aaac077bb545
code-question-c1a0ef82c502fd86
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 w in weights:\n if total + w > L:\n continue\n total += w\n count += 1", "for w in weights:\n if w > L:\n break\n total += w\n count += 1", "for w in weights:\n if total > L:\n break\n total += w\n count += 1", "for w in weights:\n if total + w > L:\n ...
D
code-055563-631e00757e35
code-question-1a14dd0c8a27c66a
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 current > critical_level:\n current *= (100 - drain_per_day) / 100.0\n days += 1", "while current >= critical_level:\n current = current - drain_per_day\n days += 1", "while current > critical_level_percent:\n current *= drain_per_day / 100.0\n days += 1", "whi...
A
code-039930-88c2019321f3
code-question-f30e07395ce3f976
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 low <= high:\n mid = (low + high) // 2\n total_deficit = 0\n possible = True\n for i in range(m):\n needed = f[i] // max(1, mid)\n if s[i] >= needed:\n continue\n total_deficit += needed - s[i]\n if total_deficit > j:\n ...
F
code-147445-72ec9eff7205
code-question-7ba400d9d9ce26e6
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...
[ "completion_times = []\ncurrent_sum = 0\nfor p in pt:\n current_sum = max(current_sum, p)\n completion_times.append(current_sum)\ntotal = sum(completion_times)\naverage = total // n", "completion_times = []\ncurrent_sum = 0\nfor p in pt:\n current_sum = (current_sum + p) // n\n completion_times.append...
C
code-125075-c1d89618fd71
code-question-fd8c2b9766ce2bc0
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...
[ "z = P.count('0')\n o = M - z\n option1 = o\n option2 = 1 + z\n print(min(option1, option2))", "z = P.count('0')\n o = M - z\n option1 = z\n option2 = 1 + o\n print(min(option1, option2))", "z = P.count('0')\n o = M - z\n option1 = z\n option2 = o\n print(max(option1, option2...
B
code-153009-77c3e75e754f
code-question-cc34aedadde6ffad
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 row_idx in range(1, n - 1):\n if remaining <= 0:\n break\n grid[row_idx][1] = '#'\n remaining -= 1\n if remaining <= 0:\n break\n grid[row_idx + 1][2] = '#'\n remaining -= 1", "for row_idx in range(1, n - 1):\n if remaining <= 0:\n ...
F
code-121319-e1482e061ad2
code-question-84653728cb784812
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...
[ "remainder = N - 7 * b\n if remainder % 4 == 0:\n a = remainder // 4\n total = a + b\n if total > min_total:\n min_total = total", "remainder = N - 7 * b\n if remainder % 4 == 0:\n a = remainder // 4\n total = a + b\n i...
B
code-205536-a431cbc3ce2f
code-question-fd0e3ade748c18a5
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_seconds = (H * 3600 + M * 60 - S) % (24 * 3600)\n new_minutes = (total_seconds + 59) // 60\n H = new_minutes // 60\n M = new_minutes % 60", "total_seconds = H * 3600 + M * 60\n new_seconds = total_seconds - S\n new_minutes = new_seconds // 60\n H = new_minutes // 6...
H
code-275961-76d40dd4f62d
code-question-98d934b11ad63055
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...
[ "binary_str = format(num, '032b')\n even_count = binary_str.count('0')\n odd_count = binary_str.count('1')\n print(even_count, odd_count)", "binary_str = bin(num)[2:]\n even_count = binary_str.count('0')\n odd_count = binary_str.count('1')\n print(odd_count, even_count)", "binary_str = bin(num...
F
code-256943-945b904d62f3
code-question-16f407f094bc2624
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 next_time < min_time:\n min_time = next_time\n candidates = []\n elif next_time == min_time:\n candidates.append(i + 1)", "if next_time < min_time:\n min_time = next_time\n candidates = [i + 1]\n elif next_time == min_time:\n candidates.append(i + 1)", "if nex...
B
code-150061-777ad960ff94
code-question-562114c777e163da
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 n % 2 != 0:\n print(-1)\n continue\n d = n // 2\n count0 = s.count('0')\n ones = n - count0\n flips = ones - d\n print(flips)", "ones = s.count('1')\n if ones % 2 != 0:\n print(-1)\n continue\n d = n // 2\n count0 = n - ones\n flips = abs(ones - d)\n p...
H
code-025413-f3d63efa1e3f
code-question-7d5e5d83e59ffd02
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...
[ "sum_val = (a & b) << 1\n carry = a ^ b\n a, b = carry, sum_val", "a = a ^ b\n carry = (a & b) << 1\n b = carry", "sum_val = (a ^ b) << 1\n carry = a & b\n a, b = sum_val, carry", "sum_val = a + b\n carry = (a & b) << 1\n a, b = sum_val, carry", "sum_v...
E
code-128082-9d2c43c252eb
code-question-2a1074e21729cdba
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...
[ "m = min(s)\nres = []\nfor i in range(n):\n if s[i] > m:\n res.append(i+1)", "m = sorted(s)[n//2]\nres = []\nfor i in range(n):\n if s[i] >= m:\n res.append(i+1)", "m = min(s)\nres = []\nfor i in range(n):\n if s[i] >= m:\n res.append(s[i])", "m = max(s)\nres = []\nfor i in range...
F
code-035215-4916baa9a1d6
code-question-50c56c4d3eb484e9
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 current_group > 0:\n if current_group == 3:\n result.append('!')\n else:\n result.append('!')\n current_group = 0\n result.append(c)", "if current_group > 0:\n if current_group == 3:\n result.append('!!!')\n ...
B
code-059399-743ec2a5f6d7
code-question-6bf227c0f372b42c
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...
[ "numerator = 1\n for num in range(1, 5*M +1):\n numerator = numerator * num % Q\n denominator = pow(120, M, Q)\n inv_denominator = pow(denominator, Q-2, Q)\n result = numerator * inv_denominator % Q\n print(result)", "nu...
A
code-257069-e8567648a40d
code-question-894cbb552ba3f27a
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...
[ "print(\"YES\")\n print(s[i:j+1])\n found = True\n exit()", "if j - i + 1 >= 2:\n print(\"YES\")\n print(s[i:j+1])\n found = True\n exit()", "if len(freq) >= 2:\n print(\"YES\")\n print(s[i:j+1])\n found = True\n ...
A
code-172503-e7028e6b32b0
code-question-d4280f7f1a7e3728
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...
[ "for i in range(len(stars) - 3):\n a, b, c, d = stars[i], stars[i+1], stars[i+2], stars[i+3]\n if b - a == d - c:\n found = True\n break", "from itertools import combinations\nfor quad in combinations(stars, 4):\n a, b, c, d = quad\n diffs = {b - a, c - a, d - c}\n if len(diffs) == 1:...
F
code-226864-bf2b488ef0e5
code-question-5e8ad69770acc602
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...
[ "required_Z = S - X - Y\n if 1 <= required_Z <= M:\n results.append(1)\n else:\n results.append(0)", "required_Z = S - X - Y\n if required_Z in range(1, M):\n results.append(1)\n else:\n results.append(0)", "required_Z = S - X - Y\n ...
A
code-137352-bd7f8d5aa2de
code-question-ce686505a89bd405
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 += sum(matrix[0])\n total += sum(matrix[-1])\n for row in matrix:\n total += row[0] + row[-1]", "total += sum(matrix[0])\n total += sum(matrix[-1])\n for row in matrix[1:-1]:\n total += row[0] + row[-1]", "total += sum(matrix[0])\n total += sum(matrix[-1])\n total -= matri...
B
code-221910-a7d2e6847f22
code-question-7452823e179c3c08
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...
[ "counts = Counter(s)\nsorted_chars = sorted(counts.items(), key=lambda x: (-x[1], x[0]))\nresult = ''.join([char for char, count in sorted_chars])", "counts = Counter(s)\nsorted_chars = counts.most_common()\nresult = ''.join([char * count for char, count in sorted_chars])", "counts = Counter(s)\nsorted_chars = ...
D
code-089566-821c85c57745
code-question-0eb91c66c2b50d8e
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(0, len(sequence), m):\n chunk = sequence[i:i+m]\n if len(chunk) >= 1:\n result.extend(chunk[::-1])\n else:\n result.extend(chunk)", "for i in range(0, len(sequence), m):\n chunk = sequence[i:i+m]\n if len(chunk) == m:\n result.extend(chunk[::1])\n else:\n ...
C
code-266682-71f513d6924e
code-question-1f93582976230507
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 requirement == 1:\n if s_remaining > 0:\n s_remaining -= 1\n else:\n denied += 1\n else:\n if l_remaining > 0:\n l_remaining -= 1\n elif s_remaining > 0:\n s_remaining -= 1\n else:\n denied += 1", "if requirement == 1...
G
code-109250-f99ac45da495
code-question-40518c8bcc8dfd0b
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...
[ "sub = D[L:R]\n total = 0\n for i in range(1, len(sub)):\n total += abs(sub[i] - sub[i-1])", "D.sort()\n sub = D[L-1:R]\n total = 0\n for i in range(1, len(sub)):\n total += sub[i] - sub[i-1]", "sub = D[L-1:R]\n sub.sort()\n total = 0\n for i in range(1, len(sub)):\n ...
F
code-056220-9f6d522ed6e8
code-question-a8503110f9b87f6b
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...
[ "rem = a % L\n if rem == 0:\n start = L\n else:\n start = rem\n if start > n:\n continue\n if rem == 0:\n last = (n // L) * L\n else:\n last = ((n - rem) // L) * L + rem\n count = ((last - start) // L) + 1\n total += count", "rem = a % L\n if rem == 0:\n ...
A
code-103050-26f1504f0814
code-question-8784a54d85eb0018
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...
[ "cost0 = 0\n cost1 = 0\n for i in range(n):\n for j in range(n):\n v = matrix[i][j] == '1'\n d0 = (i == j)\n d1 = (i + j == n - 1)\n if v != d0:\n cost0 += 1\n if v != d1:\n cost...
A
code-152993-5498270c5063
code-question-eea0580c444ab6eb
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...
[ "shifted_word = \"\"\n for c in word:\n shifted_char = chr((ord(c) - ord('A') + 1) % 26 + ord('A'))\n shifted_word += shifted_char\n new_words.append(shifted_word)", "shifted_word = \"\"\n for c in word:\n shifted_char = chr((ord(c) - ord('a') - 1) % 26 + ord(...
C
code-277276-1127170c02c8
code-question-5ef4d61881b02f82
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 N >= K:\n print(0)\n continue\n result = 1\n for i in range(N):\n result = result * (K - i) % MOD\n print(result)", "if N > K:\n print(0)\n continue\n result = 1\n for i in range(N):\n result = result * (K - i...
B
code-277275-2bdde1d950cb
code-question-7e7baab4e22a1ab3
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...
[ "list_part, k_str = input_line.split(',')\nnums = list(map(int, list_part.split()))\nk = int(k_str) - 1", "list_part, k_str = input_line.split(',')\nnums = sorted(set(map(int, list_part.split())))\nk = int(k_str)", "list_part, k_str = input_line.split(',')\nnums = list(map(int, list_part.split()))\nk = str(k_st...
F
code-270688-9fac7782f3a8
code-question-d004410cf3764ff2
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 for _ in range(M)] for __ in range(M)]\n dp[0][0] = grid[0][0]\n for j in range(1, M):\n dp[0][j] = dp[0][j-1] + grid[0][j]\n for i in range(1, M):\n dp[i][0] = dp[i-1][0] + grid[i][0]\n for i in range(1, M):\n for j in range(1, M):\n ...
A
code-099359-33fc64f9df11
code-question-be440d095e81a476
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...
[ "dot = (sum_x + A) * yi - (sum_y + B) * xi\n if dot < 0:\n directions.append(1)\n sum_x += xi\n sum_y += yi\n else:\n directions.append(-1)\n sum_x -= xi\n sum_y -= yi", "dot = (A - sum_x) * xi + (B - sum_y) * yi\n if dot < 0:\n directions.append(1)\n ...
C
code-143306-4ef6b02a8658
code-question-5214c136fd17737c
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...
[ "k = (n + 1) // 2\nt0 = t[:k-1]\nt1 = t[k-1:]", "k = (n + 1) // 2\nt0 = t[:k]\nt1 = t[k+1:]", "k = (n + 1) // 2\nt0 = t[:k]\nt1 = t[k:]", "k = (n + 1) // 2\nt0 = t[k:]\nt1 = t[:k]", "k = (n + 2) // 2\nt0 = t[:k]\nt1 = t[k:]", "k = n // 2\nt0 = t[:k]\nt1 = t[k:]", "k = n // 2\nt0 = t[k:]\nt1 = t[:k]", ...
C
code-214110-8f80870bf975
code-question-8cf7331d015956b6
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...
[ "reversed_T = T[::-1]\n V = T + reversed_T\n max_sub = T\n max_len = len(T)\n for i in range(max_len - M + 1):\n current = V[i:i+M]\n if current > max_sub:\n max_sub = current", "reversed_T = ''.join(sorted(T))\n V = T + reversed_T\n m...
D
code-171428-a7f118c01504
code-question-f0687f377f4c8705
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_distinct = len(S) + flexible\n if flexible > 0:\n min_distinct = len(S) + flexible\n else:\n min_distinct = len(S)\n print(f\"{min_distinct} {max_distinct}\")", "max_distinct = len(S) + (1 if flexible > 0 else 0)\n if flexible == 0:\n min_distinct = len(S)\n else:\n ...
E
code-227727-cc4e8b8a4f10
code-question-44bfcaa831ea7dfd
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 event in events:\n end_time, start_time, index = event\n if start_time >= last_end:\n selected.append(index)\n last_end = end_time", "for event in events:\n end_time, start_time, index = event\n if start_time > last_end:\n selected.append(index)\n last_end = end_time",...
A
code-062800-398fad372049
code-question-59727eacbd4254ff
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_diff = float('inf')\nfor i in range(len(heights) - n + 1):\n current_diff = heights[i] - heights[i + n - 1]\n if current_diff < min_diff:\n min_diff = current_diff", "min_diff = float('inf')\nfor i in range(len(heights) - 1):\n current_diff = heights[i + 1] - heights[i]\n if current_diff <...
F
code-036250-dc0eefbc9b13
code-question-c0d4512953895850
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...
[ "middle_char = None\nfor char, cnt in counts.items():\n if cnt % 2 == 0:\n middle_char = char\n break\nleft = []\nfor char, cnt in counts.items():\n left.append(char * (cnt // 2))\nleft_str = ''.join(left)\nfull = left_str + middle_char + left_str[::-1]", "middle_char = None\nfor char, cnt in ...
B
code-013990-f96ff98117a6
code-question-dde9e6e72835e134
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 v = -event\n if v not in active:\n print(-1)\n exit()\n active.discard(v)\n if len(active) == 1:\n result.append(current_length)\n current_length = 0", "else:\n v = -event\n if v not in active:\n print(-1)\n exit()\n active.discard(v)\n if...
B
code-032654-577f42e900e6
code-question-47f3f52256f9c556
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...
[ "s = list(encrypted)\nfor ai, bi in operations:\n i = ai\n j = bi\n s[i], s[j] = s[j], s[i]\nprint(''.join(s))", "s = list(encrypted)\nfor ai, bi in operations:\n i = ai - 1\n j = bi - 1\n s[i], s[j] = s[i], s[j]\nprint(''.join(s))", "s = list(encrypted)\nfor ai, bi in reversed(operations):\n ...
D
code-038195-4ba4c123278d
code-question-53cf9b79e1991347
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...
[ "numerator = xj - xi\n denominator = vi + vj\n time = numerator / denominator\n if time < min_time:\n min_time = time", "numerator = xj - xi\n denominator = (vi - vj) * (vi - vj)\n time = numerator / denominator\n if time < min_time:...
D
code-280911-8a11bd56ce39
code-question-938b2d8c697bf7c5
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...
[ "col_total = 0\nfor col in range(m):\n count = 0\n prev = '.'\n for row in range(n):\n current = grid[row][col]\n if current == '#' and prev == '.':\n count += 1\n prev = current\n col_total += count", "col_total = 0\nfor col in range(m):\n count = 0\n prev = ...
D
code-022723-f21a663696e7
code-question-699aaae513d8cd5b
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_x = min(r[2] for r in rects)\nmax_x = max(r[0] for r in rects)\nmin_y = min(r[3] for r in rects)\nmax_y = max(r[1] for r in rects)\nbounding_area = (max_x - min_x) * (max_y - min_y)", "min_x = min(r[0] for r in rects)\nmax_x = max(r[2] for r in rects)\nmin_y = min(r[1] for r in rects)\nmax_y = max(r[3] for r...
D
code-169087-cb9a9f2e3de3
code-question-607001600691a768
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...
[ "b.sort()\nif m % 2 == 1:\n median = b[0]\nelse:\n median = b[0]\ntotal = sum(abs(x - median) for x in b)", "b.sort()\nif m % 2 == 1:\n median = b[m // 2 - 1]\nelse:\n median = b[m // 2]\ntotal = sum(abs(x - median) for x in b)", "b.sort()\nif m % 2 == 1:\n median = b[-1]\nelse:\n median = b[-...
H
code-137770-5b8d6019e984
code-question-b24de1f89cef5c3f
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...
[ "ok = True\n for i in range(l - 1):\n if trip[i] == trip[i+1]:\n ok = False\n break\n if not ok:\n print(\"INVALID\")\n continue\n total_distance = 0\n for i in range(l - 1):\n a = trip[i]\n b = trip[i+1]\n if (a, b) in roads:\n ...
B
code-048832-e2e3558a03f8
code-question-490a4dd36dcfa9e2
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...
[ "nim_sum = piles[0] if piles else 0\n for p in piles[1:]:\n nim_sum &= p\n if nim_sum == 0:\n print(\"player-2\")\n else:\n print(\"player-1\")", "nim_sum = 0\n for p in piles:\n nim_sum |= p\n if nim_sum == 0:\n print(\"pla...
C
code-121534-3e4167b29fac
code-question-1c7168bba45f6d22
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 event == 'Order':\n if available >= 0:\n available -= 1\n else:\n undelivered += 1\n else:\n available = int(event)", "if event == 'Order':\n if available > 0:\n available -= 1\n else:\n u...
C
code-050204-d99af18fdeeb
code-question-7a053b969d3310a0
7