Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    heapify(a)

    for _ in range(m):
        b, c = map(int, input().split())
        for _ in range(b):
            ai = heappop(a)
            if ai < c:
                heappush(a, c)
            else:
                heappush(a, ai)
                break

    print(sum(a))


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


Fixed submission:
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x: -x[1])
    heapify(a)

    for i in range(m):
        b, c = bc[i]
        for _ in range(b):
            ai = heappop(a)
            if ai < c:
                heappush(a, c)
            else:
                heappush(a, ai)
                break

    print(sum(a))


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

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    heapify(a)

    for _ in range(m):
        b, c = map(int, input().split())
        for _ in range(b):
            ai = heappop(a)
            heappush(a, max(c, ai))

    print(sum(a))


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


Fixed submission:
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x: -x[1])
    heapify(a)

    for i in range(m):
        b, c = bc[i]
        for _ in range(b):
            ai = heappop(a)
            if ai < c:
                heappush(a, c)
            else:
                heappush(a, ai)
                break

    print(sum(a))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    if n == 1:
        print(abs(sum(a)))
        exit()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


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


Fixed submission:
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    elif idx == n:
        print(a[idx - 1] - sum(a[:idx - 1]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


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

Buggy python submission (verdict: Runtime Error):
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


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


Fixed submission:
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    elif idx == n:
        print(a[idx - 1] - sum(a[:idx - 1]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]

    summary = [[] for _ in range(n)]

    for p, y in py:
        summary[p - 1].append(y)

    for i in range(n):
        summary[i].sort()

    for p, y in py:
        print(str(p).zfill(6), str(summary[p - 1].index(y) + 1).zfill(6), sep='')


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


Fixed submission:
from sys import stdin, setrecursionlimit
from bisect import bisect_left


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]

    summary = [[] for _ in range(n)]

    for p, y in py:
        summary[p - 1].append(y)

    for i in range(n):
        summary[i].sort()

    for p, y in py:
        print(str(p).zfill(6), str(bisect_left(summary[p - 1], y) + 1).zfill(6), sep='')


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

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]

    summary = [[] for _ in range(n)]

    for p, y in py:
        summary[p - 1].append(y)

    for i in range(n):
        summary[i] = sorted(summary[i])

    for p, y in py:
        print(str(p).zfill(6), str(summary[p - 1].index(y) + 1).zfill(6), sep='')


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


Fixed submission:
from sys import stdin, setrecursionlimit
from bisect import bisect_left


def main():
    input = stdin.buffer.readline
    n, m = map(int, input().split())
    py = [list(map(int, input().split())) for _ in range(m)]

    summary = [[] for _ in range(n)]

    for p, y in py:
        summary[p - 1].append(y)

    for i in range(n):
        summary[i].sort()

    for p, y in py:
        print(str(p).zfill(6), str(bisect_left(summary[p - 1], y) + 1).zfill(6), sep='')


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    MAX = 10 ** 5
    q = int(input())
    lr = [list(map(int, input().split())) for _ in range(q)]

    dp = [1] * (MAX + 1)
    dp[0] = dp[1] = 0
    for i in range(2, MAX + 1):
        if dp[i]:
            x = 2
            while i * x < MAX + 1:
                dp[i * x] = 0
                x += 1
    for i in reversed(range(2, MAX + 1)):
        if not dp[(i + 1) // 2]:
            dp[i] = 0
    for l, r in lr:
        print(sum(dp[l:r + 1]))


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


Fixed submission:
from sys import stdin, setrecursionlimit
from itertools import accumulate


def main():
    input = stdin.buffer.readline
    MAX = 10 ** 5
    q = int(input())
    lr = [list(map(int, input().split())) for _ in range(q)]

    dp = [1] * (MAX + 1)
    dp[0] = dp[1] = 0
    for i in range(2, MAX + 1):
        if dp[i]:
            x = 2
            while i * x < MAX + 1:
                dp[i * x] = 0
                x += 1
    for i in reversed(range(2, MAX + 1)):
        if not dp[(i + 1) // 2]:
            dp[i] = 0

    summary = list(accumulate(dp))

    for l, r in lr:
        print(summary[r] - summary[l - 1])


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy python submission (verdict: Runtime Error):
import math

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    dp = [0 for _ in range(n)]
    dp[0] = t[0]
    for i in range(1, n):
        dp[i] = t[i] * dp[i-1] // math.gcd(t[i], dp[i-1])
    print(dp[-1])


if __name__ == "__main__":
    main()


Fixed submission:
import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    dp = [0 for _ in range(n)]
    dp[0] = t[0]
    for i in range(1, n):
        dp[i] = t[i] * dp[i-1] // fractions.gcd(t[i], dp[i-1])
    print(dp[-1])


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
import numpy as np

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    print(np.lcm.reduce(t))


if __name__ == "__main__":
    main()


Fixed submission:
import fractions

from sys import stdin


def main():
    n = int(stdin.readline())
    t = [int(stdin.readline()) for _ in range(n)]
    dp = [0 for _ in range(n)]
    dp[0] = t[0]
    for i in range(1, n):
        dp[i] = t[i] * dp[i-1] // fractions.gcd(t[i], dp[i-1])
    print(dp[-1])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0] * 12
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min
    for i in range(8, 12):
        max += r[i]
    print(min, max)


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0] * 13
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min
    for i in range(8, 13):
        max += r[i]
    if min == 0:
        min = 1
    print(min, max)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0]*9
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min + r[8]
    print(min, max)


