Harryxun/stf_run huggingface dataset:
import math
(a,b,c,d)=map(int,input().split())
g=int(c*d/math.gcd(c,d))
k=0
k+=int(b/c)+int(b/d)-int(b/g)-int((a-1)/c)-int((a-1)/d)+int((a-1)/g)

print(b-a+1-k)



### FIXED CODE ###

import math
import fractions
(a,b,c,d)=map(int,input().split())
g=c*d//fractions.gcd(c,d)
k=0
k+=b//c+b//d-b//g-int(a-1)//c-(a-1)//d+(a-1)//g

print(b-a+1-k)
while True:
  x,y = map(int, input().split())
  if(x+y == 0):
    break
  
  if(x>y):å
    print(y, x)
  else:
    print(x, y)


### FIXED CODE ###

while True:
  x,y = map(int, input().split())
  if(x+y == 0):
    break
  
  if(x>y):
    print(y, x)
  else:
    print(x, y)
N = import()
output = N*N*N
print(output)

### FIXED CODE ###

print((int(input()))**3)
n = int(input())
ans=0
while n>0:
  n%10+=ans
  n//=10
print(ans)

### FIXED CODE ###

# python template for atcoder1
from math import log10
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
ans = 0
l = log10(n)
if int(l) == l:
    ans = 10
else:
    while n > 0:
        ans += n % 10
        n //= 10
print(ans)
import sys

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

if N == 1:
    print(1)
    sys.exit()
max = A[-1]
memo = ['Yes'] * (10**6+1)
ans = 0
 
for i, A_i in enumerate(A):
    if memo[A_i] == 'No':
        continue
    for j in range(A_i, max+1, A_i):
        memo[j] = 'No'
    if A_i == A[i+1]:
        continue
    ans += 1
 
print(ans)

### FIXED CODE ###

N = int(input())
A = sorted(list(map(int, input().split())))
max = A[-1]
memo = ['Yes'] * (10**6+1)
ans = 0
 
for i, A_i in enumerate(A):
    if memo[A_i] == 'No':
        continue
    for j in range(A_i, max+1, A_i):
        memo[j] = 'No'
    if i != N-1 and A_i == A[i+1]:
        continue
    ans += 1
 
print(ans)
X-input()
if x in "753";
    print("YES")
else;
    print("NO")


### FIXED CODE ###

X=input()
if X in "753":
    print("YES")
else:
    print("NO")
mod = 10**9+7

def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod

X, Y = map(int, input().split())
if (X+Y)%3 != 0:
    print(0)
else:
    n = (X+Y)//3
    if X < n or Y < n or X > 2*n or Y > 2*n:
        print(0)
    else:
        k = X-n
        R = [0] * n
        for i in range(1,n):
            R[i] = Pow(i, mod-2)
        cmb = [0]*n
        cmb[0] = 1
        for i in range(n-1):
            cmb[i+1] = ((cmb[i]*(n-i))%mod)*R[i+1]%mod
        print(cmb[k])

### FIXED CODE ###

mod = 10**9+7

