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...
[ "count = Counter(thicknesses)\n max_thick = max(thicknesses)\n print(max_thick)", "thicknesses.sort()\n unique = len(set(thicknesses))\n print(unique)", "count = Counter(thicknesses)\n num_groups = len(count)\n print(num_groups)", "count = Counter(thicknesses)\n ...
D
code-045516-19138998a20c
code-question-0163a539663876de
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...
[ "d_prev = drivers[idx - 1]\n d_next = drivers[idx]\n dist_prev = c - d_prev\n dist_next = d_next - c\n if dist_prev < dist_next:\n counts[idx - 1] += 1\n elif dist_prev > dist_next:\n counts[idx] += 1\n else:\n counts[idx] += 1", "d_prev =...
D
code-227437-ec5c6f110d7b
code-question-d2b5c77c0c6f2491
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 new_tasks = []\n output = []\n for num in current_tasks:\n if num % p == 0:\n output.append(num)\n else:\n new_tasks.append(num)\n current_tasks = new_tasks", "for p in primes:\n new_tasks = []\n for num in current_tasks:\n if num % ...
D
code-194337-25c62abe52ce
code-question-5205cbcb88679b8d
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...
[ "pos = (s + i) % n\n expected = ((p[s] + i - 1) % n)\n if expected < 0:\n expected += n\n if expected == 0:\n expected = n", "pos = (s + i) % n\n expected = p[s] + i\n if expected > n:\n expected %= n\n ...
B
code-167750-81cbcb45b4b9
code-question-10c4cb994a5674b7
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...
[ "ten_part = tens[n // 10]\n unit_part = ones[n % 10]\n return ten_part", "ten_part = tens[(n % 100) // 10]\n unit_part = ones[n // 10]\n if unit_part:\n return f\"{ten_part}-{unit_part}\"\n else:\n return ten_part", "ten_part = tens[n // 10]\n unit...
E
code-099074-b6c37feaec75
code-question-9247ad0ffcc0c45d
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...
[ "diff = abs(g - y)\ntotal = g + y\nif diff <= 2:\n print(\"YES\")\nelse:\n print(\"NO\")", "max_count = max(g, y)\ntotal = g + y\nif max_count < (total + 1) // 2:\n print(\"YES\")\nelse:\n print(\"NO\")", "min_count = min(g, y)\ntotal = g + y\nif min_count <= (total + 1) // 2:\n print(\"YES\")\ne...
F
code-143189-80ee708808f7
code-question-b197ee66ce8a2ea0
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = 0\n for u in range(1, N + 1):\n s = set()\n for v in adj[u]:\n s.update(adj[v])\n count += len(s)", "count = 0\n for u in range(1, N + 1):\n s = set()\n for v in range(1, N + 1):\n if u in adj[v]:\n s.update(adj[v])\n ...
F
code-269425-3f814e44e4b5
code-question-70f4adf7a0b1aa0d
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, (M - L + 2)):\n current_sum = current_sum - B[i-1] + B[i + L - 1]\n if current_sum > max_sum:\n max_sum = current_sum\n best_start = i", "for i in range(1, (M - L + 1)):\n current_sum = current_sum - B[i] + B[i + L - 1]\n if current_sum >= max_sum:\n max_sum = c...
C
code-273533-f8fc292d83d4
code-question-d8660fb9f629a8f3
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...
[ "complement = num - target\n if complement in seen:\n return True\n seen.add(num)", "complement = target - num\n if complement not in seen:\n return True\n seen.add(num)", "complement = target - num\n if complement in arr:\n return True\n ...
D
code-093737-0e7af3f9fb7d
code-question-19c33150bd7a789f
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...
[ "tiles_p1 = (p + b) // b\n tiles_q1 = (q + c) // c\n option1 = tiles_p1 * tiles_q1\n tiles_p2 = (p + c) // c\n tiles_q2 = (q + b) // b\n option2 = tiles_p2 * tiles_q2\n return min(option1, option2)", "tiles_p1 = (p + b - 1) // b\n tiles_q1 = (q + c - 1) // c\n option1 = tiles_p1 + tiles_q1...
E
code-035067-bc97d39c524a
code-question-142d667ce2ac8b4e
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 cmd == 'B':\n if len(stack) > 1:\n stack.pop()\n ptr +=1\n else:\n pos = int(input[ptr+1])\n stack.pop()\n ptr +=2", "if cmd == 'F':\n pos = int(input[ptr+1])\n stack.append(p...
G
code-033106-83471e5aad4b
code-question-8ccd109675d219c3
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 = ['0'] * len(s)\nfound = False\nfor i, c in enumerate(s):\n if c == '1' and not found:\n result[i] = '1'\n found = False", "result = ['0'] * len(s)\nfound = False\nfor i, c in enumerate(s):\n if c == '1' and not found:\n result[i] = '1'\n found = True", "result = ['0']...
B
code-081939-3d5037cd738b
code-question-adb11794c5df12ef
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 num in arr:\n if num % k == 0:\n current += 1\n else:\n pass\n if current > max_len:\n max_len = current", "for num in arr:\n if num % k == 0:\n current += 1\n else:\n current = 0\n if current > max_len:\n max_len = current", "for num in arr:\n ...
B
code-279814-f5a66a8505b5
code-question-c0b6fcc25de158c2
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = 0\n vowels = {'a', 'e', 'i', 'o', 'u'}\n for c in set(s.lower()):\n if c in vowels:\n count += 1", "count = 1\n vowels = {'a', 'e', 'i', 'o', 'u'}\n for c in s:\n if c.lower() in vowels:\n count = 0", "count = 0\n vowels = ['a', 'e', 'i', 'o', 'u']\n ...
G
code-049059-d2646907a59a
code-question-c117dc82efcce742
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[r] in seen:\n res.append((l + 1, r + 1))\n l = r + 1\n seen.clear()\n else:\n seen[a[r]] = r", "if a[r] in seen and seen[a[r]] >= l:\n res.append((l, r))\n l = r\n seen = {}\n else:\n seen[a[r]] = r", "if a[r] in seen and seen[a[r]] >= l:\n ...
H
code-235958-fe071da6e3b3
code-question-f68389119a025809
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, b, c = map(int, sys.stdin.readline().split())\n total = a * 5 + b * 10 - c\n print(total)", "a, b, c = map(int, sys.stdin.readline().split())\n total = a + b\n print(total // c)", "a, b, c = map(int, sys.stdin.readline().split())\n total = (a + b) * 5\n print(total ...
F
code-155915-df8b8306723c
code-question-2945254417481b54
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_diff = 0\n for c in cnt1.keys():\n total_diff += abs(cnt1.get(c, 0) - cnt2.get(c, 0))\n for c in cnt2.keys():\n total_diff += abs(cnt2.get(c, 0) - cnt1.get(c, 0))\n return total_diff", "all_chars = set(cnt1.keys()) ^ set(cnt2.keys())\n total_diff = 0\n for c in all_chars:\n ...
E
code-091198-ffdf1032ad59
code-question-dace90664461ab39
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...
[ "containers.sort(reverse=True, key=lambda x: x[0])\ntotal = 0.0\nremaining = l\nfor p, li in containers:\n if remaining <= 0:\n break\n take = remaining\n total += take * p\n remaining -= li", "containers.sort(reverse=True, key=lambda x: x[0])\ntotal = 0.0\nremaining = l\nfor p, li in container...
B
code-152095-8aae0c9ed89e
code-question-7ba2e58236926976
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 True:\n next_fib = a + b\n if next_fib >= n:\n break\n if next_fib % 2 == 1:\n sum_odd += next_fib\n a, b = b, next_fib", "while True:\n next_fib = a + b\n if next_fib > n:\n break\n if...
E
code-268435-af1c4fe9c31e
code-question-0e5c081419c11891
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...
[ "result = []\n for x, y in zip(a, b):\n result.append('1' if x == '1' and y == '1' else '0')\n print(''.join(result))", "result = []\n for x, y in zip(a, b):\n result.append('1' if x == y else '0')\n print(''.join(result))", "result = []\n for x, y in zip(a, b):\n result.appe...
A
code-275249-186b21850031
code-question-353d3cdaa49041be
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_needed = 0\n for j in range(M - i, M):\n c = citations[j]\n if c >= i:\n continue\n if c + 1 > i:\n sum_needed += 1\n else:\n return False\n return sum_needed <= K", "sum_needed = 0\n for j in range(...
E
code-044329-aed2cec56ad8
code-question-c52912a9d46c7646
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_cycles = M // 3\n remainder = M % 3\n if remainder == 0:\n position = 0\n elif remainder == 1:\n position = -1\n else:\n position = 1", "full_cycles = M // 2\n remainder = M % 2\n if remainder == 0:\n position = full_cycles\n elif remainder == 1:\n pos...
D
code-212344-c0d8c46e7f27
code-question-b947ae2c26fcacd6
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(len(b)):\n current_sum += b[i]\n if i >= window_size:\n current_sum -= b[i - window_size]\n if i >= window_size - 1:\n if current_sum < min_sum:\n min_sum = current_sum", "for i in range(len(b)):\n current_sum += b[i]\n if i >...
A
code-030067-b92cd9643e14
code-question-9a30baeb816ef641
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...
[ "assignments = [b for a, b in days]\n difference = sum_max - total\n for i in range(n):\n a_i, b_i = days[i]\n possible_reduce = assignments[i] - a_i\n reduce = max(possible_reduce, difference)\n assignments[i] -= reduce\n difference -= reduce\n if difference == 0:\n ...
E
code-231000-bfae1d9f9f84
code-question-a746d07fcf395db3
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 = 5 * n + 4\n y = 5 * n - 4\n def is_square(z):\n if z < 0:\n return False\n s = math.isqrt(z)\n return s * s == z\n if is_square(x) or is_square(y):\n print(\"Yes\")\n else:\n print(\"No\")", "x = 5 * (n ** 2) + 4\n def is_square(z):\n if z <...
C
code-082273-2d51a936a1b6
code-question-23c193dcec418fb0
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_i = (r * (r + 1) // 2) - (l * (l + 1) // 2)\nsum_sq = (r * (r + 1) * (2 * r + 1) // 6) - (l * (l + 1) * (2 * l + 1) // 6)\ntotal = n + (sum_sq + sum_i) // 2", "sum_i = (r * (r + 1)) - ((l - 1) * l)\nsum_sq = (r * (r + 1) * (2 * r + 1) // 3) - ((l - 1) * l * (2 * (l - 1) + 1) // 3)\ntotal = n + (sum_sq + sum_...
E
code-177113-9163c0c3f00f
code-question-fcbc885920b68ed6
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...
[ "old = abs(current - a) + abs(next_point - current)\n new = abs(next_point - current) + abs(a - 0)\n delta = new - old\n total = original_total + delta\n print(total)", "old = abs(current - a)\n new = abs(next_point - a)\n delta = new - old\n total = original_total + delta\n print(total)",...
H
code-139890-6a7712ff2bf7
code-question-f52cb494dc27300d
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for c in s:\n if c == 'H':\n current += 2\n total += current\n else:\n current = 0", "for c in s:\n if c == 'H':\n total += current\n current += 1\n else:\n current = 0", "for c...
C
code-263323-be97705d493b
code-question-243bab66e4ede7ab
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 i > 1:\n left = s[i-2]\n if left != '.':\n fruits.add(left)\n current = s[i]\n if current == '.':\n fruits.add(current)\n if i < len(s) - 2:\n right = s[i+2]\n if right != '.':\n fruits.add(right)\n if set(['A','B','C']) == fruits:\n pr...
F
code-222895-d2bfd78f0cde
code-question-61168c320c9e8d66
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...
[ "left_moment = 0\nfor j in range(p):\n c = s[j]\n if c != '=':\n distance = (p - j) ** 2\n left_moment += int(c) * distance\nright_moment = 0\nfor j in range(p + 1, len(s)):\n c = s[j]\n if c != '=':\n distance = (j - p) ** 2\n right_moment += int(c) * distance", "left_mome...
F
code-174791-611927f819c2
code-question-4ac3b89242dd4df6
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...
[ "frequency = {}\norder = []\nseen = set()\nfor c in s:\n frequency[c] = frequency.get(c, 0) + 1\nfor c in sorted(frequency.keys()):\n order.append(c)\nseen = set(order)", "frequency = {}\norder = []\nseen = set()\nfor c in s:\n if c in seen:\n continue\n order.append(c)\n seen.add(c)\n fr...
C
code-090146-835836e6925e
code-question-0071e5c0d3a5d69e
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...
[ "sorted_with_indices = sorted([(scores[i], i) for i in range(N)], key=lambda x: (-x[0], x[1]))\n pos_map = {}\n for j in range(N):\n s, i = sorted_with_indices[j]\n pos_map[(s, i)] = j\n groups = []\n for i in range(N):\n s = scores[i]\n j = po...
C
code-197031-0b95f36d76b3
code-question-21ade95cfadc9ba7
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 required = 0\n for num in a:\n required += (num + mid - 1) // mid\n if required > k:\n break\n if required <= k:\n ans = mid\n high = mid - 1\n else:\n low = mid +...
A
code-062333-644d69b99584
code-question-a12ec4773fea01b6
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 >= 3:\n x = 3\n while x <= n:\n if is_prime(x):\n count += 1\n x += 10", "if n >= 3:\n x = 3\n while x < n:\n if is_prime(x):\n count += 1\n x += 10", "if n >= 3:\n x = 13\n while x <= n:\n if is_prime(x):\n count += 1\n...
A
code-100684-9985cae6f3ba
code-question-9d048ac1e322c044
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...
[ "l0 = l - 1\n r0 = r - 1\n diff[l0] = v\n diff[r0 + 1] = -v", "l0 = l - 1\n r0 = r - 1\n diff[l0] -= v\n diff[r0 + 1] += v", "l0 = l\n r0 = r - 1\n diff[l0] += v\n diff[r0 + 1] -= v", "l0 = l\n r0 = r - 1\n diff[l0] += v\n dif...
E
code-277214-246ef3b63442
code-question-4079b14f1816476b
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...
[ "num1 = int(a[::-1])\n num2 = int(b[::-1])\n area = num1 * num2\n reversed_area = int(str(area)[-1])", "num1 = int(a)\n num2 = int(b)\n area = num1 * num2\n reversed_area = int(str(area)[::-1])", "num1 = int(a[::-1])\n num2 = int(b[::-1])\n area = num1 * num2\n reversed_area = int(str...
F
code-268933-16c80244c0f5
code-question-360643099b642956
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 grid[row][col] == 'S':\n found = True\n break\n for dr, dc in directions:\n nr = row + dr\n nc = col + dc\n if 0 <= nr < H and 0 <= nc < W:\n if not visited[nr][nc] and grid[nr][nc] != '#':\n visited[nr][nc] = True\n...
C
code-276770-cb51cb24d681
code-question-4137d403a24a1aaf
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 i in range(m):\n if i in tim_candies and i in sam_candies:\n result.append('A')\n elif i in tim_candies:\n result.append('A')\n else:\n result.append('B')", "result = []\nfor i in range(1, m + 1):\n if i in tim_candies and i in sam_candies:\n result.append...
B
code-073202-93e071d9abc7
code-question-30bc922d346c1af6
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...
[ "subtree_sums = [0] * (N+1)\ndef post_order(u):\n subtree_sums[u] = w[u-1] + (w[parent[u]-1] if parent[u] != 0 else 0)\n for v in children[u]:\n post_order(v)\n subtree_sums[u] += w[v-1]\npost_order(1)", "subtree_sums = [0] * (N+1)\ndef post_order(u):\n subtree_sums[u] = 1\n for v in chi...
D
code-102660-d0025df5d6e2
code-question-4a01b825b6c6f109
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "k = len(positions)\n positions.sort()\n min_gap = n\n for i in range(k):\n current = positions[i]\n next_p = positions[(i + 1) % k]\n gap = next_p - current - 1\n if gap < 0:\n gap += n\n if gap < min_gap:\n min_gap = gap\n ans = min_val * n + mi...
D
code-215698-1b87fdba58f2
code-question-8f552dac66970c5e
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...
[ "if y >= 2:\n if y % 2 == 1:\n diff = 0\n else:\n diff = x * z\n if diff < min_diff:\n min_diff = diff", "if y >= 2:\n if z % 2 == 0:\n diff = 0\n else:\n diff = x * z\n if diff < min_diff:\n min_diff = diff", "if y >= 2:\n if y % 2 == 0:\n d...
D
code-200812-92f16117af47
code-question-4a7520bf2746115f
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...
[ "prob_no_collision = 1.0\n for i in range(1, k):\n prob_no_collision *= (n - i) / n\n print(\"{0:.9f}\".format(prob_no_collision))", "prob_no_collision = 1.0\n for i in range(1, k):\n prob_no_collision *= (n - i) / n\n collision_prob = 1 - ...
B
code-045267-5ea3ff09a196
code-question-b6458a202faff1ca
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...
[ "left1 = arr1[i-1] if i != 0 else 0\n left2 = arr2[j-1] if j != 0 else 0\n right1 = arr1[i] if i != n else 10**9\n right2 = arr2[j] if j != m else 10**9\n if left1 <= right2 and left2 <= right1:\n return max(left1, left2)\n elif left1 > right2:\n high = i - 1...
E
code-106369-4295ea2f134f
code-question-1bf7a8a5e032ae4b
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, P + 1):\n for j in range(1, Q + 1):\n if X[i-1] == Y[j-1]:\n dp[i][j] = dp[i-1][j-1] + 1\n else:\n dp[i][j] = min(dp[i-1][j], dp[i][j-1])", "for i in range(1, P + 1):\n for j in range(1, Q + 1):\n if X[i] == Y[j]:\n dp[i][j] = dp[i-1][...
F
code-189166-ed2af1c17544
code-question-1839639402bc1702
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 m % i == 0:\n count = 0\n while m % i == 0:\n count += 1\n i += 1\n factors.append((i, count))", "if m % i == 0:\n count = 0\n while m % i == 0:\n count += 1\n m //= i\n factors.append((i, 1))", "if m % i == 0:\n count = 0\n while m % i == 0:\n ...
E
code-083574-f92ad9e475fa
code-question-5dbc3298cda35420
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...
[ "drivers.append((-laps, i, name))\n drivers.sort()\n for d in drivers:\n print(d[2])", "drivers.append((-laps, name, i))\n drivers.sort()\n for d in drivers:\n print(d[2])", "drivers.append((-laps, i, name))\n drivers.sort(reverse=True)\n for d in drivers:\n print(d[2])", ...
A
code-068362-0cc790d848fd
code-question-7b2bfdd16a24cf1f
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 x >= h:\n cone_volume = (math.pi * math.sqrt(x ** 2 - h ** 2) * h) / 3\nelse:\n cone_volume = 0.0\nmax_volume = max(cylinder_volume, cone_volume)\nprint(\"{0:.2f}\".format(round(max_volume, 2)))", "if x >= h:\n cone_volume = (math.pi * (x / 2) ** 2 * h) / 3\nelse:\n cone_volume = 0.0\nmax_volume =...
H
code-134187-9ed9d09a74dd
code-question-d725a4156119b478
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...
[ "sum1 = A1 + B1\n sum2 = A2 + B2\n if sum1 > sum2:\n print(1)\n else:\n print(2)", "sum1 = max(A1, B1)\n sum2 = max(A2, B2)\n if sum1 > sum2:\n print(1)\n else:\n print(2)", "sum1 = A1 + B1\n sum2 = A2 + B2\n if ...
A
code-111337-5b8a57573660
code-question-038b50ef2c4ad74b
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_count = min(count0, count1)\n min_count = max(count0, count1)\n if max_count - min_count > 1:\n print(\"NO\")\n else:\n print(\"YES\")", "max_count = max(count0, count1)\n min_count = min(count0, count1)\n if max_count - min_count > 1:\n print(\"NO\")\n else:\n p...
B
code-220544-f6891cf0d9a4
code-question-325b5cb1020ba1bc
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 = 1 if grid[i][j] == '*' else 0\n b = 1 if grid[i][j+1] == '*' else 0\n c = 1 if grid[i+1][j] == '*' else 0\n d = 1 if grid[i+1][j+1] == '*' else 0\n t1 = a + b + c\n t2 = b + c + d\n t3 = a + c + d\n max_tri...
E
code-154940-74077d1892b8
code-question-a1a86a40ce46b6d5
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 k < 0 or k > n:\n print(0)\nelse:\n c = math.comb(n, k)\n m = n - k\n print(derangement(m))", "if k < 0 or k > n:\n print(0)\nelse:\n c = math.comb(n, k)\n m = n - k\n print(c * derangement(m - 1))", "if k < 0 or k > n:\n print(0)\nelse:\n c = math.comb(n, k)\n m = n - k\n ...
G
code-091264-76e1439f3106
code-question-e22cfbf937a3ece9
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 num in arr:\n current_xor ^= num\n target = K ^ num\n result += prefix_counts[target]\n prefix_counts[current_xor] += 1", "for num in arr:\n current_xor ^= num\n if current_xor == K:\n result += 1\n prefix_counts[curr...
D
code-086147-d2619fd3cc0d
code-question-727072585fa9fef2
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...
[ "L0 = L - 1\n R0 = R - 1\n if L0 == 0:\n left_val = 0\n else:\n left_val = prefix[L0]\n if R0 == M - 1:\n right_val = 0\n else:\n right_val = suffix[R0]\n res = left_val & right_val\n print(res)", "if L == 1:\n ...
D
code-049284-77e4d3eac56f
code-question-538e94d956267680
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...
[ "found = False\n for x in range(1, M // 2 + 1):\n if not is_allowed(x) and not is_allowed(M - x):\n found = True\n break", "found = False\n for x in range(1, M // 2 + 1):\n if is_allowed(M):\n found = True\n break", ...
E
code-115855-d17bd3a82f46
code-question-3c264daa920324b7
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 i in range(len(sequence)):\n s = sequence[i]\n b = spell_map[s]\n if len(b) > len(s):\n result.append(b)\n else:\n result.append(s)", "result = []\nfor s in sequence:\n b = spell_map[s]\n result.append(min(b, s, key=lambda x: (len(x), x)))", "result = []\nfor s ...
E
code-117139-c321ff322321
code-question-681413be09aec20f
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_time = 0\n for i in range(n):\n if s[i] == 'C' and nearest_left[i] != -1:\n distance = i - nearest_left[i]\n max_time = distance\n break", "max_time = 0\n for i in range(n):\n if s[i] == 'C' and nearest_left[i] != -1:\n ...
B
code-194423-5ddf9bbd68f9
code-question-586a403d4bb614c9
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, sqrt_k + 1):\n if k % d == 0:\n e = k // d\n if math.gcd(d, e) != 1:\n continue\n a = m * e\n b = m * d\n if p <= a <= q and p <= b <= q:\n count += 1", "for d in range(1, sqrt_k + 1):\n if k % d ...
D
code-190506-4f6ae1936669
code-question-ebf66eb0e5cfc897
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 = int(input[idx])\n b = int(input[idx+1])\n idx += 3\n player = input[idx]\n print(player)", "a = int(input[idx])\n b = int(input[idx+1])\n player = input[idx+2]\n idx += 3\n print(a)", "a = int(input[idx])\n b = int(input[idx+1])\n player...
F
code-233290-a7ecfcccb766
code-question-cff1755290304170
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...
[ "last_even = -1\n for i in reversed(range(len(prefix_parity))):\n if prefix_parity[i] == 0:\n last_even = i\n break\n last_odd = -1\n for i in reversed(range(len(prefix_parity))):\n if prefix_parity[i] == 1:\n last_odd = i\n break\n candidate1 = ...
A
code-254685-5c4c80f01df7
code-question-61fd42efa35f2a51
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...
[ "celsius = (f - 32) * 5 / 9\nkelvin = celsius - 273.15\ncelsius_formatted = \"{:.5f}\".format(celsius)\nkelvin_formatted = \"{:.5f}\".format(kelvin)", "celsius = (f - 32) * 5 / 9\nkelvin = celsius + 273.15\ncelsius_formatted = \"{:.5f}\".format(kelvin)\nkelvin_formatted = \"{:.5f}\".format(celsius)", "celsius =...
F
code-070484-2ff91efc98e7
code-question-1d6a3944ea5d8da1
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...
[ "segment = arr[l:r+1]\nrotated = segment[2:] + segment[:2]\narr[l:r+1] = rotated", "segment = arr[l:r+1]\nrotated = [segment[-1]] + segment[:-1]\narr[l:r+1] = rotated", "segment = arr[l:r]\nrotated = segment[1:] + [segment[0]]\narr[l:r] = rotated", "segment = arr[:]\nrotated = segment[1:] + [segment[0]]\narr ...
E
code-201695-ea0479316e75
code-question-b69599c6387e6d9b
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 num % 2 == 0:\n current_sum += 1\n else:\n current_sum -= 1\n result += prefix_counts[abs(current_sum)]\n prefix_counts[current_sum] += 1", "result += prefix_counts[current_sum]\n if num % 2 == 0:\n current_sum += 1\n else:\n current_sum -= 1\n prefix_counts[curre...
C
code-096679-09c4e01058c9
code-question-6612c5a45c3ddad4
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 rem = n % 5\n digits.append(rem)\n n = n // 5 - 1\n digits.reverse()\n return ''.join(map(str, digits))", "while n > 0:\n rem = n % 5\n digits = [rem] + digits\n n //= 5\n return ''.join(map(str, digits))", "while n > 0:\n rem = n % 5\n ...
C
code-122361-1573b6cee96b
code-question-8c1a527ab4e053c2
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...
[ "required = W - Wr\n if required <= 0:\n print(\"YES\")\n continue\n needed_sum = required // 2\n total = sum(weights)\n if total % 2 == 0:\n max_eve = total\n else:\n max_eve = total - 1\n if max_eve >= needed_sum:\n p...
D
code-114490-aaddd2b39347
code-question-f44a7ac3a0577897
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 i in range(len(s) - 1):\n current = s[i]\n if current in specials and current != 't':\n next_char = s[i + 1]\n if next_char not in specials:\n print(\"INVALID\")\n exit()", "for i in range(len(s) - 1):\n current = s[i]\n if current not in specials or current ==...
D
code-008697-54dc9e521608
code-question-bdd2dca71989bd62
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...
[ "sub = a[i:]\n if not sub:\n break\n max_val = sorted(sub, reverse=True)[0]\n j = a.index(max_val)\n if j != i:\n a[i], a[j] = a[j], a[i]\n swaps.append((i, j))", "sub = a[i:]\n if not sub:\n break\n max_val = max(sub)\n j = sub[::-1].index(max_val)\n if j != i:...
C
code-097696-37a40638a730
code-question-d3e223ec552035b2
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 % b == 0:\n y = b\nelse:\n y = (a // b) * b", "if a % b != 0:\n y = (a // b) * b\nelse:\n y = a + b", "if a % b == 0:\n y = a + 1\nelse:\n y = ((a // b) + 1) * b", "if a % b:\n y = (a // b) * b + (b - a % b) - 1\nelse:\n y = a + b", "if a % b == 0:\n y = a\nelse:\n y = ((...
G
code-134121-f5f5add66885
code-question-c7d1d0ece7d5c653
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 = bisect.bisect_left(L_list, e)\n if k > 0 and R_list[k] > e:\n print(0)\n else:\n if k < N:\n print(L_list[k] - e)\n else:\n print(-1)", "k = bisect.bisect_right(L_list, e)\n if k < N and L_list...
C
code-057605-9cec4b106634
code-question-73f9b2538acbe8b1
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 base = ''.join([chr(ord('a') + i) for i in range(26)])\n extra = K - 25\n extra_part = ''.join([chr(ord('z') - i) for i in range(extra + 1)])\n return base + extra_part", "else:\n base = ''.join([chr(ord('a') + i) for i in range(26)])\n extra = K - 25\n ex...
B
code-021322-db5f6916c349
code-question-bb113ab9e7e7e711
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...
[ "digit_a = a_digits[i] if i < len(a_digits) else 0\n digit_b = b_digits[i] if i < len(b_digits) else 0\n total = digit_a + digit_b + carry\n if carry:\n count += 1\n carry = total // 10", "digit_a = a_digits[-i-1] if i < len(a_digits) else 0\n digit_b = b_digits[-i-1]...
D
code-079347-3b8866443d8a
code-question-d325d5cb9d0eb71f
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "possible = True\n for count in freq.values():\n if count < 2:\n possible = False", "possible = True\n if len(freq) != N:\n possible = False", "possible = True\n for count in freq.values():\n if count >= 2:\n possible = False", ...
E
code-073496-00c3d629ccf7
code-question-e8bdc769164e6694
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 = min(k, n - k)\n result = 1\n for i in range(k + 1):\n result = result * (n - k + i) // (i + 1)\n return result", "k = min(k, n - k)\n result = 1\n for i in range(1, k + 1):\n result = result * (n - i) // i\n return result", "k = min(k, n - k)\n result = 1\n for i in ra...
F
code-263798-ed37b524bccd
code-question-f3ddc3112e3f7830
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_cycles = (x + 1) // next_power\n count = full_cycles * power\n remainder = (x + 1) % next_power\n count += min(0, remainder - power)\n total += count", "full_cycles = (x + 1) // next_power\n count = full_cycles * power\n remainder = (x + 1) % next_power\n cou...
B
code-277547-ac48d6935a6c
code-question-1952383d16f21a83
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...
[ "op, _ = input().split()\nif op == '+':\n current += 1\n if current > max_animals:\n max_animals = current\nelse:\n current = 0", "op, _ = input().split()\nif op == '+':\n current += 1\nelse:\n current -= 1\n max_animals = current", "_, op = input().split()\nif op == '+':\n current +...
F
code-040468-aef30d5c279d
code-question-d6195b31c673abc8
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.sort(reverse=True)\n alex = 0\n bob = 0\n for i in range(n):\n if i % 2 == 0:\n bob += a[i]\n else:\n alex += a[i]", "a.sort()\n alex = 0\n bob = 0\n for i in range(n):\n if i % 2 == 0:\n ale...
H
code-250670-4d75e948f649
code-question-ae766c7a7d2d9169
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...
[ "left_ones = sum(row[:j])\n window_length = min(l, y - j)\n window = row[j+1 : j + 1 + window_length]\n current_score = sum(window) + row[j]\n if current_score > max_score:\n max_score = current_score\n min_cost = left_ones + 1\n elif current_score == max_sco...
F
code-058294-72b6489172a6
code-question-eb27ae4b409598ef
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 d in (2, 3, 7, 8):\n c = 2\n else:\n c = 4\n i_plus_1 = i + 1\n if i_plus_1 >= c:\n effective_e = c\n else:\n fact_mod = 1\n for j in range(1, i_plus_1 + 1):\n fact_mod = (fa...
C
code-258985-b3b14083fd04
code-question-a7d300565267e64a
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...
[ "word_set = set(word)\n word_set.intersection_update(common)\n if not word_set:\n break", "word_set = set(word)\n common = word_set\n if not common:\n break", "word_set = set(word)\n common.difference_update(word_set)\n if not common:\n ...
G
code-051833-e23040d7a4fb
code-question-727b84bfad32f835
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 op == \"ADD\":\n current_size += 1\n else:\n current_size = min(current_size - x, 0)", "if op == \"ADD\":\n current_size += x\n else:\n current_size = max(current_size - 1, 0)", "if op == \"ADD\":\n current_size += 1\n else:\n current_size = max(x - current...
D
code-205392-b8abb42c3971
code-question-48b6917128ae904f
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[0]]\n for i in range(1, n):\n x.append(y[i] - y[i-1] - 1)\n print(' '.join(map(str, x)))", "x = [0]\n for i in range(1, n):\n x.append(y[i] - y[i-1])\n print(' '.join(map(str, x)))", "x = [y[0] - 1]\n for i in range(1, n):\n x.append(y[i] - x[i-1])\n print(' '.join...
H
code-072966-52fb5360f28b
code-question-9a1f58e16450bb82
8
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "for c in s:\n digit = int(c)\n remainder = (10 * remainder - digit) % 7", "for c in s:\n digit = int(c)\n remainder = (remainder + digit) % 7", "for c in s:\n digit = ord(c) - ord('0')\n remainder = (remainder * 10 + digit) % 9", "for c in s:\n digit = int(c)\...
D
code-078139-f7974869f41e
code-question-c6d0ba5523d0800b
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 = []\n for j in range(n):\n count = 0\n for k in range(j + 1, n):\n if p[k] < p[j]:\n count += 1\n C.append(count)", "C = []\n for j in range(n):\n count = 0\n for k in range(j):\n if p[k] > p[j]:\n count += 1\n ...
F
code-021475-775d85ed4280
code-question-a4987c8b8ab9ecdc
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...
[ "frequency = {}\nfor word in words:\n if word in frequency:\n frequency[word] = 0\n else:\n frequency[word] = 1", "frequency = {}\nfor word in words:\n if word in frequency:\n frequency[word] += 1\n else:\n frequency[word] = 1", "frequency = {}\nfor word in words:\n if...
B
code-277908-b1963c7826cb
code-question-0667165834fd0e40
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "count = 0\nfor char in username:\n if char in vowels:\n count += 1\nif count % 2 == 0:\n print(\"SAFE USERNAME\")\nelse:\n print(\"RISKY USERNAME\")", "for char in username:\n if char not in vowels:\n found_vowels.add(char)\ncount = len(found_vowels)\nif count % 2 == 0:\n print(\"SAF...
E
code-175474-571c8e7948f1
code-question-7b38546c6a8522ce
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 desired_bit in node:\n max_xor |= 1\n node = node[desired_bit]\n else:\n if bit in node:\n node = node[bit]\n else:\n break", "if desired_bit in node:\n max_xor = (max_xor << 1) | 1\n node = node[desired_bit...
D
code-117459-0c2b7e97199a
code-question-e5e3e67441713b33
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...
[ "ans = 0\n for c in x_counts.values():\n ans += c * (c - 1) // 2\n for c in y_counts.values():\n ans += c * (c - 1) // 2\n print(ans)", "ans = 0\n for c in x_counts.values():\n ans += c * (c - 1) / 2\n for c in y_counts.values():\n ans += c * (c - 1) / 2\n print(ans)"...
A
code-210700-3ec8caf04820
code-question-783ee0f49ec08c44
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 = s1 + s2\n s_b = s2 + s1\n if s_a == s_a[::-1]:\n print(\"YES\")\n else:\n print(\"NO\")", "s_a = s1 + s2\n s_b = s2 + s1\n if s_a == s_a[::-1] and s_b == s_b[::-1]:\n print(\"YES\")\n else:\n print(\"NO\")", "s_a = s1 + s2\n s_b = s2 + s1\n if s_a == s_...
D
code-027401-149801b8f2a4
code-question-8299d497a8718205
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...
[ "product = 1\n for x in range(2, n + 1, 2):\n product = (product + x) % 10\n print(product)", "product = 1\n for x in range(2, n + 1):\n product = (product * x) % 10\n print(product)", "product = 0\n for x in range(2, n + 1, 2):\n product = (product * x) % 10\n print(produ...
F
code-014247-e0985c16d241
code-question-4c4167f990e60d32
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 m < N:\n s = m\n d = m + 1\n else:\n s = N\n d = 1\n probs = [0.0] * K\n for j in range(1, K+1):\n if total[s] <= 1:\n prob_j = 0.0 if total[s] == 0 else expected_j[s][j] / 1.0\n else:\n prob_j =...
G
code-138999-357ec3331f73
code-question-28d94b912f60f170
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_len = 0\n for i in range(n-1):\n a = a_counts[i]\n b = b_counts[i]\n if a > 0 and b > 0:\n current = a + b\n if current > max_len:\n max_len = current\n return max_len if max_len >= 2 else 0", "max_len = 0\n for i in range(n-1):\n a = ...
D
code-226754-ee943359f6d1
code-question-07381ee6a3f17b1b
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, b, c, d = map(int, input[idx:idx+4])\n idx += 4\n lengths = [a, b, c, d]\n print(min(a, b) * min(c, d))", "lengths = list(map(int, input[idx:idx+4]))\n idx += 4\n lengths.sort()\n print(lengths[1] * lengths[2])", "lengths = list(map(int, input[idx:idx+4]))\n ...
B
code-061262-67b984447ce5
code-question-8fc10a71bf7f37db
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...
[ "l, r = i, i + 1\n if r < n and s[l] == s[r]:\n palindromes.add(s[l:r+1])\n while l > 0 or r < n - 1 and s[l-1] == s[r+1]:\n l -= 1\n r += 1\n palindromes.add(s[l:r+1])", "l, r = i, i + 1\n if r < n:\n palindromes.add(s[l:r+1])\n while l > 0 and r...
D
code-171461-bbb474518058
code-question-ed94bdae754faf3a
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(T):\n N = int(input.readline())\n print((N // 3) if N > 0 else 0)", "for _ in range(T):\n N = int(input.readline())\n print((N + 1) // 3 + 1)", "for _ in range(T):\n N = int(input.readline())\n print(N // 4 + 1)", "for _ in range(T):\n N = int(i...
E
code-060009-2870d7eac4d2
code-question-4d7950758a8c6996
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 = K - D\n if rem < 0:\n continue\n y_low = min(1, C - rem)\n y_high = max(N, C + rem)\n if y_high < y_low:\n continue\n total += y_high - y_low + 1", "rem = K - D\n if rem < 0:\n continue\n y_low = max(1, C - rem)\n y_hi...
B
code-059023-2e625cb4d271
code-question-0326c131cff0400d
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_count = min(char_counts.values())\ncandidates = [char for char, count in char_counts.items() if count == min_count]\nmax_char = min(candidates, key=lambda x: ord(x))", "min_count = min(char_counts.values())\ncandidates = [char for char, count in char_counts.items() if count == min_count]\nmax_char = max(cand...
B
code-273105-23419084d939
code-question-850529e5ba57fa5f
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...
[ "left = 0\n if i > 0:\n left = int(current[i-1])\n right = 0\n if i < n-1:\n right = int(current[i+1])\n total = left + right\n if total == 1:\n next_s[i] = '1'\n else:\n next_s[i] = '0'", "left = 0\n if i > 0:\n ...
A
code-263479-a073cb6f5827
code-question-88cdbd17c25a4e5d
7
You are given a coding problem and its solution, with some parts of the solution replaced by [MASK]. Several candidate options are provided for the missing code. Carefully analyze the programming context and select the option that best fills in the [MASK]. Output the letter of the correct option in \boxed{}. **Questio...
[ "parts = input().split()\n if len(parts) == 1:\n phone = parts[0]\n name = phone_to_name[phone]\n print(f\"{phone} #{name}\")\n else:\n phone = parts[0]\n message = ' '.join(parts[1:])\n name = phone_to_name[phone]\n print(f\"{message} {phone} #{name}\")", "p...
D
code-159762-81175efc0aee
code-question-d6eecde17113d7d4
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...
[ "candidates = []\n for delta in [d]:\n x = Y + delta\n if x not in S:\n candidates.append(x)\n if candidates:\n print(candidates[0])\n break", "candidates = []\n for delta in [d, -d]:\n x = Y + delta\n if x in S:\n candidates.append(x)\n ...
G
code-100390-acae0cd7eede
code-question-69df8ede22e765aa
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...
[ "found = False\n for n in range(n_min, n_max + 1):\n S = 53 * n - Y\n if S < 0:\n continue\n if S <= 3 * n:\n found = True\n break\n print(1 if found else 0)", "found = False\n for n in range(n_min, n_max + 1):\n ...
B
code-112070-fe92726337fd
code-question-d6c0cd3d892303b1
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 = str(abs(N))\n first = int(s[0])\n last = int(s[-1])\n sum_d = first + last", "s = str(N)\n first = int(s[0])\n last = int(s[-1])\n sum_d = first + last", "s = str(abs(N))\n first = int(s[0])\n last = int(s[-1])\n sum_d = abs(first - last)", "s = str(abs(N))\n first = int(s[-...
A
code-224379-c1ae0772db92
code-question-ec768270bc0907a8
7