Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
print (int(input()//3)

Fixed submission:
print (int(input())//3)
Buggy python submission (verdict: Time Limit Exceeded):
#前計算
#素数のリスト作成
N = 10 ** 5 + 10
def primes(n):
    import math
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(math.sqrt(n)) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_lst = primes(N)
# print (prime_lst, len(prime_lst))
count_lst = [0] * (N + 1)

def check(n):
    if n%2 == 0:
        return False
    if not n  in prime_lst:
        return False
    if not ((n + 1)//2) in prime_lst:
        return False
    return True


for i in range(3, N + 1):
    if check(i):
        count_lst[i] = count_lst[i - 1] + 1
    else:
        count_lst[i] = count_lst[i - 1]

# print (count_lst)

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print (count_lst[r] - count_lst[l - 1])

Fixed submission:
#前計算
#素数のリスト作成
N = 10 ** 5 + 10
def primes(n):
    import math
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(math.sqrt(n)) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

prime_lst = primes(N)
# print (prime_lst, len(prime_lst))
count_lst = [0] * (N + 1)

def check(n):
    if n%2 == 0:
        return False
    if not n  in prime_lst:
        return False
    if not ((n + 1)//2) in prime_lst:
        return False
    return True


for i in range(3, N + 1):
    if check(i):
        count_lst[i] = count_lst[i - 1] + 1
    else:
        count_lst[i] = count_lst[i - 1]

# print (count_lst)

Q = int(input())
for _ in range(Q):
    l, r = map(int, input().split())
    print (count_lst[r] - count_lst[l - 1])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

count = [0] * N

for i in range(N):
    count[i] = A.count(i+1)

count.sort(reverse = True)

ans = 0
for j in range(K):
    ans += count[j]
    
print (N-ans)

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

dic = dict()
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] =1
dic_sort = sorted(dic.items(), key = lambda x: x[1])

ans = 0
for i in range(len(dic_sort)-K):
    ans += dic_sort[i][1]

print (ans)


# print (dic_sort)

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

count = [0] * N

for i in range(N):
    count[i] = A.count(i+1)

count.sort(reverse = True)

ans = 0
for j in range(K):
    ans += count[j]
    
print (N-ans)

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

dic = dict()
for i in A:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] =1
dic_sort = sorted(dic.items(), key = lambda x: x[1])

ans = 0
for i in range(len(dic_sort)-K):
    ans += dic_sort[i][1]

print (ans)


# print (dic_sort)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, C = map(int, input().split())

# 入力
lst = [[0] * (10 ** 5 + 10) for _ in range(C + 1)]

for _ in range(N):
    s, t, c = map(int, input().split())
    lst[c][s] += 1
    lst[c][t + 1] -= 1

#番組ごとに毎分必要かどうかを判断する
for i in range(1, C + 1):
    for j in range(1, 10 ** 5 + 10): #いもす法で計算
        lst[i][j] += lst[i][j - 1]
    for j in range(1, 10 ** 5 + 10): #重なっている時 = 連続して使う時
        lst[i][j] = min(1, lst[i][j])

for j in range(1, 10 ** 5 + 10):
    for i in range(1, C + 1):
        lst[i][j] += lst[i - 1][j]

print (max(lst[-1]))


Fixed submission:
N, A, B = map(int, input().split())
print (min(N * A, B))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

count = 0
for i in range(N):
    j = 0
    flag1 = True
    while flag1:
        if A[i] < B[j]:
            flag2 = True
            k = 0
            while flag2:
                if B[j] < C[k]:
                    count += 1
                    k += 1
                else: 
                    flag2 = False
                if k == N:
                    flag2 = False
            j += 1
        else:
            flag1 = False
        if j == N:
            flag1 = False



print (count)

Fixed submission:

from bisect import bisect_left, bisect_right
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()


ans = 0
#Bの中の数iに対して、Aの中でiより小さい数の個数と、Cの中でiより大きい数の個数の積を探索
for i in B:
    ans += bisect_right(A, i-0.1) * (N-bisect_left(C, i+0.1))
print (ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort(reverse = True)
B.sort(reverse = True)
C.sort(reverse = True)

count = 0
for i in range(N):
    j = 0
    flag1 = True
    while flag1:
        if A[i] < B[j]:
            flag2 = True
            k = 0
            while flag2:
                if B[j] < C[k]:
                    count += 1
                    k += 1
                else: 
                    flag2 = False
                if k == N:
                    flag2 = False
            j += 1
        else:
            flag1 = False
        if j == N:
            flag1 = False



print (count)

Fixed submission:

from bisect import bisect_left, bisect_right
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort()
C.sort()


ans = 0
#Bの中の数iに対して、Aの中でiより小さい数の個数と、Cの中でiより大きい数の個数の積を探索
for i in B:
    ans += bisect_right(A, i-0.1) * (N-bisect_left(C, i+0.1))
print (ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

N = int(input())
T = [0] + list(map(int, input().split()))
V = [0] + list(map(int, input().split()))

max_speed_from_left = [0] * (N + 1)
max_speed_from_right = [0] * (N + 1)

for i in range(1, N):
    start = max_speed_from_left[i - 1]
    max_speed_from_left[i] = min(start + T[i], V[i], V[i + 1])

for i in range(N - 1, 0, -1):
    start = max_speed_from_right[i + 1]
    max_speed_from_right[i] = min(start + T[i + 1], V[i], V[i + 1])

speed = [min(x, y) for x, y in zip(max_speed_from_left, max_speed_from_right)]

def dist(left_speed, right_speed, t, v):
    x = (v - left_speed) + (v - right_speed)
    if x >= t:
        v = (left_speed + right_speed) / 2
        x = t
    d = (left_speed + v) * (v - left_speed) / 2
    d += v * (t - x)
    d += (right_speed + v) * (v - right_speed) / 2
    return d

ans = 0
for i in range(1, N + 1):
    ans += dist(speed[i - 1], speed[i], T[i], V[i])

print (ans)

Fixed submission:
R = int(input())
G = int(input())
print (2 * G - R)
Buggy python submission (verdict: Runtime Error):
N = int(input())
t = [0] + list(map(int, input().split()))
v = [0] + list(map(int, input().split()))
max_speed_from_left = [0] * (N + 1) #index i = t[i] とt[i + 1]の間
max_speed_from_right = [0] * (N + 1) #index i = t[i] とt[i + 1]の間

for i in range(1, N):
    start = max_speed_from_left[i - 1]
    max_speed_from_left[i] = min(start + t[i], v[i], v[i + 1])

for i in range(N - 1, 0, -1):
    start = max_speed_from_right[i + 1]
    max_speed_from_right = min(start + t[i + 1], v[i], v[i + 1])

speed = [min(x, y) for x, y in zip(max_speed_from_left, max_speed_from_right)]

def dist(left_speed, right_speed, t, v):
    x = (v - left_speed) + (v - right_speed)
    if x >= t:
        v = (left_speed + right_speed + t)/2
        x = t
    #最高速度vに到達してt-x余る
    d = (left_speed + v) * (v - left_speed)/2
    d += v * (t - x)
    d += (right_speed + v) * (v - right_speed)/2
    return d

ans = 0
for i in range(1, N + 1):
    ans += dist(speed[i -1], speed[i], t[i], v[i])
print (ans)

     



Fixed submission:
N = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

# if N == 1: #最初の1区間だけ
#     if t[0] % 2 == 1: #奇数秒
#         if t[0]/2 < v[0]:
#             print ((t[0]/2) ** 2)
#             exit()
        

# print ('t', t)
# print ('v', v)
N_INF = - 10 ** 15
DP = [[N_INF] * (102) for _ in range(100 * 200 + 2)] #DP[T][V] := 時刻Tに速度Dで走っているときの時刻Tまでの走行距離の最大値
DP[0][0] = 0
# print (DP[0][0:5])
time = 1
for i in range(N):
    # print (i)
    # print ('time', time)
    for j in range(time, time + t[i]): #時刻
        # print (j, end = ' ')
        for k in range(0, v[i] + 1): #速度
            if k == 0: #速度0-->加速して速度0になることはない
                # print (j, k)
                # print (max(DP[j - 1][0], DP[j - 1][1] +  1/2))
                DP[j][k] = max(DP[j - 1][0] + 0.25, DP[j - 1][1] + 1/2)
            elif k != v[i]: #加速してくるときも減速してくることもある
                DP[j][k] = max(DP[j - 1][k -1] + k - 1/2, DP[j - 1][k] + k + 0.25, DP[j - 1][k + 1] + k + 1/2)
            else: #(k == v[i] and j != time) #減速してくることはない
                DP[j][k] = max(DP[j - 1][k -1] + k - 1/2, DP[j - 1][k] + k)
        # print (DP[j][0:5])
    time += t[i]
# print (time)
print (DP[time - 1][0])
# print ('T = 6, V = 6', DP[6][6])
# print ('T = 12, V = 2', DP[12][2])
# print ('T = 12, V = 3', DP[12][3])
# print ('T = 13, V = 2', DP[13][2])
# print ('T = 26 V = 2', DP[26][2])
# print ('T = 27 V = 2', DP[27][2])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

N = int(input())
D = list(map(int, input()))
M = int(input())
T = list(map(int, input().split()))

dic = defaultdict(int)
for d in D:
    dic[d] += 1

for t in T:
    if dic[t]:
        dic[t] -= 1
    else:
        print ('No')
        exit()

print ('Yes')


Fixed submission:
from collections import defaultdict

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

dic = defaultdict(int)
for d in D:
    dic[d] += 1

for t in T:
    if dic[t]:
        dic[t] -= 1
    else:
        print ('NO')
        exit()

print ('YES')
Buggy python submission (verdict: Time Limit Exceeded):
#Pythonだと少し間に合わない
N = int(input())

for h in range(3500, 0, -1):
    for n in range(3500, 0, -1):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()


Fixed submission:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()

Buggy python submission (verdict: Time Limit Exceeded):
#Pythonだと少し間に合わない
N = int(input())

x = (3500 * N + (4 * 2500 - 2 * N) - 1) //(4 * 2500 - 2 * N)
for h in range(1, x + 2):
    for n in range(3500, 0, -1):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()


Fixed submission:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()

Buggy python submission (verdict: Time Limit Exceeded):
#Pythonだと少し間に合わない
N = int(input())

x = (3500 * N + (4 * 2500 - 2 * N) - 1) //(4 * 2500 - 2 * N)
for h in range(1, x + 2):
    for n in range(1, 3501):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()


Fixed submission:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()


Fixed submission:
N = int(input())

for h in range(1, 3501):
    for n in range(1, 3501):
        if (N * h * n) >= (4 * h * n - N * (h + n)) > 0:
            if (N * h * n) % (4 * h * n - N * (h + n)) == 0:
                w = (N * h * n) // (4 * h * n - N * (h + n))
                print (h, n, w)
                exit()
Buggy python submission (verdict: Runtime Error):
import sys
A, B, C, D, E, F = map(int, input().split())


def concentration(water, suger):
    if water * E/100 < suger or water + suger == 0:
        return 0
    return (100 * suger/(water + suger))

lst_w = []
limit_w = (F+A*100-1)//(A*100)
for i in range(limit_w):
    for j in range(limit_w):
        if 100 * (A * i + B * j) <= F:
            lst_w += [100 * (A * i + B * j)]

lst_s = []
limit_s = (F+C-1)//C
for i in range(limit_s):
    for j in range(limit_s):
        if C* i + D * j <= F:
            lst_s += [C * i + D * j]

# print (lst_w)
# print (lst_s)
set_w = set(lst_w)
set_s = set(lst_s)

# print (set_w)
# print (set_s)

ans = 0
ans_total = 0
ans_suger = 0
for water in set_w:
    for suger in set_s:
        if water + suger <= F:
            a = concentration(water, suger)
            if ans < a:
                ans = a
                ans_total = water + suger
                ans_suger = suger
            if ans == 50:
                print (ans_total, ans_suger)
                sys.exit()

if ans = 0:
    print (set_w[1], 0)
else:
    print (ans_total, ans_suger)

# print (ans)


Fixed submission:
N = int(input())
A = int(input())
print (N * N -A)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 9)
    MOD = 10 ** 9 + 7

    from itertools import permutations

    N, M, r = map(int, input().split())
    R = list(map(int, input().split()))

    INF = 10 ** 9

    G = [[INF] * (N + 1) for _ in range(N + 1)]
    for i in range(N + 1):
        G[i][i] = 0

    for _ in range(M):
        A, B, C = map(int, input().split())
        G[A][B] = C
        G[B][A] = C

    for k in range(N + 1):
        for i in range(N + 1):
            for j in range(N + 1):
                G[i][j] = min(G[i][j], G[i][k] + G[k][j])

    ans = INF
    for tmp in permutations(R):
        score = 0
        for i in range(r - 1):
            score += G[tmp[i]][tmp[i + 1]]
        ans = min(ans, score)

    print (ans)

if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations

N, M, R = map(int, input().split())
r = list(input().split())
edge = np.array([input().split() for _ in range(M)], dtype = np.int64).T
graph = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))

lst = floyd_warshall(graph, directed = False)
# print (lst)
def calc(path):
    cost = 0
    s = int(path[0]) - 1
    for i in range(1, R):
        g = int(path[i]) - 1
        cost += lst[s, g]
        s = g
    return cost

ans = 10 ** 18
for tmp in permutations(r):
    # print (tmp)
    ans = min(ans, calc(tmp))

print (int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

from itertools import permutations

N, M, r = map(int, input().split())
R = list(map(int, input().split()))

INF = 10 ** 9

G = [[INF] * (N + 1) for _ in range(N + 1)]
for i in range(N + 1):
    G[i][i] = 0

for _ in range(M):
    A, B, C = map(int, input().split())
    G[A][B] = C
    G[B][A] = C

for k in range(N + 1):
    for i in range(N + 1):
        for j in range(N + 1):
            G[i][j] = min(G[i][j], G[i][k] + G[k][j])

ans = INF
for tmp in permutations(R):
    score = 0
    for i in range(r - 1):
        score += G[tmp[i]][tmp[i + 1]]
    ans = min(ans, score)

print (ans)


Fixed submission:
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall
from itertools import permutations

N, M, R = map(int, input().split())
r = list(input().split())
edge = np.array([input().split() for _ in range(M)], dtype = np.int64).T
graph = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))

lst = floyd_warshall(graph, directed = False)
# print (lst)
def calc(path):
    cost = 0
    s = int(path[0]) - 1
    for i in range(1, R):
        g = int(path[i]) - 1
        cost += lst[s, g]
        s = g
    return cost

ans = 10 ** 18
for tmp in permutations(r):
    # print (tmp)
    ans = min(ans, calc(tmp))

print (int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

a = list(map(int, input().split())) 

a.sort()

#print (a)

a = a + [-2]
ans = 0
for i in range(N):
    count = 0
    j = 0
    while a[i] <= a[i+j] and a[i+j] <= a[i] + 2:
        count += 1
        j += 1
    ans = max(ans, count)

print (ans)





Fixed submission:
N = int(input())

a = list(map(int, input().split())) 

a.sort()

#print (a)

a = [-2] + a + [-8]

lst = []
count = 1
for i in range(1,N+2):
    if a[i] == a[i-1]:
        count += 1
    else:
        lst += [[a[i-1], count]]
        count = 1

# print (lst)

ans = 0
lst += [[-10,0], [-20,0]]
# print (lst)
for i in range(0, len(lst)-2):
    count = lst[i][1]
    if lst[i][0] + 1 == lst[i+1][0]:
        count += lst[i+1][1]
        if lst[i][0] +2 == lst[i+2][0]:
            count += lst[i+2][1]
    ans = max(ans, count)

print (ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

a = list(map(int, input().split())) 

a.sort()

#print (a)

a = a + [-2]
ans = 0
for i in range(N):
    count = 0
    j = 0
    while a[i] <= a[i+j] and a[i+j] <= a[i] + 2:
        count += 1
        j += 1
    ans = max(ans, count)

print (ans)





Fixed submission:
N = int(input())

a = list(map(int, input().split())) 

a.sort()

#print (a)

a = [-2] + a + [-8]

lst = []
count = 1
for i in range(1,N+2):
    if a[i] == a[i-1]:
        count += 1
    else:
        lst += [[a[i-1], count]]
        count = 1

# print (lst)

ans = 0
lst += [[-10,0], [-20,0]]
# print (lst)
for i in range(0, len(lst)-2):
    count = lst[i][1]
    if lst[i][0] + 1 == lst[i+1][0]:
        count += lst[i+1][1]
        if lst[i][0] +2 == lst[i+2][0]:
            count += lst[i+2][1]
    ans = max(ans, count)

print (ans)
Buggy python submission (verdict: Runtime Error):
X, A, B = map(int, input().split())

if min(abs(X - A) < abs(X - B)):
    print ('A')
else:
    print ('B')

Fixed submission:
x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
  print ('A')
else:
  print ('B')
Buggy python submission (verdict: Runtime Error):
S = list(input())
s = set(S)
S = list(s)
S.sort()
if len(S) == 26:
    print (None)
else:
    tmp = 0
    for i in 'abcdefghijklmnopqrstuvwxyz':
        if i == S[tmp]:
            tmp += 1
        else:
            print (i)
            break
    


Fixed submission:
S = list(input())
s = set(S)
S = list(s)
S.sort()
if len(S) == 26:
    print (None)
else:
    tmp = 0
    for i in 'abcdefghijklmnopqrstuvwxyz':
        if tmp >= len(S):
            print (i)
            break
        if i == S[tmp]:
            tmp += 1
        else:
            print (i)
            break
Buggy python submission (verdict: Runtime Error):
from collections import gcd

N = int(input())

t = int(input())
ans = t
for _ in range(N - 1):
    tmp = int(input())
    t = gcd(ans, tmp)
    ans *= tmp
    ans //= t

print (ans)

Fixed submission:
N = int(input())

def gcd(x, y):
    if x > y:
        x, y = y, x
    if y % x == 0:
        return x
    else:
        return gcd (y%x, x)


T1 = int(input())
ans = T1
for i in range(N-1):
    T2 = int(input())
    ans = T1 * T2 //gcd(T1, T2)
    T1 = ans

print (ans)

# print (gcd(12, 8))

Buggy python submission (verdict: Runtime Error):
from math import gcd

N = int(input())

t = int(input())
ans = t
for _ in range(N - 1):
    tmp = int(input())
    t = gcd(ans, tmp)
    ans *= tmp
    ans //= t

print (ans)

Fixed submission:
N = int(input())

def gcd(x, y):
    if x > y:
        x, y = y, x
    if y % x == 0:
        return x
    else:
        return gcd (y%x, x)


T1 = int(input())
ans = T1
for i in range(N-1):
    T2 = int(input())
    ans = T1 * T2 //gcd(T1, T2)
    T1 = ans

print (ans)

# print (gcd(12, 8))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
# from math import gcd

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

M = max(A)

g = A[0]
for a in A:
    g = gcd(g, a)

if K <= M and K % g == 0:
    print ('POSSIBLE')
else:
    print ('IMPOSSIBLE')

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

def gcd(x, y):
    if x > y:
        x, y = y, x
    if y % x == 0:
        return x
    y = y % x
    return gcd(x, y)

n = A[0]
for i in A:
    n = gcd(n, i)

flag = False
for i in A:
    if i >= K and (i - K) % n == 0:
        flag = True
        break
    else:
        pass

if flag:
    print ('POSSIBLE')
else:
    print ('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
from math import gcd

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

M = max(A)

g = A[0]
for a in A:
    g = gcd(g, a)

if K <= M and K % g == 0:
    print ('POSSIBLE')
else:
    print ('IMPOSSIBLE')

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

def gcd(x, y):
    if x > y:
        x, y = y, x
    if y % x == 0:
        return x
    y = y % x
    return gcd(x, y)

n = A[0]
for i in A:
    n = gcd(n, i)

flag = False
for i in A:
    if i >= K and (i - K) % n == 0:
        flag = True
        break
    else:
        pass

if flag:
    print ('POSSIBLE')
else:
    print ('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
s = list(input())
N = len(s)
if N == 1:
    print (0)
    exit()

    ans = 99
for i in range(1, N): #残す文字数
    tmp = 0 #残す文字以外の最大連続数
    count = 0 #残す文字以外が何文字続いているかをカウント
    for j in range(i):
        if s[j] == s[i]:
            tmp = max(tmp, count)
            count = 0
        else:
            count += 1
    tmp = max(tmp, count)
    ans = min(ans, max(tmp, N - i - 1))

print (ans)

Fixed submission:
s = list(input())
N = len(s)
if N == 1:
    print (0)
    exit()

ans = 99
for i in range(1, N): #残す文字数
    tmp = 0 #残す文字以外の最大連続数
    count = 0 #残す文字以外が何文字続いているかをカウント
    for j in range(i):
        if s[j] == s[i]:
            tmp = max(tmp, count)
            count = 0
        else:
            count += 1
    tmp = max(tmp, count)
    ans = min(ans, max(tmp, N - i - 1))

print (ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

a = list(map(int, input().split()))

lst = [0] * 9

for i in range(N):
    lst[min(a[i]//400, 8)] += 1

count = lst[:8].count(0)

kind_max = min(8-count+lst[8])
kind_min = max(8-count,1)

print (kind_min, kind_max)

Fixed submission:
N = int(input())

a = list(map(int, input().split()))

lst = [0] * 9

for i in range(N):
    lst[min(a[i]//400, 8)] += 1

count = lst[:8].count(0)

kind_max = min(8-count+lst[8], 100)
kind_min = max(8-count,1)

print (kind_min, kind_max)