Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

cnt = 0
while True:
    for i in range(len(A)):
        if A[i] % 2 != 0:
            break
    else:
        A = [a/2 for a in A]
        cnt += 1

print(cnt)


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

cnt = 0
while True:
    for i in range(len(A)):
        if A[i] % 2 != 0:
            break
    else:
        A = [a/2 for a in A]
        cnt += 1
        continue
    break

print(cnt)
Buggy python submission (verdict: Runtime Error):
S = input()


for i in range(2**3):
    formula = ""

    for j in range(4):
        formula += S[j]
        if (i >> j) & 1:
            formula += "+"
        else:
            formula += "-"

    if eval(formula) == 7:
        print(formula + "=7")
        break

Fixed submission:
S = input()


for i in range(2**3):
    formula = ""

    for j in range(3):
        formula += S[j]
        if (i >> j) & 1:
            formula += "+"
        else:
            formula += "-"
    formula += S[-1]

    if eval(formula) == 7:
        print(formula + "=7")
        break
Buggy python submission (verdict: Runtime Error):
r = int(input())
g = int(input())

print(r+2g)

Fixed submission:
r = int(input())
g = int(input())

print(2*g-r)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input())
if a==b:
  print(c)
elif a==c:
  print(b)
elif b==c:
  print(a)

Fixed submission:
a,b,c = map(int, input().split())
if a==b:
  print(c)
elif a==c:
  print(b)
elif b==c:
  print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

for t in T:
    if t in D:
        D.remove(t)
    else:
        print("NO")
        break
else:
    print("YES")

Fixed submission:
N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

dicD = {}
dicT = {}

for d in D:
    if d not in dicD:
        dicD[d] = 0
    dicD[d] += 1

for t in T:
    if t not in dicT:
        dicT[t] = 0
    dicT[t] += 1

for t in dicT:
    if t not in dicD:
        print("NO")
        break
    elif dicT[t] > dicD[t]:
        print("NO")
        break
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = list(map(int, input().split()))

sum_len = 0
for i in X:
    if X < abs(K-X[i]):
        sum_len += X * 2
    else:
        sum_len += abs(K-X[i]) * 2

print(sum_len)

Fixed submission:
N = int(input())
K = int(input())
X = list(map(int, input().split()))

sum_len = 0
for i in range(len(X)):
    if X[i] < abs(K-X[i]):
        sum_len += X[i] * 2
    else:
        sum_len += abs(K-X[i]) * 2

print(sum_len)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(10 ** 5 + 2)]

for a in A:
    L[a] += 1

ans = 0
for i in range(1,100001):
    ans = max(ans,L[i-1]+L[i]+L[i+1])

print(ans)

Fixed submission:
x, t = map(int, input().split())
print(x-t if x-t>0 else 0)

Buggy python submission (verdict: Runtime Error):
x, t = imap(int, input().split())
print(x-t if x-t>0 else 0)

Fixed submission:
x, t = map(int, input().split())
print(x-t if x-t>0 else 0)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

L = [0 for _ in range(10 ** 5 + 1)]

for a in A:
    L[a] += 1

ans = 0
for i in range(1,100001):
    ans = max(ans,L[i-1]+L[i]+L[i+1])

print(ans)

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

L = [0 for _ in range(10 ** 5 + 2)]

for a in A:
    L[a] += 1

ans = 0
for i in range(1,100001):
    ans = max(ans,L[i-1]+L[i]+L[i+1])

print(ans)
Buggy python submission (verdict: Runtime Error):
s = list(input())
alpha = ["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"]
for x in s:
    alpha.remove(x)
print(alpha[0] if len(alpha)>0 else "None")

Fixed submission:
s = list(input())
alpha = ["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"]
for x in s:
    if x in alpha:
        alpha.remove(x)
print(alpha[0] if len(alpha)>0 else "None")
Buggy python submission (verdict: Runtime Error):
n=input()
print("Yes" if n=n[::-1] else "No")

