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

N,Q=[int(s) for s in input().split()]
e_list=[[int(s) for s in input().split()] for i in range(N-1)]
q_list=[[int(s) for s in input().split()] for i in range(Q)]
#まずQを頂点ごとに集計
v_list=[0 for s in range(N+1)]
for q in q_list:
  v_list[q[0]]+=q[1]
oya_list=[0 for s in range(N+1)] #親のリスト
ko_list=[set() for s in range(N+1)] #子のリスト
position=1 #現在の場所
reached=[1] #訪れた頂点
vertex_num=1 #訪れた頂点の数
edge_count=0 #消した辺の数
counter=v_list[1]
ans_list=[0 for s in range(N+1)]
ans_list[1]=v_list[1]
while vertex_num<N:
  #現在の場所の子をリストアップする
  i=0
  while True:
    if i+edge_count>=N-1:
      break
    if e_list[i][0]==position:
      ko_list[position].add(e_list[i][1])
      oya_list[e_list[i][1]]=position
      e_list.pop(i)
      edge_count+=1
    elif e_list[i][1]==position:
      ko_list[position].add(e_list[i][0])
      oya_list[e_list[i][0]]=position
      e_list.pop(i)
      edge_count+=1
    else:
      i+=1
  ##子が存在しない->一つ戻る
  while len(ko_list[position])==0:
    position=oya_list[position]
    counter=ans_list[position]
    #print(position,vertex_num)
  ##子が存在する->移動
  if len(ko_list[position])>0:
    position=ko_list[position].pop()
    counter+=v_list[position]
    ans_list[position]=counter
    vertex_num+=1
    #print(position,vertex_num)
#print(oya_list)
#print(ko_list)
print(*ans_list[1:])
    
    
  
  

### FIXED CODE ###

N,Q=[int(s) for s in input().split()]
#辺でつながれた場所をすべてリストアップ
con_list=[set() for s in range(N+1)]
for i in range(N-1):
  a,b=[int(s) for s in input().split()]
  con_list[a].add(b)
  con_list[b].add(a)

v_list=[0 for s in range(N+1)]
for i in range(Q):
  x,y=[int(s) for s in input().split()]
  v_list[x]+=y

position=1 #現在位置
counter=v_list[1] #カウンター
ans_list=[0 for s in range(N+1)] #答え
ans_list[1]=counter 
vertex_num=1 #訪れた場所の数
oya_list=[-1 for s in range(N+1)] #親に戻るためのリスト

while vertex_num<N:
  #まだ行っていない子があるか？
  if len(con_list[position])>0:
    x=con_list[position].pop()
    con_list[x].remove(position) #xの行先から親を消す
    oya_list[x]=position
    position=x
    counter+=v_list[position] #カウンターの更新
    ans_list[position]=counter
    vertex_num+=1
  else: #行き先がないなら戻る
    position=oya_list[position]
    counter=ans_list[position] #カウンターを戻す
print(*ans_list[1:])
### BUGGY CODE ###

N = int(input())

for h in range(1, 3501):
  for n in range(1, 3501):
    if 4*n*h-N*n-N*h == 0:
      continue
    w = N*h*n/(4*n*h-N*n-N*h)
    if w > 0 and w.is_integer():
      ans = [n, h, int(w)]
print(*ans)

### FIXED CODE ###

N = int(input())

for h in range(1, 3501):
  for n in range(1, 3501):
    if 4*n*h-N*n-N*h == 0:
      continue
    w = N*h*n/(4*n*h-N*n-N*h)
    if w > 0 and w.is_integer():
      ans = [n, h, int(w)]
print(*ans)
### BUGGY CODE ###

#!python
# -*- coding: utf-8 -*-

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

for A_i in A:
    A_ = A[:]
    A_.remove(A_i)
    A_.append(0)
    a = 0
    i = 0
    for b in A_:
        i += abs(a - b)
        a = b
    print(i)


### FIXED CODE ###

#!python
# -*- coding: utf-8 -*-

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

a = 0
I = []
for b in A + [0]:
    I.append(b - a)
    a = b
S = sum(map(abs, I))

for i in range(N):
    j = i + 1
    n = S - (abs(I[i]) + abs(I[i + 1])) + abs(I[i] + I[i + 1])
    print(n)
### BUGGY CODE ###

import sys

