ZhenlongDai/ACPR huggingface dataset:
Problem: p02900
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import stdin, setrecursionlimit


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


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True


def main():
    input = stdin.buffer.readline
    a, b = map(int, input().split())
    g = gcd(a, b)

    ans = 1
    for i in range(1, int(g ** 0.5) + 2):
        if g % i == 0 and is_prime(i):
            ans += 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Failing test case input:
442 17

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from sys import stdin, setrecursionlimit


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


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True


def main():
    input = stdin.buffer.readline
    a, b = map(int, input().split())
    g = gcd(a, b)

    ans = 1
    for i in range(1, int(g ** 0.5) + 1):
        if g % i == 0:
            if is_prime(i):
                ans += 1
            if is_prime(g 
                ans += 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def euc(x,y):
  while x != y:
    if x > y:
      x -= y
    if x < y:
      y -= x
  return x

A,B = list(map(int, input().split()))
k = euc(A,B)
r = 1
s = 0
w = 1
while r**2 <= k:
  r += 1
  if k % r == 0:
    s += 1
    while k % r == 0:
      k /= r
    if k == 1:
      w = 0
s += w 
print(s)


Failing test case input:
6 2844

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
def euc(x,y):
  while x != y:
    if x > y:
      x -= y
    if x < y:
      y -= x
  return x

A,B = list(map(int, input().split()))
k = l = euc(A,B)
r = 1
s = 0
w = 1
while r**2 <= k:
  r += 1
  if k % r == 0:
    s += 1
    while k % r == 0:
      k /= r
    if k == 1:
      w = 0
s += w
if l != 1:
  s += 1
print(s)
Problem: p02900
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys

input = sys.stdin.readline


class AtCoder:

    def gcd(self, a, b):
        if b == 0:
            return a
        else:
            return self.gcd(b, a % b)

    def factorize(self, n):
        p = 2
        res = 1
        tmp = n
        while p * p < n:
            if tmp % p == 0:
                res += 1
                while tmp % p == 0:
                    tmp /= p
            p += 1
        return res

    def main(self):
        A, B = map(int, input().split())

        _gcd = self.gcd(A, B)
        print(self.factorize(_gcd))



if __name__ == '__main__':
    AtCoder().main()


Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import sys

input = sys.stdin.readline


class AtCoder:

    def gcd(self, a, b):
        if b == 0:
            return a
        else:
            return self.gcd(b, a % b)

    def factorize(self, n):
        p = 2
        res = 1
        while p * p < n:
            if n % p == 0:
                res += 1
                while n % p == 0:
                    n /= p
            p += 1
        if n != 1:
            res += 1
        return res

    def main(self):
        A, B = map(int, input().split())

        _gcd = self.gcd(A, B)
        print(self.factorize(_gcd))



if __name__ == '__main__':
    AtCoder().main()

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math


def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = gcd(a, b)
    d = {}

    min_n = min([a, b])

    for i in range(2, g):
        while True:
            if g % i == 0:
                g /= i
                d[i] = i
            else:
                break

    print(len(d) + 1)


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


if __name__ == "__main__":
    main()


Failing test case input:
42 9

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math


def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = n = gcd(a, b)
    d = {}

    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i:
            continue
        d[i] = i
        while n % i == 0:
            n /= i

    if n != 1:
        d[n] = n

    print(len(d) + 1)


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


if __name__ == "__main__":
    main()
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

def pf(n):
    ans=[1]
    i=2
    while(n!=1):
        if (n%i==0):
            while(n%i==0):
                n=n/i
            ans.append(i)
        i+=1
    return ans

a,b = map(int,input().split())
pfa=pf(a)
pfb=pf(b)
ans=0
for i in pfa:
    if(i in pfa):
        ans+=1
print(ans)


Failing test case input:
411 17

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
import math

def pf(n):
    ans=[1]
    i=2
    if(n%i==0):
        while(n%2==0):
            n = n/i
        ans.append(i)
    i+=1
    while(i<math.sqrt(n) and n!=1):
        if (n%i==0):
            while(n%i==0):
                n=n/i
            ans.append(i)
        i+=2
    if(n!=1):
        ans.append(n)
    return set(ans)

a,b = map(int,input().split())
pfa=pf(a)
a=0
for i in pfa:
    if(b%i==0):
        a+=1
print(a)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def common_divisor(a, b):
    
    res = []
    for i in range(2, int(a**0.5)+1):
        if a % i == 0 and b % i == 0:
            res.append(i)
            t = a 
            if i != t and b % t == 0:
                res.append(t)
    return sorted(res)

def primes_num(arr):
    res = 0
    for i in arr:
        flg = True
        rt_i = i**0.5
        for j in arr:
            if rt_i <= j:
                break
            elif i % j == 0:
                flg = False
                break
        if flg: res += 1
    return res

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


cds = common_divisor(A, B)
print(primes_num(cds)+1)


Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
A, B = sorted([int(i) for i in input().split()])

res = 1
for i in range(2, int(B**0.5)+1):
    if B % i == 0:
        if A % i == 0:
            for j in range(2, int(i**0.5)+1):
                if i % j == 0:
                    break
            else:
                res += 1
        t = B 
        if t != i and A % t == 0:
            for j in range(2, int(t**0.5)+1):
                if t % j == 0:
                    break
            else:
                res += 1

print(res if res > 1 else (1 if (A == B == 1) or A != B else 2))

Problem: p02900
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import math

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())

