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

A,B = map(int,input().split())
ans = 0
for i in range(A,B+1):
    ans = ans ^ i
    
print(ans)

### FIXED CODE ###

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

def calc(a):
    cnt = (a + 1) / 2
    ans = int(cnt  % 2)
    if a % 2 == 0:
        ans ^= a
        
    return ans
    
print(calc(B)^calc(A-1))
### BUGGY CODE ###

N = int(input())
P = [int(input()) for i in range(N)]
ans = 0
for i in range(N):
    nowc = 1
    now = P[i]
    for j in range(i+1,N):
        if P[j] == now+1:
            nowc += 1
            now += 1
    ans = max(ans,nowc)
print(N-ans)

### FIXED CODE ###

N = int(input())
P = [int(input()) for i in range(N)]
ind = [0 for i in range(N)]
for i in range(N):
    ind[P[i]-1] = i
ans = 0
now = 1
for i in range(1,N):
    if ind[i] > ind[i-1]:
        now+=1
    else:
        ans = max(ans,now)
        now = 1
ans = max(ans,now)
print(N-ans)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
# debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)

N = ini()
adj = [[] for _ in range(N)]

for i in range(N - 1):
    a, b = [x - 1 for x in inm()]
    adj[a].append(b)
    adj[b].append(a)

depth = [(0, 0) for _ in range(N)]


def solve():
    def gather(node, p):
        md1, md2 = 0, 0
        for x in adj[node]:
            if x != p:
                dx = gather(x, node)
                if md1 < dx:
                    md2 = md1
                    md1 = dx
                elif md2 < dx:
                    md2 = dx
        depth[node] = (md1, md2)
        return 1 + md1

    gather(0, -1)

    def distribute(node, p):
        d1, d2 = depth[node]
        if p >= 0:
            pd1, pd2 = depth[p]
            if pd1 == 1 + d1:
                pd1 = pd2
            if d2 < pd1 + 1:
                d2 = pd1 + 1
        max_len = d1 + d2 + 1
        for x in adj[node]:
            if x != p:
                l = distribute(x, node)
                if max_len < l:
                    max_len = l
        return max_len

    max_len = distribute(0, -1)
    if max_len == 1:
        return True
    if max_len == 2:
        return False
    return (max_len + 1) % 3 != 0


print("First" if solve() else "Second")


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
# debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)

N = ini()
adj = [[] for _ in range(N)]

for i in range(N - 1):
    a, b = [x - 1 for x in inm()]
    adj[a].append(b)
    adj[b].append(a)

depth = [(0, 0) for _ in range(N)]


def solve():
    stk = [(0, -1, False)]
    while stk:
        node, p, agg = stk.pop()
        if not agg:
            stk.append((node, p, True))
        md1, md2 = 0, 0
        for x in adj[node]:
            if x == p:
                continue
            if agg:
                dx, _ = depth[x]
                dx += 1
                if md1 < dx:
                    md2 = md1
                    md1 = dx
                elif md2 < dx:
                    md2 = dx
            else:
                stk.append((x, node, False))
        if agg:
            depth[node] = (md1, md2)

    stk = [(0, -1)]
    max_len = 0
    while stk:
        node, p = stk.pop()
        d1, d2 = depth[node]
        if p >= 0:
            pd1, pd2 = depth[p]
            if pd1 == 1 + d1:
                pd1 = pd2
            if d2 < pd1 + 1:
                d2 = pd1 + 1
        if max_len < d1 + d2 + 1:
            max_len = d1 + d2 + 1
        for x in adj[node]:
            if x != p:
                stk.append((x, node))

    if max_len == 1:
        return True
    if max_len == 2:
        return False
    return (max_len + 1) % 3 != 0


print("First" if solve() else "Second")
### BUGGY CODE ###

import sys
f = sys.stdin


def create_prime(n):
    prime = [1] * (n + 1)
    prime[:2] = [0, 0]
    for i in range(len(prime)):
        if prime[i]:
            for j in range(2 * i, len(prime), i):
                prime[j] = 0
    return prime

prime = create_prime(50000)

