Harryxun/stf_run huggingface dataset:
import sys
H, W, M = map(int, input().split())
lis =[]
Hlis = [0]*H
Mlis = [0]*M
for _ in range(M):
    Ch, Cm = map(int, input().split())
    Hlis[Ch-1] += 1
    Mlis[Cm-1] += 1
    lis.append([Ch, Cm])

Hmax = max(Hlis)
Hidx = [i+1 for i, v in enumerate(Hlis) if v == Hmax]
Mmax = max(Mlis)
Midx = [i+1 for i, v in enumerate(Mlis) if v == Mmax]

for i in range(len(Hidx)):
    for j in range(len(Midx)):
        if [Hidx[i], Midx[j]] not in lis:
            print(Hmax+Mmax)
            sys.exit()
else:
    print(Hmax + Mmax -1)

### FIXED CODE ###

import sys
H, W, M = map(int, input().split())
lis =set()
Hlis = [0]*H
Wlis = [0]*W
for _ in range(M):
    Ch, Cm = map(int, input().split())
    Hlis[Ch-1] += 1
    Wlis[Cm-1] += 1
    lis.add((Ch, Cm))

Hmax = max(Hlis)
Hidx = [i+1 for i, v in enumerate(Hlis) if v == Hmax]
Wmax = max(Wlis)
Widx = [i+1 for i, v in enumerate(Wlis) if v == Wmax]

for i in range(len(Hidx)):
    for j in range(len(Widx)):
        if (Hidx[i], Widx[j]) not in lis:
            print(Hmax+Wmax)
            sys.exit()
else:
    print(Hmax + Wmax -1)
N,M=map(int,input().split())
a=[]
b=0 in range(N)
for i in range(M):
    a.append(int(input()))
j=M-1
if j>=0 and a[0]==1:
    f1=0
    f2=1
elif j>=0 and a[0]==2:
    f1=1
    f2=1
else:
    f1=1
    f2=2
def f(n,a,j):
    if n>2:
        if j==-1 or ((n-1)!=a[j] and (n-2)!=a[j]):
            return (f(n-1,a,j)+f(n-2,a,j))%100000007
        if j>0 and a[j]==a[j-1]+1:
            return 0
        if j+1<M and a[j+1]==a[j]+1:
            return 0
        elif (n-1)==a[j]:
            return f(n-2,a,j-1)%100000007
        elif (n-2)==a[j]:
            return f(n-1,a,j)%100000007
    elif n==1:
        return f1
    else:
        return f2
print(f(N,a,j)%100000007)

### FIXED CODE ###

N,M=map(int,input().split())
a=[]
b=[0]*N
for i in range(M):
    a.append(int(input()))
if M==0:
    j=-1
else:
    j=0
if N==1:
    b[0]=1
elif M>0 and a[0]==1:
    b[0]=0
    b[1]=1
elif M>0 and a[0]==2:
    b[0]=1
    b[1]=1
else:
    b[0]=1
    b[1]=2
for i in range(N-2):
    if j==M-1 or (j>=0 and (i+2)!=a[j] and (i+1)!=a[j]):
        b[i+2]=b[i+1]+b[i]
    if j>0 and a[j]==a[j-1]+1:
        b[N-1]=0
    if j+1<M and a[j+1]==a[j]+1:
        b[N-1]=0
    elif j>=0 and (i+2)==a[j]:
        b[i+2]=b[i]
    elif j>=0 and j+1<M and (i+1)==a[j]:
        j+=1
        b[i+2]=b[i+1]
    elif j>=0 and (i+1)==a[j]:
        b[i+2]=b[i+1]
print(b[N-1]%1000000007)
data = raw_input().split(' ')
data = sorted(map(int, data))[::-1]
print ' '.join(data)

### FIXED CODE ###

data = raw_input().split(' ')
data = map(str, sorted(map(int, data))[::-1])
print ' '.join(data)
a,b = map(int,input())                    

if a<=0 and 0<=b:
    print("Zero")
elif 0<a:
    print("Positive")
elif (b-a+1)%2:
    print("Negative")
else:
    print("Positive")


### FIXED CODE ###

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

if a<=0 and 0<=b:
    print("Zero")