def Pow(a, n):
    if n == 0: return 1
    if n%2 == 0:
        return (Pow(a, n//2))**2%mod
    else:
        return Pow(a, n-1)*a%mod

X, Y = map(int, input().split())
if (X+Y)%3 != 0:
    print(0)
else:
    n = (X+Y)//3
    if X < n or Y < n or X > 2*n or Y > 2*n:
        print(0)
    else:
        k = min(X-n, Y-n)
        R = [0] * (k+1)
        for i in range(1,k+1):
            R[i] = Pow(i, mod-2)
        cmb = [0]*(k+1)
        cmb[0] = 1
        for i in range(k):
            cmb[i+1] = ((cmb[i]*(n-i))%mod)*R[i+1]%mod
        print(cmb[k])
n=int(input())
l=[list(map(int,input().split()))for i in range(n-1)]
for i in range(n-1):
  t=0
  for j in range(j,n-1):
    if t<l[j][1]:
      t=l[j][1]
    if t%l[j][2]!=0:
      t=(t%l[j][2]+1)*l[j][2]
    t+=l[j][0]
  print(t)
print(0)

### FIXED CODE ###

n=int(input())
m=[]
for _ in range(n-1):
  c,s,f=map(int,input().split())
  m.append(0)
  for i in range(len(m)):
    if m[i]>s:
      m[i]=s+((m[i]-s)//f+((m[i]-s)%f>0))*f+c
    else:#m[i]<=s
      m[i]=s+c
m.append(0)
for i in m:
  print(i)
def solve():
    s = input()
    return [c for c in s if c != "1"][0]


if __name__ == "__main__":
    print(solve())


### FIXED CODE ###

def solve():
    s = input()
    k = int(input())
    head_ones = 0
    for c in s:
        if c != "1":
            break
        else:
            head_ones += 1

    return "1" if head_ones >= k else [c for c in s if c != "1"][0]


if __name__ == "__main__":
    print(solve())
import math
n = int(input())
a = math.ceil(n/9)
b = n % 9 #
print(str(b) * a)

### FIXED CODE ###

s = input()
p = ""
c = ""
res = 0
for i in range(len(s)):
    c += s[i]
    if p != c:
        p = c
        c = ""
        res += 1
print(res)
a,b=map(int,input().split())
print(,a//b,a%b,f{a/b:f}')

### FIXED CODE ###

a,b=map(int,input().split())
print(a//b,a%b,f'{a/b:f}')
S=[str(x) for in input()]
ans=0
for i in range(4):
  if S[i]==S[i+1]:
  	ans+=1
    
    if ans>=1:
      print('Bad')
      else print('Good')

### FIXED CODE ###

S = input()

if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
   print("Bad")
else:
    print("Good")
N = int(input())

A = list(map(int), input().split())
if N % 2 == 0:
    print(sum(map(abs, A)))
else:
    neg = [a for a in A if a < 0]
    c = max(neg) if len(neg) > 0 else 0
    print(sum(map(abs, A)) - 2 * c)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
neg = [a for a in A if a < 0]
A = list(map(abs, A))

if len(neg) % 2 == 0:
    print(sum(A))
else:
    print(sum(A) - 2 * min(A))
from copy import deepcopy
answer = ""
while True:
    line = raw_input()
    while line.isspace() or not line: #!?!?!!!
        line = raw_input()
    if line == "0":
        break
    P, S = map(int, line.split())
    def check(data):
        return reduce(lambda a, b: a+b, data).count("?")
    def calc(seq):
        if "?" not in seq or not(0 <= seq.count("?") <= 1) :
            return seq
        if seq[-1] == "?":
            return seq[:-1] + sum(seq[:-1])
        a = seq[-1] - sum(s for s in seq[:-1] if s != "?")
        return [s if s != "?" else a for s in seq]
    def update(data):
        data = deepcopy(data)
        t_data = zip(*data)
        for i in xrange(P):
            for j, d in enumerate(calc(data[i])):
                data[i][j] = d
            for j, d in enumerate(calc(t_data[i])):
                data[j][i] = d
        return data
    data = [map(lambda x: int(x) if x.isdigit() else x, raw_input().split())
            for _ in xrange(P+1)]
    cdata = deepcopy(data)
    for _ in xrange(check(cdata)):
        cdata = update(cdata)
    ans = ""
    if check(cdata) == 0:
        for d in zip(data, cdata):
            for e1, e2 in zip(*d):
                if e1 == "?":
                    ans += "{}\n".format(e2)
    else:
        ans += "NO\n"
    answer += ans + "\n"
print answer.strip("\n")

### FIXED CODE ###

import sys
from copy import deepcopy
def check(data):
    return reduce(lambda a, b: a+b, data).count("?")

def calc(seq):
    if "?" not in seq or not(0 <= seq.count("?") <= 1) :
        return seq
    if seq[-1] == "?":
        return seq[:-1] + sum(seq[:-1])
    a = seq[-1] - sum(s for s in seq[:-1] if s != "?")
    return [s if s != "?" else a for s in seq]

def update(data):
    data = deepcopy(data)
    for i in xrange(len(data)):
        for j, d in enumerate(calc(data[i])):
            data[i][j] = d
    t_data = zip(*data)
    for i in xrange(len(t_data)):
        for j, d in enumerate(calc(t_data[i])):
            data[j][i] = d
    return data

answer = ""
while True:
    line = raw_input()
    while line.isspace() or not line: #!?!?!!!
        line = raw_input()
    if line == "0":
        break
    P, S = map(int, line.split())
    data = [map(lambda x: int(x) if x.replace("-", "").isdigit() else x, raw_input().split())
            for _ in xrange(P+1)]
    cdata = deepcopy(data)
    for _ in xrange(check(cdata)):
        cdata = update(cdata)
    ans = ""
    if check(cdata) == 0:
        for d in zip(data, cdata):
            for e1, e2 in zip(*d):
                if e1 == "?":
                    ans += "{}\n".format(e2)
    else:
        ans += "NO\n"
    answer += ans + "\n"
print answer.strip("\n")
n=int(input())
h=[map(int,input().split())]
dp=[0]*(n+1)
count=0
for i in range(1,n+1):
  if h[i-1]>=h[i]:
    dp[i]=dp[i-1]+1
print(max(dp))


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  if h[i-1]>=h[i]:
    dp[i]=dp[i-1]+1
print(max(dp))
a,b,c,d = map(int, input().open(0).split())
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))

### FIXED CODE ###

a,b,c,d = map(int, open(0))
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))
N,K = map(int, input().split())
es = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int, input().split())
    es[a-1].append(b-1)
    es[b-1].append(a-1)