def main():
    a, b = [int(s) for s in sys.stdin.readline().strip().split()]

    def factorize(x):
        ret = set()
        for n in range(2, x+1):
            if x % n == 0:
                ret.add(n)
                while x % n == 0:
                    x //= n
        return ret

    a_primes = factorize(a)
    b_primes = factorize(b)
    shared = a_primes.intersection(b_primes)
    print(len(shared) + 1)


main()


### FIXED CODE ###

import sys
import math

def main():
    a, b = [int(s) for s in sys.stdin.readline().strip().split()]

    def factorize(x):
        ret = set()
        for n in range(2, int(math.sqrt(x))+2):
            if x % n == 0:
                while x % n == 0:
                    x //= n
                ret.add(n)
        if x != 1:
            ret.add(x)
        return ret

    a_primes = factorize(a)
    b_primes = factorize(b)
    shared = a_primes.intersection(b_primes)
    print(len(shared) + 1)


main()
### BUGGY CODE ###

S_list = list(input())
i = len(S_list)

x = 0

for n_0 in range(i-3):
  for n in range(n_0+4, i+1):
    Si_list = S_list[n_0 : n]
    Si_str = ""
    for y in Si_list:
      Si_str = Si_str + y
    Si = int(Si_str)
    if Si % 2019 == 0:
      x = x + 1
      
print(x)

### FIXED CODE ###

S = input()
Sliststr = list(S)
Slist = [int(s) for s in Sliststr]
Smod = [0]
mod10 = [1]
count = [0]*2019
ans = 0
for i in range(len(S)-1):
  mod10.append(mod10[i]*10%2019)
for i in range(len(S)):
  Smod.append((Smod[i]+Slist[-i-1]*mod10[i])%2019)
for i in range(len(Smod)):
  count[Smod[i]] += 1
for i in range(2019):
  ans += count[i] * (count[i]-1) // 2
print(ans)
### BUGGY CODE ###

import math
N=int(input())
total=0

for i in range(1,N+1):
  for j in range(1,N+1):
    for k in range(1,N+1):
      ans=math.gcd(math.gcd(i,j),k)
      total+=ans
      
      
print(total)

### FIXED CODE ###

from math import gcd
N=int(input())
total=0

for i in range(1,N+1):
  for j in range(1,N+1):
    for k in range(1,N+1):
      total+=gcd(gcd(i,j),k)
      
print(total)
### BUGGY CODE ###

def main():
    for _ in range(M):
        mx = max(A)
        A[A.index(mx)] = mx // 2

    print(sum(A))


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    main()

### FIXED CODE ###

import heapq


def main():
    for _ in range(M):
        mx = heapq.heappop(A) * -1 // 2 * -1
        heapq.heappush(A, mx)

    print(sum(A) * -1)


if __name__ == "__main__":
    N, M = map(int, input().split())
    A = [int(x) * -1 for x in input().split()]
    heapq.heapify(A)
    main()
### BUGGY CODE ###

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

dp = [0] * (n)
j = 1
tmpdp = 10 ** 9
for i in range(1,n):
  while i - j >= 0 and j <= k:
    if tmpdp > dp[i-j] + abs(h[i] - h[i-j]):
      tmpdp = dp[i-j] + abs(h[i] - h[i-j])
    j += 1
  dp[i] = tmpdp
  j = 1
  tmpdp = 10 ** 9

print(dp[-1])

### FIXED CODE ###

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

dp = [0] * (n)
j = 1
tmpdp = 10 ** 9
for i in range(1,n):
  while i - j >= 0 and j <= k:
    if tmpdp > dp[i-j] + abs(h[i] - h[i-j]):
      tmpdp = dp[i-j] + abs(h[i] - h[i-j])
    j += 1
  dp[i] = tmpdp
  j = 1
  tmpdp = 10 ** 9

print(dp[-1])
### BUGGY CODE ###

N, K = map(int,input().split())
p = list(map(int,input().split()))

max_p = 0

for i in range(N - K + 1):
    max_p = max(sum(p[i:i+K]),max_p)

ex = (max_p - K + 2)/2

print(ex + K - 1)

### FIXED CODE ###

N, K = map(int,input().split())
p = list(map(int,input().split()))

sum_p = 0

for i in range(K):
    sum_p += p[i]

max_p = sum_p

for j in range(K,N):
    sum_p -= p[j - K]
    sum_p += p[j]
    max_p = max(max_p,sum_p)

ex = (max_p - K + 2)/2

print(ex + K - 1)
### BUGGY CODE ###