elif 0<a:
    print("Positive")
elif (b-a+1)%2:
    print("Negative")
else:
    print("Positive")
N = input()

W = ['Sunny','Cloudy','Rainy']

for i in range(3):
  if N == W[i]:
    print(W[i+1])
  else:
    pass
  i+=1

### FIXED CODE ###

N = input()

W = ['Sunny','Cloudy','Rainy']

for i in range(3):
  if N == 'Rainy':
    print('Sunny')
    break
  elif N == W[i]:
    print(W[i+1])
  else:
    pass
  i+=1
n = int(input())
a = [int(i) for i in input().split() if i % 2 == 0]
for i in a:
    if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

### FIXED CODE ###

a, b, c = input().split()
count = 0
if(a == b): count += 1
if(b == c): count += 1
if(c == a): count += 1

print("Yes" if(count == 1) else "No")
def get(a: list, b: list, pointer1: int, pointer2: int, k: int):
    # print(pointer1, len(a), pointer2, len(b))
    if pointer1 >= len(a) or pointer2 >= len(b) or a[pointer1] + b[pointer2] > k:
           return 0
    return max(pointer1 + pointer2, get(a, b, pointer1 + 1, pointer2, k), get(a, b, pointer1, pointer2 + 1, k))

def main():
    line1 = input()
    line2 = input()
    line3 = input()
    n, m, k = list(map(int, line1.split()))
    a = [0] + list(map(int, line2.split()))
    b = [0] + list(map(int, line3.split()))
    mark1, mark2 = 0, 0
    for i in range(1, len(a)):
        a[i] += a[i-1]
        if a[i] > k:
            mark1 = i
            break
    for i in range(1, len(b)):
        b[i] += b[i-1]
        if b[i] > k:
            mark2 = i
            break
    if mark1:
        a = a[:mark1]
    if mark2:
        b = b[:mark2]
    book = get(a, b, 0, 0, k)
    print(book)
    return

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    line1 = input()
    line2 = input()
    line3 = input()
    n, m, k = list(map(int, line1.split()))
    a = [0] + list(map(int, line2.split()))
    b = [0] + list(map(int, line3.split()))
    mark1, mark2 = 0, 0
    for i in range(1, len(a)):
        a[i] += a[i-1]
        if a[i] > k:
            mark1 = i
            break
    for i in range(1, len(b)):
        b[i] += b[i-1]
        if b[i] > k:
            mark2 = i
            break
    if mark1:
        a = a[:mark1]
    if mark2:
        b = b[:mark2]
    ans = 0
    for i in range(len(a)):
        target = k - a[i]
        tmp = 0
        low, high = 0, len(b)
        while low < high:
            mid = (low + high) // 2
            if b[mid] <= target:
                tmp = mid
                low = mid + 1
            else:
                high = mid - 1
        ans = max(ans, i + tmp)
    print(ans)
    return

if __name__ == "__main__":
    main()
from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = pos.pop()
                y = pos.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
        if len(pos + neg) == 1:
            print((pos + neg)[0])
            break
    
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = neg.pop()
                y = neg.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if len(pos) == 0 and len(neg) == 0:
            print(xmy)
            break

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()
k=int(input())
s=input()
if len(s) <= k:
    print(s)
else:
    print("{fname}...".format(fname = s[:k]))

### FIXED CODE ###

k=int(input())
s=input()
if len(s) <= k:
    print(s)
else:
    print(s[:k]+'...')
N, K=[int(i) for i in input().spit(" ")]
if K==1:
    print(0)
else:
    print(N-K)


### FIXED CODE ###

N, K=[int(i) for i in input().split(" ")]
if K==1:
    print(0)
else:
    print(N-K)
n = input()
wa = 0
for i in range(len(n)):
  wa += int(n[i])
if n%wa:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

n = input()
wa = 0
for i in range(len(n)):
  wa += int(n[i])
if int(n)%wa:
  print("No")
else:
  print("Yes")
