Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
G = [[] for i in range(n)]
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1; b-=1
  G[a].append(b)
  G[b].append(a)
ans = [0] * n
color = [[],[]]
def coloring(node,pre,oddeven):
  color[oddeven%2].append(node)
  for vi in G[node]:
    if vi != pre:
      coloring(vi,node,oddeven+1)
  return

coloring(0,-1,0)
A = n//3 + int(bool(n%3))
B = n//3 + int(n%3 == 2)
# この時点ではA>=Bである
if color[0] < color[1]:
  A,B = B,A
a=b=0; c=1
for i,ci in enumerate(color[0]):
  if i < A:
    ans[ci] = 3 * i + 1
  else:
    ans[ci] = 3 * c
    c += 1

for i,ci in enumerate(color[1]):
  if i < B:
    ans[ci] = 3 * i + 2
  else:
    ans[ci] = 3 * c
    c += 1
print(*ans)




### FIXED CODE ###

#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
sys.setrecursionlimit(10**7)

n = int(input())
G = [[] for i in range(n)]
for _ in range(n-1):
  a,b = map(int,input().split())
  a -= 1; b-=1
  G[a].append(b)
  G[b].append(a)
ans = [0] * n
color = [[],[]]
def coloring(node,pre,oddeven):
  color[oddeven%2].append(node)
  for vi in G[node]:
    if vi != pre:
      coloring(vi,node,oddeven+1)
  return

coloring(0,-1,0)
A = n//3 + int(bool(n%3))
B = n//3 + int(n%3 == 2)
C = n//3
# この時点ではA>=Bである
# if len(color[0]) < len(color[1]):
#   A,B = B,A
a=b=0; c=1
if len(color[0]) > C and len(color[1]) > C:
  for i,ci in enumerate(color[0]):
    if i < A:
      ans[ci] = 3 * i + 1
    else:
      ans[ci] = 3 * c
      c += 1

  for i,ci in enumerate(color[1]):
    if i < B:
      ans[ci] = 3 * i + 2
    else:
      ans[ci] = 3 * c
      c += 1

elif len(color[0]) <= C:
  # elseが読まれるとき必ずlen(color[0]) < A
  # Bは条件を満たすはず
  for i ,ci in enumerate(color[0]):
    ans[ci] = 3 * c
    c += 1
  for i ,ci in enumerate(color[1]):
    if a < A:
      ans[ci] = 3 * a + 1
      a += 1
    elif b < B:
      ans[ci] = 3 * b + 2
      b += 1
    else:
      ans[ci] = 3 * c
      c += 1

else:
  # elseが読まれるとき必ずlen(color[0]) < A
  # そんなことなかったwwww
  for i ,ci in enumerate(color[1]):
    ans[ci] = 3 * c
    c += 1
  for i ,ci in enumerate(color[0]):
    if a < A:
      ans[ci] = 3 * a + 1
      a += 1
    elif b < B:
      ans[ci] = 3 * b + 2
      b += 1
    else:
      ans[ci] = 3 * c
      c += 1

