Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left

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

G = [[] for _ in range(N)]

for _ in range(N - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)


root = 0

ans = [0] * N
check = [False] * N
check[root] = True

memo = [None] * N

INF = 10 ** 10
dp = [INF] * N

def dfs(x):
    tmp = bisect_left(dp, A[x])
    memo[x] = (tmp, dp[tmp])
    dp[tmp] = A[x]
    ans[x] = bisect_left(dp, INF)
    for next_ in G[x]:
        if check[next_]:
            continue
        check[next_] = True
        dfs(next_)
    j, a = memo[x]
    dp[j] = a

dfs(root)

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



Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

from bisect import bisect_left

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

G = [[] for _ in range(N)]

for _ in range(N - 1):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    G[u].append(v)
    G[v].append(u)


root = 0

ans = [0] * N
check = [False] * N
check[root] = True

memo = [None] * N

INF = 10 ** 10
dp = [INF] * N

def dfs(x):
    tmp = bisect_left(dp, A[x])
    memo[x] = (tmp, dp[tmp])
    dp[tmp] = A[x]
    ans[x] = bisect_left(dp, INF)
    for next_ in G[x]:
        if check[next_]:
            continue
        check[next_] = True
        dfs(next_)
    j, a = memo[x]
    dp[j] = a

dfs(root)

print (*ans, sep = '\n')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 2019

from collections import defaultdict

S = list(input())
dic = defaultdict(int)
dic[0] += 1

ans = 0
x = 0
count = 0
for s in S[::-1]:
    x += int(s) * pow(10, count)
    x %= MOD
    ans += dic[x]
    dic[x] += 1
    count += 1

print (ans)


Fixed submission:
from collections import defaultdict

S = list(input())
N = len(S)

dic = defaultdict(int)
dic[0] = 1

ans = 0

tmp = 0
for i in range(N):
    s = S[N - 1 - i]
    tmp += int(s) * pow(10, i, 2019)
    ans += dic[tmp % 2019]
    dic[tmp % 2019] += 1

print (ans)

# print (dic)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 2019

from collections import defaultdict

S = list(input())
dic = defaultdict(int)
dic[0] += 1

ans = 0
x = 0
count = 0
for s in S[::-1]:
    x += int(s) * pow(10, count)
    ans += dic[x % MOD]
    dic[x % MOD] += 1
    count += 1

print (ans)


Fixed submission:
from collections import defaultdict

S = list(input())
N = len(S)

dic = defaultdict(int)
dic[0] = 1

ans = 0

tmp = 0
for i in range(N):
    s = S[N - 1 - i]
    tmp += int(s) * pow(10, i, 2019)
    ans += dic[tmp % 2019]
    dic[tmp % 2019] += 1

print (ans)

# print (dic)

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

S = list(input())
N = len(S)

dic = defaultdict(int)
dic[0] = 1

ans = 0

tmp = 0
for i in range(N):
    s = S[N - 1 - i]
    tmp += int(s) * 10 ** i
    ans += dic[tmp % 2019]
    dic[tmp % 2019] += 1

print (ans)

# print (dic)

Fixed submission:
from collections import defaultdict

S = list(input())
N = len(S)

dic = defaultdict(int)
dic[0] = 1

ans = 0

tmp = 0
for i in range(N):
    s = S[N - 1 - i]
    tmp += int(s) * pow(10, i, 2019)
    ans += dic[tmp % 2019]
    dic[tmp % 2019] += 1

print (ans)

# print (dic)

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

S = list(input())
N = len(S)

dic = defaultdict(int)
dic[0] = 1

ans = 0

tmp = 0
for i in range(N):
    s = S[N - 1 - i]
    tmp += int(s) * 10 ** i
    ans += dic[tmp % 2019]
    dic[tmp % 2019] += 1

print (ans)

# print (dic)

Fixed submission:
from collections import defaultdict

S = list(input())
N = len(S)

