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

from collections import defaultdict

def get_p(ind):
    global parent
    while parent[ind] != ind:
        ind = parent[ind]
    return ind

def get_p2(ind):
    global parent
    if parent[ind] != ind:
        parent[ind] = get_p2(parent[ind])
    return parent[ind]

parent = []

def main():
    global parent

    num, swap = map(int, input().split())
    data = list(map(int, input().split()))

    parent = [i for i in range(num + 1)]

    for i in range(swap):
        a, b = map(int, input().split())
        if parent[a] == a and parent[b] == b:
            parent[max(a, b)] = min(a, b)
        elif parent[a] != a and parent[b] != b:
            a_parent = get_p2(a)
            b_parent = get_p2(b)
            parent[max(a_parent, b_parent)] = min(a_parent, b_parent)
        elif parent[a] == a:
            parent[a] = get_p2(b)
        else:
            parent[b] = get_p2(a)

    ans = 0


    for i in range(num):
        now_int = i + 1
        ind = data.index(i + 1)
        ind += 1
        if get_p(now_int) == get_p(ind):
            ans += 1
        elif ind == now_int:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###



def get_p(ind):
    if parent[ind] != ind:
        parent[ind] = get_p(parent[ind])
    return parent[ind]



num, swap = map(int, input().split())
data = list(map(int, input().split()))

parent = [i for i in range(num + 1)]

for i in range(swap):
    a, b = map(int, input().split())
    a_parent = get_p(a)
    b_parent = get_p(b)
    if a_parent != b_parent:
        parent[max(a_parent, b_parent)] = min(a_parent, b_parent)

ans = 0

for i in range(num):
    now_int = i + 1
    ind =  data[i]
    if get_p(now_int) == get_p(ind):
        ans += 1
    elif ind == now_int:
        ans += 1

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

import sys
sys.setrecursionlimit(20000)

H,N = map(int,input().split())
magic = []
for i in range(N):
    a,b = map(int,input().split())
    magic.append([a,b])

INF = 100000000000
DP_list = [INF]*(20010)
def DP(h):
    ans = INF
    if h <= 0:
        return 0
    elif DP_list[h] != INF:
        return DP_list[h]
    else:
        for i in range(N):
            k = magic[i][1] + DP(h - magic[i][0])
            ans = min(ans,k)
        DP_list[h] = ans
        return ans

print(DP(H))

### FIXED CODE ###

H,N = map(int,input().split())
magic = []
for i in range(N):
    a,b = map(int,input().split())
    magic.append([a,b])

INF = 10**9
DP = [INF]*(20005); DP[0] = 0

for i in range(1,20005):
    h = INF
    for j in range(N):
        if i - magic[j][0] >= 0:
            k = magic[j][1] + DP[i - magic[j][0]]
        else:
            k = magic[j][1]
        h = min(h,k)
    DP[i] = h

ans = DP[H]
for i in DP[H+1:]:
    ans = min(ans,i)
print(ans)
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
b=[]
x=0
for i in range(10**5):
    ind=s.find("AC",x)
    if ind==-1:
        break
    b.append(ind+1)
    x=ind+1
for i in range(q):
    cnt=0
    a=list(map(int,input().split()))
    for j in b:
        if a[0]<=j<a[1]:
            cnt+=1
    print(cnt)

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
b=[0]*(n+1)
y=0
for x,i in enumerate(s):
    if i=="A" and x!=n-1 and s[x+1]=="C":
        y+=1
    b[x+1]=y
for i in range(q):
    a0,a1=map(int,input().split())
    print(b[a1-1]-b[a0-1])
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N, T = map(int, input().split())
    ab = [tuple(map(int, input().split())) for i in range(N)]
    ab.sort(key=lambda x: x[0])
    t = ab[-1][0]
    dp = [-1]*(T+t+1)
    dp[0] = 0
    for a, b in ab:
        for i in range(T-1, -1, -1):
            if dp[i] < 0:
                continue
            else:
                dp[i+a] = max(dp[i+a], dp[i]+b)
    ans = max(dp)
    print(ans)


