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

n, k = [int(i) for i in input().split()]
a = [int(i)-1 for i in input().split()]
x = list(range(n))

def calc(a, b):
    c = [0] * n
    for i in range(n):
        c[i] = b[a[i]]
    return c

while k:
    if k & 1 == 1:
        x = calc(x, a)
    k //= 2
    a = calc(a, a)

print(x[0]+1)

### FIXED CODE ###

n, k = [int(i) for i in input().split()]
a = [int(i)-1 for i in input().split()]

if k <= n:
    i = 0
    for _ in range(k):
        i = a[i]
    print(i + 1)
    exit()

visit = [False] * n
visit[0] = True
lon = [0] * n

i = 0
l = 0
while True:
    i = a[i]
    l += 1
    if visit[i]:
        break
    visit[i] = True
    lon[i] = l

kk = (k - lon[i]) % (l - lon[i])
for _ in range(kk):
    i = a[i]
print(i+1)
### BUGGY CODE ###

import numpy as np
n,k,q = map(int,input().split())

a = np.zeros(q,dtype = int)

for i in range(q):
    a[i] = int(input())


score = np.array([k]*n)

for i in range(q):
    score = score - 1
    score[(a[i]-1)] += 1

for i in range(n):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

import numpy as np
n,k,q = map(int,input().split())

a = np.zeros(q,dtype = int)

for i in range(q):
    a[i] = int(input())


score = np.array([k]*n)
sub = np.zeros(n,dtype = int)
for i in range(q):
    sub[a[i]-1] += 1

score = score + sub - q
for i in range(n):
    if score[i] > 0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

import sys
input = sys.stdin.readline

def main():
    N, H = map(int, input().split())
    A = [0] * N
    B = [0] * N
    for i in range(N):
        A[i], B[i] = map(int, input().split())

    cnt = 0
    sort_B = sorted(B, reverse=True)
    for b in sort_B:
        if b > max(A):
            cnt += 1
            H -= b
        else:
            break
    
    cnt += H // max(A) if H % max(A) == 0 else H // max(A) + 1
    print(cnt)



if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N, H = map(int, input().split())

    A = [0] * N
    B = [0] * N

    num_list = []
    for i in range(N):
        a, b = map(int, input().split())
        A[i] = a
        B[i] = b

    sort_B = sorted(B, reverse=True)
    max_A = max(A)
    ans = 0
    for b in sort_B:
        if b > max_A:
            ans += 1
            H -= b
        else:
            break
        
        if H <= 0:
            break
    
    if H > 0:
        ans += -(-H // max_A)

    print(ans)

main()
### BUGGY CODE ###

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)
ab=[0]*K
abc=[]
i=0



for x in range(X):
  for y in range(Y):
    if i<=K-1:
    	ab[i]=A[x]+B[y]
    else:
      	ab.append(A[x]+B[y])
    i +=1

ab.sort(reverse=True)

abc=[ab[k]+C[z] for k in range(K) for z in range(Z)]
abc.sort(reverse=True)

for k in range(K):
	print(abc[k])


### FIXED CODE ###

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

K=min(K,3000)

AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:K] for c in C[:K]]
ABC.sort(reverse=True)

for k in range(K):
	print(ABC[k])
### BUGGY CODE ###

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

ans = 0
for i in range(N):
    for j in range(i,N):
        if sorted(s[i]) == sorted(s[j]) and s[i] != s[j]:
            ans += 1

print(ans)

### FIXED CODE ###

import collections
N = int(input())
s = ["".join(sorted(input())) for i in range(N)]

ans = 0
cnt = collections.Counter(s)
for i in cnt.values():
    if i > 1:
        ans += i*(i-1)//2

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

L, R = map(int, input().split())

res = float("inf")
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        res = min(res, (i * j) % 2019)
print(res)


### FIXED CODE ###

L, R = map(int, input().split())

if R - L >= 2019:
    res = 0