dic = defaultdict(int)
dic[0] = 1

ans = 0

tmp = 0
for i in range(N):
    s = S[N - 1 - i]
    tmp += int(s) * pow(10, i, 2019)
    ans += dic[tmp % 2019]
    dic[tmp % 2019] += 1

print (ans)

# print (dic)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7
INF = 10 ** 9


N, X, Y = map(int, input().split())
X -= 1
Y -= 1

G = [[abs(i - j) for i in range(N)] for j in range(N)]
G[X][Y] = 1
G[Y][X] = 1

for i in range(N):
    for j in range(N):
        G[i][j] = min(G[i][j], G[i][X] + G[Y][j] + 1, G[i][Y] + G[X][j] + 1)

ans = [0] * (N)
for i in range(N - 1):
    for j in range(i + 1, N):
        ans[G[i][j]] += 1
    
print (*ans[1:], sep = '\n')
        
# print (*G, sep = '\n')

Fixed submission:


N, X, Y = map(int, input().split())

DP = [[abs(i - j) for i in range(N)] for j in range(N)]

DP[X - 1][Y - 1] = 1
DP[Y - 1][X - 1] = 1

# que = deque()
# que.append((X - 1, Y - 1))
# while que:
#     tmp = que.popleft()
#     x, y = tmp[0], tmp[1]

x = X - 1
y = Y - 1
for i in range(N - 1):
    for j in range(i + 1, N):
        DP[i][j] = min(DP[i][j], DP[i][x] + DP[y][j] + 1, DP[i][y] + DP[x][j] + 1)

lst = [0] * N
for i in range(N - 1):
    # tmp = list(ans[i,:])
    # print (tmp)
    for j in range(i + 1, N):
        lst[DP[i][j]] += 1
    
print (*lst[1:], sep = '\n')

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

N, X, Y = map(int, input().split())

edge = [(i, i + 1, 1) for i in range(N - 1)]
edge.append((X - 1, Y - 1, 1))

edge = np.array(edge, dtype = np.int64).T
graph = csr_matrix((edge[2], (edge[:2])), (N, N))

# print (graph)

ans = floyd_warshall(graph, directed = False)
lst = [0] * N
for i in range(N - 1):
    # tmp = list(ans[i,:])
    # print (tmp)
    for j in range(i + 1, N):
        lst[int(ans[i,j])] += 1
    
print (*lst[1:], sep = '\n')


Fixed submission:


N, X, Y = map(int, input().split())

DP = [[abs(i - j) for i in range(N)] for j in range(N)]

DP[X - 1][Y - 1] = 1
DP[Y - 1][X - 1] = 1

# que = deque()
# que.append((X - 1, Y - 1))
# while que:
#     tmp = que.popleft()
#     x, y = tmp[0], tmp[1]

x = X - 1
y = Y - 1
for i in range(N - 1):
    for j in range(i + 1, N):
        DP[i][j] = min(DP[i][j], DP[i][x] + DP[y][j] + 1, DP[i][y] + DP[x][j] + 1)

lst = [0] * N
for i in range(N - 1):
    # tmp = list(ans[i,:])
    # print (tmp)
    for j in range(i + 1, N):
        lst[DP[i][j]] += 1
    
print (*lst[1:], sep = '\n')
Buggy python submission (verdict: Runtime Error):
MOD = 998244353

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

DP = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]
DP[0][0][0] = 1

for i in range(N):
    DP[i + 1][0][0] = DP[i][0][0] 
    a = A[i]
    for j in range(S + 1):
        if j == 0: #左側を決めて合計0になるのは、
            # DP[i + 1][j][0] = DP[i][j][0] 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1]
        elif j < a: #左側を決めて合計jになるとき、ただしaはjより大きいので使えない
            # DP[i + 1][j][0] = DP[i][j][0] 
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] #以前から合計jになっている場合のみOK
        else: #左側を決めて合計j > aになるとき, aだけでは足りない = 左側はこれより前で決まっている
            DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] + DP[i][j - a][0] + DP[i][j - a][1]
        # DP[i + 1][j][0] %= MOD
        DP[i + 1][j][0] %= MOD
    DP[i + 1][S][2] = DP[i][S][1] + DP[i][S][2]
    if a <= S:
        DP[i + 1][S][2] += DP[i][S - a][0] + DP[i][S - a][1]
    DP[i + 1][S][2] %= MOD