MOD = 10**9+7
 
MAXN = N+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD
 

def nPr(n,r):
    if n < r:
        return 0
    return fac[n] * finv[n-r]


# 始点のノードがK個の色でぬれて、始点の子供がnPr(K-1, 始点の子の数)通りの塗り分け方がある。
# それらの子については、nPr(K-2, 子の数)の塗り方。

q  = []
used = [False] * N
used[0] = True
for nxt in es[0]:
    q.append(nxt)
    used[nxt] = True


ans = K * nPr(K-1, len(es[0]))
ans %= MOD
while q:
    curr = q.pop()
    ans *= nPr(K-2, len(es[curr]) - 1)
    ans %= MOD
    for nxt in es[curr]:
        if used[nxt]:
            continue

        used[nxt] = True
        q.append(nxt)


print(ans)

### FIXED CODE ###



MOD = 10**9 + 7
N,K = map(int, input().split())
es = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int, input().split())
    es[a-1].append(b-1)
    es[b-1].append(a-1)

MAXN = K+5
fac = [1,1] + [0]*MAXN
finv = [1,1] + [0]*MAXN
inv = [0,1] + [0]*MAXN
for i in range(2,MAXN+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def nPr(n,r):
    if n < r:
        return 0
    return fac[n] * finv[n-r]

# 「距離が２以内は異なる色 = あるノードとそれに隣接するノードはそれぞれ異なる色」の言い換えがポイント
# 根はK通り、根の子の数をmとすると、根の子の塗り方は、K-1個の中からm個並べる方法なので、nPr(K-1, m)通り
# それ以降についてあるノードを見るとき、そのノードと親には既に色が塗られている場合を考える。
# 親とその親の２色は使われてるから、そのノードのこの塗り方はK-2のうちから子の数だけ並べるときなので、nPr(K-2, 子の数)


ans = (K * nPr(K-1, len(es[0]))) % MOD
stack = []
for nxt in es[0]:
    stack.append(nxt)

checked = [False] * N
checked[0] = True

# ノード0の子から見ていって、その子の塗り方をかけ合わせていく
while stack:
    curr = stack.pop()
    checked[curr] = True
    # currの親はすでに塗ってあるので、r = len(es[curr])-1
    ans *= nPr(K-2, len(es[curr])-1)
    ans %= MOD
    for nxt in es[curr]:
        if not checked[nxt]:
            stack.append(nxt)

print(ans % MOD)
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  C=c
  for j in range(m):
    C=C+a[i][j]*b[j]
    if C>0:
      ans=ans+1
print(ans)

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print([YNEOS][n>1 and a%2>0::2]

### FIXED CODE ###

f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print('YNEOS'[n>1 and a%2>0::2])
import sys
input = sys.stdin.readline
from collections import Counter


def read():
    N, K = map(int, input().strip().split())
    G = [[] for i in range(N+1)]
    for i in range(N-1):
        a, b = map(int, input().strip().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    return N, K, G


def permute_init(n, MOD):
    factorial = [1 for i in range(n+1)]
    for i in range(1, n+1):
        factorial[i] = factorial[i-1] * i
        factorial[i] %= MOD
    return factorial


def permute(n, r, factorial, MOD):
    """nPr = n! / (n-r)!"""
    if n < r:
        return 0
    return factorial[n] * pow(factorial[n-r], MOD-2, MOD) % MOD


def solve(N, K, G, MOD=10**9+7):
    factorial = permute_init(K, MOD)

    visited = [False for i in range(N)]
    
    def dfs(a=0):
        f = 1
        if a == 0:
            f = permute(K-1, len(G[a]), factorial, MOD)
        else:
            f = permute(K-2, len(G[a])-1, factorial, MOD)
        for b in G[a]:
            if not visited[b]:
                visited[b] = True
                f *= dfs(b)
                f %= MOD
        return f
    
    visited[0] = True
    ans = K * dfs(0) % MOD

    return ans


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)


def read():
    N, K = map(int, input().strip().split())
    G = [[] for i in range(N+1)]
    for i in range(N-1):
        a, b = map(int, input().strip().split())
        G[a-1].append(b-1)
        G[b-1].append(a-1)
    return N, K, G


def permute_init(n, MOD):
    factorial = [1 for i in range(n+1)]
    for i in range(1, n+1):
        factorial[i] = factorial[i-1] * i
        factorial[i] %= MOD
    return factorial


def permute(n, r, factorial, MOD):
    """nPr = n! / (n-r)!"""
    if n < 0 or r < 0 or n < r:
        return 0
    return factorial[n] * pow(factorial[n-r], MOD-2, MOD) % MOD


def solve(N, K, G, MOD=10**9+7):
    factorial = permute_init(K, MOD)

    visited = [False for i in range(N)]
    
    def dfs(a=0):
        f = 1
        if a == 0:
            f = permute(K-1, len(G[a]), factorial, MOD)
        else:
            f = permute(K-2, len(G[a])-1, factorial, MOD)
        for b in G[a]:
            if not visited[b]:
                visited[b] = True
                f *= dfs(b)
                f %= MOD
        return f
    
    visited[0] = True
    ans = K * dfs(0) % MOD

    return ans


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))
N=int(input())
K=int(input())
if N<=10**6:
  ans=0
  for i in range(1,N+1):
    a=str(i)
    if len(a)-list(a).count("0")==K:
      ans+=1
  print(ans)
  exit()
