Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import re

tmp = raw_input()

length = len(tmp)


for i in range(length/2):
    tmp = tmp.replace("01", "")
    tmp = tmp.replace("10", "")


length2 = len(tmp)

division = length - length2

print(division)

Fixed submission:
import re

tmp = raw_input()

length = len(tmp)


tmp1 = tmp.replace("0", "")
tmp2 = tmp.replace("1", "")

if len(tmp1) > len(tmp2):
    tmp3 = len(tmp1) - len(tmp2)

else:
    tmp3 = len(tmp2) - len(tmp1)


division = length - tmp3

print(division)

Buggy python submission (verdict: Time Limit Exceeded):
import re

tmp = raw_input()

length = len(tmp)


for i in range(length):
    tmp = tmp.replace("01", "")
    tmp = tmp.replace("10", "")


length2 = len(tmp)

division = length - length2

print(division)

Fixed submission:
import re

tmp = raw_input()

length = len(tmp)


tmp1 = tmp.replace("0", "")
tmp2 = tmp.replace("1", "")

if len(tmp1) > len(tmp2):
    tmp3 = len(tmp1) - len(tmp2)

else:
    tmp3 = len(tmp2) - len(tmp1)


division = length - tmp3

print(division)
Buggy python submission (verdict: Runtime Error):
list = input().split()

print(list[0]/list[1])

Fixed submission:
list = input().split()
print(float(list[0])/float(list[1]))

Buggy python submission (verdict: Runtime Error):
T=input()
X=input()
print(T/X)

Fixed submission:
list = input().split()
print(float(list[0])/float(list[1]))

Buggy python submission (verdict: Runtime Error):
t = T/X
print(t)