a, b = nm()

n = math.gcd(a,b)

m = int(n**(1/2))

print(n)

count = 1 
for i in range(2, n+1):
    if n%i ==0:
        count +=1
        while n%i == 0:
            n = n/i
    if n ==1:
        break

print(count)

Failing test case input:
6 1591

Expected output:
1


Actual output:
1
1


Fixed submission (verdict: Accepted):
import sys
import math

stdin = sys.stdin

nm = lambda: map(int, stdin.readline().split())

a, b = nm()

n = math.gcd(a,b)

count = 1 
for i in range(2, int(n**(1/2))+1):
    if n%i ==0:
        count +=1
        while n%i == 0:
            n = n/i
    if n ==1:
        break
if n != 1:
    count += 1

print(count)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)
    for x in range(3,k,1):
        if(k % x == 0):
            while k %x == 0:
                k/=x
                a.append(x)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))


Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        while k %2 == 0:
            k /=2
        a.append(2)
    k =int(k)

    for x in range(3,end,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    if k != 1:
        a.append(k)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=A,A%B
if B==1:
    print(1)
else:
    count=2
    i=2
    while i**2<B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    print(count)

Failing test case input:
42 9

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
a=input().split(" ")
A=int(a[0])
B=int(a[1])
if A<B:
    A,B=B,A
while A%B!=0:
    A,B=B,A%B
if B==1:
    print(1)
else:
    count=1
    i=2
    while i**2<=B:
        if B%i==0:
            count+=1
            while B%i==0:
                B/=i
        i+=1
    if B!=1:
        count+=1
    print(count)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(a, a % b)

def prime_factorize(n):
    lst = []
    while n % 2 == 0:
        lst.append(2)
        n = n / 2
    a = 3
    while n > 1:
        if n % a == 0:
            lst.append(a)
            n = n / a
        else:
            a += 2
    return lst

A, B = map(int, input().split())
print(1 + len(set(prime_factorize(gcd(A, B)))))

Failing test case input:
836 71

Expected output:
1


Actual output:
4


Fixed submission (verdict: Accepted):
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
 
def prime_factorize(n):
    a = 2
    lst = []
    while a * a <= n:
        if n % a == 0:
            n = n / a
            lst.append(a)
        else:
            a += 1
    if n > 1:
        lst.append(n)
    return lst
 
A, B = map(int, input().split())
n = gcd(A, B)
lst = prime_factorize(n)
print(len(set(lst)) + 1)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
 
D = input().split(' ')
A = int(D[0])
B = int(D[1])

result = []
result.append(1)

a_result = []
b_result = []

for i in range(2, int(A**0.5) + 2):
    flg = 0
    while A % i == 0:
        if flg == 0:
            a_result.append(i)
            flg = 1
            
        A = A / i
        
for i in range(2, int(B**0.5) + 2):
    flg = 0
    while B % i == 0:
        if flg == 0:
            b_result.append(i)
            flg = 1
            
        B = B / i
print(len(a_result) + len(b_result) - len(set(a_result + b_result)) + 1)

    

Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import math
 
D = input().split(' ')
A = int(D[0])
B = int(D[1])

result = []
result.append(1)

a_result = []
b_result = []

for i in range(2, int(A**0.5) + 2):
    flg = 0
    while A % i == 0:
        if flg == 0:
            a_result.append(i)
            flg = 1
            
        A = A / i
if A != 1:
  a_result.append(A)
        
for i in range(2, int(B**0.5) + 2):
    flg = 0
    while B % i == 0:
        if flg == 0:
            b_result.append(i)
            flg = 1
            
        B = B / i
if B != 1:
  a_result.append(B)
  
print(len(a_result) + len(b_result) - len(set(a_result + b_result)) + 1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve(n):
    res = set()
    for i in range(2, n):
        while n % i == 0:
            res.add(i)
            n /= i
    res.add(1)
    return res


def gcd(a, b):
    if a > b:
        a, b = b, a
    c = b % a
    if c == 0: return a
    return gcd(c, a)




A, B = [int(_) for _ in input().split()]
g = gcd(A, B)
print(len(solve(g)))

Failing test case input:
2 1692

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    if n>1:
        res.add(n)
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+2):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))