Fixed submission:
n = input()
print("Yes" if n == n[::-1] else "No")
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
L = list(map(int, input().split()))

ans = 0
for i in range(K):
    ans += L.pop(max(L))

print(ans)

Fixed submission:
N, K = map(int, input().split())
L = list(map(int, input().split()))

L.sort(reverse=True)
print(sum(L[:K]))

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

for i in range(K):
    ans += L.pop(max(L))

print(ans)

Fixed submission:
N, K = map(int, input().split())
L = list(map(int, input().split()))

L.sort(reverse=True)
print(sum(L[:K]))
Buggy python submission (verdict: Runtime Error):
abc = [map(int, input().split())]
print(sum(abc) - max(abc))


Fixed submission:
abc = list(map(int, input().split()))
print(sum(abc) - max(abc))

Buggy python submission (verdict: Runtime Error):
abc = [int(input().split())]
print(sum(abc) - max(abc))


Fixed submission:
abc = list(map(int, input().split()))
print(sum(abc) - max(abc))

Buggy python submission (verdict: Runtime Error):
abc = [int(input())]
print(sum(abc) - max(abc))

Fixed submission:
abc = list(map(int, input().split()))
print(sum(abc) - max(abc))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]

button = 0
for i in range(1,N+1):
    button = a[a[button]-1]
    if button == 2:
        print(i)
else:
    print(-1)

Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]

button = 1
for i in range(N):
    if button == 2:
        print(i)
        break
    button = a[button-1]
    
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]

button = 0
for i in range(1,N+1):
    button = a[a[button]]
    if button == 2:
        print(i)
else:
    print(-1)

Fixed submission:
N = int(input())
a = [int(input()) for _ in range(N)]

button = 1
for i in range(N):
    if button == 2:
        print(i)
        break
    button = a[button-1]
    
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if x,y in a:
  print("Yes")
elif x,y in b:
  print("Yes")
elif x,y in c:
  print("Yes")
else:
  print("No")

Fixed submission:
x,y=map(int,input().split())
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if x in a and y in a:
  print("Yes")
elif x in b and y in b:
  print("Yes")
elif x in c and y in c:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input())
print("Yes" if a<=c<=b else "No")

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a<=c<=b else "No")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = []
for i in range(N):
    ab.append(map(int, input().split()))

ans = []
for i in range(1,max(ab)+1):
    ans.append(ans.count(i))

for x in ans:
    print(x)

Fixed submission:
N, M = map(int, input().split())
c = [0] * N

for _ in range(M):
    a, b = map(int, input().split())
    c[a - 1] += 1
    c[b - 1] += 1

print(*c, sep='\n')

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = [map(int, input().split()) for _ in range(N)]

ans = []
for i in range(1,max(ab)+1):
    ans.append(ans.count(i))

for x in ans:
    print(x)

Fixed submission:
N, M = map(int, input().split())
c = [0] * N

for _ in range(M):
    a, b = map(int, input().split())
    c[a - 1] += 1
    c[b - 1] += 1

print(*c, sep='\n')

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]

ans = [0] * M
for i in range(N):
    ans[ab[i][0]] += 1
    ans[ab[i][1]] += 1

for x in ans:
    print(x)

Fixed submission:
N, M = map(int, input().split())
c = [0] * N

for _ in range(M):
    a, b = map(int, input().split())
    c[a - 1] += 1
    c[b - 1] += 1

print(*c, sep='\n')
Buggy python submission (verdict: Runtime Error):
O = input()
E = input()

ans = ""
for i in range(len(O)):
    ans += O[i]
    ans += E[i]
if len(O) > len(E):
    ans += O[-1]

print(ans)

Fixed submission:
O = input()
E = input()

ans = ""
for i in range(len(E)):
    ans += O[i]
    ans += E[i]
