Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split()) #入力
a = list(map(int,input().split())) #使用不可の数字
b = {0,1,2,3,4,5,6,7,8,9}-set(a) #使用可能な数字の集合
n = [int(i) for i in list(str(n))] #価格(int)をリストに分解

while set([int(i) for i in list(str(n))])-b !={} : # 使用可能な数字のみでなければ
    n += 1

print(n)

### FIXED CODE ###

n,k = map(int,input().split()) #入力
a = list(map(int,input().split())) #使用不可の数字
b = {0,1,2,3,4,5,6,7,8,9}-set(a) #使用可能な数字の集合
while set([int(i) for i in list(str(n))])-b !=set() : # 使用可能な数字のみでなければ
    n += 1
print(n)
n=int(input())
v=list(map(int,input().split()))
a=v[0::2]
b=v[1::2]
c=dict()
d=dict()

for i in a:
  if i in c:
    c[i]+=1
  else:
    c[i]=1
for j in b:
  if j in d:
    d[j]+=1
  else:
    d[j]=1

e=sorted([[c,v] for v,c in c.items()],reverse=True)
f=sorted([[c,v] for v,c in d.items()],reverse=True)

if e[0][1]!=f[0][1]:
  print(n-e[0][0]-f[0][0])
elif e[0][0]>f[0][0]:
  print(n-e[0][0]-f[1][0])
else:
  print(n-e[1][0]-f[0][0])

### FIXED CODE ###

from collections import defaultdict
n = int(input())
A = [int(x) for x in input().split()]
even = A[0::2]
odd = A[1::2]
EC = defaultdict(int)
EC[0] = 0
OC = defaultdict(int)
OC[0] = 0
for e in even:
  EC[e] += 1
for o in odd:
  OC[o] += 1
E = sorted([[v, k] for k, v in EC.items()], reverse=True)
O = sorted([[v, k] for k, v in OC.items()], reverse=True)
if E[0][1] != O[0][1]:
  print(n - E[0][0] - O[0][0])
elif E[1][0] >= O[1][0]:
  print(n - E[1][0] - O[0][0])
else:
  print(n - E[0][0] - O[1][0])

#sample code.
s = list(input())
t = list(input())
s_uni = sorted([ord(i) for i in s])
t_uni = sorted([ord(i) for i in t], reverse = True)
for i in range(len(s)):
    if s_uni[i] < t_uni[i]:
        print('Yes')
        exit()
    elif s_uni[i] == t_uni[i]:
        continue
    else:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = list(input())
t = list(input())
s_uni = sorted([ord(i) for i in s])
t_uni = sorted([ord(i) for i in t], reverse = True)
for i in range(min(len(s), len(t))):
    if s_uni[i] < t_uni[i]:
        print('Yes')
        exit()
    elif s_uni[i] == t_uni[i]:
        continue
    else:
        print('No')
        exit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')
N,M = map(int,input().split())
H=list(map(int,input().split()))
ABmap=[[0 for i in range(N)] for i in range(N)]
count=0
for i in range(M):
    A,B=map(lambda x:x-1,map(int,input().split()))
    ABmap[A][B]=H[B]
    ABmap[B][A]=H[A]
        
for i in range(N):
    #print(ABmap[i])
    #print(ABmap.count(H[i]))
    if max(ABmap[i])<H[i]:
        count+=1
print(count)
        
    

### FIXED CODE ###

S=input()
T=""
if S=="ARC":
   T="ABC"
else: T="ARC"
print(T)
A,B = map(int, input.split())
print(A*B)

### FIXED CODE ###

A,B = map(int, input().split())
print(A*B)
while 1:
    n = input()
    if n == 0:
        break
    s = raw_input()
    lock = 0
    P = set()
    for c in s:
        if c is 'u':
            lock = 0
        else:
            P.add((lock, 1 << int(c)))
            lock |= 1 << int(c)
    while 1:
        Q = set()
        for lock1, c1 in P:
            for lock2, c2 in P:
                if lock1 & lock2 == 0 and c1 & lock2 == c1:
                    v = (lock1 | lock2, c2)
                    if v not in P:
                        Q.add(v)
        if not Q:
            break
        P |= Q
    ok = 1
    for lock1, c1 in P:
        for lock2, c2 in P:
            if lock1 & lock2 == 0 and c1 & lock2 == c1 and c2 & lock1 == c2:
                ok = 0
    for lock, c in P:
        if lock & c == c:
            ok = 0
    print "SAFE"*ok or "UNSAFE"

