Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
line = [int(i) for i in input().split()]


#sum
#count : 組み合わせの個数
#tmp : L番目の要素で始まる組み合わせの個数

count = 0

for L in range(N-1):
  sum = line[L]
  count_tmp = 1
  #ビットが被るまで右端を伸ばす。かぶったら終了
  for r in range(L+1,N):
    sum_tmp = sum+line[r]
    if sum_tmp == sum ^ line[r]:
      sum = sum_tmp
      count_tmp += 1
    else:
      break
  count += count_tmp

#L=N, r=Nの分を１つ追加する
print(count+1)

Fixed submission:
N = int(input())
line = [int(i) for i in input().split()]


#sum
#count : 組み合わせの個数
#tmp : L番目の要素で始まる組み合わせの個数

count = 0
sum = line[0]
r = 1
count_tmp = 1

for L in range(N-1):
  #ビットが被るまで右端を伸ばす。かぶったら終了
  for r in range(r,N):
    sum_tmp = sum+line[r]
    if sum_tmp == sum ^ line[r]:
      sum = sum_tmp
      count_tmp += 1
      if r == N-1:
        r += 1
    else:
      break
  count += count_tmp
  count_tmp -= 1
  sum -= line[L]

#L=N, r=Nの分を１つ追加する
print(count+1)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())

list = []
for i in range(len(s)):
  for j in range(i+1,len(s)+1):
    tmp = s[i:j]
    if not tmp in list:
      list.append(tmp)
    list.sort()
    if len(list)>K:
      list = list[:K]

print(list[K-1])

Fixed submission:
s = input()
K = int(input())

list = []
for i in range(len(s)):
  for j in range(i+1,len(s)+1):
    tmp = s[i:j]
    if len(list)>=K:
      if tmp>list[-1]:
        break
      else:
        if not tmp in list:
          list.append(tmp)
          list.sort()
          list = list[:K]
    else:
      if not tmp in list:
        list.append(tmp)
        list.sort()
        if len(list)>K:
          list = list[:K]

print(list[K-1])
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

import sys

n, k = [int(x) for x in input().split()]
ss = [int(x) for x in input()]

zero_array = []
one_array = []
curr_num = ss[0]
flag = 0

if curr_num == 0:
    zero_array.append(0)
else:
    one_array.append(0)
    flag = 1

for i in ss:
    if curr_num == i:
        if i == 0:
            zero_array[-1] += 1
        else:
            one_array[-1] += 1
    else:
        curr_num = i
        if i == 0:
            zero_array.append(1)
        else:
            one_array.append(1)

if k >= len(zero_array):
    print(sum(zero_array) + sum(one_array))
    sys.exit()
else:
    t = 0
    tmp = sum(zero_array[t: t+k]) + sum(one_array[t: t+k+flag])
    max_count = tmp
    while t + k + flag <= len(one_array):
        if t+k+flag < len(one_array):
            tmp += zero_array[t+k] - zero_array[t] + one_array[t+k+flag] - one_array[t+flag-1]
        else:
            tmp += zero_array[t + k] - zero_array[t] - one_array[t + flag - 1]
        if tmp > max_count:
            max_count = tmp
            # print(t, max_count)
        t += 1

    print(max_count)
# print(zero_array)
# print(one_array)

Fixed submission:
# coding: utf-8

import sys

n, k = [int(x) for x in input().split()]
ss = [int(x) for x in input()]

zero_array = []
one_array = []
curr_num = ss[0]
flag = 0

if curr_num == 0:
    zero_array.append(0)
else:
    one_array.append(0)
    flag = 1

for i in ss:
    if curr_num == i:
        if i == 0:
            zero_array[-1] += 1
        else:
            one_array[-1] += 1
    else:
        curr_num = i
        if i == 0:
            zero_array.append(1)
        else:
            one_array.append(1)

# print("zero_array", zero_array)
# print("one_array", one_array)
# print("flag", flag)