Failing test case input:
3 4371

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from math import sqrt


def solve(n):
    res = set()
    for i in range(2, int(sqrt(n))+1):
        while n % i == 0:
            res.add(i)
            n /= i
        if(n<=1): break
    if n>1:
        res.add(n)
    res.add(1)
    return res


A, B = [int(_) for _ in input().split()]
print(len(solve(A) & solve(B)))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b = map(int, input().split())

import math

def prime(n):
  i = 1
  while i < int(math.sqrt(n)):
    i += 1
    if n%i == 0:
      return False
  else:
    return True



l = []
for i in range(1, min(int(math.sqrt(a))+2, int(math.sqrt(b))+2)):
  if i == 1:
    l.append(i)
  else:
    if a%i == 0 and b%i == 0 and prime(i):
      l.append(i)
    j = a
    if j != 0:
      if b%j == 0 and prime(j):
        l.append(j)
    k = b
    if k != 0:
      if a%k == 0 and prime(k):
        l.append(k)

print(len(set(l)))
               

Failing test case input:
10 6430

Expected output:
3


Actual output:
2


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

import math

def prime(n):
  if n == 1:
    return False
  i = 1
  while i < int(math.sqrt(n)):
    i += 1
    if n%i == 0:
      return False
  else:
    return True



if prime(a) and prime(b) and a==b:
  print(2)
  exit()
  
if a-b == 1 or b-a == 1:
  print(1)
  exit()

l = []
for i in range(1, max(int(math.sqrt(a))+2, int(math.sqrt(b))+2)):
  if i == 1:
    l.append(i)
  else:
    if a%i == 0 and b%i == 0 and prime(i):
      l.append(i)
    j = a
    if j != 0:
      if b%j == 0 and prime(j):
        l.append(j)
    k = b
    if k != 0:
      if a%k == 0 and prime(k):
        l.append(k)

print(len(set(l)))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +2):
        if n%i==0 and n!=2:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
checked=[]
for i in range(1, int(math.sqrt(p) + 1e-9) +2):
    checked.append(i)
    if p%i==0 and q%i==0:
        ans+=func(i)

if p not in checked:
    if func(p)==1 and q%p==0:
        ans+=1

print(ans)


Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +3):
        if n%i==0 and n!=i:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
check=[]
for i in range(1, int(math.sqrt(p)+ 1e-9)+3):
    if p%i==0:
        if i not in check:
            check.append(i)
        if p
            check.append(p

for i in check:
    if q%i==0:
        ans+=func(i)

print(ans)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt

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

L = []

if a < b: a,b = b,a
while b!=0:
    r = a%b
    a,b = b,r
    
G = a

for i in range(2,G+1):
    for j in L:
        if i%j==0: 
            break
        if G%i==0: 
            L.append(i)

print(len(L)+1)   

Failing test case input:
16 6430

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from math import sqrt

a,b = map(int,input().split())
 
L = []
 
if a < b: a,b = b,a
while b!=0:
    r = a%b
    a,b = b,r
 
G = a
 
for i in range(2,int(sqrt(G))+1):
    if G%i==0:
        L.append(i)
        while G%i==0:
            G/=i

if G!=1:
    L.append(G)

print(len(L)+1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +3):
        if n%i==0 and n!=i:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
check=[]
for i in range(1, int(math.sqrt(p)+ 1e-9)+3):
    if p%i==0:
        check.append(i)
        check.append(p/i)

for i in check:
    if q%i==0:
        ans+=func(i)

print(ans)

Failing test case input:
42 9

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +3):
        if n%i==0 and n!=i:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
