Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]
c = [k for k in range(a, b + 1)]

if 0 in c:
    print('Zero')
elif len([k for k in c if k < 0]) % 2 == 0:
    print('Positive')
else:
    print('Negative')

Fixed submission:
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]

if a > 0:
    print('Positive')
elif b < 0:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
elif a <= 0 <= b:
    print('Zero')

Buggy python submission (verdict: Runtime Error):
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]

numbers = list(range(a, b + 1))

if 0 in numbers:
    print('Zero')
else:
    number_of_negatives = 0
    
    for n in numbers:
        if n < 0:
            number_of_negatives += 1
    
    print('Positive' if number_of_negatives % 2 == 0 else 'Negative')

Fixed submission:
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]

if a > 0:
    print('Positive')
elif b < 0:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
elif a <= 0 <= b:
    print('Zero')
Buggy python submission (verdict: Runtime Error):
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else "NO")

Fixed submission:
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else "NO")

Buggy python submission (verdict: Runtime Error):
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else print("NO"))

Fixed submission:
# ABC 042: A – 和風いろはちゃんイージー / Iroha and Haiku (ABC Edition)
nums = [int(s) for s in input().split(" ")]
print("YES" if nums.count(5) == 2 and nums.count(7) == 1 else "NO")
Buggy python submission (verdict: Runtime Error):
n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta<=0:
    ta=ta-int(a[cnta])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)


Fixed submission:
n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta-1>=0:
    ta=ta-int(a[cnta-1])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)

Buggy python submission (verdict: Runtime Error):
m,n,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while ta+int(a[cnta])<=int(k) and int(cnta)<int(n):
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta<=0:
    ta=ta-int(a[cnta])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)


Fixed submission:
n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta-1>=0:
    ta=ta-int(a[cnta-1])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)

Buggy python submission (verdict: Runtime Error):
m,n,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while ta+int(a[cnta])<=int(k) and int(cnta)<int(n):
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta<=0:
    ta=ta-a[cnta]
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)


Fixed submission:
n,m,k=input().split()
a=input().split()
b=input().split()
ta=0
cnta=0
while int(cnta)<int(n) and ta+int(a[cnta])<=int(k) :
    ta= ta+ int(a[cnta])
    cnta=cnta+1
tb=0
cntb=0
while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
    tb = tb+ int(b[cntb])
    cntb=cntb+1 
ans=cnta+cntb

while cnta-1>=0:
    ta=ta-int(a[cnta-1])
    cnta=cnta-1
    while cntb<int(m) and ta+tb+int(b[cntb])<=int(k):
        tb= tb+ int(b[cntb])
        cntb=cntb+1
    ans=max(ans,cnta+cntb)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans = " "
while n>0:
    re=n%26
    if re!=0:
        ans= chr(ord('a')+re-1)+ans
        n=n//26
    else:
        ans='z'+ans
        n=(n/26)-1
print(ans)
        