while True:
    n = int(f.readline())
    if n == 0:
        break
    print(sum(1 for i in range(n // 2 + 1) if prime[i] and prime[n - i]))

### FIXED CODE ###

import sys
f = sys.stdin

def create_prime(n):
    prime = [1] * (n + 1)
    prime[:2] = [0, 0]
    for i in range(len(prime)):
        if prime[i]:
            for j in range(2 * i, len(prime), i):
                prime[j] = 0
    return prime

sieve = create_prime(50000)

prime = []
for i in range(25001):
    if sieve[i]:
        prime.append(i)

while True:
    n = int(f.readline())
    if n == 0:
        break
    cnt = 0
    temp = n // 2
    for i in prime:
        if i > temp:
            break
        if sieve[n - i]:
            cnt += 1
    print(cnt)
### BUGGY CODE ###

N,K = map(int,input().split())
asiba = list(map(int,input().split()))
dp =[0] *N

#初期化
dp[0]=0
dp[1]=abs(asiba[1]-asiba[0])

for i in range(2,N):
    dp[i] = min(dp[i-j]+abs(asiba[i]-asiba[i-j]) for j in range(1,min(i+1,K+1)))
    
print(dp[N-1])

### FIXED CODE ###

def main():
  n, k = [int(e) for e in input().split()]
  h = [int(e) for e in input().split()]
  cost = [0] * n
  for i in range(1, n):
    cost[i] = min(abs(h[i] - h[j]) + cost[j] for j in range(max(0, i - k), i))
  print(cost[n - 1])
main()
### BUGGY CODE ###

N,A,B = map(int, input().split())
adds = A + B
times = (N-1) // (adds + 1)
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)
    
    


### FIXED CODE ###

N,A,B = map(int, input().split())
adds = A + B
times = N // adds
boalsLen = adds * times
count = A * times


while True:
    if boalsLen > N:
        break
    
    tmpBoalsLen = boalsLen + A
    if tmpBoalsLen > N:
        addBoals = N - boalsLen
        count += addBoals
        break
    
    boalsLen = tmpBoalsLen
    boalsLen += B
    count += A

print(count)
### BUGGY CODE ###

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

mod = (10**9)+7
res = 0
for i in range(N-1):
    for j in range(i+1,N):
       res += ((A[i] % mod) * (A[j] % mod)) % mod
    
print(res % mod)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
A_j = sum(A)
mod = (10**9)+7
res = 0
for i in range(N-1):
    A_j -= A[i]
    res += (A[i] * (A_j % mod)) % mod

print(res % mod)
### BUGGY CODE ###

N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

res = -float("inf")
for i in range(2**N):
  X = 0
  Y = 0
  for j in range(N):
    if (i>>j)&1 == 1:
      X += V[j]
      Y += C[j]
  res = max(res, X-Y)
  
print(res)

### FIXED CODE ###

N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

res = -float("inf")
for i in range(2**N):
  X = 0
  Y = 0
  for j in range(N):
    if (i>>j)&1 == 1:
      X += V[j]
      Y += C[j]
  res = max(res, X-Y)
  
print(res)
### BUGGY CODE ###

from heapq import heappop, heappush
import sys
input = sys.stdin.readline
h, w, k = map(int, input().split())
x1, y1, x2, y2 = [int(a) - 1 for a in input().split()]
c = [input() for _ in range(h)]

inf = 10 ** 7
d = [[[inf] * 4 for _ in range(w)] for _ in range(h)]
move = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def dijkstra():
    que = []
    for i in range(4):
        d[x1][y1][i] = 0
        heappush(que, (0, x1, y1, i))
    
    while len(que):
        dist, cur_x, cur_y, dir = heappop(que)
        if d[cur_x][cur_y][dir] < dist:
            continue
        if cur_x == x2 and cur_y == y2:
            break
        for i, (dx, dy) in enumerate(move):
            memo = dist
            if i != dir:
                memo = -(-dist // k) * k
            
            to_x, to_y = cur_x + dx, cur_y + dy
            if 0 <= to_x < h and 0 <= to_y < w and c[to_x][to_y] == '.':
                if d[to_x][to_y][i] > memo + 1:
                    d[to_x][to_y][i] = memo + 1
                    heappush(que, (memo + 1, to_x, to_y, i))

dijkstra()
if all(d[x2][y2][i] == inf for i in range(4)):
    print(-1)
else:
    print(-(-min(d[x2][y2]) // k))

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
h, w, k = map(int, input().split())
x1, y1, x2, y2 = [int(a) - 1 for a in input().split()]
c = [input() for _ in range(h)]

inf = 10 ** 8
d = [[inf for _ in range(w)] for _ in range(h)]
move = [(1, 0), (0, 1), (-1, 0), (0, -1)]


que = deque()
for i in range(4):
    d[x1][y1] = 0
    que.append((x1, y1))
    
while len(que):
    cur_x, cur_y = que.popleft()
    if cur_x == x2 and cur_y == y2:
        break
    for dx, dy in move:
        to_x, to_y = cur_x, cur_y
        for _ in range(k):
            to_x += dx
            to_y += dy
            if 0 <= to_x < h and 0 <= to_y < w and c[to_x][to_y] == '.':
                if d[to_x][to_y] > d[cur_x][cur_y] + 1:
                    d[to_x][to_y] = d[cur_x][cur_y] + 1
                    que.append((to_x, to_y))
                elif d[to_x][to_y] == d[cur_x][cur_y] + 1:
                    continue
                else:
                    break
            else:
                break


print(-1 if d[x2][y2] == inf else d[x2][y2])
### BUGGY CODE ###

from collections import Counter

def factorization(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N = int(input())
ANS = 0
for i in range(1, N+1):
    c = Counter(factorization(i))
    ans = 1
    for j in c.values():
        ans *= (j+1)
    ANS += i*ans

print(ANS)

### FIXED CODE ###

N = int(input())

ans = 0
for i in range(1, N+1):
    x = N//i
    ans += i*x*(x+1)//2

print(ans)
### BUGGY CODE ###

N, Q = map(int, input().split())
S = list(input())
start_pair = [-1]
for j in range(N-1):
    if S[j] == 'A' and S[j+1] == 'C':
        start_pair.append(j)
for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    Flag = [1 for x in start_pair if l <= x < r]
    print(sum(Flag))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
T = [0]*N
for i in range(1, N):
    if S[i-1:i+1] == 'AC':
        T[i] = T[i-1] + 1
    else:
        T[i] = T[i-1]
for j in range(Q):
    left, right = map(int, input().split())
    print(T[right-1]-T[left-1])
### BUGGY CODE ###

#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
cnt = 0

for i in range(0, N):
    if all(P[i] <= P[j] for j in range(0, i+1)):
        cnt += 1

print(cnt)

### FIXED CODE ###

#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
cnt = 0
tmp = 10 ** 10

for i in range(N):
    if tmp >= P[i]:
        cnt += 1
    tmp = min(tmp, P[i])

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

N = int(input())
H = [int(s) for s in input().split()]
l=0
for i in range(N):
  t_l=0
  for j in range(i, N-1):
    if H[j] >= H[j+1]:
      t_l = t_l + 1
    else:
      break
  if l < t_l:
    l = t_l
  i=i+t_l+1
print(l)


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
l=0
t_l = 0
for i in range(N-1):
  if H[i] >= H[i+1]:
    t_l = t_l + 1
    if l < t_l:
      l = t_l
  else:
    t_l=0
print(l)
### BUGGY CODE ###

N, K, L = map(int,input().split())
data = [[0, 0] for _ in range(N)]
Lpath = [[] for _ in range(N)]
Tpath = [[] for _ in range(N)]

for _ in range(K):
    p, q = map(int,input().split())
    p -= 1
    q -= 1
    Lpath[p].append(q)
    Lpath[q].append(p)
    
for _ in range(L):
    r, s = map(int,input().split())
    r -= 1
    s -= 1
    Tpath[r].append(s)
    Tpath[s].append(r)
    
for i in range(N):
    if data[i][0]:
        continue
    data[i][0] = i + 1
    stack = [i]
    while stack:
        s = stack.pop()
        for to in Lpath[s]:
            if data[to][0]:
                continue
            data[to][0] = i + 1
            stack.append(to)

for i in range(N):
    if data[i][1]:
        continue
    data[i][1] = i + 1
    stack = [i]
    while stack:
        s = stack.pop()
        for to in Tpath[s]:
            if data[to][1]:
                continue
            data[to][1] = i + 1
            stack.append(to)

ans = [0] * N
            
for i in range(N):
    ans[i] = data.count(data[i])

print(*ans)

### FIXED CODE ###

from collections import defaultdict
N, K, L = map(int,input().split())
data = [[0, 0] for _ in range(N)]
Lpath = [[] for _ in range(N)]
Tpath = [[] for _ in range(N)]

for _ in range(K):
    p, q = map(int,input().split())
    p -= 1
    q -= 1
    Lpath[p].append(q)
    Lpath[q].append(p)
    
for _ in range(L):
    r, s = map(int,input().split())
    r -= 1
    s -= 1
    Tpath[r].append(s)
    Tpath[s].append(r)
    
for i in range(N):
    if data[i][0]:
        continue
    data[i][0] = i + 1
    stack = [i]
    while stack:
        s = stack.pop()
        for to in Lpath[s]:
            if data[to][0]:
                continue
            data[to][0] = i + 1
            stack.append(to)

for i in range(N):
    if data[i][1]:
        continue
    data[i][1] = i + 1
    stack = [i]
    while stack:
        s = stack.pop()
        for to in Tpath[s]:
            if data[to][1]:
                continue
            data[to][1] = i + 1
            stack.append(to)

ans = [0] * N
d = defaultdict(int)         
for i in range(N):
    d[tuple(data[i])] += 1
for i in range(N):
    ans[i] = d[tuple(data[i])]

print(*ans)
### BUGGY CODE ###

ABC = 'ABC'
S = list(input())

dp = [0, 0, 0, 0]
dp[3] = 1

for i in range(len(S))[::-1]:
    c = S[i]
    if c == '?':
        dp[0] = 3 * dp[0] + dp[1]
        dp[1] = 3 * dp[1] + dp[2]
        dp[2] = 3 * dp[2] + dp[3]
        dp[3] = 3 * dp[3]
    elif c == 'A':
        dp[0] = 1 * dp[0] + dp[1]
        dp[1] = 1 * dp[1]
        dp[2] = 1 * dp[2]
        dp[3] = 1 * dp[3]
    elif c == 'B':
        dp[0] = 1 * dp[0]
        dp[1] = 1 * dp[1] + dp[2]
        dp[2] = 1 * dp[2]
        dp[3] = 1 * dp[3]
    elif c == 'C':
        dp[0] = 1 * dp[0]
        dp[1] = 1 * dp[1]
        dp[2] = 1 * dp[2] + dp[3]
        dp[3] = 1 * dp[3]

print(dp[0] % 1000000007)


### FIXED CODE ###

def we_love_abc(S: str)->int:
    ABC = 'ABC'
    MOD = 1000000007

    dp = [0, 0, 0, 0]
    dp[3] = 1

    for c in reversed(S):
        for j in range(3):
            m1 = 3 if c == '?' else 1
            m2 = 1 if c == '?' or c == ABC[j] else 0
            dp[j] = (m1 * dp[j] + m2 * dp[j+1]) % MOD
        dp[3] = (3 if c == '?' else 1) * dp[3]
        dp[3] %= MOD

    return dp[0] % MOD


if __name__ == "__main__":
    S = input()
    ans = we_love_abc(S)
    print(ans)
### BUGGY CODE ###

# coding: utf-8
import numpy as np


def solve(*args: str) -> str:
    h, w, k = map(int, args[0].split())
    white = np.array([[n for n in map(int, S)] for S in args[1:]])

    ret = h*w
    for b in range(2**(h-1)):
        y_end = [i+1 for i in range(h-1) if (b >> i) & 1 == 1]
        count = len(y_end)
        A = np.array(tuple(x.sum(axis=0) for x in np.vsplit(white, y_end)))
        S = np.zeros((1, len(A)), dtype=int)
        for x in range(w):
            S += A[:, x]
            if (k < S).any():
                S = A[:, x]
                count += 1

        ret = min(ret, count)

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


### FIXED CODE ###

import numpy as np


def solve(*args: str) -> str:
    h, w, k = map(int, args[0].split())
    white = np.array([[n for n in map(int, S)] for S in args[1:]])

    ret = h*w
    for b in range(2**(h-1)):
        h_cuts = list(i+1 for i in range(h-1) if (b >> i) & 1 == 1)
        count = len(h_cuts)
        if ret < count:
            continue

        A = np.array(list(x.sum(axis=0) for x in np.vsplit(white, h_cuts)))
        if (k < A).any():
            continue

        S = np.zeros((1, len(A)), dtype=int)
        for x in range(w):
            S += A[:, x]
            if (k < S).any():
                S = A[:, x]
                count += 1
                if ret < count:
                    break

        ret = min(ret, count)

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

maxR = N // R
ans = 0
for r in range(maxR+1):
    if r * R == N:
        ans += 1
        continue
    n = N - r * R
    maxG = n // G
    for g in range(maxG+1):
        if g * G == n:
            ans += 1
            continue
        nn = n - g * G
        maxB = nn // B
        for b in range(maxB+1):
            if b * B == nn:
                ans += 1

print(ans)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
R, G, B = sorted([R, G, B], reverse=True)
maxR = N // R
ans = 0
if R == 1:
    ans = (N+2)*(N+1) // 2
    print(ans)
    quit()

for r in range(maxR+1):
    if r * R == N:
        ans += 1
        continue
    n = N - r * R
    maxG = n // G
    for g in range(maxG+1):
        if g * G == n:
            ans += 1
            continue
        nn = n - g * G
        maxB = nn // B
        for b in range(maxB+1):
            if b * B == nn:
                ans += 1

print(ans)
### BUGGY CODE ###

n,k,q=(int(x) for x in input().split())
a=[]
p=[]
for i in range(0,q):
    temp=int(input())
    a.append(temp)
for j in range(0,n):
    p.append(a.count(j+1))
border=-k+q
for m in range(0,n):
    if p[m] >border:
        print('Yes')
    else:
        print('No')
#print(p)


### FIXED CODE ###

n,k,q=(int(x) for x in input().split())
a=[]
p=[0]*n
for i in range(0,q):
    temp=int(input())
    p[temp-1]+=1
border=-k+q

res = '\n'.join('Yes' if p[j]> border else 'No' for j in range(0,n))

print(res)
### BUGGY CODE ###

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

x = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for _ in range(M):
    L, R = map(int, input().split())
    x[L][R] += 1

c = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
for i in range(1, N + 1):
    for j in range(1, N + 1):
        c[i][j] += c[i][j - 1] + x[i][j]

for _ in range(Q):
    P, Q = map(int, input().split())
    ans = 0
    for i in range(P, Q + 1):
        ans += c[i][Q] - c[i][P - 1]
    print(ans)


### FIXED CODE ###

def arr(row, column, value): return [[value for _ in range(column)] for _ in range(row)]

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

sum_range = arr(n + 1, n + 1, 0)
#sum_range[0][0] - sum_range[n][n]まで
#初期値0
#行列値は1からnを取るが、累積和を加算する過程で行列を1引いたものを参照するので、[0][0]がエラーにならないと便利？

for _ in range(m):
    L, R = map(int, input().split())
    sum_range[L][R] += 1#(L, R)間を運行す列車の数を代入
    
for L in range(1, n + 1):
    for R in range(1, n + 1):
        #累積和を取る（53:44あたり）
        #https://www.youtube.com/watch?v=OdJH-io-sVw
        sum_range[L][R] += sum_range[L - 1][R]
        sum_range[L][R] += sum_range[L][R - 1]
        sum_range[L][R] -= sum_range[L - 1][R - 1]

#print(sum_range)
for _ in range(q):
    p, q = map(int, input().split())
    ans = sum_range[q][q] - sum_range[p - 1][q] - sum_range[q][p - 1] + sum_range[p - 1][p - 1]
    print(ans)
### BUGGY CODE ###

# 大きさがsum(a)のスライムが1匹いる
# dp[l][r]=min(区間[l,r]を分解するための最小コスト)
import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
INF=10**15
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n+1)
for i in range(n):
    b[i+1]=b[i]+a[i]
dp=[[-1]*n for i in range(n)]
for i in range(n):
    dp[i][i]=0
def memo(i,j):
    if dp[i][j]>=0:
        return dp[i][j]
    ans=INF
    for k in range(i,j):
        ans=min(ans,memo(i,k)+memo(k+1,j))
    dp[i][j]=ans+b[j+1]-b[i]
    return dp[i][j]
print(memo(0,n-1))

### FIXED CODE ###

# 大きさがsum(a)のスライムが1匹いる
# dp[l][r]=min(区間[l,r]を分解するための最小コスト)
n=int(input())
a=list(map(int,input().split()))
INF=10**15
dp=[[0]*n for i in range(n)]
for i in range(n):
    dp[i][i]=a[i]
for i in range(n-1):
    for j in range(i+1,n):
        dp[i][j]=dp[i][j-1]+a[j]

for i in range(n-1):
    for j in range(i+1,n):
        ans=INF
        # print(j-i-1,j)
        for k in range(j-i-1,j):
            ans=min(ans,dp[j-i-1][k]+dp[k+1][j])
        if i<n-2:
            dp[j-i-1][j]+=ans
        else:
            print(ans)
### BUGGY CODE ###

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

cf=[]
for i in range(2,min(a,b)+1):
    if a % i == 0 and b % i == 0:
        cf.append(i)

n=min(a,b)
is_prime=[True]*(n+1)
is_prime[0],is_prime[1]=False,False
for i in range(2,int(n**0.5)+1):
    if not is_prime[i]:continue
    for j in range(i*2,n+1,i):
        is_prime[j]=False
prime=[i for i in range(n+1) if is_prime[i]]

number=prime
answer=cf
flag=0
count=1
for i in answer:
    if i==number[flag]:
        count +=1
        flag +=1

print(count)

### FIXED CODE ###

from collections import Counter
def prime_fact(n):
    a=[]
    while n%2==0:
        a.append(2)
        n //=2
    f=3
    while f**2<=n:
        if n%f==0:
            a.append(f)
            n //=f
        else:f +=2
    if n!=1:a.append(n)
    return a

a,b=map(int,input().split())
a_key=Counter(prime_fact(a))
b_key=Counter(prime_fact(b))
print(len(a_key&b_key)+1)
### BUGGY CODE ###

H,N=map(int,input().split())
A=[]
B=[]

for _ in range(N):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

dp=[0]
AM=max(A)
BM=max(B)
for i in range(1,H+AM):
    dcand=dp[-1]+BM
    for j in range(N):
        dcand=min(dcand,B[j]+min(dp[i-A[j]:]))
    dp.append(dcand)

print(min(dp[H:]))

### FIXED CODE ###

h, n = map(int, input().split())
magics = [list(map(int, input().split())) for _ in range(n)]
max_a = max(a for a, b in magics)
dp = [0] * (h + max_a)
for i in range(1, h + max_a):
    dp[i] = min(dp[i - a] + b for a, b in magics)
print(dp[h])
### BUGGY CODE ###

N = int(input())
life = list(map(int, input().split()))
while len(life) >1:
    life.sort()
    if life[0] == 1 : break
    life_array = [life[0]] + [i%life[0] for i in life if i%life[0] !=0]
    life = []
    for i in life_array:
        if i not in life:
            life.append(i)
 
print(life[0])

### FIXED CODE ###

N = int(input())
life = list(map(int, input().split()))
while len(life) >1:
    life.sort()
    life_array = [life[0]] + [i%life[0] for i in life if i%life[0] !=0]
    life = life_array
    #for i in life_array:
        #if i not in life:
            #life.append(i)
 
print(life[0])
### BUGGY CODE ###

N = int(input())
L = []
M0 = []
M = []
C = 0
for i in range(N):
  L.append(input())
for j1 in range(N):
  for j2 in range(10):
    M0.append(L[j1][j2])
  M.append(M0)
  M0 = []
for i in range(N):
  M[i].sort()
for l in range(N):
  for m in range(N):
    if m > l:
      if M[m] == M[l]:
        C += 1
print(C)

### FIXED CODE ###

from collections import Counter as CC
N = int(input())
L = [str(sorted(list(input()))) for i in range(N)]
C = CC(L)
print(sum([C[i] * (C[i] - 1) // 2 for i in C if C[i] > 1]))