Harryxun/stf_run huggingface dataset:
#####segfunc######
def segfunc(x,y):
    if type(x) is int:
        return x+y
    res = len(set([x,y]))
    if x == None:
        res -= 1
    if y == None:
        res -= 1
    return res
def init(init_val):
    #set_val
    for i in range(len(init_val)):
        seg[i+num-1]=init_val[i]   
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
n = int(input())
s = list(input())
ide_ele = None
num =2**(n-1).bit_length()
seg=[ide_ele]*(2*num - 1)
init(s)
for i in range(int(input())):
    a,b,c = input().split()
    if a == "1":
        update(int(b) -1, c)
    else:
        if b == c:
            print(1)
        else:
            print(query(int(b)-1,int(c)-1))

### FIXED CODE ###

import sys
input = sys.stdin.readline
#####segfunc######
def segfunc(x,y):
    return x | y

def init(init_val):
    #set_val
    for i in range(len(init_val)):
        seg[i+num-1]=init_val[i]   
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x):
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q):
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
n = int(input())
s = list(input())[:-1]
ide_ele = 0
num =2**(n-1).bit_length()
seg=[ide_ele]*(2*num - 1)
s = [2 ** (ord(i) - ord('a')) for i in s]
init(s)
q = int(input())
for i in range(q):
    tmp = input()
    a,b,c = tmp[:-1].split()
    if a == "1":
        update(int(b)-1, 2 ** (ord(c) - ord('a')))
    else:
        if b == c:
            print(1)
        else:
            tmp = query(int(b)-1, int(c))
            tmp = format(tmp, 'b')
            print(tmp.count('1'))
# -*- coding: utf-8 -*-

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

th = sum(A) // (4 * M)

sorted_A = sorted(A, key=lambda x: -x)
if sorted_A[M] < th:
    print("No")
else:
    print("Yes")


### FIXED CODE ###

# -*- coding: utf-8 -*-

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

th = 1.0 * sum(A) / (4 * M)

sorted_A = sorted(A, key=lambda x: -x)
if sorted_A[M - 1] < th:
    print("No")
else:
    print("Yes")
x, y = map(int, input().split())
print(gcd(x, y))

### FIXED CODE ###

x, y = map(int, input().split())
while y > 0 :
    x, y = y, x % y
print(x)
A,B,K=map(int,input().split())
count=1
i=1
while count<K:
  i+=1
  if A%i=0 and B%i=0:
    count+=1
print(i)
  

### FIXED CODE ###

A,B,K=map(int,input().split())
count=0
i=min(A,B)+1
while count<K:
  i-=1
  if A%i==0 and B%i==0:
    count+=1
print(i)
N,K = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
if a[0] >= K:
    print(0)
    exit()

