Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int, input().split()))
 
dp = [0] * n
dp[0] = 0
dp[1] = abs(a[0] - a[1])
#dp[2] = dp[0]
for i in range(2, n):
  dp[i] = min(dp[i-2] + abs(a[i-2] - a[i]) , d[i - 1] + abs(a[i - 1] - a[i]))

print(dp[n - 1])  

### FIXED CODE ###

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

dp = [0] * n
dp[0] = 0
dp[1] = abs(a[0] - a[1])

for i in range(2, n):
  dp[i] = min(dp[i-2] + abs(a[i-2] - a[i]) , dp[i - 1] + abs(a[i - 1] - a[i]))

print(dp[n - 1])
*a = map(int,input().split())
print(max(a) - min(a))


### FIXED CODE ###

*a, = map(int,input().split())
print(max(a) - min(a))
#!/usr/bin/env python
W, H, x, y = map(int, input().split())

if x == W/2:
    print(H*W/2, 0)
else:
    b = (H-W)/2
    a = (y-b)/x
    print((a*W+2*b)*W/2, 1)



### FIXED CODE ###

#!/usr/bin/env python
W, H, x, y = map(int, input().split())
a = W*H/2

if 2*x == W and 2*y == H:
    b = 1
else:
    b = 0
print(a, b)
N,M = map(int,input().split())
count = 0
while(1):
    if N>=1:
        if M>=2:
            N -= 1
            M -= 2
            count += 1
        else:
            break
    elif M >= 4 :
        M -= 4
        count += 1
    else:
        break
        
print(count)


### FIXED CODE ###

N = int(input())
x = 0
y = 0
for i in range(1,N+1):
    x += 800
    if (i%15 == 0):
        y += 200
print(x-y)
import sys

s = c = 0
for line in sys.stdin:
    x, y = map(int line.split(','))
    s += x * y
    c += y
print(s, round(s / c))

### FIXED CODE ###

import sys

s = c = n = 0
for line in sys.stdin:
    x, y = map(int, line.split(','))
    s += x * y
    c += y
    n += 1
print(s)
print(int(c / n + 0.5))
N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] -= 1
li = [False] * N
f = True
now = 0
l = []
l2 = [0] * N
i = 0
while f:
    l.append(now)
    li[now] = True
    l2[now] = i
    if li[A[now]]:
        f = False
        num = len(l) - l2[A[now]]
        n = l2[A[now]]
    i += 1
    now = A[now]
k = (K-n) % num
print(l[min(K, n+k)]+1)

### FIXED CODE ###

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
mod = 998244353
N, M, K = map(int, input().split())
x = [1]*N
for i in range(1,N):
    x[i] = Pow(i, mod-2)
cmb = [1]*N
for i in range(N-2):
    cmb[i+1] = ((cmb[i]*(N-1-i))%mod*x[i+1])%mod
ans = 0
for i in range(K+1):
    num = Pow(M-1, N-1-i)
    ans = (ans+M*num%mod*cmb[i]%mod)%mod
print(ans)
from sys import exit
inf=1000000000000000000
n,m=map(int,input().split())
x=[inf]*n
#まだ訪問してなければTrue
check=[True]*n
#どこと関係があるかを記録する(maybe right)
lrd=[[] for i in range(n)]
for i in range(m):
    l,r,d=map(int,input().split())
    l-=1
    r-=1
    lrd[l].append((r,d))
    lrd[r].append((l,-d))
#wrong thought
#どっちも決まってない場合の処理
#決まってるとこからやれば良い
#ソートして順番に決めておく

#記録した関係から辿っていく
#まず初めのやつ
st=-1
for i in range(n):
    if len(lrd[i])>=1:
        st=i
        break
if st==-1:
    print("Yes")
    exit()
def bfs(z):
    for i in range(len(lrd[z])):
        k=lrd[z][i]
        if check[k[0]]:
            x[k[0]]=x[z]+k[1]
            check[k[0]]=False
            bfs(k[0])
        else:
            if x[k[0]]!=x[z]+k[1]:
                print("No")
                exit()