if __name__ == "__main__":
    main()


Fixed submission:
from sys import stdin


def main():
    n = int(stdin.readline())
    a = map(int, stdin.readline().split())
    r = [0] * 13
    for ai in a:
        r[int(ai / 400)] += 1
    min = 0
    for i in range(8):
        if r[i] > 0:
            min += 1
    max = min
    for i in range(8, 13):
        max += r[i]
    if min == 0:
        min = 1
    print(min, max)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np

from sys import stdin


def main():
    n = int(stdin.readline())
    d = set()
    ans = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.add(i)
    for a in d:
        tmp = np.max([len(str(a)), len(str(int(n / a)))])
        if tmp < ans:
            ans = tmp
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
import numpy as np

from sys import stdin


def main():
    n = int(stdin.readline())
    d = set()
    ans = len(str(n))
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            d.add(i)
    for a in d:
        tmp = np.max([len(str(a)), len(str(int(n / a)))])
        if tmp < ans:
            ans = tmp
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    sx, sy, tx, ty = map(int, input().split())
    print(
        ''.join(
            [
                'U' * (ty - sy),
                'R' * (tx - sx),
                'D' * (ty - sy),
                'L' * (tx - sx + 1),
                'U' * (ty - sy + 1),
                'R' * (tx - sx + 1),
                'D',
                'R',
                'D' * (ty - sy + 1),
                'L' * (tx - sx + 1),
                'U'
            ]
        )
    )


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    sx, sy, tx, ty = map(int, input().split())
    path = []
    path.append(''.join('U' * (ty - sy)))
    path.append(''.join('R' * (tx - sx)))
    path.append(''.join('D' * (ty - sy)))
    path.append(''.join('L' * (tx - sx)))

    path.append('L')
    path.append(''.join('U' * (ty - sy + 1)))
    path.append(''.join('R' * (tx - sx + 1)))
    path.append('D')
    path.append('R')
    path.append(''.join('D' * (ty - sy + 1)))
    path.append(''.join('L' * (tx - sx + 1)))
    path.append('U')

    ans = ''.join(path)
    print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    ta = [list(map(int, input().split())) for _ in range(n)]
    ans = sum(ta[0])
    for i in range(1, n):
        si1 = sum(ta[i - 1])
        si = sum(ta[i])
        tmp = si
        while tmp * ta[i][0] // si < ans * ta[i - 1][0] // si1 or tmp * ta[i][1] // si < ans * ta[i - 1][1] // si1:
            tmp += si
        ans = tmp
    print(ans)


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


