Harryxun/stf_run huggingface dataset:
N,M=map(int, input().split())
q=list([] for m in range(M))
if 1<=M:
    x0,y0=input().split()
    q[0].append(y0)
    for m in range(M-1):
        x,y=input().split()
        q[int(x)-int(x0)].append(y)
wa=[0]*M
ac=[0]*M
for i in range(len(q)):
    for j in range(len(q[i])):
        if (q[i][j]=='AC')&(ac[i]==0):
            ac[i]=1
            wa[i]=j
print(sum(ac),sum(wa))

### FIXED CODE ###

N,M=map(int, input().split())
wa=[0]*N # カウント
ac=[0]*N # 何回目でacか
ac_n=0
for _ in range(M):
    p,s=input().split()
    p=int(p)
    if s=='WA':
        wa[p-1]+=1
    if (s=='AC') and (ac[p-1]==0):
        ac[p-1]=wa[p-1]+1
        ac_n+=1
print(str(ac_n)+' '+str(sum(ac)-ac_n))
import math

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

print(int(a*b/math.gcd(a,b)))

### FIXED CODE ###

from fractions import gcd

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

print(int(a*b/gcd(a,b)))
A,V=map(int(input().split()))
B,W=map(int(input().split()))
T=int(input())
if A+V*T>=B+W*T:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
if A>B:
  A,B=B,A
if A+V*T>=B+W*T:
  print('YES')
else:
  print('NO')
import math

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

def blue(b):
    return math.factorial(K-1)//(math.factorial(b-1)*math.factorial(K-b))
def red(r):
    return math.factorial(N-K+1)//(math.factorial(N-K-r+1)*math.factorial(r))

for i in range(1,K+1):
    ans = blue(i)*red(i)
    print(ans%(10**9+7))



### FIXED CODE ###

import math

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

def blue(b):
    if K-1<0 or K-b<0 or b-1<0:
        return 0
    else:
        return math.factorial(K-1)//(math.factorial(b-1)*math.factorial(K-b))
def red(r):
    if N-K+1<0 or N-K-r+1<0 or r<0:
        return 0
    else:
        return math.factorial(N-K+1)//(math.factorial(N-K-r+1)*math.factorial(r))

for i in range(1,K+1):
    ans = blue(i)*red(i)
    print(ans%(10**9+7))
x,y=map(int,input().strip().split())

if x*4<b:
  print("No")
elif y%2!=0:
  print("No")
else:
  print("Yes")


### FIXED CODE ###

x,y=map(int,input().strip().split())
if x*4<y or x*2>y:
  print("No")
elif y%2!=0:
  print("No")
else:
  print("Yes")
x = 1;

    while x <= 9 :
        y = 1;
        while y <= 9 :
             z = x * y;
             print(str(x) + " x " + str(y)  + " = " + str(z) )
             y = y + 1
        print()
        x = x + 1


### FIXED CODE ###

def __main():
    x = 1;
    while x <= 9 :
        y = 1;
        while y <= 9 :
             z = x * y;
             print(str(x) + "x" + str(y)  + "=" + str(z) )
             y = y + 1
        x = x + 1
        
        
__main()
a, b, c, k = map(int, input().split())
if a >= k:
    print(a)