if len(O) > len(E):
    ans += O[-1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ans = 1
for i in range(1, N+1):
    ans *= i
print(ans % (10**9 + 7))

Fixed submission:
N = int(input())
ans = 1
for i in range(1, N+1):
    ans =ans * i % (10**9 + 7)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[y+k]:
                break
        else:
            print("Yes")
            sys.exit()
print("No")

Fixed submission:
import sys

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[k]:
                break
        else:
            print("Yes")
            sys.exit()
print("No")

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[y+k]:
                break
        else:
            print("Yes")
            exit()
print("No")

Fixed submission:
import sys

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[k]:
                break
        else:
            print("Yes")
            sys.exit()
print("No")

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[y]:
                break
        else:
            print("Yes")
            exit()
print("No")

Fixed submission:
import sys

N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for y in range(N-M+1):
    for x in range(N-M+1):
        for k in range(M):
            if A[y+k][x:x+M] != B[k]:
                break
        else:
            print("Yes")
            sys.exit()
print("No")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input())
print(a*b if c*d<a*b else c*d)

Fixed submission:
a,b,c,d = map(int, input().split())
print(a*b if c*d<a*b else c*d)
Buggy python submission (verdict: Runtime Error):
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for _ in range(M)]

sum_before = sum(T)
for i in range(M):
    sum_after = sum_before - T[PX[i][0]] + PX[i][1]
    print(sum_after)

Fixed submission:
N = int(input())
T = list(map(int, input().split()))
M = int(input())
PX = [list(map(int, input().split())) for _ in range(M)]

sum_before = sum(T)
for i in range(M):
    sum_after = sum_before - T[PX[i][0]-1] + PX[i][1]
    print(sum_after)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
A = [list(input().split()) for _ in range(H)]

ans = "Impossible"
d = [(1, 0), (0, 1)]


def f(y, x):
    if y == H-1 and x == W-1:
        global ans
        ans = "Possible"
        return
    elif not (0 <= y < H and 0 <= x < W):
        return
    elif A[y][x] == ".":
        return
    
    f(y+1, x)
    f(y, x+1)


f(0, 0)
print(ans)

Fixed submission:
H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]

ans = "Impossible"

cnt = 0
for a in A:
    cnt += a.count("#")

if cnt == H + W - 1:
    ans = "Possible"

print(ans)
Buggy python submission (verdict: Runtime Error):
print(len(set(map(input().split()))))

Fixed submission:
a = list(map(int, input().split()))
print(len(set(a)))

Buggy python submission (verdict: Runtime Error):
a = list(map(innt, input().split()))
print(len(set(a)))

Fixed submission:
a = list(map(int, input().split()))
print(len(set(a)))
Buggy python submission (verdict: Runtime Error):
li=list(map(int,input().split()))
print("YES" li.sort()==[5,5,7] else "NO")


Fixed submission:
li=list(map(int,input().split()))
print("YES" if sorted(li)==[5,5,7] else "NO")

Buggy python submission (verdict: Runtime Error):
li=map(int,input().split())
print("YES" li.sort()==[5,5,7] else "NO")

Fixed submission:
li=list(map(int,input().split()))
print("YES" if sorted(li)==[5,5,7] else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

mod = 998244353

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

s = []
for _ in range(k):
    l, r = map(int, input().split())
    s += list(range(l, r+1))

s = set(s)

dp = [0] * (2 * n)
dp[0] = 1

s = sorted(list(s))


for i in range(n):
    if dp[i] == 0:
        continue
    for s_ele in s:
        if s_ele + i > n:
            break
        dp[i+s_ele] += dp[i]

print(dp[n-1]%mod)

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

mod = 998244353

n, k = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n+1)
dp[1] = 1

for i in range(1, n):
    dp[i+1] += dp[i]
    for l, r in lr:
        dp[i+1] += dp[max(i-l+1, 0)] - dp[max(i-r, 0)]
        dp[i+1] %= mod

print((dp[n]-dp[n-1])%mod)

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

mod = 998244353

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

s = []
for _ in range(k):
    l, r = map(int, input().split())
    s += list(range(l, r+1))

