GoalScope — triples_sum_to_zero (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def triples_sum_to_zero(l: list):↵
"""Find all unique triplets in the list which gives the sum of zero."""↵
l.sort()↵
result = []↵
for i in range(len(l) - 2):↵
if i > 0 and l[i] == l[i - 1]:↵
continue↵
left, right = i + 1, len(l) - 1↵
while left < right:↵
total = l[i] + l[left] + l[right]↵
if total == 0:↵
result.append([l[i], l[left], l[right]])↵
while left < right and l[left] == l[left + 1]:↵
left += 1↵
while left < right and l[right] == l[right - 1]:↵
right -= 1↵
left += 1↵
right -= 1↵
elif total < 0:↵
left += 1↵
else:↵
right -= 1↵
return result↵
</code>