Buggy python submission (verdict: Runtime Error):
X, Y, Z = list(map(int, input().split(" ")))

import numpy as np

ABC = []

for i in range(X+Y+Z):
    ABC.append(list(map(int, input().split(" "))))

ABC = sorted(ABC, key=lambda row: row[0]-row[1])    

ans = 0

ABC_bk = ABC_np[:Y]
ABC_ak = ABC_np[Y:]

for k in range(Y, Y+Z):
    
    ABC_bk = ABC_bk + ABC_ak[0]
    ABC_ak = ABC_ak.pop(0)
    
    
    before_k = np.asarray(sorted(ABC_bk.tolist(), key=lambda row: row[1]-row[2]))
    after_k = np.asarray(sorted(ABC_ak.tolist(), key=lambda row: row[0]-row[2]) )      
    
    bk_sum = before_k[-Y:].sum(axis=0)[1] + before_k[:-Y].sum(axis=0)[2]
    ak_sum = after_k[-X:].sum(axis=0)[0] + after_k[:-X].sum(axis=0)[2]
    
    tmp = ak_sum + bk_sum
                          
    if ans < tmp:
        ans = tmp
    
print (ans)

Fixed submission:
N, K = list(map(int, input().split(" ")))

A = list(map(int, input().split(" ")))

ans = False

A = sorted(A)

key = 99999999999999
    
if A[-1] < K:
    ans = False

else:
    for i in range(2, A[0]+1):
        key_flag = True
        for a in A:
            if a % i !=0:
                key_flag = False
                break
                
        if key_flag == True:
            key = i
            break

    if key_flag == False:
        ans = True
#         print(1)
    elif K % key == 0:
        ans = True
#         print(2)
    else:
#         print(3)
        ans = False           
    
if ans == True:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N, K = list(map(int, input().split(" ")))

A = list(map(int, input().split(" ")))

ans = False

cnt = 0
prev_len = 0
prepre_len = 0

while(1):
    if K in A:
        ans = True
        break
        
    
     
    if cnt == 0:
        for i in range(len(A)-1):
            for j in range(i+1, len(A)):
                tmp = abs(A[i] - A[j])
#                 print(tmp)
                if tmp not in A:
                    A.append(tmp)
                    
    else :
        for i in range(len(A)-1):
            for j in range(prepre_len, len(A)):
                tmp = abs(A[i] - A[j])
#                 print(tmp)
                if tmp not in A:
                    A.append(tmp)
                    
    if len(A) == prev_len:
        ans = False
        break
                    
#     print(A)
    
    prepre_len = prev_len
    prev_len = len(A)
    cnt += 1
    
    
if ans == True:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Fixed submission:
N, K = list(map(int, input().split(" ")))

A = list(map(int, input().split(" ")))

ans = False

A = sorted(A)

key = 99999999999999
    
if A[-1] < K:
    ans = False

else:
    for i in range(2, A[0]+1):
        key_flag = True
        for a in A:
            if a % i !=0:
                key_flag = False
                break
                
        if key_flag == True:
            key = i
            break

    if key_flag == False:
        ans = True
#         print(1)
    elif K % key == 0:
        ans = True
#         print(2)
    else:
#         print(3)
        ans = False           
    
if ans == True:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")