check=[]
for i in range(1, int(math.sqrt(p)+ 1e-9)+3):
    if p%i==0:
        if i not in check:
            check.append(i)
        if p
            check.append(p

for i in check:
    if q%i==0:
        ans+=func(i)

print(ans)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%n==0: 
        a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(trial_division(A,B))+1)

Failing test case input:
420 324

Expected output:
3


Actual output:
6


Fixed submission (verdict: Accepted):
def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%n==0: 
        a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(A,B)))+1)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())
ls = []
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    for n in range(2,int(i**0.5)+1):
      if i%n==0:
        break
    else:
      ans += 1
    j = A
    if i==j:
      continue
    for n in range(2,int(j**0.5)+1):
      if j%n==0:
        break
    else:
      ans += 1
print(ans)

Failing test case input:
11 949

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A
    if B%j!=0:
      continue
  elif B%i==0:
    j = B
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b = map(int,input().split())
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)
count = 0
max_gcd = gcd(a,b)

for i in range(1,max_gcd+1):
    if i>max_gcd:
        break
    if max_gcd%i == 0:
        count += 1
        max_gcd = max_gcd/i
print(count)


Failing test case input:
16 7064

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):

a,b = map(int,input().split())
def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)
def waru(max_gcd,x):
    if max_gcd%x != 0:
        return max_gcd
    else:
        return waru(max_gcd

count = 0
max_gcd = gcd(a,b)

for i in range(2,max_gcd+1):
    if i*i > max_gcd:
        break
    if max_gcd%i == 0:
        count += 1
        max_gcd = waru(max_gcd,i)
if max_gcd == 1:
    print(count+1)
else:
    print(count+2)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p = list(set(p))
print(len(p))
  
  


Failing test case input:
42 9

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def calcDiv(n):
    d_list = [1]
    for i in range(2, int(n**(1/2))+1):
        if n%i == 0:
            d_list.append(i)
            d_list.append(int(n/i))
    return d_list


def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True


if __name__ == "__main__":    
    a, b = map(int, input().split())
    a_list = calcDiv(a)
    b_list = calcDiv(b)
    d_list = set(a_list) & set(b_list)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)


Failing test case input:
2 1692

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
def calcDiv(n):
    d_list = []
    for i in range(1, int(n**(1/2))+1):
        if n%i == 0:
            d_list.append(i)
            d_list.append(int(n/i))
    return d_list


def isPrime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True


if __name__ == "__main__":    
    a, b = map(int, input().split())
    a_list = calcDiv(a)
    b_list = calcDiv(b)
    d_list = set(a_list) & set(b_list)
    cnt = 0
    for d in d_list:
        if isPrime(d):
            cnt += 1
    print(cnt)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def common_divisor(a, b):
    
    res = []
    for i in range(2, int(a**0.5)+1):
        if a % i == 0 and b % i == 0:
            res.append(i)
            
            
                
    return sorted(res)

def primes_num(arr):
    res = 0
    for i in arr:
        flg = True
        rt_i = i**0.5
        for j in arr:
            if rt_i < j:
                break
            elif i % j == 0:
                flg = False
                break
        if flg: res += 1
    return res

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


cds = common_divisor(A, B)
res = primes_num(cds)
print(res+1)


Failing test case input:
10 6430

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
A, B = sorted([int(i) for i in input().split()])

res = 1
for i in range(2, int(B**0.5)+1):
    if B % i == 0:
        if A % i == 0:
            for j in range(2, int(i**0.5)+1):
                if i % j == 0:
                    break
            else:
                res += 1
        t = B 
        if t != i and A % t == 0:
            for j in range(2, int(t**0.5)+1):
                if t % j == 0:
                    break
            else:
                res += 1

print(res if res > 1 else (1 if (A == B == 1) or A != B else 2))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    if k % 2 == 0:
        k /=2
        a.append(2)
    k =int(k)

    for x in range(3,k+1,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))