### FIXED CODE ###

while 1:
    n = input()
    if n == 0:
        break
    s = raw_input()
    Q = set()
    lock = 0
    P = []
    for c in s:
        if c is 'u':
            lock = 0
        else:
            v = (lock, 1 << int(c))
            if v not in Q:
                P.append(v)
                Q.add(v)
            lock |= 1 << int(c)
    i = 0; ok = 1
    while i < len(P) and ok:
        lock1, t1 = P[i]
        if lock1 & t1 == t1:
            ok = 0
        for j in xrange(i):
            lock2, t2 = P[j]
            if lock1 & lock2 == 0 and t1 & lock2 == t1:
                if t2 & lock1 == t2:
                    ok = 0
                v = (lock1 | lock2, t2)
                if v not in Q:
                    P.append(v)
                    Q.add(v)
        i += 1
    print "SAFE"*ok or "UNSAFE"
n = int(input())

a = list(map(int, input().split()))
for _, val in enumerate(a):
    ans *= val
if ans > 10**18:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

n = int(input())

a = list(map(int, input().split()))
ans = 1
if 0 in a:
    print(0)
else:
    for num, val in enumerate(a):
        ans *= val
        if ans > 10**18:
            print(-1)
            break 
    else:
        print(ans)
def checkWhichToRead(A, B):
    if len(A) == 0 or A[0] > B[0]:
        return 1
    elif len(B) == 0 or A[0] < B[0]:
        return 0
    else:
        return 2


def searchEqualCase(A, B, K, count):
    if K < 0:
        return count
    ACount = count
    BCount = count
    if len(A) > 0:
        ACount = checkWhichToRead(A[1:], B, K - A[0], count + 1)
    if len(B) > 0:
        BCount = checkWhichToRead(A, B[1:], K - B[0], count + 1)
    if ACount > BCount:
        return ACount
    else:
        return BCount


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

count = 0
while K >= 0:
    case = checkWhichToRead(A, B)
    if case == 0:
        K -= A[0]
        A = A[1:]
    elif case == 1:
        K -= B[0]
        B = B[1:]
    else:
        count = searchEqualCase(A, B, K, count)
        break
    count += 1
    if count == N + M:
        count += 1
        break

print(count - 1)




### FIXED CODE ###

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

totalA = [0]
totalB = [0]
sumA = 0
for i in range(N):
    sumA += A[i]
    totalA.append(sumA)
sumB = 0
for i in range(M):
    sumB += B[i]
    totalB.append(sumB)

iB = M
countMax = 0
for iA in range(N+1):
  if totalA[iA]>K:
    break
  else:
    while totalA[iA] + totalB[iB] > K:
      iB -= 1
  countMax = max(countMax,iA+iB)

print(countMax)
import sys
sys.setrecursionlimit(10000)

N = int(input())
A = list(map(int,input().split()))
error = 0

if N%2 == 1:
      if A.count(0) != 1:
            print(0)
      elif sum(A) != (N+1)*(N-1)/2:
            print(0)
      else:
            print(int((2**((N-1)/2))%(10**9+7)))
      
else:
      if A.count(0) != 0:
            print(0)
      elif sum(A) != N**2/2:
            print(0)
      else:
            print(int((2**(N/2))%(10**9+7)))


### FIXED CODE ###

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

if op == '+':
      result = a + b
else:
      result = a - b
print(result)
N, M = map(int, input().split())
L = []
S = [[] for i in range(M)]
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
  for l in Ls:
    S[l].append(i)
#print(L)
#print(S)
UF = list(range(N+M))
def par(m):
  if UF[m] == m:
    return m
  r = par(UF[m])
  UF[m] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

N, M = map(int, input().split())
L = []
for i in range(N):
  Ls = list(map(int, input().split()))
  Ls.pop(0)
  Ls = [l-1 for l in Ls]
  L.append(Ls)
#print(L)
UF = list(range(N+M))
def par(m):
  s = []
  r = UF[m]
  while r != m:
    s.append(m)
    m = r
    r = UF[m]
  for i in s:
    UF[i] = r
  return r
def unite(m, n):
  i = par(m)
  j = par(n)
  UF[j] = i
for i in range(N):
  Ls = L[i]
  for l in Ls:
    unite(i, N+l)
    unite(N+l, i)
#print(UF)
#for i in range(N+M):
#  p = par(i)
#print(UF)
ok = True
for i in range(1, N):
  if par(i) != par(i-1):
    ok = False
    break