print (DP[N][S][2])

# for i in range(N + 1):
#     print (DP[i])

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

ans = (N * (N - 1) // 2) + (M * (M - 1) // 2)

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



def check(string):
    for s, c in SC:
        if string[s - 1] != str(c):
            return False
    return True 



if N == 1:
    for i in range(10 ** i):
        if check(str(i)):
            print (i)
            exit()
    print (-1)
    exit()
else:
    for i in range(10 ** (N - 1), 10 ** (N)):
        if check(str(i)):
            print (i)
            exit()
    print (-1)
    exit()
       

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

def check(string):
    for s, c in SC:
        if string[s - 1] != str(c):
            return False
    return True 

if N == 1:
    for i in range(10 ** 1):
        if check(str(i)):
            print (i)
            exit()
    print (-1)
    exit()
else:
    for i in range(10 ** (N - 1), 10 ** (N)):
        if check(str(i)):
            print (i)
            exit()
    print (-1)
    exit()
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

from math import gcd

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

print (A * B // gcd(A, B))

Fixed submission:
from fractions import gcd

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

lcm = (A * B) // gcd(A, B)

print (lcm)
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())

ans = max(0, (4 - X) * 100000)
ans+ = max(0, (4 - Y) * 100000)

if X == Y == 1:
    ans += 100000 * 4

print (ans)

Fixed submission:
X, Y = map(int, input().split())

ans = max(0, (4 - X) * 100000)
ans+= max(0, (4 - Y) * 100000)

if X == Y == 1:
    ans += 100000 * 4

print (ans)
Buggy python submission (verdict: Runtime Error):
import math
MOD = 10 ** 9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print (0)
    exit()

x = X - (X + Y) // 3
y = Y - (X + Y) // 3

if x < y:
    x, y = y, x

tmp = math.factorial(y)

ans = 1
for i in range(x + 1, x + y + 1):
    ans *= i
    ans %= MOD

def modinv(a, m): #mod. m でのaの逆元 a^{-1}を計算する
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    
    u %= m
    if u < 0:
        u += m
    return u

tmp = modinv(tmp, MOD)

ans *= tmp

ans %= MOD

print (ans)

Fixed submission:
import math
MOD = 10 ** 9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print (0)
    exit()

x = X - (X + Y) // 3
y = Y - (X + Y) // 3

if x < 0 or y < 0:
    print (0)
    exit()

if x < y:
    x, y = y, x

# tmp = math.factorial(y)
tmp = 1
for i in range(1, y + 1):
    tmp *= i
    tmp %= MOD

ans = 1
for i in range(x + 1, x + y + 1):
    ans *= i
    ans %= MOD

def modinv(a, m): #mod. m でのaの逆元 a^{-1}を計算する
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    
    u %= m
    if u < 0:
        u += m
    return u

tmp = modinv(tmp, MOD)

ans *= tmp

ans %= MOD

print (ans)

# print (x, y)

Buggy python submission (verdict: Runtime Error):
import math
MOD = 10 ** 9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print (0)
    exit()

x = X - (X + Y) // 3
y = Y - (X + Y) // 3

if x < y:
    x, y = y, x

tmp = math.factorial(y)

ans = 1
for i in range(x + 1, x + y + 1):
    ans *= i

ans //= tmp

ans %= MOD

print (ans)

Fixed submission:
import math
MOD = 10 ** 9 + 7

X, Y = map(int, input().split())

if (X + Y) % 3 != 0:
    print (0)
    exit()

x = X - (X + Y) // 3
y = Y - (X + Y) // 3

if x < 0 or y < 0:
    print (0)
    exit()

if x < y:
    x, y = y, x

# tmp = math.factorial(y)
tmp = 1
for i in range(1, y + 1):
    tmp *= i
    tmp %= MOD

ans = 1
for i in range(x + 1, x + y + 1):
    ans *= i
    ans %= MOD

def modinv(a, m): #mod. m でのaの逆元 a^{-1}を計算する
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    
    u %= m
    if u < 0:
        u += m
    return u

tmp = modinv(tmp, MOD)

ans *= tmp

ans %= MOD

print (ans)

# print (x, y)
Buggy python submission (verdict: Time Limit Exceeded):
N, T = map(int, input().split())
T -= 1

AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
AB.sort(key = lambda x: x[0], reverse = True)

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

ans = AB[N - 1][1]
for i in range(N - 1, 0, -1):
    for j in range(T + 1):
        if j < AB[i][0]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - AB[i][0]] + AB[i][1])
    tmp = dp[i][T] + AB[i - 1][1]
    ans = max(ans, tmp)
    
