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...
[ "current_len = len(word)\n if current_len < min_length:\n min_length = current_len\n max_word = word\n if current_len > max_length:\n max_length = current_len\n min_word = word", "current_len = len(word)\n if current_len > min_length:\n min_length = current_len\n ...
D
code-213017-657767e1e67d
code-question-001c2d35c3e12dbe
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...
[ "a0 = math.isqrt(d)\n a.append(a0)\n for j in range(1, n):\n a_j = matrix[0][j] // a0\n a.append(a_j)", "a0 = math.isqrt(d)\n a.append(a0)\n for j in range(1, n):\n a_j = matrix[0][j] * a0\n a.append(a_j)", "a0 = math.isqrt(d)\n a.append(a0)\n for j in range(1, n):\...
A
code-054578-a05898624d52
code-question-20c9aca8273116cb
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...
[ "odds = [x for x in arr if x % 2 == 1]\nk = len(odds)\nsum_odds = sum(odds)\nsum_odd_pairs = (sum_odds // 2) * k if k >= 2 else 0", "evens = [x for x in arr if x % 2 == 0]\nk = len(evens)\nsum_evens = sum(evens)\nsum_odd_pairs = sum_evens * (k - 1) if k >= 2 else 0", "odds = [x for x in arr if x % 2 != 0]\nk = ...
D
code-182562-de3656c21daf
code-question-3b55f538ef2ce9d9
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 = A - 2 * B\nif (A & B) != B:\n print(-1)\nelse:\n P = A - B\n Q = B\n if (P & Q) == B:\n print(P, Q)\n else:\n print(-1)", "S = A - 2 * B\nif S <= 0:\n print(-1)\nelse:\n if (S & B) != 0:\n print(-1)\n else:\n P = A - B\n Q = B\n if (P & Q) == ...
F
code-215539-d7575c5e10be
code-question-abe600e04f9ef0b1
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...
[ "lower_c = c.lower()\n value = ord(lower_c) - ord('a')\n total += value", "lower_c = c.lower()\n value = ord(lower_c) - ord('b') + 1\n total += value", "lower_c = c.lower()\n value = ord(lower_c) - ord('a') + 1\n total += value", "lower_c = c\n value = ord(lowe...
C
code-112792-b29f2bc21d5a
code-question-6f9f03bbc6c3a3e6
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...
[ "Y.sort()\npossible = True\nfor i in range(M):\n if X[i] <= Y[i]:\n possible = False\n break", "Y.sort()\npossible = True\nfor i in range(M):\n if X[i] >= Y[i]:\n possible = False\n break", "Y = Y\npossible = True\nfor i in range(M):\n if X[i] >= Y[i]:\n possible = Fa...
B
code-225540-826975271797
code-question-f90baa7e336128ee
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 top < bottom:\n for i in range(right, left - 1, -1):\n matrix[top][i] = num\n num += 1\n bottom -= 1\n if left < right:\n for i in range(bottom, top - 1, -1):\n matrix[i][right] = num\n num += 1\n left += 1", "if top <= bottom:\n ...
C
code-184036-c21f9eeaf295
code-question-c1aeae14f3a8760c
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...
[ "degrees = [0] * (n + 1)\n for _ in range(m):\n u, v = map(int, sys.stdin.readline().strip().split())\n degrees[u] += 1\n degrees[v] += 1\n possible = True\n for i in range(1, n + 1):\n if degrees[i] == 2:\n possible = False\n ...
B
code-002218-231e55efb97c
code-question-51d9cf7711c49ab5
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 count_b > 1:\n while s[left] != 'B':\n left += 1\n count_b -= 1\n left += 1\ncurrent_window = right - left + 1\nmax_len = max(max_len, current_window - 1)", "while count_b >= 1:\n if s[left] == 'B':\n count_b -= 1\n left += 1\ncurrent_window = right - left + 1\nif current_window >...
G
code-232688-79a62bd4d936
code-question-0c444ae63b0aa4f3
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 = list(map(int, sys.stdin.readline().split()))\n print(\"POSSIBLE\")\n print(' '.join(map(str, sorted(q, reverse=True))))", "q = list(map(int, sys.stdin.readline().split()))\n print(\"POSSIBLE\")\n print(' '.join(map(str, [-x for x in q])))", "q = list(map(int, sys.stdin.readline(...
C
code-162547-cc6a1c5d23dd
code-question-0cd4b9405e92bdc2
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...
[ "special_sum = 0\nfor s in specials:\n idx = s - 1\n if idx > 0:\n special_sum += b[idx] * b[idx-1]\n elif idx < n-1:\n special_sum += b[idx] * b[idx+1]", "special_sum = 0\nfor s in specials:\n idx = s - 1\n if idx >= 0:\n special_sum += b[idx] * b[idx-1]\n if idx <= n-1:\n ...
D
code-235238-541b7b473a02
code-question-dde1dd83494a8603
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...
[ "temp = s_list.copy()\n temp[i], temp[j] = temp[j], temp[i]\n new_str = tuple(temp)\n s_set.add(new_str)", "temp = s_list.copy()\n temp[i], temp[j] = temp[j], temp[i]\n new_str = ''.join(temp)\n s_set.add(s_list)", "temp = s_list.copy()\n ...
H
code-171559-85157999966e
code-question-53624c7144064978
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 i > 0 and j > 0:\n if s1[i-1] == s2[j-1]:\n lcs.append(s1[i-1])\n i -= 1\n j -= 1\n else:\n if dp[i-1][j-1] >= dp[i][j]:\n i -= 1\n j -= 1\n elif dp[i-1][j] >= dp[i][j-1]:\n i -= 1\n else:\n j -= 1", "while i > 0 an...
D
code-192813-c87718916838
code-question-654e5e1cc09151e0
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 = sum(nums)\n target_parity = total % 2\n candidates = [num for num in nums if num % 2 == target_parity]\n if candidates:\n print(max(candidates))\n else:\n print(max(nums))", "total = sum(nums)\n target_parity = N % 2\n candidates = [num for ...
D
code-254656-e45a09fa38b2
code-question-2f6e513f89b0343a
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...
[ "remaining = weights[:i] + weights[i+1:j] + weights[j+1:]\n remaining.sort()\n total = 0\n for k in range(0, len(remaining), 2):\n total += remaining[k] - remaining[k + 1]\n if total < min_total:\n min_total = total", "remaining = [x for x in weights if x != weigh...
F
code-004762-aa4829b43fb2
code-question-5e1662b959356c55
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(m):\n current_max = heapq.heappop(max_heap)\n discounted_price = (-current_max) // 2\n total -= ((-current_max) - discounted_price)\n heapq.heappush(max_heap, -current_max)", "for _ in range(m):\n current_max = -heapq.heappop(max_heap)\n discounted_price = current_max // 2\n t...
D
code-058868-d810d151bb8b
code-question-ff5847084e879743
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...
[ "sqrt_candidate = int(candidate ** 0.5)\n for p in primes:\n if p >= sqrt_candidate:\n break\n if candidate % p == 0:\n is_prime = False\n break", "sqrt_candidate = int(candidate ** 0.5) + 1\n for p in primes[sqrt_candidate:]:\n ...
C
code-218560-5536a4537b17
code-question-cc903a05f084403a
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_shelves = 0\nfor g in genres:\n count = [0] * 101\n count[g] += 1\n if count[g] > max_shelves:\n max_shelves = count[g]", "max_shelves = len(set(genres))\nfor g in genres:\n count[g] += 0\n if count[g] > max_shelves:\n max_shelves = max_shelves", "max_shelves = float('inf')\nfo...
E
code-042666-d6fb67d4e9c1
code-question-beeefd6bdc4945d1
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 = [False] * (n + 1)\n queue = deque([1])\n visited[1] = True\n count = 0\n while queue:\n u = queue.popleft()\n for v in adj[u]:\n count += 1\n if not visited[v]:\n visited[v] = True\n queue.append(v)\n connected = (count >= n...
G
code-197939-aa91eb94f33d
code-question-1775fc7895ab3bd6
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...
[ "unique_dates = set(dates)\n for d in unique_dates:\n if d in date_counts:\n date_counts[d] += 2\n else:\n date_counts[d] = 2", "unique_dates = set(dates)\n for d in unique_dates:\n if d not in date_counts:\n date_counts[d] = 0\n else:\n ...
E
code-036157-7a8c60d72f53
code-question-1baa17c8295cbfe6
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...
[ "result = []\nfor num in range(1, n + 1):\n if digit_sum(num) == k:\n result.append(num)", "result = []\nfor num in range(0, n + 1):\n if digit_sum(num) == k:\n result.append(num)", "result = []\nfor num in range(0, n + 1):\n if digit_sum(num) > k:\n result.append(num)", "result ...
B
code-104466-c173610ea6b1
code-question-0b6e6d7b72e20a9f
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...
[ "full_weeks = n // 7\nremainder = n % 7\nmax_count = full_weeks * total_week\nif remainder > 0:\n for s in range(7):\n current = 0\n for i in range(remainder):\n current += f[s + i]\n max_count = max(max_count, full_weeks * total_week + current)", "full_weeks = n // 7\nremainder...
F
code-197099-1b5422e095fb
code-question-1721c74dd7b2c05a
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...
[ "options = []\nif len(pair_lengths) >= 2:\n options.append(pair_lengths[0] * pair_lengths[1])", "options = []\nfor x in pair_lengths:\n if freq[x] >= 4:\n options.append(4 * x)\nif len(pair_lengths) >= 2:\n options.append(pair_lengths[0] + pair_lengths[1])", "options = []\nfor x in pair_lengths:...
C
code-053336-730cf8284b36
code-question-b877d9201ac496c4
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...
[ "target = m - 2\n count = 0\n for num in [x, y, z]:\n if num == target:\n count += 1\n if count == 2:\n if m % 2 == 1:\n return 2 * m - 2\n else:\n return 2 * m - 3\n else:\n return \"No Number\"", ...
B
code-253081-c7985b1ccb2b
code-question-17729d508190b0ac
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 row[col_idx] == 'alpha':\n col_letter = chr(ord('A') + col_idx)\n print(col_letter, row_num)\n exit()", "if row[col_idx] == 'alpha':\n col_letter = chr(ord('A') + col_idx)\n print(f\"{col_letter}{row_num - 1}\")\n exit()", "if row[col_idx] ==...
H
code-155621-f90d5d04ae3b
code-question-f40ee32587454ea8
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_count < b_count:\n print(\"MORE\")\nelif a_count > b_count:\n print(\"LESS\")\nelse:\n print(\"EQUAL\")", "if a_count > b_count:\n print(\"MORE\")\nelif a_count < b_count:\n print(\"LESS\")\nelse:\n print(\"EQUAL\")", "if a_count > b_count:\n print(\"MORE\")\nelif a_count < b_count:\n...
B
code-149669-421ea90655da
code-question-a61f662b11f4ac4e
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...
[ "sqrt_m = int(math.isqrt(M)) + 1\n for i in range(1, sqrt_m + 1):\n if M % i == 0:\n if i * i == M:\n count += 1\n else:\n count += 1", "sqrt_m = int(math.isqrt(M))\n for i in range(1, sqrt_m + 1):\n if M % i == 0:\n if i * i == M:...
B
code-225296-1df4f04a6df6
code-question-8147c323749f2aeb
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 filename in filenames:\n if filename not in seen:\n seen.add(filename)\n else:\n unique_files.append(filename)", "for filename in filenames:\n seen = set()\n if filename not in seen:\n unique_files.append(filename)\n seen.add(filename)",...
E
code-030489-aa26b1e8a737
code-question-a211c3f56be2e161
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 = 1\nfor i in range(len(primes)):\n product *= i", "product = 1\nfor p in primes:\n product *= p", "product = 1\nfor p in primes:\n product *= (p - 1)", "product = primes[-1]\nfor p in primes:\n product *= p", "product = 1\nfor p in range(1, len(primes)):\n product *= primes[p]", "...
B
code-010725-6d35d810724b
code-question-54f1335ae423cfce
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_sum not in sum_indices:\n possible_length = i - sum_indices.get(current_sum, -1)\n if possible_length > max_length:\n max_length = possible_length\n else:\n sum_indices[current_sum] = i", "if current_sum in sum_indices:\n sum_indices[current_sum] = i\n else...
E
code-173665-77a4a9e78112
code-question-dd639582a659504a
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...
[ "elif op == '1':\n t = int(parts[1])\n if stacks[t]:\n print(stacks[t][-1])\n elif op == '2':\n t = int(parts[1])\n if stacks[t]:\n stacks[t].pop()", "elif op == '1':\n t = int(parts[1])\n if len(stacks[t]) > 1:\n print(stacks[t][-2])\n...
A
code-186806-7b17691d3996
code-question-9b80413c43f9aac1
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...
[ "even_distinct = set()\nfor num in arr:\n if num % 2 == 0:\n even_distinct.add(num)\nproduct = 1\nfor num in even_distinct:\n product *= num", "even_distinct = set(arr)\nproduct = 1\nfor num in even_distinct:\n product *= num", "even_distinct = []\nfor num in arr:\n if num % 2 == 0:\n ...
A
code-096984-5bd9d40333c5
code-question-b00986e71ef49020
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...
[ "next1 = current + diff\n next2 = current - diff\n if (1 <= next1 <= n) or (not visited[next1]):\n perm.append(next1)\n visited[next1] = True\n current = next1\n continue\n if (1 <= next2 <= n) or (not visited[next2]):\n perm.append(next2)\...
B
code-178760-3f98da25bba4
code-question-4e31a5ffc7d42563
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...
[ "avg = sum_total // n\nif sum_total % n == 0:\n avg += 1\nmin_max = max(max_initial, avg)\nmax_max = max_initial + m", "avg = m // n\nif m % n != 0:\n avg += 1\nmin_max = max_initial + avg\nmax_max = max_initial + m", "avg = sum_initial // n\nif sum_initial % n != 0:\n avg += 1\nmin_max = max(max_initi...
D
code-227184-c4b8c2f41023
code-question-3e519946c9d0e4a6
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...
[ "changes = 0\n changes += abs(a - d1)\n changes += abs(b - d2)\n changes += abs(c - d3)\n if changes < min_changes:\n min_changes = changes\n changes += 0", "changes = 0\n if a != d1:\n ...
F
code-018640-9c9bb2831547
code-question-8a467e9fc985c0d9
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 len(s) < 2:\n print(0)\n else:\n second_left = s[1]\n second_right = s[-2]\n print(int(second_right) - int(second_left))", "if len(s) < 2:\n print(0)\n else:\n second_left = s[1]\n second_right = s[-1]\n prin...
A
code-100338-46c7f9473152
code-question-e5629bdc79357708
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_char = t[i]\n length = n - i\n current_sum = length * (length + 1) // 2\n if current_char.isupper():\n david += current_sum\n else:\n emily += current_sum", "current_char = t[i]\n length = n - i\n current_sum = length * (length + 1) // 2\n ...
H
code-256986-3eb86cbd1627
code-question-c6ec08788286e5ef
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 % 4 == 0:\n N = N // 4\n elif N % 2 == 0:\n N = N // 2\n else:\n N -= 1\n steps += 1", "if N % 4 == 0:\n N -= 1\n elif N % 2 == 0:\n N = N // 2\n else:\n N = N // 4\n steps += 1", "if N % 4 == 0:\n ...
A
code-252011-526779b73ecd
code-question-32baeb63587d6e2d
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 w < d:\n dp[i][0] = (dp[i][0] + dp[i - w][0]) % MOD\n dp[i][1] = (dp[i][1] + dp[i - w][1]) % MOD\nelse:\n dp[i][0] = (dp[i][0] + dp[i - w][0]) % MOD\n dp[i][1] = (dp[i][1] + dp[i - w][1]) % MOD", "if w < d:\n dp[i][0] = (dp[i][0] + dp[i - w][0]) % MOD\n dp[i][1] = (dp[i][1] + dp[i - w][0]) %...
E
code-130286-8851ab200f51
code-question-f92365bdf0079b31
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(len(y_coords) - 1):\n y_start = y_coords[j]\n y_end = y_coords[j + 1]\n dy = y_end - y_start\n covered = False\n for (left, right, bottom, top) in rectangles:\n if (bottom <= x_start and top >= x_end) and (left <= y_start and right >= y_end):\n covered = True\n ...
G
code-271405-8d358c3e11a6
code-question-626eb73d928edb63
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_list.append(num)\n current_count += 1\n if current_count <= m:\n new_list.append(key)\n current_count = 0", "new_list.append(num)\n current_count += 1\n if len(new_list) % m == 0:\n new_list.append(key)\n current_count = 0", "new_list.append(num)\n current_count +...
C
code-078294-ecfaafa1312c
code-question-91c206d256dbde83
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 coins:\n for j in range(s, c - 1, -1):\n dp[j] = dp[j] + 1 if j == c else dp[j]", "for c in coins:\n for j in range(0, s + 1):\n if j >= c:\n dp[j] += dp[j - c]", "for c in coins:\n dp[0] = 0\n for j in range(s, c - 1, -1):\n dp[j] += dp[j - c]", "for c in...
H
code-200072-e4069ab2603f
code-question-354f8f3242e17ebd
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(0)\n else:\n exponent = (n // 2) - 1\n print(pow(2, n, MOD))", "if n % 2 != 0:\n print(0)\n else:\n exponent = (n // 2) - 1\n print(pow(2, exponent, MOD))", "if n % 2 != 0:\n print(1)\n else:\n exponent = (n // 2) - 1\n ...
B
code-083723-b07474f0eeb4
code-question-d94dcc6d807f649b
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 stack and c < stack[-1]:\n stack.pop()\n stack.append(c)", "stack.append(c)\n while len(stack) > 1 and stack[-2] > stack[-1]:\n stack.pop()", "while stack and c > stack[-1]:\n stack.pop()\n stack.append(c)", "if stack and c < stack[-1]:\n ...
A
code-217854-2002ee9a0872
code-question-6df9d0d70c7ad4d9
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...
[ "block = k ** (remaining_length - 1)\n d = 0\n while (d + 1) * block <= current:\n d += 1\n sequence.append(d + 1)\n current -= d * block\n remaining_length -= 1", "block = k ** (remaining_length - 1)\n d = 1\n while d * block <= current:\n d += 1\n sequence.append(d)\n cu...
C
code-113769-028f374edf4f
code-question-113b25125168b74c
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...
[ "car_option = c[i-2] + (d[i-2] if (i-2) < len(d) else 0)\nbus_option = current_min_prev + prefix_e[i-1] + f\nc_i = min(car_option, bus_option)\nc[i] = c_i\ncandidate = c_i - prefix_e[i-2] if i-2 >= 0 else c_i\nif candidate < current_min_prev:\n current_min_prev = candidate", "car_option = c[i-1] + (d[i-2] if (...
G
code-197102-a1854c6c88c2
code-question-e76ba4dddc3bb026
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...
[ "non_zero = [x for x in P if x > 0]\n current_min = min(non_zero)\n count = len(non_zero)\n print(count)\n for i in range(M):\n if P[i] > 0:\n P[i] -= current_min", "non_zero = sorted(set(x for x in P if x > 0))\n current_min = non_zero[0]\n count = len(non_zero)\n print(cur...
F
code-057623-334306084f24
code-question-ba829117a06f538b
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 in range(m):\n start_idx = row * p\n for col in range(p):\n grid[row][col] = sorted_upper[start_idx + col]\nfor lower_row in range(p - m):\n global_row = m + lower_row\n start_idx = lower_row * p\n for col in range(p):\n grid[global_row][col] = sorted_lower[start_idx + col]", ...
A
code-066729-ce001a39f8bc
code-question-64ea48ca6b1fbbaf
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...
[ "team1_can_win = False\nfor t1_d, t1_o in team1_options:\n can_defeat_all = True\n for t2_d, t2_o in team2_options:\n if t1_d > t2_o and t1_o > t2_d:\n break\n else:\n can_defeat_all = False\n break\n if can_defeat_all:\n team1_can_win = True\n b...
B
code-017686-f6d910a634f2
code-question-ecc3598f4ce2f1ea
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...
[ "time = i + 1\n if rainfall[i] > 0:\n current_wet_end = max(current_wet_end, time + W)\n if time <= current_wet_end and time <= T:\n total += 1", "time = i + 1\n if rainfall[i] > 0:\n current_wet_end = max(current_wet_end, time + W)\n if time < current_wet_end or time > T:\n ...
A
code-039909-5929e8e8752d
code-question-c55ae206100ab4b7
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_max = min(x // 2, y)\n for a in range(0, a_max + 1):\n rem_y = y - a\n b = min(rem_y // 2, z)\n current = a + b\n if current > max_total:\n max_total = current", "a_max = min(x, y // 2)\n for a in range(0, a_max + 1):\n rem_y =...
C
code-141622-8145fd847efd
code-question-bf584b437165537c
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...
[ "def get_odd(num):\n while num & 1:\n num //= 2\n return num", "def get_odd(num):\n while num % 2 == 0:\n num /= 2\n return num", "def get_odd(num):\n while num % 2 == 0:\n num = num // 2 + 1\n return num", "def get_odd(num):\n ...
D
code-151076-4245c768914c
code-question-1045701b44b8e830
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...
[ "balanced = True\nfor k, count in counts.items():\n if count % 2 != 0:\n balanced = False\n break\nprint(\"Balanced\" if balanced else \"Not Balanced\")", "balanced = True\nif len(arr) % 2 == 0:\n balanced = False\nprint(\"Balanced\" if balanced else \"Not Balanced\")", "balanced = True\nfor...
E
code-097276-1502cb67db25
code-question-00237e3be368e4ab
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 c == 'U':\n sum_y += 1\n elif c == 'D':\n sum_y -= 1\n elif c == 'L':\n sum_x -= 1\n elif c == 'R':\n sum_x += 1", "visited.add((sum_x, sum_y))\n if c == 'U':\n sum_y += 1\n elif c == 'D':\n sum_y -= 1\n elif c == 'L':\n sum_x -= 1\n elif c...
C
code-027410-3cc061f57360
code-question-45b0c9222e555a20
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 = 1\n prev = s[0]\n for c in s[1:]:\n if c != prev:\n count += 1\n prev = c\n return count", "count = 1\n prev = s[0]\n for c in s[1:]:\n if c < prev:\n count += 1\n prev = c\n return len(s) - count", "count = 0\n prev = s[0]\...
E
code-134875-0deb17a15cb6
code-question-7ab0b3386117fb57
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...
[ "digits_sorted = sorted(digits)\nletters_sorted = sorted(letters)\nresult = ''.join(digits_sorted + letters_sorted)\nprint(result)", "digits_sorted = sorted(set(digits))\nletters_sorted = sorted(set(letters))\nresult = ''.join(letters_sorted + digits_sorted)\nprint(result)", "digits_sorted = sorted(digits)\nlet...
A
code-015483-75b1e4f1b7f9
code-question-0e8aff585968c50c
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...
[ "cx = max(y_min, min(xc, y_max))\n cy = max(x_min, min(yc, x_max))\n dx_sq = (xc - cx) ** 2\n dy_sq = (yc - cy) ** 2\n distance_sq = dx_sq + dy_sq", "cx = min(x_min, max(xc, x_max))\n cy = min(y_min, max(yc, y_max))\n dx_sq = (xc - cx) ** 2\n dy_sq = (yc - cy) ** 2...
C
code-077575-2b5abc94ac9e
code-question-f0ab083939be8008
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...
[ "sum1 = D1 + D2\nsum2 = D1 + D3\nsum3 = D2 + D3\nminimum = min(sum1, sum2, sum3)", "sum1 = D1 + D2\nsum2 = D1 + D3\nsum3 = D2 + D3\nminimum = sorted([sum1, sum2, sum3], reverse=True)[0]", "sum1 = D1 + D2\nsum2 = D1 + D3\nsum3 = D2 + D3\nminimum = min(D1, D2, D3)", "sum1 = D1 + D2\nsum2 = D1 + D3\nsum3 = D2 + ...
A
code-242709-da99fe2467d4
code-question-fc983641fc1b1d04
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...
[ "found = False\n for char in all_chars:\n a = count_A.get(char, 0)\n b = count_B.get(char, 0)\n if a == b or a == 0:\n found = True\n break", "found = True\n for char in all_chars:\n a = count_A.get(char, 0)\n b = c...
G
code-193058-286bd07d5705
code-question-2e64f2841776bedb
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 = 0\n for x in a:\n target = mid - x\n c = bisect.bisect_left(a, target)\n cnt += len(a) - c\n if cnt > m:\n break\n if cnt >= m:\n low = mid + 1\n else:\n high = mid", "cnt = 0\n for x in a:\n ...
C
code-181343-63423a765d3a
code-question-d0336072c33a458c
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[m//2]\nelse:\n mid = m // 2\n median = (b[mid - 1] + b[mid]) / 2", "b.sort()\nif m % 2 == 1:\n median = b[m//2]\nelse:\n mid = m // 2\n median = (b[mid - 1] + b[mid]) // 2", "if m % 2 == 1:\n median = b[m//2]\nelse:\n mid = m // 2\n mid = mid\n ...
A
code-259847-d8a0c6fdc51e
code-question-77d994e8a43de809
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 = max(w, z)\n b = max(w, x)\n c = max(x, y)\n d = max(y, z)", "a = min(w, z)\n b = min(w, x)\n c = min(x, y)\n d = min(y, z)", "a = min(w, x)\n b = min(x, y)\n c = min(y, z)\n d = min(z, w)", "a = max(w, z)\n b = min(w, x)\n c = min(x, y)\n d = min(y, z)", "a = min(w, ...
B
code-186423-f7fa8bc7fd9d
code-question-6a2fa0df60c14765
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...
[ "sum_initial = sum(a)\n max_x = 0\n for num in a:\n x = M * num - sum_initial\n if x > max_x:\n max_x = x\n k = max(max_x, 0)\n print(k)", "sum_initial = sum(a)\n min_x = 0\n for num in a:\n x = M * num - sum_initial\n ...
G
code-119429-600d0b933b25
code-question-de79bb1df9020842
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...
[ "idx1 = (p1 + p2 - 2) % word_length\n idx2 = (p1 + p2) % word_length\n if w[idx1] == w[idx2]:\n print(\"Same\")\n else:\n print(\"Different\")", "idx1 = p1 % word_length\n idx2 = p2 % word_length\n if w[idx1] == w[idx2]:\n print(\"Same\")\n else:\n print(\"Different\"...
G
code-043537-8c7def21fe06
code-question-f6922fd7c6bade32
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 stack and current_avg < stack[-1][2]:\n prev_sum, prev_count, prev_avg = stack.pop()\n current_sum += prev_sum\n current_count += prev_count\n current_avg = current_sum / current_count", "while stack and current_avg <= stack[-1][2]:\n prev_sum, prev_count, prev_avg = stac...
H
code-213247-b2f8f177d2cb
code-question-73c1fff8c5e7a027
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 = 0\n for j in range(i, n):\n current_sum += arr[j]\n if current_sum > K * (j - i + 1):\n count += 1", "current_sum = 0\n for j in range(i, n):\n current_sum = arr[j]\n if current_sum > K * (j - i + 1):\n count += 1", "current_sum = 0\n for...
A
code-094532-10816b7aa1e3
code-question-ba84826ba8b5a4e3
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...
[ "effective_shift = n % 26\nfor char in s:\n shifted = (ord(char) - ord('a') + effective_shift) % 26\n new_char = chr(ord('a') + shifted)\n result.append(new_char)", "effective_shift = (n + 1) % 26\nfor char in s:\n shifted = (ord(char) - ord('a') + effective_shift) % 26\n new_char = chr(ord('a') + ...
A
code-238746-294f06374642
code-question-b5e4968a952c9692
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):\n current = probs[i] * (1.0 - impacts[i])\n if current > max_val:\n max_val = current\n best_idx = i\n elif current == max_val:\n if i < best_idx:\n best_idx = i", "for i in range(1, N):\n ...
F
code-264231-7788dc642d9e
code-question-d1addae4c87b8cff
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 = abs(r - mid)\n stars = 1 + 2 * (mid - distance)\n spaces_needed = width - stars\n left = spaces_needed // 2\n right = spaces_needed - left\n print(' ' * left + '*' * stars + ' ' * right)", "distance = abs(r - mid)\n stars = max(1, 2 * (mid - distance))\n spaces_needed = width - st...
A
code-268897-92f2f2c1e83a
code-question-03ce476a726ae007
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_reach = min(n, i + s)\n if i <= current_reach:\n if possible_reach >= current_reach:\n current_reach = possible_reach\n else:\n current_reach = i\n max_reach = max(max_reach, current_reach)", "possible_reach = i + s\n if possible_reach > n:\n possible_reach = ...
B
code-141284-cb0011b7b08b
code-question-29ca9b94e787b919
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...
[ "sums = []\n for i in range(N):\n for j in range(i, N):\n s = B[j] - B[i]\n sums.append(s)", "sums = []\n for i in range(N):\n s = 0\n for j in range(i, N):\n s += B[j]\n sums.append(s)", "sums = []\n f...
E
code-177540-e581bb2fbca0
code-question-d4d859f9edbad0fa
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...
[ "X, Y, D = map(int, sys.stdin.readline().split())\n print((Y - X + D) // (D + 1))", "X, Y, D = map(int, sys.stdin.readline().split())\n print(max(1, (Y - X + 1) // D))", "X, Y, D = map(int, sys.stdin.readline().split())\n print((Y - X + 1) // (D + 1))", "X, Y, D = map(int, sys.stdin.readl...
E
code-261354-32ded33a87ff
code-question-b4f13f98307249e9
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...
[ "def union(u, v):\n r = min(u, v)\n if find(u) == find(v):\n return\n parent[u] = r\n parent[v] = r", "def union(u, v):\n u_root = find(u - 1)\n v_root = find(v - 1)\n if u_root == v_root:\n return\n parent[v_root] = u_root", "def uni...
F
code-107251-394061c64f8f
code-question-29b3405714dd2be8
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 i == 0:\n option2 = 9 - d\n if option2 == 0:\n total += d\n else:\n total += max(d, option2)\n else:\n option2 = 9 - d\n total += max(d, option2)", "if i == 0:\n option2 = 9 - d\n total += min(d, option2)\n else:\n option2 = 9...
A
code-127378-6bdf3d8ceb88
code-question-e463ea3b7fa10380
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 current = (mid * (mid + 1) * (mid + 2)) // 2\n if current <= w:\n max_n = mid\n low = mid + 1\n else:\n high = mid - 1", "while low <= high:\n mid = (low + high) // 2\n current = mid * (mid + 1) * (mid + 2)\n if current <= w...
C
code-139340-e09fc216828f
code-question-0d09490e70a56a0a
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 in primes:\n exponent = 0\n temp = x\n while temp >= p:\n exponent += temp // p\n temp -= p\n if exponent > 0:\n factors.append((p, exponent))", "for p in primes:\n exponent = 0\n temp = p\n while temp <= x:\n exponent += x // temp\n temp *= 2\n if...
D
code-127726-7cd199e2a2f6
code-question-cc23f03004ff5ead
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...
[ "def has_period(s, d):\n for i in range(1, len(s)):\n if s[i] != s[i % len(s)]:\n return False\n return True", "def has_period(s, d):\n for i in range(d, len(s)):\n if s[i] != s[0]:\n return False\n return True", "def has_period(s, d):\n for i in range(d, len(s...
E
code-237321-bc66e08ba339
code-question-83e546ea971bf3dc
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...
[ "freq = [0] * (w + 1)\n for k in range(i, j + 1):\n freq[soldiers[k]] += 1\n match = True\n for type_idx in range(w - 1):\n if freq[type_idx + 1] != req[type_idx]:\n match = False\n break\n if match:\n print(\"YES\")\n exit()", "freq = [0] * (w + 1)\n ...
F
code-231521-2b785c915817
code-question-2330697fed1a03c4
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...
[ "for a in range(start_a, a_max + 1):\n rem = M - a * Wo\n if rem < 0:\n continue\n b = rem // Wa\n total = Ha * a + Ho * b\n if total > max_total:\n max_total = total", "for a in range(start_a, a_max + 1):\n rem = M - a * Wa\n if rem < 0:\n continue\n b = rem // Wo\n ...
F
code-142874-d566f5007d7b
code-question-0bcb12df4a436ecb
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...
[ "mid = (left + right) // 2\n if arr[mid] == target:\n return right\n elif arr[mid] < target:\n left = mid\n else:\n right = mid", "mid = (left + right) // 2\n if arr[mid] == target:\n return mid + 1\n elif arr[mid] < target:\n ...
E
code-207772-820eb6b33813
code-question-538b8eb0a2c29317
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 not in {'b', 'y'}:\n current_run += 1\n else:\n invalid += current_run * (current_run + 1) // 2\n current_run = 0\n invalid += current_run * (current_run + 1) // 2\n return total - invalid", "for c in s:\n if c != 'b' and c != 'y':\n ...
A
code-066130-519841ba4a7a
code-question-c6f95654703f2b54
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...
[ "power = a * b\n product = 1\n for digit in str(power):\n product *= int(digit)", "power = a ** b\n product = 1\n for digit in str(b):\n product *= int(digit)", "power = a ** b\n product = 0\n for digit in str(power):\n product += int(digit)", "power = a ** b\n produc...
G
code-046675-779ef502d607
code-question-8dac5063316dada7
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...
[ "dx = xi - current_x\n dy = yi - current_y\n distance = math.hypot(dx, dy)\n arrival_time = ti + distance\n if i < n - 1:\n next_t = commands[i][0]\n else:\n next_t = float('inf')\n if arrival_time <= next_t:\n ...
D
code-201337-f7052cab66cb
code-question-26fcfe62b1c22bfb
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_li = max(lis)\nmin_ri = min(ris)\nif max_li > min_ri:\n print(m)\nelse:\n common = min_ri - max_li\n print(m - common)", "max_li = max(lis)\nmin_ri = min(ris)\nif max_li > min_ri:\n print(0)\nelse:\n common = min_ri - max_li + 1\n print(m - common)", "max_li = min(lis)\nmin_ri = max(ris)\...
E
code-060049-edc32d1d2c07
code-question-b3b48dd8c911b33d
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_val = -1\n best_dir = None\n for val, d in candidates:\n if val > max_val:\n max_val = val\n best_dir = d\n directions.append(best_dir)\n last = a[left] if best_dir == 'R' else a[right]\n if best_dir == 'L':\n right -= 1\n ...
F
code-167393-1af00e37d5a8
code-question-0065bd6c138daabc
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_length = len(A) * len(B)\n odd_count = 0\n for v in combined.values():\n if v % 2 != 0:\n odd_count += 1\n if total_length % 2 == 0:\n if odd_count == 0:\n return len(A) + 1\n else:\n return 0\n else:\n if odd_count == 1:\n r...
C
code-193089-b729cc2c9236
code-question-00c0a069be485167
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...
[ "result = nums[0]\n for num in nums[1:]:\n result ^= num\n print(-1 if result == 0 else result)", "result = nums[0]\n for num in nums[1:]:\n result |= num\n print(-1 if result == 0 else result)", "result = nums[1] if len(nums) > 1 else 0\n for num in nums[1:]:\n result &= num...
E
code-078878-ab1194ea2a41
code-question-db157a076aa06322
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_m = max(m)\n min_M = min(M)\n if max_m >= min_M:\n print(-1)\n return\n sum_m = sum(m)\n sum_M = sum(M)\n m_sorted = sorted(m)\n sum_mi_j = 0", "max_m = max(m)\n min_M = min(M)\n if max_m > min_M:\n print(-1)\n return\n sum_m = sum(set(m))\n sum_M = s...
D
code-107622-be80a9c32e6f
code-question-29fc34d7a11d3e57
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_gcd = arr[0]\n for num in arr[1:]:\n if current_gcd == 0:\n break\n current_gcd = num % current_gcd\n if current_gcd == 1:\n break\n return current_gcd", "current_gcd = arr[0]\n for num in arr[1:]:\n current_gcd = math.gcd(current_gcd, num)\n ...
C
code-064863-fcf9f1f9df18
code-question-c602321766f4f771
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...
[ "m = n // k\n for s in range(n):\n valid = True\n for t in range(k):\n pos = s + t\n if pos >= n or arr[pos] == 0:\n valid = False\n break\n if valid:\n print(\"YES\")\n return",...
F
code-114688-c837b0ba6b2a
code-question-8d3f0308fcf025fb
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_d = {1: -1, 2: -1, 3: -1}\nfor i in range(n):\n dept = d[i]\n price = p[i]\n if price > max_d[dept]:\n max_d[dept] = price\nresult = []\nfor favorite in f:\n if max_d[favorite] != -1:\n result.append(str(max_d[favorite]))\n else:\n result.append('-1')\nprint(' '.join(result)...
B
code-144169-b102ea64a91c
code-question-260fd713347e20c4
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...
[ "def determine_winner(M):\n return \"CHARLIE\" if M % 2 != 0 else \"DAN\"", "def determine_winner(M):\n return \"CHARLIE\" if M % 3 == 0 else \"DAN\"", "def determine_winner(M):\n return \"CHARLIE\" if M > 1 else \"DAN\"", "def determine_winner(M):\n return \"CHARLIE\" if M == 2 else \"DAN\"", "...
G
code-067201-0ae0309de656
code-question-58fe8d902c43aae3
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 day == 1:\n height += 2\n consecutive_dry = 0\n previous_watered = False\n else:\n consecutive_dry += 1\n if consecutive_dry >= 3:\n dead = True\n height = -1\n previous_watered = False", "if day == 1:\n ...
F
code-124639-0256f25d3861
code-question-0ab89b02393a0553
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_n = 2 * n\n fact = [1] * (max_n + 1)\n for i in range(1, max_n + 1):\n fact[i] = fact[i-1] * i % MOD\n inv_fact = [1] * (max_n + 1)\n inv_fact[max_n] = pow(fact[max_n], MOD-2, MOD)\n for i in range(max_n-1, -1, -1):\n inv_fact[i] = inv_fact[i+1] * (i+1) % MOD\n def comb(a, b):\n...
D
code-179016-be986b6c36fb
code-question-e7bf4cea5ebd3f51
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 char in s:\n if char.isalpha():\n count += 1", "for char in s:\n if not char.isdigit():\n count += 1", "for char in s:\n if char.isdigit():\n count = count", "for char in s:\n if char.isdigit():\n count += 1", "for i, char in enume...
D
code-091168-c928ed7f4099
code-question-6c898ce04509ebbc
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_le = bisect.bisect_right(A_sorted, t)\n b_le = bisect.bisect_right(B_sorted, t)\n diff = a_le - b_le\n A_score = 2 * a_le + 3 * (len(A) - a_le)\n B_score = 2 * b_le + 3 * (len(B) - b_le)\n if (diff > min_diff) or (diff == min_diff and A_score < best_A):\n min_diff = diff\n best_A = A...
G
code-244317-dfb129680ed2
code-question-6e752cc1b0b8ab77
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_count = max(counts.values())\n total = sum(counts.values())\n trays_needed = max(max_count, (total + 7) // 8)\n print(trays_needed)", "max_count = len(counts.values())\n total = sum(counts.values())\n trays_needed = max(max_count, total // 8)\n print(trays_needed)", "max_count = max(count...
A
code-265243-244ec8d96c1a
code-question-57f2603e0f9617a3
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\npath1 = [(1, c) for c in range(1, n + 1)]\npath2 = [(r, n) for r in range(n, 0, -1)]", "k = 2 * n - 1\npath1 = [(1, c) for c in range(1, n + 1)]\npath2 = [(r, n) for r in range(n, 0, -1)]", "k = n + 1\npath1 = [(1, c) for c in range(1, n + 1)]\npath2 = [(r, n) for r in range(n, 0, -1)]", "k = n\npath1...
A
code-264477-29a5f4d52259
code-question-c2a16e7f605ef4df
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 song in songs:\n count = 0\n for char in song:\n if char == C:\n count = 1\n break\n if count > max_count:\n max_count = count\n max_song = song", "for song in songs:\n count = 0\n max_count = -1\n for ch...
E
code-219423-a9d030d6fa70
code-question-d37b58e579a6fba5
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 name, max_val in data_types:\n if m <= max_val:\n print(name)\n break\nprint('BigInt')", "if m < 0:\n print('BigInt')\n exit()\nfor name, max_val in data_types:\n if m <= max_val:\n continue\nprint('BigInt')", "for name, max_val in reversed(data_types):\n if m <= max_val...
G
code-135453-9b2387084299
code-question-bba2cdb0c54cf10a
7