else:
    res = float("inf")
    L = L % 2019
    R = R % 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            res = min(res, (i * j) % 2019)
print(res)
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(lambda x:int(x)%k, input().split()))

b = 0
c = 0
for i in range(1,min(n,k-1)+1):
  c += a[i-1]
  c2 = c
  for j in range(n-i+1):
    if c2%k == i:
      b += 1
    if i+j < n:
      c2 += a[i+j] - a[j]
print(b)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
a[0] = (a[0]-1)%k
for i in range(1,n):
  a[i] = (a[i]+a[i-1]-1)%k
ans = 0
b = {0:1}
for i in range(n):
  if i>0:
    b[a[i-1]] = b.get(a[i-1],0) + 1
  if i>=k:
    b[a[i-k]] -= 1
  if i==k-1:
    b[0] -= 1
  ans += b.get(a[i],0)
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
  b.append(a[i])
  b = b[::-1]
print(" ".join(map(str, b)))

### FIXED CODE ###

n = int(input())
a = input().split()
b = []
for i in range(n - 1, -1, -2):
  b.extend([a[i]])
for j in range(n % 2, n, 2):
  b.extend([a[j]])
print(" ".join(b))
### BUGGY CODE ###

# フェルマーの小定理
K = int(input())
S = input()

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(len(S) + K)

result = 0
for i in range(K + 1):
    result += pow(26, i, m) * mcomb(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, m)
    result %= m
print(result)


### FIXED CODE ###

# フェルマーの小定理
K = int(input())
S = input()

m = 1000000007


def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


fac = make_factorial_table(len(S) + K)

result = 0
for i in range(K + 1):
    result += pow(26, i, m) * mcomb(len(S) - 1 + K - i, len(S) - 1) * pow(25, K - i, m)
    result %= m
print(result)
### BUGGY CODE ###

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

ans = 0
tmp = 0
count = float(0)
for i in range(k, n + 1):
    tmp = (sum(p[i - k:i]) + k) / 2
    if ans <= tmp:
        ans = tmp
print(ans)


### FIXED CODE ###

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

tmp_sum = sum(p[0:k])
ans = (tmp_sum + k) / 2
count = float(0)
for i in range(k, n):
    tmp_sum = tmp_sum + p[i] - p[i - k]
    tmp = (tmp_sum + k) / 2
    if ans <= tmp:
        ans = tmp

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

def main():
  n,k = map(int, input().split())
  a = list(map(int, input().split()))
  a.sort()
  ans = 0

  c = 1
  nCk = [1]
  for r in range(k,n+1):
      c_ = c*r//(r-k+1)
      c = c_
      nCk.append(c_)

  if k == 1:
    print(0)
  else:
    for i in range(1,n+1):
      if n-i < k-1:
        break
      ans += (a[n-i]-a[i-1])*nCk[n-i-k+1]
    print(ans%1000000007)
if __name__ == "__main__":
  main()

### FIXED CODE ###

n,k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0

from operator import mul
from functools import reduce
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 5
fact = [1, 1]  
factinv = [1, 1]
inv = [0, 1]  

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

if k == 1:
  print(0)
else:
  for i in range(1,n):
    if n-i < k-1:
      break
    ans += a[n-i]*cmb(n-i,k-1,p)
    ans -= a[i-1]*cmb(n-i,k-1,p)
  print(ans%1000000007)
### BUGGY CODE ###

def main():
  n = int(input())
  li = list(map(int,input().split()))
  ans = 1
  for i in range(n):
    ans *= li[i]
  if ans > (10 ** 18):
    print(-1)
  else:
    print(ans)


if __name__ == '__main__':
  main()

### FIXED CODE ###

def main():
  n = int(input())
  li = list(map(int,input().split()))
  li.sort()
  ans = 1
  for i in range(n):
    ans *= li[i]
    if ans > (10 ** 18):
      print(-1)
      exit()
  print(ans)


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

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