x[st]=0
check[st]=False
bfs(st)

print("Yes")

### FIXED CODE ###

#PyPy遅え
import sys
sys.setrecursionlimit(100000000)
inf=1000000000000000000
n,m=map(int,input().split())
x=[inf]*n
#まだ訪問してなければTrue
check=[True]*n
#どこと関係があるかを記録する(maybe right)
lrd=[[] for i in range(n)]
for i in range(m):
    l,r,d=map(int,input().split())
    l-=1
    r-=1
    lrd[l].append((r,d))
    lrd[r].append((l,-d))
#wrong thought
#どっちも決まってない場合の処理
#決まってるとこからやれば良い
#ソートして順番に決めておく

#記録した関係から辿っていく
#まず初めのやつ
st=-1
for i in range(n):
    if len(lrd[i])>=1:
        st=i
        break

def bfs(z):
    #globalくらいちゃんとしろ
    global lrd,check,x
    for i in range(len(lrd[z])):
        k=lrd[z][i]
        if check[k[0]]:
            x[k[0]]=x[z]+k[1]
            check[k[0]]=False
            bfs(k[0])

st=0
while any(check):
    for i in range(st,n):
        if len(lrd[i])!=0 and check[i]:
            st=i
            break
        else:
            check[i]=False
    else:
        break
    x[st]=0
    check[st]=False
    bfs(st)

for i in range(n):
    l=len(lrd[i])
    for j in range(l):
        k=lrd[i][j]
        if x[k[0]]!=x[i]+k[1]:
            print("No")
            sys.exit()
print("Yes")
N,A,B = map(int,input().split())
maxN,minN = 0

if N >= A + B:
  minN = 0
  maxN = min([A,B])
else:
  minN = A + B - N
  maxN = min([A,B])
  
print('{} {}'.format(maxN,minN))

### FIXED CODE ###

N,A,B = map(int,input().split())
maxN,minN = 0,0

if N >= A + B:
  minN = 0
  maxN = min([A,B])
else:
  minN = A + B - N
  maxN = min([A,B])
  
print('{} {}'.format(maxN,minN))
a = input()
b = input()

if a % 500 <= b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = int(input())
b = int(input())
if a % 500 <= b:
  print("Yes")
else:
  print("No")
n,k = map(int. input().split())
s = input()

change = s[k-1].lower()
print(s[:k] + change + s[k+1:])


### FIXED CODE ###

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

change = s[k-1].lower()
print(s[:k-1] + change + s[k:])
A,V = (int(x) for x in input().split())
B,W = (int(x) for x in input().split())
T = int(input())
if V>W:
    if (A-B)%(V-W)==0:
        if abs(A-B)//(V-W)<=T:
            Flag = 1
    else:
        if abs(A-B)//(V-W)+1<=T:
            Flag = 1
else:
    Flag = False
    
if Flag:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

A,V = (int(x) for x in input().split())
B,W = (int(x) for x in input().split())
T = int(input())

if V>W and abs(A-B)/(V-W)<=T:
    Flag = True
else:
    Flag = False
    
if Flag:
    print('YES')
else:
    print('NO')
D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 0):
        ck.append(j)
    while t < G:
      t += (max(ck)+1)*100
      c += 1
    l.append(c)
      
print(c)


### FIXED CODE ###

D, G = map(int, input().split())
PC = [list(map(int,input().split())) for i in range(D)]

l = []
for i in range(2 ** D):
  t = 0
  c = 0
  for j in range(D):
    if ((i >> j) & 1):
      t += (j+1)*100*PC[j][0]+PC[j][1]
      c += PC[j][0]
  if t >= G:
    l.append(c)
  else:
    ck = []
    for j in range(D):
      if ((i >> j) & 1):
        continue
      else:
        ck.append(j)
    if ck == []:
      continue
    ckm = max(ck)
    for k in range(PC[ckm][0]):
      t += (ckm+1)*100
      c += 1
      if t >= G:
        l.append(c)
        break
      