s = set(s)

dp = [0] * (2 * n)
dp[0] = 1

for i in range(n):
    if dp[i] == 0:
        continue
    for s_ele in s:
        dp[i+s_ele] += dp[i]

print(dp[n-1]%mod)

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

mod = 998244353

n, k = map(int, input().split())
lr = [list(map(int, input().split())) for _ in range(k)]

dp = [0] * (n+1)
dp[1] = 1

for i in range(1, n):
    dp[i+1] += dp[i]
    for l, r in lr:
        dp[i+1] += dp[max(i-l+1, 0)] - dp[max(i-r, 0)]
        dp[i+1] %= mod

print((dp[n]-dp[n-1])%mod)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

s = input().split()[0]
q = int(input())

for _ in range(q):
    q_i = input().split()
    if len(q_i) == 1:
        s = s[::-1]
    else:
        _, f, c = q_i
        f = int(f)
        if f == 1:
            s = c + s
        else:
            s = s + c

print(s)

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

s = input().split()[0]
q = int(input())

left, right = [], []
state = 1
for _ in range(q):
    q_i = input().split()
    if len(q_i) == 1:
        state = (state)%2 + 1
    else:
        _, f, c = q_i
        f = int(f)
        if (f+state)%2 == 0:
            left += [c]
        else:
            right += [c]
if state == 1:
    print(''.join(left[::-1]) + s + ''.join(right))
else:
    print(''.join(right[::-1]) + s[::-1] + ''.join(left))

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

s = input().split()[0]
q = int(input())

for _ in range(q):
    q_i = input().split()
    if len(q_i) == 1:
        s = s[::-1]
    else:
        _, f, c = q_i
        f = int(f)
        if f == 1:
            s = c + s
        else:
            s = s + c

print(s)

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

s = input().split()[0]
q = int(input())

left, right = [], []
state = 1
for _ in range(q):
    q_i = input().split()
    if len(q_i) == 1:
        state = (state)%2 + 1
    else:
        _, f, c = q_i
        f = int(f)
        if (f+state)%2 == 0:
            left += [c]
        else:
            right += [c]
if state == 1:
    print(''.join(left[::-1]) + s + ''.join(right))
else:
    print(''.join(right[::-1]) + s[::-1] + ''.join(left))
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = np.array(ab)

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(h+1, dtype=np.int)
for i in range(1, h+1):
    dp[i] = (dp[i-a]+b).min()

print(dp[h])

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

h, n = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab = np.array(ab)

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(100001, dtype=np.int)
for i in range(1, h+1):
    dp[i] = (dp[i-a]+b).min()

print(dp[h])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import math

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

a = [ai >> 1 for ai in a]

import fractions
from functools import reduce

def getLCM(a, b):
    return a * b // fractions.gcd(a, b)

def f(x):
    cnt = 0
    while x%2 == 0:
        x //= 2
        cnt += 1
    return cnt

cnt = f(a[0])
for i in range(1, len(a)):
    if cnt != f(a[i]):
        print(0)
        break
else:
    lcm = reduce(lambda x, y: getLCM(x, y), a)
    ans = (m-lcm) // (lcm*2) + 1 if m >= lcm else 0
    print(ans)

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

k, x = map(int, input().split())
if 500*k >= x:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import numpy as np

from math import factorial
import itertools

def permutations_count(n, r):
    ''' 順列 '''
    return factorial(n) // factorial(n - r)

def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))

n = int(input())
*s, = map(int, list(input().split()[0]))

ans = 0
for i in range(1000):
    num_str = str(i)
    if i < 100:
        num_str = '0'+num_str
    if i<10:
        num_str = '0'+num_str
    idx = 0
    for j in s:
        # print(j, idx)
        if j == int(num_str[idx]):
            idx += 1
            if idx==3:
                break
    if idx == 3:
        ans += 1
print(ans)

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

n = int(input())
s = input().split()[0]

