Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03494 (python)

Fixed submission:
import numpy as np

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

ans = 0
while(all(A%2==0)):
    A = A/2
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(int,input().split())

ans = 0
for n in range(N+1):
    temp = n
    sum = 0
    while (temp>=1):
            sum += temp%10
            temp = int(temp/10)

    if A <= sum <= B:
        ans += n

print(ans)
Problem p03633 (python)

Fixed submission:
n=int(input())
T=[]
for _ in range(n):
    t = int(input())
    T.append(t)

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

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

ans = T[0]
for i in range(1,n):
    ans=lcm(ans, T[i])

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
T=[]
for _ in range(n):
    t = int(input())
    T.append(t)

def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

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

for i in range(n-1):
    ans=lcm(T[i], T[i+1])

print(ans)
Problem p03777 (python)

Fixed submission:
a,b=input().split()
if (a=="H" and b=="H") or (a=="D" and b=="D"):
    print("H")
else:
    print("D")

Buggy submission (verdict: Runtime Error):
a,b=input().split()
if (a=="H" and b=="H") or (a=="D" and b=="D"):
  print(H)
  else:
    print(D)
Problem p02724 (python)

Fixed submission:
# coding: utf-8
# Your code here!
I =int(input())


# if I ==0:
#     print(I)
    
if I>=500:
    J=I//500
    
    K=J*500*2#
    
    
    P=I-500*J
    if P==0:
        print(K)
    
    if P>=5:
        Q=P//5
        R=Q*5#
        
        A=K+R
        print(A)

if I<500:
        M=I//5
        A=M*5#
        
        
        print(A)

Buggy submission (verdict: Runtime Error):
# Your code here!
I =int(input())


if I>=500:
    J=I//500
    
    K=J*500*2#
    
    
    P=I-500*J
    
    if P>=5:
        Q=P//5
        R=Q*5#
        
        A=K+R
print(A)
Problem p02687 (python)

Fixed submission:
S=input()
Ans="ARC"
if S=="ARC":
  Ans="ABC"
print(Ans)

Buggy submission (verdict: Runtime Error):
S=input()
Ans="ARC"
if S=="ARC":
  Ans="ABC
print(Ans)
Problem p03220 (python)

Fixed submission:
def main():
    N = int(input())
    TA = list(map(int, input().split()))
    T, A = TA[0], TA[1]
    H = list(map(int, input().split()))

    temp1 = abs(A - (T - H[0] * 0.006))
    pos = 0

    for i in range(1, N):
        temp2 = abs(A - (T - H[i] * 0.006))
        if temp1 > temp2:
            temp1 = temp2
            pos = i
    print(pos+1)

if __name__  == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    TA = list(map(int, input().split()))
    T, A = TA[0], TA[1]
    H = list(map(int, input().split()))
    arr = []
    ondo = 0
    for i in range(N):
        ondo = int(T - H[i] * 0.006)
        arr.append([ondo, i+1])
    for j in range(1, N):
        res1 = A - arr[j-1][0]
        res2 = A - arr[j][0]
        if res1 < res2:
            ans = arr[j-i][1]
        else:
            ans = arr[j][1]
    print(ans)
main(
Problem p02719 (python)

Fixed submission:
N, K =map(int,input().split())
r = N % K
print(min(r,abs(r-K)))

Buggy submission (verdict: Runtime Error):
N, K =map(int,input().split())
r = N % K
print(min(r,abs(r-k)))
Problem p02747 (python)

Fixed submission:
S = input()
if S == "hi" or S == "hihi" or S == "hihihi" or S == "hihihihi" or S == "hihihihihi":
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = input()
if S == hi or S == hihi or S == hihihi or S == hihihihi or S == hihihihihi:
    print("Yes")
else:
    print("No")
Problem p03943 (python)

Fixed submission:
a,b,c = map(int,input().split())

big = max(a,b,c)
total = a + b + c
if total == big*2:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())

big = max(a,b,c)
total = a + b + c
if total = big*2:
    print("Yes")
else:
    print("No")
Problem p03963 (python)

Fixed submission:
N, K = map(int,input().split())
cnt = K*(K-1)**(N-1)
print(cnt)

