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

import sys
input = sys.stdin.readline

from collections import deque

sys.setrecursionlimit(10000000)

N,M=map(int,input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
to = [[] for _ in range(N+1)]
def dfs(v, p):
    count=1
    for u in to[v]:
        if u == p or done[u] == 1: continue
        done[u] = 1
        #print(v,u)
        count += dfs(u, v)
    return count

ans=0
sum = N*(N-1)/2
ans_list=[]
ans_list.append(sum)
for i in reversed(range(1,M)):
    done = [0]*(N+1)
    done[AB[i][0]] = 1
    v1 = dfs(AB[i][0], -1)
    if done[AB[i][1]] == 1:
        v2 = 0
    else:
        done[AB[i][1]] = 1
        v2 = dfs(AB[i][1], -1)
    to[AB[i][0]].append(AB[i][1])
    to[AB[i][1]].append(AB[i][0])
    ans+=v1*v2
    ans_list.append(sum-ans)
    
for i in reversed(range(M)):
    print(int(ans_list[i]))

### FIXED CODE ###

import sys
input = sys.stdin.readline


class UnionFind:
    def __init__(self, N):
        self.Parent = [-1]*(N+1)
    #Aの親を探す。このときParent[A]は親の値からグループサイズに変わる。探索の最適化
    def root(self, A):
        if self.Parent[A] < 0: return A
        self.Parent[A] = self.root(self.Parent[A])
        return self.Parent[A]
    #Aが属しているグループのサイズを求める
    def size(self, A):
        return -self.Parent[self.root(A)]
    
    def connect(self,A,B):
        A = self.root(A)
        B = self.root(B)
        if A == B: return False
        
        if self.size(A) < self.size(B): A,B = B,A
        self.Parent[A] += self.Parent[B]
        self.Parent[B] = A
        return True



N,M = map(int,input().split())
AB = [list(map(int, input().split())) for _ in range(M)]
Uni = UnionFind(N)
ans = [-1]*(M)
ans[M-1] = N*(N-1)//2 
for i in reversed(range(1,M)):
    ans[i-1] = ans[i]
    if Uni.root(AB[i][0]) != Uni.root(AB[i][1]):
        ans[i-1] -= Uni.size(AB[i][0])*Uni.size(AB[i][1])
    Uni.connect(AB[i][0], AB[i][1])
for i in range(M):
    print(ans[i])
### BUGGY CODE ###

n,m = map(int,input().split())
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = []
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr or n in arr:
        a.append(arr)
l = [i[0] for i in a if i[1]==n]
if len(l)==0:
    print("IMPOSSIBLE")
    exit()
for i in l:
    if [1,i] in a:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

### FIXED CODE ###

n,m = map(int,input().split())
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = set()
b = set()
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr:a.add(arr[1])
    if n in arr:b.add(arr[0])
if len(a&b)==0:print("IMPOSSIBLE")
else:print("POSSIBLE")
### BUGGY CODE ###

N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
pat = [0]*(N+1)
for i in range(N+1):
  if i == 0:
    pat[i] = 1
  else:
    before1 = pat[i-1] if i-1 not in a else 0
    before2 = pat[i-2] if i-2 not in a else 0
    pat[i] = before1 + before2
print(pat[-1]%1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
pat = [0]*(N+1)
for i in range(N+1):
  if i == 0:
    pat[i] = 1
  else:
    element = a[0] if len(a) != 0 else -1
    pat[i] = pat[i-1] + pat[i-2] if i != element  else 0
    if i == element:
      a.pop(0)
print(pat[-1]%1000000007)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
m=1
maxx=10**18
flag=0
for i in range(n):
    m*=l[i]
    if m==0:
        print(0)
        flag=1
        break
if flag!=1:
    if m>maxx:
        print(-1)
    else:
        print(m)


### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
m=1
maxx=10**18
flag=0
for i in range(n):
   if l[i]==0:
       print(0)
       flag=1
       break
if flag!=1:
    flag=0
    for i in range(n):
        m*=l[i]
        if m>maxx:
            print(-1)
            flag=1
            break

    if flag!=1:
        print(m)
### BUGGY CODE ###

# input
N = int(input())
S = list(input())

# initialization
ans = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            if not S[i]==S[j] and not S[i]==S[k] and not S[k]==S[j] and not j-i==k-j:
                ans += 1

# output
print(ans)


### FIXED CODE ###

# Problem D - RGB Triplets

# input
N = int(input())
S = list(input())

# initialization
r_count = 0
g_count = 0
b_count = 0
exception_count = 0

# a, b, c count
for i in range(N):
    if S[i]=='R':
        r_count += 1
    elif S[i]=='G':
        g_count += 1
    elif S[i]=='B':
        b_count += 1
ans_1 = r_count * g_count * b_count

# exception count
for i in range(N-2):
    for j in range(i+1,N-1):
        k = 2 * j - i
        if k>=N:
            continue
        if not S[i]==S[j] and not S[j]==S[k] and not S[i]==S[k]:
            exception_count += 1

# output
ans = ans_1 - exception_count
print(ans)
### BUGGY CODE ###

import numpy as np


def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = [[]] * N
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp] = A[pp] + [ss]
        A[ss] = A[ss] + [pp]

    ans = 0
    H = np.array(H)
    for j in range(N):
        now = H[j]
        if not A[j]:
            ans += 1
            continue

        if (now > np.max(H[A[j]])):
            ans += 1

    print(ans)


resolve()

### FIXED CODE ###

def resolve():
    n, m = map(int, input().split())
    hhh = list(map(int, input().split()))
    nice = [1] * n

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        ha = hhh[a]
        hb = hhh[b]
        if ha <= hb:
            nice[a] = False
        if ha >= hb:
            nice[b] = False

    print(sum(nice))


resolve()
### BUGGY CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n == 2:
        print(a[0], a[1])
    for i in range(n):
        if max(a) // 2 - i in a:
            print(max(a), max(a) // 2 - i)
            exit()
        if max(a) // 2 - i + 1 in a:
            print(max(a), max(a) // 2 - i + 1)
            exit()


main()


### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    if n == 2:
        print(max(a), min(a))
    else:
        ma = max(a)
        sa = sorted([(i, abs(ma // 2 - a[i]))
                     for i in range(n)], key=lambda x: x[1])
        print(ma, a[sa[0][0]])


main()
### BUGGY CODE ###

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

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


for i in range(M):
    j = A.index(max(A))
    A[j] //= 2

print(sum(A))

### FIXED CODE ###

import heapq
import math

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

A = list(map(lambda x: -x, map(int, input().split())))
heapq.heapify(A)

for i in range(M):
    tmp = heapq.heappop(A)
    tmp = math.ceil(tmp / 2)
    heapq.heappush(A, tmp)

print(-sum(A))
### BUGGY CODE ###

n = int(input())
ans = 1
v = []
v = [int(x) for x in input().split()]
for x in v:
	ans = ans*x
if ans > 1e18:
	print(-1)
else :
	print(ans)

### FIXED CODE ###

n = int(input())
ans = 1
v = []
v = [int(x) for x in input().split()]
v.sort()
for x in v:
	ans = ans*x
	if ans > 1e18:
		break
if ans > 1e18:
	print(-1)
else :
	print(ans)
### BUGGY CODE ###


a=int(input())
x=1
for i in range(1,a+1):
    x=x*i

print(x%(10**9+7))


### FIXED CODE ###

X=10**9+7

def A(c,d):
    return c*d%X

a=int(input())
x=1
for i in range(1,a+1):
    x = A(x,i)

print(x)
### BUGGY CODE ###

S=input()
S=S+'0'
length=len(S)

count={}

for i in range(length):
    count[int(S[i:])%2019]=count.get(int(S[i:])%2019,0)+1

retval=0
for key in count:
    retval+=count[key]*(count[key]-1)//2

print(retval)


### FIXED CODE ###

from functools import lru_cache



S=input()
count=[0 for i in range(2019)]
length=len(S)
#S=int(S)
S=S+'0'
S=S[::-1]
_S=0

base=1
for i,s in enumerate(S):
    _S=base*int(s)+_S
    count[_S%2019]+=1
    base*=10
    base=base%2019
    _S=_S%2019



retval=0
for key in range(2019):
    retval+=count[key]*(count[key]-1)//2


print(retval)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
 
a.sort()
b=list(set(a))
c=0
for i in range(len(b)):
    er = a.count( b[i] ) - b[i]
    if er<0:
        er = a.count( b[i] )
    if er>0:
        c+=er
print(c)

### FIXED CODE ###

from collections import Counter

n=int(input())
a=list(map(int,input().split()))
counter=Counter(a)
b=list(set(a))
c=0
for i in b:
    k =  counter[i]
    c+= k-i if k-i>=0 else k
print(c)
### BUGGY CODE ###

n,p=map(int,input().split())
ans=1
if(n==1):
    print(p)
    exit()
for i in range(int(pow(p,1/n)+1),0,-1):
    if(p%(i**n)==0):
        ans=i
        break
print(ans)        



### FIXED CODE ###

n,p=map(int,input().split())
root=round(p**(1/n))
for i in range(root,0,-1):
        if(p%(i**n)==0):
                print(i)
                break
### BUGGY CODE ###

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

c = [[] for i in range(a)]
z = []
for _ in range(b):
  f,g = map(int,input().split())
  c[f - 1].append(g)
  z.append([f,g])
d = c.copy()


for i in range(a):
    if c[i] != []:
        c[i].sort()

#print(z)
h = []
x =''
y = ''
for j in range(b):                    
    x = str(z[j][0])
    while len(x) <= 5:
        x = '0' + x
    y = str(c[z[j][0] - 1].index(z[j][1]) + 1)
    while len(y) <= 5:
        y = '0' + y
    print(x + y)

### FIXED CODE ###

import bisect
a,b = map(int,input().split())

c = [[] for i in range(a)]
z = []
for _ in range(b):
  f,g = map(int,input().split())
  c[f - 1].append(g)
  z.append([f,g])

for i in range(a):
    if c[i] != []:
        c[i].sort()

x =''
y = ''
for j in range(b):                    
    x = str(z[j][0])
    x = '0' * (6 - len(x)) + x
    y = str(bisect.bisect(c[z[j][0] - 1], z[j][1]))
    y = '0' * (6 - len(y)) + y
    print(x + y)
### BUGGY CODE ###

N, X, Y = list(map(int, input().split()))
result = {N-i:0 for i in range(1, N)}

for i in range(1, N):
  for j in range(i + 1, N + 1):
    dis = min([j - i, abs(j - Y) + abs(i - X) + 1, abs(j - X) + abs(i - Y) + 1])
    result[dis] += 1
print("\n".join(list(map(str, result.values()))))

### FIXED CODE ###

N, X, Y = list(map(int, input().split()))
result = {N-i:0 for i in range(1, N)}

for i in range(1, N):
  for j in range(i + 1, N + 1):
    dis = min([j - i, abs(j - Y) + abs(i - X) + 1, abs(j - X) + abs(i - Y) + 1])
    result[dis] += 1
print("\n".join(list(map(str, result.values()))))
### BUGGY CODE ###

import numpy as np
N,K = map(int, input().split())
p = np.array(list(map(int,input().split())))
p = (p+1)/2
ans = 0.0
for i in range(N-K+1):
    buf = sum(p[i:i+K])
    if ans < buf:
        ans = buf
print(ans)


### FIXED CODE ###

import numpy as np
N,K = map(int, input().split())
p = [(int(i)+1)/2 for i in input().split()]
s = [0]*N
s[0] = p[0]
if N==K:
    print(sum(p))
else:
    for i in range(N-1):
        s[i+1] = s[i]+p[i+1]
    ans=max(s[i+K]-s[i] for i in range(N-K))
    print(ans)
### BUGGY CODE ###

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

# A[i]は問題では1から始まるので注意
# A[i], A[j]について、|j-i| == A[j]+A[i]なら極秘情報の取引をする
# この条件を満たすペアの数
# modはとらなくてよいぐらい
# i, jは2*10^5の程度だから全件で10^10の程度, A[i]は10^9の程度
# j > iとして良い。j-iの値を固定して計算はできる。
# いったんこれぐらいで始めてみよう

# だめだった
# 値の範囲で搾ろう。

counter = 0
B = [i+A[i] for i in range(N)]
C = [j-A[j] for j in range(N)]
for i in range(N):
    for j in range(i+1, N):
        if C[j] == B[i]:
            counter += 1
print(counter)


### FIXED CODE ###

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

# 線形で計算できる
# j > iとしてA[j]+A[i] = j-iよりA[i]+i=j-A[j]
# iとjを分離できたのでjを前に進めていって、計算結果を貯めていけばいい
# 

counter = 0
dic = {}
for j in range(N):
    if j-A[j] in dic:
        counter += dic[j - A[j]]
    if j + A[j] in dic:
        dic[j+A[j]] += 1
    else:
        dic[j+A[j]] = 1
print(counter)
### BUGGY CODE ###

N,M = list(map(int,input().split()))
A = [int(i) for i in input().split()]

for i in range(M):
  #print(A)
  idx = A.index(max(A))
  A[idx] = A[idx] // 2

print(sum(A))

### FIXED CODE ###

import heapq

N,M = list(map(int,input().split()))
A_tmp = [int(i) for i in input().split()]

#print(A_tmp)
A = [-i for i in A_tmp]

heapq.heapify(A)
#print(A)

for i in range(M):
  tmp = heapq.heappop(A)
  heapq.heappush(A, -(-tmp // 2))
  #print(A)

print(-sum(A))
### BUGGY CODE ###

N = int(input())
# A[0]
A = [int(input())-1]

count = [-1]*N
n = 0
ans = 1
while A[n] != 2-1:
  
  if A[n]+1 > len(A):
    for _ in range(A[n]+1 - len(A)):
      A.append(int(input()) -1)
    continue
  
  n = A[n]
  if n in count:
    ans = -1
    break
  count[n] = n
  ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
al = []
for i in range(n):
    a = int(input())
    al.append(a)
 
al.insert(0, 0)
ans = -1
push = 1
for i in range(1, n+2):
    light = al[push]
    push = light
    if light == 2:
        ans = i
        break
print(ans)
### BUGGY CODE ###

N = int(input())
X = list(map(int,input().split()))

ans=10**10
for i in range(2*10**5):
  tmp=0
  for x in X:
    tmp += (i - x)**2
  
  if ans>=tmp:
    ans=tmp

print(ans)

### FIXED CODE ###

N = int(input())
X = list(map(int,input().split()))
 
ans=10**10
for i in range(0,101):
  tmp=0
  for x in X:
    tmp += (i - x)**2
  
  if ans>=tmp:
    ans=tmp
 
print(ans)
### BUGGY CODE ###

N, M, Q = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]
pq = [list(map(int, input().split())) for _ in range(Q)]

table = [[0 for _i in range(N+1)] for _j in range(N+1)]
for line in LR:
    table[line[0]][line[1]] += 1
for question in pq:
    p = question[0]
    q = question[1]
    ans = 0
    for i in range(p, q+1):
        ans += sum(table[i][p:q+1])
    print(ans)

### FIXED CODE ###

N, M, Q = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]
pq = [list(map(int, input().split())) for _ in range(Q)]

table = [[0 for _i in range(N+1)] for _j in range(N+1)]
accum = [[0 for _i in range(N+1)] for _j in range(N+1)]
accum2 = [[0 for _i in range(N+1)] for _j in range(N+1)]

for line in LR:
    table[line[0]][line[1]] += 1
# よこ
for i in range(1, N+1):
    for j in range(1, N+1):
        accum[i][j] = accum[i][j-1] + table[i][j]
# 縦
for i in range(1, N+1):
    for j in range(1, N+1):
        accum2[i][j] = accum2[i-1][j] + accum[i][j]

# for i in range(1, N+1):
#     for j in range(i, N+1):
#         ans[i][j] = sum([accum[k][j] - accum[k][i-1] for k in range(i, j+1)])

for question in pq:
    p = question[0]
    q = question[1]
    print(accum2[q][q] - accum2[p-1][q] - accum2[q][p-1] + accum2[p-1][p-1])
### BUGGY CODE ###

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

### FIXED CODE ###

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

n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[999999999999]*n;dp[0]=0
for i in range(1,n):
  for j in range(1,min(k+1,i+1)):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
print(dp[-1])

### FIXED CODE ###

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  kk=max(i-k,0)
  dp[i]=min(d+abs(hh-h[i])for d,hh in zip(dp[kk:i],h[kk:i]))
print(dp[n-1])
### BUGGY CODE ###

N = int(input())
S = input()

C =[[],[],[]]
for i in range(N):
    if S[i] == 'R':
        C[0].append(i)
    elif S[i] == 'G':
        C[1].append(i)
    else:
        C[2].append(i)

count = 0
for i in C[0]:
    for j in C[1]:
        for k in C[2]:
            ls = [i,j,k]
            ls.sort()
            if ls[1]-ls[0] != ls[2]-ls[1]:
                count += 1

print(count)



### FIXED CODE ###

N = int(input())
S = input()
from collections import deque
C =[deque([]),deque([]),deque([])]
for i in range(N):
    if S[i] == 'R':
        C[0].append(i)
    elif S[i] == 'G':
        C[1].append(i)
    else:
        C[2].append(i)

count = len(C[0])*len(C[1])*len(C[2])

for i in C[0]:
    for j in C[1]:
        if max(i,j) + abs(j-i)<N and S[max(i,j) + abs(j-i)] == "B":
            count -= 1
        if min(i,j) - abs(j-i)>=0 and S[min(i,j) - abs(j-i)] == "B":
            count -= 1
        if (i + j)%2 == 0 and S[(i + j)//2] == "B":
            count -= 1


print(count)
### BUGGY CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
 
e = []
 
for i in range(len(p)):
	e.append((1 + p[i]) / 2)

tmp = 0
l = 0
 
while True:
  res = 0
  j = 0
  for j in range(k):
    res = res + e[l + j]
  if tmp < res:
    tmp = res
  l = l + 1
  if l + k > len(e):
    break

print(tmp)

### FIXED CODE ###

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

sum_acc = [0]
tmp = 0
 
for i in range(n):
  tmp += (1 + p[i]) / 2
  sum_acc.append(tmp)

ans = 0
for j in range(k, n + 1): 
  ans = max(sum_acc[j] - sum_acc[j - k], ans)

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

import sys
N = int(input())
A = list(map(int, input().split()))
A_max = max(A)
if A_max == 1:
    print("pairwise coprime")
    sys.exit()
dp = [0]*(A_max+10)
p = 0
s = 0
for i in range(2, A_max+1):
    c = 0
    if dp[i] == 0:
        dp[i] = 1
        for j in range(i, A_max+1, 2):
            if j % i == 0:
                dp[j] = 1
        for j in range(N):
            if A[j] % i == 0:
                c += 1
        if c >= 2:
            p = 1
        if c == N:
            s = 1
if p == 0:
    print("pairwise coprime")
elif s == 0:
    print("setwise coprime")
else:
    print("not coprime")

### FIXED CODE ###

import sys
N = int(input())
A = list(map(int, input().split()))
A_max = max(A)
if A_max == 1:
    print("pairwise coprime")
    sys.exit()
dp = [0]*(A_max+10)
K = [0]*(A_max+10)
p = 0
s = 0
for i in range(N):
    K[A[i]] += 1
for i in range(2, A_max+1):
    c = 0
    if dp[i] == 0:
        dp[i] = 1
        for j in range(i, A_max+1, i):
            dp[j] = 1
            c += K[j]
        if c >= 2:
            p = 1
        if c == N:
            s = 1
if p == 0:
    print("pairwise coprime")
elif s == 0:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

S=input()
T=input()
n=len(S)
m=len(T)
dp=[['']*(m+1) for i in range(n+1)]
for i in range(1,n+1):
  for j in range(1,m+1):
    if S[i-1]==T[j-1]:
      dp[i][j]=dp[i-1][j-1]+S[i-1]
    else:
      if len(dp[i][j-1])>=len(dp[i-1][j]):
        dp[i][j]=dp[i][j-1]
      else:
        dp[i][j]=dp[i-1][j]
print(dp[n][m])

### FIXED CODE ###

S=input()
T=input()
n=len(S)
m=len(T)
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n):
  for j in range(m):
    dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j],dp[i][j]+(S[i]==T[j]))
ans=''
while n>0 and m>0:
  if dp[n][m]==dp[n-1][m]:
    n-=1
  elif dp[n][m]==dp[n][m-1]:
    m-=1
  else:
    n-=1
    m-=1
    ans=S[n]+ans
print(ans)
### BUGGY CODE ###

n ,k = map(int,input().split())
h_list = list(map(int,input().split()))
inf = float("inf")
dp = [inf for i in range(n + 3)]
dp[0] = 0
dp[1] = 0
dp[2] = abs(h_list[1] - h_list[0])
for i in range(3,n + 1):
  list_ = []
  for j in range(min(k,i - 1)):
    hoge = dp[i - j-1] + abs(h_list[i-1] - h_list[i-j-2])
    list_.append(hoge)
  dp[i] = min(list_)
print(dp[n])

### FIXED CODE ###

def DP_2(n,h,k):
  #初期化
  dp = [float("inf")] * n
  dp[0] = 0
  #DP
  for i in range(1,n):
        dp[i] = min([dp[m] + abs(h[m] - h[i]) for m in range(max(0, i - k),  i)])
  return dp[-1]

        
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(DP_2(n,h,k))
### BUGGY CODE ###

s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0]*(m+1) for _ in range(n+1)]
for i in range(n):
  for j in range(m):
    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,j = n,m
ans = ""
while i and j:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    ans += s[i]
print(ans[::-1])

### FIXED CODE ###

s = input()
t = input()
n = len(s)
m = len(t)
dp = [[0]*(m+1) for _ in range(n+1)]
for i in range(n):
  for j in range(m):
    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,j = n,m
ans = ""
while i and j:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    i -= 1
    j -= 1
    ans += s[i]
print(ans[::-1])
### BUGGY CODE ###

N,Q=map(int, input().split())
S=list(input())
A = []
for i in range(Q):
  A.append(list(map(int, input().split())))
for i in range(Q):
  print(("".join(S[A[i][0]-1:A[i][1]])).count("AC"))

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
a=[0]*N
for i in range(N-1):
  a[i+1]=a[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
  l,r=map(int,input().split())
  print(a[r-1]-a[l-1])
### BUGGY CODE ###

N,Q = map(int,input().split())
S = list(input())
ls = [list(map(int,input().split())) for i in range(Q)]
ac = [0]*N
for i in range(1,N):
    if S[i-1] == "A":
        if S[i] == "C":
            ac[i] += 1
ans = 0
for i in range(Q):
    print(sum(ac[ls[i][0]:ls[i][1]]))

### FIXED CODE ###

N,Q = map(int,input().split())
S = input()
ac = [0]*(N+1)
for i in range(N):
    ac[i+1] = ac[i] + (1 if S[i:i+2] == "AC" else 0)
for i in range(Q):
    l,r = map(int,input().split())
    print(ac[r-1]-ac[l-1])
### BUGGY CODE ###

s = input().strip()
K = int(input())
C = {}
for i in range(len(s)):
    if s[i] not in C:
        C[s[i]] = []
    C[s[i]].append(i)
if len(C)==1:
    a = s[0]
    print(a*K)
else:
    A = []
    for a in C:
        for i in C[a]:
            for j in range(i+1,len(s)+1):
                A.append(s[i:j])
    A = sorted(list(set(A)))
    print(A[K-1])

### FIXED CODE ###

S = input().strip()
N = len(S)
K = int(input())
A = []
for k in range(1,min(6,N+1)):
    for i in range(N-k+1):
        x = S[i:i+k]
        if x not in A:
            A.append(x)
A = sorted(A)
print(A[K-1])
### BUGGY CODE ###

characteristic=10**9+7
def plus(input1,input2):
    return (input1+input2)%characteristic
def minus(input1,input2):
    return (input1-input2)%characteristic
def times(input1,input2):
    return (input1*input2)%characteristic
def exponen(input1,input2):
    binaryl=list(str(bin(input2))[2:])
    binarysize=len(binaryl)
    binarylist=[int(binaryl[binarysize-1-i]) for i in range(binarysize)]
    modlist=[0 for i in range(binarysize)]
    modlist[0]=input1
    for i in range(1,binarysize):
        modlist[i]=times(modlist[i-1],modlist[i-1])
    answer=1
    for i in range(binarysize):
        if binarylist[i]==1:
            answer=times(answer,modlist[i])
    return answer
def divide(input1,input2):
    return times(input1,exponen(input2,characteristic-2))
N=int(input())
Fact=[1 for i in range(N+1)]
Finv=[1 for i in range(N+1)]
for i in range(1,N+1):
    Fact[i]=times(Fact[i-1],i)
    Finv[i]=divide(1,Fact[i])
ans=0
SGL=[0 for i in range(N)]
for K in range(N):
    if 2*K-N<0:
        continue
    SGL[K]=times(times(Fact[K],Finv[2*K-N]),Fact[K-1])
for K in range(1,N):
    ans=plus(ans,times(SGL[K]-SGL[K-1],K))
print(ans)


### FIXED CODE ###

P=10**9+7
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
def inv(x):
    return egcd(x,P)[0]
N=int(input())
Fact=[0 for i in range(N+1)]
Finv=[0 for i in range(N+1)]
Fact[0]=1
Finv[0]=1
for i in range(N):
    Fact[i+1]=((i+1)*Fact[i])%P
    Finv[i+1]=(Finv[i]*inv(i+1))%P
SGN=[0 for i in range(N)]
ans=0
for k in range(N):
    if 2*k-N>=0:
        SGN[k]=(((Fact[k-1]*Fact[k])%P)*Finv[2*k-N])%P
        ans=(ans+k*(SGN[k]-SGN[k-1]))%P
print(ans)
### BUGGY CODE ###

N = int(input())
li = list(map(int,input().split()))
ans = []
for i in range(N):
  for j in range(N):
    if li[j] == i+1:
      print(j+1,end=' ')

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())
li = list(map(int,input().split()))
ans = [0] * N
for i in range(N):
    ans[li[i]-1] = i+1
for j in range(N):
    print(ans[j],end = ' ')