ans = 0
for i in range(1000):
    num_str = str(i).zfill(3)
    a = s.find(num_str[0])
    if a==-1:
        continue
    b = s[a+1:].find(num_str[1])
    if b==-1:
        continue
    b += a+1
    c = s[b+1:].find(num_str[2])
    if c!=-1:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

s = input()[:-1]

cnts = []

tmp = 1
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        tmp += 1
    else:
        if s[i] == '>':
            tmp *= -1
        cnts.append(tmp)
        tmp = 1

if s[i] == '>':
    tmp *= -1
cnts.append(tmp)

idx = 0
a = [0] * (len(s)+1)
for i in range(len(cnts)):
    base = 0
    if i != 0 and cnts[i-1] > 0 and cnts[i] < 0 and a[idx-1] >= abs(cnts[i]):
        base = a[idx-1] - abs(cnts[i])
    for j in range(abs(cnts[i])):
        if cnts[i] > 0:
            a[idx] = j
        else:
            a[idx] = abs(cnts[i]) - j + base
        idx += 1
# print(*cnts)
# print(*a)
print(sum(a))
# for i in range(len(s)):
#     print(a[i],s[i],end='')
# print(a[-1])

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

s = input()[:-1]

cnts = []

tmp = 1
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        tmp += 1
    else:
        if s[i] == '>':
            tmp *= -1
        cnts.append(tmp)
        tmp = 1

if s[-1] == '>':
    tmp *= -1
cnts.append(tmp)

idx = 0
a = [0] * (len(s)+1)

for i in range(len(cnts)):
    if i != 0 and cnts[i-1] > 0 and cnts[i] < 0 and a[idx-1] >=  abs(cnts[i]):
        a[idx] = a[idx-1] + 1

    for j in range(abs(cnts[i])):
        if a[idx] != 0:
            idx += 1
            continue
        if cnts[i] > 0:
            a[idx] = j
        else:
            a[idx] = abs(cnts[i]) - j
        idx += 1
if s[-1] == '<':
    a[-1] = a[-2] + 1

# print(*cnts)
# print(*a)
print(sum(a))
# for i in range(len(s)):
#     print(a[i],s[i],end='')
# print(a[-1])
Buggy python submission (verdict: Runtime Error):
import copy
import fractions
a, b = map(int, input().split())

temp = fractions.gcd(a, b)

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

d = primes(temp)
ans = 1
for ele in d:
    if a%ele==0 and b%ele==0:
        ans += 1

print(ans)

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

temp = fractions.gcd(a, b)

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 // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

d = make_divisors(temp)
d.sort()

for ele in d:
    if ele==1:
        continue
    d = [e for e in d if e%ele!=0 or ele==e] 

print(len(d))

Buggy python submission (verdict: Runtime Error):
import copy
import fractions
a, b = map(int, input().split())

temp = fractions.gcd(a, b)

c = [None]*(temp+1)
for i in range(2, temp+1):
    if a%i==0 and b%i==0:
        c[i] = i

for ele in c:
    if ele!=None:
        c = [e for e in c if e!=None and (e%ele!=0 or e==ele)]
print(len(c)+1)

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

temp = fractions.gcd(a, b)

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 // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

d = make_divisors(temp)
d.sort()

for ele in d:
    if ele==1:
        continue
    d = [e for e in d if e%ele!=0 or ele==e] 

print(len(d))

Buggy python submission (verdict: Time Limit Exceeded):
import copy
import fractions
a, b = map(int, input().split())

temp = fractions.gcd(a, b)

c = []
for i in range(1, temp+1):
    if a%i==0 and b%i==0:
        c.append(i)
c = set(c)

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

d = set(primes(temp))

ans = c&d
        
print(len(ans)+1)

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

temp = fractions.gcd(a, b)

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 // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

d = make_divisors(temp)
d.sort()

for ele in d:
    if ele==1:
        continue
    d = [e for e in d if e%ele!=0 or ele==e] 

print(len(d))