import numpy as np
temp=input().split(" ")
n=int(temp[0])
k=int(temp[1])
k2=2*k
tileb=[[0 for i in range(k2*2)] for j in range(k2*2)]
for i in range(n):
    temp=input().split(" ")
    x=int(temp[0])
    y=int(temp[1])
    c=temp[2]
    tempx=x%(k2)
    if c=='B':  
        tempy=y%(k2)
        
    elif c=='W':  
        tempy=(y+k)%(k2)

    tileb[tempy][tempx]+=1
    tileb[tempy+k2][tempx]+=1
    tileb[tempy][tempx+k2]+=1
    tileb[tempy+k2][tempx+k2]+=1
        

#ruisekiwa=[[0 for i in range(k2)] for j in range(k2)]
# for x in range(0,k2):
#     ruisekiwa[0][x]=tileb[0][x]

ans=0
# for y in range(0,k2*2):
#     for x in range(1,k2*2):
#         tileb[y][x]+=tileb[y][x-1]

# for x in range(0,k2*2):
#     for y in range(1,k2*2):
#         tileb[y][x]+=tileb[y-1][x]

tileb=np.array(tileb)
tileb=tileb.cumsum(0)
tileb=tileb.cumsum(1)
tileb=list(tileb)
def nijiruisekiwa(x,y,k): #左下(x,y) 長さkの正方形領域の和
    global tileb
    if x==0 and y==0:     
        return tileb[y+k-1][x+k-1]
    if y==0:     
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]
    if x==0:     
        return tileb[y+k-1][x+k-1]-tileb[y-1][x+k-1]
    else:     
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]-tileb[y-1][x+k-1]+tileb[y-1][x-1]
for x in range(0,k2):
    for y in range(0,k2):
        temp=0
        a=nijiruisekiwa(x,y,k)
        b=nijiruisekiwa(x+k,y+k,k)

        temp=a+b
      #  print("temp="+str(temp))

        if temp>ans:
            # print(a)
            # print(b)
            # print("x={0}  y={1}  ".format(x,y))
            ans=temp
print(ans)


### FIXED CODE ###

temp=input().split(" ")
n=int(temp[0])
k=int(temp[1])
k2=2*k
tileb=[[0 for i in range(k2*2)] for j in range(k2*2)]
for i in range(n):
    temp=input().split(" ")
    x=int(temp[0])
    y=int(temp[1])
    c=temp[2]
    tempx=x%(k2)
    if c=='B':  
        tempy=y%(k2)
        
    elif c=='W':  
        tempy=(y+k)%(k2)

    tileb[tempy][tempx]+=1
    tileb[tempy+k2][tempx]+=1
    tileb[tempy][tempx+k2]+=1
    tileb[tempy+k2][tempx+k2]+=1
        
ans=0
for y in range(0,k2*2):
    for x in range(1,k2*2):
        tileb[y][x]+=tileb[y][x-1]

for x in range(0,k2*2):
    for y in range(1,k2*2):
        tileb[y][x]+=tileb[y-1][x]

def nijiruisekiwa(x,y,k): #左下(x,y) 長さkの正方形領域の和
    global tileb
    if x!=0 and y!=0:
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]-tileb[y-1][x+k-1]+tileb[y-1][x-1]
    
    if x==0 and y==0:     
        return tileb[y+k-1][x+k-1]
    if y==0:     
        return tileb[y+k-1][x+k-1]-tileb[y+k-1][x-1]
    if x==0:     
        return tileb[y+k-1][x+k-1]-tileb[y-1][x+k-1]
    
for x in range(0,k2):
    for y in range(0,k2):
        temp=0
        a=nijiruisekiwa(x,y,k)
        b=nijiruisekiwa(x+k,y+k,k)

        temp=a+b
      #  print("temp="+str(temp))

        if temp>ans:
            # print(a)
            # print(b)
            # print("x={0}  y={1}  ".format(x,y))
            ans=temp
print(ans)
### BUGGY CODE ###

r, g, b = [int(x) for x in input().split()]
times = int(input())

def check(r, g, b, times):
    while True:
        if b > g > r:
            return 'Yes'
        elif b < g:
            times -= 1
            b *= 2
        elif g < r:
            times -= 1
            g *= 2
        if times < 0:
            return 'No'

print(check(r, g, b, times))

### FIXED CODE ###

r, g, b = [int(x) for x in input().split()]
times = int(input())