list_val = list(set(L))
list_size = [0]*N
for i,v in enumerate(list_val):
    list_size[i] = L.count(v)

max_size = max(list_size)

ans = []
for i,s in enumerate(list_size):
    if s == max_size:
      ans.append(list_val[i])
print("\n".join(sorted(ans)))


### FIXED CODE ###

import collections

N = int(input())

s = [input() for i in range(N)]

c = collections.Counter(s)
max_n = max(c.values())

ans = []
for key, val in c.items():
  if val == max_n:
    ans.append(key)
print("\n".join(sorted(list(set(ans)))))
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    aa = list(map(int, input().split()))
    ff = list(map(int, input().split()))
    aa.sort(reverse=True)
    ff.sort()
    l = -1
    r = aa[0] * ff[-1]
    #print(aa)
    #print(ff)
    while l + 1 < r:
        #print(l,r)
        m = (l + r) // 2
        s = 0
        for a, f in zip(aa, ff):
            b = m // f
            s += max(a - b, 0)
            if s > k:
                l = m
                break
        else:
            r = m
    print(r)


main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    aa = list(map(int, input().split()))
    ff = list(map(int, input().split()))
    aa.sort(reverse=True)
    ff.sort()
    l = -1
    r = aa[0] * ff[-1]
    # print(aa)
    # print(ff)
    while l + 1 < r:
        # print(l,r)
        m = (l + r) // 2
        s = 0
        for a, f in zip(aa, ff):
            b = m // f
            s += max(a - b, 0)
            if s > k:
                l = m
                break
        else:
            r = m
    print(r)

main()
### BUGGY CODE ###

import sys
input=sys.stdin.readline

N,M=map(int, input().split())
lis={}
ly=[]
for i in range(M):
    t1,t2 =list(map(int,input().split()))
    lis[t2]=t1
    ly.append(t2)
d={}
for i in sorted(lis):
    d[lis[i]]=d.get(lis[i],0)+1
    ly[ly.index(i)]='{:0=6}{:0=6}'.format(lis[i],d[lis[i]])
for i in ly:print(i)

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    lines = [input() for j in range(m)]
 
    cities = {}
    for i in range(m):
        p, y = map(int, lines[i].split())
        if p in cities:
            cities[p].append((i, y))
        else:
            cities[p] = [(i, y)]
 
    outputs = [None] * m
    for pref, city_list in cities.items():
        city_list.sort(key=lambda x: x[1])
        #print(pref, city_list)
        city_no = 1
        for city in city_list:
            outputs[city[0]] = "{:06d}{:06d}".format(pref, city_no)
            city_no += 1
 
    for output in outputs:
        print(output)
    return
 
 
main()
### BUGGY CODE ###

N = int(input())
S = input()
ans = set()

for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            ans.add(S[i]+S[j]+S[k])
print(len(ans))

### FIXED CODE ###

N = int(input())
S = input()
ans = 0

for i in range(0, 1000):
    i = str(i).zfill(3)
    idx = 0
    for j in range(3):
        if i[j] in S[idx:]:
            idx += S[idx:].index(i[j])+1
            continue
        else:
            break
    else:
        ans += 1

    


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

N=int(input())
S=input()
d={}
for i in range(N):
  for j in range(i,N+1):
    now=S[i:j]
    if now in d:
      d[now]+=1
    else:
      d.setdefault(now,1)
twice={k:v for k, v in d.items() if v>=2}
v1=sorted(twice.keys(), key=len)[::-1] 
for v in v1:
    f=S.find(v)+len(v)
    if v in S[f:]:
        break
print(len(v))

### FIXED CODE ###

N=int(input())
S=input()
a=i=j=0
while j<N:
  t=S[i:j]
  if t in S[j:]:
    a=max(a,len(t))
    j+=1
  else:
    i+=1
print(a)
### BUGGY CODE ###

N, M = map(int,input().split())
A = []
for _ in range(M):
    A.append(int(input()))

dp = [ 0 for _ in range(N+5)]


