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

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def sosuserch(n):
        sosu = [2]
        for i in range(3, int(n ** (1 / 2)) + 1):
            flg = True
            for s in sosu:
                if i % s == 0:
                    flg = False
                    break
            if flg:
                sosu.append(i)

        return sosu

    a, b = ns()

    sosu_set = set(sosuserch(max(a, b)))


    def make_divisors(a, b):
        divisors = []
        for i in range(1, min(a, b) + 1):
            if a % i == 0 and b % i == 0:
                if i in sosu_set:
                    divisors.append(i)

        # divisors.sort()
        return divisors

    gcd = make_divisors(a, b)

    print(len(gcd)+1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    a, b = ns()

    g = fractions.gcd(a, b)

    def search(n):
        i = 2
        so = []
        while not(n == 1 or i * i > n):
            while n % i == 0:
                n //= i
                so.append(i)
            i += 1
        if n != 1:
            so.append(n)

        return so

    ans = set(search(g))
    print(len(ans) + 1)


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

INF = 10 ** 9
N, K = map(int, input().split())
h = [int(x) for x in input().split()]

dp = [INF] * N
dp[0] = 0

for i in range(N - 1):
    for j in range(1, K + 1):
        if i + j < N:
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))

print(dp[N - 1])


### FIXED CODE ###

INF = 10 ** 9
N, K = map(int, input().split())
h = [int(x) for x in input().split()]

dp = [INF] * N
dp[0] = 0

for i in range(N - 1):
    for j in range(1, K + 1):
        if i + j < N:
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))

print(dp[N - 1])
### BUGGY CODE ###

n,a,b,c,d = map(int,input().split())
S = input()

ans = 0
def aaa(s,g):
    global ans
    if S[s:g].count("##") == 0:
        ans += 1
    
def bbb(s,g):
    global ans
    if S[s:g].count("##") == 0:
        ans += 1
        return(1)
    else:
        return(0)
        
if c < d:
    aaa(b,d)
    aaa(a,c)
else:
    flag = bbb(b,d)
 #   print(ans)
    if flag == 1:
        for i in range(b,d+1):
            if S[i-1:i] != "#":
                k = S[:i-1] + "#" + S[i:]
   #             print(k,i)
                if k[a:c].count("##") == 0:
                    flag = 2
                    break
        if flag == 2:
            aaa(a,c)
#    print(flag)
  #  print(ans)

if ans == 2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n,a,b,c,d = map(int,input().split())
S = input()
 
ans = 0
def aaa(s,g):
    global ans
    if S[s:g].count("##") == 0:
        ans += 1
    
def bbb(s,g):
    global ans
    if S[s:g].count("##") == 0:
        ans += 1
        return(1)
    else:
        return(0)

def ccc(s,g):
    global ans
    if S[s:g].count("##") == 0:
        return(1)
    else:
        return(0)
        
if c < d:
    aaa(b,d)
    aaa(a,c)
else:
    flag = bbb(b,d)
    flag2 = ccc(a,c)
 #   print(ans)
    if flag == 1 and flag2 == 1:
        for i in range(b,d+1):
      #      print(i)
            if S[i-1:i] != "#":
                k = S[i-2:i-1] + "#" + S[i:i+1]
      #          print(k,i)
                if k.count("##") == 0:
                    ans += 1
                    break
#    print(flag)
#    print(ans)
 
if ans == 2:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

h, w = map(int, input().split())
s = [[*map(lambda c:c == ".", input())] for _ in [0] * h]
for i in "LRUD":
    exec(i + "= [[0] * w for _ in [0] * h]")
for i in range(h):
    for j in range(w):
        L[i][j]    = L[i][j-1] + 1 if s[i][j]    else 0
        R[i][-j-1] = R[i][-j]  + 1 if s[i][-j-1] else 0
for j in range(w):
    for i in range(h):
        U[i][j]    = U[i-1][j] + 1 if s[i][j]    else 0
        D[-i-1][j] = D[-i][j]  + 1 if s[-i-1][j] else 0
