diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -13,12 +13,15 @@
 for k, i in enumerate(b):
     if i != 0:
         x = q[k] // i
+
         if x < bmax:
             bmax = x
+
 mi = 10**7
 if amax > bmax:
     ans = amax
     for i in range(amax + 1)[::-1]:
+        mi = 10**7
         for k, j in enumerate(a):
             if b[k] != 0:
                 y = q[k] - (i * j)
@@ -32,12 +35,15 @@
 else:
     ans = bmax
     for i in range(bmax + 1)[::-1]:
+        mi = 10**7
         for k, j in enumerate(b):
             if a[k] != 0:
                 y = q[k] - (i * j)
                 x = y // a[k]
+
             else:
                 x = 10**7
+
             if x < mi:
                 mi = x
 