if K==1:#おけ
  ans=0
  print((len(str(N))-1)*9+int(str(N)[0]))
elif K==2:#おけ
  ans=0
  L=list(map(int,list(str(N))))
  for i in range(len(L)-1):
    ans+=(9*(int(str(N)[0])-1))
    for j in range(i+1,len(L)):
      if i==0:
        if j==1:
          ans+=int(str(N)[1])
        else:
          ans+=9
      else:
        ans+=81
  print(ans)
else:
  qwq

### FIXED CODE ###

n=int(input())
k=int(input())
def main(N,K):
  ans=0
  if N<=100+10**6:
    for i in range(1,N+1):
      a=str(i)
      if len(a)-list(a).count("0")==K:
        ans+=1
    return ans
  L=list(map(int,list(str(N))))
  ans=0
  L=list(map(int,list(str(N))))
  if K==1:#おけ
    return (len(str(N))-1)*9+int(str(N)[0])
  elif K==2:#おけ
    for i in range(len(L)-1):
      ans+=(9*(int(str(N)[0])-1))
      for j in range(i+1,len(L)):
        if i==0:
          if j==1:
            ans+=int(str(N)[1])
          else:
            ans+=9
        else:
          ans+=81
    return ans
  else:
    le=len(L)
    for i in range(le-2):
      for j in range(i+1,le-1):
        for k in range(j+1,le):
          if i==0:
            ans+=81*(int(str(N)[0])-1)
            if j==1:
              ans+=9*(int(str(N)[1])-1)
              if k==2:
                ans+=int(str(N)[2])
              else:
                ans+=9
            else:
              ans+=81
          else:
            ans+=729
    return ans