print(*ans)
a = input()
s = 0
for i in (l,len(a):
  if a[i-1] ==a[i]:
          s+=1
if s>=3:
          print("Yes")
else:print("No")

### FIXED CODE ###

a=list(input())
print('Yes' if((a[0]==a[1]==a[2]) or(a[1]==a[2]==a[3])) else 'No')
n = int(input())
min = n+1
kaisu = int(n-1)
if 
for i in range(kaisu):
    if n%(i+1)==0:
        tmp = i+(n/(i+1))-1
        if min > tmp:
            min = tmp
    if (i+1)**2>n:
        break

print(int(min))

### FIXED CODE ###

n = int(input())
min = n+1
kaisu = int(n-1)

for i in range(kaisu):
    if n%(i+1)==0:
        tmp = i+(n/(i+1))-1
        if min > tmp:
            min = tmp
    if (i+1)**2>n:
        break

print(int(min))
n = input()
s = list(input())

ans = 0

for i in range(len(s)-1):
	if(s[i] == "#" and s[i+1] == "."):
		if(i == 0):
			s[i] = "."
		else if(i > 0 and s[i-1] != "#"):
			s[i] = "."
		else:
			s[i+1] = "#"
		ans += 1

print(ans)


### FIXED CODE ###

n = input()
s = list(input())
 
ans = len(s)

sharp = 0
dot = 0
for string in s:
	if(string == "#"):
		sharp += 1
	else:
		dot += 1 

left_sharp = 0
right_dot = dot

for i in range(len(s)):
	temp_ans = left_sharp + right_dot
	ans = min(ans,temp_ans)
	if(s[i] == "."):
		right_dot -= 1
	else:
		left_sharp += 1

ans = min(ans, len(s) - dot) 

print(ans)
n=int(input())
b=[int(input()) for _ in range(n)]
m=int(input())
r=[int(input()) for _ in range(m)]
l=list(set(b))
a=[]
for s in l:
    a.append(b.count(s) - r.count(b))
print(max(max(a),0))


### FIXED CODE ###

n=int(input())
b=[input() for _ in range(n)]
m=int(input())
r=[input() for _ in range(m)]
l=list(set(b))
a=[]
for s in l:
    a.append(b.count(s) - r.count(s))

print(max(max(a),0))
input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

def consunt():
    if input_.count(input_str_arr[0]) and input_.count(input_str_arr[1]):
      print("Yes")
    else:
      print("No")

input_ = input()

input_str = set(input_)

input_str_arr = [s for s in input_str]

if len(set(input_str_arr))==2:
    consunt()
else:
    print("No")
N = int(input())
import math
l = [int(x) for x in input().split()]
tobi = [0]*(math.ceil(N/2))
tobi[0] = l[0]
for i in range(1,math.ceil(N/2)):
    tobi[i] = tobi[i-1] + l[i*2]
from functools import lru_cache
@lru_cache(maxsize=1000000000)
def motomeru(x,y):
    if y == 0 or x == 0 or x == 1:
        return 0
    elif x % 2 == 0:
        return max(motomeru(x-2,y-1)+l[x-1],tobi[math.floor((x-1)/2)])
    else:
        return max(motomeru(x-2,y-1)+l[x-1],motomeru(x-1,y))
print(motomeru(N,N//2))

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000000000)
N = int(input())
import math
l = [int(x) for x in input().split()]
tobi = [0]*(math.ceil(N/2))
tobi[0] = l[0]
for i in range(1,math.ceil(N/2)):
    tobi[i] = tobi[i-1] + l[i*2]
from functools import lru_cache
@lru_cache(maxsize=1000000000)
def motomeru(x,y):
    if y == 0 or x == 0 or x == 1:
        return 0
    elif x % 2 == 0:
        return max(motomeru(x-2,y-1)+l[x-1],tobi[math.floor((x-1)/2)])
    else:
        return max(motomeru(x-2,y-1)+l[x-1],motomeru(x-1,y))
print(motomeru(N,N//2))
a,b,k = map(int,input().split())
if　k > a+b:
  print(0,0)
elif k > a:
  print(0,a+b-k)
else:
  print(a-k,b)

### FIXED CODE ###

a,b,k = map(int,input().split())
if k > (a+b):
  print(0,0)
elif k > a:
    print(0,a+b-k)
else:
    print(a-k,b)
n=int(input())
x,y=[list(map(int,input().split()))for in range(2)]
d=[abs(s-t)for s,t in zip(x,y)]
f=lambda n:sum([s**n for s in d])**(1/n)
print(f(1),f(2),f(3),max(d),sep='\n')


### FIXED CODE ###

input()
d=[abs(s-t)for s,t in zip(*[list(map(int,input().split()))for _ in'12'])]
f=lambda n:sum(s**n for s in d)**(1/n)
print(f(1),f(2),f(3),max(d),sep='\n')
N, M=map(int, input().split())
items=[int(input()) for i in range(M)]
mod=10**9+7
dp=[0 for i in range(N+1)]
dp[0] = 1
is_broken =[1 for i in range(N+1)]

for i in range(M):
    is_broken[items[i]] = 0

for i in range(N).reverse:
    if is_broken[i]:
        dp[i] = 0
        continue
    dp[i] = (dp[i+1] + dp[i+1]) % mod

print(dp[0])
    

### FIXED CODE ###

N, M=map(int, input().split())
items=[int(input()) for i in range(M)]
mod=10**9+7
dp=[0 for i in range(N+1)]
dp[0] = 1
is_broken =[1 for i in range(N+1)]

for i in range(M):
    is_broken[items[i]] = 0

for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i]*is_broken[i] + dp[i-1]*is_broken[i-1]
    else:
        dp[i+1] = dp[i]*is_broken[i]
    dp[i+1] %= mod

print(dp[N])
d, t, s = int(input())
a = d / s
print('Yes' if a <= t else 'No')


### FIXED CODE ###

d, t, s = map(int, input().split())
a = d / s
print('Yes' if a <= t else 'No')
import sys
stdin = sys.stdin

def main():
    n = int(stdin.readline().rstrip())
    ls = list(map(int, stdin.readline().split()))
    lsm = list(set(ls))
    m = len(lsm)
    ans = 0
    for i in range(n-1):
        for j in range(i+1, n):
            ans = (ans + lsm[i] * lsm[j]) % (10**9 + 7)
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
stdin = sys.stdin

def main():
    n = int(stdin.readline().rstrip())
    ls = list(map(int, stdin.readline().split()))
    ans = 0
    m = 10**9 + 7
    sum1 = sum(ls)%m
    for i in range(n-1):
        sum1 = sum1-ls[i]
        ans = ((sum1 * ls[i])+ans) % m
    print(ans)

if __name__ == '__main__':
    main()
import math
while True:
    line = input().split(" ")
    if(len(line) != 2):
        exit()
    a = int(line[0])
    b = int(line[1])
    print(int(math.log10(a+b))+1)

### FIXED CODE ###

import math
while True:
    try:
        line = input().split(" ")
        print(int(math.log10(int(line[0])+int(line[1])))+1)
    except:
        break
a, b, k = map(int, input().split())

z = list(range(a, b + 1))
ans = sorted(list(set(z[:k]) | set(z[-k:])))
for x in ans:
    print(x)


### FIXED CODE ###

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

for i in range(a, min(a + k, b - k + 1)):
    print(i)
for i in range(max(a, b - k + 1), b + 1):
    print(i)
x,a=map(int, input.split())
print('10' if x>=a else '0')

### FIXED CODE ###

x,a=map(int, input().split())
print('10' if x>=a else '0')
a, b ＝ map(int, input().split())
tower = []
tmp = 0

for i in range(1, 1000):
    tmp += 1
    tower.append(tmp)
    
count = a - b

print(tower[count - 1] - b)

### FIXED CODE ###

a, b = map(int, input().split())
tower = []
tmp = 0

for i in range(1, 1000):
    tmp += i
    tower.append(tmp)
    
count = b - a

print(tower[count - 1] - b)
h = int(input())
w = int(input())
n = int(input())

if n / max(h, w) > n:
    print(n // max(h, w) + 1)
elif n / max(h, w) == 1:
    print(1)
elif n / max(h, w) < 1:
    print(1)
else:
    print(n // max(h, w))

### FIXED CODE ###

import math

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

print( math.floor(t / a) * b )
a, b, c = map(int, input().split())
 if a < b < c:
   print("Yes")
 else:
   print("No")
 

### FIXED CODE ###

a, b, c = map(int, input().split())
if a < b < c:
  print("Yes")
else:
  print("No")
# A - Task Scheduling Problem
*a=map(int,input().split())
print(max(a)- min(a)

### FIXED CODE ###

*a,=map(int,input().split())
print(max(a)-min(a))
N = int(input())
S = []
for _ in range(N):
    x, y = map(int, input().split())
    S.append(x + y)
S.sort()
cost = N
target = 1
# 同じではなくて割り切れるやつを探す
for a in S:
    temp_cost = 1
    bb = -1
    for b in S:
        if bb != b and b % a != 0:
            # print("a:{0}, b:{1}".format(a, b))
            temp_cost += 1
        bb = b
    temp_cost += S.count(a) - 1
    if temp_cost < cost:
        print(temp_cost)
        cost = temp_cost
print(cost)


### FIXED CODE ###

# Picking Up
# グラフ,有向グラフ,ベクトル, ２次元、コスト,

N = int(input())
S = []
for _ in range(N):
    x, y = map(int, input().split())
    S.append([x, y])
cost = N
d = {}

if N==1:
    print(1)
    exit()
for l,le in enumerate(S):
    for m, me in enumerate(S):
        if l == m:
            continue
        t = (me[0] - le[0], me[1] - le[1])
        if t in d:
            d[t] +=1
        else:
            d[t] = 1

print(N - max(d.values()))
import math
from functools import reduce

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

def lcm_list(a):
    return reduce(lcm_base, a)
if __name__ == '__main__':
	N = int(input())
	a = list(map(int, input().split()))
	ans = 0
	num = lcm_list(a) - 1
	print(num)
	for i in range(len(a)):
		ans += num % a[i]
	print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
ans = 0
for x in a:
	ans += x - 1
print(ans)
w,h,x,y = map(int,input().split())
s = w*h/2
if x == w/2 and y == h/2:
  print(s,1)
else:
  print(s,0)


### FIXED CODE ###

x,a = map(int,input().split())
if x >= a:
  print(10)
else:
  print(0)
input_str = row_input

translate_num = int("input_str")**

print("translate_num\n")

### FIXED CODE ###

input_str = input()

translate_num = (int(input_str))**3

print(translate_num)
import numpy as np
n, a = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]

dp= np.zeros((n+1,n*a+1),dtype=int)
dp[0][0]=1
ans=0

f=0
for k in range(1,n+1):
  f+=x[k-1]
  for i in range(k,-1,-1):
    for j in range(0, f + 1):
      if j>=x[k-1] and i>=1:
        dp[i][j]= dp[i][j] + dp[i-1][j-x[k-1]]
      else:
        dp[i][j]= dp[i][j] 
      
for i in range(1,n+1):
  ans+=dp[i][a*i]

print(ans)


### FIXED CODE ###

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

dp=[[0 for i in range(a*n+1)] for j in range(n+1)]
dp[0][0]=1
ans=0
f=0

for k in range(1,n+1):
  kx=x[k-1]
  f+=kx
  for i in range(k,0,-1):
    for j in range(kx,a*n+1):
      dp[i][j] += dp[i-1][j-kx]
      if j > f:
        break
      
for i in range(1,n+1):
  ans+=dp[i][a*i]

print(ans)
N = int(input())
X = str(input())
X10 = int(X,2)

one_num = X.count("1")
xp = X10 % (one_num+1)
xm = X10 % (one_num-1)

for i in range(N):
    target = int(X[i])
    count=0
    if target == 0:
        plus = pow(2,N-i-1,xp)
    else:
        plus = -pow(2,N-i-1,xm)
    if X10+plus == 0:
        print(count)
        continue
    if target == 0:
        ones = one_num+1
        Xnow = (xp + plus)%ones
    else:
        ones = one_num-1
        Xnow = (xm + plus)%ones
    count += 1
    while Xnow > 0:
        Xnow2 = bin(Xnow)
        ones = Xnow2.count("1")
        Xnow = Xnow%ones
        count+=1
    print(count)

### FIXED CODE ###

N = int(input())
x2 = input()
x10 = int(x2, 2)
popc =  x2.count("1")
#print("x10", x10)
#print("popc", popc)
#popc: Nを2進数で表したときの1の個数

#以下で1つフリップさせた時の入力に対する余りを事前に計算
if popc <= 1:
    xp = x10%(popc+1)
    xm = 0
else:
    xp = x10%(popc+1)
    xm = x10%(popc-1)
#print("xp", xp)
#print("xm", xm)

#以下でフリップさせた場所のみを計算
for i in range(N):
    if x2[i] == "1":
        if popc == 1:
            print(0)
            continue
        tmp = (xm - pow(2, N-i-1, popc-1))%(popc-1)
    else:
        tmp = (xp + pow(2, N-i-1, popc+1))%(popc+1)
        
    #print("tmp", tmp)
    ans = 1
    while tmp > 0:
        tmp %= bin(tmp).count("1")
        ans += 1
    print(ans)
w, h, w, y, r = map(int, input().split())

if (x- r) >= 0 and (x + r) <= w:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

w, h, x, y, r = map(int, input().split())

if x + r <= w and y + r >= 0 and x - r >= 0 and y + r <= h:
    print("Yes")
else:
    print("No")
x,a,b=[int(input())for i in range(3)
c=int(x-a)
print(c%b)

### FIXED CODE ###

x,a,b=[int(input()) for i in range(3)]
c=x-a
print(c%b)
from functools import lru_cache

N = int(input().strip())
A = [int(v) for v in input().strip().split()]
C = {}


@lru_cache
def calc(a):
    C[a] -= 1
    sum_ = sum([n * (n - 1) // 2 for n in C.values() if n > 1])
    C[a] += 1
    return sum_

for a in A:
    C.setdefault(a, 0)
    C[a] += 1

for i, a in enumerate(A):
    print(calc(a))


### FIXED CODE ###

from functools import lru_cache

N = int(input().strip())
A = [int(v) for v in input().strip().split()]
C = {}


@lru_cache(maxsize=None)
def pair(k):
    return k * (k - 1) // 2

@lru_cache(maxsize=None)
def calc(s, a):
    return s - pair(C[a]) + pair(C[a] - 1)

for a in A:
    C.setdefault(a, 0)
    C[a] += 1

S = sum([pair(v) for v in C.values()])

for a in A:
    print(calc(S, a))
import sys
sys.setrecursionlimit(300000) #上限上げないと引っかかる
N = int(input())
tree = [[] for _ in range(N)]
for e in sys.stdin.read().rstrip():
    x,y,dist = e.split()
    x = int(x);y=int(y);dist= int(dist)
    x -=1
    y -=1
    if dist%2 == 0:
        tree[x].append(y)
        tree[y].append(x)#偶数の場合のみ処理




color = [-1]*N
#本体
def dfs(G,V,cur):
    color[V] = cur
    for next_V in G[V]:
        if (color[next_V] != -1):
            continue#これ入れないとスタックオーバーフロー　すでに行ったところはもう調べない
        dfs(G,next_V, cur)
    return True

for i in range(N):
    dfs(tree, 0, 0)
for j in range(N):
    print(color[j])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n = int(input())
G = [[] for _ in range(n+1)]
for i in range(n-1):
    v,w,dist = map(int, input().split())
    G[v].append((w,dist))
    G[w].append((v,dist))
color = [-1]*(n+1)


def dfs(a, col):
    tmp = -1
    if color[a] == -1:
        color[a] = col

    for next_V,dis in G[a]:
        if color[next_V] == -1:
            tmp = col
            if dis%2 !=0:
                tmp = 1-col
            dfs(next_V, tmp)
dfs(1,0)
[print(color[i]) for i in range(1,n+1)]
def xor_sum(n):
    m1 = (n+1)//4
    m2 = (n+1)%4
    if m2 == 0:return 0
    else:
        ret = 0
        for i in range(m1*4,m1*4+m2):ret ^= i
        else: return ret

a,b = map(int, input().split())
if a==b:print(a)
else:ans = xor_sum(a-1) ^ xor_sum(b)
print(ans)

### FIXED CODE ###

def xor_sum(n):
    m1 = (n+1)//4
    m2 = (n+1)%4
    if m2 == 0:return 0
    else:
        ret = 0
        for i in range(m1*4,m1*4+m2):ret ^= i
        else: return ret

a,b = map(int, input().split())
if a==b:print(a)
else:
    ans = xor_sum(a-1) ^ xor_sum(b)
    print(ans)
s = input()
s = s.replace('S', ' ').split()
print(max([len(i) for i in s]))

### FIXED CODE ###

s = input()
s = s.split('S')
print(max([len(i) for i in s]))
N=int(input("enter number of people")
A=int(input("enter the cost of train")
B=int(input("enter the cost of taxi")
t1=N*A
if t1<B:
      tmin=t1
      print("minimum total travel expense",tmin)
else:
      tmin=B
      print("minimum total travel expense",tmin)
      


### FIXED CODE ###

n,a,b=map(int,input().split())
if(n*a>=b):
    print(b)
else:
    print(n*a)
n, a, b = map(int,input().split())
count = 0
if 1 <= (n/(a+b)):
    if a < n%(a+b):
        print ((n/(a+b)*a) +a)
    else:
        print (int(n/(a+b)*a) + int(n%(a+b)))
else:
    if a < n%(a+b):
        print (a)
    else:
        print (n%(a+b))

### FIXED CODE ###

status = input()
if 'AB' in status or 'BA' in status:
    print('Yes')
else:
    print('No')
import sys
import itertools
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数
from math import ceil, floor, sqrt, isinf #小数点切り上げ、切り捨て、平方根
from copy import deepcopy #参照で影響されないコピー
from collections import Counter, deque #要素ごとの出現回数、双方向アクセス可能データ型
import heapq
import numpy as np
from functools import reduce
sys.setrecursionlimit(200000)

input = sys.stdin.readline
# template


def main():
    n = int(input())
    abc = [list(map(int, input().split())) for _ in range(n)]

    dp = [ [0, 0, 0] for _ in range(n) ]

    for i in range(n):
        for j in range(3):
            for k in range(3):
                if(j == k):
                     continue
                dp[i][k] = max(dp[i][k], dp[i][j] + abc[i][k])

    ans = 0
    for i in range(3):
        ans = max(ans, dp[n][i])

    print(ans)


if __name__ == "__main__":
    main()



### FIXED CODE ###

import sys
import itertools
from operator import itemgetter #sortedの対象を決めたい
from fractions import gcd #最大公約数
from math import ceil, floor, sqrt, isinf #小数点切り上げ、切り捨て、平方根
from copy import deepcopy #参照で影響されないコピー
from collections import Counter, deque #要素ごとの出現回数、双方向アクセス可能データ型
import heapq
import numpy as np
from functools import reduce
sys.setrecursionlimit(200000)

input = sys.stdin.readline
# template

def retmax(a, b):
    if a > b:
        return a
    else:
        return b

def main():
    n = int(input())
    a = [list(map(int, input().split())) for _ in range(n)]

    dp = np.zeros([3, n+1])

    for i, a_l in enumerate(a):
        for j in range(3):
            for k in range(3):
                if j != k:
                    dp[k, i+1] = retmax(dp[k, i+1], dp[j, i] + a_l[k])

    print(int(np.max(dp[:, n], axis=0)))


if __name__ == "__main__":
    main()
import math

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

a, b, c, d = [int(elem) for elem in input().split()]
print((b+1 - a) - ((b+1) // c) - ((b+1) // d) + (a // c) + (a // d) + ((b+1) // lcm(c, d)) - (a // lcm(c, d)))

### FIXED CODE ###

import fractions

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

a, b, c, d = [int(elem) for elem in input().split()]

res = (b+1 - a) - ((b) // c) - ((b) // d) + ((a-1) // c) + ((a-1) // d) + ((b) // lcm(c, d)) - ((a-1) // lcm(c, d))
print(res)
N=int(input())
A=list(map(int,input().split()))
t=[0]*N
for idx,i in enumerate(N):
    t[i-1]=idx+1
    
    print(t[i],end=' ')

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
t=[0]*N
for idx,i in enumerate(A):
    t[i-1]=idx+1

print(*t)
import heapq

n = int(input())
A = list(map(lambda x: int(x) * (-1), input().split()))

heapq.heapify(A)

while len(A) > 1:
    print(A)
    Amax1 = heapq.heappop(A) * (-1)
    Amax2 = heapq.heappop(A) * (-1)
    pushA = Amax1 % Amax2
    if pushA == 0:
        heapq.heappush(A, Amax2 * (-1))
    else:
        heapq.heappush(A, pushA * (-1))
        heapq.heappush(A, Amax2 * (-1))

print(A[0] * (-1))

### FIXED CODE ###

import heapq

n = int(input())
A = list(map(lambda x: int(x) * (-1), input().split()))

heapq.heapify(A)

while len(A) > 1:
    Amax1 = heapq.heappop(A) * (-1)
    Amax2 = heapq.heappop(A) * (-1)
    pushA = Amax1 % Amax2
    if pushA == 0:
        heapq.heappush(A, Amax2 * (-1))
    else:
        heapq.heappush(A, pushA * (-1))
        heapq.heappush(A, Amax2 * (-1))

print(A[0] * (-1))
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
B = []
j = 0
 
for i in range (0,K+1):
	if B.count(A[j]) > 0:
		Value = B.index(A[j])
		C = B[B.index(A[j])::]
		break
	else:
		B.append(A[j])
		j = A[j]-1

if A[0] ==1:
	print(1)
elif len(B) == K:
	print(B[-1])
else:
	print(C[(K-Value-1)%len(C)])

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
 
B = []
Vector = [0]*N
j = 0
 
for i in range (0,K):
	if Vector[A[j]-1] == 1:
		Value = B.index(A[j])
		C = B[B.index(A[j])::]
		break
	else:
		B.append(A[j])
		Vector[A[j]-1] = 1
		j = A[j]-1

if A[0] ==1:
	print(1)
elif len(B) == K:
	print(B[-1])
else:
	print(C[(K-Value-1)%len(C)])
A,B = map(int,input().split())
tmp=0
cnt=0

while tmp<3:
  if A > B:
    cnt+=A
    A-=1
  elif A < B:
    cnt+=B
    B-=1
  else:
    cnt+=A
   A-=1
print(cnt)
  


### FIXED CODE ###

A,B = map(int,input().split())
tmp=0
cnt=0

while tmp<2:
  if A > B:
    cnt+=A
    A-=1
    tmp+=1
  elif A < B:
    cnt+=B
    B-=1
    tmp+=1
  else:
    cnt+=A
    A-=1
    tmp+=1
print(cnt)
import sys
from copy import deepcopy
sys.setrecursionlimit(10**7)


def dfs(now):
    global ans
    if len(now) == N:
        tmp_ans = 0
        for a, b, c, d in query:
            a -= 1
            b -= 1
            if now[b] - now[a] == c:
                tmp_ans += d
        ans = max(tmp_ans, ans)
    else:
        for i in range(now[-1], M+1):
            tmp = deepcopy(now)
            tmp.append(i)
            dfs(tmp)


N, M, Q = map(int, input().split())  # N個の数列, 上限M, Q個のクエリ
query = [list(map(int, input().split())) for _ in range(Q)]

A = [1]
ans = 0
dfs(A)
print(ans)


### FIXED CODE ###

import math
A, B, N = map(int, input().split())
ans = math.floor(A*min(N, B-1)/B) - A*math.floor(min(N, B-1)/B)
print(ans)
n=int(input())
c=0
for i in range(1,n+1):
    if str(i)%2==1:
        c+=1
print(c)

### FIXED CODE ###

n=int(input())
c=0
for i in range(1,n+1):
    if len(str(i))%2==1:
        c+=1
print(c)
n,k=map(int,input().split())
h=[int(i) for i in input().split()]
inf=pow(10,6)
dp=[inf]*(n)
dp[0]=0
dp[1]=abs(h[0]-h[1])
for i in range(n):
    for j in range(min(k+1):
        if i+j<n:
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])       

### FIXED CODE ###

n,k=map(int,input().split())
a=[int(i) for i in input().split()]
dp=[10**9]*n
dp[0]=0
dp[1]=abs(a[1]-a[0])
for i in range(2,n):
    for j in range(max(0,i-k),i):
        dp[i]=min(dp[j]+abs(a[i]-a[j]),dp[i])
print(dp[-1])
H, W, M = map(int, input().split())
S = [[0]*W for _ in range(H)]
lh = [0]*(H+1)
lw = [0]*(W+1)
l = []
for _ in range(M):
  h, w = map(int, input().split())
  lh[h] += 1
  lw[w] += 1
  l += [[h, w]]

maxh = max(lh)
maxw = max(lw)
cnt = 0

ch = lh.count(maxh)
cw = lw.count(maxw)
for y, x in l:
  if lh[y] == maxh and lw[x] == maxw:
    cnt += 1

ans = maxh+maxw
if cnt == ch*cw:
  ans -= 1

print(ans)    


### FIXED CODE ###

ans=0

h,w,m=map(int,input().split())
d=list()
from collections import defaultdict
r=defaultdict(int)
c=defaultdict(int)
r=[0]*(h+1)
c=[0]*(w+1)
for i in range(m):
  a,b=map(int,input().split())
  d+=(a,b),
  r[a]+=1
  c[b]+=1
R=max(r)
C=max(c)

x=0
nr=r.count(R)
nc=c.count(C)
for i in range(m):
    a,b=d[i]
    if r[a]==R and c[b]==C:
        x+=1

ans=R+C
if x==nr*nc:
    ans-=1
print(ans)