if k >= len(zero_array):
    print(sum(zero_array) + sum(one_array))
    sys.exit()
else:
    t = 0
    tmp = sum(zero_array[t: t+k]) + sum(one_array[t: t+k+flag])
    max_count = tmp
    # print("outer_tmp", tmp)
    # print()
    while t + k + flag <= len(one_array) and t + k < len(zero_array):
        # print("t", t)
        tmp += zero_array[t+k] - zero_array[t]
        if t+k+flag < len(one_array):
            tmp += one_array[t+k+flag]
            if not (t == 0 and flag == 0):
                if t == 0:
                    pass
                    # print("yeh")
                tmp -= one_array[t+flag-1]
        elif not (t == 0 and flag == 0):
            tmp -= one_array[t+flag-1]
        # print("tmp", tmp)
        if tmp > max_count:
            max_count = tmp
            # print(t, max_count)
        t += 1

    print(max_count)
# print(zero_array)
# print(one_array)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n, m = [int(x) for x in input().split()]
xx = []
yy = []
zz = []

for _ in range(n):
    x, y, z = [int(x) for x in input().split()]
    xx.append(x)
    yy.append(y)
    zz.append(z)

result_points = []

for k in range(8):
    max_point = 0
    selected_indexes = []
    for i in range(m):
        max_plus_point = 0
        max_index = 0
        for j in range(n):
            if j in selected_indexes:
                continue
            plus_point = 0
            if k % 2 == 1:
                plus_point += xx[j]
            else:
                plus_point -= xx[j]
            if (k // 2) % 2 == 1:
                plus_point += yy[j]
            else:
                plus_point -= yy[j]
            if (k // 4) % 2 == 1:
                plus_point += zz[j]
            else:
                plus_point -= zz[j]
            if plus_point > max_plus_point:
                max_index = j
                max_plus_point = plus_point
        max_point += max_plus_point
        selected_indexes.append(max_index)
    result_points.append(max_point)

print(max(result_points))


Fixed submission:
# coding: utf-8

n, m = [int(x) for x in input().split()]
xx = []
yy = []
zz = []

for _ in range(n):
    x, y, z = [int(x) for x in input().split()]
    xx.append(x)
    yy.append(y)
    zz.append(z)

result_points = []

results = []

for i in range(8):
    results.append([])
    for j in range(n):
        plus_point = 0
        if i % 2 == 1:
            plus_point += xx[j]
        else:
            plus_point -= xx[j]
        if (i // 2) % 2 == 1:
            plus_point += yy[j]
        else:
            plus_point -= yy[j]
        if (i // 4) % 2 == 1:
            plus_point += zz[j]
        else:
            plus_point -= zz[j]
        results[i].append(plus_point)
    results[i].sort()
    results[i].reverse()

result_points = []

for i in range(8):
    result_points.append(sum(results[i][0:m]))

print(max(result_points))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n = int(input())
s = list(input())

for (i, x) in enumerate(s):
    if x == "E":
        s[i] = 1
    elif x == "W":
        s[i] = 0

min_changed_num = sum(s[1:n])

for i in range(1, n):
    left = i - sum(s[0:i])
    right = sum(s[i:n])
    changed_num = left + right
    if min_changed_num > changed_num:
        min_changed_num = changed_num

print(min_changed_num)


Fixed submission:
# coding: utf-8

n = int(input())
s = list(input())

for (i, x) in enumerate(s):
    if x == "E":
        s[i] = 1
    elif x == "W":
        s[i] = 0

left = 0
right = sum(s[1:n])
center = s[0]
min_changed_num = right

for i in range(1, n):
    left = left + (1 - center)
    center = s[i]
    right = right - center
    changed_num = left + right
    if min_changed_num > changed_num:
        min_changed_num = changed_num

print(min_changed_num)
Buggy python submission (verdict: Runtime Error):
n, m = [int(i) for i in input().split()]
p = [0 for i in range(m)]
y = [0 for i in range(m)]

out = [[0, 0] for i in range(m)]
hash = [[] for i in range(10**5)]
for i in range(m):
    p[i], y[i] = [int(i) for i in input().split()]
    hash[p[i]].append([y[i], i])

for i in range(len(hash)):
    hash[i] = sorted(hash[i])
    for j in range(len(hash[i])):
        out[hash[i][j][1]] = i, j+1
for i in range(len(out)):
    print("{}{}".format(str(out[i][0]).zfill(6), str(out[i][1]).zfill(6)))

Fixed submission:
n, m = [int(i) for i in input().split()]
p = [0 for i in range(m)]
y = [0 for i in range(m)]

out = [[0, 0] for i in range(m)]
hash = [[] for i in range(10**5+10)]
for i in range(m):
    p[i], y[i] = [int(i) for i in input().split()]
    hash[p[i]].append([y[i], i])

for i in range(len(hash)):
    hash[i] = sorted(hash[i])
    for j in range(len(hash[i])):
        out[hash[i][j][1]] = i, j+1
for i in range(len(out)):
    print("{}{}".format(str(out[i][0]).zfill(6), str(out[i][1]).zfill(6)))
Buggy python submission (verdict: Runtime Error):
n = input()
for i in range(n):
  if n[i] == "1":
    n[i] = "9"
  else:
    n[i] = "1"
print(n)

Fixed submission:
n = str(input())
lis = ""
for i in range(len(n)):
    if n[i] == "1":
        lis += "9"
    else:
        lis += "1"
print(lis)
Buggy python submission (verdict: Runtime Error):
import math

n, k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

plus = [0]
minus = []
zeroExist = 0

for i in range(n):
    if x[i] > 0:
        plus.append(x[i])
    elif x[i] == 0:
        zeroExist = 1
    else:
        minus.append(-x[i])
minus.append(0)
minus = list(reversed(minus))

# for i in range(1, len(minus)):
# minus[i] += minus[i-1]

# print(plus)
# print(minus)

if zeroExist == 1:
    k -= 1

cost = math.inf
for i in range(k+1):
    if i < len(plus) and k - i < len(minus):
        #print(i)
        if i == 0 or i == k:
            cost = min(cost, plus[i] + minus[k - i])
        else:
            cost = min(cost, plus[i] + minus[k - i]
                       + min(plus[i], minus[k-i]))
        #print("{}:{}".format(i, cost))
print(cost)


Fixed submission:
n, k = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

plus = [0]
minus = []
zeroExist = 0

for i in range(n):
    if x[i] > 0:
        plus.append(x[i])
    elif x[i] == 0:
        zeroExist = 1
    else:
        minus.append(-x[i])
minus.append(0)
minus = list(reversed(minus))

if zeroExist == 1:
    k -= 1

cost = 10**9
for i in range(k + 1):
    if i < len(plus) and k - i < len(minus):
        # print("i:{} k-i:{}".format(i, k-i))
        if i == 0 or i == k:
            cost = min(cost, plus[i] + minus[k - i])
        else:
            cost = min(cost, plus[i] + minus[k - i]
                       + min(plus[i], minus[k - i]))
            # print("{}:{}".format(i, cost))
print(cost)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, q = [int(i) for i in input().split()]
m_list = [[0 for i in range(n+1)] for j in range(n+1)]
dynamic = [[0 for i in range(n+1)] for j in range(n+1)]

for i in range(m):
    l, r = [int(i) for i in input().split()]
    m_list[l][r] += 1

for i in range(1, n+1):
    for j in range(i, n+1):
        dynamic[i][j] = dynamic[i][j-1]
        for k in range(i, j+1):
            dynamic[i][j] += m_list[k][j]

for i in range(q):
    l, r = [int(i) for i in input().split()]
    print(dynamic[l][r])


Fixed submission:
n, m, q = [int(i) for i in input().split()]
imos = [[0 for r in range(n+1)] for l in range(n+1)]
for i in range(m):
    l, r = [int(i) - 1 for i in input().split()]
    imos[0][r] += 1
    imos[l+1][r] -= 1
#imos法
for l in range(n):
    for r in range(1, n):
        imos[l][r] += imos[l][r-1]
for r in range(n):
    for l in range(1, n):
        imos[l][r] += imos[l-1][r]
for i in range(q):
    l, r = [int(i) - 1 for i in input().split()]
    print(imos[l][r])
Buggy python submission (verdict: Runtime Error):
n = int(input())
nine = []
six = []
i = 0
for i in range(1, 100000):
    if 9 ** i < n:
        nine.append(9 ** i)
    else:
        break
for i in range(1, 100000):
    if 6 ** i < n:
        six.append(6 ** i)
    else:
        break

count = 0
last = n
while last >= 9:
    if nine:
        while nine[-1] > last:
            nine.pop()
    if six:
        while six[-1] > last:
            six.pop()

    if nine:
        tmp9 = nine[-1]
        num9 = int(last / tmp9)
    if six:
        tmp6 = six[-1]
        num6 = int(last / tmp6)

    if num9 < num6:
        count += num9
        last %= tmp9
        nine.pop()
    elif num9 == num6 and last % tmp9 <= last % tmp6:
        count += num9
        last %= tmp9
        nine.pop()
    else:
        count += num6
        last %= tmp6
        six.pop()


count += int(last / 6)
last %= 6
print(count + last)


Fixed submission:
n = int(input())
paySix = []
payNine = []
i = 0
while 6**i <= n:
   paySix.append(6**i)
   i += 1
i = 0
while 9**i <= n:
   payNine.append(9**i)
   i += 1

maxCount = n
sum = 0
for j in range(n+1):
    count = 0
    count6 = 0
    count9 = 0
    nine = j
    six = n - j
    for i in reversed(range(len(payNine))):
        count9 += int(nine/payNine[i])
        nine -= int(nine/payNine[i])*payNine[i]
    # print("\ndiv target:{} 9Count:{}".format(j, count9))
    for i in reversed(range(len(paySix))):
        count6 += int(six/paySix[i])
        six -= int(six/paySix[i])*paySix[i]
    # print("div target:{} 6Count:{}".format(n-j, count6))
    maxCount = min(maxCount, count9+count6)
print(maxCount)
"""
pay = [1]
i = 1
while 6**i <= n:
   pay.append(6**i)
   i += 1
i = 1
while 9**i <= n:
   pay.append(9**i)
print(i)
pay = sorted(pay)
print(len(pay))
count = 0
for i in reversed(range(len(pay))):
    # print(i)
    count += int(n/pay[i])
    n -= int(n/pay[i])*pay[i]
    if n == 0:
        print(count)
"""
""""
for i in range(1, 100000):
    if 9 ** i < n:
        nine.append(9 ** i)
    else:
        break
for i in range(1, 100000):
    if 6 ** i < n:
        six.append(6 ** i)
    else:
        break

count = 0
last = n
while last >= 9:
    if nine:
        while nine[-1] > last:
            nine.pop()
    if six:
        while six[-1] > last:
            six.pop()

    if nine:
        tmp9 = nine[-1]
        num9 = int(last / tmp9)
    if six:
        tmp6 = six[-1]
        num6 = int(last / tmp6)

    if num9 < num6:
        count += num9
        last %= tmp9
        nine.pop()
    elif num9 == num6 and last % tmp9 <= last % tmp6:
        count += num9
        last %= tmp9
        nine.pop()
    else:
        count += num6
        last %= tmp6
        six.pop()


count += int(last / 6)
last %= 6
print(count + last)
"""
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = input()
s = [0 for i in range(n)]

for i in range(n):
    if S[i] == "E":
        s[i] = 1
min = n

for i in range(n):
    count = 0
    for j in range(n):
        if i < j and s[j] == 1:
            count += 1
        elif i > j and s[j] == 0:
            count += 1
    if count < min:
        min = count
print(min)


Fixed submission:
n = int(input())
S = input()
s = [0 for i in range(n)]

for i in range(n):
    if S[i] == "E":
        s[i] = 1
min = n

count = 0
for j in range(n):
    i = 0
    if i < j and s[j] == 1:
        count += 1
    elif i > j and s[j] == 0:
        count += 1
if count < min:
    min = count

for i in range(1, n):
    if s[i-1] == 0:
        count += 1
    if s[i] == 1:
        count -= 1
    if count < min:
        min = count
print(min)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [0 for i in range(n)]
for i in range(n):
    p[i] = int(input())

visited = [0 for i in range(n)]
n_range = range(n)
for i in reversed(n_range):
    if visited[i] == 0:
        visited[i] = 1
        count = 1
        target = p[i] - 1
        for j in reversed(range(i)):
            if p[j] == target:
                count += 1
                visited[j] = count
                target -= 1
print(n - max(visited))


Fixed submission:
n = int(input())
p = [0 for i in range(n)]
for i in range(n):
    p[i] = int(input())

visited = [0 for i in range(n+1)]

"""
for i in reversed(range(n)):
    if visited[i] == 0:
        visited[i] = 1
        count = 1
        target = p[i] - 1

        for j in reversed(range(i)):
            if p[j] == target:
                count += 1
                visited[j] = count
                target -= 1
"""
for i in range(n):
    visited[p[i]] = visited[p[i] - 1] + 1
print(n - max(visited))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [0 for i in range(n)]
for i in range(n):
    p[i] = int(input())

visited = [0 for i in range(n)]

for i in reversed(range(n)):
    if visited[i] == 0:
        visited[i] = 1
        count = 1
        target = p[i] - 1
        for j in reversed(range(i)):
            if p[j] == target:
                count += 1
                visited[j] = count
                target -= 1
print(n - max(visited))


Fixed submission:
n = int(input())
p = [0 for i in range(n)]
for i in range(n):
    p[i] = int(input())

visited = [0 for i in range(n+1)]

"""
for i in reversed(range(n)):
    if visited[i] == 0:
        visited[i] = 1
        count = 1
        target = p[i] - 1

        for j in reversed(range(i)):
            if p[j] == target:
                count += 1
                visited[j] = count
                target -= 1
"""
for i in range(n):
    visited[p[i]] = visited[p[i] - 1] + 1
print(n - max(visited))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = [0 for i in range(n)]
for i in range(n):
    p[i] = int(input())

max_count = 1
for i in range(n):
    count = 1
    target = p[i] + 1
    for j in range(i + 1, n):
        if p[j] == target:
            count += 1
            target += 1
    if max_count<count:
        max_count=count
print(n-max_count)



Fixed submission:
n = int(input())
p = [0 for i in range(n)]
for i in range(n):
    p[i] = int(input())

visited = [0 for i in range(n+1)]

"""
for i in reversed(range(n)):
    if visited[i] == 0:
        visited[i] = 1
        count = 1
        target = p[i] - 1

        for j in reversed(range(i)):
            if p[j] == target:
                count += 1
                visited[j] = count
                target -= 1
"""
for i in range(n):
    visited[p[i]] = visited[p[i] - 1] + 1
print(n - max(visited))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = [int(i) for i in input().split()]
appear = [0 for i in range(b+1)]

for i in range(a, a+k):
    if i <= b:
        print(i)
    else:
        break
max = b+1-k
if b+1-k<a+k:
    max = a+k
for i in range(max, b+1):
    print(i)
        


Fixed submission:
a,b,k = [int(i) for i in input().split()]

if a+k-1<b-k+1:
    for i in range(a,a+k):
        print(i)
    for i in range(b+1-k, b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = [int(i) for i in input().split()]
appear = [0 for i in range(b+1)]
for i in range(a, a+k):
    if i <= b:
        appear[i] = 1
for i in range(b+1-k, b+1):
    if i >= a:
        appear[i] = 1
for i in range(len(appear)):
    if appear[i] == 1:
        print(i)


Fixed submission:
a,b,k = [int(i) for i in input().split()]

if a+k-1<b-k+1:
    for i in range(a,a+k):
        print(i)
    for i in range(b+1-k, b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n+10)]
visited = [-1 for _ in range(n+10)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b - 1, c])
    tree[b - 1].append([a - 1, c])
def depth(now, cost):
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            depth(tree[now][i][0], cost+tree[now][i][1])
    return
q, k = [int(i) for i in input().split()]
depth(k - 1, 0)
# print(visited)
for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])

Fixed submission:
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n+10)]
visited = [-1 for _ in range(n+10)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b - 1, c])
    tree[b - 1].append([a - 1, c])