print (ans)
# print (AB)

# for i in dp:
#     print (dp)

Fixed submission:
N, T = map(int, input().split())
T -= 1

AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key = lambda x: x[1])
AB.sort(key = lambda x: x[0], reverse = True)

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

ans = AB[N - 1][1]
for i in range(N - 1, 0, -1):
    for j in range(T + 1):
        if j < AB[i][0]:
            dp[i][j] = dp[i + 1][j]
        else:
            dp[i][j] = max(dp[i + 1][j], dp[i + 1][j - AB[i][0]] + AB[i][1])
    tmp = dp[i][T] + AB[i - 1][1]
    ans = max(ans, tmp)
    
print (ans)
# print (AB)

# for i in dp:
#     print (dp)
Buggy python submission (verdict: Runtime Error):
import math

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

V = a * a * b
if x * 2 <= V:
    tmp = 2 * x / (a * b * b)
else:
    tmp = a / (2 * (b - x / (a ** 2)))

print (90 - math.degrees(math.atan(tmp)))


Fixed submission:
import math

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

V = a * a * b

if V == x:
    print (0)
    exit()

if x * 2 <= V:
    tmp = 2 * x / (a * b * b)
else:
    tmp = a / (2 * (b - x / (a ** 2)))

print (90 - math.degrees(math.atan(tmp)))
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())

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

A.sort()
F.sort(reverse = True)

