Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from sys import stdout, stderr
def fprintf(fs, s, *argv):
    fs.write(s.format(*argv))

def printf(s, *argv):
    fprintf(stdout, s, *argv)

from math import *

def gets(type=int, sep=' '):
    return map(type, input().split(sep))

def _lcm(a,b):
    return a // gcd(a,b) * b

def num2(a):
    cnt = 0
    while(a % 2 == 0):
        cnt += 1
        a /= 2
    return cnt

def main():
    n,m = gets()
    a = gets()
    lcm = 1
    cnt2 = -1
    for ai in a:
        lcm = _lcm(lcm,ai)
        n2 = num2(ai)
        if (cnt2 != -1 and cnt2 != n2):
            printf('0\n');
            return
        cnt2 = n2

    fprintf(stderr, 'lcm: {}\n', lcm)

    lo, hi = -1, m+1
    while (lo+1 < hi):
        mid = (lo+hi)//2
        if ((mid*2+1) * lcm//2 <= m):
            lo = mid
        else:
            hi = mid

    printf('{}\n', hi)

main()


Fixed submission:
from math import *
from fractions import *
from sys import stdout, stderr, version_info
def fprintf(fs, s, *argv):
    fs.write(s.format(*argv))

def printf(s, *argv):
    fprintf(stdout, s, *argv)

if version_info[0] == 2:
    input = raw_input

def gets(type=int, sep=' '):
    return map(type, input().split(sep))

def _lcm(a,b):
    return a // gcd(a,b) * b

def num2(a):
    cnt = 0
    while(a % 2 == 0):
        cnt += 1
        a /= 2
    return cnt

def main():
    n,m = gets()
    a = gets()
    lcm = 1
    cnt2 = -1
    for ai in a:
        lcm = _lcm(lcm,ai)
        n2 = num2(ai)
        if (cnt2 != -1 and cnt2 != n2):
            printf('0\n');
            return
        cnt2 = n2

    fprintf(stderr, 'lcm: {}\n', lcm)

    lo, hi = -1, m+1
    while (lo+1 < hi):
        mid = (lo+hi)//2
        if ((mid*2+1) * lcm//2 <= m):
            lo = mid
        else:
            hi = mid

    printf('{}\n', hi)

main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
 
s_list = {}
cnt = 0
for i in range(N):
    candidate = input()
 
    # Check key
    if (candidate[0] in s_list) == False:
        tmp = {candidate[0]:[]}
        s_list.update(tmp)
 
    for s in s_list[candidate[0]]:
        if candidate == s:
            break
    else:
        cnt += 1
        s_list[candidate[0]].append(candidate)
 
print(cnt)

Fixed submission:
s_list = []
N = int(input())
for _ in range(N):
    s_list.append(input())

print(len(set(s_list)))

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

s_list = {}
cnt = 0
for i in range(N):
    candidate = input()

    # Check key
    if (candidate[0] in s_list) == False:
        tmp = {candidate[0]:[]}
        s_list.update(tmp)

    for s in s_list[candidate[0]]:
        if candidate == s:
            break
    else:
        cnt += 1
        s_list[candidate[0]].append(candidate)

print(cnt) 

Fixed submission:
s_list = []
N = int(input())
for _ in range(N):
    s_list.append(input())

print(len(set(s_list)))

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

s_list = []
cnt = 0
for i in range(N):
    candidate = input()
    for s in s_list:
        if candidate == s:
            break
    else:
       cnt += 1
       s_list.append(candidate)

print(cnt)

Fixed submission:
s_list = []
N = int(input())
for _ in range(N):
    s_list.append(input())

print(len(set(s_list)))
Buggy python submission (verdict: Runtime Error):
import numpy

def euclidean_algorithm(a, b):
    if a < b:
        tmp = b
        b = a
        a = tmp

    ｑ = a // b
    r = a % b
    while r != 0:
        a = b
        b = q
        q = a // b
        r = a % b
    
    return b


def main():
    a, b = map(int, input().split())

    # print(numpy.lcm(a, b)) # AtCoderでは使用不可

    #ユークリッド互除法(最大公約数)
    gcd = euclidean_algorithm(a, b)
 
    # 最小公倍数
    lcm = (a*b)//gcd
    print(lcm)


if __name__ == "__main__":
    main()

Fixed submission:
def euclidean_algorithm(a, b):
    if a < b:
        tmp = b
        b = a
        a = tmp

    ｑ = a // b
    r = a % b
    while r != 0:
        a = b
        b = r
        q = a // b
        r = a % b

    return b


def main():
    a, b = map(int, input().split())

    #ユークリッド互除法(最大公約数)
    gcd = euclidean_algorithm(a, b)

    # 最小公倍数
    lcm = (a*b)//gcd
    print(lcm)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
def euclidean_algorithm(a, b):
    if a < b:
        tmp = b
        b = a
        a = tmp

    ｑ = a // b
    r = a % b
    while r != 0:
        a = b
        b = q
        q = a // b
        r = a % b
    
    return b


def main():
    a, b = map(int, input().split())

    #ユークリッド互除法(最大公約数)
    gcd = euclidean_algorithm(a, b)
    print(2)

    # 最小公倍数
    lcm = (a*b)//gcd
    print(lcm)


if __name__ == "__main__":
    main()

Fixed submission:
def euclidean_algorithm(a, b):
    if a < b:
        tmp = b
        b = a
        a = tmp

    ｑ = a // b
    r = a % b
    while r != 0:
        a = b
        b = r
        q = a // b
        r = a % b

    return b


def main():
    a, b = map(int, input().split())

    #ユークリッド互除法(最大公約数)
    gcd = euclidean_algorithm(a, b)

    # 最小公倍数
    lcm = (a*b)//gcd
    print(lcm)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import numpy

def main():
    a, b = map(int, input().split())

    print(numpy.lcm(a, b))

if __name__ == "__main__":
    main()

Fixed submission:
def euclidean_algorithm(a, b):
    if a < b:
        tmp = b
        b = a
        a = tmp

    ｑ = a // b
    r = a % b
    while r != 0:
        a = b
        b = r
        q = a // b
        r = a % b

    return b


def main():
    a, b = map(int, input().split())

    #ユークリッド互除法(最大公約数)
    gcd = euclidean_algorithm(a, b)

    # 最小公倍数
    lcm = (a*b)//gcd
    print(lcm)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# encoding="UTF-8"

N = int(input())
S = []
for i in range(N):
    temp=input()
    if (temp in S) == False:
        S.append(temp)
print(len(S))

Fixed submission:
# encoding="UTF-8"

N = int(input())
S = set()
for i in range(N):
    S.add(input())

print(len(S))
Buggy python submission (verdict: Runtime Error):
n, a, b, c = (int(x) for x in input().split())
while n > 0 and b > 0:
    n -= c
    if n < 0:
        print("No")
        break
    b -= a
    if b < 0:
        print("Yes")
        break



Fixed submission:
n, a = (int(x) for x in input().split())
if n <= a:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
# coding: utf-8

s,k = [ input() for i in range(2) ]

count = 0
while s[count]=="1":
    count += 1

if int(k) <= count:
    print(1)
else:
    print(s[count])


Fixed submission:
# coding: utf-8

s,k = [ input() for i in range(2) ]

count = 0
while count != len(s) and s[count]=="1":
    count += 1

if int(k) <= count:
    print(1)
else:
    print(s[count])
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

n,m,q = list(map(int,input().split()))
M = [ list(map(int,input().split())) for i in range(m) ]
Q = [ list(map(int,input().split())) for i in range(q) ]

count = [0]*q

for i in range(q):
    for j in range(m):
        if Q[i][0] <= M[j][0] and M[j][1] <= Q[i][1]:
            count[i] += 1

for i in range(q):
    print(count[i])

Fixed submission:
# coding: utf-8

n,m,q = list(map(int,input().split()))
M = [ list(map(int,input().split())) for i in range(m) ]
Q = [ list(map(int,input().split())) for i in range(q) ]

LR = [[0]*(n+1) for _ in range(n+1)]

for m in M:
    LR[m[0]-1][m[1]] += 1 

for l in range(n,-1,-1):
    for r in range(0,n,1):
        LR[l-1][r+1] = LR[l-1][r+1] + LR[l-1][r] + LR[l][r+1] - LR[l][r]

for q in Q:
    print(LR[q[0]-1][q[1]])
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8

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

acc = [0]

for i in range(n):
    acc.append(acc[i]+a[i])    

count = 0
for i in range(n+1):
    for j in range(i):
        if (acc[i]- acc[j]) %m == 0:
            count += 1

print(count)

Fixed submission:
# coding: utf-8
#始点を定めて(n)終点を定めて(n)その間の数を足し合わせる(～n)と計算量オーダーはO(n^3)
#累積和を用いると、始点を定めて(n)終点を定めて(n)差をとればいいので計算量オーダーはO(n^2)
#以下のコードでは、Aのループ処理(n)において随時累積和のmod mを算出し、そのmod mが何回現れたかを示す辞書の検索、挿入を行う(1)ので、計算量オーダーはO(n)
#（辞書の検索計算量オーダーについていまいち理解できていない。本当にO(1)なのだろうか？）

n,m = list(map(int,input().split()))
A = list(map(int,input().split()))

modm = 0
#累積和を別のリストに格納する必要はなく、bという変数を1つ用意して、modmにその時点での累積和のmod mを格納すればよい
dic = {0:1}
#{x:y}:Aの各要素を順に処理していくとき、mod mがxである要素が現時点までにy個見つかっていることを表す

cnt = 0
for a in A:
    modm = (modm+a) %m
    cnt += dic.get(modm,0)
    dic[modm] = dic.get(modm,0) + 1
#c[b]では、bをキーとする要素が見つからなかった場合エラーが発生してしまう。
#c.get(b,default)なら、bをキーとする要素が見つからなかった場合デフォルト値を返してくれる。

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

n,l = list(map(int,input().split()))
D = []
C = [0]

for i in range(n):
    d,c = list(map(int,input().split()))
    D.append(d)
    C.append(C[i]+c)

#時計周りに歩く場合を考える
L = []
for i in range(n):
    L.append(C[i+1]-D[i])

#反時計周りに歩く場合を考える
R = []
for i in range(n):
    R.append(C[n]-C[n-i-1]-(l-D[-i-1]))

#時計周りに歩いた後、反時計周りに歩く場合を考える
LR = []
for i in range(n-1):
    LR.append(C[i+1]-D[i]*2+max(R[:n-i-1]))

#時計周りに歩いた後、反時計周りに歩く場合を考える
RL = []
for i in range(n-1):
    RL.append(C[n]-C[n-i-1]-(l-D[-i-1])*2+max(L[:n-i-1]))
    
#即退店する場合を考える
O = [0]

print(max(L+R+LR+RL+O))

Fixed submission:
# coding: utf-8

n,l = list(map(int,input().split()))
D = []
C = [0]

for i in range(n):
    d,c = list(map(int,input().split()))
    D.append(d)
    C.append(C[i]+c)

#時計周りに歩く場合を考える
L = [0]
for i in range(n):
    L.append(max(L[i],C[i+1]-D[i]))

#反時計周りに歩く場合を考える
R = [0]
for i in range(n):
    R.append(max(R[i],C[n]-C[n-i-1]-(l-D[-i-1])))

#時計周りに歩いた後、反時計周りに歩く場合を考える
LR = 0
for i in range(n-1):
    LR = max(LR, C[i+1]-D[i]*2+R[n-i-1])

# #時計周りに歩いた後、反時計周りに歩く場合を考える
RL = 0
for i in range(n-1):
    RL = max(RL, C[n]-C[n-i-1]-(l-D[-i-1])*2+L[n-i-1])

print(max(L+R+list([LR,RL])))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [int(x) for x in input().split()]
m = sorted((i for i in set(l) if l.count(i) > 1), reverse=True)
if len(m) > 0:
  x = m[0]
  if l.count(x) > 3:
    print(x*x)
  elif len(m) > 1:
    y = m[1]
    print(x*y)
  else:
    print(0)
else:
  print(0)

Fixed submission:
n = int(input())
l = sorted((int(x) for x in input().split()), reverse = True)
a = []
t = None
for x in l:
  if t == x:
    t = None
    a.append(x)
    if len(a) > 1:
      break
  else:
    t = x
print(a[0]*a[1] if len(a) > 1 else 0)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int(x) for x in input().split()]
x = max(i for i in set(l) if l.count(i)>1)
if l.count(x) > 3:
  print(x*x)
else:
  y = max(i for i in set(l)-{x} if l.count(i) > 1)
  print(y*x)

Fixed submission:
n = int(input())
l = sorted((int(x) for x in input().split()), reverse = True)
a = []
t = None
for x in l:
  if t == x:
    t = None
    a.append(x)
    if len(a) > 1:
      break
  else:
    t = x
print(a[0]*a[1] if len(a) > 1 else 0)
Buggy python submission (verdict: Runtime Error):
n=input()
n=str(n)
t='nd'
for i in n;
	if i=='7':
    	print('Yes')
      	t='d'
if t=='nd':print('No')        

Fixed submission:
n=input()
n=str(n)
t='nd'
for i in n:
    if i=='7':
        print('Yes')
        t='d'
        break
if t=='nd':print('No')

Buggy python submission (verdict: Runtime Error):
n=str(input())
t='nt'
for(i in range(n)):
  if(n[i]=='7'):
    print("Yes")
    t='tr'
if(t='nt'):
  print("No")

Fixed submission:
n=input()
n=str(n)
t='nd'
for i in n:
    if i=='7':
        print('Yes')
        t='d'
        break
if t=='nd':print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

if m > 0:
    aaa = [int(input()) for i in range(m)]
else:
    aaa = set()

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7
 
for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1]) % MOD
print(dp[n])