q, k = [int(i) for i in input().split()]

stack = [[k-1, 0]]
while True:
    size = len(stack)
    if size == 0:
        break
    now, cost = stack.pop()
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            stack.append([tree[now][i][0],
                          cost+tree[now][i][1]])

for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])

Buggy python submission (verdict: Runtime Error):
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n)]
visited = [-1 for _ in range(n)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b-1, c])
    tree[b - 1].append([a - 1, c])
def depth(now, cost):
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            depth(tree[now][i][0], cost+tree[now][i][1])
    return
q, k = [int(i) for i in input().split()]
depth(k-1, 0)
# print(visited)
for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])

Fixed submission:
n = int(input())
# [[[ノード1, 距離3],[ノード3, 距離5]],[],...]
tree = [[] for _ in range(n+10)]
visited = [-1 for _ in range(n+10)]
# abc = [[0, 0, 0] for _ in range(n)]
for i in range(n-1):
    a, b, c = [int(j) for j in input().split()]
    tree[a - 1].append([b - 1, c])
    tree[b - 1].append([a - 1, c])
q, k = [int(i) for i in input().split()]

stack = [[k-1, 0]]
while True:
    size = len(stack)
    if size == 0:
        break
    now, cost = stack.pop()
    visited[now] = cost
    for i in range(len(tree[now])):
        if visited[tree[now][i][0]] == -1:
            stack.append([tree[now][i][0],
                          cost+tree[now][i][1]])

