Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

def test(n):
    cnt = 0
    for i in range(1,100):
        for j in range(1,100):
            for k in range(1,100):
                if (i+j+k)**2 == n + (i*j + j*k + k*i):
                    cnt += 1 
    return cnt

for i in range(N):
    print(test(i+1))


### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

ans = [0 for _ in range(10050)]

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
           v = (i+j+k)**2 - (i*j + j*k + k*i)
           if v < 10050:
            ans[v] += 1

for i in range(N):
    print(ans[i+1])
### BUGGY CODE ###

S = input()

cnt = 0

while "ABC" in S:
    cnt += S.count("ABC")
    S = S.replace("ABC", "BCA")

print(cnt)

### FIXED CODE ###

S = input()

cnt = 0

S = S.replace("BC", "X")
S = S.replace("B", " ")
S = S.replace("C", " ")

arr = S.split()

for elem in arr:
    i = 0

    for char in elem:
        if char == "A":
            i += 1
        else:
            cnt += i

print(cnt)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100000)

n = int(input())
s = input()
s_set = set(s)
S = []
for i in s_set:
    S.append(s.count(i))

def cal(n, S):
    if n == 1:
        return sum(S)
    if n == 2:
        ans = 0
        for i in range(len(S) - 1):
            for j in range(i+1, len(S)):
                ans += S[i] * S[j]
                ans %= 10 ** 9 + 7
        return ans
    else:
        ans = 0
        for i in range(len(S) - n + 1):
            cross = cal(n-1, S[i+1:])
            cross %= 10 ** 9 + 7
            ans += S[i] * cross
            ans %= 10 ** 9 +7
        return ans

ans = 0
for i in range(n):
    ans += cal(i+1, S)

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



### FIXED CODE ###

n = int(input())
s = input()
s_set = set(s)
S = []
for i in s_set:
    S.append(s.count(i))

ans = 1
for i in S:
    ans *= i + 1
    ans %= 10 ** 9 + 7

print(ans - 1)
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
B = []

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            B.append(A[i])
        else:
            B.insert(0, A[i])

else:
    for i in range(n):
        if i % 2 == 0:
            B.insert(0, A[i])
        else:
            B.append(A[i])

B = list(map(str, B))
print(" ".join(B))

### FIXED CODE ###

from collections import deque

n = int(input())
A = list(map(int, input().split()))
B = deque([])

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            B.append(A[i])
        else:
            B.appendleft(A[i])

else:
    for i in range(n):
        if i % 2 == 0:
            B.appendleft(A[i])
        else:
            B.append(A[i])

B = list(map(str, B))
print(" ".join(B))
### BUGGY CODE ###

# -*- coding:utf-8 -*-
def gcd(n,m):
    k = max(n,m)
    for i in range(k):
        if n%(k-i) == 0 and m%(k-i) == 0:
            return k-i
x, y = map(int,input().split())
print(gcd(x,y))

### FIXED CODE ###

# -*- coding:utf-8 -*-
def gcd(n,m):
    if n < m:
        tmp = m
        m = n
        n = tmp
    while m > 0:
        r = n % m
        n = m
        m = r
    return n
    
x, y = map(int,input().split())
print(gcd(x,y))
### BUGGY CODE ###

#おわり、むり

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

X,Y,Z = [],[],[]
for i in range(N):
    x,y,z = map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)  
    
dp = [[[0,0,0] for i in range(W+1)] for j in range(N+1)]
    