else:
    print(a - ((k-a)-b)

### FIXED CODE ###

a, b, c, k = map(int, input().split())
if a >= k:
    print(k)
else:
    print(a - ((k-a)-b))
import math
n = int(input())
print("{0:.20f}".format(2*n*math.pi))

### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
if s>n:
    print(-1)
else:
    print(n-s)
from copy import deepcopy
s = list(input())
a, b = map(int, input().split())

def searchpath(pos, dir, st):
    pos = deepcopy(pos)
    dir = deepcopy(dir)
    st  = deepcopy(st)
    while len(st)>0:
        i = st.pop(0)
        if i == 'F':
            if dir == 'r':
                pos = [pos[0]+1, pos[1]]
            if dir == 'l':
                pos = [pos[0]-1, pos[1]]
            if dir == 'u':
                pos = [pos[0], pos[1]+1]
            if dir == 'd':
                pos = [pos[0], pos[1]-1]
            if len(st) == 0 and pos == [a, b]:
                return 1
        if i == 'T':
            if dir == 'r' or dir == 'l':
                if searchpath(pos, 'u', st)==1 or searchpath(pos, 'd', st)==1:
                    return 1
            if dir == 'u' or dir == 'd':
                if searchpath(pos, 'r', st)==1 or searchpath(pos, 'l', st)==1:
                    return 1
            break;
    return -1

ans = searchpath([0,0], 'r', s)
if ans == 1:
    print('Yes' , flush=True)
else:
    print('No' , flush=True)


### FIXED CODE ###

# tle
# from copy import deepcopy
# s = list(input())
# a, b = map(int, input().split())
# def searchpath(pos, dir, st):
#     pos = deepcopy(pos)
#     dir = deepcopy(dir)
#     st  = deepcopy(st)
#     while len(st)>0:
#         i = st.pop(0)
#         if i == 'F':
#             if dir == 'r':
#                 pos = [pos[0]+1, pos[1]]
#             if dir == 'l':
#                 pos = [pos[0]-1, pos[1]]
#             if dir == 'u':
#                 pos = [pos[0], pos[1]+1]
#             if dir == 'd':
#                 pos = [pos[0], pos[1]-1]
#             if len(st) == 0 and pos == [a, b]:
#                 return 1
#         if i == 'T':
#             if dir == 'r' or dir == 'l':
#                 if searchpath(pos, 'u', st)==1 or searchpath(pos, 'd', st)==1:
#                     return 1
#             if dir == 'u' or dir == 'd':
#                 if searchpath(pos, 'r', st)==1 or searchpath(pos, 'l', st)==1:
#                     return 1
#             break;
#     return -1
# ans = searchpath([0,0], 'r', s)
# if ans == 1:
#     print('Yes' , flush=True)
# else:
#     print('No' , flush=True)


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

current_x = len(s[0])
current_y = 0

# for i in s[2::2]: # cant calculate order
for i in sorted([len(j) for j in s[2::2]])[::-1]:
    if current_x < a:
        current_x += i
    else:
        current_x -= i
for i in sorted([len(j) for j in s[1::2]])[::-1]:
    if current_y < b:
        current_y += i
    else:
        current_y -= i

if current_x==a and current_y==b:
    print('Yes', flush=True)
else:
    print('No', flush=True)
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

for i in range(1,k+1):
  print((combinations_count(n-k+1, i)*combinations_count(k-1, i-1))%(10**9+7))

  
  

### FIXED CODE ###

import math
 
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

if n == k:
  for i in range(1, k+1):
    if i == 1:
      print(1)
    else:
      print(0)
else:
  for i in range(1,k+1):
    if i <= n-k+1:
      p1 = combinations_count(n-k+1, i)
      p2 = combinations_count(k-1, i-1)
      ans = p1*p2
      ans = ans%(10**9+7)
      print(ans)
    else:
      print(0)
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
DIV = 10**9+7

B = [0]*(M+1)
for i in range(M+1):
    if i==0:
        B[i] = A[i]-1
    elif i==M:
        B[i] = N-A[i-1]-1
    else:
        B[i] = A[i] - A[i-1] - 2
max_B = max(B)
F = [1]*(max_B+1)
for i,f in enumerate(F):
    if i<2:
        pass
    else:
        F[i] = F[i-2] + F[i-1]
ans = 1
for b in B:
    ans *= F[b]
    ans %=DIV

print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]
DIV = 10**9+7

def main():
    if M>0:
        B = [0]*(M+1)
        for i in range(M+1):
            if i==0:
                B[i] = A[i]-1
            elif i==M:
                B[i] = N-A[i-1]-1
            else:
                if A[i]==A[i-1]:
                    B[i] = 0
                else:
                    B[i] = A[i] - A[i-1] - 2
    else:
        B = [N]
    min_B = min(B)
    if min_B<0:
        return 0
    
    max_B = max(B)
    F = [1]*(max_B+1)
    for i in range(max_B+1):
        if i<2:
            pass
        else:
            F[i] = F[i-2] + F[i-1]
    ans = 1
    for b in B:
        ans *= F[b]
        if ans >= DIV:
            ans %= DIV
    return ans

