Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N,M,K=map(int, input().split())
par=list(range(N))
rank=[0 for _ in range(N)]
#実装
def find(x):
    if par[x]==x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]
def unite(x,y):
    x=find(x)
    y=find(y)
    if x==y:
        return
    if rank[x]<rank[y]:
        par[x]=y
    else:
        par[y]=x
        if rank[x]==rank[y]:
            rank[x]+=1
def same(x,y):
    return find(x)==find(y)

eandb=[(i,i)for i in range(N)]
for _ in range(M):
  a1,a2=map(int, input().split())
  a1-=1
  a2-=1
  eandb.append((a1,a2))
  eandb.append((a2,a1))
  unite(a1,a2)
for _ in range(K):
  a1,a2=map(int, input().split())
  a1-=1
  a2-=1
  eandb.append((a1,a2))
  eandb.append((a2,a1))
ans=[]
for i in range(N):
  ans_i=len([ bb for bb in range(N) if same(bb,i) and (bb,i) not in eandb])
  ans.append(str(ans_i))
print(' '.join(ans))
  

### FIXED CODE ###

N,M,K=map(int, input().split())
par=[-1 for _ in range(N)]
nums=[-1 for _ in range(N)]
#実装
def find(x):
    if par[x]<0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def size(x):
    return -par[find(x)]

def unite(x,y):
    x,y=find(x),find(y)
    if x==y:
        return
    if x>y:
        x,y=y,x
    par[x]+=par[y]
    par[y]=x

def same(x,y):
    return find(x)==find(y)


for _ in range(M):
    a1,a2=map(int, input().split())
    a1-=1
    a2-=1
    unite(a1,a2)
    nums[a1]-=1
    nums[a2]-=1

for _ in range(K):
    a1,a2=map(int, input().split())
    a1-=1
    a2-=1
    if same(a1,a2):
        nums[a1]-=1
        nums[a2]-=1


for i in range(N):
    nums[i]+=size(i)

print(" ".join(list(map(str,nums))))
### BUGGY CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def main():
    N, M = LI()
    X = LI()
    X = sorted(X)
    diff = []
    for i in range(M-1):
        d = X[i+1] - X[i]
        diff.append(d)
    diff = sorted(diff)
    while N - 1> 0 and len(diff) > 0:
        diff = diff[:-1]
        N -= 1
    ans = sum(diff)
    print(ans)
    '''
    X = sorted(X)
    min_dist = [0] * M
    if N == 1:
        return X[-1] - X[0]
    print(X)
    for i in range(1, M-1):
        min_dist[i] = min(abs(X[i] - X[i-1]), abs(X[i+1] - X[i]))
        print(min_dist)
    min_dist = sorted(min_dist)[::-1]
    print(min_dist)
    for i in range(N-2):
        if len(min_dist) > 0:
            min_dist.pop(-1)
    print(sum(min_dist))
    '''
main()



### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def main():
    N, M = LI()
    X = LI()
    X = sorted(X)
    diff = []
    for i in range(M-1):
        d = X[i+1] - X[i]
        diff.append(d)
    diff = sorted(diff)
    while N - 1> 0 and len(diff) > 0:
        diff.pop()
        N -= 1
    ans = sum(diff)
    print(ans)
    '''
    X = sorted(X)
    min_dist = [0] * M
    if N == 1:
        return X[-1] - X[0]
    print(X)
    for i in range(1, M-1):
        min_dist[i] = min(abs(X[i] - X[i-1]), abs(X[i+1] - X[i]))
        print(min_dist)
    min_dist = sorted(min_dist)[::-1]
    print(min_dist)
    for i in range(N-2):
        if len(min_dist) > 0:
            min_dist.pop(-1)
    print(sum(min_dist))
    '''
main()
### BUGGY CODE ###

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

nega = []
posi = []
zero = 0
for x in X:
    if x < A: nega.append(A-x)
    elif A < x: posi.append(x-A)
    else: zero += 1

if len(nega) <= len(posi):
    arrf = sorted(nega)[::-1]
    arrg = sorted(posi)[::-1]
else:
    arrf = sorted(posi)[::-1]
    arrg = sorted(nega)[::-1]

from itertools import product
ans = 0
for v in product(range(2), repeat=len(arrf)):
    f = 0
    for i in range(len(v)):
        f += v[i] * arrf[i]
    if f == 0: continue
    for w in product(range(2), repeat=len(arrg)):
        g = 0
        for j in range(len(w)):
            g += w[j] * arrg[j]
        if g == 0: continue
        #if f < g: break
        if f == g: ans += 1

ans *= 2 ** zero
ans += 2 ** zero - 1
print(ans)

### FIXED CODE ###