ans2=0
L=list(str(n))
a=len(L)
for i in range(a):
  L=list(str(n))
  s=L[:a-i-1]
  t=L[a-i-1:]
  t=int("".join(t))
  p=s.count("0")
  p=len(s)-p
  if p>k:
    n-=t+1
  elif p==k:
    n-=t+1
    ans2+=1
  else:
    ans2+=main(t,k-p)
    n-=t+1
print(ans2)
from sys in stdin
N = input()
print(len(set(stdin.read().splitlines())))

### FIXED CODE ###

from sys import stdin
N = input()
print(len(set(stdin.read().splitlines())))
A, B, C, K = [int(i) for i in input().split()]
D = [1] * A + [0] * B + [-1] * C
print(sum(D[:K]))

### FIXED CODE ###

A, B, C, K = [int(i) for i in input().split()]
if A + B >= K:
    if K < A:
        print(K)
    else:
        print(A)
else:
    tmp = K - A - B
    print(A - tmp)
p=[]
N=int(input())
for i in range:
  p.append(int(input()))
ans=sum(p)-(max(p)2)
print(int(ans))

### FIXED CODE ###

p=[]
N=int(input())
for i in range(N):
  p.append(int(input()))
ans=sum(p)-(max(p)/2)
print(int(ans))
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

#回数
n = int(arr_data[0][0])

#番目
k = int(arr_data[0][1])

s=""

for i in range(1, 1 + n):

    cnt = int(arr_data[i][1])
    j = arr_data[i][0]

    s+=str(cnt * j)

print(s[k-1])


### FIXED CODE ###

import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

#回数
n = int(arr_data[0][0])

#番目
k = int(arr_data[0][1])

arr=[]

for i in range(1, 1 + n):
    
    arr.append(list(map(int, arr_data[i])))

arr.sort(key=lambda x:(x[0]))

#print(arr)

#sys.exit()

mysum=0

for i in range(0,n):
 
    cnt = arr[i][1]
    j = arr[i][0]
 

    if k<=mysum+cnt:
        
        print(j)
        
        break
        
    else:
        
        
        mysum+=cnt
import bisect
import sys
import math
input = sys.stdin.readline
import functools

from collections import defaultdict

############ ---- Input Functions ---- ############

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

############ ---- Solution ---- ############

def gcd(a, b):
    if b > a:
        return gcd(b, a)
    m = a % b
    if m == 0:
        return b
    return gcd(b, m)