Failing test case input:
16 7064

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
def mkou(A,B):
    x = A%B
    if  x== 0:
        return B
    else:
        return mkou(B,x)
        
def prime_F(k):
    a =[1,]
    end = int(pow(k,0.5))
    if k % 2 == 0:
        while k %2 == 0:
            k /=2
        a.append(2)
    k =int(k)

    for x in range(3,end,1):
        if k % x == 0:
            while k %x == 0:
                k/=x
            a.append(x)
            if k == 1:
                break
    if k != 1:
        a.append(k)
    return a
            
A,B = map(int,input().split())
divA_array = []
divB_array = []
if A<B:
    A,B =B,A

kouyaku = mkou(A,B)
soinsu =prime_F(kouyaku)
print(len(soinsu))

Problem: p02900
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import stdin, setrecursionlimit


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


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True


def main():
    input = stdin.buffer.readline
    a, b = map(int, input().split())
    g = gcd(a, b)

    ans = 1
    for i in range(1, int(g ** 0.5) + 1):
        if g % i == 0 and is_prime(i):
            ans += 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


Failing test case input:
4 4794

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from sys import stdin, setrecursionlimit


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


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    return True


def main():
    input = stdin.buffer.readline
    a, b = map(int, input().split())
    g = gcd(a, b)

    ans = 1
    for i in range(1, int(g ** 0.5) + 1):
        if g % i == 0:
            if is_prime(i):
                ans += 1
            if is_prime(g 
                ans += 1

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import sqrt
def get_divisor(num):
	return [i for i in range(1,num+1) if num % i == 0]

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in range(2,int(sqrt(num))+1):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print(len(c_prime))

Failing test case input:
313 17

Expected output:
1


Actual output:
0


Fixed submission (verdict: Accepted):
from math import sqrt
def get_divisor(num):
	arr = [i for i in range(1,int(sqrt(num))+1) if num % i == 0]
	arr += [num 
	return arr

def get_common(num1, num2):
	list_a = get_divisor(num1)
	list_b = get_divisor(num2)
	return [i for i in list_a if i in list_b]

def prime_ch(num):
	if num == 1:
		return False
	for i in list(range(2,int(sqrt(num))+1)):
		if num % i == 0:
			return False
	return True


A,B = list(map(int,input().split()))[:2]
common = get_common(A,B)
c_prime = [p for p in common if prime_ch(p)]
print((len(c_prime)+1))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A = [int(i) for i in input().split()]

prime_num = [[],[]]

prime_num[0].append(1)
prime_num[1].append(1)

for i in range(2):
    a = 2
    n = A[i]
    while A[i] >= a*a:
        if n%a == 0:
            prime_num[i].append(a)
            n /= a
        else:
            a+=1

print(len(set(prime_num[0])&set(prime_num[1])))


Failing test case input:
2 1692

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
A = [int(i) for i in input().split()]

prime_num = [[],[]]

prime_num[0].append(1)
prime_num[1].append(1)

for i in range(2):
    a = 2
    n = A[i]
    while A[i] >= a*a:
        if n%a == 0:
            prime_num[i].append(a)
            n /= a
        else:
            a+=1
    prime_num[i].append(n)
    


print(len(set(prime_num[0])&set(prime_num[1])))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())


div1 = set()
for i in range(1, int(A ** 0.5) + 10):
    if A % i == 0:
        div1.add(i)

div2 = set()
for i in range(1, int(B ** 0.5) + 10):
    if B % i == 0:
        div2.add(i)

div = div1 & div2

cnt = 1
for d in list(div):
    if d == 1:
        continue
    flg = True
    for i in range(2, int(d ** 0.5) + 2):
        if d % i == 0:
            if i in (div-{d}):
                flg = False
                break
    if flg:
        cnt += 1

print(cnt)

Failing test case input:
442 17

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
A, B = map(int, input().split())


div1 = set()
for i in range(1, int(A ** 0.5) + 1):
    if A % i == 0:
        div1.add(i)
        if i != A 
            div1.add(A 

div2 = set()
for i in range(1, int(B ** 0.5) + 1):
    if B % i == 0:
        div2.add(i)
        if i != B 
            div2.add(B 

div = div1 & div2

cnt = 1
for d in list(div):
    if d == 1:
        continue
    flg = True
    for i in range(2, int(d ** 0.5) + 1):
        if d % i == 0:
            if i in (div-{d}):
                flg = False
                break
    if flg:
        cnt += 1

print(cnt)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +1):
        if n%i==0:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
for i in range(1, int(math.sqrt(p) + 1e-9) +1):
    if p%i==0 and q%i==0:
        ans+=func(i)

print(ans)


Failing test case input:
442 17

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +3):
        if n%i==0 and n!=i:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
check=[]
for i in range(1, int(math.sqrt(p)+ 1e-9)+3):
    if p%i==0:
        if i not in check:
            check.append(i)
        if p
            check.append(p

for i in check:
    if q%i==0:
        ans+=func(i)

print(ans)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a, b):
    if a % b == 0:
        return a
    else:
        return gcd(b, a % b)

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

A, B = map(int, input().split())
n = gcd(A, B)
lst = prime_factorize(n)
print(len(set(lst)) + 1)

Failing test case input:
154 25

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)
 
