diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -17,9 +17,9 @@
     is_called = [False] * N
     ans = []
     que: list = []
+    minimum_index = -1
     while partitions:
         partition = partitions.pop()
-        minimum_index = -1
         for i in range(l + 1, partition + 1):
             heapq.heappush(que, A[i] * N + i)
             is_called[i] = True