print(max(L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3 for i in range(h) for j in range(w)))

### FIXED CODE ###

h, w = map(int, input().split())
s = [[*map(lambda c:c == ".", input())] for _ in [0] * h]
for i in "LRUD":
    exec(i + "= [[0] * w for _ in [0] * h]")
for i in range(h):
    for j in range(w):
        L[i][j]    = L[i][j-1] + 1 if s[i][j]    else 0
        R[i][-j-1] = R[i][-j]  + 1 if s[i][-j-1] else 0
for j in range(w):
    for i in range(h):
        U[i][j]    = U[i-1][j] + 1 if s[i][j]    else 0
        D[-i-1][j] = D[-i][j]  + 1 if s[-i-1][j] else 0
print(max(L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3 for i in range(h) for j in range(w)))
### BUGGY CODE ###

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

cnt = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if S == x + y + z:
                cnt += 1

print(cnt)

### FIXED CODE ###

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

cnt = 0
for x in range(K+1):
    for y in range(K+1):
        if 0 <= S - (x + y) <= K:
            cnt += 1

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

import bisect
n=int(input())
p=list(map(int,input().split()))
locate=[0]*(n+1)

for i in range(n):
    locate[p[i]]=i

a=[-1,-1,n,n]
ans=0
for i in range(n,0,-1):
    k=locate[i]
    q=bisect.bisect_left(a,k)
    a.insert(q,k)
    c=(a[q]-a[q-1])*(a[q+2]-a[q+1])+(a[q-1]-a[q-2])*(a[q+1]-a[q])
    ans+=c*i
print(ans)

### FIXED CODE ###

import bisect
n=int(input())
p=list(map(int,input().split()))
idx=[0]*(n+1)

for i,p_i in enumerate(p):
    idx[p_i]=i

right_idx=list(range(1,n+1))+[n,n]
left_idx =list(range(-1,n-1))+[-1,-1]
ans=0
for p in range(1,n+1):
    x=idx[p]
    r1=right_idx[x]
    r2=right_idx[r1]
    l1=left_idx[x]
    l2=left_idx[l1]

    ans+=p*( (x-l1)*(r2-r1) + (l1-l2)*(r1-x)  )
    right_idx[l1]=r1
    left_idx[r1]=l1
print(ans)
### BUGGY CODE ###

import sys
f = sys.stdin