Fixed submission:
#!/usr/bin/env python3

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    ta = [list(map(int, input().split())) for _ in range(n)]
    ans = sum(ta[0])
    for i in range(1, n):
        si1 = sum(ta[i - 1])
        si = sum(ta[i])
        cand1 = (ans * ta[i - 1][0] // si1) // ta[i][0] if (ans * ta[i - 1][0] // si1) % ta[i][0] == 0 else (ans * ta[i - 1][0] // si1) // ta[i][0] + 1
        cand2 = (ans * ta[i - 1][1] // si1) // ta[i][1] if (ans * ta[i - 1][1] // si1) % ta[i][1] == 0 else (ans * ta[i - 1][1] // si1) // ta[i][1] + 1
        ans = si * max([cand1, cand2])
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    x1 = sum(a) // n
    x2 = x1 + 1
    ans1 = 0
    ans2 = 0
    for ai in a:
        ans1 += (ai - x1) ** 2
        ans2 += (ai - x2) ** 2

    print(min(ans1, ans2))


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


Fixed submission:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    x1 = sum(a) // n
    x2 = x1 + 1
    ans1 = 0
    ans2 = 0
    for ai in a:
        ans1 += (ai - x1) ** 2
        ans2 += (ai - x2) ** 2

    print(min(ans1, ans2))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
Buggy python submission (verdict: Runtime Error):
x = input()
if x.isUpper():
  print('A')
else:
  print('a')

Fixed submission:
x = input()
if x.isupper():
  print('A')
else:
  print('a')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit(0)
ans = 1
for i in A:
    ans = ans * i
    if ans > pow(10, 18):
        print(-1)
        exit(0)
else:
    print(ans)

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

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
	print(0)
	exit()
for i in A:
	ans = ans * i
	if ans > pow(10, 18):
		print(-1)
		exit()
else:
	print(ans)

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

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
  print(0)
  exit()
for i in A:
  ans = ans * i
  if ans > pow(10, 18):
    print(-1)
    exit()
else:
  print(ans)


Fixed submission:
a,b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
  	print(0)
  	exit(0)
for i in A:
    ans = ans * i
if ans > pow(10, 18):
    print(-1)
    exit(0)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit(0)
ans = 1
for i in A:
    ans = ans * i
    if ans > pow(10, 18):
        print(-1)
        exit(0)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1
if 0 in A:
  	print(0)
  	exit()
for i in A:
    ans = ans * i
if ans > pow(10, 18):
    print(-1)
    exit()
else:
    print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit(0)
ans = 1
for i in A:
    ans = ans * i
    if ans > pow(10, 18):
        print(-1)
        exit(0)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in A:
    ans = ans * i
if ans > pow(10, 18):
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    exit(0)
ans = 1
for i in A:
    ans = ans * i
    if ans > pow(10, 18):
        print(-1)
        exit(0)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
i = int(input())
a = i % 10
if a in [2,4,5,7,9]:
  return 'hon'
if a in [0,1,6,8]:
  return 'pon'
if a in [3]:
  return 'bon'


Fixed submission:
i = int(input())
a = i % 10
if a in [2,4,5,7,9]:
  print('hon')
if a in [0,1,6,8]:
  print('pon')
if a in [3]:
  print('bon')
Buggy python submission (verdict: Runtime Error):
S=input()
if S[3]==S[4]:
  if S[5]==S[6]:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Fixed submission:
S=input()
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
S=input()
if S[3]==S[4] and S[5]==S[6]:
  print("Yes")
else:
  print("No")

Fixed submission:
S=input()
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):

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

import math
c=(a*a*b-x)*2

if c<a*a*b:
  d=c/(a*a)
  print(math.degrees(math.atan(d/a)))
else:
  f=(2*x)/a*b 
  print(math.degrees(math.atan(b/f)))

Fixed submission:
a,b=map(int,input().split())
if a>=10 or b>=10:
  print(-1)
else:
  print(a*b)
Buggy python submission (verdict: Runtime Error):
S=list(input())
K=int(input())
SS=S*2
F=S[1]

if len(S)==1:
	P=int(K//2)
elif S==[F]*len(S):
	P=int((len(S))*K//2)
else:
	for G in range(1,len(S)):
		if S[G-1]==S[G]:
			S[G]="O"
		else:
			continue
	A=S.count("O")
	for J in range(1,len(SS)):
		if SS[J-1]==SS[J]:
			SS[J]="O"
		else:
			continue
	B=SS.count("O")
	P=A+(B-A)*(K-1)
print(P)

Fixed submission:
S=list(input())
K=int(input())
SS=S*2
F=S[0]
if len(S)==1:
	P=int(K//2)
elif S==[F]*len(S):
	P=int((len(S))*K//2)
else:
	for G in range(1,len(S)):
		if S[G-1]==S[G]:
			S[G]="O"
		else:
			continue
	A=S.count("O")
	for J in range(1,len(SS)):
		if SS[J-1]==SS[J]:
			SS[J]="O"
		else:
			continue
	B=SS.count("O")
	P=A+(B-A)*(K-1)
print(P)

Buggy python submission (verdict: Runtime Error):
S=list(input())
K=int(input())
#基本は文字列一単位内でひっくり返す×単位数ですが、文字列が一つの場合と文字列の両端が同じ場合を考慮してね。
P=0
if len(S)==1:
	P=K//2
else:
	for G in range(1,len(S):
		B=S[G-1]
		if S[G] in B:
			S[G]='O'
			P+=1
		else:
			continue
	P=P*K
	if S[0]==S[len(S)-1]:
		P+=K-1
print(P)
S=list(input())
K=int(input())
P=0
if len(S)==1:
	P=K//2
else:
	for G in range(1,len(S)):
		B=S[G-1]
		if S[G] in B:
			S[G]='O'
			P+=1
		else:
			continue
	P=P*K
	if S[0]==S[len(S)-1]:
		P+=K-1
print(P)

Fixed submission:
S=list(input())
K=int(input())
SS=S*2
F=S[0]
if len(S)==1:
	P=int(K//2)
elif S==[F]*len(S):
	P=int((len(S))*K//2)
else:
	for G in range(1,len(S)):
		if S[G-1]==S[G]:
			S[G]="O"
		else:
			continue
	A=S.count("O")
	for J in range(1,len(SS)):
		if SS[J-1]==SS[J]:
			SS[J]="O"
		else:
			continue
	B=SS.count("O")
	P=A+(B-A)*(K-1)
print(P)

Buggy python submission (verdict: Runtime Error):
S=list(input())
K=int(input())
#基本は文字列一単位内でひっくり返す×単位数ですが、文字列が一つの場合と文字列の両端が同じ場合を考慮してね。
P=0
if len(S)==1:
	P=K//2
else:
	for G in range(1,len(S):
		B=S[G-1]
		if S[G] in B:
			S[G]='O'
			P+=1
		else:
			continue
	P=P*K
	if S[0]==S[len(S)-1]:
		P+=K-1
print(P)

Fixed submission:
S=list(input())
K=int(input())
SS=S*2
F=S[0]
if len(S)==1:
	P=int(K//2)
elif S==[F]*len(S):
	P=int((len(S))*K//2)
else:
	for G in range(1,len(S)):
		if S[G-1]==S[G]:
			S[G]="O"
		else:
			continue
	A=S.count("O")
	for J in range(1,len(SS)):
		if SS[J-1]==SS[J]:
			SS[J]="O"
		else:
			continue
	B=SS.count("O")
	P=A+(B-A)*(K-1)
print(P)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in range (0,N):
    B[i]=A.index(i+1)+1

    
print(*B)


Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in range (0,N):
    
    B[A[i]-1]=i+1
    
print(*B)
Buggy python submission (verdict: Runtime Error):

A,B=map(int,(input().split()))
import fractions 
C=fractions.gcd(A,B)
d = []
for i in range(2, int(C**0.5)+1):
	if C%i==0:
		d.append(i)
		if i != C // i:
			d.append(C//i)
if C!=1:
	d.append(C)
D=sorted(d)[::-1]

if len(D)==0:
	kotae=0
elif len(D)==1:
	kotae=1
else:	
	j=0
	k=len(D)-1
	while j<k:
		print(D)
		if D[j]%D[k]==0:
			D.pop(j)
			k=len(D)-1
		else:
			if j+1<k:
				k-=1
			else:
				j+=1
				k=len(D)-1
	kotae=len(D)
print(kotae+1)

Fixed submission:
A,B=map(int,(input().split()))
import fractions 
C=fractions.gcd(A,B)
d = []
for i in range(2, int(C**0.5)+1):
	if C % i == 0:
		d.append(i)
		if i != C // i:
			d.append(C//i)
	
D=sorted(d)[::-1]
if D!=[]:
	j=0
	k=len(D)-1
	while j<k:
 
		if D[j]%D[k]==0:
			D.pop(j)
			k=len(D)-1
		else:
			if j+1<k:
				k-=1
			else:
				j+=1
				k=len(D)-1
	D.append(1)
elif C!=1:
	D=[C,1]
else:
	D=[1]
print(len(D))
Buggy python submission (verdict: Runtime Error):
S=list(input())
K="Yes"
for i in range (0,len(S)):
	if i%2==0:
		if S[i]=="L" :
        	K="No"
			break
		else:
        	continue
	else :
		if S[i]=="R" :
			K="No"
			break
		else:
			continue
print(K)

Fixed submission:
S=input()
if S[0]=="R":
    print("Sunny")
elif S[0]=="S":
    print("Cloudy")
else:
    print("Rainy")

Buggy python submission (verdict: Runtime Error):
S=list(input())
K="Yes"
for i in range (0,len(S)):
	if i%2==0:
	    if S[i]=="L" :
        	K="No"
        	break
        else:
        	continue
    else :
		if S[i]=="R" :
        	K="No"
        	break
    	else:
        	continue
print(K)


Fixed submission:
S=input()
if S[0]=="R":
    print("Sunny")
elif S[0]=="S":
    print("Cloudy")
else:
    print("Rainy")
Buggy python submission (verdict: Runtime Error):
S=list(input())

K="Yes"

for i in range (0,len(S)):
	if i%2=0
	    if S[i]=="L" :
        	K="No"
        	break
        else:
        	continue
    else :
		if S[i]=="R" :
        	K="No"
        	break
    	else:
        	continue
print(K)

Fixed submission:
S=list(input())
K="Yes"
for i in range (0,len(S)):
	if i%2==0:
		if S[i]=="L" :
			K="No"
			break
		else:
			continue
	else :
		if S[i]=="R" :
			K="No"
			break
		else:
			continue
print(K)

Buggy python submission (verdict: Runtime Error):
S=list(input())
q=len(S)//2+1
i=0
K="Yes"
for i in range (0,q):
    if S[2*i]=="L":
        K="No"
        break
    elif S[2*i+1]=="R":
        K="No"
        break
    else:
        continue
print(K)
        
        


Fixed submission:
S=list(input())
K="Yes"
for i in range (0,len(S)):
	if i%2==0:
		if S[i]=="L" :
			K="No"
			break
		else:
			continue
	else :
		if S[i]=="R" :
			K="No"
			break
		else:
			continue
print(K)