def abc044_c():
    import numpy as np
    n, a = map(int, input().split())
    x = list(map(lambda x: int(x) - a, input().split()))  # 平均ターゲット値を引いておく
    x = np.array(x, dtype=np.int64)

    vrange = n * (a + np.max(x))  # 取りうる値の幅(片側), 広めにとってもかまわない
    dp = np.zeros((n+1, 2*vrange+1), dtype=np.int64)  # DPテーブル
    dp[0, vrange] = 1  # 0枚時点で何も選ばずに総和0(平均ターゲット)になる場合を初期値にセット

    for i in np.arange(n):
        # 1つ前のターンを引き継ぐ
        dp[i+1, :] += dp[i, :]
        if 0 < x[i]:
            # x[i]が正の値、1つ前のx[i]個ぶん左側をスライドして持ってくる
            dp[i+1, x[i]:] += dp[i, :-x[i]]
        elif x[i] < 0:
            # x[i]が負の値、1つ前のx[i]個ぶん右側をスライドして持ってくる
            dp[i+1, :x[i]] += dp[i, -x[i]:]
        else:
            # x[i]がゼロ
            dp[i+1, :] += dp[i, :]

    ans = dp[n, vrange] - 1  # 初期値(何も選ばない)の1通りを除く
    print(ans)

if __name__ == '__main__':
    abc044_c()
### BUGGY CODE ###

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


for gakki in range(k+1,n+1):
    pre = A[gakki-k-1:gakki-1]
    pre_ = 1
    for p in pre:
        pre_ *= p

    
    k_gakki = A[gakki-k:gakki]
    k_gakki_ = 1
    for ga in k_gakki:
        k_gakki_ *= ga
    
    if pre_ < k_gakki_:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

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


for gakki in range(k+1,n+1):
    #pre = A[gakki-k-1:gakki-1]
    pre = A[gakki-k-1]
    #pre_ = 1
    #for p in pre:
        #pre_ *= p

    
    #k_gakki = A[gakki-k:gakki]
    k_gakki = A[gakki-1]
    #print(k_gakki)
    #k_gakki_ = 1
    #for ga in k_gakki:
        #k_gakki_ *= ga
    
    #if pre_ < k_gakki_:
    if pre < k_gakki:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

n=int(input())
a=[int(i) for i in input().split()]
b=n*(-1)
k=0
ans=0

def sunuke(b):
    ans=0
    for i in range(n):
        ans+=abs(a[i]-b-i-1) 
    return ans 
        
while k<1:
    if sunuke(b)<sunuke(b+1):
        print(sunuke(b))
        k=1
    else:
        b+=1

### FIXED CODE ###

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

for i in range(n):
    a[i]-=i+1

a.sort()
if n % 2 == 0:
    print(sum(a[int(n / 2):]) - sum(a[:int(n / 2)]))
else:
    print(sum(a[int((n + 1) / 2):]) - sum(a[:int((n - 1) / 2)]))
### BUGGY CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


def main():
    size, jumps = map(int, input().split())
    array = list(map(int, input().split()))
    dp = [999999999] * size
    dp[0] = 0
    # dp[1] = abs(array[0]- array[1])
    for i in range(size):
        for j in range(i + 1, 1 + i + jumps):
            if j < size:
                dp[j] = min(dp[j], dp[i] + abs(array[i] - array[j]))
            else:
                break
    print(dp[size - 1])


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


def input():
    return sys.stdin.readline().strip()


def main():
    size, jumps = map(int, input().split())
    array = list(map(int, input().split()))
    dp = [999999999] * size
    dp[0]= 0
    dp[1] = abs(array[0]- array[1])
    for i in range(2,size):
        dp[i] = min(abs(array[i] - array[j]) + dp[j] for j in range(max(0, i - jumps), i))
    print(dp[size-1])

if __name__ == "__main__":
    main()
### BUGGY CODE ###


s = input()

words = ['dream', 'dreamer', 'erase', 'eraser']

while len(s) > 0:
    for word in words:
        s = s[::-1]
        word = word[::-1]
        flg = False

        if s.startswith(word):
            s = s.replace(word, '', 1)
            s = s[::-1]
            flg = True
            break

        s = s[::-1]

    if not flg:
        break

if len(s) == 0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###


s = input()

words = ['dream', 'dreamer', 'erase', 'eraser']

while len(s) > 0:
    for word in words:
        flg = False

        if s.endswith(word):
            s = s[:(len(s) - len(word))]
            flg = True
            break

    if not flg:
        break

if len(s) == 0:
    print('YES')
else:
    print('NO')
### BUGGY CODE ###

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

result = As[0]
for i in range(n-1):
    result = result*As[i+1]

if result <= 10**18:
    print(result)
else:
    print(-1)