def check(r, g, b, times):
    while True:
        if b > g > r:
            return 'Yes'
        elif b <= g:
            times -= 1
            b *= 2
        elif g <= r:
            times -= 1
            g *= 2
        if times < 0:
            return 'No'

print(check(r, g, b, times))
### BUGGY CODE ###

n = int(input())
s = str(input())
lst_ans=[]
lst_e = []
lst_w = []
for i in range(n):
    lst_e.append(s[:i+1].count("E"))
    lst_w.append(s[:i+1].count("W"))
for i in range(n):
    if i == 0:ans = lst_e[n-1]
    else:ans = (lst_w[i-1]+lst_e[n-1]-lst_e[i])
    lst_ans.append(ans)
print(min(lst_ans))

### FIXED CODE ###

n=int(input())
s=list(input())
n_W,n_E=0,0
l_W,l_E=[0],[0]
for i in s:
    if i=="W":n_W+=1
    else:n_E+=1
    l_W.append(n_W)
    l_E.append(n_E)
ans=10**9+7
for i in range(n):
    tmp=l_W[i]+l_E[-1]-l_E[i+1]
    if tmp<ans:ans=tmp
print(ans)
### BUGGY CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
dots = XY[:]

import sys
INT_MAX = sys.maxsize

x_dots = [(x, y) for x, y in dots]
x_dots = sorted(x_dots)
y_dots = [(y, x) for x, y in dots]
y_dots = sorted(y_dots)
y_dots = [(x, y) for y, x in y_dots]

ans = INT_MAX
for i in range(N):
    for j in range(i+1, N):
        sub_x_dots = set(x_dots[i:j+1])
        xl = x_dots[i:j+1][0][0]
        xr = x_dots[i:j+1][-1][0]
        for k in range(N):
            for l in range(k+1, N):
                sub_y_dots = set(y_dots[k:l+1])
                #print("----")
                #print(x_dots[i:j+1])
                #print(y_dots[k:l+1])
                intersection = (sub_x_dots) & sub_y_dots
                if len(intersection) >= K:
                    yl = y_dots[k:l+1][0][1]
                    yr = y_dots[k:l+1][-1][1]
                    area = (xl-xr) * (yl-yr)
                    
                    ans = min(ans, area)
print(ans)
                
                

### FIXED CODE ###

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

XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append((x, y))
    
dots = XY[:]

import sys
INT_MAX = sys.maxsize

ans = INT_MAX

import itertools
for ((left_x, _), (right_x, _)) in itertools.combinations(dots, 2):
    if left_x > right_x:
        left_x, right_x = right_x, left_x
    for ((_, under_y), (_, top_y)) in itertools.combinations(dots, 2):
        if under_y > top_y:
            under_y, top_y = top_y, under_y
        counter = 0
        for d_x, d_y in dots:
            if  (left_x <= d_x) and (d_x <= right_x) and (under_y <= d_y) and (d_y <= top_y):
                counter += 1
                
        if counter >= K:
            area = (top_y-under_y) * (right_x-left_x)
            if ans > area:
                ans = area
            
print(ans)
### BUGGY CODE ###

def main():
    n = int(input())
    s = [""] * n
    ans = 0
    for i in range(n):
        s[i] = SortString(input())
    for i in range(n - 1):
        for j in range(i + 1, n):
            if s[i] == s[j]:
                ans += 1
            else:
                continue
    print(ans)


def SortString(text):
    n = len(text)
    textList = [""] * n
    for i in range(len(text)):
        textList[i] = text[i]
    return "".join(sorted(textList))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = [""] * n
    ans = 0
    for i in range(n):
        s[i] = SortString(input())
    sDictionary = {}
    for i in range(n):
        if sDictionary.get(s[i]):
            ans += sDictionary.get(s[i])
            sDictionary[s[i]] += 1
        else:
            sDictionary[s[i]] = 1
    print(ans)


def SortString(text):
    return "".join(sorted(list(text)))


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

r, g, b, n = map(int, input().split())
r_num = n // r
g_num = n // g
b_num = n // b
count = 0
for i in range(r_num+1):
    r_r_remain = n - r * i
    if r_r_remain == 0:
        count += 1
    else:
        for j in range(g_num+1):
            r_g_remain = r_r_remain - g * j
            if r_g_remain >= 0:
                if r_g_remain == 0:
                    count += 1
                else:
                    if r_g_remain % b == 0:
                        count += 1
print(count)

### FIXED CODE ###