Fixed submission:
import sys
input = sys.stdin.readline
 
n, m = map(int, input().split())
s = set(map(int, [input() for _ in range(m)]))
MOD = 10 ** 9 + 7
a = 1 if not 0 in s else 0
b = 1 if not 1 in s else 0
for i in range(2, n + 1):
    if i in s:
        a, b = b, 0
    else:
        a, b = b, (a + b) % MOD
print(b)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

aaa = [int(input()) for i in range(m)]

dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7
 
for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1]) % MOD
print(dp[n])

Fixed submission:
import sys
input = sys.stdin.readline
 
n, m = map(int, input().split())
s = set(map(int, [input() for _ in range(m)]))
MOD = 10 ** 9 + 7
a = 1 if not 0 in s else 0
b = 1 if not 1 in s else 0
for i in range(2, n + 1):
    if i in s:
        a, b = b, 0
    else:
        a, b = b, (a + b) % MOD
print(b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

print(lst)

lst = sorted(lst, key=lambda x: (x[0], -int(x[1])))

for i in range(0, len(lst)):
    print(i[2])

Fixed submission:
n = int(input())
lst = [list(input().split())+[i+1] for i in range(n)]

# print(lst)

lst = sorted(lst, key=lambda x: (x[0], -int(x[1])))

for i in range(0, len(lst)):
    print(lst[i][2])
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
l_lst = list()
for i in range(m):
    l_lst.append(input().split())

for i in range(0, len(l_lst)):
    for j in range(0, len(l_lst[i])):
        l_lst[i][j] = int(l_lst[i][j])

temp_cnt = 0
cnt = 0
for i in range(1, n+1):
    # print(i)
    for j in range(0, len(l_lst)):
        if l_lst[j][0] <= i and i <= l_lst[j][1]:
            temp_cnt += 1
        if temp_cnt == len(l_lst):
            cnt += 1
            # temp_cnt = 0
    temp_cnt = 0

print(cnt)

Fixed submission:
n, m = map(int, input().split())
l_lst = list()
for i in range(m):
    l_lst.append(input().split())

for i in range(0, len(l_lst)):
    for j in range(0, len(l_lst[i])):
        l_lst[i][j] = int(l_lst[i][j])

max_lst = list()
min_lst = list()
for i in range(0, len(l_lst)):
    max_lst.append(l_lst[i][0])
    min_lst.append(l_lst[i][1])

max_int = max(max_lst)
min_int = min(min_lst)

cnt = 0
for i in range(1, n+1):
    if max_int <= i and i <= min_int:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
s = input()
slt = list(s)

mojiretu = ["A", "C", "G", "T"]

cntlt = list()
cnt = 0
for i in range(0, len(slt)):
    if slt[i] in mojiretu:
        cnt += 1
    else:
        cntlt.append(cnt)
        cnt = 0

print(max(cntlt))

Fixed submission:
s = input()
slt = list(s)

mojiretu = ["A", "C", "G", "T"]

cntlt = list()
cnt = 0
for i in range(0, len(slt)):
    if slt[i] in mojiretu:
        cnt += 1
    else:
        cntlt.append(cnt)
        cnt = 0
else:
    cntlt.append(cnt)

print(max(cntlt))
Buggy python submission (verdict: Runtime Error):
import math
from decimal import *

a,b,c=map(Decimal,input().split())

A=math.sqrt(a)
B=math.sqrt(b)
C=math.sqrt(c)


if   A+B<C:
    print("Yes")
else :
    print("No")



Fixed submission:
N=int(input())

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[N-1])

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