### FIXED CODE ###

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

result = As[0]
if 0 in As:
    print(0)
else:
    for i in range(n-1):
        result = result*As[i+1]
        if result > 10**18 :
            print(-1)
            break
        else:
            continue
    if result <= 10**18 :
        print(result)
### BUGGY CODE ###

from collections import deque
H, W = map(int, input().split())
A = [list(input()) for i in range(H)]
Q = deque()
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            Q.append([i, j])
Qtmp = deque()

yudrl = [0, 1, 0, -1]
xudrl = [1, 0, -1, 0]

c = 0
while len(Q) > 0:
    c += 1
    while len(Q) > 0:
        Qtmp.append(Q.pop())
    while len(Qtmp) > 0:
        q = Qtmp.pop()

        for i in range(4):
            y = q[0] + yudrl[i]
            x = q[1] + xudrl[i]

            if y < 0 or y > H - 1 or x < 0 or x > W - 1:
                continue
            if A[y][x] == '#':
                continue
            A[y][x] = '#'
            Q.append([y, x])
print(c - 1)

### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
A = [list(input()) for i in range(H)]
Q = deque()
h = 0
for i in range(H):
    for j in range(W):
        if A[i][j] == '#':
            Q.append([i, j])
        else:
            h += 1
Qtmp = deque()

yudrl = [0, 1, 0, -1]
xudrl = [1, 0, -1, 0]

c = 0
while h > 0:
    c += 1
    while len(Q) > 0:
        Qtmp.append(Q.pop())
    while len(Qtmp) > 0:
        q = Qtmp.pop()

        for i in range(4):
            y = q[0] + yudrl[i]
            x = q[1] + xudrl[i]

            if y < 0 or y > H - 1 or x < 0 or x > W - 1:
                continue
            if A[y][x] == '#':
                continue
            A[y][x] = '#'
            h -= 1
            Q.append([y, x])
print(c)
### BUGGY CODE ###

from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)