ans = 0
for fgo in range(0,8):
    FGO = [fgo%2,(fgo//2)%2,(fgo//4)%2]
    for i in range(W+1):
        dp[0][i][0]= 0 #X
        dp[0][i][1]= 0 #Y
        dp[0][i][2]= 0 #Z
    for i in range(N):
        for w in range(W+1):
            if w>=1:
                x = dp[i][w-1][0]+X[i]
                y = dp[i][w-1][1]+Y[i]
                z = dp[i][w-1][2]+Z[i]
                NOW = (x*pow(-1,FGO[0]))+(y*pow(-1,FGO[1]))+(z*pow(-1,FGO[2]))
                BEFORE = sum([dp[i][w][f]*pow(-1,FGO[f]) for f in range(3)])
                if NOW > BEFORE:
                    dp[i+1][w][0] = x
                    dp[i+1][w][1] = y
                    dp[i+1][w][2] = z
                else:
                    dp[i+1][w][0] = dp[i][w][0]
                    dp[i+1][w][1] = dp[i][w][1]
                    dp[i+1][w][2] = dp[i][w][2]
            else:
                dp[i+1][w][0] = dp[i][w][0]
                dp[i+1][w][1] = dp[i][w][1]
                dp[i+1][w][2] = dp[i][w][2]
    MAX_ABS = abs(dp[N][W][0])+abs(dp[N][W][1])+abs(dp[N][W][2])
    if MAX_ABS > ans: ans = MAX_ABS
    #print(MAX_ABS,FGO,dp)

print(ans)

### FIXED CODE ###

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

L = []
for i in range(N):
    L.append(list(map(int,input().split())))
    
MAX_ANS = 0
for fgo in range(0,8):
    FGO = [pow(-1,fgo%2),pow(-1,(fgo//2)%2),pow(-1,(fgo//4)%2)]
    L = sorted(L,key=lambda x:x[0]*FGO[0]+x[1]*FGO[1]+x[2]*FGO[2],reverse=True)
    ans = 0
    for m in L[:W]:
        ans += m[0]*FGO[0] + m[1]*FGO[1] + m[2]*FGO[2]
    if ans > MAX_ANS: MAX_ANS = ans

print(MAX_ANS)
### BUGGY CODE ###


N, M = map(int, input().split())
S = input()
T = input()

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 
def lcm(x, y):
    return (x * y) // gcd(x, y)

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

success = False
ans = 0
fans = ans

_lcm = lcm(len(S), len(T))
for k in list(reversed(range(1, (len(S) * len(T))//_lcm + 1))):
    ans = k * _lcm
    double_st = []
    
    for i in range(len(S)):
        if (len(T)*i)%len(S) == 0 and (len(T) * i)//len(S) <len(T):
            double_st += [(i * ans)//len(S) + 1]
    isImpossible = False

    for st in double_st:
        s_i = ((st-1) * len(S))//ans
        t_i = ((st-1) * len(T))//ans
        if S[s_i] != T[t_i]:
            isImpossible = True
            break

            
    if isImpossible:
        break
    else:
        success = True
        fans = ans

if not success:
    print(-1)
else:
    print(ans)

### FIXED CODE ###


N, M = map(int, input().split())
S = input()
T = input()

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
 
def lcm(x, y):
    return (x * y) // gcd(x, y)

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

success = False
fans = 0

_lcm = lcm(len(S), len(T))

def isImpble(k, _lcm):
    global success
    global S
    global T
    global fans
    
    ans = k * _lcm
    double_st = []
    
    for i in range(len(S)):
        if (len(T)*i)%len(S) == 0 and (len(T) * i)//len(S) <len(T):
            double_st += [(i * ans)//len(S) + 1]
    isImpossible = False

    for st in double_st:
        s_i = ((st-1) * len(S))//ans
        t_i = ((st-1) * len(T))//ans
        if S[s_i] != T[t_i]:
            isImpossible = True
            break

            
    if isImpossible:
        return True
    else:
        success = True
        fans = k*_lcm
        return False
        

imp = isImpble((len(S) * len(T))//_lcm, _lcm)

if not imp:
    for k in range(1, (len(S) * len(T))//_lcm ):
        imp = isImpble(k, _lcm)
        if success:
            break
    

if not success:
    print(-1)
else:
    print(fans)
### BUGGY CODE ###


n,m = map(int,input().split())
s = list(input())
edges = [tuple(map(int,input().split())) for i in range(m)]


edgeset = set()
for i,j in edges:
    edgeset.add((min(i,j),max(i,j)))


def addEdge(graph,u,v):
    graph[u].add(v)


def deleteNode(graph,node):
    graph.pop(node,None)

from collections import defaultdict
graphAB = defaultdict(set)
graphABopp = defaultdict(set)

for i,j in edgeset:
    addEdge(graphAB,i,j)
    addEdge(graphABopp,j,i)



def adjAB(node):
    Aflag = False
    Bflag = False
    for i in graphAB[node]:
        if s[i-1] == 'A':
            Aflag = True
        if s[i-1] == 'B':
            Bflag = True
        if Aflag and Bflag:
            break
    for i in graphABopp[node]:
        if s[i-1] == 'A':
            Aflag = True
        if s[i-1] == 'B':
            Bflag = True
        if Aflag and Bflag:
            break
    if Aflag and Bflag:
        return(True)
    else:
        return(False)



visitlist = [i for i in set(graphAB.keys())|set(graphABopp.keys()) if not adjAB(i)]
#print(visitset)

while bool(visitlist):
    i = visitlist.pop()
    for j in graphAB[i]:
        graphABopp[j].remove(i)
        if not adjAB(j):
            visitlist.append(j)
            #print(visitset,'add')
    for j in graphABopp[i]:
        graphAB[j].remove(i)
        if not adjAB(j):
            visitlist.append(j)
            #print(visitset,'add')
    graphAB.pop(i,None)
    graphABopp.pop(i,None)

#print(graphAB)
#print(graphABopp)


if graphAB == {} and graphABopp == {}:
    print('No')
else:
    print('Yes')





### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#

"""
GC027 C
"""

n,m = map(int,input().split())
s = list(input())
edges = [tuple(map(int,input().split())) for i in range(m)]
ali = [0 for i in range(n)]
bli = [0 for i in range(n)]


def addEdge(graph,u,v):
    graph[u].add(v)


from collections import defaultdict
graphAB = defaultdict(set)

def incrementAB(node,adj):
    if s[adj-1] == 'A':
        ali[node-1]+=1
    if s[adj-1] == 'B':
        bli[node-1]+=1

def decrementAB(node,adj):
    if s[adj-1] == 'A':
        ali[node-1]-=1
    if s[adj-1] == 'B':
        bli[node-1]-=1

for i,j in edges:
    addEdge(graphAB,i,j)
    addEdge(graphAB,j,i)

def adjAB(node):
    if ali[node-1]!=0 and bli[node-1]!=0:
        return(True)
    else:
        return(False)

graphvers = set(graphAB.keys())
visitset = set()
for i in range(1,n+1):
    if not i in graphvers:
        s[i-1] = 'C'
    else:
        for j in graphAB[i]:
            incrementAB(i,j)
        if not adjAB(i):
            visitset.add(i)


while bool(visitset):
    #print(graphAB)
    #print(graphABopp)
    #print(abli)
    i = visitset.pop()
    for j in graphAB[i]:
        if s[j-1] != 'C':
            decrementAB(j,i)
            if not adjAB(j):
                visitset.add(j)
    s[i-1] = 'C'

#print(graphAB)
#print(graphABopp)

sset= set(s)
sset.add('C')
sset.remove('C')
if bool(sset):
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

X = int(input())
for a in range(X//100+1):
    for b in range(X//101+1):
        for c in range(X//102+1):
            for d in range(X//103+1):
                for e in range(X//104+1):
                    for f in range(X//105+1):
                        if 100*a + 101*b +102*c + 103*d + 104*e + 105*f == X:
                            print(1)
                            exit()
print(0)


### FIXED CODE ###

X = int(input())
# とりあえず 100 で構成しようとして、余剰分を 100 を置換することで構成できないか調べる
q, r = X//100, X%100
if r <= 5 * q:
    print(1)
else:
    print(0)
### BUGGY CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
a_max=max(a)
for i in range(n):
    if a[i]!=a_max:
        print(a_max)
    else:
        a[i]=0
        print(max(a))
        a[i]=a_max

### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
a_max=max(a)
a_sort=sorted(a,reverse=True)
for i in range(n):
    if a[i]!=a_max:
        print(a_max)
    else:
        print(a_sort[1])
### BUGGY CODE ###

n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(list(map(int,input().split())))
a.sort()
#print(a)
d=[]
for i in range(m):
    if a[i][0]==1:
        d.append(a[i][1])
    else:
        break
e=[]
for i in range(m):
    if a[i][1]==n:
        e.append(a[i])
for i in range(len(d)):
    if [d[i],n] in e:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
#print([d[0],n])

### FIXED CODE ###

n,m=map(int,input().split())
a=[]
for i in range(m):
    a.append(list(map(int,input().split())))
a.sort()
#print(a)
d=[]
for i in range(m):
    if a[i][0]==1:
        d.append(a[i][1])
    else:
        break
e=[]
for i in range(m):
    if a[i][1]==n:
        e.append(a[i][0])
if len(set(e) & set(d))!=0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
#from math import *
from collections import defaultdict as dd, deque
def data(): return sys.stdin.readline().strip()
def mdata(): return map(int, data().split())
out=sys.stdout.write
#sys.setrecursionlimit(100000)
INF=int(10e9)


s=data()
t=data()
dp1=[0]*len(s)
for i in range(len(t)):
    m=0
    dp2=dp1.copy()
    for j in range(len(s)):
        if s[j]==t[i]:
            dp2[j]=max(m+1,dp1[j])
        m=max(m,dp1[j])
    dp1=dp2.copy()

dp3=[0]*len(s)
for i in range(len(t)-1,-1,-1):
    m=0
    dp2=dp3.copy()
    for j in range(len(s)-1,-1,-1):
        if s[j]==t[i]:
            dp2[j]=max(m+1,dp3[j])
        m=max(m,dp3[j])
    dp3=dp2.copy()

m=max(dp1)
cnt=m
ans=''
for j in range(len(s)-1,-1,-1):
    if dp1[j]>=cnt and dp3[j]>=m-cnt+1:
        ans=s[j]+ans
        cnt-=1
    if cnt==0:
        break
print(ans)



### FIXED CODE ###

from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
#from math import *
from collections import defaultdict as dd, deque
def data(): return sys.stdin.buffer.readline().strip().decode()
def mdata(): return map(int, data().split())
out=sys.stdout.write
#sys.setrecursionlimit(100000)
INF=int(10e9)


s=data()
t=data()
dp=[[0]*(len(s)+1) for i in range(len(t)+1)]
for i in range(1,len(t)+1):
    for j in range(1,len(s)+1):
        if s[j-1]==t[i-1]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            dp[i][j]=max(dp[i-1][j],dp[i][j-1])
m=max(max(dp))
ans=''
for i in range(len(t)-1,-1,-1):
    for j in range(len(s)-1,-1,-1):
        if dp[i+1][j+1]==m and s[j]==t[i]:
            ans=s[j]+ans
            m-=1
            break
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from sys import stdin
import numpy as np

ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()

N, W = ds_in()

dp = np.zeros((N+1, W+1), dtype=int)  # 重さi以下の最大価値
# dp[index][weight]:=valueとしてdp[n]での最大を求める.
for i in range(N):
    # pre = values.copy()
    w, v = ds_in()  # [weight, value]
    for j in range(W+1):
        if (j-w>=0):
            dp[i+1][j] = np.maximum(dp[i][j], dp[i][j-w]+v)
        else:
            dp[i+1][j] = dp[i][j]
        # values[w] = np.maximum(values[wv[0]] + wv[1], values[wv[0]:])

ans = 0
for i in range(W+1):
    ans = max(ans, dp[N][i])
print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin

def main():
    ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()

    N, W = ds_in()

    dp = [[0] * (W+1) for i in range(N+1)]
# dp[index][weight]:=valueとしてdp[n]での最大を求める.
    for i in range(N):
    # pre = values.copy()
        w, v = ds_in()  # [weight, value]
        for j in range(W+1):
            if (j-w>=0):
                dp[i+1][j] = max(dp[i][j], dp[i][j-w]+v)
            else:
                dp[i+1][j] = dp[i][j]
    ans = 0
    for i in range(W+1):
        ans = max(ans, dp[N][i])
    print(ans)
    return 0
main()
### BUGGY CODE ###

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

sushi_array = []

sushi_count = [-1] * N
sushi_kind = 0
for i in range(N):
    t, d = map(int, input().split())
    sushi_array.append((t - 1, d))
    if sushi_count[t - 1] == -1:
        sushi_count[t - 1] = 0
        sushi_kind += 1

sushi_array = sorted(sushi_array, key=lambda x: -x[1])
# print(sushi_array, sushi_kind)

now_kind = 0
kiso = 0
for sushi in sushi_array[:K]:
    kiso += sushi[1]
    if sushi_count[sushi[0]] == 0:
        now_kind += 1
    sushi_count[sushi[0]] += 1

ans = kiso + now_kind * now_kind

add_index = K
remove_index = K - 1

now_kind += 1
while now_kind <= sushi_kind:
    for sushi in sushi_array[add_index:]:
        if sushi_count[sushi[0]] == 0:
            kiso += sushi[1]
            sushi_count[sushi[0]] = 1
            break
        add_index += 1
    else:
        break
    for sushi in sushi_array[remove_index::-1]:
        if sushi_count[sushi[0]] >= 1:
            kiso -= sushi[1]
            sushi_count[sushi[0]] -= 1
            break
        remove_index -= 1
    else:
        break
    # print(kiso + now_kind * now_kind)
    ans = max(ans, kiso + now_kind * now_kind)
    now_kind += 1

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K = map(int, input().split())

sushi_array = []

sushi_count = [-1] * N
sushi_kind = 0
for i in range(N):
    t, d = map(int, input().split())
    sushi_array.append([t - 1, d])
    if sushi_count[t - 1] == -1:
        sushi_count[t - 1] = 0
        sushi_kind += 1

sushi_array = sorted(sushi_array, key=lambda x: -x[1])
# print(sushi_array, sushi_kind)

now_kind = 0
kiso = 0
can_remove = []
for sushi in sushi_array[:K]:
    kiso += sushi[1]
    if sushi_count[sushi[0]] == 0:
        now_kind += 1
        sushi_count[sushi[0]] = 1
    else:
        can_remove.append(sushi[1])

    # print(sushi_count)
ans = kiso + now_kind * now_kind

add_index = K
remove_index = K - 1

# print(ans, kiso, now_kind)
now_kind += 1

for sushi in sushi_array[add_index:]:
    if len(can_remove) == 0 or now_kind > sushi_kind:
        break
    if sushi_count[sushi[0]] == 0:
        kiso += sushi[1] - can_remove.pop()
        sushi_count[sushi[0]] = 1
        # print(ans, kiso, now_kind)
        ans = max(ans, kiso + now_kind * now_kind)
        now_kind += 1
    else:
        continue

print(ans)
### BUGGY CODE ###

x=int(input())
i = 1
s=set()
while x/i>=1:
  if x%i == 0:
    s.add(i+x//i-2)
    a1=i+x//i-2
    a2=a1
    if a2-a1 >0:
      break
  i = i + 1
print(min(s))

### FIXED CODE ###

import math
x=int(input())
s=set()
y=int(math.sqrt(x))
for i in range(y,0,-1):
  if x%i == 0:
    a=i+x//i-2
    s.add(a)
    if min(s)-a <0:
      break
print(min(s))
### BUGGY CODE ###

import sys
import queue
#+++++
		
def main():
	n,q = map(int, input().split())
	tree=[[] for _ in range(n+1)]
	hh=[ 0 for _ in range(n+1)]
	ret=[0 for _ in range(n+1)]
	
	for i in range(n-1):
		pa,ch = map(int, input().split())
		tree[pa].append(ch)
		
	for v in range(q):
		nd, hv = map(int, input().split())
		hh[nd] += hv
		
	ol = queue.Queue(n+1)
	ret[1]=hh[1]
	vv=hh[1]
	for cc in tree[1]:
		ol.put((vv,cc))
		
	while not ol.empty():
		ph,nd=ol.get()
		ret[nd]=hh[nd]+ph
		vv=ret[nd]
		for cc in tree[nd]:
			ol.put((vv,cc))

	print(' '.join([str(v) for v in ret[1:]]))
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys
import queue
#+++++
		
def main():
	n,q = map(int, input().split())
	tree=[[] for _ in range(n+1)]
	hh=[0 for _ in range(n+1)]
	ret=[0 for _ in range(n+1)]
	
	for i in range(n-1):
		pa,ch = map(int, input().split())
		tree[pa].append(ch)
		
	for v in range(q):
		nd, hv = map(int, input().split())
		hh[nd] += hv
		
	ol = queue.Queue(n+1)
	ret[1]=hh[1]
	vv=hh[1]
	for cc in tree[1]:
		ol.put((vv,cc))
		
	while not ol.empty():
		ph,nd=ol.get()
		ret[nd]=hh[nd]+ph
		vv=ret[nd]
		for cc in tree[nd]:
			ol.put((vv,cc))

	rets=' '.join([str(v) for v in ret[1:]])
	print(rets)
	
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
### BUGGY CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

cnt = 0
for n in range(1,N+1):
    adj = []
    adj.append([n])
    for i in AB:
        if n in i:
            adj.append(i)
    adj = set(sum(adj,[]))
    adj_H = [H[s-1] for s in adj]
    if max(adj_H) == H[n-1] and adj_H.count(max(adj_H)) == 1:
        cnt += 1

print(cnt)


### FIXED CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
g = [[] for _ in range(N+1)]

for _ in range(M):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)

cnt = 0
for n in range(1,N+1):
    for i in g[n]:
        if H[n-1] <= H[i-1]:
            break
    else:
        cnt += 1

print(cnt)
### BUGGY CODE ###

n, q = [int(x) for x in input().split()]
s = input()
for _ in range(q):
    l, r = [int(x) for x in input().split()]
    print(s[l-1:r].count("AC"))

### FIXED CODE ###

from bisect import bisect_left

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

index_list = []
i = 0
while i < n - 1:
    if s[i] == "A" and s[i + 1] == "C":
        index_list.append(i + 1)
        i += 2
    else:
        i += 1

for _ in range(q):
    l, r = [int(x) for x in input().split()]
    print(bisect_left(index_list, r) - bisect_left(index_list, l))
### BUGGY CODE ###

import itertools

n=int(input())
s=list(input() for _ in range(n))
s=list(map(lambda _s: _s[0], filter(lambda _s: _s[0] == "M" or _s[0] == "A" or _s[0] == "R" or _s[0] == "C" or _s[0] == "H", s)))

if len(s) == 0:
    print(0)
    quit()

print(len(list(filter(lambda x: len(x)==3, map(set, itertools.combinations(s, 3))))))


### FIXED CODE ###

import itertools
n = int(input())
s = [input()[0] for _ in range(n)]
c = list(itertools.combinations(set(filter(lambda x: x in "MARCH", s)), 3))

ans = 0
for _c in c:
    ans += s.count(_c[0])*s.count(_c[1])*s.count(_c[2])
print(ans)
### BUGGY CODE ###

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

ans = 1
for i in a:
    ans *= i

print(ans) if ans <= 10 ** 18 else print(-1)


### FIXED CODE ###

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

if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans *= i
        if ans > 10 ** 18:
            print(-1)
            exit()

    print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(n) for n in input().split()]
ans = 0

for i in range(N):
    for j in range(N):
        if A[i] % A[j] == 0 and i != j:
            break
        if j == N-1:
            ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
A = [int(n) for n in input().split()]
maxA = max(A)

C = {a:0 for a in A}
D = {a:0 for a in A}
for a in A:
    C[a] += 1
for a in A:
    if C[a] > 0:
        t = 2
        while a*t <= maxA:
            D[a*t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)