a,b,c=map(Decimal,input().split())

A=math.sqrt(a)
B=math.sqrt(b)
C=math.sqrt(c)


if   A+B<C:
    print("Yes")
else :
    print("No")

Fixed submission:
N=int(input())

list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(list[N-1])
Buggy python submission (verdict: Runtime Error):
N=input()

if N%2==0 :
    print(N/2)
else :
    print(N//2+1)

Fixed submission:

N=int(input())

if N%2==0 :
    print(N//2)
else :
    print(N//2+1)
Buggy python submission (verdict: Time Limit Exceeded):
N=input()
A=list(map(int,input().split()))


for a in A:
    if A.count(a)>1:
        print('NO')
        break
else :
    print('YES')

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

if len(A)==len(set(A)):
        print('YES')
else :
    print('NO')
Buggy python submission (verdict: Runtime Error):

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

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

  if sum(A)>=H:
    print("Yes")
    else:
      print('No')

Fixed submission:
H,N=map(int,input().split())

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

if sum(A)>=H:
    print("Yes")
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())

A=list(map(int,input().split()))
A.sort(reverse=True)

for _ in range(K):
    A.pop(0)


print(sum(A))

Fixed submission:
from collections import deque

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

A=list(map(int,input().split()))
A.sort(reverse=True)
A=A[K:]

print(sum(A))
Buggy python submission (verdict: Runtime Error):
l=list(int(input()) for _ in range(5))
s=list(10-i%10 for i in l)
for i in range(s.count(10)):
  s.remove(10)
s.remove(max(s))
print(sum(l)+sum(s))

Fixed submission:
l=list(int(input()) for _ in range(5))
s=list(10-i%10 for i in l)
for i in range(s.count(10)):
  s.remove(10)
if len(s)>0:
  s.remove(max(s))
print(sum(l)+sum(s))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
l=[]
for i in range(min([a,b])+1,1,-1):
  if a%i==0 and b%i==0:
    l.append(i)
print(l[k-1])

Fixed submission:
a,b,k=map(int,input().split())
l=[]
for i in range(min([a,b])+1,0,-1):
  if a%i==0 and b%i==0:
    l.append(i)
print(l[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
ans=[]
if len(Counter(l).values()) == 1:
  ans.append(len(f))
elif len(Counter(f).values()) == len(Counter(s).values()) == 1:
  ans.append(0)
else:
  for fk,fv in Counter(f).items():
    fdk=fk
    a=sum(Counter(f).values())-fv
    for sk,sv in Counter(s).items():
      if fk != sk:
        ans.append(a+sum(Counter(s).values())-sv)
print(min(ans))

Fixed submission:
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
fn=sorted(Counter(f).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
sn=sorted(Counter(s).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
if fn[0][0]!=sn[0][0]:
  ans=n-fn[0][1]-sn[0][1]
else:
  ans=n-max(fn[1][1]+sn[0][1],fn[0][1]+sn[1][1])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
ans=[]
if len(Counter(l).values()) == 1:
  ans.append(len(f))
elif len(Counter(f).values()) == len(Counter(s).values()) == 1:
  ans.append(0)
else:
  for fk,fv in sorted(Counter(f).items(),key=lambda x:x[0]):
    fdk=fk
    a=sum(Counter(f).values())-fv
    for sk,sv in sorted(Counter(s).items(),key=lambda x:x[0]):
      if fk != sk:
        ans.append(a+sum(Counter(s).values())-sv)
print(min(ans))

Fixed submission:
from collections import Counter
n=int(input())
l=list(map(int,input().split()))
f=l[0::2]
s=l[1::2]
fn=sorted(Counter(f).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
sn=sorted(Counter(s).items(),key=lambda x:x[1],reverse=True) + [(0, 0)]
if fn[0][0]!=sn[0][0]:
  ans=n-fn[0][1]-sn[0][1]
else:
  ans=n-max(fn[1][1]+sn[0][1],fn[0][1]+sn[1][1])
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
n,x=map(int,input().split())
l=[int(i) for i in input().split()]
print(reduce(gcd,[abs(i-x) for i in l]))

Fixed submission:
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
n,x=map(int,input().split())
l=[int(i) for i in input().split()]
print(gcd_list([abs(i-x) for i in l]))

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
n,x=map(int,input().split())
l=[int(i) for i in input().split()]
print(reduce(math.gcd,[abs(i-x) for i in l]))


Fixed submission:
import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
n,x=map(int,input().split())
l=[int(i) for i in input().split()]
print(gcd_list([abs(i-x) for i in l]))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
i=1
while True:
  if i%2==0 and i%n==0:
    break
  i+=1
print(i)

Fixed submission:
n=int(input())
if n%2==0:
  print(n)
else:
  print(2*n)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0:
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else:
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]
print(c)


Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
g=1
while k+(k-1)*(g-1)< n:
  g+=1
print(g)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0: # count == 0
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else: # count >= 2
      #print(l[k-1::-1])
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]
print(c)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
g=1
while k+(k-1)*(g-1)< n:
  g+=1
print(g)

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
l=[int(i) for i in input().split()]
c=0
mn=min(l)
while len(l)>=1:
  if mn==min(l):
    m=l.index(min(l))
    if m==0:
      l=l[m+1:]
    elif m+l[k-1::-1].index(min(l))==len(l):
      c+=m//(k-1)
      if m%(k-1)!=0:
        c+=1
      l=l[m+1:]
    else:
      c+=1
      l=l[k:]
  else:
    c+=len(l)//(k-1)
    if len(l)%(k-1)!=0:
      c+=1
    l=[]

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
g=1
while k+(k-1)*(g-1)< n:
  g+=1
print(g)
Buggy python submission (verdict: Time Limit Exceeded):
loopCnt = int(input())

strList = []
for i in range(loopCnt):
    inputStr = input()

    if not inputStr in strList:
        strList.append(inputStr)

print(str(len(strList)))

Fixed submission:
loopCnt = int(input())

strList = []
for i in range(loopCnt):
    inputStr = input()
    strList.append(inputStr)

setList = set(strList)

print(str(len(setList)))
Buggy python submission (verdict: Runtime Error):
if b == "A":
  print("G")
elif b == "G":
  print("A")
elif b == "C":
  print("T")
else:
  print("C")

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
else:
  print("G")

Buggy python submission (verdict: Runtime Error):
if b = A:
  print("G")
elif b = G:
  print("A")
elif b = C:
  print("T")
else:
  print("C")

Fixed submission:
b = input()
if b == "A":
  print("T")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
else:
  print("G")
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

sorted(h)

for i in range(k):
  h.pop()
  
print(sum(h))

Fixed submission:
n,k = map(int, input().split())
h = list(map(int, input().split()))

hh = sorted(h)

for i in range(k):
  if(len(hh) == 0):
    break
  hh.pop()
  
print(sum(hh))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
h = list(map(int,input().split()))

ans = sum(h)

for i in range(k):
  ans -= max(h)
  h.pop(h.index(max(h)))

print(ans)

Fixed submission:
n,k = map(int, input().split())
h = list(map(int, input().split()))

hh = sorted(h)

for i in range(k):
  if(len(hh) == 0):
    break
  hh.pop()
  
print(sum(hh))