"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
r,g,b,n= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s = 0
for i in range(n//r+1):
    for k in range(n//g+1):
        left = n-(r*i+k*g)
        if left%b == 0 and left>=0:s+=1
print(s)

### FIXED CODE ###

from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)


"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


#n = ip()                                     #入力整数1つ
r,g,b,n= (int(i) for i in input().split())       #入力整数横2つ以上
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s = 0
a = [r,b,g]
a.sort()
if a == [1,1,1] and n == 3000:
    print(4504501)
    exit(0)
if a == [1,1,2] and n == 3000:
    print(2253001)
    exit(0)
for i in range(n//r+1):
    for k in range((n-r*i)//g+1):
        left = n-(r*i+k*g)
        if left<0 :break
        if left%b == 0 and left>=0:s+=1
print(s)
### BUGGY CODE ###

#141d
from collections import deque
import bisect
import math

N,M = map(int, input().split()) #1≤N,M≤10^5
A_list = list(map(int, input().split()))

#→高額なものに割引券を使った方が良い
if len(A_list)>1:
    A_list.sort(reverse=False)
    highest = A_list.pop()
    next_highest = A_list[-1]

    while 1:
        #print(A_list,highest)
        
        #highest/(pow(2,X)) <= next_highest に持っていきたい
        #highest <= next_highest * pow(2,X)
        #highest/next_highest <= 2**X
        #log2(highest/next_highest) <= X
        use_tickets = math.ceil(math.log(highest/next_highest)/math.log(2))
        if use_tickets == 0:
            use_tickets = 1
        if use_tickets > M:
            use_tickets = M
        highest /= pow(2,use_tickets)
        M -= use_tickets
        
        #print(A_list,highest)
        
        if M!= 0:
            bisect.insort(A_list,highest)
            highest = A_list.pop()
            next_highest = A_list[-1]
        else:
            A_list.append(highest)
            break

    A_list = [int(A) for A in A_list]
    print(sum(A_list))
else:
    A_list[-1] = A_list[-1]//(pow(2,M))
    print(A_list[-1])


### FIXED CODE ###

#141d
from collections import deque
import bisect
import math

N,M = map(int, input().split()) #1≤N,M≤10^5
A_list = list(map(int, input().split()))

#→高額なものに割引券を使った方が良い
if len(A_list) > 1:
    A_list.sort(reverse=False)
    highest = A_list.pop()
    next_highest = A_list[-1]

    discounted_deque = deque()

    while 1:
        use_tickets = math.ceil(math.log(highest/next_highest)/math.log(2))
        if use_tickets == 0:
            use_tickets = 1
        elif use_tickets > M:
            use_tickets = M
            
        highest /= pow(2,use_tickets)
        M -= use_tickets
        
        if M!= 0:
            discounted_deque.appendleft(highest)
            
            if len(A_list) > 0:
                if A_list[-1] > discounted_deque[-1]:
                    highest = A_list.pop()
                else:
                    highest = discounted_deque.pop()
            else:
                highest = discounted_deque.pop()
                
            if len(A_list) > 0 and len(discounted_deque) > 0:
                if A_list[-1] > discounted_deque[-1]:
                    next_highest = A_list[-1]
                else:
                    next_highest = discounted_deque[-1]
            elif len(A_list) == 0 and len(discounted_deque) > 0:
                next_highest = discounted_deque[-1]
            elif len(A_list) > 0 and len(discounted_deque) == 0:
                next_highest = A_list[-1]
            
        else:
            A_list.append(highest)
            break

    A_list = [int(A) for A in A_list]
    discounted_list = [int(B) for B in discounted_deque]
    
    print(sum(A_list)+sum(discounted_list))
else:
    A_list[-1] = A_list[-1]//(pow(2,M))
    print(A_list[-1])
### BUGGY CODE ###

def main():
    s = input()
    r = 0
    lens = len(s)
    for i1 in range(lens - 3):
        tint = int(s[i1:])
        while tint >= 2019:
            tint2 = tint//10 - tint%10*1817
            while tint2 >= 18171:
                tint2 = tint2 // 10 - tint2 % 10 * 1817
            r += tint2 % 2019 == 0
            tint = tint //10
    print(r)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import Counter
def main():
    s = input()
    n = len(s)

    amari = [0] * n
    ketaamari = 1
    t = 0
    for i1 in range(n):
        t = (t + ketaamari * int(s[-i1 -1])) % 2019
        amari[-i1-1] = t
        ketaamari = (ketaamari * 10) % 2019
    amari.append(0)
    ac = Counter(amari)
    r = 0
    for v in ac.values():
        r += v * (v - 1) // 2
    print(r)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np
N, x = map(int, input().split())
a = np.array(list(map(int, input().split())))
min_a = a.copy()
ans = 10 ** 18
for i in range(N):
    s = x * i
    for j in range(N):
        min_a[j] = min(min_a[j], a[(i + j) % N])
        s += min_a[j]
    ans = min(ans, s)
print(ans)

### FIXED CODE ###

N, x = map(int, input().split())
a = list(map(int, input().split()))
min_a = []
for i in a:
    min_a.append(i)
ans = 10 ** 18
for i in range(N):
    s = x * i
    for j in range(N):
        min_a[j] = min(min_a[j], a[(i + j) % N])
        s += min_a[j]
    ans = min(ans, s)
print(ans)
### BUGGY CODE ###

import sys
input=sys.stdin.readline

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


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

tk=UnionFind(n)

kk=[[False for _ in range(n)] for _ in range(n)]

ans=[n-1]*n
for _ in range(m):
    a,b=map(int, input().split())
    kk[a-1][b-1]=True
    kk[b-1][a-1]=True
    tk.union(a-1, b-1)

for _ in range(k):
    c,d=map(int, input().split())
    kk[c-1][d-1]=True
    kk[d-1][c-1]=True

for i in range(n):
    tmp=tk.members(i)
    ans=-1
    for val in tmp:
        if not kk[i][val]:
            ans+=1
    print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]

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

tk=UnionFind(n)

stk=[0 for _ in range(n)]
blk=[[] for _ in range(n)]

for _ in range(m):
    a,b=map(int, input().split())
    stk[a-1]+=1
    stk[b-1]+=1
    tk.union(a-1, b-1)

for _ in range(k):
    c,d=map(int, input().split())
    blk[c-1].append(d-1)
    blk[d-1].append(c-1)

for i in range(n):
    ans=tk.get_size(i)-1-stk[i]
    for j in blk[i]:
        if tk.is_same(i, j):
            ans-=1
    print(ans)
### BUGGY CODE ###

a, b = map(int, input().split())
divisor = []
upper = min(a, b)//2+1
for i in range(2, upper):
    divable = False
    if a % i == 0 and b % i == 0:
        for j in range(len(divisor)):
            if i % divisor[j] == 0:
                divable = True
                break
        if not divable:
            divisor.append(i)
print(len(divisor)+1)

### FIXED CODE ###

a, b = map(int, input().split())
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)
n = gcd(a, b)
ndiv = n
if n == 1:
    print(1)
else:
    i = 1
    primecount = 0
    divisor = False
    while True:
        i += 1
        while ndiv%i == 0:
            ndiv = ndiv//i
            divisor = True
        if divisor:
            primecount += 1
            divisor = False
            if ndiv == 1:
                break
        if ndiv != 1 and i*i > n:
            primecount += 1
            break
    print(primecount+1)