Fixed submission:
n=int(input())
ans = " "
while n>0:
    re=n%26
    if re!=0:
        ans= chr(ord('a')+re-1)+ans
        n=n//26
    else:
        ans='z'+ans
        n=(n//26)-1
print(ans)
Buggy python submission (verdict: Runtime Error):
x,n=input().split()
x=int(x)
n=int(n)
lst = [ ]
lst=input()
lst=lst.split()
for i in range(0,n):
    lst[i]=int(lst[i])
minv=min(lst)
maxv=max(lst)
dis=100000
for i in range(minv-2,maxv+3):
    if(i not in lst and abs(i-x)<dis):
        dis=abs(i-x)
        clv=i
        
print(clv)
    


Fixed submission:
x,n=input().split()
x=int(x)
n=int(n)
lst=input().split()
for i in range(0,n):
    lst[i]=int(lst[i])
if n==0:
    print(x)
else:
    minv=min(lst)
    maxv=max(lst)
    dis=100000

    for i in range(minv-2,maxv+3):
        if(i not in lst and abs(i-x)<dis):
            dis=abs(i-x)
            clv=i
            
    print(clv)
Buggy python submission (verdict: Runtime Error):
#Lucky 7
input(nm)
num=int(nm)
num3=num/100
num2=num/10%10
num1=num%10
if(num3==7 or num2==7 or num1==7):
    print("Yes")
else:
    print("No")
    



Fixed submission:
#Lucky 7
num=int(input(""))
num3=num//100
num2=num//10%10
num1=num%10
if(num3==7 or num2==7 or num1==7):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def fun():
	n = int(input()
	A = list(map(int,input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod*=a
		if(prod>1000000000000000000):
			print(-1)
			return
	print(prod)



fun()

Fixed submission:
def fun():
	n = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod*=a
		if(prod>1000000000000000000):
			print(-1)
			return
	print(prod)
 
 
 
fun()

Buggy python submission (verdict: Runtime Error):
n = int(input())
prod = 1
a = []
for i in range(n):
    a.append(int(input()))
sorted(a)
if(a[0]==0):
	print(0)
for i in range(n):
	prod*=a[i]
	if(prod>1e18):
		print(-1)
		return
print(prod)

Fixed submission:
def fun():
	n = int(input())
	A = list(map(int,input().split()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod*=a
		if(prod>1000000000000000000):
			print(-1)
			return
	print(prod)
 
 
 
fun()
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = int(input())
print(S.count('ABC'))

Fixed submission:
N = int(input())
S = input()
print(S.count('ABC'))
Buggy python submission (verdict: Runtime Error):
S,T = list(map(int,input().split()))
print(T + S)

Fixed submission:
S,T = list(input().split())
print(T + S)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B = list(map(int,input().split()))
print(lcm(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

A,B,X = input().split()
A = int(A)
B = int(B)
X = math.floor(int(X))
N = 0
tmp = 0
while tmp < X:
    tmp = A * N
    tmp += B * len(str(N))
    N += 1
if A == B:
    N += 1
print(N-2)

Fixed submission:
S = input()
week = ['SUN','MON','TUE','WED','THU','FRI','SAT']
ans = 7 - week.index(S)
print(ans)
Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(3)]
print(s)

Fixed submission:
s = [input() for i in range(2)]
predict = s[0]
result = s[1]
count = 0
for i in range(3):
    if predict[i] == result[i]:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
argList = list(map(int, input().split())) 
heights = list(map(int, input().split())) 

#いい展望台フラグ
check = np.array([1]*argList[0])

for n in range(argList[1]):
    #どことどこをつないでいるか
    con = list(map(int, input().split())) 
    #低かったらいい展望台ではない
    if heights[con[0]-1] <= heights[con[1]-1]:
        check[con[0]-1] = 0
    if heights[con[0]-1] >= heights[con[1]-1]:
        check[con[1]-1] = 0
print(np.sum(check))

Fixed submission:
s = input()
if( s == 'ABC'):
  print('ARC')
 
if( s == 'ARC'):
  print('ABC')
Buggy python submission (verdict: Runtime Error):
import numpy as np
argList = list(map(int, input().split())) 
heights = list(map(int, input().split())) 

#いい展望台フラグ
check = np.array([1]*argList[0])

for n in range(argList[0]-1):
    #どことどこをつないでいるか
    con = list(map(int, input().split())) 
    #print(con)
    #低かったらいい展望台ではない
    if heights[con[0]-1] < heights[con[1]-1]:
        check[con[0]-1] = 0
    else:
        check[con[1]-1] = 0
print(np.sum(check))

Fixed submission:
import numpy as np
argList = list(map(int, input().split())) 
heights = list(map(int, input().split())) 

#いい展望台フラグ
check = np.array([1]*argList[0])

for n in range(argList[1]):
    #どことどこをつないでいるか
    con = list(map(int, input().split())) 
    #低かったらいい展望台ではない
    if heights[con[0]-1] <= heights[con[1]-1]:
        check[con[0]-1] = 0
    if heights[con[0]-1] >= heights[con[1]-1]:
        check[con[1]-1] = 0
print(np.sum(check))

Buggy python submission (verdict: Runtime Error):
import numpy as np
argList = list(map(int, input().split())) 
heights = list(map(int, input().split())) 

#いい展望台フラグ
check = np.array([1]*argList[0])

for n in range(argList[0]-1):
    #どことどこをつないでいるか
    con = list(map(int, input().split())) 
    #print(con)
    #低かったらいい展望台ではない
    if heights[con[0]-1] < heights[con[1]-1]:
        check[con[0]] = 0
    else:
        check[con[1]] = 0
print(np.sum(check))

Fixed submission:
import numpy as np
argList = list(map(int, input().split())) 
heights = list(map(int, input().split())) 

#いい展望台フラグ
check = np.array([1]*argList[0])

for n in range(argList[1]):
    #どことどこをつないでいるか
    con = list(map(int, input().split())) 
    #低かったらいい展望台ではない
    if heights[con[0]-1] <= heights[con[1]-1]:
        check[con[0]-1] = 0
    if heights[con[0]-1] >= heights[con[1]-1]:
        check[con[1]-1] = 0
print(np.sum(check))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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


for i in range(len(argList)):
    argList2 = argList.copy()
    argList2.pop(i)
    argList2.sort()
    print(argList2[int(len(argList2)/2)])


Fixed submission:
n = int(input())

argList = list(map(int, input().split()))
argList2 = argList.copy()
argList2.sort()

med_before = argList2[int(len(argList2)/2)-2]
med = argList2[int(len(argList2)/2)-1]
med_after = argList2[int(len(argList2)/2)]

for a in argList:
    if( a <= med):
        print(med_after)
    else:
        print(med)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
l = l[0]
cnt = 0
for i in range(n):    
    if l[i]-1 > i:
        if( l[l[i]-1]-1 == i):
            cnt+=1
print(cnt)

Fixed submission:
n = int(input())
l = list(map(int, input().split())) 
cnt = 0
for i in range(n):    
    if l[i]-1 > i:
        if( l[l[i]-1]-1 == i):
            cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i) for i in input().split()]
A = [1]+[int(i) for i in input().split()]

P = 1
for i in range(1,N+1):
    A[i] *= A[i-1]

for i in range(K+1,N+1):
    if A[i]/A[i-K] > A[i-1]/A[i-K-1]:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for i in range(K,N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i) for i in input().split()]
A = [1]+[int(i) for i in input().split()]

P = 1
for i in range(1,N+1):
    A[i] *= A[i-1]

for i in range(K+1,N+1):
    if A[i]/A[i-K] > A[i-1]/A[i-K-1]:
        print('Yes')
    else:
        print('No')


Fixed submission:
N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for i in range(K,N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)

if N == 1:
    print('No')
    exit()
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')


Fixed submission:
S = list(input())
N = len(S)

if N%2 == 1:
    print('No')
    exit()
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')

Buggy python submission (verdict: Runtime Error):
S = list(input())
N = len(S)
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')


Fixed submission:
S = list(input())
N = len(S)

if N%2 == 1:
    print('No')
    exit()
for i in range(0,N,2):
    if S[i] != 'h' or S[i+1] != 'i':
        print('No')
        exit()

print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
li = [input() for i in range(N)]
li.sort()

key = set(li)
c = [0]*len(key)
ind = 0
ans = [[] for _ in range(len(key))]
for i in key:
    ans[ind] = [li.count(i), i]
    ind += 1

ans.sort(reverse=True)
p = ans[0][0]
q = []
for i in range(len(ans)):
    if ans[i][0] == p:
        q.append(ans[i][1])
q.sort()
[print(i) for i in q]


Fixed submission:
import sys
from bisect import bisect_left, bisect_right
input = sys.stdin.readline

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

key = set(li)
c = [0]*len(key)
ind = 0
ans = [[] for _ in range(len(key))]
for i in key:
    p = bisect_left(li,i)
    q = bisect_right(li,i)
    ans[ind] = [q-p, i]
    ind += 1

ans.sort(reverse=True)
p = ans[0][0]
q = []
for i in range(len(ans)):
    if ans[i][0] == p:
        q.append(ans[i][1])
q.sort()
[print(i,end='') for i in q]
Buggy python submission (verdict: Time Limit Exceeded):
H,N = [int(zz) for zz in input().split()]
mahou = [[int(zz) for zz in input().split()] for _ in range(N)]

dmg = [i[0] for i in mahou]
mp = [i[1] for i in mahou]

dp = [[0]*(H+1) for _ in range(N)]
for j in range(1,H+1):
    if j <= dmg[0]:
        dp[0][j] = mp[0]
    else:
        dp[0][j] = dp[0][j-dmg[0]]+mp[0]

for i in range(1,N):
    for j in range(1,H+1):
        if j <= dmg[i]:
            dp[i][j] = min(mp[i],dp[i-1][j])
        else:
            dp[i][j] = min(dp[i][j-dmg[i]]+mp[i],dp[i-1][j])

print(dp[-1][-1])


Fixed submission:
H,N = [int(zz) for zz in input().split()]
li = [[int(zz) for zz in input().split()] for _ in range(N)]

dp = [[0]*(H+1) for _ in range(N)]

for j in range(1,H+1):
    if j <= li[0][0]:
        dp[0][j] = li[0][1]
    else:
        dp[0][j] = dp[0][j-li[0][0]]+li[0][1]

for i in range(1,N):
    for j in range(1,H+1):
        if j <= li[i][0]:
            dp[i][j] = min(li[i][1],dp[i-1][j])
        else:
            dp[i][j] = min(dp[i][j-li[i][0]]+li[i][1],dp[i-1][j])

print(dp[-1][-1])

Buggy python submission (verdict: Time Limit Exceeded):
H,N = [int(zz) for zz in input().split()]
li = [[int(zz) for zz in input().split()] for _ in range(N)]

dp = [[0]*(H+1) for _ in range(N)]

for j in range(1,H+1):
    if j <= li[0][0]:
        dp[0][j] = li[0][1]
    else:
        dp[0][j] = dp[0][j-li[0][0]]+li[0][1]

for i in range(1,N):
    for j in range(1,H+1):
        if j <= li[i][0]:
            dp[i][j] = min(li[i][1],dp[i-1][j])
        else:
            dp[i][j] = min(dp[i][j-li[i][0]]+li[i][1],dp[i-1][j])

print(dp[-1][-1])


Fixed submission:
H,N = [int(zz) for zz in input().split()]
li = [[int(zz) for zz in input().split()] for _ in range(N)]

dp = [[0]*(H+1) for _ in range(N)]

for j in range(1,H+1):
    if j <= li[0][0]:
        dp[0][j] = li[0][1]
    else:
        dp[0][j] = dp[0][j-li[0][0]]+li[0][1]

for i in range(1,N):
    for j in range(1,H+1):
        if j <= li[i][0]:
            dp[i][j] = min(li[i][1],dp[i-1][j])
        else:
            dp[i][j] = min(dp[i][j-li[i][0]]+li[i][1],dp[i-1][j])

print(dp[-1][-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
from numpy import linalg as LA

N = int(input())
li = [[1,N]]

for i in range(2,int(np.sqrt(N))+1):
    if N%i == 0:
        li.append([i,N//i])

ans = 10**12
for i in li:
    x,y = i
    tmp = LA.norm([x-1,y-1],1)
    if ans > tmp:
        ans = tmp

print(ans)


Fixed submission:
X,Y = [int(zz) for zz in input().split()]

mod = 10**9+7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

a = (2*Y-X)/3
b = (2*X-Y)/3

if a != int(a):
    print(0)
    exit()

a = int(a)
b = int(b)
N = a+b

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans = cmb(N,a,mod)%(10**9+7)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

N = len(S)
p = S[0]
c = 0
for i in range(1,N):
    if S[i] == p:
        c += 1
        p = ''
    else:
        p = S[i]

ans = c*K
if S[0] == S[-1] and S[-2] != S[-1]:
    ans += K-1

print(ans)


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

N = len(S)
p = S[0]
c = 0

if N == 1:
    print(K//2)
    exit()

if len(set(S)) == 1:
    print(N*K//2)
    exit()

for i in range(1,N):
    if S[i] == p:
        c += 1
        p = ''
    else:
        p = S[i]

ans = c*K
if S[0] == S[-1]:
    p = S[0]
    c = 1
    for i in range(1,N):
        if p == S[i]:
            c += 1
        else:
            break

    d = 1
    for i in range(2,N+1):
        if p == S[-i]:
            d += 1
        else:
            break

    if (c%2)*(d%2) == 1:
        ans += K-1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(zz) for zz in input().split()]

[print(A.index(i+1)+1, end=' ') for i in range(N)]


Fixed submission:
N = int(input())
A = [[int(zz),i+1] for i,zz in enumerate(input().split())]
A.sort()

[print(i[1],end=' ') for i in A]
Buggy python submission (verdict: Runtime Error):
from math import gcd
from collections import Counter

A,B = [int(zz) for zz in input().split()]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

x = gcd(A,B)

print(len(set(prime_factorize(x)))+1)


Fixed submission:
from fractions import gcd

A,B = [int(zz) for zz in input().split()]

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

x = gcd(A,B)

print(len(set(prime_factorize(x)))+1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import sys
input = sys.stdin.readline

N = int(input())
S = [Counter(input()) for _ in range(N)]

ans = 0
T = []
ans = [1]*N
for i in range(N):
    if S[i] in T:
        p = T.index(S[i])
        ans[p] += 1
    else:
        T.append(S[i])

pp = 0
for i in ans:
    pp += (i-1)*i//2

print(pp)


Fixed submission:
from collections import Counter, defaultdict

N = int(input())
S = [Counter(input()) for _ in range(N)]

dd = defaultdict(int)

for i in S:
    p = 0
    for j in i:
        p += 26**(ord(j)-ord('a'))*(i[j])
    dd[p] += 1

ans = 0
a = dd.keys()
for i in a:
    ans += (dd[i]-1)*dd[i]//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
import sys
input = sys.stdin.readline

N = int(input())
S = [Counter(input()) for _ in range(N)]

ans = 0
T = []
ans = [1]*N
for i in range(N):
    if S[i] in T:
        p = T.index(S[i])
        ans[p] += 1
    else:
        T.append(S[i])

pp = 0
for i in ans:
    pp += (i-1)*i//2

print(pp)


Fixed submission:
from collections import Counter, defaultdict

N = int(input())
S = [Counter(input()) for _ in range(N)]

dd = defaultdict(int)

for i in S:
    p = 0
    for j in i:
        p += 26**(ord(j)-ord('a'))*(i[j])
    dd[p] += 1

ans = 0
a = dd.keys()
for i in a:
    ans += (dd[i]-1)*dd[i]//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
S = [Counter(input()) for _ in range(N)]

ans = 0
T = []
ans = [1]*N
for i in range(N):
    if S[i] in T:
        p = T.index(S[i])
        ans[p] += 1
    else:
        T.append(S[i])

pp = 0
for i in ans:
    pp += (i-1)*i//2

print(pp)


Fixed submission:
from collections import Counter, defaultdict

N = int(input())
S = [Counter(input()) for _ in range(N)]

dd = defaultdict(int)

for i in S:
    p = 0
    for j in i:
        p += 26**(ord(j)-ord('a'))*(i[j])
    dd[p] += 1

ans = 0
a = dd.keys()
for i in a:
    ans += (dd[i]-1)*dd[i]//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
S = [Counter(input()) for _ in range(N)]

ans = 0
for i in range(N):
    for j in range(i+1,N):
        if S[i] == S[j]:
            ans += 1

print(ans)


Fixed submission:
from collections import Counter, defaultdict

N = int(input())
S = [Counter(input()) for _ in range(N)]

dd = defaultdict(int)

for i in S:
    p = 0
    for j in i:
        p += 26**(ord(j)-ord('a'))*(i[j])
    dd[p] += 1

ans = 0
a = dd.keys()
for i in a:
    ans += (dd[i]-1)*dd[i]//2
print(ans)
Buggy python submission (verdict: Runtime Error):
-- [Char]あるいは String を Int にする
toInt :: (String -> Int)
toInt x = read x ::Int

--入力を受け取り、[Int]にする
getInts = do
  x <- getLine
  let y = (map$toInt)$words x -- 半角スペースで分割してInt にする
  return y

main = do
  _ <- getInts
  x <- getInts

  if ok x 0 == 1
    then putStrLn "Yes"
    else putStrLn "No"
  where
    ok x n =
      if null x
        then 1
        else if head x >= n
          then ok (tail x) $ max n $ (head x) - 1
          else 0


Fixed submission:
N = int(input())
H = [int(zz) for zz in input().split()][::-1]
p = H[0]

for i in range(N):
    if H[i] > p:
        H[i] -= 1
        if H[i] > p:
            print('No')
            exit()
    p = H[i]

print('Yes')