a,b = map(int,input().split())
print(str(min(a,b)*max(a,b))

### FIXED CODE ###

a,b = map(int,input().split())
print(str(min(a,b))*max(a,b))
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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

print(gcd_list(A))

### FIXED CODE ###

from functools import reduce

def gcd(a,b):
    if a < b:
        (a,b) = (b,a)
    while 1:
        (a, b) = (b, a % b)
        if b == 0:
            return a

def gcd_list(numbers):
    return reduce(gcd, numbers)

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

print(gcd_list(A))
r = int(raw_input())

menseki = r ** 2 * 3.141592
shuu = 2 * r * 3.141592

print("{:.6f} {:.6f}".format(menseki, shuu))

### FIXED CODE ###

import math

r = float(raw_input())

menseki = r ** 2 * math.pi
shuu = 2 * r * math.pi

print("{:.6f} {:.6f}".format(menseki, shuu))
import numpy as np
N,Q = map(int,input().split())
S = input()
ans =[]
for i in range(N):
  if S[i] == 'A':
    if S[i+1] == 'C':
      ans.append(i)
ans2 = np.array(ans)
for i in range(Q):
  l,r = map(int,input().split())
  print(np.count_nonzero((l-2<ans2)&(ans2<r-1)))


### FIXED CODE ###

import numpy as np
N,Q = map(int,input().split())
S = input()
ans = np.zeros(N+1)
for i in range(N):
  ans[i+1] = ans[i] + (1 if S[i:(i+2)] == 'AC' else 0) 
for i in range(Q):
  l,r = map(int,input().split())
  print(int(ans[r-1] - ans[l-1]))
a,b,c,k=map(int,input().split())
vis=[1]*a + [0]*b + [-1]*c
s = 0

for i in vis[0:k]:
    s += i
    
print(s)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
if a >= k:
    vis = k
elif a + b >= k:
    vis = a
else:
    vis= a + (-1*(k-a-b))
    
print(vis)
#!/usr/bin/env python

def dfs(node, edge, vis):
    if vis[node]:
        return 0
    vis[node] = True
    count = 1
    for b in edge[node]:
        if not vis[b]:
            count += dfs(b, edge, vis)
    return count

n, m = [int(i) for i in input().split(' ')]

edge = [[] for i in range(n)]

for _ in range(m):
    a, b = [int(i) for i in input().split(' ')]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

vis = [False]*n

count = 0

for i in range(n):
    if not vis[i]:
        count = max(count, dfs(i, edge, vis))

print(count)


### FIXED CODE ###

#!/usr/bin/env python

import queue

def dfs(node, edge, vis):
    vis[node] = True
    count = 1
    vq = []
    vq.append(node)
    vq = queue.LifoQueue()
    vq.put(node)
    while not vq.empty():
        fnode = vq.get()
        for b in edge[fnode]:
            if not vis[b]:
                count += 1
                vq.put(b)
                vis[b] = True
    return count

n, m = [int(i) for i in input().split(' ')]

edge = [[] for i in range(n)]

for _ in range(m):
    a, b = [int(i) for i in input().split(' ')]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

vis = [False]*n

count = 0

for i in range(n):
    if not vis[i]:
        count = max(count, dfs(i, edge, vis))

print(count)
import numpy as np

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

a = mean(X)
print(a)
b = 0
for i in range(N):
    b +=(X[i]-a)**2
print(b)

### FIXED CODE ###

import math
from statistics import mean, median,variance,stdev
N = int(input())
X = list(map(int,input().split()))
a = sum(X)
ave = round(a/N)
b = 0
for i in range(N):
    b +=(X[i]-ave)**2
print(b)
import sys
sys.setrecursionlimit(100000)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

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

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

def lcm_li(li):
    if len(li) == 2:
        return lcm(li[0], li[1])
    else:
        x = lcm(li[0], li[1])
        x = [x] + li[2:]
        return lcm_li(x)

print(lcm_li(T))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

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

lcm = 1
for i in T:
    lcm = int(lcm * i // gcd(lcm, i))

print(lcm)
N,X=map(int,input().split())
L=list(map(int,input().split()))
d=0
i=0
while d<=X:
  d+=L[i]
  i+=1
print(i)

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
d=0
i=0
for i in range(N):
  d+=L[i]
  if d<=X:
    i+=1
  else:break
print(i+1)
import sys
input = sys.stdin.readline

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

U = 2 * 10 ** 6
fact = [1] * (U+1)
for n in range(1,U+1):
    fact[n] = fact[n-1] * n % MOD
fact_inv = [1] * (U+1)
fact_inv[U] = pow(fact[U],MOD-2,MOD)
for n in range(U,0,-1):
    fact_inv[n-1] = fact_inv[n] * n % MOD

def comb(n,k):
    if n == -1 and k == -1:
      return 1
    if k < 0 or k > n:
      return 0
    return fact[n] * fact_inv[k] * fact_inv[n-k] % MOD

answer = comb(3*M+N-1,N-1) # 何でもいいから作る
answer -= N * comb(M+N-2,N-1) # どれかが 2M+1 以上

# 「ちょうど1」がM個より多くある場合を引かなければいけない
# （既に引いた場合と背反）
for k in range(M+1,3*M+1):
    sgn = -1 if (k-M)%2 else 1
    # k個決める、残りは和が3M-k, 個数N-k
    x = comb(N,k)
    x *= comb(3*M-k+N-k-1,N-k-1)
    answer += sgn * x * comb(k-1,k-1-M)
answer %= MOD

print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline

import numpy as np

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

def cumprod_mod(arr):
    L = len(arr)
    Lsq = int(L**.5+1)
    arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD
    for n in range(1,Lsq):
        arr[n] *= arr[n-1,-1]; arr[n] %= MOD
    arr = arr.ravel()[:L]
    return arr

U = 5*10**6
x = np.arange(U,dtype=np.int64)
x[0] = 1
fact = cumprod_mod(x)

x = np.arange(U,0,-1,dtype=np.int64)
x[0] = pow(int(fact[-1]),MOD-2,MOD)
fact_inv = cumprod_mod(x)[::-1]

def comb(n,k):
    return fact[n] * fact_inv[k] % MOD * fact_inv[n-k] % MOD

x = comb(3*M+N-1,N-1) # 何でもいいから作る
y = N * comb(M+N-2,N-1) # どれかが 2M+1 以上

# 奇数がM+1個以上あるものを除く
odd_cnt = np.arange(M+2,3*M+1,2)
S = (3*M - odd_cnt)//2
bl = (odd_cnt <= N)&(S>=0)
odd_cnt = odd_cnt[bl]
S = S[bl]
arr = fact[N] * fact_inv[odd_cnt] % MOD * fact_inv[N-odd_cnt] % MOD
# SをN個で作る -> S+N-1 C N-1
arr *= fact[S+N-1] * fact_inv[N-1] % MOD * fact_inv[S] % MOD
arr %= MOD
z = arr.sum() % MOD

answer = x-y-z
answer %= MOD
print(answer)
s = input()
a = s.index('a')
sr = s[::-1]
z = sr.index('z')
print(s[a:-z])


### FIXED CODE ###

s = input()
a = s.index('A')
sr = s[::-1]
z = sr.index('Z')
print(len(s) - a - z)
s = str(input())
ans = 0
for i in range(len(s)):
    count = 0
    if S[i] == "A" or "T" or "C" or "G":
        count += 1
        for j in range(len(s)-i):
            if S[j] == "A" or "T" or "C" or "G":       
                count += 1:
            else:
                break:
    if ans < count:
        ans = count
print(ans)

### FIXED CODE ###

S = str(input())
ans = []
for i in range(len(S)):
    preans = []
    if S[i] == "A" or S[i] == "C" or S[i]  == "G" or S[i] =="T":
        preans.append(S[i])
        for j in range(1,len(S)-i):
            if S[i+j] == "A" or S[i+j] == "C" or S[i+j]  == "G" or S[i+j] =="T":
                preans.append(S[i+j])
            else:
                break
    if len(preans) > len(ans):
        ans = preans
if len(ans) == 2 and ans[0] == "A" and ans[1] == "C":
    print(0)
else:
    print(len(ans))
#D
N, K = map(int,input().split())
A = list(map(int,input().split()))

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        roop_start = now
        break
    visited.append(now)
    visited_set.add(now)
    
ind = visited.index(roop_start)
roop = visited[ind:]

if len(roop) != 0:
    print(roop[(K-ind)%len(roop)]+1)
else:
    print(visited[K]+1)

### FIXED CODE ###

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

now = 0
visited = [0]
visited_set = set([0])

for i in range(K):
    now = A[now] - 1
    if now in visited_set:
        break
    visited.append(now)
    visited_set.add(now)
if len(visited) == N:
    print(visited[K-1]+1)
else:    
    ind = visited.index(now)
    roop = visited[ind:]
    print(roop[(K-ind)%len(roop)]+1)
def show1(n, ans):
    for i in xrange(n):
        print ans[i],
    print

def show2(n, m, l, ans):
    for i in xrange(l):
        print ans[i] * m + 1,
    for i in xrange(l, n):
        print ans[i] * m,
    print

k = int(raw_input())
n = 50
ans = [0] * n
print n
if k <= n:
    for i in xrange(k):
        ans[i] = n - i
    show(n, ans)
else:
    ans = range(50, 0, -1)
    m = k / 50
    l = k % 50
    show2(n, m, l, ans)   


### FIXED CODE ###

def show1(n, ans):
    for i in xrange(n):
        print ans[i],
    print

def show2(n, m, l, ans):
    for i in xrange(l):
        print ans[i] + m + 1,
    for i in xrange(l, n):
        print ans[i] + m ,
    print

k = int(raw_input())
n = 50
ans = [0] * n
print n
if k <= n:
    for i in xrange(k):
        ans[i] = n - i
    show1(n, ans)
else:
    ans = range(50, 0, -1)
    m = k / 50 - 1
    l = k % 50
    show2(n, m, l, ans)
def LCM(m,n):
  for i in range(1,m+1)[::-1]:
    if n%i==0:
      return i
    
N,X=(int(i) for i in input().split(' '))
x=[int(i) for i in input().split(' ')]
x=[X]+x
D=x[1]-x[0]
for i in range(N):
  D=LCM(D,x[i+1]-x[i])
print(D)

### FIXED CODE ###

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right

def LCM(m,n):
  if m>n:
    m,n=n,m
  for i in range(1,m+1)[::-1]:
    if n%i==0:
      return i
    
N,X=(int(i) for i in input().split(' '))
x=[int(i) for i in input().split(' ')]
x=[X]+x
x=quick_sort(x)
D=abs(x[1]-x[0])
for i in range(N):
  D=LCM(D,abs(x[i+1]-x[i]))
print(D)
n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*(n//100)
lis = [-1]*m
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        break
    l[i] = x
    lis[x] = i
    ans += x
for i in range(lis[x],lis[x]+b):
    ans += l[i]
print(ans)

### FIXED CODE ###

n, x, m = map(int,input().split())
ans = x
num = 0
l = [0]*m
lis = [-1]*m
l[0] = x
lis[x] = num
for i in range(1,n):
    x = (x*x)%m
    num += 1
    if lis[x]!=-1:
        a = (n-i)//(i-lis[x])
        b = (n-i)%(i-lis[x])
        ans += a * sum(l[lis[x]:i])
        for j in range(lis[x],lis[x]+b):
            ans += l[j]
        break
    l[i] = x
    lis[x] = i
    ans += x
print(ans)
A,B,C = map(int,input())
min(B//A,C)

### FIXED CODE ###

A,B,C = map(int,input().split())
print(min(B//A,C))
aaaaaaaaaa


### FIXED CODE ###

c=input()
print(chr(ord(c)+1))
N = int(input())
high = [int(x) for x in input().split()]

top = 0

for i in range(N):
    challenge = True
    
    if count > 0:
        count -= 1
    else:
        while challenge == True and i < N-1:
            if high[i] >= high[i+1]:
                count += 1
                if i < N-1:
                    i += 1
            else:
                challenge = False
        
        if top < count:
            top = count

print(top)


### FIXED CODE ###

N = int(input())
high = [int(x) for x in input().split()]

top = 0
count = 0

for i in range(N):
    challenge = True
    
    if count > 0:
        count -= 1
    else:
        while challenge == True and i < N-1:
            if high[i] >= high[i+1]:
                count += 1
                if i < N-1:
                    i += 1
            else:
                challenge = False
        
        if top < count:
            top = count

print(top)
import math

A, B, C, D = map(int, input().split())

A -= 1

E = (C * D) // math.gcd(C, D)

ans = (B - B // C - B // D + B // E) - (A - A // C - A // D + A // E)

print(ans)

### FIXED CODE ###


A, B, C, D = map(int, input().split())

Cw = C
Dw = D

if Cw < Dw:
    Cw, Dw = Dw, Cw
while Cw % Dw != 0:
    Cw, Dw = Dw, Cw % Dw

E = C * D // Dw

A -= 1

ans = (B - B // C - B // D + B // E) - (A - A // C - A // D + A // E)

print(ans)
def dps(no, fno, d, hen, D, MD, P):
    D[no] = d
    P[no] = fno
    maxd = d
    for h in hen[no]:
        if h == fno:
            continue
        maxd = max(maxd, dps(h, no, d + 1, hen, D, MD, P))
    MD[no] = maxd
    return maxd


def main():
    N, u, v = map(int, input().split())
    hen = {}
    for i in range(N - 1):
        A, B = map(int, input().split())
        if A in hen.keys():
            hen[A].append(B)
        else:
            hen[A] = [B]
        if B in hen.keys():
            hen[B].append(A)
        else:
            hen[B] = [A]
    DEPTH = [-1 for i in range(N + 1)]
    MAX_DEPTH = [-1 for i in range(N + 1)]
    Parent = [-1 for i in range(N + 1)]
    dps(v, -1, 0, hen, DEPTH, MAX_DEPTH, Parent)
    ans = DEPTH[u]
    p = u
    for i in range((DEPTH[u] + 1) // 2):
        p = Parent[p]
        ans = max(ans, MAX_DEPTH[p])
    print(ans - 1)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def dps_rec(no, fno, d, hen, D, MD, P):
    D[no] = d
    P[no] = fno
    maxd = d
    for h in hen[no]:
        if h == fno:
            continue
        maxd = max(maxd, dps_rec(h, no, d + 1, hen, D, MD, P))
    MD[no] = maxd
    return maxd

def dps_stc(no, fno, d, hen, D):
    stack = [(no, fno, d)]
    while not stack == []:
        t = stack.pop()
        D[t[0]] = t[2]
        for h in hen[t[0]]:
            if h == t[1]:
                continue
            stack.append((h, t[0], t[2] + 1))

def main():
    N, u, v = map(int, input().split())
    hen = {}
    for i in range(N - 1):
        A, B = map(int, input().split())
        if A in hen.keys():
            hen[A].append(B)
        else:
            hen[A] = [B]
        if B in hen.keys():
            hen[B].append(A)
        else:
            hen[B] = [A]
    DEPTH_A = [-1 for i in range(N + 1)]
    DEPTH_T = [-1 for i in range(N + 1)]
    dps_stc(v, -1, 0, hen, DEPTH_A)
    dps_stc(u, -1, 0, hen, DEPTH_T)
    ans = 0
    for a, t in zip(DEPTH_A, DEPTH_T):
        if a > t:
            ans = max(ans, a - 1)

    print(ans)


if __name__ == '__main__':
    main()
N=int(input())
s=input()
if N%2==1:
  print("No")
else:
  for i in range(N):
    if s[i]!=s[N-i-1]:
      print("No")
      return(0)
  print("Yes")

### FIXED CODE ###

N=int(input())
s=input()
if N%2==1:
  print("No")
else:
  b=1
  for i in range(N//2):
    if s[i]!=s[N//2+i]:
      print("No")
      b=0
      break
      
  if b==1:
  	print("Yes")
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
p = 0

for i in range(n):
    j = i + 1
    while j < n:
        if i == j:
            pass
        elif a[i] % a[j] == 0:
            break
        else:
            pass
        if j == n - 1:
            p += 1
	    j += 1

print(p)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
m = max(a)
flag = [True]*(m+1)
c = [0]*(m+1)
b = list(sorted(a))
for i in b:
    x = i + i
    while x <= m:
        flag[x] = False
        x += i
    c[i] += 1
ans = 0
x = 0
l = []
ans = 0
for i in a:
    if flag[i] and c[i] <= 1:
        ans += 1
print(ans)