Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
ink= input().split()
ink=[int(i) for i in ink]
in1=ink[0]
in2=ink[1]
in3=ink[2]

def nibun(a,e,h):
    #a=int(input("何乗？"))
    b=2#何進法でもできるようにする予定だった
    c=[]
    d=0
    while d==0:
        for i in range(999):
            if b**i<=a and a<b**(i+1):
                c.append(1)
                d=i

    a=a-b**d
    for x in range(d-1,-1,-1):
        if b**(x)<=a:
            a=a-(b**x)
            c.append(1)
        else:
            c.append(0)
        d=d-1
    #print(c)

    #e=int(input("何を？"))
    f=1
    g=0
    #h=int(input("mod?"))#mod
    j=1
    for i in range(len(c)-1,-1,-1):
        j=e
        if c[i]==1:
            for x in range(g):
                j=j*j%h
            f=f*j%h
        g=g+1
    return f
f=nibun(in1,2,10**9+7)

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

######################################################
p=10**6

#pは素数とする

#fact[i] : i! modp (0<= i <p) O(p)
fact = [1]
k = 1
for i in range(1,p):
    k = k*i%p
    fact.append(k)


#n! = a p^eとしたときのeを求める (O(logp n)
def mod_e(n,p):
    res = 0
    while n >= p:
        res += n//p
        n = n//p
    return res

#n! = a p^eとしたときのa mod pを求める  (O(logp n)
def mod_fact(n,p):
    if n==0:
        return 1


    res = mod_fact(n//p,p)

    if n//p %2 != 0:
        return res*(p-fact[n%p])%p
    return res*fact[n%p]%p

######################################################

#nCk mod p
def mod_comb(n,k,p):
    if n < 0 or k < 0 or n<k:
        return 0
    e1 = mod_e(n,p)
    e2 = mod_e(k,p)
    e3 = mod_e(n-k,p)
    #pで割り切れる場合
    if e1 > e2 + e3:
        return 0

    #pで割り切れない場合
    a1 = mod_fact(n,p)
    a2 = mod_fact(k,p)
    a3 = mod_fact(n-k,p)
    return a1 * mod_inv(a2*a3%p,p) %p

p =10**9+7

#fact[i] : i! modp (0<= i <p) O(p)
#上だとO(p)なのでnまでにして O(n)にする
fact = [1]
k = 1
for i in range(1,10**5+1):
    k = k*i%p
    fact.append(k)

#10000C4000 mod 10**9+7

j=mod_comb(in1,in2,p)
k=mod_comb(in1,in3,p)
x=(f-1-j-k)
print(x)


Fixed submission:
a = input().split()
a=[int(i) for i in a]
n,r=a[0],a[1]
if n>=10:
    b=r
else:
    b=r+1000-100*n
print(b)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
l=set()
r=set()
for i in range(0,n-2):
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        # print(i,s[i])
        if i==0 and j>=2 and s[j]==s[1]  :
            continue
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))


Fixed submission:
n=int(input())
s=input()
l=set()
r=set()

for i in range(0,n-2):
    a=set()
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        if s[j] in a:
            continue
        else:
            a.add(s[j])
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
l=set()
for i in range(0,n-2):
    if i>=1 and s[i]==s[0]  :
        continue
    for j in range(i+1,n-1):
        # print(i,s[i])
        if i==0 and j>=2 and s[j]==s[1]  :
            continue
        for k in range(j+1,n):
            if i==0 and j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)



print(len(l))


Fixed submission:
n=int(input())
s=input()
l=set()
r=set()

for i in range(0,n-2):
    a=set()
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        if s[j] in a:
            continue
        else:
            a.add(s[j])
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
l=set()
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))


Fixed submission:
n=int(input())
s=input()
l=set()
r=set()

for i in range(0,n-2):
    a=set()
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        if s[j] in a:
            continue
        else:
            a.add(s[j])
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
l=set()
for i in range(0,n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))


Fixed submission:
n=int(input())
s=input()
l=set()
r=set()