print(min(l))
N = int(input())
Ai = list(map(int, input().split()))
     
result = 1
     
if 0 in Ai:
	result= '0'  
else:
  for i in range(N):
      result *= Ai[i]
      if result > 10**18:
        result = '-1'
     
print(result)

### FIXED CODE ###

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

print(a * b)
n,k=map(int,input().split())
dp=[10**9]*(n)

x=[int(w) for w in input().split()]
dp[0]=0

for i in range(n):
    for j in range(i+1,i+3):
        if j<n:
            dp[j]=min(dp[j],dp[i]+abs(x[i]-x[j]))

print(dp[n-1])

### FIXED CODE ###

n=int(input())
x=[int(q) for q in input().split()]

dp=[0,abs(x[0]-x[1])]
for i in range(2,n):
    y=min(dp[i-2]+abs(x[i]-x[i-2]),dp[i-1]+abs(x[i-1]-x[i]))
    dp.append(y)
print(dp[-1])
n,k=map(int,input().split())
p=list(map(int,input().split()))
d=[]
ans=0
for i in range(n-k+1):
  ans+=(1+p[i])/2
  ans+=(1+p[i+1])/2
  ans+=(1+p[i+2])/2
  ans+=(1+p[i+3])/2
  d.append(ans)
  ans=0
  
print(max(d))

### FIXED CODE ###

from itertools import accumulate
N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K+1):
    ans.append(B[i+K]-B[i])
print(max(ans))
N,M = map(int,input().split())

if M % N != 0:
  
  a = int(M % N)
  b = (M - a) / N
  c = math.gcd(a, b)
  print(c)
else:
  print(int(M/N))


### FIXED CODE ###

import math
N,M = map(int,input().split())

sq = math.sqrt(M)
sq = math.floor(sq)


ans = 1
for i in range(1,sq+2):
  if M % i == 0:
    if i * N <= M:
      ans = max(i,ans)
    if M / i * N <= M:
      ans = max(M // i,ans)
if N == 1:
  print(int(M))
else:
  print(int(ans))
from collections import Counter

n = int(input())
c = Counter(map(int, input().split()))

print("YES" if c.most_common(1)[1] <= 1 else "NO")

### FIXED CODE ###

from collections import Counter

n = int(input())
c = Counter(map(int, input().split()))

print("YES" if c.most_common(1)[0][1] <= 1 else "NO")
import copy

n,m = map(int,input().split())
city_max_number=0
ab = []
for _ in range(m):
    a, b = (int(x) for x in input().split())
    city_max_number = max(city_max_number,b)
    ab.append([a, b])

copy_ab = copy.deepcopy(ab)

copy_ab = sorted(ab, key=lambda x: x[0])
copy_ab = sorted(ab, key=lambda x: x[1])

city = [0]*(city_max_number+1)

count = 1
for i in range(m):
    city[copy_ab[i][1]] = count
    if i == m-1:
        break
    elif copy_ab[i][0] == copy_ab[i+1][0]:
        count += 1
    else:
        count = 1

for i, j in ab:
    i = str(i)
    city_number = (6-len(i))*'0'+i
    ID = str(city[j])
    ID = (6-len(ID))*'0'+ID
    print(city_number+ID)

### FIXED CODE ###

n,m = map(int,input().split())
py = []
p_y = [[] for i in range(n)]
for _ in range(m):
    p,y = map(int,input().split())
    py.append((p,y))
    p_y[p-1].append(y)
ans = {}
for i, tmp in enumerate(p_y):
    cnt = 1
    p_y[i] = tmp.sort()
    for j, jj in enumerate(tmp):
 
        ans[(i+1, jj)] = str(i+1).zfill(6) + str(j+1).zfill(6)
 
 
for i, tmp in enumerate(py):
    print(ans[tmp])
import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(math.sqrt(ab))-1,AB[1]+2):
		if i*i>=ab:
			x=i-1
			break
	for i in range(int(ab/x)-1,ab+2):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)