dp[0] = 1
for i in range(N):
    if i+1 not in A:
        dp[i+1] += dp[i]
        dp[i] %= 1000000007
    if i+2 not in A:
        dp[i+2] += dp[i]
        dp[i] %= 1000000007

print(dp[N] % 1000000007)

### FIXED CODE ###

import bisect
N, M = map(int,input().split())
A = []
for _ in range(M):
    A.append(int(input()))

dp = [ 0 for _ in range(N+5)]

def check(n):
    i = bisect.bisect_left(A, n)
    if i != M and A[i] == n:
        return False
    else:
        return True

dp[0] = 1
for i in range(N):
    if check(i+1):
        dp[i+1] += dp[i]
        dp[i] %= 1000000007
    if check(i+2):
        dp[i+2] += dp[i]
        dp[i] %= 1000000007

print(dp[N] % 1000000007)
### BUGGY CODE ###

def main():
    N, K = map(int, input().split())
    A = sorted(map(int, input().split()))
    F = sorted(map(int, input().split()), reverse=True)
    def helper(t):
        k = K
        for a, f in zip(A, F):
            if a * f <= t:
                continue
            m = t // f
            k -= (a - m)
            if k < 0:
                return False
        return True

    l = 0
    r = A[-1] * F[0]
    while r != l:
        m = l + (r - l) // 2
        if helper(m):
            r = m
        else:
            l = m + 1
    print(r)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, K = map(int, input().split())
    A = sorted(map(int, input().split()))
    F = sorted(map(int, input().split()), reverse=True)
    def helper(t):
        k = K
        for a, f in zip(A, F):
            if a * f <= t:
                continue
            m = t // f
            k -= (a - m)
            if k < 0:
                return False
        return True

    l = 0
    r = A[-1] * F[0]
    while r != l:
        m = l + (r - l) // 2
        if helper(m):
            r = m
        else:
            l = m + 1
    print(r)


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

N=int(input())
L=list(input().split())
Q=int(input())
for i in range(Q):
  a,b=input().split()
  L=[i if i!=a else b for i in L]
  print(sum(list(map(int,L))))

### FIXED CODE ###

import sys
input = sys.stdin.readline 
N=int(input())
L=list(map(int,input().split()))
Q=int(input())
R=[0]*(10**5)
for i in L:
  R[i-1]+=1
ans=sum(L)
for i in range(Q):
  a,b=map(int,input().split())
  R[b-1]+=R[a-1]
  ans+=(b-a)*R[a-1]
  R[a-1]=0
  print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from collections import defaultdict
from bisect import bisect
def inpl(): return list(map(int, input().split()))

def primes(N):
    sieve = [True]*(N+1)
    sieve[:2] = [False, False]
    for i in range(4, N+1, 2):
        sieve[i] = False

    for i in range(3, N+1, 2):
        if sieve:
            for j in range(2*i, N+1, i):
                sieve[j] = False
    P = []
    for i in range(N+1):
        if sieve[i]:
            P.append(i)
    return P

N, M = inpl()
P = primes(10**6)
searched = defaultdict(int)

Q = [1]

if N==1:
    print(M)
    exit()

if M%N == 0:
    ans = M//N
else:
    ans = 1
while Q:
    a = Q.pop()
    for p in P:
        c = a*p
        d = M - c*N
        if d < 0:
            break
        
        if d%c == 0:
            if not searched[c]:
                searched[c] = True
                ans = max(ans, c)
                Q.append(c)
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import defaultdict
from bisect import bisect
def inpl(): return list(map(int, input().split()))

def primes(N):
    sieve = [True]*(N+1)
    sieve[:2] = [False, False]
    for i in range(4, N+1, 2):
        sieve[i] = False

    for i in range(3, N+1, 2):
        if sieve:
            for j in range(2*i, N+1, i):
                sieve[j] = False
    P = []
    for i in range(N+1):
        if sieve[i]:
            P.append(i)
    return P