main()


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N, T = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(N)]
    ab.sort(key=lambda x: (x[0], x[1]))
    dp = [-1 for i in range(T*2 + 1)]
    dp[0] = 0
    for a, b in ab:
        for i in range(T*2, 0, -1):
            if i >= a:
                if dp[i-a] >= 0 and i - a < T:
                    dp[i] = max(dp[i], dp[i-a] + b)

    for i in range(1, T*2+1):
        dp[i] = max(dp[i], dp[i-1])
    ans = dp[-1]

    ab.sort(key=lambda x: x[1])
    tmp = ab.pop()
    dp = [-1 for i in range(T)]
    dp[0] = 0
    for a, b in ab:
        for i in range(T-1, 0, -1):
            if i >= a:
                if dp[i-a] >= 0:
                    dp[i] = max(dp[i], dp[i-a] + b)

    for i in range(1, T):
        dp[i] = max(dp[i], dp[i-1])
    ans = max(ans, tmp[1] + dp[-1])

    # print(dp)
    print(ans)


main()
### BUGGY CODE ###

A, B, C, K = map(int, input().split())

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K == 0:
    judge(A-B)
else:
    if A == B and B == C and C == A :
        print(0)
    else:
        sum = A + B + C
        for i in range(1, K+1):
            sum *= K
            A = sum - A
            B = sum - B
        judge(A-B)

### FIXED CODE ###

A, B, C, K = map(int, input().split())

def judge(n):
    if abs(n) > 10**18:
        print('Unfair')
    else:
        print(n)

if K % 2 == 0:
    judge(A-B)
else:
     judge(B-A)
### BUGGY CODE ###

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


n=l()[0]
A=l()
ans=[]
for i in range(n):
    if(i%2==0):
        ans+=[A[i]]
    else:
        ans=[A[i]]+ans
if(i%2==0):
    print(*ans[::-1])
else:
    print(*ans)

### FIXED CODE ###

import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
# import math
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
# sys.setrecursionlimit(int(pow(10, 2)))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = int(pow(10, 9) + 7)
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]





# @lru_cache(None)


n = int(input())
A = input().split()
if n%2==0:
    print(' '.join(A[1::2][::-1]),end=' ')
    print(' '.join(A[::2]))
else:
    print(' '.join(A[::2][::-1]),end=' ')
    print(' '.join(A[1::2]))
### BUGGY CODE ###

n,k=map(int, input().split())
a=list(map(int, input().split()))
x=[1]
dp=[0]*(k+1)
#先手勝利1

for i in range(1,k+1):
    for j in range(n):
        if i>=a[j]:
            x.append(dp[i-a[j]])
    if min(x)==0:
        dp[i]=1
    else:
        dp[i]=0
    x=[1]
if dp[k]==1:
    print('First')
else:
    print('Second')

### FIXED CODE ###

n,k=map(int, input().split())
a=list(map(int, input().split()))
x=[1]
dp=[0]*(k+1)
#先手勝利1

for i in range(1,k+1):
    for j in range(n):
        if i>=a[j]:
            x.append(dp[i-a[j]])
    if min(x)==0:
        dp[i]=1
    else:
        dp[i]=0
    x=[1]
if dp[k]==1:
    print('First')
else:
    print('Second')
### BUGGY CODE ###

n=int(input())
li=[]
for i in range(1, n+1):
  if (i ** .5).is_integer():
    li.append(i)
print(max(li))

### FIXED CODE ###

n=int(input())
for i in reversed(range(1, n+1)):
  if (i ** .5).is_integer():
    print(i)
    break
### BUGGY CODE ###

import sys
from collections import deque
n, m, k = map(int, sys.stdin.readline().split())
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]

for i in range(m):
    a,b = map(lambda x: x-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)