Fixed submission:
list = input().split()
print(float(list[0])/float(list[1]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
listL = [int(i) for i in raw_input().split()]
maxL = max(listL)
sum = 0
for i in range(N):
    sum = sum + listL[i]

sum = sum - maxL

if maxL < sum:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
listL = [int(i) for i in raw_input().split()]
maxL = max(listL)
sum = 0
for i in range(N):
    sum = sum + listL[i]

sum = sum - maxL

if maxL < sum:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
listL = [int(i) for i in input().split()]
maxL = max(listL)

for i in range(N)
	sum += listL[i-1]
  
sum = sum - maxL

if maxL < sum:
	print("Yes")
else:
	print("No")

Fixed submission:
N = int(input())
listL = [int(i) for i in raw_input().split()]
maxL = max(listL)
sum = 0
for i in range(N):
    sum = sum + listL[i]

sum = sum - maxL

if maxL < sum:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=["a","b","c","d","e","f","g","h","i","j","k","l","m",
   "n","o","p","q","r","s","t","u","v","w","x","y","z"]
Ans=[]
s=0
for i in range(10):
    s+=26**i
    S=s+26**(i+1)
    if s<=N<S:
        I=i
        break
while I>=0:
    for i in range(1,27):
        n=N-26**I*i
        if n<26**I:
            Ans.append(l[i-1])
            N=n
            I-=1
            break
print("".join(Ans))

Fixed submission:
N=int(input())
l=["a","b","c","d","e","f","g","h","i","j","k","l","m",
   "n","o","p","q","r","s","t","u","v","w","x","y","z"]
Ans=[]
s=0
for i in range(11):
    s+=26**i
    S=s+26**(i+1)
    if s<=N<S:
        I=i
        break
for i in range(I+1):
    N-=26**i
while I>=0:
    for i in range(0,26):
        n=N-26**I*i
        if n<26**I:
            Ans.append(l[i])
            N=n
            I-=1
            break
print("".join(Ans))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
a=1
for i in range(N):
    a*=A[i]
if a>10**18:
    a=-1
print(a)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
a=1
for i in A:
    if i==0:
        print(0)
        exit()
for i in range(N):
    a*=A[i]
    if a>10**18:
        print(-1)
        exit()
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
s=0
K=int(input())
for a in range(K):
    for b in range(K):
        for c in range(K):
            x=reduce(math.gcd,(a+1,b+1,c+1))
            s+=x
print(s)

Fixed submission:
import math
from functools import reduce
s=0
K=int(input())+1
for a in range(1,K):
    for b in range(a,K):
        for c in range(b,K):
            if a==b==c:
                s+=a
                continue
            x=reduce(math.gcd,(a,b,c))
            if a==b or b==c or c==a:
                s+=x*3
            else:
                s+=x*6
print(s)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
for x in range(10*B,10*B+10):
    if A*100/8<=x<A*100/8+100/8:
        print(x)
        exit()
print("-1")

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
for x in range(10*B,10*B+10):
    if A*100/8<=x<=A*100/8+100/8:
        print(x)
        exit()
print("-1")

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N,A,B=map(int,input().split())
n=0
while True:
    N-=A
    if N<=0:
        print(n+(A+N))
        break
    n+=A
    N-=B
    if N<=0:
        print(n)
        break

Fixed submission:
N,A,B=map(int,input().split())
n=0
x=N//(A+B)
y=N%(A+B)-A
if y>0:
    print((x+1)*A)
else:
    print((x+1)*A+y)
Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
Q=int(input())
r=1
for i in range(Q):
    T=input().split()
    if T[0]=="1":
        r*=-1
        continue
    if T[1]=="1":
        if r==1:
            S=[T[2]]+S
        else:
            S=S+[T[2]]
        continue
    if r==1:
        S=S+[T[2]]
    else:
        S=[T[2]]+S
if r==1:
    print("".join(S))
else:
    print("".join(list(reversed(S))))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
r=1
for i in range(Q):
    T=input().split()
    if T[0]=="1":
        r*=-1
        continue
    t=T[2]
    if T[1]=="1":
        if r==1:
            S.appendleft(t)
        else:
            S.append(t)
        continue
    if r==1:
        S.append(t)
    else:
        S.appendleft(t)
if r==1:
    print("".join(list(S)))
else:
    S.reverse()
    print("".join(list(S)))

Buggy python submission (verdict: Time Limit Exceeded):
S=list(input())
Q=int(input())
for i in range(Q):
    T=input().split()
    if T[0]=="1":
        S=list(reversed(S))
        continue
    if T[1]=="1":
        S=[T[2]]+S
        continue
    S=S+[T[2]]
print("".join(S))

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
r=1
for i in range(Q):
    T=input().split()
    if T[0]=="1":
        r*=-1
        continue
    t=T[2]
    if T[1]=="1":
        if r==1:
            S.appendleft(t)
        else:
            S.append(t)
        continue
    if r==1:
        S.append(t)
    else:
        S.appendleft(t)
if r==1:
    print("".join(list(S)))
else:
    S.reverse()
    print("".join(list(S)))
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A>=B:
    x,y=A,B
else:
    x,y=B,A
i=1
while if x*i%y==0:
    i+=1
print(x*i)

Fixed submission:
A,B=map(int,input().split())
if A>B:
    x,y=A,B
else:
    x,y=B,A
i=1
while x*i%y!=0:
    i+=1
print(x*i)
Buggy python submission (verdict: Runtime Error):
input = stdin.readline

N = int(input())

b = False
cnt = 0
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        cnt += 1
        if cnt == 3:
            b = True
    else:
        cnt = 0

if b == False:
    print('No')
else:
    print('Yes')

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

N = int(input())

b = False
cnt = 0
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        cnt += 1
        if cnt == 3:
            b = True
    else:
        cnt = 0

if b == True:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
input = stdin.readline

def SumOfProductParis(n):
    if n == 0:
        return 0
    elif n == 1:
        return A[0]
    else:
        result = 0
        for i in range(0, n-1):
            for j in range(i+1, n):
                result += A[i]*A[j]
        return result%(10**9+7)

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

print(SumOfProductParis(N))

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

def SumOfProductParis(n):
    if n == 0:
        return 0
    elif n == 1:
        return A[0]
    else:
        result = 0
        temp = sum(A)
        result = temp**2
        for i in range(n):
            result -= A[i]**2
        return (result//2)%(10**9+7)

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

print(SumOfProductParis(N))
Buggy python submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline

L, N = map(int, input().split())
D = []

for i in range(N):
    D.append(input()

D.sort()

print(''.join(D))

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

N, L = map(int, input().split())
D = []

for i in range(N):
    D.append(input().strip())
D.sort()
print(''.join(D))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
height = list(map(int, input().split()))
total = 0
max_number = height[0]

for i in range(1, height.index(max(height))):
	if height[i] > max_number:
		max_number = height[i]
	else:
		total += (max_number - height[i])

for i in range(height.index(max(height)), N):
	total += (max(height)-height[i])
    
print(total)

Fixed submission:
N = int(input())
height = list(map(int, input().split()))
total = 0
max_number = height[0]

for i in range(1, height.index(max(height))):
	if height[i] > max_number:
		max_number = height[i]
	else:
		total += (max_number - height[i])

total += (max(height)*(N-1-height.index(max(height)))-sum(height[height.index(max(height))+1:N]))
    
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())
def divisor(n): 
    i = 1
    c=0
    table = []
    while i * i <= n:
        if n%i == 0:
            if i==n//i:
                c+=1
            else:
                c+=2
        i += 1
    return c
n=n-1
ans=0
while n>=1:
    ans+=divisor(n)
    n-=1

print(ans)

Fixed submission:
import math

n=int(input())
c=0

for a in range(1,n):
    c+=math.floor((n-1)/a)

print(c)

Buggy python submission (verdict: Time Limit Exceeded):
import math
n=int(input())
def divisor(n): 
    i = 1
    c=0
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return len(table)
n=n-1
ans=0
while n>=1:
    ans+=divisor(n)
    n-=1

print(ans)

Fixed submission:
import math

n=int(input())
c=0

for a in range(1,n):
    c+=math.floor((n-1)/a)

print(c)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
ls=len(s)
lt=len(t)
a=[0]*(ls-lt)

for i in range(ls-lt):
    for j in range(lt):
        if s[i+j]!=t[j]:
            a[i]+=1

print(min(a))

Fixed submission:
s=input()
t=input()
ls=len(s)
lt=len(t)
a=[0]*(ls-lt+1)

for i in range(ls-lt+1):
    for j in range(lt):
        if s[i+j]!=t[j]:
            a[i]+=1

print(min(a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(n-1):
    j=i+1
    while j<=n-1:
        s+=a[i]*a[j]
        j+=1

ans=s%(10**9+7)
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
sa=sum(a)
s=0
for i in range(n-1):
    sa-=a[i]
    s+=a[i]*sa
ans=s%(10**9+7)
print(ans)
Buggy python submission (verdict: Runtime Error):
r=int(input())
x=list(map(int,input().split())
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)

Fixed submission:
r=int(input())
x=list(map(int,input().split()))
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)

Buggy python submission (verdict: Runtime Error):
r=int(input())
x=list(map(int,input().split())
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)

Fixed submission:
r=int(input())
x=list(map(int,input().split()))
setx=list(set(x))
setx.sort()
cx=[]
for i in setx:
    cx.append(x.count(i))
ans=0
A=0
while A<=len(setx)-3:
    B=A+1
    while B<=len(setx)-2:
        C=B+1
        while C<=len(setx)-1:
            if setx[A]+setx[B]>setx[C]:
                ans+=cx[A]*cx[B]*cx[C]
            C+=1
        B+=1
    A+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1

        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
    # print(dp[i])
ans=''
i,j=len(s),len(t)
while i > 0 and j > 0:
  if s[i-1]==t[j-1]:
    ans=s[i-1]+ans
    i=i-1
    j=j-1
  else:
    if dp[i-1][j]>dp[i][j-1]:
      i-=1
    else:
      j-=1
print(ans)


Fixed submission:
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1

        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
    # print(dp[i])
ans=''
i,j=len(s),len(t)
while i > 0 and j > 0:
  if s[i-1]==t[j-1]:
    ans=s[i-1]+ans
    i=i-1
    j=j-1
  else:
    if dp[i-1][j]>dp[i][j-1]:
      i-=1
    else:
      j-=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

ls=len(s)
lt=len(t)

dp=[[0]*(lt+1) for _ in range(ls+1)]

for i in range(ls):
    for j in range(lt):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

ans=""
l=dp[ls][lt]-1
i=ls-1
j=lt-1
while l>=0:
    if s[i]==t[j]:
        ans=s[i]+ans
        i-=1
        j-=1
        l-=1
    else:
      	if dp[i-1][j]>dp[i][j-1]:
        	i-=1
    	else:
        	j-=1

print(ans)


Fixed submission:
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1

        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
    # print(dp[i])
ans=''
i,j=len(s),len(t)
while i > 0 and j > 0:
  if s[i-1]==t[j-1]:
    ans=s[i-1]+ans
    i=i-1
    j=j-1
  else:
    if dp[i-1][j]>dp[i][j-1]:
      i-=1
    else:
      j-=1
print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()

ls=len(s)
lt=len(t)

dp=[[0]*(lt+1) for _ in range(ls+1)]

for i in range(ls):
    for j in range(lt):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1])

ans=""
l=dp[ls][lt]-1
i=ls-1
j=lt-1
while l>=0:
    if s[i]==t[j]:
        ans=s[i]+ans
        i-=1
        j-=1
        l-=1
    else:
      	if dp[i-1][j]>dp[i][j-1]:
        i-=1
    else:
        j-=1

print(ans)

Fixed submission:
s=input()
t=input()
dp=[[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
    for j in range(1,len(t)+1):
        if s[i-1]==t[j-1]:
            dp[i][j]=dp[i-1][j-1]+1

        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
    # print(dp[i])
ans=''
i,j=len(s),len(t)
while i > 0 and j > 0:
  if s[i-1]==t[j-1]:
    ans=s[i-1]+ans
    i=i-1
    j=j-1
  else:
    if dp[i-1][j]>dp[i][j-1]:
      i-=1
    else:
      j-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
 
print(max(a * c, b * d, a * d, b * c))

Fixed submission:
x = int(input())

print(int(x == 0))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product, combinations

n = int(input())

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

result = 0

for x, y in combinations(a, 2):
	result += x * y

print(result % (10 ** 9 + 7))

Fixed submission:
from itertools import accumulate

MOD = 10 ** 9 + 7

n = int(input())

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

suffix_sum = list(accumulate(a[::-1]))[::-1]

req_arr = [x -  y for x, y in zip(suffix_sum, a)]

result = sum([(x * y) % MOD for x, y in zip(req_arr, a)])

print(result % MOD)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)

thold = sum(a) // (4 * m)

if a[m] <= thold:
    print('No')
else:
    print('Yes')



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

x, y = y, x
x, z = z, x

print(x, y, z)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)

thold = sum(a) // (4 * m)

if a[m] <= thold:
    print('No')
else:
    print('Yes')



Fixed submission:
from math import ceil

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

a.sort(reverse=True)

thold = ceil(sum(a) / (4 * m))

if a[m-1] < thold:
    print('No')
else:
    print('Yes')

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

thold = sum(a) / (4 * m)

if a[m] < thold:
    print('No')
else:
    print('Yes')


Fixed submission:
from math import ceil

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

a.sort(reverse=True)

thold = ceil(sum(a) / (4 * m))

if a[m-1] < thold:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
n = int(input())

for i in range(1, 10):
    if n % i == 0 and n / i < 10:
        print('Yes')
        break

else:
    print('No')

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

if 0 < a < 10 and 0 < b < 10:
    print(a * b)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import itertools as it 

n = input()
l = list(map(int, input().split()))

l.sort()

triangles = set()
for a, b, c in it.combinations(l, 3):
    if a + b > c and b + c > a and a + c > b:
        triangles.add((a, b, c))

print(len(triangles))

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

print(max(a - 2 * b, 0))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it 
 
n = input()
l = list(map(int, input().split()))
 
l.sort()
 
triangles = set()
for a, b, c in it.combinations(l, 3):
    if a + b > c and b + c > a and a + c > b:
        triangles.add((a, b, c))
 
print(len(triangles))

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

l.sort()
count = 0
  
for i in range(0,n-2): 

    k = i + 2

    for j in range(i+1,n): 

        while (k < n and l[i] + l[j] > l[k]): 
            k += 1

        if(k>j): 
            count += k - j - 1

print(count)

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

triangles = set()
for i, a in enumerate(l[:-2]):
    for j, b in enumerate(l[i+1:-1], i+1):
        for k, c in enumerate(l[j+1:], j+1):
            if a + b > c and b + c > a and a + c > b:
                triangles.add(tuple(sorted([a, b, c])))

print(len(triangles))

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

l.sort()
count = 0
  
for i in range(0,n-2): 

    k = i + 2

    for j in range(i+1,n): 

        while (k < n and l[i] + l[j] > l[k]): 
            k += 1

        if(k>j): 
            count += k - j - 1

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


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

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

gcd = gcd(a, b)

res = set([1])
while gcd % 2 == 0: 
        res.add(2)
        gcd = gcd // 2

for i in range(3,int(math.sqrt(gcd))+1,2): 
    while gcd % i == 0: 
        res.add(i)
        gcd = gcd // i 
            
if gcd > 2: 
    res.add(gcd)

print(len(res))

Fixed submission:
from math import ceil

n = int(input())

if n % 2:
    print(ceil(n/2)/n)
else:
    print((n//2)/n)
Buggy python submission (verdict: Runtime Error):
import math

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

gcd = math.gcd(a, b)

res = set([1])
while gcd % 2 == 0: 
        res.add(2)
        gcd = gcd // 2

for i in range(3,int(math.sqrt(gcd))+1,2): 
    while gcd % i == 0: 
        res.add(i)
        gcd = gcd // i 
            
if gcd > 2: 
    res.add(gcd)

print(len(res))

Fixed submission:
import math
 
 
def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
  
 
a, b = map(int, input().split())
 
gcd = gcd(a, b)
 
res = set([1])
while gcd % 2 == 0: 
        res.add(2)
        gcd = gcd // 2
 
for i in range(3,int(math.sqrt(gcd))+1,2): 
    while gcd % i == 0: 
        res.add(i)
        gcd = gcd // i 
            
if gcd > 2: 
    res.add(gcd)
 
print(len(res))
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]*2

for i in range(1, n-1):
    if b[i] >= b[i-1]:
        a.append(b[i])
    else:
        a[i] = b[i]
        a[i-1] = b[i]

print(sum(a))


Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]*2

for i in range(1, n-1):
    a.append(b[i])
    if b[i] < b[i-1]:
        a[i] = b[i]

print(sum(a))

Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]*2

for i in range(1, n-1):
    if b[i] >= b[i-1]:
        a.append(b[i])
    else:
        a[i] = b[i]
        a[i-1] = b[i]

print(sum(a))


Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a = [b[0]]*2

for i in range(1, n-1):
    a.append(b[i])
    if b[i] < b[i-1]:
        a[i] = b[i]

print(sum(a))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
count = 0
s = 'X' + s + 'X'
for i in range(1, n+1):
    print(f's[i]: {s[i]} s[i-1]: {s[i-1]} s[i+1]:{s[i+1]}')
    if (s[i] == s[i-1] and s[i] == 'L') or \
        (s[i] == s[i+1] and s[i] == 'R'):
        count += 1
if count == n-2:
    print(count + 1)
else:
    print(count + 2*k)

Fixed submission:
n, k = map(int, input().split())
s = input()
count = 0
s = 'X' + s + 'X'
for i in range(1, n+1):
    #print(f's[i]: {s[i]} s[i-1]: {s[i-1]} s[i+1]:{s[i+1]}')
    if (s[i] == s[i-1] and s[i] == 'L') or \
        (s[i] == s[i+1] and s[i] == 'R'):
        count += 1
print(min(n-1, count + 2*k))
Buggy python submission (verdict: Runtime Error):
from math import factorial

def comb(n, r):
    if n < r:
        return 0
    return (factorial(n) // (factorial(n-r) * factorial(r)))

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

for i in range(1, k+1):
    print(comb(n-k+1, i) * comb(k-1, i-1) % (10**9+7))

Fixed submission:
from collections import Counter

s = input()

c = Counter(s)

if len(c) == 2:
    print('Yes')
else:
    print('No')

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

def comb(n, r):
    if n < r:
        return 0
    return factorial(n) // (factorial(n-r) * factorial(r))

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


for i in range(1, k+1):
    print(comb(n-k+1, i) * comb(k-1, i-1) % (10**9+7))





Fixed submission:
from collections import Counter

s = input()

c = Counter(s)

if len(c) == 2:
    print('Yes')
else:
    print('No')