for i in range(0,n-2):
    a=set()
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        if s[j] in a:
            continue
        else:
            a.add(s[j])
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n=int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans=0
bfla=0
cfla=0
for i in range(n):
    x=a[i]
    bfla=0
    cfla=0
    for j in range(bfla,n):
        if b[j] > x :
            y=b[j]
            bfla=j
        else:
            continue
        for k in range(cfla,n):
            if c[k]>y:
                z=c[k]
                ans+=n-k
                cfla=k
                break
print(ans)


Fixed submission:
import sys
import bisect
input = sys.stdin.readline

n=int(input())
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans=0

for j in range(n):
    al=bisect.bisect_left(a,b[j])
    cl=n-bisect.bisect_right(c,b[j])
    ans+=al*cl
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list=list(map(int,input().split()))
Q=int(input())

N_list=[0]*(10001)
sumn=0

for a in a_list:
    N_list[a]+=1
    sumn+=a


for i in range(Q):
    b,c=map(int,input().split())
    henka=(c-b)*N_list[b]

    sumn+=henka

    N_list[c]+=N_list[b]
    N_list[b]=0

    print(sumn)

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

N_list=[0]*(100001)
sumn=0

for a in a_list:
    N_list[a]+=1
    sumn+=a


for i in range(Q):
    b,c=map(int,input().split())
    henka=(c-b)*N_list[b]

    sumn+=henka

    N_list[c]+=N_list[b]
    N_list[b]=0

    print(sumn)

Buggy python submission (verdict: Runtime Error):
N=int(input())
a_list=list(map(int,input().split()))
Q=int(input())

N_list=[0]*(N+1)
sumn=0

for a in a_list:
    N_list[a]+=1
    sumn+=a


for i in range(Q):
    b,c=map(int,input().split())
    henka=(c-b)*N_list[b]

    sumn+=henka

    N_list[c]+=N_list[b]
    N_list[b]=0

    print(sumn)



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

N_list=[0]*(100001)
sumn=0

for a in a_list:
    N_list[a]+=1
    sumn+=a


for i in range(Q):
    b,c=map(int,input().split())
    henka=(c-b)*N_list[b]

    sumn+=henka

    N_list[c]+=N_list[b]
    N_list[b]=0

    print(sumn)
Buggy python submission (verdict: Runtime Error):
N,x,y=map(int,input().split())

tri=y-x+1
linear=x+N-y+1

