Harryxun/stf_run huggingface dataset:
import math

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

maxn=10**6
prime=[1]*(maxn+1)
prime[0]=0
prime[1]=0

for i in range(2,maxn+1):
    if prime[i]==0:
        continue

    for j in range(2,maxn//i+1):
        prime[i*j]=0

C=math.gcd(A,B)
cnt=1

for i in range(2,maxn+1):
    if prime[i]==0:
        continue

    if C%i==0:
        while C%i==0:
            C//=i
        cnt+=1

if C>1:
    cnt+=1

print(cnt)

### FIXED CODE ###

import fractions

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

maxn=10**6
prime=[1]*(maxn+1)
prime[0]=0
prime[1]=0

for i in range(2,maxn+1):
    if prime[i]==0:
        continue

    for j in range(2,maxn//i+1):
        prime[i*j]=0

C=fractions.gcd(A,B)
cnt=1

for i in range(2,maxn+1):
    if prime[i]==0:
        continue

    if C%i==0:
        while C%i==0:
            C//=i
        cnt+=1

if C>1:
    cnt+=1

print(cnt)
n=int(input())
arr = list(map(float,input().split()))
dp = [[-1]*(3001) for i in range(3001)]

def func(n,x):
    if x==0:
        return 1
    if dp[n][x]>-0.9:
        return dp[n][x]  
    if n==0:
        return 0
    
    dp[n][x] = (arr[n-1])*func(n-1,x-1) + (1-arr[n-1])*func(n-1,x)
    return dp[n][x]

print("%0.10f"%func(n,(n+1)//2))

### FIXED CODE ###


n=int(input())
arr = list(map(float,input().split()))
dp = [[-1]*(n+1) for i in range(n+1)]
def func(n,x):
    for i in range(0,n+1):
        for j in range(0,n+1):
            if j==0:
                dp[i][j] = 1
            elif i==0:
                dp[i][j]=0
            else:
                p=(arr[i-1])*dp[i-1][j-1]
                q=(1-arr[i-1])*dp[i-1][j]
                dp[i][j] = p+q 
    
    return dp[n][x]

print("%0.10f"%func(n,(n+1)//2))
n = int(input())
for i in range(0, n):
    a, b, c = map(int, sorted(input().split()))
    print("YES" if c*c == a*a+b*b else "NO")

### FIXED CODE ###

n = int(input())
for i in range(0, n):
    a, b, c = sorted(map(int, input().split()))
    print("YES" if c*c == a*a+b*b else "NO")
import sys
input = sys.stdin.readline

N = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())
A = [10**18] * 3
B = [10**18] * 3
dg = abs(ga - gb)
ds = abs(sa - sb)
db = abs(ba - bb)
if ga < gb:
    A[0] = ga
elif ga > gb:
    B[0] = gb
if sa < sb:
    A[1] = sa
elif sa > sb:
    B[1] = sb
if ba < bb:
    A[2] = ba
elif ba > bb:
    B[2] = bb

def calc(X):
    res = -1
    for i in range(N+1):
        if X[0] * i > N:
            break
        M = N - X[0] * i
        jj = M // X[1]
        x = 500 if x < 10000 else 100
        for j in range(max(jj - x, 0), jj+1):
            k = (M - X[1] * j) // X[2]
            res = max(res, dg * i + ds * j + db * k)
        kk = M // X[2]
        for k in range(max(kk - x, 0), kk+1):
            j = (M - X[2] * k) // X[1]
            res = max(res, dg * i + ds * j + db * k)
    return res

N += calc(A)
N += calc(B)
print(N)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
ga, sa, ba = map(int, input().split())
gb, sb, bb = map(int, input().split())
INF = 10**18
A = [INF] * 3
B = [INF] * 3
values = [abs(ga - gb), abs(sa - sb), abs(ba - bb)]
if ga < gb:
    A[0] = ga
elif ga > gb:
    B[0] = gb
if sa < sb:
    A[1] = sa
elif sa > sb:
    B[1] = sb
if ba < bb:
    A[2] = ba
elif ba > bb:
    B[2] = bb

def calc(X):
    dp = [0] * (N+1)
    dp[0] = 0
    for x, v in zip(X, values):
        for i in range(N+1-x):
            dp[i+x] = max(dp[i+x], dp[i] + v)
    return dp[-1]

N += calc(A)
N += calc(B)
print(N)
n, k = map(int, input().split(" "))

l = map(int, input().split(" "))
l.sort()

sum = 0
for i in range(n-k,n):
    sum = sum + l[i]

print(sum)


### FIXED CODE ###

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

l = list(map(int, input().split(" ")))
l.sort()

sum = 0
for i in range(n-k, n):
    sum = sum + l[i]

print(sum)
def minN(N:int, usable:list, restrict=True):
    usable.sort()
    if restrict:
        for i in usable:
            if i >= N:
                return str(i)
    else:
        return str(usable[0])


def main():
    N, K = map(int, input().split())
    D = set(map(int, input().split()))
    numset = set(range(0,10))
    d = list(numset.difference(D))
    d.sort()

    Nstr = list(str(N))
    ans = ''
    flag = True
    for n in Nstr:
        n = int(n)
        if flag:
            if n in D:
                ans += minN(n, d)
                flag = False
            else:
                ans += str(n)
        else:
            ans += str(min(d))
    print(int(ans))

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    D = set(map(int, input().split()))
    numset = set(range(0,10))
    d = numset.difference(D)

    for n in range(N, pow(10, 6) + 10):
        check = set(list(str(n)))
        ngflag = False
        for i in check:
            if int(i) in D:
                ngflag = True
                break
        if not ngflag:
            break
    print(n)

if __name__ == "__main__":
    main()
x = int(input())

elif x >= 100:
    print(1 if x % 100 <= x // 100 * 5 else 0)
else:
    print(0)


### FIXED CODE ###

x = int(input())

if x >= 2000:
    print(1) 
elif x >= 100:
    print(1 if x % 100 <= x // 100 * 5 else 0)
else:
    print(0)
import statistics

n = int(input())
a = [int(n) for n in input().split(" ")]

sub_a = [a_n - i - 1 for i, a_n in enumerate(a)]
median = statistics.median(sub_a)
print(sum([abs(sub_a-median) for sub_a_n in sub_a]))

### FIXED CODE ###

import statistics

n = int(input())
a = [int(n) for n in input().split(" ")]

sub_a = [a_n - i - 1 for i, a_n in enumerate(a)]
median = statistics.median(sub_a)
print(int(sum([abs(sub_a_n-median) for sub_a_n in sub_a])))
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    
    ave = sum(s) / n
    dev = math.sqrt(sum((ave - si) ** 2 for si in s) / n)

    print(dev)    

### FIXED CODE ###

import math


while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    
    ave = sum(s) / n
    dev = math.sqrt(sum((ave - si) ** 2 for si in s) / n)

    print("{:.8f}".format(dev))
mod = 1000000007

N, M = [int(i) for i in input().split()]
A = [int(input()) for _ in range(M)] + [N + 1]

for i in range(len(A) - 1):
    if A[i] + 1 == A[i + 1]:
        print(0)
        quit()

memo = {0: 1, 1: 1, 2: 2, 3: 3}

def fib(n):
    if n not in memo:
        memo[n] = fib(n - 1) + fib(n - 2)
    return memo[n]

ans = 1
pre = -1
lo = 0
for a in A:
    f = fib(a - 1 - lo)
    ans = (ans * f) % mod

    lo = a + 1
    pre = a

print(ans)

### FIXED CODE ###

mod = 1000000007

N, M = [int(i) for i in input().split()]
A = [int(input()) for _ in range(M)] + [N + 1]

for i in range(len(A) - 1):
    if A[i] + 1 == A[i + 1]:
        print(0)
        quit()

fib = [-1] * (N + 1)
fib[0] = 1
fib[1] = 1
for i in range(2, len(fib)):
    fib[i] = fib[i - 1] + fib[i - 2]


ans = 1
pre = -1
lo = 0
for a in A:
    f = fib[a - 1 - lo]
    ans = (ans * f) % mod

    lo = a + 1
    pre = a

print(ans)
n=int(input())
s=input

if a>=3200:
  print(s)
else:
  print('red')
#L=list(map(int,input().split()))
#a,b=map(int,input().split())
#A=[[0 for i in range()] for j in range()]
#l = [int(input()) for i in range(N)]

### FIXED CODE ###

a=int(input())
s=input()

if a>=3200:
  print(s)
else:
  print('red')
#L=list(map(int,input().split()))
#a,b=map(int,input().split())
#A=[[0 for i in range()] for j in range()]
#l = [int(input()) for i in range(N)]
numList = input ( ) .split ( " " )
numList = reversed ( numList )
for x in numList :
    print ( x , end = " " )

### FIXED CODE ###

raw_input ( )
numList = raw_input ( ) .split ( " " )
numList = reversed ( numList )
for x in numList :
    print x ,
N,D=input().split()
n=int(N)
d=int(D)
count=0
for i in range(n):
  X,Y=input().split()
  x=int(X)
  y=int(Y)
  distance=x*x+y*y
  if distance<=d*d:
    count+=1
print(count)

### FIXED CODE ###

x=int(input())
if x>=30:
  print('Yes')
else:
  print('No')
#それぞれの桁を考えた時にその桁を一つ多めに払うのかちょうどで払うのかで場合分けする

import math
n=int(input())
k=math.floor(math.log10(n))+1#桁数
n=list(map(int,str(n)))#それぞれの桁にアクセスするためにイテラブルにする

#それぞれの桁を見ていくが、そのままと一つ多い状態から引く場合と二つあることに注意
dp=[[-1,-1] for _ in range(k)]
dp[0]=[min(1+(10-n[i]),n[i]),min(1+(10-n[i]-1),n[i]+1)]
for i in range(1,k):
    dp[i]=[min(dp[i-1][1]+(10-n[i]),dp[i-1][0]+n[i]),min(dp[i-1][1]+(10-n[i]-1),dp[i-1][0]+n[i]+1)]
print(dp[k-1][0])

### FIXED CODE ###

#それぞれの桁を考えた時にその桁を一つ多めに払うのかちょうどで払うのかで場合分けする

n=[int(x) for x in list(input())]#それぞれの桁にアクセスするためにイテラブルにする
k=len(n)

#それぞれの桁を見ていくが、そのままと一つ多い状態から引く場合と二つあることに注意
dp=[[-1,-1] for _ in range(k)]
dp[0]=[min(1+(10-n[0]),n[0]),min(1+(10-n[0]-1),n[0]+1)]
for i in range(1,k):
    dp[i]=[min(dp[i-1][1]+(10-n[i]),dp[i-1][0]+n[i]),min(dp[i-1][1]+(10-n[i]-1),dp[i-1][0]+n[i]+1)]
print(dp[k-1][0])
A, B = list(map(int,input().split()))
result = A

diff = (B - A) // 2

if A % 2 == 0 and B % 2 == 0:
    if num_of_ones % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    if num_of_ones % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    if num_of_ones % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    if num_of_ones % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)

### FIXED CODE ###

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

if A % 2 == 0 and B % 2 == 0:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
         print(1 ^ B)
    else :
        print(0 ^ B)
elif A % 2 == 0 and B % 2 == 1:
    diff = (B - A + 1) // 2
    if diff % 2 == 1:
        print(1)
    else :
        print(0)
elif A % 2 == 1 and B % 2 == 0:
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1 ^ B)
    else :
        print(A ^ 0 ^ B)
else :
    diff = (B - A) // 2
    if diff % 2 == 1:
        print(A ^ 1)
    else :
        print(A ^ 0)
n = int(input())
p = [int(i)-1 for i in input().split()]
ans = 0
for i in range(n):
    if p[i] == i:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))

x = []

for i in range(n):
    if p[i] - 1 == i:
        x.append('x')
    else:
        x.append('o')

cnt = 0
for i in range(n-1):
    if x[i] == "x" and x[i+1] == 'o':
        cnt += 1
    elif x[i] == "x" and x[i+1] == 'x':
        cnt += 1
        x[i+1] = 'o'

if x[n-1] == "x":
    cnt += 1

print(cnt)
import math
from sys import stdin

X,N=[int(x) for x in stdin.readline().rstrip().split()]
P=[int(x) for x in stdin.readline().rstrip().split()]
l=[i for i in range(1,101) if i not in P]
abslist = list(map(lambda a:abs(a-X),l))
result = min(abslist)

print(l[abslist.index(result)])


### FIXED CODE ###

from sys import stdin


X,N=[int(x) for x in stdin.readline().rstrip().split()]
P=[int(x) for x in stdin.readline().rstrip().split()]
l=[i for i in range(-1,102) if i not in P]
abslist = list(map(lambda a:abs(a-X),l))
print(l[abslist.index(min(abslist))])
n=int(input())
a=list(map(int,input().split())
b=list(map(int,input().split())
c=list(map(int,input().split())
   
s=0
bb=sum(b)
for i in range(n-1):
       if a[i]+1==a[i+1]:
               s+=c[a[i]-1]
s+=bb
print(s)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
   
s=0
bb=sum(b)
for i in range(n-1):
       if a[i]+1==a[i+1]:
               s+=c[a[i]-1]
s+=bb
print(s)
x = map(float,input().split(' '))
a = x[0]
b = x[1]
c = x[2]
d = x[3]
e = x[4]
f = x[5]
g = (c*e-b*f)/(a*e-d*b)
h = (c*d-a*f)/(b*d-a*e)
print round(g,3),round(h,3)

### FIXED CODE ###

while True:
	try:
		a,b,c,d,e,f = map(float,raw_input().split(' '))
		p = round((c*e-b*f)/(a*e-b*d),4)
		q = round((a*f-c*d)/(a*e-b*d),4)
		x = '%.3f' % p
		y = '%.3f' % q
		if str(x) == '-0.000': x = '%.3f' % 0.000
		if str(y) == '-0.000': y = '%.3f' % 0.000
		print x,y
	except: break
from collections import deque
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(input())
a = [int(readline()) for _ in range(n)]

a.sort()
deq = deque(a)

ans = 0

left, right = deq.popleft(), 0
cnt = 1


def comparison(left, right, x, y):
    if y == 0:
        return max(abs(left - x), abs(right - x))

    if right == 0:
        return abs(left*2 - x - y)
    else:
        return abs(left+right-x-y)


while deq:
    if len(deq) == 1:
        x = deq.pop()
        y = 0
    else:
        if cnt:
            x = deq.pop()
            y = deq.pop()
        else:
            x = deq.popleft()
            y = deq.popleft()

    ans += comparison(left, right, x, y)
    left, right = x, y
    cnt = 1-cnt

print(ans)

### FIXED CODE ###

from collections import deque
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
x = deque(a)
y = deque(a)


def align(a, fromLeft=1):
    if fromLeft:
        p = a.popleft()
    else:
        p = a.pop()
    q = p

    res = 0
    fromLeft = 1 - fromLeft
    while a:
        p1 = a.popleft() if fromLeft else a.pop()
        if a:
            q1 = a.popleft() if fromLeft else a.pop()
            res += abs(p - p1) + abs(q - q1)
            p = p1
            q = q1
        else:
            res += max(abs(p - p1), abs(q - p1))
        fromLeft = 1 - fromLeft
    return res


ans = max(align(x, 1), align(y, 0))
print(ans)
a,b = int(input())

seki = a*b

if seki % 2 == 0:
    print("Even")

elif seki % 2 == 1:
  	print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
import math

def lcm(a, b):
    return int(a * b / int(math.gcd(a, b)))

def solve():
    n = input()
    nums = list(map(int, input().split()))
    c_m = lcm(nums[0], nums[1])
    for n in nums[2:]:
        c_m = lcm(c_m, n)
    print(c_m)

solve()

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

import functools

def solve():
    n = input()
    nums = map(int, input().split())
    print(functools.reduce(lcm, nums))

solve()
def actual(a, b, h):
    return int((a + b) * h / 2)

a, b, h = map(int, input())
print(actual(a, b, h))

### FIXED CODE ###

def actual(a, b, h):
    return int((a + b) * h / 2)

a = int(input())
b = int(input())
h = int(input())

print(actual(a, b, h))
n,m = map(int,input().split())

up = [[] for i in range(n)]
down= [[]for i in range(n)]
for i in range(n+m-1):
    a,b = map(int,input().split())
    a -=1
    b -=1
    up[b].append(a)
    down[a].append(b)

res = [-1]*n
root = -1

for i in range(n):
    if len(up[i])==0:
        res[i] = 0
        root = i
        break

#0なら不使用
used = [0]*n
used[root]=1

#yの親に不使用が一つも存在しなければTrue
def g(y):
    for pe in up[y]:
        if used[pe]==0:
            return False
    return True
    
#zの下のusedとresを埋める
def f(z):
    global used
    global res
    for e in down[z]:
        if used[e]==0 and g(e):
            used[e]=1
            res[e]=z+1
            f(e)
f(root)
for i in range(n):
    print(res[i])


### FIXED CODE ###

from collections import deque

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

up = [[] for i in range(n)]
down= [[]for i in range(n)]
for i in range(n+m-1):
    a,b = map(int,input().split())
    a -=1
    b -=1
    up[b].append(a)
    down[a].append(b)

res = [-1]*n
root = -1

for i in range(n):
    if len(up[i])==0:
        res[i] = 0
        root = i
        break

#0なら不使用
used = [0]*n
used[root]=1

#yの親に不使用が一つも存在しなければTrue
def g(y):
    for pe in up[y]:
        if used[pe]==0:
            return False
    return True
    
#zの下のusedとresを埋める
def f(z):
    for e in down[z]:
        if used[e]==0 and g(e):
            res[e]=z+1
            tank2.append(e)
            usedtank.append(e)
c = 1
tank = deque([root])
tank2 = deque([root])
usedtank = []
while c != n:
    tank = tank2
    tank2 = deque([])
    usedtank = []
    while len(tank)!=0:
        f(tank.popleft())
    for usede in usedtank:
        used[usede]=1
    c += len(tank2)
    
for i in range(n):
    print(res[i])
n=int(input())
p=[int(i) for i in input().split()]

ans=0

if p[0]==1:
    ans+=1
    p[1]=1

for i in range(1,n):
    if p[i]==i+1:
        if p[i-1]==i:
            ans+=1
            p[i]=i
        else:
            if p[i+1]!=i+2:
                ans+=1
                p[i]=p[i-1]

print(ans)

### FIXED CODE ###

n=int(input())
p=[int(i) for i in input().split()]

ans=0

if p[0]==1:
    ans+=1
    p[1]=1

for i in range(1,n):
    if p[i]==i+1:
        if p[i-1]==i:
            ans+=1
            p[i]=i
        else:
            if i+1!=n:
                if p[i+1]!=i+2:
                    ans+=1
                    p[i]=p[i-1]
            else:
                ans+=1

print(ans)
a, b = input().split()
a = int(a)
b_i = int(b[:-3])
b_f = int(b[-2:])
b_m = a*b_f
print(a*b_i + int(str(b_m)[:-2]))

### FIXED CODE ###

a, b = input().split()
a = int(a)
b_i = int(b[:-3])
b_f = int(b[-2:])
if b_f == 0:
  print(a*b_i)
  exit()
b_m = a*b_f
if b_m < 100:
  print(a*b_i)
  exit()
print(a*b_i + int(str(b_m)[:-2]))
a, b, c ,d = map(int,input().split(' '))
 L=a+b;R=c+d;
if L>R;
	print('Left')
elif L=R;
	print('Balance')
else;
	print('Right')


### FIXED CODE ###

a , b, c ,d = map(int,input().split(' '))
L=a+b
R=c + d
if L> R:
    print('Left')
elif L<R:
    print('Right')
else:
    print('Balanced ')
N, X, M = map(int, input().split())
d = [-1] * (M + 1)
out = [0]
a = X
ans = 0
for i in range(1, N + 1):
    ans += a
    d[a] = i
    out.append(a)
    a = a ** 2 % M
    if d[a] != -1:
        loop_num = i + 1 - d[a]
        remain = N - i
        break
ans += sum(out[d[a]:d[a] + loop_num]) * (remain // loop_num)
ans += sum(out[d[a]:d[a] + (remain % loop_num)])

print(ans)


### FIXED CODE ###

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

if X == 0:
    print(0)
    exit()

if N == 1:
    print(X)
    exit()

d = [-1] * (M + 1)
out = [0]
a = X
ans = 0
for i in range(1, N + 1):
    ans += a
    d[a] = i
    out.append(a)
    a = a ** 2 % M
    if a == 0:
        print(ans)
        exit()

    if d[a] != -1:
        loop_num = i + 1 - d[a]
        remain = N - i
        ans += sum(out[d[a]:d[a] + loop_num]) * (remain // loop_num)
        ans += sum(out[d[a]:d[a] + (remain % loop_num)])
        break
print(ans)
s = input()
K = int(input())
length = len(s)
if (length>=5):
    substringList = list(set([s[i] for i in range(length)]))
else :
    substringList = []
    for i in range(1,length+1) :
        for j in range(length-i+1) :
            substringList.append(s[j:j+i])

substringList = sorted(substringList)
print(substringList[K])


### FIXED CODE ###

s = input()
K = int(input())
length = len(s)

substringList = []
for i in range(1,K+1) :
    for j in range(length-i+1) :
        substringList.append(s[j:j+i])


substringList = sorted(list(set(substringList)))
print(substringList[K-1])
a,b=map(input().split())
if a=="H" and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print("H")


### FIXED CODE ###

a,b=input().split()
if a=="H" and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print("H")
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1], reverse=True)

c = 0
for i, j in b:
    for k in range(c, i + c):
        if a[k] < j:
            a[k] = j
            c += 1
        else:
            break
print(sum(a))

### FIXED CODE ###

n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = sorted([list(map(int, input().split())) for _ in range(m)], key=lambda x: x[1], reverse=True)

c = 0
for i, j in b:
    for k in range(c, i + c):
        if k == n:
            break
        if a[k] < j:
            a[k] = j
            c += 1
        else:
            break
print(sum(a))
import sys
input = sys.stdin.readline

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

def yakusu(x,X):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            while x%i==0:
                x=x//i
    

A=[1]
B=[1]
yakusu(a,A)
yakusu(b,B)
ans=0
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        ans+=1
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

def yakusu(x,X):
    for i in range(1,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            if x!=i:
                X.append(x//i)
    
A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
A.sort()
B.sort()
#print(A,B)
kouyakusu=[]
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[j]:
        kouyakusu.append(A[i])
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1

ans=0
for i in range(1,len(kouyakusu)):
    if not(kouyakusu[i]): continue
    ans+=1
    for j in range(i+1,len(kouyakusu)):
        if kouyakusu[j]%kouyakusu[i]==0:
            kouyakusu[j]=False
#print(kouyakusu)
print(ans+1)
# E - Coprime

import math
from functools import reduce
from itertools import chain
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
assert len(a) == n

if reduce(math.gcd, a) > 1:
    print("not coprime")
    exit()

def factors(n):
    """Return the list of prime factors of n."""
    fac = set()
    d = 2
    while d <= math.sqrt(n):
        if n % d == 0:
            fac.add(d)
            n //= d
        else:
            d += 1
    if n > 1:
        fac.add(n)
    return fac

c = Counter(chain.from_iterable(map(factors, a)))
if max(c.values()) > 1:
    print("setwise coprime")
else:
    print("pairwise coprime")


### FIXED CODE ###

# E - Coprime

import math
from functools import reduce

n = int(input())
a = list(map(int, input().split()))
assert len(a) == n

if reduce(math.gcd, a) > 1:
    print("not coprime")
    exit()

def factors(n):
    """Return the list of prime factors of n."""
    fac = set()
    sqrtn = math.sqrt(n)
    d = 2
    while d <= sqrtn:
        if n % d == 0:
            fac.add(d)
            n //= d
        else:
            d += 1
    if n > 1:
        fac.add(n)
    return fac

count = [0] * (10 ** 6 + 1)
for x in a:
    for f in factors(x):
        count[f] += 1
        if count[f] > 1:
            print("setwise coprime")
            exit()
print("pairwise coprime")
n, m = map(int, input().split())
a = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

mlcm = 1
for i in a:
    mlcm = lcm(mlcm, i)

for i in a:
    if (int(mlcm / i) % 2 == 0):
        print(0)
        exit(0)

print(int((int(m * 2 / mlcm) + 1) / 2))

### FIXED CODE ###

from fractions import gcd
import sys
input = sys.stdin.readline

def main():
    _, m = map(int, input().split())
    a = list(map(int, input().split()))

    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
        if i == 1:
            if (int(x / a[0]) % 2 == 0) or (int(x / a[i]) % 2 == 0):
                print(0)
                return
        else:
            if (int(x / a[i]) % 2 == 0):
                print(0)
                return

    print(int((int(m * 2 / x) + 1) / 2))

if __name__ == '__main__':
    main()
n,m=map(int,input().split())
root=[-1]*n
def r(x):
    if root[x]<0:
        return x
    else:
        root[x]=r(root[x])
        return root[x]
def unite(x,y):
    x=r(x)
    y=r(y)
    if x==y:
        return
    root[x]+=root[y]
    root[y]=x
def size(x):
    x=r(x)
    return -root[x]
for i in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    unite(x,y)
ans=0
for i in range(n):
    ans=max(ans,size(i))
print(ans)





### FIXED CODE ###

d,t,s=map(int,input().split())
print("Yes" if d<=s*t else "No")
N,M=map(int, input().split())

s=[[] for i in range(M)]

for i in range(M):
    L,R=map(int, input().split())
    for j in range(L,R+1):
        s[i].append(j)

for i in range(M-1):
    s=set(s[i]) & set(s[i+1])

print(len(s))

### FIXED CODE ###

N,M=map(int, input().split())

L=[]
R=[]

for i in range(M):
    a,b=map(int, input().split())
    L.append(a)
    R.append(b)

ans=min(R)-max(L)+1
print("0" if ans<0 else ans)