a = [a[i] for i in range(N) if a[i]<K]
a.reverse()
N = len(a)
ans = N
dp = [False]*K
dp[0] = True
Smax = 0
for i in range(N):
    a_ = a[i]
    if Smax + a_ >= K:
        ans = N-i-1
    updated = False
    for j in range(min(Smax,K-a_-1),-1,-1):
        if dp[j]:
            dp[j+a_=True
            if not updated:
                Smax = max(Smax,j+a_)
                updated = True

print(ans)

### FIXED CODE ###

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

def f(N,K,a):
    a.sort()
    if a[0] >= K:
        print(0)
        exit()

    a = [a[i] for i in range(N) if a[i]<K]
    N = len(a)
    ans = N
    dp = [False]*K
    dp[0] = True
    Smax = 0
    for i,a_ in reversed(list(enumerate(a))):
        if Smax + a_ >= K:
            ans = i
        updated = True
        for j in range(min(Smax,K-a_-1),-1,-1):
            if dp[j]:
                dp[j+a_]=True
                if updated:
                    Smax = max(Smax,j+a_)
                    updated = False
    return ans

print(f(N,K,a))
x = int(input())
while True:
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            c = False
            break
        c = True
    if c == True:
        print(x)
        break
    elif c == False:
        x += 1
        
    


### FIXED CODE ###

x = int(input())
if x == 2:
    print(2)
    exit()
elif x == 3:
    print(3)
    exit()
while True:
    for i in range(2,int(x**0.5)+1):
        if x % i == 0:
            c = False
            break
        c = True
    if c == True:
        print(x)
        break
    elif c == False:
        x += 1
import time

nk = [int(x) for x in raw_input().strip().split()]
d = []
for i in range(nk[0]):
    d_tmp = raw_input().strip().split()
    d.append([int(d_tmp[0]), int(d_tmp[1]), int(d_tmp[2] == 'B')])

n1 = nk[0]
k1 = nk[1]

check_x = [0] * n1 * 4
check_y = [0] * n1 * 4
for i in range(n1):
    check_x[i * 4] = d[i][0] - k1
    check_x[i * 4 + 1] = d[i][0] - k1 + 1
    check_x[i * 4 + 2] = d[i][0]
    check_x[i * 4 + 3] = d[i][0] + 1
    check_y[i * 4] = d[i][1] - k1
    check_y[i * 4 + 1] = d[i][1] - k1 + 1
    check_y[i * 4 + 2] = d[i][1]
    check_y[i * 4 + 3] = d[i][1] + 1
check_x = list(set(check_x))
check_y = list(set(check_y))

#d = tuple(d)
n = 0
#t = time.clock()
for i in check_x:
    for j in check_y:
        n_tmp = [0, 0]
        for k in range(n1):
            x = (d[k][0] - i) // k1 % 2
            y = (d[k][1] - j) // k1 % 2
#            if x == y:
#                n_tmp[1 - d[k][2]] += 1
#            else:
#                n_tmp[d[k][2]] += 1
            n_tmp[(x == y) ^ d[k][2]] += 1
        if n_tmp[0] > n:
            n = n_tmp[0]
        if n_tmp[1] > n:
            n = n_tmp[1]
#print time.clock() - t
print n


### FIXED CODE ###

ab = [int(x) for x in raw_input().strip().split()]

c = (ab[0] * ab[1]) % 2
if c == 1:
    print 'Odd'
else:
    print 'Even'
​
n, k = [int(v) for v in input().split()]
​
c = (n - 1) * (n - 2) // 2
#print("c=", c)
m = 0
if k > c:
  print(-1)
else:
  m_max = n - 1 + (c - k)
  print(m_max)
  for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
      if m < m_max:
        print(i, j)
        m += 1
      else:
        break

### FIXED CODE ###

n, k = [int(v) for v in input().split()]

c = (n - 1) * (n - 2) // 2
#print("c=", c)
m = 0
if k > c:
  print(-1)
else:
  m_max = n - 1 + (c - k)
  print(m_max)
  for i in range(1, n + 1):
    for j in range(i + 1, n + 1):
      if m < m_max:
        print(i, j)
        m += 1
      else:
        break
import math
a,b,c = map(int,input().split())
G = math.sqrt(c)-(math.sqrt(a) + math.sqrt(b))
if G != 0 and math.ceil(G) >= 1:
  print('Yes')
  sys.exit(0)
print('No')


### FIXED CODE ###

from decimal import *
import sys
a,b,c = map(int,input().split())
getcontext().prec = 500
if a + b >= c:
  print('No')
  sys.exit(0)
if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
  print('Yes')
  sys.exit(0)
print('No')
N = int(input())
A = list(map(int, input().split()))
dct = {}
for i in range(-1,10**5):
  dct[i] = 0
for i in A:
  dct[i-1] += 1
  dct[i] += 1
  dct[i+1] += 1

sorted_dct = sorted(dct.items(), key=lambda x:-x[1])
print(sorted_dct[0][1])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
dct = {}
for i in range(-1,10**5+1):
  dct[i] = 0
for i in A:
  dct[i-1] += 1
  dct[i] += 1
  dct[i+1] += 1

sorted_dct = sorted(dct.items(), key=lambda x:-x[1])
print(sorted_dct[0][1])
N, X = map(int, input().split())

def get_lburger(l):
    lburger = [1]
    for i in range(l):
        lburger = [0] + lburger + [1] + lburger + [0]
    return lburger

if __name__ == "__main__":
    print(sum(get_lburger(N)[:X]))

### FIXED CODE ###

D = int(input())
assert 22 <= D <= 25
print(" ".join(["Christmas"] + ["Eve"] * (25 - D)))
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i;
            if v<10050:
            ans[v]+=1
for i in range(n):
    print(ans[i+1])

### FIXED CODE ###

n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
    for j in range(1,105):
        for k in range(1,105):
            v = i*i+j*j+k*k+i*j+j*k+k*i;
            if v<10050:
            	ans[v]+=1
for i in range(n):
    print(ans[i+1])
p = int(input().split()[1])
s = input()
if 10 % p:
  s = reversed(s)
a = enumerate(s, 1)
if 10 % p == 0:
  r = sum(i for i, x in a if x % p == 0)
else:
  d = [1] + [0] * (p - 1)
  t, y = 0, 1
  for i, x in a:
    t = (t + x * y) % p
    d[t] += 1
    y = y * 10 % p;
  r = sum(i * (i - 1) // 2 for i in d)
print(r)


### FIXED CODE ###

from itertools import accumulate
from collections import Counter

p = int(input().split()[1])
a = list(map(int, input()))
if 10 % p == 0:
  r = sum(i for i, x in enumerate(a, 1) if x % p == 0)
else:
  a = accumulate(x * pow(10, i, p) for i, x in enumerate(reversed(a), 1))
  c = Counter(x % p for x in a) 
  c[0] += 1
  r = sum(i * (i - 1) // 2 for i in c.values())
print(r)
def main():
    import numpy as np
    import sys
    input=sys.stdin.readline

    a,b,q=map(int,input().split())
    S=np.array([int(input()) for _ in range(a)])
    T=np.array([int(input()) for _ in range(b)])
    Q=np.array([int(input()) for _ in range(q)])
    idxs=np.searchsorted(S,Q)
    idxt=np.searchsorted(T,Q)
    
    for i in range(q):
        x=Q[i]
        s=idxs[i]
        t=idxt[i]
        
        if s==0 and t==0:
            print(max(S[0],T[0])-x)
        elif s==0 and t==b:
            print(S[0]-T[-1]+min(S[0]-x,x-T[-1]))               
        elif s==a and t==0:
            print(T[0]-S[-1]+min(T[0]-x,x-S[-1]))
        elif s==a and t==b:
            print(x-min(S[-1],T[-1]))
        
        elif s==0:
            print(min(max(S[0],T[t])-x,min(S[0]-x,x-T[t-1])+S[0]-T[t-1]))
        elif s==a:
            print(min(x-min(S[-1],T[t-1]),min(T[t]-x,x-S[-1])+T[t]-S[-1]))                  
        elif t==0:
            print(min(max(T[0],S[s])-x,min(T[0]-x,x-S[s-1])+T[0]-S[s-1]))
        elif t==b:
            print(min(x-min(T[-1],S[s-1]),min(S[t]-x,x-T[-1])+S[s]-T[-1]))
            
        else:
            print(min(max(T[t],S[s])-x,x-min(T[t-1],S[s-1])))   
  
if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    INF=10**11
    from bisect import bisect_left
    a,b,q=map(int,input().split())
    S=[-INF]+[int(input()) for _ in range(a)]+[INF]
    T=[-INF]+[int(input()) for _ in range(b)]+[INF]

    for _ in range(q):
        x=int(input())
        s=bisect_left(S,x)
        t=bisect_left(T,x)
        ans=max(T[t],S[s])-x
        ans=min(ans,S[s]-T[t-1]+min(S[s]-x,x-T[t-1]))
        ans=min(ans,x-min(S[s-1],T[t-1]))
        ans=min(ans,T[t]-S[s-1]+min(T[t]-x,x-S[s-1]))
        print(ans)
if __name__=='__main__':
    main()
n,m,x = map(int,input().split())
C = [0]*n
A = [[0]*m for i in range(n)]
for i in range(n):
    b = list(map(int,input().split()))
    C[i] = b[0]
    for j in range(1,m+1):
        A[i][j-1] = b[j]
    
MAX = 100000000000
def dfs(a,c,i):
    if min(a)>=x:
        return cost
    elif i == n:
        return MAX
    total_A = [u+v for (u,v) in zip(a,A[i])]
    return min(dfs(a,c,i+1), dfs(total_A,c + C[i], i+1))

ans = dfs([0]*m,0,0)
if ans == MAX:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n,m,x = map(int,input().split())
C = list()
A = list()
for i in range(n):
    temp = list(map(int,input().split()))
    C.append(temp[0])
    A.append(temp[1:])

maxnum = 10000000000
def dfs(a,cost,i):
    if min(a) >= x:
        return cost
    elif i == n:
        return maxnum
    
    getA = [x+y for (x,y) in zip(a,A[i])]
    
    return min(dfs(a,cost,i+1), dfs(getA,cost+C[i],i+1))

ans = dfs([0]*m,0,0)

if ans == maxnum:
    print(-1)
else:
    print(ans)
# coding: utf-8
import math

def gcd(a, b):
    return math.gcd(a, b)

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

def calc(n, a, b):
    aa = (int(n/a))
    bb = (int(n/b))
    ab = (int(n/lcm(a,b)))
    return aa + bb - ab

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans + 1)


### FIXED CODE ###

# coding: utf-8
import re
import bisect
from datetime import datetime as dt
import bisect
import fractions

def gcd(a, b):
    return fractions.gcd(a, b)

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

def calc(n, a, b):
    return n//a + n//b - n//lcm(a,b)

if __name__ == '__main__':
    a, b, c, d = map(int, input().split())
    ## これで通った
    # num1 = b - calc(b,c,d)
    # num2 = (a-1) - calc(a-1, c,d)
    # print(num1-num2)

    ## これはとおらない
    ans = calc(b, c, d) - calc(a - 1, c, d)
    print(b - a + 1 - ans)
def input_from_console():
    l, r = map(int, input().split())
    return l, r


def solve(l, r):
    minimum = 2020
    if r - l >= 2019:
        return 0
    a, b = l % 2019, r % 2019
    if r // 2019 > l // 2019:
        return 0
    for i in range(a, b):
        for j in range(a + 1, b + 1):
            minimum = min(minimum, (i * j) % 2019)
    result = minimum
    return result


def main():
    l, r = input_from_console()
    print(solve(l, r))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


### FIXED CODE ###


def input_from_console():
    n, a, b = map(int, input().split())
    return n, a, b


def solve(n, a, b):
    result = min(a * n, b)
    return result


def main():
    n, a, b = input_from_console()
    print(solve(n, a, b))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()
a,b=map(int,input().split())
k=int(input())
for i in range (k):
  if a > 0:
    a-=1
  elif:
  	if b > 0:
      b-=1
print(a, b)

### FIXED CODE ###

a,b,k=map(int,input().split())
if a-k>=0:
    print(a-k,b)
elif a+b>=k:
    print(0,a+b-k)
else:
    print(0,0)
A = int(input())
B = int(input())
C = int(input())
K = int(input())

for _ in range(K):
    if A >= B:
        B = 2*B
    else:
        C = 2*C
        

if C > B > A:
    print('Yes')
else:
  print('No')

### FIXED CODE ###

n = [int(i) for i in input().split()]
K = int(input())

for _ in range(K):
    if n[0] >= n[1]:
        n[1] = n[1] * 2
    else:
        n[2] = 2*n[2]
        

if n[2] > n[1] > n[0]:
    print('Yes')
else:
    print('No')
S = int(input())
h = S // 3600
m = S % 3600
s = m % 60
print(h + ":" + m + ":" + s)

### FIXED CODE ###

S = int(input())
h = int(S / 3600)
m = int(S / 60)
m = m % 60
s = S % 60
print("{0}:{1}:{2}".format(h,m,s))
from sympy import divisors
n,m = map(int,input().split())
l = m//n
a = list(divisors(m,generator=True))
c = 0

for i in range(len(a)):
    if a[i] > c and a[i] <= l:
        c = a[i]

print(c)

### FIXED CODE ###

n,m = map(int,input().split())
l = m//n

def x():
    for i in range(l+1)[::-1]:
        if m % i == 0:
            return i
print(x())
from itertools import accumulate


def main():
    n = int(input())
    prime_counter = [0] * n
    acc = tuple(accumulate(range(1, 42)))  # 10^12 < 2^39

    f = 2
    while f * f <= n:
        if n % f == 0:
            n //= f
            prime_counter[f] += 1
        else:
            f += 2
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter:
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()
N = int(input())
if '7' in N:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
ans = 'No'
for i in n:
    if i == '7':
        ans = 'Yes'
print(ans)
n,m = map(int,input().split())
a = [str(input()) for _ in range(n)]
b = [str(input()) for _ in range(m)]
flag = False
for k in range(n-m+1):
    cnt = 0
    for i in range(m):
        for j in range(m):
            if b[k+i][j]==a[k+i][j]:
                cnt += 1
        if cnt==m**2:
            flag = True
            break
    if flag:
        break
print('Yes' if flag else 'No')

### FIXED CODE ###

n,m = map(int,input().split())
a = [str(input()) for _ in range(n)]
b = [str(input()) for _ in range(m)]
flag = False
for l in range(n-m+1):
    for k in range(n-m+1):
        cnt = 0
        for i in range(m):
            for j in range(m):
                if a[k+i][j+l]==b[i][j]:
                    cnt += 1
            if cnt==m**2:
                flag = True
                break
        if flag:
            break
    if flag:
        break
print('Yes' if flag else 'No')
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())
k = -1
for i in range(1,1000):
    if i*(i-1)//2 == N:
        k = i
        print('Yes')
        break
if k == -1:
    print('No')
    exit()

print(k)
ans = [[] for i in range(k)]

import itertools

for i,(a,b) in enemurate(itertools.combinations(range(k),2),1):
    ans[a].append(i)
    ans[b].append(i)

for aaa in ans:
    print(len(aaa),' '.join(map(str,aaa)))



### FIXED CODE ###

import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())

