Sample

MBJP/4

Human rating uses the original dataset scale.

DatasetMBJP
Human3
Lines28

Scores

MethodScoreScaleDataset rank
(0–100)
Posnett00–1; higher is more readable
37.5Δ 3.1
Scalabrino0.7320–1; higher is more readable
43.8Δ 3.1
Dorn0.6360–1; higher is more readable
50.0Δ 9.4
Mi0.4040–1; higher is more readable
6.2Δ 34.4
LLOC11Logical lines; fewer is more readable
37.5Δ 3.1
DeepSeek V4 Pro170–20; mean of three runs
65.6Δ 25.0
GPT-6.1 Sol180–20; mean of three runs
65.6Δ 25.0
BTTF0.4590–1; higher is more readable
31.2Δ 9.4
Human31–5; original rating
40.6

Views

Source code

import java.util.*; class HeapQueueLargest { /** * * Write a function to find the largest integers from a given list of numbers using heap queue algorithm. * * > heapQueueLargest([25, 35, 22, 85, 14, 65, 75, 22, 58], 3) * [85, 75, 65] * > heapQueueLargest([25, 35, 22, 85, 14, 65, 75, 22, 58], 2) * [85, 75] * > heapQueueLargest([25, 35, 22, 85, 14, 65, 75, 22, 58], 5) * [85, 75, 65, 58, 35] */ public static List<Integer> heapQueueLargest(List<Integer> nums, int n) { PriorityQueue<Integer> minHeap = new PriorityQueue<>(); for (Integer num : nums) { if (minHeap.size() < n) { minHeap.offer(num); } else if (num > minHeap.peek()) { minHeap.poll(); minHeap.offer(num); } } List<Integer> result = new ArrayList<>(minHeap); result.sort(Collections.reverseOrder()); return result; } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.674.04−22.243
Source linesThe number of non-empty source lines.28+11.2
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.4.513−6.769

Intercept 8.87 + feature contributions = -8.943 (log-odds).
Score = sigmoid(-8.943) = 0.

Score0.732

Feature contributions

FeatureValueContribution
(log-odds)
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.110.964−1.035
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.110.929+0.985
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.1+0.398
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.075+0.209
Indentation frequencyHow rapidly indentation changes from line to line.19−0.08
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.28+0.045
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.26.768−0.036

Intercept 0.07 + feature contributions = 0.556 (log-odds).
Score = sigmoid(0.556) = 0.636.

Score0.404
Score11
Run 1

The code is well-structured and readable. It uses a clear class and method name, a descriptive Javadoc with examples, and a straightforward heap-based approach. Nesting is minimal with only a single conditional inside a loop. Intent is clear: maintain a min-heap of the largest n elements and return them in descending order. Code length is appropriate and not overly verbose. Each loop iteration performs one logical action, though the conditional block does combine a poll and offer on separate lines, which is acceptable. Reading flow is natural, from input validation (implicit) to processing and sorting. Minor improvements could include handling edge cases like n <= 0 or n > nums.size(), and using a max-heap or collections reverse order directly in the priority queue for clarity. Overall, highly readable.

Run 2

The code is well-structured with a clear method, descriptive naming, and proper use of a priority queue to solve the problem efficiently. Nesting is minimal (one loop with a simple if-else), and intent is obvious from both the method name and the concise Javadoc with examples. The code length is appropriate, and lines generally perform one logical action, though the if-else inside the loop slightly compresses multiple actions. Reading flow is natural: build heap, convert to list, sort descending, return. Minor deductions: no validation for edge cases (n > list size), and variable names like 'n' could be more descriptive (e.g., 'k'). Overall, highly readable.

Run 3

The code is well-structured and readable. It uses a clear class and method name, includes meaningful Javadoc examples, and follows a straightforward heap-based approach to find the largest n elements. Nesting is minimal, with only one level inside the loop, and the logic is easy to follow. Each action is on its own line, aiding readability. The use of a min-heap is well-chosen, although the variable name 'minHeap' and the subsequent reverse sort may require a moment to understand. The method could be slightly shorter, but the clarity gained from explicit steps justifies the length. Overall, the code is concise, purposeful, and easy to read.

Run 1

Code Structure: A single, logically organized method separates heap construction from result sorting. Nesting: One loop with a shallow conditional keeps complexity easy to follow. Clarity of intent: Descriptive names such as minHeap and result, plus documented examples, clearly convey the purpose; n could be named more explicitly. Code length: The implementation is concise without unnecessary steps, although the documentation has a stray asterisk. Action granularity: Each statement performs one clear action on its own line. Reading flow: Execution progresses naturally from initialization through selection to descending output. Wildcard imports and the lack of explicit handling for nonpositive n slightly reduce clarity.

Run 2

Code Structure: The method is logically organized into heap initialization, selection, and result sorting. Nesting: A single loop with a shallow if/else-if branch keeps complexity easy to follow. Clarity of intent: The documentation and examples clearly establish the goal, and minHeap and result are descriptive; n could be named more explicitly, and a brief comment explaining why a min-heap retains the largest values would help. Code length: The implementation is concise without unnecessary steps. Action granularity: Each statement performs one clear action on its own line. Reading flow: Execution progresses naturally from input traversal to descending output. Minor readability weaknesses include the wildcard import and absence of an explicit guard clarifying behavior for nonpositive n.

Run 3

Code Structure: The method is logically organized into heap construction, iteration, result conversion, sorting, and return. Nesting: A single loop containing a simple if/else-if keeps nesting shallow. Clarity of intent: Descriptive method and variable names, documentation, and examples clearly communicate the goal; a brief explanation of why a min-heap retains the largest n values would improve clarity. Code length: The implementation is concise without sacrificing readability, although the documentation has a stray asterisk. Action granularity: Each statement performs one clear action on its own line. Reading flow: Execution proceeds naturally from collecting candidates to returning descending results. Minor weaknesses include the wildcard import and the absence of explicit handling for nonpositive n, which leaves the method's input assumptions unclear.