### FIXED CODE ###

import math
q=int(input())
for j in range(q):
	AB=[int(i) for i in input().split()]
	AB.sort()#4,11
	ab=AB[0]*AB[1] #44
	for i in range(int(math.sqrt(ab)),AB[1]+1):
		if i*i>=ab:
			x=i-1
			break
	if x==0:
		print(0)
		continue
	for i in range(int(ab/x),ab+1):
		if x*i>=ab:
			y=i-1
			break
	cnt1=2*x
	cnts=1 if x==y else 0
	cntdd=1 if x-AB[0]>=0 else 0
	cntdu=1 if AB[1]-y>=0 and (AB[1]+1)*(x-AB[1]+y)>=ab else 0 #x-i, y+i=c,b->c,b+1
	print(cnt1-cnts-cntdd-cntdu)
INF = 10**10
arr = [10,2,5,5,4,5,6,3,7,6]
N,M = map(int,input().split())
src = sorted(list(map(int,input().split())),key = lambda x:arr[x])

dp = [-INF]*(N+1)
dp[0] = 0
for i in range(N+1):
    for j in src:
        if i + arr[j] <= N:
            dp[i+arr[j]] = max(dp[i+arr[j]],dp[i] + 1)
dim = dp[N]
ans  = ''
while(dim > 0):
    for i in src[::-1]:
        if dp[N-arr[i]] + 1 == dp[N]:
            ans += str(i)
            N -= arr[i]
            dim -= 1
            break
print(ans)

### FIXED CODE ###

INF = 10**10
arr = [INF,2,5,5,4,5,6,3,7,6]
N,M = map(int,input().split())
src = sorted(list(map(int,input().split())))

dp = [-INF]*(N+1)
dp[0] = 0
for i in range(N):
    for j in src:
        if i + arr[j] <= N:
            dp[i+arr[j]] = max(dp[i+arr[j]],dp[i] + 1)
dim = dp[N]
ans  = ''
while(dim > 0):
    for i in src[::-1]:
        if N >= arr[i] and dp[N-arr[i]] + 1 == dp[N]:
            ans += str(i)
            N -= arr[i]
            dim -= 1
            break
print(ans)
n=int(input())
S=list(map(int,input().split()))
c=0

print(n,S)

for i in range(7):
    for j in range(7):
        if i!=j:
            c+=S[i]*S[j]


print(int(c/2))

### FIXED CODE ###

n=int(input())
S=list(map(int,input().split()))
c=0

for i in range(n):
    for j in range(n):
        if i!=j:
            c+=S[i]*S[j]


print(int(c/2))
import gcc

def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

def lcm(a,b):
    c=gcd(a,b);
    return a/c*b


n=int(input())
t=[int(input()) for lop in range(n)]
ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[n])
print(int(ans))

### FIXED CODE ###

'''
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)
'''

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

def lcm(e,f):
    c=gcd(e,f)
    g=e*f
    return g//c



n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))
a,b = input().split()
if a=="H"and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print(")
  

### FIXED CODE ###

a,b = input().split()
if a=="H"and b=="H":
  print("H")
elif a=="H" and b=="D":
  print("D")
elif a=="D" and b=="H":
  print("D")
elif a=="D" and b=="D":
  print("H")
a,b = map(int,input())
if a<10 and b<10:
  print(a*b)
  
else:
  print('-1')

### FIXED CODE ###

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

if a<10 and b<10:
  print(a*b)
  
else:
  print('-1')
N,K = map(int,input().split())
num = N
if N <= abs(N - K)
  print(N)
else:
  while N <= num:
    num = N
    N = abs(N - K)
  print(num)

### FIXED CODE ###

N,K = map(int,input().split())
ans1 = N % K
ans2 = abs(ans1 - K)
if ans1 <= ans2:
  print(ans1)
else:
  print(ans2)
a,b,c,d=input().split()
a=int(a)
b=int(b)
print(a+b/2)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=int(b)
print(int(a+b/2))
import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=0
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)