for i in range(1,1000):
    if i*(i-1)//2 == N:
        k = i
        print('Yes')
        break
    if i == 999:
        print('No')
        exit()

print(k)
ans = [[] for i in range(k)]

now = 1

import itertools
L = [i for i in range(k)]
for v in itertools.combinations(L,2):
    ans[v[0]].append(now)
    ans[v[1]].append(now)
    now += 1
for aaa in ans:
    print(len(aaa),' '.join(map(str,aaa)))
import time
import random
N = int(input())
s = str(input())
maxlen = N//2
start = time.time()
def solve(tgt):
    for i in range(N-tgt*2+1):
        if s[i:i+tgt] in s[i+tgt:]:
            return True
    return False

ng = maxlen + 1
ok = 0
if N>650:
    ok = 2
first = 1
while ng-ok > 1:
    end = time.time()
    if end-start > 1.2:
        if ok >= 1000:
            assert()
        r = random.random.randint(ok,ng-1)
        print(r)
        exit()
    tgt = (ok+ng)//2
    if first == 1:
        tgt = (ok+ng)//2
        first = 0
    if solve(tgt):
        ok = tgt
    else:
        ng = tgt
print(ok)


### FIXED CODE ###

from collections import defaultdict as dd
N = int(input())
s = str(input())
maxlen = N//2