def q(t,i,s,e,func):
    if s == e:
        return t[s][i]
    else:
        return func(q(t,i,s,(s+e)//2,func),q(t,i,(s+e)//2 + 1,e,func))

_, d = map(int, f.readline().split())

b = []
for line in f:
    xi, yi, bi = map(int, line.split())
    b.append((bi,xi,yi))
b = sorted(b)

max_size = i = j = 0
while j < len(b) - 1:
    for k in range(j,-1,-1):
        if b[k][0] + d < b[j][0]:
            break
        i = k
    for k in range(i,len(b)):
        if b[i][0] + d < b[k][0]:
            break
        j = k

    max_size = max(max_size,(q(b,1,i,j,max) - q(b,1,i,j,min)) * (q(b,2,i,j,max) - q(b,2,i,j,min)))
    j+=1
    
print(max_size)

### FIXED CODE ###

import math
def segmentTree(dat, f, sentinel):
        pad = 2 ** math.ceil(math.log(len(dat),2))
        dat = [0] * pad + dat + [sentinel] * (pad - len(dat))
        for i in range(pad - 1, 0, -1):
            dat[i] = f(dat[i * 2],dat[i * 2 + 1])
        return dat

def get_lr(b,d):
    l = r = 0
    while r < len(b):
        while b[l] + d < b[r]:
            l += 1
        for r in range(r,len(b)):
            if b[l] + d < b[r]:
                r -= 1
                break
        r += 1
        yield l,r
        l += 1
    
import sys
f = sys.stdin

_, d = map(int, f.readline().split())

xyb = []
for line in f:
    xyb.append(tuple(map(int, line.split())))
from operator import itemgetter
xyb.sort(key=itemgetter(2))

x = [xybi[0] for xybi in xyb]
y = [xybi[1] for xybi in xyb]
b = [xybi[2] for xybi in xyb]

xmax = segmentTree(x,max,sentinel = 0)
xmin = segmentTree(x,min,sentinel = 2000000)
ymax = segmentTree(y,max,sentinel = 0)
ymin = segmentTree(y,min,sentinel = 2000000)


pad = len(xmax) // 2
max_size = 0
def create_index(l,r):
    index = []
    ia = index.append
    while l < r:
        if r & 1:
            r -= 1
            ia(r)
        if l & 1:
            ia(l)
            l += 1
        l >>= 1
        r >>= 1
    return index

for l,r in get_lr(b,d):
    l += pad 
    r += pad
    index = create_index(l,r)

    now_xmax = max(xmax[i] for i in index)
    now_ymax = max(ymax[i] for i in index)
    if max_size < now_xmax * now_ymax:
        max_size = max(max_size,((now_xmax - min(xmin[i] for i in index)) * (now_ymax - min(ymin[i] for i in index))))
print(max_size)
### BUGGY CODE ###

import sys
import math
sys.setrecursionlimit(200000)
MOD = 10 ** 9 + 7


def main():
    X, Y = map(int, input().split())
    if (X + Y) % 3 != 0:
        print(0)
        exit()
    else:
        m = (2 * X - Y) / 3
        n = (2 * Y - X) / 3
        if m < 0 or n < 0:
            print(0)
            exit()
        else:
            mn = math.factorial(m + n)
            a = math.factorial(m)
            b = math.factorial(n)
            print(mn // (a * b) % MOD)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import math
sys.setrecursionlimit(200000)
MOD = 10 ** 9 + 7


def extgcd(a, b):
    r = [1, 0, a]
    w = [0, 1, b]
    while w[2] != 1:
        q = r[2] // w[2]
        r2 = w
        w2 = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0], w[1]]
# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)


def mod_inv(a,m):
    x = extgcd(a, m)[0]
    return (m + x % m) % m


def main():
    X, Y = map(int, input().split())
    if (X + Y) % 3 != 0:
        print(0)
        exit()
    else:
        m = (2 * X - Y) // 3
        n = (2 * Y - X) // 3
        if m < 0 or n < 0:
            print(0)
            exit()
        else:
            res = 1
            for i in range(1, n + m + 1):
                res = res * i % MOD
            for i in range(1, n + 1):
                res = res * mod_inv(i, MOD) % MOD
            for i in range(1,m + 1):
                res = res * mod_inv(i, MOD) % MOD
            print(res)

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

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

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
dic = {}
ans = []
for i in range(n):
    dic [a[i]-1] = i+1
for i in range(n):
    ans.append(dic[i])
print(" ".join(map(str,ans)))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
total=0
total2=0
count=1
ans=0
for i in range(N):
    total+=A[i]
for i in range(1,N+1):
    total2+=i
while True:
    if total>total2:
        if total//N+total%N>total2:
            count+=(total-total//N+total%N)//N
            total=total//N+total%N
        else:
            break
    elif total<total2:
        if total+total*N<total2:
            count+=total
            total+=total*N
        else:
            break
    else:
        break

if total>total2:
    while True:
        total2 +=N
        count+=1
        if total2>=total:
            if abs(total2-total)<=abs(total2-total-N):
                break
            else:
                count-=1
                break
elif total<total2:
    while True:
        total2 -=N
        count-=1
        if total2<=total:
            if abs(total2-total)<=abs(total2-total-N):
                break
            else:
                count+=1
                break

for i in range(N):
    ans+=abs(A[i]-count)
    count+=1

print(ans)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[]
total=0
for i in range(N):
    B.append(A[i]-i-1)

B.sort()
#print(B)
if len(A)%2==1:
    for i in range(N):
        total+=abs(A[i]-(B[len(B)//2]+i+1))
        #print(B[len(B)//2+1],total)
else:
    for i in range(N):
        total+=abs(A[i]-(B[len(B)//2]+i+1))
print(total)
### BUGGY CODE ###

n = int(input())
s = input()

su = 0
for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            for lis in ['R','G','B']:
                if lis != s[i] and lis != s[j]:
                   su += s[j+1:2*j-i].count(lis) + s[2*j-i+1:].count(lis)

print(su)


### FIXED CODE ###

n = int(input())
s = input()

su = s.count('R') * s.count('G') * s.count('B')
for i in range(n):
    for j in range(i+1,n):
        if s[i] != s[j]:
            for lis in ['R','G','B']:
                if lis != s[i] and lis != s[j]:
                    try:
                        su -= s[2*j-i].count(lis)
                    except:
                        pass

print(su)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().rstrip().rsplit()))

limit = 10**18
ans = 1
for val in A:
    ans *= val

if ans > limit:
    ans = -1
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().rstrip().rsplit()))
A_dict = {}

for val in A:
    A_dict[val] = A_dict.get(val, 0) + 1

limit = 10**18
ans = 1

if A_dict.get(0, 0) > 0:
    ans = 0
else:
    for val in A_dict:
        ans *= val ** A_dict[val]

        if ans > limit:
            ans = -1
            break

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

x = int(input())
for b in range(10000000):
    tmp=x+b**5
    if tmp>=0:
        if tmp**0.2==int(tmp**0.2):
            print(int(tmp**0.2),b)
            exit()
    tmp=x-b**5
    if tmp>=0:
        if tmp**0.2==int(tmp**0.2):
            print(int(tmp**0.2),-b)
            exit()

### FIXED CODE ###

x = int(input())
A=[a**5 for a in range(500)]
for b in range(10000):
    tmp=x+b**5
    if tmp in A:
        print(A.index(tmp),b)
        exit()
    tmp=x-b**5
    if tmp in A:
        print(A.index(tmp),-b)
        exit()
### BUGGY CODE ###

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

mod = 10 ** 9 + 7

cnt = [0] * 60
for i in range(n):
    for j in range(60):
        cnt[j] += a[i] % 2
        a[i] = a[i] // 2

ans = 0
for i in range(60):
    ans = (ans + (2 ** i) * cnt[i] * (n - cnt[i])) % mod

print(ans)


### FIXED CODE ###

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

mod = 10 ** 9 + 7

j_max = 0
cnt = [0] * 60
for i in range(n):
    for j in range(60):
        cnt[j] += a[i] % 2
        a[i] = a[i] // 2
        if a[i] == 0:
            j_max = max(j_max, j)
            break

ans = 0
for i in range(j_max + 1):
    ans = (ans + (2 ** i) * cnt[i] * (n - cnt[i])) % mod

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

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

f = [[] for i in range(n)]

for i in ab:
    if not (i[1]-1) in f[i[0]-1]:
        f[i[0]-1].append(i[1]-1)
    if not (i[0]-1) in f[i[1]-1]:
        f[i[1]-1].append(i[0]-1)
ans = 0
#print(f)
for i in range(n):
    flag = True
    for j in range(len(f[i])):
        #print("比べ,",i,f[i][j], h[i], h[f[i][j]])
        if h[i] <= h[f[i][j]]:
            #print("低い")
            flag = False
            break
    if flag:
        #print("good",i)
        ans += 1

print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

f = [[] for i in range(n)]

for i in ab:
    f[i[0]-1].append(i[1]-1)
    f[i[1]-1].append(i[0]-1)
ans = 0
#print(f)
for i in range(n):
    flag = True
    for j in range(len(f[i])):
        #print("比べ,",i,f[i][j], h[i], h[f[i][j]])
        if h[i] <= h[f[i][j]]:
            #print("低い")
            flag = False
            break
    if flag:
        #print("good",i)
        ans += 1

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

R,C,K=map(int,input().split())
l=[[0] * C for i in range(R)]
for i in range(K):
  a,b,c=map(int,input().split())
  a-=1
  b-=1
  l[a][b]=c
dp=[0]*C
for i in range(R):
  ndp=[0]*C
  kdp=[0]*4
  for j in range(0,C):
    kdp[0]=max(kdp[0],dp[j])
    for k in range(2,-1,-1):
      kdp[k+1]=max(kdp[k+1],kdp[k]+l[i][j])
    ndp[j]=max(kdp)
  dp=ndp
print(dp[C-1])


### FIXED CODE ###

R,C,K=map(int,input().split())
l=[[0] * C for i in range(R)]
for i in range(K):
  a,b,c=map(int,input().split())
  a-=1
  b-=1
  l[a][b]=c
dp=[0]*C
for i in range(R):
  ndp=[0]*C
  kdp=[0]*4
  kdp[0]=dp[0]
  kdp[1]=l[i][0]+dp[0]
  ndp[0]=kdp[1]
  for j in range(1,C):
    kdp[0]=max(kdp[0],dp[j])
    for k in range(2,-1,-1):
      kdp[k+1]=max(kdp[k+1],kdp[k]+l[i][j])
    ndp[j]=max(kdp)
  dp=ndp
print(dp[C-1])
### BUGGY CODE ###

s = input()
t = input()
ls = len(s)
lt = len(t)

dp = [["" for i in range(lt+1)] for j in range(ls+1)]
dp2 = [[0 for i in range(lt+1)] for j in range(ls+1)]


for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + s[i]
            dp2[i+1][j+1] = dp2[i][j] + 1
        else:
            if dp2[i][j+1] > dp2[i+1][j]:
                dp[i+1][j+1] = dp[i][j+1]
                dp2[i+1][j+1] = dp2[i][j+1]
            else:
                dp[i+1][j+1] = dp[i+1][j]
                dp2[i+1][j+1] = dp2[i+1][j]
print(dp[ls][lt])



### FIXED CODE ###

s = input()
t = input()
ls = len(s)
lt = len(t)


dp = [[0 for i in range(lt+1)] for j in range(ls+1)]
answer = ''

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])


i = ls-1
j = lt-1
while (0 <= i) & (0 <= j):
    if s[i] == t[j]:
        answer += s[i]
        i -= 1
        j -= 1
    elif dp[i+1][j+1] == dp[i+1][j]:
        j -= 1
    else:
        i -= 1
if len(answer) == 0:
  print('')
else:
  print(answer[::-1])
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



def main():
    H, W = map(int, readline().split())
    g = []
    for _ in range(H):
        s = readline().rstrip().decode()
        g.append(s)

    def rowBeam(si, sj):
        cnt1 = 0
        cnt2 = 0
        for dj in range(W):
            x = sj+dj
            if x>=W:
                break
            if g[si][x] == '#':
                break
            cnt1 += 1
        for dj in range(W):
            x = sj-dj
            if x<0:
                break
            if g[si][x] == '#':
                break
            cnt2 += 1
        return cnt1+cnt2-1


    def clumnBeam(si, sj):
        cnt1 = 0
        cnt2 = 0
        for di in range(H):
            x = si+di
            if x>=H:
                break
            if g[x][sj] == '#':
                break
            cnt1 += 1
        for di in range(H):
            x = si-di
            if x<0:
                break
            if g[x][sj] == '#':
                break
            cnt2 += 1
        return cnt1+cnt2-1

    ans = 0
    for si in range(H):
        for sj in range(W):
            if g[si][sj] == '#':
                continue
            tmp = rowBeam(si, sj) + clumnBeam(si, sj)
            ans = max(ans, tmp)
    print(ans-1)
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np 
import itertools as it
def main():
    H, W = map(int, readline().split())
    G = np.zeros((H+2, W+2), np.int16)
    G[1:-1, 1:] = (np.frombuffer(read(H*(W+1)), dtype='B') == ord('.')).reshape((H, W+1))
    def solve(G):
        left = np.zeros(G.shape, np.int16)
        for i in range(G.shape[0]):
            left[i, ] = np.arange(G.shape[1])
        left[G>0] = 0
        np.maximum.accumulate(left, out=left, axis=1)

        rG = G[..., ::-1]
        right = np.zeros(G.shape, np.int16)
        for i in range(G.shape[0]): 
            right[i, ] = np.arange(G.shape[1])
        right[rG>0] = 0
        np.maximum.accumulate(right, out=right, axis=1)

        right = G.shape[1] - right[..., ::-1]-1
        scoreres = (right-left-1) 
        scoreres[G==0] = 0
        return scoreres

    print((solve(G)+solve(G.T).T-1).max())
if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import deque
n,m=map(int,input().split())
s=set()
edge=[[] for _ in range(n)]
for _ in range(n+m-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    edge[a].append(b)
    s.add(b)
for i in range(n):
    if i not in s:
        root=i
        break
def bfs(root):
    q=deque([root])
    visited=[[0,0] for _ in range(n)]
    visited[root]=[0,-1]
    while q:
        p=q.popleft()
        dp,pp=visited[p]
        for c in edge[p]:
            dc,cp=visited[c]
            if dc<dp+1:
                visited[c]=[dp+1,p]
                q.append(c)
    return visited
visited=bfs(root)
#print(visited)
for d,i in visited:
    print(i+1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline
n,m=map(int,input().split())
s=set()
edge=[[] for _ in range(n)]
edgerev=[[] for _ in range(n)]
for _ in range(n+m-1):
    a,b=map(int,input().split())
    a-=1
    b-=1
    edge[a].append(b)
    edgerev[b].append(a)
    s.add(b)
for i in range(n):
    if i not in s:
        root=i
        break
visited=[False]*n
to=[] #topological order
def dfs(root):
    if visited[root]:
        return
    visited[root]=True
    for i in edge[root]:
        dfs(i)
    to.append(root)
dfs(root)
to=to[::-1]
#print(to)
result=[0]*n
for i in range(n):
    result[to[i]]=i #頂点の順番
#print(result)
#print(edgerev)
for i in range(n):
    if not edgerev[i]:
        print(0)
        continue
    order=-1
    for j in edgerev[i]:
        if order<result[j]:
            ans=j
            order=result[j]
    print(ans+1)
### BUGGY CODE ###

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

minimum = max(A,B)

for i in range(minimum, A*B+1):
  if i % A == 0 and i % B == 0:
    print(i)
    break


### FIXED CODE ###

import math

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

def lcm(x,y):
  return (x*y)//math.gcd(x,y)

print(lcm(A,B))
### BUGGY CODE ###

N = int(input())
H = [int(i) for i in input().split()]
move_old = 0
for i in range(0,len(H)):
    move_new = 0
    for j in range(i+1, len(H)):
        # print(i+j)
        if H[i] >= H[j]:
            move_new += 1
        else:
            break
        i = i + 1
    if move_old < move_new:
        move_old = move_new

print(move_old)

### FIXED CODE ###

N = int(input())
H = [int(i) for i in input().split()]
ans = 0
tmp = 0
for i in range(0, N-1):
    if H[i] >= H[i+1]:
        tmp += 1
    else:
        tmp = 0
    ans = max(ans, tmp)
print(ans)
### BUGGY CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = []
    for i in range(1, n+1):
        ans.append(a.index(i)+1)
    print(*ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [0] * n
    for i in range(n):
        ans[a[i]-1] = i + 1
    print(*ans)

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

n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
b=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if a[k]>=a[i]+a[j]:
        continue
      b=b+1
print(b)

### FIXED CODE ###

import bisect
n=int(input())
l=list(map(int,input().split()))
l=sorted(l)
a=0
for i in range(n-2):
  for j in range(i+1,n-1):
    a=a+bisect.bisect_left(l,l[i]+l[j])-j-1
print(a)