Answer: reject

votes=['reject', 'reject', 'reject', 'accept', 'reject', 'reject', 'accept']

Prompt: Seven reviewers vote ['reject', 'reject', 'reject', 'accept', 'reject', 'reject', 'accept']. Majority (ties broken by accept>reject>defer). What is the outcome?

Solution: Counts {'accept': 2, 'reject': 5, 'defer': 0}; winner reject.


Answer: reject

votes=['accept', 'reject', 'defer', 'reject', 'defer', 'reject', 'defer']

Prompt: Seven reviewers vote ['accept', 'reject', 'defer', 'reject', 'defer', 'reject', 'defer']. Majority (ties broken by accept>reject>defer). What is the outcome?

Solution: Counts {'accept': 1, 'reject': 3, 'defer': 3}; winner reject.


Answer: 3

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(2, 3), (5, 6), (9, 11)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(2, 3), (5, 6), (9, 11)]; count=3.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(3, 7), (4, 6), (8, 11)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(3, 7), (8, 11)]; count=2.


Answer: 1

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(3, 6), (5, 9), (5, 7)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(3, 9)]; count=1.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 6), (8, 11), (9, 12)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 6), (8, 12)]; count=2.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 8), (7, 9), (10, 13)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 9), (10, 13)]; count=2.


Answer: 1

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 9), (9, 13), (9, 10)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 13)]; count=1.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(3, 4), (3, 5), (7, 10)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(3, 5), (7, 10)]; count=2.


Answer: 3

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(6, 8), (11, 12), (16, 20)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(6, 8), (11, 12), (16, 20)]; count=3.


Answer: 1

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(2, 5), (4, 8), (6, 7)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(2, 8)]; count=1.


Answer: 1

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(6, 9), (7, 10), (8, 12)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(6, 12)]; count=1.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 6), (6, 8), (9, 11)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 8), (9, 11)]; count=2.


Answer: 1

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(4, 6), (6, 8), (7, 9)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(4, 9)]; count=1.


Answer: 1

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 7), (7, 8), (8, 11)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 11)]; count=1.


Answer: 3

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 6), (7, 8), (10, 14)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 6), (7, 8), (10, 14)]; count=3.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(5, 9), (9, 10), (14, 16)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(5, 10), (14, 16)]; count=2.


Answer: 2

Half-open [a,b) treated as overlapping when a < prev_b

Merge if they touch or overlap
Integer endpoints

Prompt: Merge overlapping half-open intervals [(7, 10), (12, 13), (13, 17)] on the integer line. How many disjoint intervals remain?

Solution: Merged [(7, 10), (12, 17)]; count=2.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [7, 13, 17, 20, 13] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 57 tokens and keeps 4 chunks.


Answer: 2

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 32 tokens. Pack chunks [20, 7, 11, 15, 8] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 27 tokens and keeps 2 chunks.


Answer: 2

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 32 tokens. Pack chunks [8, 10, 15, 16, 15] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 18 tokens and keeps 2 chunks.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [17, 11, 12, 15, 14] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 55 tokens and keeps 4 chunks.


Answer: 3

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 48 tokens. Pack chunks [13, 14, 15, 12, 7] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 42 tokens and keeps 3 chunks.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [7, 19, 16, 16, 20] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 58 tokens and keeps 4 chunks.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [17, 19, 9, 12, 13] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?


Answer: 2

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 32 tokens. Pack chunks [12, 11, 19, 13, 12] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 23 tokens and keeps 2 chunks.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 48 tokens. Pack chunks [17, 7, 11, 12, 11] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 47 tokens and keeps 4 chunks.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [10, 11, 8, 16, 20] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 45 tokens and keeps 4 chunks.


Answer: 5

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 48 tokens. Pack chunks [7, 7, 19, 7, 7] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 47 tokens and keeps 5 chunks.


Answer: 3

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 48 tokens. Pack chunks [7, 17, 17, 11, 18] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 41 tokens and keeps 3 chunks.


Answer: 2

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 32 tokens. Pack chunks [14, 6, 15, 14, 14] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 20 tokens and keeps 2 chunks.