nl=[0]*(N-1)
# triangle is gusu
if tri%2==0:
    # triangle
    for i in range(tri//2-1):
        nl[i]+=tri

    nl[i+1]+=tri//2

    # before,x,y,after
    for i in range(linear-1):
        if i==0:
            nl[i]+=min(0,linear-(i+1)-1)
        else:
            nl[i]+=linear-(i+1)
    
    # before,tri
    half_tri=(tri-2)//2
    mind=min(x-1,half_tri)
    maxd=max(x-1,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

    mind=min(N-y,half_tri)
    maxd=max(N-y,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

elif tri%2==1:
    # triangle
    for i in range(tri//2):
        nl[i]+=tri

    # before,x,y,after
    for i in range(linear-1):
        if i==0:
            nl[i]+=min(0,linear-(i+1)-1)
        else:
            nl[i]+=linear-(i+1)
    
    # before,tri
    half_tri=(tri-2)//2
    mind=min(x-1,half_tri)
    maxd=max(x-1,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind
    
    half_tri=min(0,half_tri-1)
    mind=min(x-1,half_tri)
    maxd=max(x-1,half_tri)
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

    mind=min(N-y,half_tri)
    maxd=max(N-y,half_tri)
    for i in range(mind+2,maxd+2):
        nl[i]+=mind

    half_tri-=1
    mind=min(N-y,half_tri)
    maxd=max(N-y,half_tri)
    for i in range(mind+3,maxd+3):
        nl[i]+=mind

for s in nl:
    print(s)




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

ln=[0]*(N-1)

for i in range(1,N+1):
    for j in range(i+1,N+1):
        d2=N
        d=j-i
        if j <= x:
            pass
        elif i<=x and j <=y:
            d2=y-j+1+x-i
        elif j<=y:
            d2=y-j+1+i-x
        elif i<=x and j>=y:
            d2=x-i+j-y+1
        elif j>=y:
            d2=j-y+1+i-x

        if d2 < d:
            d=d2
        
        ln[d-1]+=1

for i in ln:
    print(i)
Buggy python submission (verdict: Runtime Error):
a,b,c=input()

if a==b and a!=c:
    print("Yes")
elif a==c and a!=b:
    print("Yes")
elif b==c and a!=b:
    print("Yes")
else:
    print("No")

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

if a==b and a!=c:
    print("Yes")
elif a==c and a!=b:
    print("Yes")
elif b==c and a!=b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
import sys
input=sys.stdin.readline

n,k=map(int,input().split())

#p=np.array(list(map(int,input().split())))
func=lambda x: ((int(x)+1.)/2.)
p=list(map(func,input().split()))

#p=(p+1.)/2.
max_p=0

for i in range(n-k+1):
    #s=np.sum(p[i:i+k])
    s=sum(p[i:i+k])
    if  max_p < s:
        max_p=s

print(max_p)

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

n,k=map(int,input().split())

#p=np.array(list(map(int,input().split())))
func=lambda x: ((int(x)+1.)/2.)
p=list(map(func,input().split()))

#p=(p+1.)/2.
s=sum(p[0:k])
max_p=s

#for i in range(n-k+1):
for i in range(n-k):
    #s=np.sum(p[i:i+k])
    s=s-p[i]+p[i+k]
    if  max_p < s:
        max_p=s

print(max_p)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input=sys.stdin.readline

n,k=map(int,input().split())
p=np.array(list(map(int,input().split())))
p=(p+1.)/2.
max_p=0

for i in range(n-k+1):
    s=np.sum(p[i:i+k])
    if  max_p < s:
        max_p=s

print(max_p)

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

n,k=map(int,input().split())

#p=np.array(list(map(int,input().split())))
func=lambda x: ((int(x)+1.)/2.)
p=list(map(func,input().split()))

#p=(p+1.)/2.
s=sum(p[0:k])
max_p=s

#for i in range(n-k+1):
for i in range(n-k):
    #s=np.sum(p[i:i+k])
    s=s-p[i]+p[i+k]
    if  max_p < s:
        max_p=s

print(max_p)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import sys
input=sys.stdin.readline

n,k=map(int,input().split())
p=np.array(list(map(int,input().split())))
p=(p+1.)/2.
max_p=0

for i in range(n-k+1):
    s=sum(p[i:i+k])
    if  max_p < s:
        max_p=s

print(max_p)

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

n,k=map(int,input().split())

#p=np.array(list(map(int,input().split())))
func=lambda x: ((int(x)+1.)/2.)
p=list(map(func,input().split()))

#p=(p+1.)/2.
s=sum(p[0:k])
max_p=s

#for i in range(n-k+1):
for i in range(n-k):
    #s=np.sum(p[i:i+k])
    s=s-p[i]+p[i+k]
    if  max_p < s:
        max_p=s

print(max_p)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,k=map(int,input().split())
p=np.array(list(map(int,input().split())))
p=(p+1.)/2.
max_p=0

for i in range(n-k+1):
    s=sum(p[i:i+k])
    if  max_p < s:
        max_p=s

print(max_p)

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

n,k=map(int,input().split())

#p=np.array(list(map(int,input().split())))
func=lambda x: ((int(x)+1.)/2.)
p=list(map(func,input().split()))

#p=(p+1.)/2.
s=sum(p[0:k])
max_p=s

#for i in range(n-k+1):
for i in range(n-k):
    #s=np.sum(p[i:i+k])
    s=s-p[i]+p[i+k]
    if  max_p < s:
        max_p=s

print(max_p)
Buggy python submission (verdict: Runtime Error):
import math

H,N=map(int,input().split())
A_list=[]
B_list=[]
for i in range(N):
    A,B=map(int,input().split())
    A_list.append(A)
    B_list.append(B)

amax=max(A_list)

inf=float('inf')
dp=[0]+[inf]*(H+amax)

for i in range(N):
    A=A_list[i]
    B=B_list[i]
    if A > H and B<dp[-1]:
        dp[-1]=B
        continue

    for j in range(A,1+H):
        if dp[j-A]+B<dp[j]:
            dp[j]=dp[j-A]+B
    
    minA=min(dp[H-A:])+B
    if minA < dp[-1]:
        dp[-1]=minA

print(dp[-1])


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

N=0
while H > 0:
    N+=1
    H-=A

print(N)

Buggy python submission (verdict: Runtime Error):
import math
import copy
H,N=map(int,input().split())

inf=float('inf')
dp=[0]+[inf]*H

for i in range(N):
    A,B=map(int,input().split())
    ndp=copy.deepcopy(dp)
    for j in range(A,H+1):
        ndp[j]=min(ndp[j-A]+B,dp[j])

        if j > H-A:
            ndp[-1]=min(ndp[-1],ndp[j]+B)

    dp=ndp

print(dp[-1])

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

N=0
while H > 0:
    N+=1
    H-=A

print(N)
Buggy python submission (verdict: Runtime Error):
from functools import reduce
import fractions

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


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

kobai=lcm_list(a)

sumN=0
for i in a:
    sumN+=int(kobai/i)
   
sumN=int(sumN%(1e9+7))

print(sumN)

Fixed submission:
N=int(input())

a_list= [[0 for i in range(10)] for j in range(10)]
b_list= [[0 for i in range(10)] for j in range(10)]
for i in range(N+1):
    a=int(str(i)[0])
    b=int(str(i)[-1])
    a_list[a][b]+=1
    b_list[b][a]+=1

count=0
for i in range(1,10):
    for j in range(1,10):
        count+=a_list[i][j]*b_list[i][j]

print(count)
Buggy python submission (verdict: Runtime Error):
import copy
H,W=map(int,input().split())

def BFS(h,w,maze):


maze=[]
maze.append("#"*W)
for h in range(H):
    maze_e=input()
    line=[]

    maze.append("#"+line+"#")

maze.append("#"*W)


maze_ori=copy.deepcopy(maze)

maxd=0

for h in range(1,H+1):
    for w in range(1,W+1):
        maze=copy.deepcopy(maze_ori)
        if maze[h][w]="#":
            continue
        else:
            next_flag=True


        direction=[[-1,0],[0][-1],[1,0],[0][1]])
        distance=0
        maze[h][w]=distance

        next_list=[h,w]
        while next_flag is True:
            p_list=next_list[]
            next_list=[]
            distance+=1
            next_flag=False
            for p in p_list:
                for d in direction:
                    i=p[0]+d[0]
                    j=p[1]+d[1]

                    if maze[i,j]==".":
                        maze[i,j]=distance
                        next_list.append([i,j])
                        next_flag=True
            
        maxd=max(maxd,distance-1)

print(maxd)

Fixed submission:
import copy
H,W=map(int,input().split())

maze=[]
maze.append(["#"]*(W+2))
for h in range(H):
    line=list(input())

    maze.append(["#"]+line+["#"])

maze.append(["#"]*(W+2))


maze_ori=copy.deepcopy(maze)

maxd=0

for h in range(1,H+1):
    for w in range(1,W+1):
        maze=copy.deepcopy(maze_ori)
        if maze[h][w]=="#":
            continue
        else:
            next_flag=True


        direction=[[-1,0],[0,-1],[1,0],[0,1]]
        distance=0
        maze[h][w]=distance

        next_list=[]
        next_list.append([h,w])
        while next_flag is True:
            p_list=next_list
            next_list=[]
            distance+=1
            next_flag=False
            for p in p_list:
                for d in direction:
                    i=p[0]+d[0]
                    j=p[1]+d[1]

                    if maze[i][j]==".":
                        maze[i][j]=distance
                        next_list.append([i,j])
                        next_flag=True
            
        maxd=max(maxd,distance-1)

print(maxd)
Buggy python submission (verdict: Runtime Error):
import math

a,b=map(int,input().split(" "))

print(a * b // math.gcd(a, b))

Fixed submission:
import fractions

a,b=map(int,input().split(" "))

print(a * b // fractions.gcd(a, b))
Buggy python submission (verdict: Runtime Error):
import math
N=input()
a=math.ceil(N/1.08)
if math.floor(a*1.08) == N:
  print(a)
else:
  print(":(")

Fixed submission:
import math
N=int(input())
a=math.ceil(N/1.08)
if math.floor(a*1.08) == N:
  print(a)
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
import math

r = imt(input())
pi = math.pi
ans = 2 * pi * r

print(ans)

Fixed submission:
import math

r = int(input())
pi = math.pi
ans = 2 * pi * r

print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

for i in range(1, N):
  if N/(K**i) < 1:
    print(i)
    break

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

ans = R
if N < 10:
  ans += 100*(10-N)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

l = [
  [len([n for n in range(1, N+1) if (str(n)[0]==str(i) and str(n)[-1]==str(j))])
     for j in range(1, 10)]
  for i in range(1, 10)
]

ans = 0
for i in range(9):
  for j in range(9):
    ans += l[i][j]*l[j][i]

print(ans)

Fixed submission:
N = int(input())

l = [
  [len([n for n in range(1, N+1) if (str(n)[0]==str(i) and str(n)[-1]==str(j))])
     for j in range(1, 10)]
  for i in range(1, 10)
]

ans = 0
for i in range(9):
  for j in range(9):
    ans += l[i][j]*l[j][i]

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

memo = [set()]*4
def dp(n):
  for i in range(4, n+1):
    if i == 4:
      t = {S[:j]+S[j+1:i] for j in range(i)}
      memo.append(t)
    else:
      t = {a[:-1]+S[i-1] for a in memo[i-1]}
      u = {a[0]+a[2]+S[i-1] for a in memo[i-1]}
      v = {a[1:]+S[i-1] for a in memo[i-1]}
      memo.append(memo[i-1] | t | u | v)
  return len(memo[n])

print(dp(N))  

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(10):
  a = S.find(str(i))
  if a != -1:
    for j in range(10):
      b = S.find(str(j), a+1)
      if b != -1:
        for k in range(10):
          c = S.find(str(k), b+1)
          if c != -1:
            ans += 1
print(ans)

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

s = set()
for i in range(N-2):
  for j in range(i+1, N-1):
    for k in range(j+1, N):
      s.add(S[i]+S[j]+S[k])
print(len(s))

Fixed submission:
N = int(input())
S = input()

ans = 0
for i in range(10):
  a = S.find(str(i))
  if a != -1:
    for j in range(10):
      b = S.find(str(j), a+1)
      if b != -1:
        for k in range(10):
          c = S.find(str(k), b+1)
          if c != -1:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
for i in range(2, round(pow(d, 2/1))):
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)

Fixed submission:
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)

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

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

D = gcd(A, B)
d = D.copy()
ans = 1
i = 2
while i <= pow(D, 1/2):
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)

Fixed submission:
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= d:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)

Fixed submission:
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

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

A = deque(sorted(A, reverse=True))
for _ in range(M):
  x = A.popleft()//2
  for i, a in enumerate(A):
    if x >= a:
      A.insert(i, x)
      break
  else:
    A.append(x) 
print(sum(A))

Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(lambda x: -int(x), input().split()))

heapq.heapify(A)
for _ in range(M):
  heapq.heappush(A, (-((-heapq.heappop(A))//2)))
print(-sum(A))
Buggy python submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N-2):
  if min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]):
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N-1):
  if min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]):
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)