Buggy submission (verdict: Runtime Error):
N, K = map(int,input())
cnt = K*(K-1)**(N-1)
print(cnt)
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().split())
li = [list(map(int, input().split())) for i in range(m)]
 
a=li[0][0]
b=li[0][1]
for i in range(m-1):
  if li[i+1][0]>a:
    a=li[i+1][0]
  if li[i+1][1]<b:
    b=li[i+1][1]
 
if b<a:
  print(int(0))
  exit()
  
if b-a+1<n:
  print(b-a+1)
else:
  print(n)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
li = [list(map(int, input().split())) for i in range(m)]

a=li[0][0]
b=li[0][1]
for i in range(m-1):
  if li[i+1][0]>a:
    a=li[i+1][0]
  if li[i+1][1]<b:
    b=li[i+1][1]

if b<a:
  print(int(0))
  break
  
if b-a+1<n:
  print(b-a+1)
else:
  print(n)
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
li = list(map(int,input().split()))

listT=[0]*n
for i in range(n):
  listT[i]=t-0.006*li[i]
#print(listT)
min=abs(listT[0]-a)
#print(listT[0]-a)
#print(min)
ans=1
for i in range(n):
  if min>abs(a-listT[i]):
    min=abs(a-listT[i])
    ans=i+1

print(ans)

Buggy submission (verdict: Runtime Error):
t,a=map(int,input().split())
li = list(map(int,input().split()))

listT=[0]*n
for i in range(n):
  listT[i]=t-0.006*li[i]
#print(listT)
min=abs(listT[0]-a)
#print(listT[0]-a)
#print(min)
ans=1
for i in range(n):
  if min>abs(a-listT[i]):
    min=abs(listT[i])
    ans=i+1

print(ans)
Problem p03633 (python)

Fixed submission:
a=int(input())
li = [int(input()) for i in range(a)]
li.sort()

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


def lcm(x,y):
  return x*y//gcd(x,y)

ans=li[0]
for i in range(a-1):
  if ans<=li[i+1]:
    ans=lcm(ans,li[i+1])
  else:
    ans=lcm(li[i+1],ans)

print(int(ans))

Buggy submission (verdict: Runtime Error):
a=int(input())
li = [int(input()) for i in range(a)]
li.sort()

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


def lcm(x,y):
  return x*y/gcd(x,y)

ans=li[0]
for i in range(a-1):
  if ans<=li[i+1]:
    ans=lcm(ans,li[i+1])
  else:
    ans=lcm(li[i+1],ans)

print(int(ans))

Buggy submission (verdict: Runtime Error):
a=int(input())
li = [int(input()) for i in range(a)]
li.sort()

def gcm(x,y):
  #x<=y
  if x==y:
    return x
  else:
    if y%x==0:
      return x
    else:
      return gcm(y%x,x)


def lcm(x,y):
  return x*y/gcm(x,y)

ans=li[0]
for i in range(a-1):
  ans=lcm(ans,li[i+1])

print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a,b): #a<=b
  if b%a==0:
    return a
  else:
    c=b%a
    return gcd(c,a)

x=gcd(8,12)

n=int(input())
li = [int(input()) for i in range(n)]
li.sort()

a=gcd(li[0],li[1])
b=li[0]*li[1]/a

for i in range(n-2):
  a=gcd(li[i+2],b)
  b=li[i+2]*b/a

b=int(b)

print(b)

Buggy submission (verdict: Runtime Error):
def gcd(a,b): #a<=b
  if b%a==0:
    return a
  else:
    c=b%a
    return gcd(c,a)

x=gcd(8,12)

n=int(input())
li = [int(input()) for i in range(n)]
li.sort()

a=gcd(li[0],li[1])
b=li[0]*li[1]/a
c=a

for i in range(n-2):
  a=gcd(li[i+2],a)
  b=li[i+2]*c/a
  c=a

b=int(b)

print(b)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
li = [int(input()) for i in range(n)]
li.sort()

a=math.gcd(li[0],li[1])
b=li[0]*li[1]/a
c=a

for i in range(n-2):
  a=math.gcd(li[i+2],a)
  b=li[i+2]*c/a
  c=a