Answer: 4

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 48 tokens. Pack chunks [16, 7, 12, 11, 19] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 46 tokens and keeps 4 chunks.


Answer: 3

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [18, 12, 19, 20, 17] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 49 tokens and keeps 3 chunks.


Answer: 2

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 32 tokens. Pack chunks [10, 15, 10, 11, 7] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 25 tokens and keeps 2 chunks.


Answer: 5

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 64 tokens. Pack chunks [14, 9, 8, 16, 13] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 60 tokens and keeps 5 chunks.


Answer: 2

Preserve order
No skipping in the middle

Add chunks until the next would exceed budget

Prompt: A context window has 32 tokens. Pack chunks [19, 7, 11, 19, 14] in order, skipping none except by stopping when the next chunk would overflow. How many chunks are kept?

Solution: Greedy prefix uses 26 tokens and keeps 2 chunks.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [2, 0, 1, 3]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@1, 2@0, 1@2, 3@3 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [3, 2, 0, 1]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@2, 2@1, 1@3, 3@0 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [0, 3, 1, 2]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@0, 2@3, 1@2, 3@1 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [2, 1, 0, 3]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@2, 2@0, 1@1, 3@3 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [1, 2, 3, 0]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@3, 2@1, 1@0, 3@2 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [1, 2, 0, 3]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@2, 2@1, 1@0, 3@3 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [1, 3, 2, 0]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@3, 2@2, 1@0, 3@1 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [2, 3, 0, 1]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@2, 2@0, 1@3, 3@1 → no.


Answer: yes

Prompt: Jobs 0,1,2,3 run in order [1, 0, 2, 3]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@1, 2@2, 1@0, 3@3 → yes.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [2, 1, 3, 0]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@3, 2@0, 1@1, 3@2 → no.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [3, 1, 2, 0]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@3, 2@2, 1@1, 3@0 → no.


Answer: yes

Prompt: Jobs 0,1,2,3 run in order [0, 1, 2, 3]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@0, 2@2, 1@1, 3@3 → yes.


Answer: no

Prompt: Jobs 0,1,2,3 run in order [2, 3, 1, 0]. Constraints: 0 before 2, and 1 before 3. Is the order valid? Answer yes or no.

Solution: Positions: 0@3, 2@0, 1@2, 3@1 → no.


Answer: 6

Prompt: SKUs have demand [2, 3, 3] and on-hand [2, 0, 0]. Total units short (unmet demand)?

Solution: shortfall = sum(max(0, demand-stock)) = 6.


Answer: 4

Prompt: SKUs have demand [4, 4, 2] and on-hand [1, 3, 4]. Total units short (unmet demand)?

Solution: shortfall = sum(max(0, demand-stock)) = 4.


Answer: 0

Prompt: SKUs have demand [2, 5, 5] and on-hand [6, 5, 6]. Total units short (unmet demand)?

Solution: shortfall = sum(max(0, demand-stock)) = 0.


Answer: 4

Prompt: SKUs have demand [3, 1, 4] and on-hand [6, 5, 0]. Total units short (unmet demand)?


Answer: 6

Prompt: SKUs have demand [4, 1, 4] and on-hand [0, 6, 2]. Total units short (unmet demand)?


Answer: 2

Prompt: SKUs have demand [5, 4, 5] and on-hand [3, 5, 5]. Total units short (unmet demand)?

Solution: shortfall = sum(max(0, demand-stock)) = 2.


Answer: 4

Prompt: SKUs have demand [4, 3, 1] and on-hand [3, 0, 2]. Total units short (unmet demand)?


Answer: 2

Prompt: SKUs have demand [2, 5, 4] and on-hand [6, 5, 2]. Total units short (unmet demand)?


Answer: 1

Prompt: SKUs have demand [1, 4, 1] and on-hand [1, 3, 4]. Total units short (unmet demand)?

Solution: shortfall = sum(max(0, demand-stock)) = 1.


Answer: 1

Prompt: SKUs have demand [4, 5, 1] and on-hand [3, 6, 2]. Total units short (unmet demand)?


Answer: 4

Prompt: SKUs have demand [3, 2, 3] and on-hand [6, 1, 0]. Total units short (unmet demand)?