def prime_factorize(n):
    a = 2
    lst = []
    while a * a <= n:
        if n % a == 0:
            n = n / a
            lst.append(a)
        else:
            a += 1
    if n > 1:
        lst.append(n)
    return lst
 
A, B = map(int, input().split())
n = gcd(A, B)
lst = prime_factorize(n)
print(len(set(lst)) + 1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    a, b = map(int, input().split(' '))
    d_s = make_divisors(a, b)
    
    ans = 0
    for d in reversed(d_s):

        flg = True
        for j in d_s[1:]:
            if d == j:
                continue
            if d % j == 0:
                flg = False
                break
        if flg:
            ans += 1
    print(ans)


def make_divisors(a, b):
    divisors = []
    n = min(a, b)
    for i in range(1, int(n**0.5)+1):
        if a % i == 0 and b % i == 0:
            divisors.append(i)
    return divisors


if __name__ == '__main__':
    main()


Failing test case input:
6 2844

Expected output:
3


Actual output:
2


Fixed submission (verdict: Accepted):
def main():
    a, b = map(int, input().split(' '))
    d_s = make_divisors(a, b)

    ans = []

    for j in d_s:
        flg = True
        for k in d_s:
            if k == 1 or j == k:
                continue
            if j % k == 0:
                flg = False
                break
        if flg:
            ans.append(j)
    print(len(ans))


def make_divisors(a, b):
    A = []
    B = []
    n = max(a, b)
    for i in range(1, int(n**0.5)+1):
        if a % i == 0:
            A.append(i)
            if i != a 
                A.append(a
        if b % i == 0:
            B.append(i)
            if i != b 
                B.append(b
    return list(set(A) & set(B))


if __name__ == '__main__':
    main()
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a, b = map(int, input().split())

import math

def prime(n):
  i = 1
  while i < int(math.sqrt(n)):
    i += 1
    if n%i == 0:
      return False
  else:
    return True



l = []
for i in range(1, min(int(math.sqrt(a))+1, int(math.sqrt(b))+1)):
  if i == 1:
    l.append(i)
  else:
    if a%i == 0 and b%i == 0 and prime(i):
      l.append(i)
    j = a
    if b%j == 0 and prime(j):
      l.append(j)
    k = b
    if a%k == 0 and prime(k):
      l.append(k)

print(len(set(l)))
               

Failing test case input:
2 1692

Expected output:
2


Actual output:
1


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

import math

def prime(n):
  if n == 1:
    return False
  i = 1
  while i < int(math.sqrt(n)):
    i += 1
    if n%i == 0:
      return False
  else:
    return True



if prime(a) and prime(b) and a==b:
  print(2)
  exit()
  
if a-b == 1 or b-a == 1:
  print(1)
  exit()

l = []
for i in range(1, max(int(math.sqrt(a))+2, int(math.sqrt(b))+2)):
  if i == 1:
    l.append(i)
  else:
    if a%i == 0 and b%i == 0 and prime(i):
      l.append(i)
    j = a
    if j != 0:
      if b%j == 0 and prime(j):
        l.append(j)
    k = b
    if k != 0:
      if a%k == 0 and prime(k):
        l.append(k)

print(len(set(l)))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
 
D = input().split(' ')
A = int(D[0])
B = int(D[1])

result = []
result.append(1)

a_result = []
b_result = []

for i in range(2, int(A**0.5) + 2):
    flg = 0
    while A % i == 0:
        if flg == 0:
            a_result.append(i)
            flg = 1
            
        A = A / i
        
for i in range(2, int(B**0.5) + 2):
    flg = 0
    while B % i == 0:
        if flg == 0:
            b_result.append(i)
            flg = 1
            
        B = B / i

print(len(set(a_result + b_result)) + 1)
    

Failing test case input:
5 1324

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
import math
 
D = input().split(' ')
A = int(D[0])
B = int(D[1])

result = []
result.append(1)

a_result = []
b_result = []

for i in range(2, int(A**0.5) + 2):
    flg = 0
    while A % i == 0:
        if flg == 0:
            a_result.append(i)
            flg = 1
            
        A = A / i
if A != 1:
  a_result.append(A)
        
for i in range(2, int(B**0.5) + 2):
    flg = 0
    while B % i == 0:
        if flg == 0:
            b_result.append(i)
            flg = 1
            
        B = B / i
if B != 1:
  a_result.append(B)
  
print(len(a_result) + len(b_result) - len(set(a_result + b_result)) + 1)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def common_divisor(a, b):
    
    res = []
    for i in range(2, int(a**0.5)+1):
        if a % i == 0 and b % i == 0:
            res.append(i)
            t = a 
            if i != t and b % t == 0:
                res.append(t)
    return sorted(res)

def primes_num(arr):
    res = 0
    for i in arr:
        flg = True
        rt_i = i**0.5
        for j in arr:
            if rt_i < j:
                break
            elif i % j == 0:
                flg = False
                break
        if flg: res += 1
    return res

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


cds = common_divisor(A, B)
print(primes_num(cds)+1)


Failing test case input:
3 2019

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
A, B = sorted([int(i) for i in input().split()])

res = 1
for i in range(2, int(B**0.5)+1):
    if B % i == 0:
        if A % i == 0:
            for j in range(2, int(i**0.5)+1):
                if i % j == 0:
                    break
            else:
                res += 1
        t = B 
        if t != i and A % t == 0:
            for j in range(2, int(t**0.5)+1):
                if t % j == 0:
                    break
            else:
                res += 1

print(res if res > 1 else (1 if (A == B == 1) or A != B else 2))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

def coprime(a, b):
    return gcd(a, b) == 1

A , B = map(int , input().split())
A = 100000000000
B = 50000000000
gcd_value = gcd(A , B)
cd = []

for i in range(1,100000):
    if A % i == 0 and B % i == 0 and is_prime(i):
        cd.append(i)
print(len(cd) + 1)

Failing test case input:
3 1324

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
def gcd( x, y ):
    while y != 0:
        x, y = y, x%y
    return x

def coprime(a, b):
    return gcd(a, b) == 1

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n 
                divisors.append(n

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




gcd_value = gcd(A , B)
cd = []
div = make_divisors(gcd_value)

for i in range(len(div)):
    if A % div[i] == 0 and B % div[i] == 0 and is_prime(div[i]):
        cd.append(div[i])
print(len(cd) + 1)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
    
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

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

gcd_AB = gcd(A, B)
cd = []
for i in range(2, int(math.sqrt(gcd_AB)) + 2):
    if A % i == 0 and B % i == 0:
        cd.append(i)

count = 1
for i in range(len(cd)):
    if is_prime(cd[i]) == True:
        count += 1

print(count)

Failing test case input:
3 2019

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import fractions
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True
    
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n 
                divisors.append(n
    return divisors
    
A, B = map(int, input().split())

ans = 1
tmp = make_divisors(fractions.gcd(A ,B))
for x in tmp:
    if is_prime(x):
        ans += 1

print(ans)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int, input().split())
ls = []
ans = 0
for i in range(1, min(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    for n in range(2,int(i**0.5)+1):
      if i%n==0:
        break
    else:
      ans += 1
    j = A
    if (i!=1 and j%i==0) or j<=i or B%j!=0:
      continue
    for n in range(2,int(j**0.5)+1):
      if j%n==0:
        break
    else:
      ans += 1
print(ans)

Failing test case input:
442 17

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
from collections import defaultdict
A, B = map(int, input().split())
ls = defaultdict(int)
ans = 0
for i in range(1, max(int(A**0.5)+1, int(B**0.5)+1)):
  if A%i==0 and B%i==0:
    if ls[i]==0:
      ls[i]=1
      for n in range(2,int(i**0.5)+1):
        if i%n==0:
          break
      else:
        ans += 1
  if A%i==0:
    j = A
    if B%j!=0:
      continue
  elif B%i==0:
    j = B
    if A%j!=0:
      continue
  else:
    continue
  if ls[j]==0:
    ls[j] = 1
  else:
    continue
  for n in range(2,int(j**0.5)+1):
    if j%n==0:
      break
  else:
    ans += 1
print(ans)
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math


def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = gcd(a, b)
    d = {}

    min_n = min([a, b])

    for i in range(2, int(math.sqrt(min_n + 1))):
        while True:
            if g % i == 0:
                g /= i
                d[i] = i
            else:
                break

    print(len(d) + 1)


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


if __name__ == "__main__":
    main()


Failing test case input:
6 2844

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
import math


def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = n = gcd(a, b)
    d = {}

    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i:
            continue
        d[i] = i
        while n % i == 0:
            n /= i

    if n != 1:
        d[n] = n

    print(len(d) + 1)


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


if __name__ == "__main__":
    main()

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def decomposition_prime(n):
    i = 2
    li = []
    while i <= n:
        if n%i == 0:
            li.append(i)
            n /= i
        i += 1
    return li

a, b = map(int, input().split())
ap = decomposition_prime(a)
bp = decomposition_prime(b)

print(len(set(ap) & set(bp))+1)

Failing test case input:
16 11968

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
def decomposition_prime(n):
    i = 2
    li = []
    while i*i <= n:
        while n%i == 0:
            li.append(i)
            n /= i
        i += 1
    if n > 1:
        li.append(int(n))
    return li

a, b = map(int, input().split())
ap = decomposition_prime(a)
bp = decomposition_prime(b)

print(len(set(ap) & set(bp))+1)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
for n in range(2,int(math.sqrt(x))+1):
  if x % n == 0:
    x /= n
    p.append(n)
  else:
    p.append(int(x))
p = list(set(p))
print(len(p))
  
  


Failing test case input:
4 4794

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
import math
A,B = map(int, input().split())


y = max(A,B)
x = min(A,B)
while y%x != 0:
  tmp = x
  x = y%x
  y = tmp


p = []
tmp = int(math.sqrt(x))+1
for n in range(2,tmp):
  while x % n == 0:
    x /= n
    p.append(n)
p.append(int(x))
p.append(1)
p = list(set(p))
print(len(p))
Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
A, B = map(int,input().split())
def gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0: return a
    r = a % b
    return gcd(b,r)

L = [1]

g = gcd(A, B)
i = 2
while g > 1:
    if i > g ** (1/2): break
    if g % i == 0:
        if L[-1] != i:
            L.append(i)
        g /= i
    else:
        i += 1
print(len(L))


Failing test case input:
3 2019

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
A, B = map(int,input().split())
def gcd(a,b):
    if a < b:
        a,b = b,a
    if b == 0: return a
    r = a % b
    return gcd(b,r)

L = [1]

g = gcd(A, B)
g_copy = gcd(A, B)
i = 2
while g > 1:
    if i > g_copy ** (1/2) :
        if g != 1:
            L.append(i)
        break
    if g % i == 0:
        if L[-1] != i:
            L.append(i)
        g /= i
    else:
        i += 1
print(len(L))

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +2):
        if n%i==0 and n!=2:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
for i in range(1, int(math.sqrt(p) + 1e-9) +2):
    if p%i==0 and q%i==0:
        ans+=func(i)

print(ans)

Failing test case input:
11 11968

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math

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

def func(n):
    num=1
    for i in range(2,int(math.sqrt(n) + 1e-9) +3):
        if n%i==0 and n!=i:
            num=0
            break
        else:
            continue
    return num

p=min(A,B)
q=max(A,B)

ans=0
check=[]
for i in range(1, int(math.sqrt(p)+ 1e-9)+3):
    if p%i==0:
        if i not in check:
            check.append(i)
        if p
            check.append(p

for i in check:
    if q%i==0:
        ans+=func(i)

print(ans)

Problem: p02900
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%f==0: a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(trial_division(A,B))+1)

Failing test case input:
10 3453

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%n==0: 
        a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(A,B)))+1)