b=int(b)

print(b)
Problem p03471 (python)

Fixed submission:
n, y = map(int,input().split())
y = y / 1000
f = 0
for i in range(n+1):
    for j in range(n-i+1):
        #print(i)
        if 10 * i + 5 * j + 1 * (n - i - j) == y:
            print(i)
            print(j)
            print(n - i - j)
            f = 1
            break
    if f == 1:
        break
if f != 1:
    print(-1)
    print(-1)
    print(-1)

Buggy submission (verdict: Runtime Error):
n, y = map(int,input().split())
y = y / 1000
for i in range(n+1):
    for j in range(n-i+1):
        if 10 * i + 5 * j + 1 * (n - i - j) == y:
            print(i)
            print(j)
            print(n - i - j)
            exit(1)
print(-1)
print(-1)
print(-1)

Buggy submission (verdict: Runtime Error):
n, y = map(int,input().split())
for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + 1000 * (n - i - j) == y:
            print(i)
            print(j)
            print(n - i - j)
            exit(1)
print(-1)
print(-1)
print(-1)
Problem p02995 (python)

Fixed submission:
import fractions

def div(a,b,c):
    val=b//c-(a-1)//c
    return val

A,B,C,D=map(int,input().split())
numC=div(A,B,C)
numD=div(A,B,D)
lcm=int(C*D/(fractions.gcd(C,D)))
numCD=div(A,B,lcm)
ans=B-A+1-numC-numD+numCD
print(ans)

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D=map(int,input().split())
num=B-A
numC=num//C
numD=num//D
numCD=int(num//(C*D/math.gcd(C,D)))
ans=num-numC-numD+numCD
print(ans)
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
L=[int(a) for a in input().split()]

d=0
cnt=0
for i in range(N+1):
    if d>X:
        break
    elif i==N:
        cnt+=1
    else:
        d+=L[i]#next
        cnt+=1
   
print(cnt)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=[int(a) for a in input().split()]

temp=0
cnt=0
for i in range(N+1):
    if temp>X:
        break
    else:
        temp+=L[i]
        cnt+=1
   
print(cnt)
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())

if x==0 or y==0:
    print(w*h/2,'0')
elif w/x==2 and h/y==2:
    print(w*h/2,'1')
else:
    print(w*h/2,'0')

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())

if w/x==2 and h/y==2:
    print(w*h/2,'1')
else:
    print(w*h/2,'0')
Problem p03006 (python)

Fixed submission:
N=int(input())
x=['']*N
y=['']*N
dic={(0,0):0}
for i in range(N):
    x[i],y[i]=map(int,input().split())

for i in range(N):
    for j in range(N):
        if i==j:
            continue
        else:
            p=y[j]-y[i]
            q=x[j]-x[i]
            if (p,q) in dic.keys():
                dic[(p,q)] += 1
            else:
                dic[(p,q)] = 1

print(N-max(dic.values()))

Buggy submission (verdict: Runtime Error):
N=int(input())
x=['']*N
y=['']*N
dic={}
for i in range(N):
    x[i],y[i]=map(int,input().split())

for i in range(N):
    for j in range(N):
        if i==j:
            pass
        else:
            p=y[j]-y[i]
            q=x[j]-x[i]
            if (p,q) in dic.keys():
                dic[(p,q)] += 1
            else:
                dic[(p,q)] = 1

print(N-max(dic.values()))
Problem p03029 (python)

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