### FIXED CODE ###

import copy
N, K=list(map(int,input().split()))
A=list(map(int,input().split()))
a=max(A)
l=1
y=copy.copy(a)
a=a-1
while l<=a:
    x=(l+a)//2
    m=0
    for i in range(N):
        if A[i]%x==0:
            m+=A[i]//x-1
        else:
            m+=A[i]//x
    if m<=K:
        a=x-1
        y=copy.copy(x)
    else:
        l=x+1
print(y)
from bisect import bisect_left as bl
x,n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
    print(x)
else:
    i = 0
    p.sort()
    if p[bl(p, x)] != x:
        print(x)
    else:
        while(True):
            i += 1
            if p[bl(p, x-i)] != x-i:
                print(x-i)
                break
            elif p[bl(p, x+i)] != x+i:
                print(x+i)
                break

### FIXED CODE ###

from bisect import bisect_left as bl
x,n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
    print(x)
else:
    i = 0
    p.sort()
    a = bl(p, x)
    if a == n:
        print(x)
    elif p[a] != x:
        print(x)
    else:
        while(True):
            i += 1
            if p[bl(p, x-i)] != x-i:
                print(x-i)
                break
            else:
                a = bl(p, x+i)
                if a == n:
                    print(x+i)
                    break
                elif p[a] != x+i:
                    print(x+i)
                    break
import copy
from collections import deque
def main():
  H, W = map(int, input().split())
  G = [['#' == x for x in input()] for _ in range(H)]
 
  black = deque([(i, j) for i in range(H) for j in range(W) if M[i][j]])
 
  ans = 0
  while True:
    ans += 1
    next_black = deque()
    while black:
      bi, bj = black.popleft()
      if bi > 0 and not M[bi - 1][bj]:
        G[bi - 1][bj] = True
        next_black.append((bi - 1, bj))
      if bj > 0 and not M[bi][bj - 1]:
        G[bi][bj - 1] = True
        next_black.append((bi, bj - 1))
      if bi < H - 1 and not M[bi + 1][bj]:
        G[bi + 1][bj] = True
        next_black.append((bi + 1, bj))
      if bj < W - 1 and not M[bi][bj + 1]:
        G[bi][bj + 1] = True
        next_black.append((bi, bj + 1))
    if next_black:
       black = copy.copy(next_black)
    else:
       break
  print(ans - 1)
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

import copy
from collections import deque
def main():
  H, W = map(int, input().split())
  G = [['#' == x for x in input()] for _ in range(H)]
 
  black = deque([(i, j) for i in range(H) for j in range(W) if G[i][j]])
 
  ans = 0
  while True:
    ans += 1
    next_black = deque()
    while black:
      bi, bj = black.popleft()
      if bi > 0 and not G[bi - 1][bj]:
        G[bi - 1][bj] = True
        next_black.append((bi - 1, bj))
      if bj > 0 and not G[bi][bj - 1]:
        G[bi][bj - 1] = True
        next_black.append((bi, bj - 1))
      if bi < H - 1 and not G[bi + 1][bj]:
        G[bi + 1][bj] = True
        next_black.append((bi + 1, bj))
      if bj < W - 1 and not G[bi][bj + 1]:
        G[bi][bj + 1] = True
        next_black.append((bi, bj + 1))
    if next_black:
       black = copy.copy(next_black)
    else:
       break
  print(ans - 1)
  
if __name__ == "__main__":
  main()
import math
from collections import deque
a,b=map(float,input().split())
a=int(a)
A=a
lst=deque()
while a > 0:
    lst.append(a%10)
    a //= 10
lst.reverse()

c=lst.pop()
if len(lst)>=2:
  c+=10*lst.pop()
d=math.floor(c*b)

A-=c
A=int(A/100)
b=int(b*100)
print(A*b+d)

### FIXED CODE ###

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