N, M = inpl()
P = primes(10**6)
searched = defaultdict(int)

Q = [1]

if N==1:
    print(M)
    exit()

if M%N == 0:
    ans = M//N
else:
    ans = 1
while Q:
    a = Q.pop()
    for p in P:
        c = a*p
        d = M - c*N
        if d < 0:
            break
        
        if d%c == 0:
            if not searched[c]:
                searched[c] = True
                ans = max(ans, c)
                Q.append(c)
print(ans)
### BUGGY CODE ###

n = int(input())
x = list(input())

for i in range(len(x)):
  if x[i] == "0":
    x[i] = "1"
  else:
    x[i] = "0"
  n = int("".join(x), 2)
  count = 0
  while n != 0:
    one_num = bin(n)
    n = n % one_num.count("1")
    count += 1
  print(count)
  if x[i] == "0":
    x[i] = "1"
  else:
    x[i] = "0"

### FIXED CODE ###

N=int(input())
X=input()
Y=int(X,2)
Z=Y
C=X.count('1')
if C==1:
  for i in range(N):
    if X[i]=='1':
      print(0)
    elif i==N-1:
      print(2)
    else:
      print(1)
  exit()
Y,Z=Y%(C+1),Z%(C-1)

def f(x):
  if x==0:
    return 0
  return 1+f(x%bin(x).count('1'))

for i in range(N):
  if X[i]=='1':
    print(1+f((Z-pow(2,N-i-1,C-1))%(C-1)))
  else:
    print(1+f((Y+pow(2,N-i-1,C+1))%(C+1)))
### BUGGY CODE ###

def main():
    import sys
    from collections import deque
    from sys import stdin
    readline = stdin.readline
    n,m = map(int, readline().split())
    abl =[[]for i in range(n)]
    for i in range(m):
        a,b = map(int,readline().split())
        abl[a-1].append(b)
        abl[b-1].append(a)

    an=[0]*(n-1)
    i=1
    wk=deque([i])
    wwk=deque([])
    il=deque(abl[0])

    while any(wk):
        i=wk.pop()
        il=deque(abl[i-1])
        for k in range(len(il)):
            iwk=il.pop()
            if an[iwk-2]==0 and iwk>1:
                wwk.append(iwk)
                an[iwk-2]=i
                if all(an):
                    print('Yes')
                    for i in an:
                        print(i)
                    sys.exit()
        if not(any(wk)):
            wk=deque(wwk)
            wwk=deque([])
    print('No')

main()

### FIXED CODE ###

def main():
    from collections import deque
 
    n,m =map(int,input().split())
    abl=[[] for i in range(n+1)]
    for i in range(m):
        a,b = map(int,input().split())
        abl[a].append(b)
        abl[b].append(a)
 
    an=[0]*(n+1)
    an[0]=1
    tg = deque([1])
    while len(tg):
        itg = tg.popleft()
        for j in abl[itg]:
            if an[j]==0:
                an[j]=itg
                tg.append(j)

    if all(an):
        print('Yes')
        for j in an[2:]:
            print(j)
    else:
        print('No')
 
main()
### BUGGY CODE ###