print((3*A+P)//2)

Buggy submission (verdict: Runtime Error):
A,P=map(int,input().split())

print((3A+P)//2)
Problem p02993 (python)

Fixed submission:
S=int(input())
a=int(S/1000)
b=int((S-a*1000)/100)
c=int((S-a*1000-b*100)/10)
d=int(S-a*1000-b*100-c*10)
if a==b or b==c or c==d:
    print('Bad')
else:
    print('Good')

Buggy submission (verdict: Runtime Error):
N, L=map(int, input().split())
if L>0:
    A=(N-1)*L+N*(N-1)/2
elif N+L<=0:
    A=(N-1)*L+(N-1)*(N-2)/2
else:
    A=(L*2+N-1)*N/2
print(int(A))
Problem p03280 (python)

Fixed submission:
A, B=map(int, input().split())
S=(A-1)*(B-1)
print(S)

Buggy submission (verdict: Runtime Error):
A, B=map(int, input().split()
S=(A-1)*(B-1)
print(S)
Problem p02716 (python)

Fixed submission:
from sys import stdin, stdout
def main():
    N = int(stdin.readline())
    A = [0] + list(map(int, stdin.readline().rstrip().split()))
    dp = [0] * (N+1)
    prefix = [0] * (N+1)
    dp[1], prefix[1] = 0, A[1]
    for i in range(3, N, 2):
        prefix[i] = prefix[i-2]+A[i]
    for i in range(2, N+1):
        if i & 1:
            dp[i] = max(dp[i-1], A[i] + dp[i-2])
        else:
            dp[i] = max(dp[i-2] + A[i], prefix[i-1])
    
    stdout.write(str(dp[N])+"\n")
main()

Buggy submission (verdict: Runtime Error):
from sys import stdin, stdout
def main():
    N = int(stdin.readline())
    A = list(map(int, stdin.readline().rstrip().split()))
    dp = [0] * N
    dp[1] = max(A[0], A[1])
    dp[2] = max(dp[1], A[2])
    for i in range(3, N):
        if i & 1 == 0:
            dp[i] = max(dp[i-1], A[i] + dp[i-2])
        else:
            dp[i] = A[i] + dp[i-2]
    ret=dp[N-1]
    stdout.write(str(ret)+"\n")
main()
Problem p02713 (python)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


def main(): # C163
    N = int(input())
    sum = 0
    for i in range(1, N+1):
        for j in range(1, N+1):
            for h in range(1, N+1):
                sum += gcd(i,j,h)
    print(sum)


main()

Buggy submission (verdict: Runtime Error):
def main(): # C163
    N = int(input())
    sum = 0
    for i in range(1, N+1):
        for j in range(1, N+1):
            for h in range(1, N+1):
                sum += gcd(i,j,h)
    print(sum)


main()
Problem p02714 (python)

Fixed submission:
def main():
    N = int(input())
    S = list(str(input()))
    sum = S.count("R") * S.count("G") * S.count("B")
    for i in range(0, N-2):
        si = S[i]
        for j in range(i+1, N-1):
            sj = S[j]
            k = 2*j -i  # Nを超える
            if k < N:
                sk = S[k]
                #if j - i != k -j and si != sj and si != sk and sj != sk:
                if si != sj and si != sk and sj != sk:
                    sum -= 1
    print(sum)

    # 提出 #11871188


main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = list(str(input()))
    sum = 0
    for i in range(0, N-2):
        si = S[i]
        for j in range(i, N-1):
            sj = S[j]
            k = 2*j -i  # Nを超える
            if k <= N:
                sk = S[k]
                if j - i != k -j and si != sj and si != sk and sj != sk:
                    sum += 1
    print(sum)


main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = list(str(input()))
    sum = 0
    for i in range(0, N-2):
        si = S[i]
        for j in range(i, N-1):
            sj = S[j]
            k = 2*j -i
            sk = S[k]
            if j - i != k -j and si != sj and si != sk and sj != sk:
                sum += 1
    print(sum)


main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = list(str(input()))
    print()
    sum = 0
    for i in range(0, N-2):
        si = S[i]
        for j in range(i, N-1):
            sj = S[j]
            for k in range(j, N):
                sk = S[k]
                #if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                if si != sj and sj != sk and sj != sk
                    if j - i != k -j:
                        sum += 1
    print(sum)



main()
Problem p02732 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
import collections
A_count = collections.Counter(A)
 
import math
sum_ = 0
for ai in A_count:
    sum_ += (A_count[ai] * (A_count[ai] - 1)) // 2
 
for ai in A:
    #print(sum_ - (A_count[ai] * (A_count[ai] - 1)) // 2 + (A_count[ai] - 1) * (A_count[ai] - 2)) // 2
    l = A_count[ai] * (A_count[ai] - 1) // 2
    m = (A_count[ai] - 1) * (A_count[ai] - 2) // 2
    print(sum_ - l + m)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = input().split()
tmp = 0
idx = list(set(A))
value = [ A.count(_) for _ in idx ]
for n in value:
    tmp += combi(n)
#sum = 0
for i in A:
    j = idx.index(i)
    #sum += tmp - combi(j) + combi(j-1)
    print(int(tmp - combi(value[j]) + combi(value[j]-1)))
Problem p02742 (python)

Fixed submission:
import math
 
H, W = [int(_) for _ in input().split()]
if H == 1 or W == 1:
    print(1)
elif H %2 == 0:
    print(int(H*W/2))
else:
    print(int((H-1)*W/2) + int(math.ceil(W/2)))

Buggy submission (verdict: Runtime Error):
H, W = [int(_) for _ in input().split()]
if H == 1 and W == 1:
    print(1)
elif H %2 == 0:
    print(int(H*W/2))
else:
    print(int((H-1)*W/2) + int(math.ceil(W/2)))
Problem p02743 (python)

Fixed submission:
a, b, c = [int(_) for _ in input().split()]
d = c - a - b
if d > 0 and d * d > 4 * a * b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = [int(_) for _ in input().split()]
if math.sqrt(a) + math.sqrt(b) < math.sqrt(c):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = [int(_) for _ in input().split()]
if math.sqrt(a) + math.sqrt(b)  < math.sqrt(c):
    print("Yes")
else:
    print("No")
Problem p02755 (python)

Fixed submission:
def C158():
    A, B = [int(_) for _ in input().split()]
    N = 1
    while N <= 10000:
        if int(N * 8/100) == A and int(N * 10/100) == B:
            break
        N += 1
    if N <= 10000:
        print(N)
    else:
        print(-1)
        
if __name__ == "__main__":
    C158()

Buggy submission (verdict: Runtime Error):
def C158():
    A, B = [int(_) for _ in input().split()]
    X1 = int(A / 0.08)
    # パターンを探す
    X = []
    for i in range(X1, 10000):
        if int(i * 0.08) == A:
            X.append(i)
        else:
            break

    for i in X:
        if int(i * 0.1) == B:
            print(i)
            exit(1)
    else:
        print("-1")

if __name__ == "__main__":
    C158()
Problem p02761 (python)

Fixed submission:
n,m,*z=map(int,open(0).read().split())
for i in range(10**n):
  S=str(i)
  if len(S)==n:
    if all(S[s-1]==str(c)for s,c in zip(z[0::2],z[1::2])):
      print(S)
      quit()
print(-1)

Buggy submission (verdict: Runtime Error):
def main():
    # importも関数の中で実装する
    # ローカル変数化する
    # xxx
    N, N = map(int, input().split())
    SC = [list(map(int, input().split())) for _ in [0]*N ]

    for i in range(10 ** (N-1), 10 ** N):
        S = str(i)
        if len(S) == N:
            if all(S[s - 1] == str(c) for s, c in SC):
                print(S)
                quit()
    print(-1)

main()

Buggy submission (verdict: Runtime Error):
def main():
    # importも関数の中で実装する
    # ローカル変数化する
    # xxx
    N, N = map(int, input().split())
    SC = [list(map(int, input().split())) for _ in [0]*N ]
    SC.sort()

    num = (10 ** N) - 1
    keta = 1

    if SC[0][0] != 1:
        print('-1')
        exit()

    for S,C in SC:
        if S == 1 and C == 0:
            print('-1')
            exit()

        if S == keta:
            tmp = C * (10 ** (N - S))
            if tmp < num:
                num = tmp
        elif S > keta:
            keta = S
            tmp = C * (10 ** (N - S))
            num += tmp

    print(num)


main()

Buggy submission (verdict: Runtime Error):
def main():
    # importも関数の中で実装する
    # ローカル変数化する
    # xxx
    N, N = map(int, input().split())
    SC = [list(map(int, input().split())) for _ in [0]*N ]
    SC.sort()

    num = (10 ** N) - 1
    keta = 1

    if SC[0][0] != 0:
        print('-1')
        exit()

    for S,C in SC:
        if S == 1 and C == 0:
            print('-1')
            exit()

        if S == keta:
            tmp = C * (10 ** (N - S))
            if tmp < num:
                num = tmp
        elif S > keta:
            keta = S
            tmp = C * (10 ** (N - S))
            num += tmp

    print(num)


main()
Problem p02681 (python)

Fixed submission:
a = input()
b = input()
if(a==b[:-1]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
if(a==b[:-1]):
  print("Yes")
else:
  print("No)
Problem p02882 (python)

Fixed submission:
import math
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.degrees(math.atan2((2*(b-(x/(a*a)))), a)))
elif x == v:
	print(0)
else:
	print(90 - math.degrees(math.atan2(((2*x)/(a*b)), b)))

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.atan((v/a*a)/a))
elif x*2 == v:
	print(0)
else:
	print(math.atan((x/a*a)/a))

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
v = a*a*b
if x*2 > v:
	print(math.atan((v/a*a)/a))
else:
	print(math.atan((x/a*a)/a))
Problem p03061 (python)

Fixed submission:
import numpy as np
def gcd(a, b):
	if a < b:
		a, b = b, a
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
a = np.array([int(x) for x in input().split()])
np.sort(a)
l = np.zeros(n + 1)
r = np.zeros(n + 1)
m = np.zeros(n)
for i in range(n):
	l[i + 1] = gcd(l[i], a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i + 1], a[i])
for i in range(n):
	m[i] = gcd(l[i], r[i + 1])
print(int(np.max(m)))

Buggy submission (verdict: Runtime Error):
import numpy as np
def gcd(a, b):
	if a > b:
		a, b = b, a
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
n = int(input())
a = np.array([int(x) for x in input().split()])
np.sort(a)
l = np.zeros(n + 1)
r = np.zeros(n + 1)
m = np.zeros(n)
for i in range(n):
	l[i + 1] = gcd(l[i], a[i])
for i in reversed(range(n)):
	r[i] = gcd(r[i + 1], a[i])
for i in range(n):
	m[i] = gcd(l[i], r[i + 1])
print(int(np.max(m)))
Problem p03087 (python)

Fixed submission:
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s) - 1):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
readline = sys.stdin.readline
read = sys.stdin.read