r, g, b, n = map(int, input().split())
count = 0
for i in range(0, n+1, r):
    rem = n-i
    for j in range(0, rem+1, g):
        if (rem-j)%b==0:
            count += 1
print(count)
### BUGGY CODE ###

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')
in_nl = lambda: list(map(int, readline().split()))
in_nl2 = lambda H: [in_nl() for _ in range(H)]
in_map = lambda: [s == ord('.') for s in readline() if s != ord('\n')]
in_map2 = lambda H: [in_map() for _ in range(H)]
in_all = lambda: map(int, read().split())


def main():
    N = in_n()
    X = in_s()
    tx = int(X, 2)

    ans = [0] * N

    one_count = [X.count('1')] * N
    for i in range(N):
        if X[i] == '0':
            one_count[i] += 1
        else:
            one_count[i] -= 1

    for i in range(N):
        a = tx ^ (1 << N - i - 1)
        count = 0
        while a:
            if count == 0:
                a = a % one_count[i]
            else:
                a = a % bin(a).count('1')
            count += 1
        ans[i] = count

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    X = readline().rstrip().decode('utf-8')
    nx = int(X, 2)

    ans = [0] * N

    oc = X.count('1')

    if oc - 1 != 0:
        mx = nx % (oc - 1)
        f = True
    else:
        f = False

    px = nx % (oc + 1)

    for i in range(N):

        if X[i] == '0':
            a = (px + pow(2, N - i - 1, oc + 1)) % (oc + 1)
        elif f:
            a = (mx - pow(2, N - i - 1, oc - 1)) % (oc - 1)
        else:
            ans[i] = 0
            continue

        count = 1
        while a:
            a = a % bin(a).count('1')
            count += 1

        ans[i] = count

    print('\n'.join(map(str, ans)))


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

def count_divisors(n):
    cnt = 0
    i = 1
    while i*i <= n:
        if n % i == 0:
            cnt += 1
            if i != n // i:
                cnt += 1
        i += 1
    return cnt
N = int(input())
ans = 0
for i in range(1,N+1):
  ans += i * count_divisors(i)
print(ans)

### FIXED CODE ###

# 正整数Xの正約数個数をf(X)とするときの \sum_(K=1)^N {K*f(K)}
# 正整数jの倍数でありN以下のものの総和をg(j)とするときの \sum_(j=1)^N g(j)