Answer: 1

Prompt: SKUs have demand [5, 1, 5] and on-hand [4, 1, 6]. Total units short (unmet demand)?


Answer: 6

Prompt: SKUs have demand [3, 3, 2] and on-hand [1, 0, 1]. Total units short (unmet demand)?


Answer: 1

Prompt: SKUs have demand [3, 2, 2] and on-hand [4, 1, 6]. Total units short (unmet demand)?


Answer: 0

Prompt: SKUs have demand [1, 2, 4] and on-hand [3, 6, 4]. Total units short (unmet demand)?


Answer: 1

Prompt: SKUs have demand [5, 4, 5] and on-hand [5, 5, 4]. Total units short (unmet demand)?


Answer: 0

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 1, 0, 1, 0, 1, 1, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=6; even parity bit=0.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 0, 1, 0, 1, 1, 1, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=5; even parity bit=1.


Answer: 0

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 1, 1, 0, 0, 1, 1, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=4; even parity bit=0.


Answer: 0

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 0, 1, 1, 0, 0, 1, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=4; even parity bit=0.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 0, 0, 0, 0, 1, 1, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=3; even parity bit=1.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 1, 1, 1, 1, 1, 0, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=7; even parity bit=1.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 1, 0, 1, 1, 1, 0, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=5; even parity bit=1.


Answer: 0

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 0, 1, 1, 1, 0, 0, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=4; even parity bit=0.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 1, 0, 0, 1, 1, 0, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=5; even parity bit=1.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 0, 0, 1, 1, 0, 0, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=3; even parity bit=1.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 0, 1, 0, 0, 1, 0, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=3; even parity bit=1.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 0, 0, 0, 1, 0, 1, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=3; even parity bit=1.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 1, 1, 1, 0, 0, 1, 1] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=5; even parity bit=1.


Answer: 0

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 1, 1, 1, 1, 1, 1, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=6; even parity bit=0.


Answer: 1

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [0, 0, 1, 0, 1, 1, 0, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=3; even parity bit=1.


Answer: 0

Even parity over the eight data bits plus the appended bit

Prompt: Eight bits [1, 0, 0, 1, 1, 0, 1, 0] are sent with even parity. What parity bit should be appended (0 or 1) so the nine-bit string has even parity?

Solution: Sum=4; even parity bit=0.


Answer: 5

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: You need inclusive integers from 3 through 7. In Python, what is list(range(3, 8)) length?

Solution: range(start, stop) excludes stop; 3,4,5,6,7 → 5 values.


Answer: no

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: Two naive datetime values differ by 3600 seconds locally. Does that prove they are one UTC hour apart? Answer yes or no.

Solution: Naive datetimes have no zone; DST and offset make local deltas unreliable as UTC.


Answer: no

CPython / common SQL / git unless stated

inspired_by=stackoverflow topic=json vs eval

Identify the common pitfall
Answer the yes/no or count

Prompt: Should untrusted text be turned into a Python object with eval? yes or no.

Solution: eval executes code. Use json.loads for JSON payloads.


Answer: no

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: Is binary float a safe ledger type for USD cents? yes or no.

Solution: Use integer cents or decimal. Decimal/float rounding is not cash-safe.


Answer: no

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: A dict key is a list. After insertion you mutate the list. Is lookup by the new list guaranteed? yes or no.

Solution: Mutable keys are invalid; lists are unhashable. If a custom mutable key were used, mutation would break the table.


Answer: no

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: Two Python threads each run a tight CPU loop of bytecode. Will they typically use two cores at full speed under CPython's GIL? yes or no.

Solution: CPython's GIL usually serializes bytecode execution on one core.


Answer: no

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: In SQL, does `NULL = NULL` evaluate to TRUE? yes or no.

Solution: NULL comparisons yield UNKNOWN; use IS NULL.


Answer: no

CPython / common SQL / git unless stated

Identify the common pitfall
Answer the yes/no or count

Prompt: You checkout a raw commit SHA. Are new commits still on a named branch? yes or no.

Solution: Detached HEAD: commits are not on a branch until you create/move one.