import bisect
n, q = map(int, readline().split())
s = readline().rstrip()
a = []
for i in range(len(s)):
	if s[i] == 'A' and s[i + 1] == 'C':
		a.append(i)
for _ in range(q):
	l, r = map(int, readline().split())
	l -= 1
	r -= 2
	print(bisect.bisect_right(a, r) - bisect.bisect_left(a, l))
Problem p03110 (python)

Fixed submission:
import numpy as np
import sys

n = int(input())
ans = 0
for _ in range(n):
	x, u = input().split()
	x = float(x)
	if u == "BTC":
		ans += x * 380000
	else:
		ans += x
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys

n = int(input())
ans = 0
for _ in range(n):
	x, u = input().split()
	float(x)
	if u == "BTC":
		ans += x * 380000
	else:
		ans += x
print(x)
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b=map(int,split())
if a*b%2=0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a*b % 2 == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
if a*b % 2 == 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a = random.randint(1,10000)
b = random.randint(1,10000)
if a * b %= 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a = random(1,10000)
b = random(1,10000)
if a * b %= 0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
if a * b %= 0:
  print('Even')
else:
  print('Odd')
Problem p02717 (python)

Fixed submission:
a,b,c=list(map(int,input().split()))

a,b=b,a
a,c=c,a
print(a,b,c)

Buggy submission (verdict: Runtime Error):
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort(reverse=True)

cnt=0
for j in range(n):
    cnt+=a[j]

b=[]
for i in range(n):
    if a[i]>(cnt*(1/(4*m))):
        b.append(a[i])

if len(b) > m:
    print("Yes")
else:
    print("No")
Problem p03501 (python)

Fixed submission:
n,a,b=map(int,input().split())
print(min(n*a,b))

Buggy submission (verdict: Runtime Error):
N=input()
cnt=0

for i in range(len(N)):
    cnt+=int(N[i])

if int(N)%cnt==0:
    print("Yes")
    
else:
    print("No")