print(int(a*b//100))
a=list(map(int,input().split()))
h=a[0]
w=a[1]
m=a[2]
sh=[0]*1000000
sw=[0]*1000000
mw=0
mh=0
for i in range (0,m):
    s=list(map(int,input().split()))
    sh[s[0]]+=1
    if sh[s[0]]>mh:
        mh=sh[s[0]]
        hh=s[0]
    sw[s[1]]+=1
    if sw[s[0]]>mw:
        mw=sw[s[0]]
        ww=s[1]
z=mh+mw
if sh[hh]>0 and sw[ww]>0:
    z-=1

print(z)


### FIXED CODE ###

from collections import defaultdict

def main()->str:
    H,W,M=map(int,input().split())
    ch=[0]*H
    cw=[0]*W
    bm=defaultdict(lambda:False)
    for _ in range(M):
        h,w=map(int,input().split())
        h-=1
        w-=1
        bm[(h,w)]=True
        ch[h]+=1
        cw[w]+=1
    hb=max(ch)
#    max_h=[i for i, x in enumerate(ch) if x == hb]
    max_h=[]
    for i in range(len(ch)):
        if ch[i]==hb: max_h.append(i)
    wb=max(cw)
#    max_w=[i for i, x in enumerate(cw) if x == wb]
    max_w=[]
    for i in range(len(cw)):
        if cw[i]==wb: max_w.append(i)
    
    z=hb+wb
    for mh in max_h:
        for mw in max_w:
            if bm[(mh,mw)]==False:
                return(z)
    return(z-1)

if __name__ == "__main__":
    print(main())
S = input()
L=len(S)
ans='No'
    if S[:(L-1)/2+1]==S[(L-1)/2-1::-1] and S[L+3/2:]==S[:(L+3/2)-2:-1]:
    ans='Yes'
print(ans)

### FIXED CODE ###

S = input()
L=len(S)
ans=0
S1=S[:(L-1)//2]
S2=S[((L+3)//2)-1:]
if (S==S[::-1]) & (S1==S1[::-1]) & (S2==S2[::-1]):
    ans='Yes'
else:
    ans='No'
print(ans)
N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        aw=(N*n*h)
        bw=4*n*h-N*h-N*n
        if bw!=0 and bw/aw==bw//aw:
            h=i
            n=j
            break
print(h,n,bw//aw)

### FIXED CODE ###

N=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        bw=4*i*j-N*i-N*j
        if bw<=0:
            continue
        if (N*i*j)%bw==0:
            print(i,j,(N*i*j)//bw)
            exit()
# B - KEYENCE String
def is_keyence_string():
	for i in range(1, len(key)):
		left = key[:i]
		right = key[i-len(key):]
		
		if S.startswith(left) and S.endswith(right):
			return True
	
	return False


S = input().trim()
key = 'keyence'

if S.startswith(key):
	print('YES')
elif S.endswith(key):
	print('YES')
elif is_keyence_string():
	print('YES')
else:
	print('NO')

### FIXED CODE ###

# B - KEYENCE String
def is_keyence_string():
	for i in range(1, len(key)):
		left = key[:i]
		right = key[i-len(key):]
		
		if S.startswith(left) and S.endswith(right):
			return True
	
	return False


S = input().strip()
key = 'keyence'

if S.startswith(key):
	print('YES')
elif S.endswith(key):
	print('YES')
elif is_keyence_string():
	print('YES')
else:
	print('NO')
x=include("xを入力してください")
if x==1:
  print("0")
else:
  print("1")

### FIXED CODE ###

x=int(input())
if x==1:
  print("0")
if x==0:
  print("1")
s = str(input())
t = str(input())
s =  ''.join(sorted(s))
t = ''.join(sorted(t))

if s == t:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import math

a,b,c = map(int,input().split())
lst = []
lst.append(a)
lst.append(b)
lst.append(c)
lst.sort()

print(lst[2] - lst[1] + (lst[1] - lst[0]))
H = map(int, input().split())

num = 1
res = 1

if H > 1:
    while (num * 2) <= H:
        num = num * 2
        res = num * 2 - 1

print(res)

### FIXED CODE ###

H = int(input())

num = 1
res = 1

if H > 1:
    while (num * 2) <= H:
        num = num * 2
        res = num * 2 - 1

print(res)
#!/usr/bin/env python3
def collatz(number):
    if number % 2 == 0:
        return number // 2  # 整数の商
    else:  # elseで良い
        return 3 * number + 1  # // intは不要では？


number = int(input())
a = [number]
while True:
    number = collatz(number)
    a += [number]

    if number == 1:
        break
print(a.index(4)+4)


### FIXED CODE ###

#!/usr/bin/env python3
def collatz(number):
    if number % 2 == 0:
        return number // 2  # 整数の商
    else:  # elseで良い
        return 3 * number + 1  # // intは不要では？


number = int(input())
if number == 1:
    print(4)
    quit()
a = [number]
while True:
    number = collatz(number)
    a += [number]

    if number == 1:
        break
if 4 in a:
    print(a.index(4)+4)
elif 2 in a:
    print(a.index(2)+4)
else:
    print(a.index(1)+4)
N, K = map(int,input().split())

C = [0 for _ in range(N)]
ct = N
for i in range(N):
  d = int(input())
  A = list(map(int, input().split()))
  for a in A:
    if C[a-1] == 0:
      C[a-1] += 1
      ct -= 1

print(ct)



### FIXED CODE ###

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

C = [0 for _ in range(N)]
ct = N
for i in range(K):
  d = input()
  A = list(map(int, input().split()))
  for a in A:
    if C[a-1] == 0:
      C[a-1] += 1
      ct -= 1

print(ct)
n , k = map(int,input().split())
print((n-1)//(k-2)+1)

### FIXED CODE ###

n , k = map(int,input().split())
print((n-2)//(k-1)+1)
import math
X, Y = map(int, input().split())

MOD = 10 ** 9 + 7

xx = 2 * Y - X
if (xx % 3 == 0 and Y - 2 * xx // 3 >= 0):
    a = xx // 3
    b = Y - 2 * a

    f = 1
    factorials = [1]
    for m in range(1, a + b + 1):
        f *= m
        f %= MOD
        factorials.append(f)

    print (a, b, inv)
    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (a + b + 1)
    invs[a + b] = inv
    for m in range(a + b, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv


    print (factorials[-1] * invs[a] * invs[b] % MOD)

    # print (math.factorial(a + b) // math.factorial(a) // math.factorial(b) %  MOD)


else:
    print (0)


### FIXED CODE ###

import math
X, Y = map(int, input().split())

MOD = 10 ** 9 + 7

xx = 2 * Y - X
if (xx >= 0 and xx % 3 == 0 and Y - 2 * xx // 3 >= 0):
    a = xx // 3
    b = Y - 2 * a

    f = 1
    factorials = [1]
    for m in range(1, a + b + 1):
        f *= m
        f %= MOD
        factorials.append(f)

    inv = pow(f, MOD - 2, MOD)
    invs = [1] * (a + b + 1)
    invs[a + b] = inv
    for m in range(a + b, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv


    print (factorials[-1] * invs[a] * invs[b] % MOD)

    # print (math.factorial(a + b) // math.factorial(a) // math.factorial(b) %  MOD)


else:
    print (0)
n=int(input())
a=list(map(int,input().split()))
set(a)
ans=[0]*1000000
x=1
for i in a:
    if(ans[i]!=0):
        ans[i]=2
        continue
    for j in range(i,1000000,i):
        ans[j]=ans[j]+1
cnt=0
for i in range(0,n):
    if(ans[a[i]]==1):
        cnt=cnt+1
print(cnt)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
set(a)
ans=[0]*1000005
x=1
for i in a:
    if(ans[i]!=0):
        ans[i]=2
        continue
    for j in range(i,1000005,i):
        ans[j]=ans[j]+1
cnt=0
for i in range(0,n):
    if(ans[a[i]]==1):
        cnt=cnt+1
print(cnt)