def solve(tgt):
    dic = dd(int)
    st = s[tgt:2*tgt]
    dic[st] += 1
    ls = [st]
    for char in s[2*tgt:]:
        st = st[1:]+char
        dic[st] += 1
        ls.append(st)
    st = s[:tgt]
    if dic[st] > 0:
        return True
    dic[ls[0]] -= 1
    for i,char in enumerate(s[tgt:N-tgt]):
        st = st[1:]+char
        if dic[st] > 0:
            return True
        dic[ls[i+1]] -= 1
    return False

ng = maxlen + 1
ok = 0
while ng-ok > 1:
    tgt = (ok+ng)//2
    if solve(tgt):
        ok = tgt
    else:
        ng = tgt
print(ok)
def main():
    N, K = map(int, input().split())
    h = [0]*N
    for i in range(N):
        h[i] = int(input())
    hh = sorted(h)

    for i in range(1, N-K+1):
        ans = min(ans, max(hh[i:i+K])-min(hh[i:i+K]))
    print(ans)
    
main()

### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    h = [0]*N
    for i in range(N):
        h[i] = int(input())
    h.sort()
    
    ans = 10**10
    for i in range(N-K+1):
        ans = min(ans, h[i+K-1]-h[i])
    print(ans)
main()
n = int(input())
aa = list(map(int, input().split()))
if 0 in aa:
  print(0)
