diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -13,7 +13,7 @@
 ans = -1
 for i, a in enumerate(A):
     for b, j in P:
-        if (i, j) in pat:
+        if (i, j) in ng_set:
             continue
         ans = max(ans, a + b)
         break