if ok:
  print("YES")
else:
  print("NO")
n = int(input())
aL = sorted(list(set(list(map(int, input().split(" "))))))

dp = [False for _ in range(100001)]

if len(aL) == 1 and n != 1:
    print(0)
    exit()

ans = 0
for a in aL:
    if not dp[a]:
        ans += 1
    c = 1
    while a * c <= 100000:
        dp[a * c] = True
        c += 1

print(ans)

### FIXED CODE ###

n = int(input())
aL = sorted(list(map(int, input().split(" "))))
# aL = sorted(list(set(aLP)))

dp = [False for _ in range(1000001)]

d = {}
for a in aL:
    if a in d:
        d[a] += 1
    else:
        d[a] = 1

ans = 0
for a in aL:
    if dp[a]:
        continue
    if d[a] > 1:
        c = 1
        while a * c <= 1000000:
            dp[a * c] = True
            c += 1
        continue
    ans += 1

    c = 1
    while a * c <= 1000000:
        dp[a * c] = True
        c += 1

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

c = A / K
b = c * K
flag = False

if b == B:
  flag = True
b += K
  if b <= B:
    flag = True

if flag == True:
  print("OK")
else:
  print("NG")


### FIXED CODE ###

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

flag = False

if a <= int(b / k) * k:
  print("OK")
else:
  print("NG")
k,x = map(input().split())
start=max(-1000000,x-k+1)
end=min(1000000,x+k-1)
print(" ".join(range(start,end+1)))


### FIXED CODE ###

k, x = map(int, input().split())
start = max(-1000000, x-k+1)
end = min(1000000, x+k-1)
print(" ".join(map(str, range(start, end+1))))
import collections


def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb


n = int(input())
balls = [tuple(map(int, input().split())) for _ in range(n)]

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        a.append(calc(balls[i], balls[j]))
counts = collections.Counter(a)

print(n-max(counts.values()))


### FIXED CODE ###

import collections


def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb


n = int(input())
balls = [tuple(map(int, input().split())) for _ in range(n)]

if n == 1:
    print(1)
    exit()

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))
l = input()
a = l.split(' ')

tmp = 0
tmp2 = 0

for i in range(n):
    tmp += int(a[i])

for i in range(n):
    tmp2 += int(a[i])*int(a[i])

print((tmp*tmp-tmp2)//2%1000000007)

### FIXED CODE ###

from itertools import accumulate

m = 1000000007

N, *A = map(int, open(0).read().split())

result = 0
b = list(accumulate(A))
for i in range(N):
    result += A[i] * (b[N - 1] - b[i])
    result %= m
print(result)
import math

a=input()
a=a.split()
l1=int(a[0])
l2=int(a[1])
h=int(a[2])
m=int(a[3])

de1=math.radians(360*h/12+0.5*m)
de2=math.radians(360*m/60)

#print(de1,de2)

x1=l1*math.cos(de1)
y1=l1*math.sin(de1)

#print(x1,y1)

x2=l2*math.cos(de2)
y2=l2*math.sin(de2)

#print(x2,y2)

l_2=pow(x1-x2,2)+pow(y1-y2,2)
l=pow(l_2,0.5)

print(l)

### FIXED CODE ###


a = input()

a = list(a)

b = a.pop(-1)

b = int(b)

if b == 2 or b == 4 or b == 5 or b == 7 or b == 9:
	print("hon")

if b ==0 or b==6 or b == 8 or b == 1:
	print("pon")

if b == 3:
	print("bon")
a = input()
b = input()

for i in range(len(b)):
  if a[i] != b[i]:
    print("No")
    break
  if i == len(b) - 1:
    print("Yes")

### FIXED CODE ###

a = input()
b = input()

for i in range(len(a)):
  if a[i] != b[i]:
    print("No")
    break
  if i == len(a) - 1:
    print("Yes")
import math
from functools import reduce

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

print(reduce(math.gcd, A))

### FIXED CODE ###

import fractions

N = int(input())
A = list(map(int, input().split()))
ans = A[0]
for i in range(1, N):
    ans = fractions.gcd(ans, A[i])
    
print(ans)
#!/usr/bin/env python3
import sys

def dfs(idx, con, visited):
    visited[idx] = True
    max_depth = 0
    max_len = 0
    depths = []
    for v in con[idx]:
        if not visited[v]:
            max_d, max_l = dfs(v, con, visited)
            max_len = max(max_len, max_l)
            depths.append(max_d + 1)
    return 0, 0
    if len(depths) > 0:
        depths.sort(reverse=True)
        max_depth = depths[0]
        if len(depths) > 1:
            max_len = max(max_len, depths[0] + depths[1])
        else:
            max_len = max(max_len, depths[0])
    return max_depth, max_len


def solve(N: int, A: "List[int]", B: "List[int]"):
    con = [[] for _ in range(N)]
    for i in range(len(A)):
        a = A[i] - 1
        b = B[i] - 1
        con[a].append(b)
        con[b].append(a)
    #print(con)
    visited = [False] * N
    max_depth, max_len = dfs(0, con, visited)
    #print(max_len)
    if (max_len + 1) % 3 == 2:
        ret = 'Second'
    else:
        ret = 'First'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N-1)  # type: "List[int]" 
    b = [int()] * (N-1)  # type: "List[int]" 
    for i in range(N-1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)