import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=-a[i]
for i in range(m):
    heapq.heapify(a)
    a[0]=-(-a[0]//2)
ans=0
for i in range(n):
    ans+=a[i]
print(-ans)


### FIXED CODE ###

import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
lis=[]
for i in range(n):
    heapq.heappush(lis,-a[i])
for i in range(m):
    b=(heapq.heappop(lis)*(-1)//2)*(-1)
    heapq.heappush(lis,b)
    #print(lis)
ans=0
#print(lis)
for i in range(n):
    ans+=lis[i]
print(-ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in A:
  ans *= i
if ans > 1e18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

def solve():
  ans = 1
  if 0 in A:
    return 0
  for i in A:
    ans *= i
    if ans > 1e18:
      return -1
  return ans


N = int(input())
A = list(map(int, input().split()))
print(solve())
### BUGGY CODE ###

import sys
from functools import reduce
from operator import add


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


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


def main():
    n = _i()
    a = list(sorted(_ia()))
    r = a[0]
    for ai in a[1:]:
        r = gcd(r, ai)
        if r == 1:
            break
    else:
        return "not coprime"

    N = 10 ** 6 + 1
    f = [False] * N
    p = []
    k = {ai: [] for ai in a}
    for i in range(2, N):
        if f[i]:
            continue
        p.append(i)
        if k.get(i) is not None:
            k[i].append(i)
        for j in range(2*i, N, i):
            f[j] = True
            if k.get(j) is not None:
                k[j].append(i)

    ls = reduce(add, k.values(), [])
    if len(ls) != len(set(ls)):
        return "setwise coprime"
    else:
        return "pairwise coprime"


if __name__ == "__main__":
    print(main())


### FIXED CODE ###

import sys
from functools import reduce
from operator import add


def _i(): return int(sys.stdin.readline().strip())


def _ia(): return map(int, sys.stdin.readline().strip().split())


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


def main():
    n = _i()
    a = list(sorted(_ia()))
    r = a[0]
    for ai in a[1:]:
        r = gcd(r, ai)
        if r == 1:
            break
    else:
        return "not coprime"

    N = 10 ** 6 + 1
    f = [False] * N
    p = []
    k = {ai: 1 for ai in a}
    for i in range(2, N):
        if f[i]:
            continue
        p.append(i)

        tmp = 0
        if k.get(i) is not None:
            tmp += 1
        for j in range(2*i, N, i):
            f[j] = True
            if k.get(j) is not None:
                tmp += 1
                if tmp > 1:
                    return "setwise coprime"
    else:
        return "pairwise coprime"


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

X, Y = map(int, input().split())
num = X
l = 10**18
while num <= l:
    if num % Y == 0:
        print(num)
    num += X
else:
    print(-1)

### FIXED CODE ###

X, Y = map(int, input().split())
if X % Y != 0:
    print(X)
elif X*2%Y != 0:
    print(X*2)
else:
    print(-1)
### BUGGY CODE ###

a,b,c,k = (map(int, input().split()))
for _ in range(k):
  tmpa = b+c
  tmpb = c+a
  tmpc = a+b
  a = tmpa
  b=tmpb
  c=tmpc
if a-b>10**18:
  print("Unfair")
else:
  print(a-b)

### FIXED CODE ###

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

if a-b>10**18:
  print("Unfair")
elif k%2==0:
  print(a-b)
else:
  print(b-a)
### BUGGY CODE ###

def is_ok(x, A, F):
    result = 0
    for i in range(N):
        a = A[i]
        t = x // F[i]
        if t < a:
            result += a - t
    return result <= K


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

A.sort()
F.sort(reverse=True)

ng = -1
ok = A[-1] * F[0]
while ok - ng > 1:
    m = ng + (ok - ng) // 2
    if is_ok(m, A, F):
        ok = m
    else:
        ng = m
print(ok)


### FIXED CODE ###

def f(x, A, F):
    result = 0
    for i in range(N):
        t = x // F[i]
        if t < A[i]:
            result += A[i] - t
    return result


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

A.sort()
F.sort(reverse=True)

lo = 0
hi = A[-1] * F[0]
while lo < hi:
    mid = (lo+hi)//2
    if K - f(mid, A, F) < 0:
        lo = mid+1
    else:
        hi = mid
print(lo)
### BUGGY CODE ###

N = int(input())
P = [int(i) for i in input().split()]

t = 0
for i in range(N):
    s = 0
    for j in range(i):
        if P[i] > P[j]:
            s += 1
            break
    if s == 0:
        t += 1

print(t)

### FIXED CODE ###

N = int(input())
P = [int(i) for i in input().split()]

p = N
ans = 0
for i in range(N):
    if p >= P[i]:
        ans += 1
        p = P[i]

print(ans)