N = int(input())
ans = 0
for j in range(1, N+1):
  # Y = N/j とすると g(j) = j+2j+...+Yj = (1+2+...+Y)j = Y(Y+1)/2 *j
  g = (N//j)*(N//j+1)*j//2
  ans += g
print(ans)
### BUGGY CODE ###

import math
N = int(input().strip())
a = list(map(int, input().strip().split()))
A=[0]*N
for i in range (N):
    for j in range (N-1):
        if a[j]==i+1:
            A[i]=A[i]+1
for i in range(N):
    print(A[i])


### FIXED CODE ###

from collections import Counter

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

for i in range(1,N+1):
  print(A[i])
### BUGGY CODE ###

import fractions
A,B = map(int, input().split())
C = fractions.gcd(A, B)
counter = 1

for i in range(C):
  if i==0:
    continue
  if C%(i+1) == 0:
    j = 2
    whileFin = i+1
    while True:
      if j > whileFin or i+1 == 2:
        counter += 1
        break
      if (i+1)%j == 0:
        break
      else:
        whileFin = int((i+1)/(j+1)) + 1
      j += 1

print(counter)

    


### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    return arr

a, b = map(int, input().split())
fa = factorization(a)
fb = factorization(b)

i = 0
j = 0
cnt = 1
while i < len(fa) and j < len(fb):
  if fa[i][0] == fb[j][0]:
    cnt += 1
    i += 1
    j += 1
  elif fa[i][0] < fb[j][0]:
    i += 1
  else:
    j += 1

print(cnt)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter

N = int(input())

edges = []
counter = Counter()
nodes = defaultdict(set)

for _ in range(N - 1):
    u, v = map(int, input().split(' '))
    counter[u] += 1
    counter[v] += 1
    nodes[u].add(v)
    nodes[v].add(u)
    edges.append((u, v))

K = max(counter.values())
colors = set([1 + k for k in range(K)])

checked = set()
queue = deque([(1, 0)])
edge_colors = {}

while queue:
    u, uc = queue.popleft()
    checked.add(u)
    if len(checked) == N:
        break
    for v, vc in zip(nodes[u] - checked, colors - {uc}):
        edge_colors[(min(u, v), max(u, v))] = vc
        queue.append((v, vc))

print(K)
for u, v in edges:
    print(edge_colors[(u, v)])


### FIXED CODE ###

from collections import defaultdict, deque, Counter

N = int(input())

counter = Counter()
nodes = defaultdict(list)
edges = []

for i in range(N - 1):
    u, v = map(int, input().split(' '))
    nodes[u].append((v, i))
    nodes[v].append((u, i))
    edges.append((u, v))

K = 0
for node in nodes.values():
    K = max(K, len(node))

checked = set()
queue = deque([(1, 0)])
edge_colors = [0] * N

while queue:
    u, uc = queue.popleft()
    checked.add(u)
    color = 1
    for v, e in nodes[u]:
        if v in checked:
            continue
        if color == uc:
            color += 1
        edge_colors[e] = color
        queue.append((v, color))
        color += 1

print(K)
for i in range(N - 1):
    print(edge_colors[i])
### BUGGY CODE ###

x = int(input())
prime_table = []

def judge(n):
    for i in prime_table:
        if n%i == 0:
            return False
    prime_table.append(n)
    return True

num = 1
p = True
while p == True:
    num += 1
    if judge(num) == True:
        if num >= x:
            p = False

print(num)

### FIXED CODE ###

x = int(input())

def is_prime(n):
    if n <= 1:
        return False
    for i in range(2, x):
        if x%i == 0:
            return False
    return True

while is_prime(x) == False:
    x += 1

print(x)
### BUGGY CODE ###

import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
k, s = na()

count = 0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x + y + z == s:
        count += 1
print(count)

### FIXED CODE ###

import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()
 
k, s = na()

count = 0
for x in range(k+1):
  for y in range(k+1):
      if s-x-y >= 0 and s-x-y <= k:
        count += 1
print(count)
### BUGGY CODE ###

#template
def inputlist(): return [int(j) for j in input().split()]
#template
#issueから始める
N,X,Y = inputlist()
graph = [[] for _ in range(N+1)]
for i in range(1,N):
    graph[i].append(i+1)
    graph[i+1].append(i)
graph[X].append(Y)
graph[Y].append(X)
seen = [False]*(N+1)
ans = [0]*(N+1)
def bfs(i):
    from collections import deque
    que = deque()
    que.append([i,0])
    seen[i] = True
    while len(que)!=0:
        li = que.popleft()
        x = li[0]
        count = li[1]
        for j in graph[x]:
            if seen[j]:
                continue
            seen[j] = True
            counta= count + 1
            que.append([j,counta])
            ans[counta]+=1
for i in range(1,N+1):
    seen = [False]*(N+1)
    bfs(i)
for i in range(1,N):
    print(ans[i]//2)

### FIXED CODE ###

#template
def inputlist(): return [int(j) for j in input().split()]
#template
#issueから始める
N,X,Y = inputlist()
graph = [[] for _ in range(N+1)]
for i in range(1,N):
    graph[i].append(i+1)
    graph[i+1].append(i)
graph[X].append(Y)
graph[Y].append(X)
seen = [False]*(N+1)
ans = [0]*(N+1)
def bfs(i):
    from collections import deque
    que = deque()
    que.append([i,0])
    seen[i] = True
    while len(que)!=0:
        li = que.popleft()
        x = li[0]
        count = li[1]
        for j in graph[x]:
            if seen[j]:
                continue
            seen[j] = True
            counta= count + 1
            que.append([j,counta])
            ans[counta]+=1
for i in range(1,N+1):
    seen = [False]*(N+1)
    bfs(i)
for i in range(1,N):
    print(ans[i]//2)
### BUGGY CODE ###

import math

def isprime(number):
    for i in range(2, number):
        if number % i == 0:
            return False
    return True

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

if B < A:
    C = B
    B = A
    A = C
# A <= B

for i in range(2, round(A / 2 + 1)):
    if A % i == 0:
        if B % i == 0:
            if isprime(i):
                count += 1

print(str(count))


### FIXED CODE ###

from fractions import gcd
def f(n):
    tmp = n
    cnt = 0
    i = 2
    while i <= n**0.5 + 1:
        if tmp < i:
            break
        if tmp % i == 0:
            cnt += 1
            while tmp % i == 0:
                tmp //= i
        i += 1
    if tmp != 1:
        cnt += 1
    return cnt

A, B = map(int, input().split())
g = gcd(A, B)
ans = f(g) + 1
print(ans)