def dfs(idx, con, visited):
    visited[idx] = True
    max_depth = 0
    max_len = 0
    depths = []
    if idx >= len(con):
        return max_depth, max_len
    for v in con[idx]:
        if v < len(visited) and not visited[v]:
            max_d, max_l = dfs(v, con, visited)
            max_len = max(max_len, max_l)
            depths.append(max_d + 1)
    if len(depths) > 0:
        depths.sort(reverse=True)
        max_depth = depths[0]
        if len(depths) > 1:
            max_len = max(max_len, depths[0] + depths[1])
        else:
            max_len = max(max_len, depths[0])
    visited[idx] = False
    return max_depth, max_len


def solve(N: int, A: "List[int]", B: "List[int]"):
    con = [[] for _ in range(N)]
    for i in range(len(A)):
        a = A[i] - 1
        b = B[i] - 1
        con[a].append(b)
        con[b].append(a)
    #print(con)
    visited = [False] * N
    max_depth, max_len = dfs(0, con, visited)
    #print(max_len)
    if (max_len + 1) % 3 == 2:
        ret = 'Second'
    else:
        ret = 'First'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int()] * (N-1)  # type: "List[int]" 
    b = [int()] * (N-1)  # type: "List[int]" 
    for i in range(N-1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, a, b)

if __name__ == '__main__':
    main()
import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N = INT()
A = LIST()
B = LIST()

C1 = Counter(A)
C2 = Counter(B)
for k, v in C1.items():
    if v > N-C2[k]:
        No()
        exit()
raise Exception