def calc(x): #全てx以下にするために何回変える必要があるか
    tmp = 0
    for a, f in zip(A, F):
        tmp += max(0, a - (x // f))
    return tmp

ng = -1
ok = 10 ** 18
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) <= K:
        ok = mid
    else:
        ng = mid

print (ok)

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

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

A.sort()
F.sort(reverse = True)

def calc(x): #全てx以下にするために何回変える必要があるか
    tmp = 0
    for a, f in zip(A, F):
        tmp += max(0, a - (x // f))
    return tmp

ng = -1
ok = 10 ** 18
while ok - ng > 1:
    mid = (ok + ng) // 2
    if calc(mid) <= K:
        ok = mid
    else:
        ng = mid

print (ok)
Buggy python submission (verdict: Time Limit Exceeded):
N, M, L = map(int, input().split())

INF = 10 ** 9
dist1 = [[INF] * N for _ in range(N)]
for i in range(N):
    dist1[i][i] = 0

for _ in range(M):
    A, B, C = map(int, input().split())
    A -= 1
    B -= 1
    dist1[A][B] = C
    dist1[B][A] = C

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j])

dist2 = [[INF] * N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if dist1[i][j] <= L:
            dist2[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[j][k])

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    if dist2[s][t] >= INF:
        print (-1)
    else:
        print (dist2[s][t] - 1)

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

INF = 10 ** 18
dist1 = [[INF] * N for _ in range(N)]
for i in range(N):
    dist1[i][i] = 0

for _ in range(M):
    A, B, C = map(int, input().split())
    A -= 1
    B -= 1
    dist1[A][B] = C
    dist1[B][A] = C

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist1[i][j] = min(dist1[i][j], dist1[i][k] + dist1[k][j])

dist2 = [[INF] * N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if dist1[i][j] <= L:
            dist2[i][j] = 1

for k in range(N):
    for i in range(N):
        for j in range(N):
            dist2[i][j] = min(dist2[i][j], dist2[i][k] + dist2[k][j])

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    if dist2[s][t] >= INF:
        print (-1)
    else:
        print (dist2[s][t] - 1)
Buggy python submission (verdict: Runtime Error):
import sys
# input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

S = list(input())
K = int(input())

N = len(S)

T = S + S

count1 = 0
for i in range(N - 1):
    if T[i] == T[i + 1]:
        T[i + 1] = '*'
        count1 += 1

count2 = 0
if K >= 2:
    for i in range(N - 1, 2 * N - 1):
        if T[i] == T[i + 1]:
            T[i + 1] = '*'
            count2 += 1
    ans = (count1 + count2) * (K // 2) + count1 * (K % 2)
    if T[0] == T[-1]:
        ans += (K // 2) - 1
    if K % 2 == 1 and T[-1] == T[0] and T[N - 1] == T[0]:
        ans += 1
    print (ans)

else:
    print (error)
    print (count1)

# print (T)

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

n = len(S)
start = 0
i = 0
while i < n and S[0] == S[i]:
    start += 1
    i += 1

if i == n:
    print ((n * K) // 2)
    exit()

lst = [start]
count = 1
tmp = i
i += 1
while i < n:
    if S[tmp] == S[i]:
        count += 1
        i += 1
    else:
        lst.append(count)
        count = 1
        tmp = i
        i += 1

lst.append(count)
# print (lst)
if S[0] != S[-1]:
    ans = 0
    for i in lst:
        ans += i // 2
    print (ans * K)
else:
    ans = (lst[0] + lst[-1]) // 2
    for i in lst[1:-1]:
        ans += i //2
    ans *= (K - 1)
    # print (ans)
    for i in lst:
        ans += i //2
    print (ans)
Buggy python submission (verdict: Time Limit Exceeded):
#直径が答えになるわけではない

N = int(input())
S = [list(map(int, input())) for _ in range(N)]

# for s in S:
#     print (s)

lst = [0] * N
lst[0] = 1

stack = [0]
flag = True
while len(stack) != 0:
    tmp = stack.pop()
    for index, x in enumerate(S[tmp]):
        if x == 0:
            continue
        if lst[index] == 0:
            lst[index] = -lst[tmp]
            stack.append(index)
        else:
            if lst[tmp] == -lst[index]:
                pass
            else:
                flag = False
                break
    if not flag:
        print (-1)
        exit()

INF = 10 ** 9
for i in range(N):
    for j in range(N):
        if S[i][j] == 0 and i != j:
            S[i][j] = INF

for k in range(N):
    for i in range(N):
        for j in range(N):
            S[i][j] = min(S[i][j], S[i][k] + S[k][j])
            
ans = 0
for i in range(N):
    for j in range(N):
        ans = max(S[i][j], ans)

print (ans + 1)

Fixed submission:
#直径が答えになるわけではない

N = int(input())
S = [list(map(int, input())) for _ in range(N)]

# for s in S:
#     print (s)

lst = [0] * N
lst[0] = 1

stack = [0]
flag = True
while len(stack) != 0:
    tmp = stack.pop()
    for index, x in enumerate(S[tmp]):
        if x == 0:
            continue
        if lst[index] == 0:
            lst[index] = -lst[tmp]
            stack.append(index)
        else:
            if lst[tmp] == -lst[index]:
                pass
            else:
                flag = False
                break
    if not flag:
        print (-1)
        exit()

INF = 10 ** 9
for i in range(N):
    for j in range(N):
        if S[i][j] == 0 and i != j:
            S[i][j] = INF

for k in range(N):
    for i in range(N):
        for j in range(N):
            S[i][j] = min(S[i][j], S[i][k] + S[k][j])
            
ans = 0
for i in range(N):
    for j in range(N):
        ans = max(S[i][j], ans)

print (ans + 1)
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

def make_divisors(a, b):
    n = min(a, b)
    m = max(a, b)
    import math
    divisors = []
    for i in range(2, n + 1):
        if n == 0:
            break
        if n % i == 0: #割り切れるとき
            if m % i == 0:
                divisors.append(i)
            while n % i == 0 and n != 1:
                n //= i
            if n == 1:
                break
    divisors.sort()
    return divisors

lst = make_divisors(A, B) #この中から素数を数えたらいい
print (len(lst) + 1)


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

def make_divisors(a, b):
    n = min(a, b)
    m = max(a, b)
    import math
    divisors = []
    for i in range(2, int(math.sqrt(n)) + 1):
        if n == 1:
            break
        if n % i == 0: #割り切れるとき
            if m % i == 0:
                divisors.append(i)
            while n % i == 0 and n != 1:
                n //= i
    if n != 1 and m % n == 0:
        divisors.append(n)
    return divisors

lst = make_divisors(A, B) #この中から素数を数えたらいい
print (len(lst) + 1)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

# def make_divisors(a, b):
#     n = min(a, b)
#     m = max(a, b)
#     import math
#     divisors = []
#     for i in range(1, int(math.sqrt(n)) + 1):
#         if n % i == 0: #割り切れるとき
#             if m % i == 0:
#                 divisors.append(i)
#             if i != n//i:
#                 if m % (n // i) == 0:
#                     divisors.append(n//i)
#     divisors.sort()
#     return divisors

# lst = make_divisors(A, B)
# print (lst)

a = min(A, B)
def primes(n):
    import math
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(math.sqrt(n)) + 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]]

prime_lst = primes(a)

count = 1
for i in prime_lst:
    if A % i == B % i == 0:
        count += 1

print (count)

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

def make_divisors(a, b):
    n = min(a, b)
    m = max(a, b)
    import math
    divisors = []
    for i in range(2, int(math.sqrt(n)) + 1):
        if n == 1:
            break
        if n % i == 0: #割り切れるとき
            if m % i == 0:
                divisors.append(i)
            while n % i == 0 and n != 1:
                n //= i
    if n != 1 and m % n == 0:
        divisors.append(n)
    return divisors

lst = make_divisors(A, B) #この中から素数を数えたらいい
print (len(lst) + 1)
Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in "RUD":
      print ("No") 
      exit() 
  else: 
    if nit s[i] in "LUD":
      print("No")
      exit()
print("Yes")


Fixed submission:
s = list(input())
for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in "RUD":
      print ("No") 
      exit() 
  else: 
    if not s[i] in "LUD":
      print("No")
      exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in "RUD":
      print ("No") 
      exit() 
  else: 
    if not s[i] in "LUD":
      print("No")
      exit()
print("Yes"


Fixed submission:
s = list(input())
for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in "RUD":
      print ("No") 
      exit() 
  else: 
    if not s[i] in "LUD":
      print("No")
      exit()
print("Yes")

Buggy python submission (verdict: Runtime Error):
s = list(input())
for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in "RUD":
      print ("No") 
      exit() 
  else: 
    if nit s[i] in "LUD":
      print("No")
      exit()
print("Yes"

Fixed submission:
s = list(input())
for i in range(len(s)):
  if i % 2 == 0:
    if not s[i] in "RUD":
      print ("No") 
      exit() 
  else: 
    if not s[i] in "LUD":
      print("No")
      exit()
print("Yes")