print(main())
H, N = map(int, input().split())
attacks = [*map(int, input().split())]
if sum(attacks) >= H:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

H, N = map(int, input().split())
attacks = list(map(int, input().split()))
if sum(attacks) >= H:
    print("Yes")
else:
    print("No")
n=int(input())
X=[]
Y=[]
#A=[]
#for i in range(n):
A=int(input())
x=[]
y=[]
  #for j in range(A[i]):
x,y=[int(s) for s in input().split()]
  #X.append(x)
  #Y.append(y)
  
c=0
#for i in range(n):
 # l=[1]*n
  #for j in range(i, n-i):
   # if l[j]==0:continue
    #for k in range(A[j]):
   # 　　l[X[j][k]] *= Y[j][k]
#if c<l.count(1):
 # c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
import sys

N, K = map(int, sys.stdin.readline().split())
A = list(map(int, sys.stdin.readline().split())) * K


def main():
    count = 0
    for i in range(0, K * N - 1):
        for j in range(1, K * N):
            if i < j and A[i] > A[j]:
                count = count + 1

    ans = count % (10 ** 9 + 7)
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys


def main():
    N, K = map(int, sys.stdin.readline().split())
    A = list(map(int, sys.stdin.readline().split()))

    count1 = 0
    count2 = 0

    for i in range(N - 1):
        for j in range(i + 1, N):
            if A[i] > A[j]:
                count1 = count1 + 1
            if A[i] != A[j]:
                count2 = count2 + 1
    count1 = count1 * K
    count2 = count2 * (K * (K - 1) // 2)

    ans = (count1 + count2) % 1000000007
    print(ans)


if __name__ == "__main__":
    main()
A, B, X = map(int,input().split())
if(A <= X and A+B => X):
  print('YES')
else:
  print('NO')

### FIXED CODE ###

A, B, X = map(int,input().split())
if(A <= X and X <= A+B):
  print('YES')
else:
  print('NO')
999999999999999 1.11

### FIXED CODE ###

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

x = a // 1000 * (1000 *b)
y = a % 1000

ans = int(x) + int(y*b)
print(ans)
while True:
    H,W = map(int,input().split())
    if H == W == 0:
        break
    for int(i) in range(H):
        if i = 1:
            print("#"*W)
        elif i = H:
            print("#"*W)
        else:
            print("#","・"*(W-2),"#")
    print()


### FIXED CODE ###

while True:
    H,W = map(int,input().split())
    
    if H == W == 0:
        break
    
    for i in range(H):
        if i == 0 or i == H-1:
            print('#' * W)
        else:
            print('#','.'*(W-2),'#',sep='')
    print('')
import sys
import math
import fractions
import bisect
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''

N, D, A = map(int, input().split())
XH = []
X = []

for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    XH.append([x1, y1])

    
def counting(hp):
    return hp//A + int(hp%A!=0)

ans = 0
XH.sort()
for i in range(N):
    X.append(XH[i][0])

begin = 0
last = XH[begin][0] + 2*D

# これより手前までを減らす
end = bisect.bisect_right(X, last)

while True:
    need = counting(XH[begin][1])
    ans += need
    

    # 爆発
    for i in range(begin, end):
        # 最後に達したら終える
        if i == N:
            break
        XH[i][1] -= need*A
        
    # 次の範囲に更新
    for i in range(begin, end):
        
        if XH[i][1] > 0:
            begin = i
            last = XH[begin][0] + 2*D
            for j in range(end, N):
                if XH[j][1] > last:
                    end = j
                    break
                elif j == N-1:
                    end = N
                    break
            break

        # 最後まで０にできてたらおしまい
        elif i == N-1:
            print(ans)
            sys.exit()

        # 範囲がすべて０以下なら次に行く
        elif i == end-1:
            begin = end
            last = XH[begin][0] + 2*D
            for j in range(end, N):
                if XH[j][1] > last:
                    end = j
                    breake
                elif j == N-1:
                    end = N
                    break







"""
ATTENTION: Pythonで間に合うか？？

            <目安>
 文字列結合、再帰関数を含む→Python
 上を含まず時間が不安→PyPy3

"""

### FIXED CODE ###

import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''

N, D, A = map(int, input().split())
XH = []

for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    XH.append([x1, y1])

    
def counting(hp):
    if hp < 0:
        return 0
    return hp//A + int(hp%A!=0)

XH.sort()


bombs = deque([]) # 有効な爆弾の威力と範囲を保存する
power = 0 # 有効な爆弾の威力の合計

ans = 0
for i in range(N):
    
    # 使えない爆弾を捨てる
    while len(bombs)>0 and bombs[0][0] < XH[i][0]:
        power -= bombs.popleft()[1]

    # パワーの不足分の爆弾
    add = counting(XH[i][1]-power) 
    ans += add
    
    # 追加した爆弾をキューに加える
    bombs.append((XH[i][0] + 2*D, add*A))
    power += add*A


print(ans)









"""
ATTENTION: Pythonで間に合うか？？

            <目安>
 文字列結合、再帰関数を含む→Python
 上を含まず時間が不安→PyPy3

"""
x = input()
k = int(input())
x = x.split()
y = [int(s) for s in x]
dict = {"red":0, "green":0}
dict["red"] = y[0]
dict["green"] = y[1]
count = 0
if dict["red"] < dict["green"]:
      pass
else:
  for N in range(k):
    count += 1
    dict["green"] = dict["green"] * 2
    if dict["red"] < dict["green"]:
        break
    else:
        continue
if k - count == 0:
  if dict["green"] < dict["blue"]:
    print("No")
  else:
    print("Yes")
else:
  pass
i = k - count
dict["blue"] = y[2]
if dict["green"] < dict["blue"]:
  print("Yes")
  exit()
else:
  for N in range(i):
    dict["blue"] = dict["blue"] * 2
    if dict["green"] < dict["blue"]:
      print("Yes")
      exit()
    else:
        continue
print("No")

### FIXED CODE ###

x = input()
k = int(input())
x = x.split()
y = [int(s) for s in x]
dict = {"red":0, "green":0}
dict["red"] = y[0]
dict["green"] = y[1]
count = 0
if dict["red"] < dict["green"]:
      pass
else:
  for N in range(k):
    count += 1
    dict["green"] = dict["green"] * 2
    if dict["red"] < dict["green"]:
        break
    else:
        continue
dict["blue"] = y[2]
if k - count == 0:
  if dict["green"] > dict["blue"]:
    pass
  else:
    print("Yes")
    exit()
else:
  pass
i = k - count
if dict["green"] < dict["blue"]:
  print("Yes")
  exit()
else:
  for N in range(i):
    dict["blue"] = dict["blue"] * 2
    if dict["green"] < dict["blue"]:
      print("Yes")
      exit()
    else:
        continue
print("No")
N = int(input())
D = list(map(int, input().split()))
D.sort()
print(D[N//2 + 1] - D[N//2])

### FIXED CODE ###

N=int(input())//2
D=sorted(list(map(int,input().split())))
print(D[N]-D[N-1])
n = int(input())
p = 0
for _ in n:
  i,j = [int(i) for i in input().split()]
  p += j-i+1
print(p)
  

### FIXED CODE ###

n = int(input())
p = 0
for _ in range(n):
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)
from math import log2
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = [[a[i]] for i in range(n)]
c = list(a)

for i in range(n-1):
    for j in range(i+1, n):
        b[i].append(a[j]+b[i][-1])
        c.append(b[i][-1])

m = 40 #ceil(log2((10**9)*1000))=40よりbit幅を40としておけば十分
ans = 0
for i in range(m, -1, -1):
    log = 2**i
    tmp = [x for x in c if x&log==log]
    if len(tmp) >= k:
        ans += log
        c = tmp
print(ans)


### FIXED CODE ###

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

md = sum(a)/n

ans = 0
m = float('inf')
for i in range(n):
    if abs(a[i]-md) < m:
        ans = i
        m = abs(a[i]-md)
print(ans)
import collections

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

import collections 
def solve():
  c = list(collections.Counter(a).values())
  c.sort()
  if(len(c)<=k):
    print(0)
  else:
    print(sum(c[:len(c)-k]))
 
solve()

### FIXED CODE ###

n,k  =map(int, input().split())
A = list(map(int, input().split()))

d = {}
for a in A:
    d[a] = d.get(a, 0) + 1

if len(d) <= k:
    print(0)
else:
    d = sorted(d.values())
    cnt = 0
    for i in range(len(d)-k):
        cnt += d[i]
    print(cnt)
def main():
    #区間の管理は　[a, b)で管理していることに注意

    # INT_MIN = -10 ** 18
    MAX_N = 2 * 10 ** 5
    # MAX_N = 20


    def init(n_):
        #簡単にするために2のべき乗に揃える
        n = 1
        while n < n_:
            n *= 2
        return n

    #初期化
    N = int(input())
    n = init(N) + 1
    data = [0] * (2 * MAX_N - 1)

    def update(k, a):
        k += n - 1
        data[k] = a
        while k > 0:
            k = (k - 1) // 2
            data[k] = max(data[2 * k + 1], data[2 * k + 2])

    def query(a, b, k = 0, l = 0, r = n):
        if r <= a or b <= l:
            return 0
        if a <= l and r <= b:
            return data[k]
        else:
            v1 = query(a, b, 2 * k + 1, l, (l + r)//2)
            v2 = query(a, b, 2 * k + 2, (l + r)//2, r)
            return max(v1, v2)

    def initialize(A): #リストAを与えて初期化する
        for i, a in enumerate(A):
            data[i + n - 1] = a
        for i in range(N + n - 1, 0, -2):
            tmp = i
            tmp = (tmp - 1) //2
            data[tmp] = max(data[tmp * 2 + 1], data[tmp * 2 + 2])

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

    ans = 0
    for i in range(N):
        # h = int(input())
        # a = int(input())
        h = H[i]
        a = A[i]
        tmp = query(1, h + 1) #[1, h)での最大値
        # print (h, tmp)
        update(h, tmp + a)
        ans = max(ans, tmp + a)
        # print (data)

    print (ans)

    # print (update(1, 1))
    # print (update(2, 5))
    # print (query(1, 2))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    #区間の管理は　[a, b)で管理していることに注意

    # INT_MIN = -10 ** 18
    # MAX_N = 4 * 10 ** 5
    # MAX_N = 20


    # def init(n_):
    #     #簡単にするために2のべき乗に揃える
    #     n = 1
    #     while n <= n_:
    #         n *= 2
    #     return n

    #初期化
    N = int(input())
    # n = 1
    # while n <= N:
    #     n *= 2

    n = 262144
    data = [0] * (2 * n - 1)

    def update(k, a):
        k = k + n - 1
        # data[k] = a
        while k >= 0:
            data[k] = max(a, data[k])
            k = (k - 1) // 2
            # data[k] = max(data[2 * k + 1], data[2 * k + 2])

    def query(a, b, k, l, r):
        if r <= a or b <= l:
            return 0
        elif a <= l and r <= b:
            return data[k]
        else:
            return max(query(a, b, 2 * k + 1, l, (l + r)//2), query(a, b, 2 * k + 2, (l + r)//2, r))

    H = tuple(map(int, input().split()))
    A = tuple(map(int, input().split()))

    # ans = 0

    dp = [A[0]] + [0] * (N - 1)
    update(H[0] - 1, A[0])
    for i in range(1, N):
        # h = int(input())
        # a = int(input())
        dp[i] = query(0, H[i] - 1, 0, 0, n) + A[i]
        # h = H[i]
        # a = A[i]
        # tmp = query(1, h + 1) #[1, h)での最大値
        # print (h, tmp)
        update(H[i] - 1, dp[i])
        # ans = max(ans, tmp + a)
        # print (data)

    print (query(0, N, 0, 0, n))

if __name__ == '__main__':
    main()
INF = 10 ** 10
n, t = map(int, raw_input().split())

stores = []
for i in xrange(n):
    a, b = map(int, raw_input().split())
    stores.append((a, b))

def mycmp(s1, s2):
    a1, b1 = s1
    a2, b2 = s2
    v1 = a2 + a2 * b1
    v2 = a1 + a1 * b2
    return cmp(v1, v2)

stores.sort(cmp=mycmp)

def multi(s1, s2):
    a1, b1 = s1
    a2, b2 = s2

    a3 = a1 + a2 + a1 * a2
    b3 = b1 + 1 + a2 * b1 + a2 + b2

    a3 = min(INF, a3)
    b3 = min(INF, b3)
    return (a3, b3)

rev = stores[:]
for i in xrange(n - 2, -1, -1):
    rev[i] = multi(rev[i], rev[i + 1])

cnt = 0
tick = 1
ptr = 0
qtr = 0
res = 0
while tick <= t and ptr < n:
    qtr = max(qtr, ptr)
    while True:
        (a, b) = rev[qtr]
        u = a * tick + b
        if tick + u <= t:
            res = max(res, ptr + n - qtr)
            break
        else:
            qtr += 1

    (a, b) = stores[ptr]
    #print (a, b)
    ptr += 1

    tt = a * tick + b
    if tick + tt > t:
        break
    tick += tt + 1
    #print tick, t, a, b, ptr, n
print res



### FIXED CODE ###

INF = 10 ** 10
N = 100
n, T = map(int, raw_input().split())

stores = []
zs = []
for i in xrange(n):
    a, b = map(int, raw_input().split())
    if a == 0:
        zs.append(b)
    else:
        stores.append((a, b))

def mycmp(s1, s2):
    a1, b1 = s1
    a2, b2 = s2
    v1 = a2 + a2 * b1
    v2 = a1 + a1 * b2
    return cmp(v1, v2)

stores.sort(cmp=mycmp)
stores.append((INF, INF))
zs.sort()

m = len(zs)

for i in xrange(1, m):
    zs[i] += zs[i - 1]

dp = [ [INF for i in xrange(N)] for j in xrange(2) ]
dp[0][0] = 0
res = 0

n = len(stores)

p = 0
for i in xrange(n):
    q = p ^ 1
    dp[q] = [INF for j in xrange(N)]

    a, b = stores[i]
    for j in xrange(N):
        dp[q][j] = min(dp[q][j], dp[p][j])
        if dp[p][j] == -INF:
            continue
        if j + 1 < N:
            t = dp[p][j] + 1
            dp[q][j + 1] = min(dp[q][j + 1], dp[p][j] + 1 + a * t + b)
            if dp[q][j + 1] <= T:
                res = max(res, j + 1)
    for j in xrange(N):
        if dp[q][j] > T:
            continue
        rem = T - dp[q][j] - 1
        l, r = 0, m - 1
        while l <= r:
            mid = (l + r) / 2
            if zs[mid] + mid <= rem:
                res = max(res, j + mid + 1)
                l = mid + 1
            else:
                r = mid - 1
    p = q
print res
N = int(input())
A = list(map(int, input().split()))
ans = 1
 
for i in range(N):
  	ans *= A[i]
		if ans > 10**18:
    		print("-1")
        	break
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
if 0 in A:
    print(0)
    exit()
ans=1
for i in A:
    ans*=i
    if ans>10**18:
        print(-1)
        exit()
print(ans)
import sympy

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

if a[0]==1:
    if a[1]==1:
        print(0)
    else:
        print(1)
else:
    ans = 0
    for num in a:
        if a.count(num) >= 2:
            continue
        else:
            cands = set([i for i in a if i!=num])
            divs = set(sympy.divisors(num))
            if not cands&divs:
                ans+=1
            
    print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
M = max(a)
cands = [0]*M

ans = 0
for num in a:
    if cands[num-1] >= 2:
        continue
    for i in range(num, M+1, num):
        cands[i-1] += 1
        
for num in a:
    if cands[num-1]==1:
        ans+=1
print(ans)