for i in range(k):
    c,d = map(lambda x: x-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

ans = []
for i in range(n):
    que = deque([i])
    V = [False]*n
    V[i] = True
    _B = set(B[i])
    _F = set(F[i])
    _ans = 0
    while que:
        nw = que.popleft()
        for nx in F[nw]:
            if V[nx]: continue
            V[nx] = True
            if nx not in _B and not nx in _F:
                _ans += 1
            que.append(nx)
    ans.append(_ans)
print(" ".join([str(_ans) for _ans in ans]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from collections import Counter

def dfs(nw):
    for nx in F[nw]:
        if V[nx]==-1:
            V[nx] = cnt
            dfs(nx)

n, m, k = list(map(int, sys.stdin.readline().split()))
F = [[] for _ in range(n)]
B = [[] for _ in range(n)]
for i in range(m):
    a,b = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    F[a].append(b)
    F[b].append(a)
for i in range(k):
    c,d = map(lambda x: int(x)-1, map(int, sys.stdin.readline().split()))
    B[c].append(d)
    B[d].append(c)

V = [-1]*n
cnt = 1
for i in range(n):
    if V[i]==-1:
        V[i] = cnt
        dfs(i)
        cnt += 1
cV = Counter(V)
ans = []
for i in range(n):
    ans.append(cV[V[i]]-1 - len(F[i]) - sum([V[b]==V[i] for b in B[i]]))

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

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

for i in range(a[2]):
  if a[0] != 0:
    a[0] = a[0] - 1
  elif a[1] != 0:
    a[1] = a[1] - 1

print(a[0],a[1])

### FIXED CODE ###

A,B,K=map(int,input().split())

if A >= K:
  ans_A = A - K
  ans_B = B
elif A + B >= K:
  ans_A = 0
  ans_B = B - (K - A)
else:
  ans_A = 0
  ans_B = 0

print(ans_A,ans_B)
### BUGGY CODE ###

import heapq
N,M = map(int,input().split())
AB = []
for i in range(N):
    a,b = list(map(int,input().split()))
    AB.append([-b,a])
heapq.heapify(AB)
work = [0 for i in range(M)]
ABlist = []
for i in range(M):
    ABlist.append(list(filter(lambda x:x[1]<=i+1,AB)))
ABremoved = []
for i in range(1,M+1):
    AB2 = ABlist[i-1]
    heapq.heapify(AB2)
    flag = False
    while AB2:
        b,a = heapq.heappop(AB2)
        if [b,a] not in ABremoved:
            flag = True
            break
    if flag:
        work[i-1] = -b
        ABremoved.append([b,a])
print(sum(work))

### FIXED CODE ###

import heapq
from collections import defaultdict
N,M = map(int,input().split())
AB = defaultdict(list)
for i in range(N):
    a,b = list(map(int,input().split()))
    if a not in AB:
        AB[a] = [-b]
    else:
        AB[a] += [-b]
work = 0
AB2 = []
heapq.heapify(AB2)
for i in range(1,M+1):
    for j in AB[i]:
        heapq.heappush(AB2,j)
    if not AB2:
        continue
    b = heapq.heappop(AB2)
    work += -b
print(work)
### BUGGY CODE ###

from bisect import bisect_left
from random import randint
D = int(input())
Cs = list(map(int, input().split()))
Sss = []
for _ in range(D):
    Ss = list(map(int, input().split()))
    Sss.append(Ss)

def change(d, afterIdx):
    global score
    i = d - 1
    beforeIdx = Ts[i] - 1
    afterIdx -= 1
    if beforeIdx == afterIdx:
        return

    newScore = score

    before = lasts[beforeIdx]
    # dが何番目にあるか
    k1 = bisect_left(before, d)
    w = before[k1+1] - d
    h = d - before[k1-1]
    newScore -= Sss[i][beforeIdx]
    newScore -= w * h * Cs[beforeIdx]

    after = lasts[afterIdx]
    # dが何番目にあるか
    k2 = bisect_left(after, d)
    w = after[k2] - d
    h = d - after[k2-1]
    newScore += Sss[i][afterIdx]
    newScore += w * h * Cs[afterIdx]

    if newScore > score:
        lasts[beforeIdx].pop(k1)
        lasts[afterIdx].insert(k2, d)
        Ts[i] = afterIdx + 1
        score = newScore

Ts = []
for _ in range(D):
    Ts.append(randint(1, 26))

score = 0
lasts = [[0] for _ in range(26)]
for i, t in enumerate(Ts):
    d = i + 1
    t -= 1
    score += Sss[i][t]
    lasts[t].append(d)
    for j in range(26):
        score -= (d - lasts[j][-1]) * Cs[j]

for i in range(26):
    lasts[i].append(D+1)


for i in range(10000000):
    change(randint(1, D), randint(1, 26))

for t in Ts:
    print(t)


### FIXED CODE ###

from bisect import bisect_left
from random import randint
D = int(input())
Cs = list(map(int, input().split()))
Sss = []
for _ in range(D):
    Ss = list(map(int, input().split()))
    Sss.append(Ss)

def change(d, afterIdx):
    global score
    i = d - 1
    beforeIdx = Ts[i] - 1
    afterIdx -= 1
    if beforeIdx == afterIdx:
        return

    newScore = score

    before = lasts[beforeIdx]
    # dが何番目にあるか
    k1 = bisect_left(before, d)
    w = before[k1+1] - d
    h = d - before[k1-1]
    newScore -= Sss[i][beforeIdx]
    newScore -= w * h * Cs[beforeIdx]

    after = lasts[afterIdx]
    # dが何番目にあるか
    k2 = bisect_left(after, d)
    w = after[k2] - d
    h = d - after[k2-1]
    newScore += Sss[i][afterIdx]
    newScore += w * h * Cs[afterIdx]

    if newScore > score:
        lasts[beforeIdx] = before[:k1] + before[k1+1:]
        lasts[afterIdx] = after[:k2] + [d] + after[k2:]
        Ts[i] = afterIdx + 1
        score = newScore

Ts = []
for _ in range(D):
    Ts.append(randint(1, 26))

score = 0
lasts = [[0] for _ in range(26)]
for i, t in enumerate(Ts):
    d = i + 1
    t -= 1
    score += Sss[i][t]
    lasts[t].append(d)
    for j in range(26):
        score -= (d - lasts[j][-1]) * Cs[j]

for i in range(26):
    lasts[i].append(D+1)


for i in range(100000):
    change(randint(1, D), randint(1, 26))

for t in Ts:
    print(t)
### BUGGY CODE ###

import numpy

def solution():
    n, m = map(int, input().split())
    a = [int(aa) for aa in input().split()]
    a.sort(reverse=True)
    for i in range(m):
        a[0] = a[0] // 2
        a = numpy.sort(a)[::-1]
    print(sum(a))

solution()


### FIXED CODE ###

import heapq as hp
def solution():
    n, m = map(int, input().split())
    a = [int(aa) * -1 for aa in input().split()]
    hp.heapify(a)
    for i in range(m):
        hp.heappush(a, (hp.heappop(a)*-1 // 2) * -1)
    print(abs(sum(a)))

solution()
### BUGGY CODE ###

from statistics import mean
while True:
  n=int(input())
  c=0
  if n==0:
    break
  ns=list(map(int, input().split()))
  for i in range(n):
    if ns[i]<=mean(ns):
      c+=1
    else:
      pass
  print(c)


### FIXED CODE ###

while True:
  n=int(input())
  c=0
  if n==0:
    break
  ns=list(map(int, input().split()))
  for i in range(n):
    if ns[i]<=sum(ns)/n:
      c+=1
  print(c)
### BUGGY CODE ###

N=int(input())
S=input().split()
NS = [int(i) for i in S]
def exist():
    s=0
    for i in range(N):
      cond=True
      for j in range(0,i):
         if NS[i]>NS[j]:
            cond=False
      if cond:
        s+=1   
    return s
if __name__=='__main__':
   print(exist())

### FIXED CODE ###

N=int(input())
S=input().split()
NS = [int(i) for i in S]
def minL():
  ml=[NS[0]]
  for i in range(1,N):
     ml+=[min(ml[i-1],NS[i])]
  return ml  

MINL=minL()
def exist():
    s=0
    for i in range(N):
      if MINL[i]>=NS[i]:
         s+=1
    return s
if __name__=='__main__':
   print(exist())
### BUGGY CODE ###

N = int(input())
ans=0
for i in range(1,N):
    p = 0
    k = 1
    while k*k <= i:
        if i % k == 0:
            p+=1
            if k != i // k:
                p+=1
        k += 1
    ans+=p
print(ans)

### FIXED CODE ###

N = int(input())
ans=0
for i in range(1,10**6+1):
    for j in range(1,1000001):
        if i*j>N-1:
            break
        else:
            ans+=1
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
t=1
b=10**15
c=-(10**15)
for i in a:
    k=i-t
    b=min(b,k)
    c=max(c,k)
    t+=1
v=10**15
for i in range(b,c+1):
    t=1
    k=0
    for j in a:
        k+=abs(j-(i+t))
        if t==n:
            v=min(v,k)
        t+=1
print(v)

### FIXED CODE ###

n=int(input())
a=map(int,input().split())
import statistics
t=1
b=10**15
c=-(10**15)
d=[]
for i in a:
    e=i-t
    d.append(e)
    t+=1
i=int(statistics.median(d))
k=0
for j in d:
    k+=abs(j-i)
print(k)
### BUGGY CODE ###

N = int(input())
S = [input() for i in range(N)]
word_list=[]
for w in S:
  sort_word=''.join(sorted(w))
  word_list.append(sort_word)
word_list.sort()

import itertools
word_set=set(word_list)
count_list=[]
for word in word_set:
  count_list.append(word_list.count(word))

total_counts=[]
for num in count_list:
  total_counts.append(len(list(itertools.combinations(range(num),2))))
  
print(sum(total_counts))

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)
### BUGGY CODE ###

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,q,s,l):
    lst_ac = [0]*(len(s)-1)
    for i in range(len(s)-1):
        if s[i]+s[i+1] == "AC":
            lst_ac[i] = 1
    for item in l:
        print(sum(lst_ac[item[0]-1:item[1]-1]))

def resolve():
    n,q = mi()
    s = input()
    l = mix(q)
    main(n,q,s,l)

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,q,s,l):
    lst_ac = [0]*(len(s))
    for i in range(len(s)-1):
        if s[i]+s[i+1] == "AC":
            lst_ac[i+1] = lst_ac[i]+1
        else:
            lst_ac[i+1] = lst_ac[i]
    for item in l:
        print(lst_ac[item[1]-1] - lst_ac[item[0]-1])

def resolve():
    n,q = mi()
    s = input()
    l = mix(q)
    main(n,q,s,l)

if __name__ == "__main__":
    resolve()
### BUGGY CODE ###

import heapq

INF = float('inf')

N = int(input())
to = [[] for _ in range(N)]

for _ in range(N - 1):
    a, b, c = map(int, input().split())
    a, b, = a - 1, b - 1
    to[a].append((c, b))
    to[b].append((c, a))

Q, K = map(int, input().split())
query = [list(map(lambda x:int(x) - 1, input().split())) for _ in range(Q)]


def dijkstra(s, e):
    hq = [(0, s)]
    heapq.heapify(hq) # リストを優先度付きキューに変換
    cost = [INF] * N # 行ったことのないところはinf
    cost[s] = 0 # 開始地点は0
    
    while hq:
        c, v = heapq.heappop(hq)
        if c > cost[v]: # コストが現在のコストよりも高ければスルー
            continue
        for d, u in to[v]:
            tmp = d + cost[v]
            if tmp < cost[u]:
                cost[u] = tmp
                heapq.heappush(hq, (tmp, u))
    return cost[e]


def main():
    min_path = [dijkstra(i, K - 1) for i in range(N)]
    for x, y in query:
        print(min_path[x] + min_path[y])


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)


N = int(input())
to = [[] for _ in range(N)]

for _ in range(N - 1):
    a, b, c = map(int, input().split())
    a, b, = a - 1, b - 1
    to[a].append((c, b))
    to[b].append((c, a))

Q, K = map(int, input().split())
K -= 1
query = [list(map(lambda x:int(x) - 1, input().split())) for _ in range(Q)]
depth = [0] * N

def dfs(v, d, p=-1):
    depth[v] = d
    for cost, nv in to[v]:
        if nv == p:
            continue
        dfs(nv, d + cost, v)


def main():
    dfs(K, 0)
    for x, y in query:
        print(depth[x] + depth[y])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

n = 50000
c = [1 for i in range(n)]
c[0] = 0
i = 2
while i**2 <= n:
    j = i*2
    while j <= n:
        c[j - 1] = 0
        j += i
    i += 1

while True:
    n = int(input())
    if n == 0:
        break
    elif n%2 == 1:
        print(0)
        continue
    cnt = 0
    for i in range(n):
        if c[i] == 1 and c[n-i] == 1:
            cnt +=1
    print(cnt)



### FIXED CODE ###

n = 50001
is_prime = [i for i in range(n)]
is_prime[0] = is_prime[1] = 0
i = 2
while i**2 <= n:
    j = i*2
    while j < n:
        is_prime[j] = 0
        j += i
    i += 1

prime_set  = set(is_prime)
prime_set.remove(0)
prime_list = sorted(list(prime_set))

while True:
    cnt = 0
    n = int(input())
    if n == 0:
        break
    for i in prime_list:
        if i > n//2:
            break
        if n - i in prime_set:
            cnt += 1
    print(cnt)
### BUGGY CODE ###

N = int(input())
ans = 1
for i in range(1,N+1):
    ans = ans * i
print(ans%(10**9+7))

### FIXED CODE ###

N = int(input())
ans = 1
for i in range(1,N+1):
    ans = (i * ans) % (10**9+7)
print(ans)
### BUGGY CODE ###

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

benefits = [max(a[i + 1:]) - a[i] for i in range(n - 1)]

# for i in range(n)
#     if a[i] > a[i + 1]:
#         continue
#     else:
#         benefits.append(max([a[j] - a[i]]))
# 

print(benefits.count(max(benefits)))

### FIXED CODE ###

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

max_benefit = 0
a_min = a[0]
ans = 0
for i in range(1, n):
    if a[i] < a_min:
        a_min = a[i]
    benefit = (a[i] - a_min)
    if  benefit == max_benefit:
        ans += 1
    elif benefit > max_benefit:
        ans = 1
        max_benefit = benefit

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

def main():
  from fractions import gcd
  mod = 10**9 + 7
  N = int(input())
  A = list(map(int, input().split()))

  lcm = A[0]
  for i in A:
    lcm = (lcm*i) // gcd(lcm,i)

  ans = 0
  for i in A:
    ans += lcm // i
  print(ans%mod)
main()

### FIXED CODE ###

from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%mod)
### BUGGY CODE ###

n=int(input())
i=int(n**0.5)
while i<n:
  if n%i==0:
    break
  else:
    i+=1
if i==n:
  print(i-1)
else:
  print(int(i+n/i)-2)

### FIXED CODE ###

n=int(input())
i=int(n**0.5)+1
while i>0:
  if n%i==0:
    break
  else:
    i-=1
if i==n:
  print(i-1)
else:
  print(int(i+n/i)-2)
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rtsrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())
    
    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = (ok+ng)//2
    while ng - ok > 1:
        a = ask(mid)
        if a == a0:
            ok = a
        else:
            ng = a
        mid = (ok+ng)//2


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

    def ask(n):
        print(n)
        sys.stdout.flush()
        s = input().rstrip('\n')
        if s == 'Vacant':
            exit()
        elif s == 'Male':
            return 0
        else:
            return 1

    N = int(input())

    a0 = ask(0)
    ok = 0
    ng = N-1
    mid = ((ng//2)//2) * 2
    while ng - ok > 2:
        a = ask(mid)
        if a == a0:
            ok = mid
        else:
            ng = mid
        mid = (((ok//2)+(ng//2))//2)*2
    ask((ok+ng)//2)
    ask(N-1)


if __name__ == '__main__':
    main()