for _ in range(q):
    x, y = [int(i) - 1 for i in input().split()]
    print(visited[x] + visited[y])
Buggy python submission (verdict: Runtime Error):
# import math
import fractions
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
if n == 1:
    if a[0] == k:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
div = fractions.gcd(a[0], a[1])
for i in range(n):
    if a[i] == k:
        print("POSSIBLE")
        exit()
    elif i >= 2:
        div = fractions.gcd(a[i], a[i-1])
if k % div == 0 and k <= a[-1]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
"""
b = []
for i in range(len(a)):
    if a[i] == k:
        print("POSSIBLE")
        exit()
    elif a[i] > k:
      b.append(a[i] - k)
      del(a[i])
print(a)
print(b)
"""

Fixed submission:
# import math
# import fractions
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)

div = a[0]
for i in range(1, n):
    div = gcd(div, a[i])

if k % div == 0 and k <= a[-1]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
# import math
import fractions
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
div = fractions.gcd(a[0], a[1])
for i in range(2, n):
    div = fractions.gcd(a[i], a[i-1])
if k % div == 0 and k <= a[-1]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
"""
b = []
for i in range(len(a)):
    if a[i] == k:
        print("POSSIBLE")
        exit()
    elif a[i] > k:
      b.append(a[i] - k)
      del(a[i])
print(a)
print(b)
"""

Fixed submission:
# import math
# import fractions
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)

div = a[0]
for i in range(1, n):
    div = gcd(div, a[i])

if k % div == 0 and k <= a[-1]:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")