### FIXED CODE ###

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c for j in range(b)] for i in range(a)]
def list3d(a, b, c, d): return [[[d for k in range(c)] for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

N = INT()
A = LIST()
B = LIST()

C1 = Counter(A)
C2 = Counter(B)
for k, v in C1.items():
    if v > N-C2[k]:
        No()
        exit()

ans = B[ceil(N, 2):] + B[:ceil(N, 2)]

def check(A, B):
    for i in range(N):
        if A[i] == B[i]:
            return i
    return -1

def swap(x, A, B):
    for i in range(N):
        if A[x] != B[i] and A[i] != B[x]:
            B[x], B[i] = B[i], B[x]
            return True
    return False

while 1:
    res = check(A, ans)
    if res == -1:
        Yes()
        print(*ans)
        break
    else:
        if not swap(res, A, ans):
            No()
            break
from sys import stdin

input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()


def dfs(node, prev):
    for i in graph[node]:
        if i != prev:
            inc[i] += inc[node]
            dfs(i, node)


n, q = mi()
inc = [0 for i in range(n+1)]
graph = [[] for i in range(n+1)]
for i in range(n-1):
    a, b = mi()
    graph[a].append(b)
    graph[b].append(a)
for i in range(q):
    a, b = mi()
    inc[a] += b
dfs(1, -1)
print(*inc[1:])

### FIXED CODE ###

from sys import stdin, setrecursionlimit
setrecursionlimit(10000000)

input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())
si = lambda: input().strip('\n')
ssi = lambda: input().strip('\n').split()


def dfs(node, prev):
    for i in graph[node]:
        if i != prev:
            inc[i] += inc[node]
            dfs(i, node)


n, q = mi()
inc = [0 for i in range(n+1)]
graph = [[] for i in range(n+1)]
for i in range(n-1):
    a, b = mi()
    graph[a].append(b)
    graph[b].append(a)
for i in range(q):
    a, b = mi()
    inc[a] += b
dfs(1, -1)
print(*inc[1:])
cubics = [ x * x * x for x in range(101)]
squares = [ x * x for x in range(1000)]
while True:
    x, y, z = -1, -1, -1
    m = 1000000
    e = int(input())
    if e == 0: break
#    for i in range(len(cubics)):
#        if e - cubics[i] < 0:
#            e -= cubics[i - 1]
#            z = i - 1
#            break
#    for i in range(len(squares)):
#        if e - squares[i] < 0:
#            e -= squares[i -1]
#            y = i - 1
#            break
#    x = e
    for cubic in cubics:
        if e < cubic: break
        else: z += 1
        tmp = e - cubic
        #print("tmp:",tmp)
        y = -1
        for squ in squares:
            if tmp < squ: break
            else: 
                x = tmp - squ
                y += 1
                #print(x,y,z)
                m = min(m, x + y + z)
    print(m)

### FIXED CODE ###

from math import floor, sqrt

cubics = [ x * x * x for x in range(101)]
squares = [ x * x for x in range(1000)]
while True:
    m = 1000000
    e = int(input())
    if e == 0: break
    for z in range(len(cubics)):
        if e < cubics[z]: break
        tmp = e - cubics[z]
        y = floor(sqrt(tmp))
        x = tmp - y ** 2
        m = min(m, x + y + z)
    print(m)
n = int(input())
enemy = list(map(int, input().split()))
beat = list(map(int, input().split()))

def hoge(index, index1):
	if(index == 0 and index1 == 0):
		return min([enemy[0], beat[0]])
	elif(index1 - index == 1):
		return min([enemy[index1], beat[index] - hoge(index, index)])
	else:
		return min([enemy[index] - hoge(index - 1, index), beat[index] ])
  
res = 0
for i in range(n):
	print(i)  
	res += hoge(i, i) + hoge(i, i+1)
print(res)


### FIXED CODE ###

n = int(input())
enemy = list(map(int, input().split()))
beat = list(map(int, input().split()))
ans = 0 
for i in range(n):
  #左を全力で倒す
  left = min([enemy[i], beat[i]])
  ans += left
  enemy[i] -= left
  beat[i] -= left
  
  right = min([enemy[i+1], beat[i]])
  ans += right
  enemy[i + 1] -= right
  beat[i] -= right
  
print(ans)
import sys

line = sys.argv[1]
digits = line.split(' ')
nums = [int(s) for s in digits]

res = 'No'
if num[0] == num[1]:
  if num[0] != num[2]:
    res = 'Yes'
    
if num[1] == num[2]:
  if num[1] != num[0]:
    res = 'Yes'
    
if num[2] == num[0]:
  if num[2] != num[1]:
    res = 'Yes'
return res

### FIXED CODE ###

import sys
 
line = [l for l in sys.stdin][0]
digits = line.split(' ')
num = [int(s) for s in digits]
 
res = 'No'
if num[0] == num[1]:
  if num[0] != num[2]:
    res = 'Yes'
    
if num[1] == num[2]:
  if num[1] != num[0]:
    res = 'Yes'

if num[2] == num[0]:
  if num[2] != num[1]:
    res = 'Yes'
    
print(res)
def circle(r):
  return r**2

str = input()
circle(str)

### FIXED CODE ###

def circle(r):
    return r**2
str = int(input())
print(circle(str))
def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        minj = i
        for j in range(i, n) :
            if nums[j] < nums[minj] :
                minj = j
        if minj != i :
                exchange_count += 1
        nums[i], nums[minj] = nums[minj], nums[i]

    print(" ".join(map(str, nums)))
    print(excnage_count)

if __name__ == '__main__' :
    main()

### FIXED CODE ###

def main() :
    n = int(input())
    nums = [int(i) for i in input().split()]
    exchange_count = 0

    for i in range(n) :
        minj = i
        for j in range(i, n) :
            if nums[j] < nums[minj] :
                minj = j
        if minj != i :
                exchange_count += 1
        nums[i], nums[minj] = nums[minj], nums[i]

    print(" ".join(map(str, nums)))
    print(exchange_count)

if __name__ == '__main__' :
    main()
a, b= map(int, input().split())


c = (a*b)
d = (a+b)*2

print( c, d)


### FIXED CODE ###

x = int(input())
print(x**3)
N=int(input())
a=0
for i in range (2,10):
  if N%i==0:
    if N/i<=9:
      a=a+1
if (a==0 and N>1):
  print("No")
else:
    print("Yes")


### FIXED CODE ###

a, b = map(int, input().split()) 
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)