diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -16,6 +16,6 @@
     for j in range(n):
         if i == j == 0:
             continue
-        dp[i][j] = min(dp[i - 1][j - 1], dp[i - 1][j] + abs(asumm - i * one - j))
+        dp[i][j] = min(dp[i - 1][j - 1], dp[i - 1][j]) + abs(asumm - i * one - j)
 
 print(dp[n][s % n])