else:
  ans = 1
  for a in aa:
    ans = ans * a
    if ans > 10**18:
      break
print(-1 if ans > 10**18 else ans)

### FIXED CODE ###

n = int(input())
aa = list(map(int, input().split()))
if 0 in aa:
  print(0)
else:
  ans = 1
  for a in aa:
    ans = ans * a
    if ans > 10**18:
      break
  print(-1 if ans > 10**18 else ans)
a,b.c=map(int,input().split())
if a+b+c>=22:
  print('bust')
else:
  print('win')

### FIXED CODE ###

a,b,c=map(int,input().split())
if a+b+c>=22:
  print('bust')
else:
  print('win')
a,b=map(int,input().split())
A=ord(a)
B=ord(b)
if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")


### FIXED CODE ###

S=input()
A=ord(S[0])
B=ord(S[2])

if A>B:
  print(">")
elif A<B:
  print("<")
else:
  print("=")
near = abs(xlist[lpos]) if (abs(xlist[lpos]) < abs(xlist[rpos])) else abs(xlist[rpos])
bet = abs(xlist[lpos] - xlist[rpos])

ans = bet + near

for i in range(N-K):
    lpos += 1
    rpos += 1

    near = abs(xlist[lpos]) if (abs(xlist[lpos]) < abs(xlist[rpos])) else abs(xlist[rpos])
    bet = abs(xlist[lpos] - xlist[rpos])

    tmp = bet+near

    if tmp < ans:
        ans = tmp


print(ans)


### FIXED CODE ###

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

lpos = 0
rpos = K-1

near = abs(xlist[lpos]) if (abs(xlist[lpos]) < abs(xlist[rpos])) else abs(xlist[rpos])
bet = abs(xlist[lpos] - xlist[rpos])

ans = bet + near

for i in range(N-K):
    lpos += 1
    rpos += 1

    near = abs(xlist[lpos]) if (abs(xlist[lpos]) < abs(xlist[rpos])) else abs(xlist[rpos])
    bet = abs(xlist[lpos] - xlist[rpos])

    tmp = bet+near

    if tmp < ans:
        ans = tmp


print(ans)
n=int(input())
a=list(map(int,input().split()))
alist=[0]*200001
for i in range(n):
  for j in range(a[i],200001,a[i]):
    alist[j]+=1
cnt=0
for i in range(n):
  if alist[a[i]]==1:
    cnt+=1
print(cnt)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
m=max(a)
alist=[0]*(m+1)
for i in a:
  for j in range(i,m+1,i):
    alist[j]+=1
cnt=0
for i in a:
  if alist[i]==1:
    cnt+=1
print(cnt)