def solve():
    N = inp()
    AA = inlt()

    AA = [v for v in AA if v > 1]
    if len(AA) == 0:
        return "pairwise coprime"
    
    mult = AA[0]
    gcd_cum = AA[0]
    pairwise = True

    for i in range(1, N):
        if i == 1 or gcd_cum == 1:
            if pairwise:
                g = gcd(mult, AA[i])
                if g != 1:
                    pairwise = False
                mult = mult * (AA[i] // g)
            else:
                break
        gcd_cum = gcd(gcd_cum, AA[i])
    
    if gcd_cum == 1 and pairwise:
        return "pairwise coprime"

    if gcd_cum == 1:
        return "setwise coprime"
    
    return "not coprime"

    

if len(sys.argv) > 1 and sys.argv[1].startswith("input"):
    f = open("./" + sys.argv[1], 'r')
    input = f.readline

res = solve()
print(str(res))


### FIXED CODE ###

import bisect
import sys
import math
input = sys.stdin.readline
import functools

from collections import defaultdict

############ ---- Input Functions ---- ############

def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

############ ---- Solution ---- ############


def gcd(a, b):
    if b > a:
        return gcd(b, a)
    m = a % b
    if m == 0:
        return b
    return gcd(b, m)

def solve():
    N = inp()
    AA = inlt()

    MAX = 10 ** 6 + 5
    freq = [0 for i in range(MAX)]
    cnt = [0 for i in range(MAX)]
    
    gcd_cum = AA[0]

    for i in range(N):
        freq[AA[i]] += 1
        gcd_cum = gcd(gcd_cum, AA[i])

    for i in range(2, MAX):
        for j in range(i, MAX, i):
            cnt[i] += freq[j]

    pairwise = True
    for i in range(2, MAX):
        if cnt[i] > 1:
            pairwise = False
            break
    
    if gcd_cum == 1 and pairwise:
        return "pairwise coprime"

    if gcd_cum == 1:
        return "setwise coprime"
    
    return "not coprime"
    

if len(sys.argv) > 1 and sys.argv[1].startswith("input"):
    f = open("./" + sys.argv[1], 'r')
    input = f.readline

res = solve()
print(str(res))
def func(N):
    tmp=N
    arr=[]
    for i in range(2,int(-(-N**0.5//1))+1):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if arr==[] or temp!=1:
        arr.append([tmp,1])
   
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)
    

### FIXED CODE ###

def func(N):
    tmp=N
    arr=[]
    for i in range(2,int(-(-N**0.5//1))+1):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
            
    if tmp!=1:
        arr.append([tmp, 1])
    if arr==[]:
        arr.append([tmp,1])
   
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)
S = input()
ans = 999
for i in range(S - 2):
  ans = min(ans, abs(753 - int(S[i:i + 3])))
print(ans)

### FIXED CODE ###

S = input()
ans = 999
for i in range(len(S) - 2):
  ans = min(ans, abs(753 - int(S[i:i + 3])))
print(ans)
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]

l = [[] for i in range(N + 1)]

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    l[a].append(b)
    l[b].append(a)

p = [[] for i in range(N + 1)]
c = [-1] * (N + 1)
c[1] = 0


def dfs(i):
    for j in range(len(l[i])):
        if c[l[i][j]] == -1:
            p[l[i][j]] = i
            c[l[i][j]] = c[i] + 1
            dfs(l[i][j])
        elif c[l[i][j]] > c[i] + 1:
            p[l[i][j]] = i
            c[l[i][j]] = c[i] + 1
            dfs(l[i][j])


dfs(1)
flag = 1
for i in range(2, N + 1):
    if c[i] == -1:
        flag = 0
if flag == 0:
    print('No')
else:
    print('Yes')
    for i in range(2, N + 1):
        print(p[i])

### FIXED CODE ###

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]
 
l = [[] for i in range(N + 1)]
 
for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    l[a].append(b)
    l[b].append(a)
 
point = [0] * (N + 1)
search = [0] * (N + 1)
search[1] = 1

que = []
que.append(1)
p = 0

while len(que) != N:
    now = que[p]
    for i in range(len(l[now])):
        n = l[now][i]
        if search[n] == 0:
            search[n] = 1
            que.append(n)
            point[n] = now
    p += 1
    
print('Yes')
for i in range(2,N+1):
    print(point[i])
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))

def main():
  n = ni()
  ans = n // 11 * 2
  if 0 < x % 11 < 7:
    ans += 1
  elif x % 11 > 6:
    ans += 2
  print(ans)
main()

### FIXED CODE ###

x = int(input())
ans = x//11 * 2
if(0 < x%11 < 7):
  ans += 1
elif(x%11 > 6):
  ans += 2
print(ans)
import numpy as np
L, R = map(int, input().split())

LR = np.arange(L, R+1, dtype="int64")
LR %= 2019
LR.sort

print(LR[0] * LR[1])


### FIXED CODE ###

L, R = map(int, input().split())

R = min(R, L + 2019)
out = 2020
for i in range(L, R):
    for j in range(i + 1, R + 1):
        out = min(out, (i * j) % 2019)

print(out)
input();print(eval(input().replace(" ", "*")))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 1 
if 0 in a:
        print(0)
else:
        for i in range(n):
                ans = ans * a[i]
                if ans > 10**18:
                        ans = -1
                        break
        print(ans)
import math

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

c = a*b/2
print(c)
~                                                                               
~           

### FIXED CODE ###

import math

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

if a == 1 or b == 1:
    print(1)
else:
    print(math.ceil(a*b/2))