Harryxun/stf_run huggingface dataset:
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))

a_sort = np.sort(a)
b_sort = np.sort(b)

# 1. 回数関係なくそもそも不可能なやつ → no
# 2-a. サイクルは1つだとしても，完璧じゃない組み合わせが1つ以上許容されるやつ → yes
# 2-b. サイクルが2以上にわけられるやつ → yes

# 1
if (a_sort > b_sort).any():
    print('No')
    exit()

# 2-a
# if (a_sort[1:] <= b_sort[:-1]).any():
#     print('Yes')
#     exit()

# 2-b （startをとりあえず0番目とかにする）
a_ = (a.argsort() ).tolist()
print(a_)
from_ = 0
count = 0
while True:
    count += 1
    from_ = a_[from_]
    if from_ == 0:
        break

if count == n:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
b = np.array(list(map(int, input().split())))

a_sort = np.sort(a)
b_sort = np.sort(b)

# 1. 回数関係なくそもそも不可能なやつ → no
# 2-a. サイクルは1つだとしても，完璧じゃない組み合わせが1つ以上許容されるやつ → yes
# 2-b. サイクルが2以上にわけられるやつ → yes

# 1
if (a_sort > b_sort).any():
    print('No')
    exit()

# 2-a
if (a_sort[1:] <= b_sort[:-1]).any():
    print('Yes')
    exit()

# 2-b （startをとりあえず0番目とかにする）
index = b.argsort()
a = a[index]
sort_dict = a.argsort().tolist()
from_ = 0
count = 0
while True:
    count += 1
    from_ = sort_dict[from_]
    if from_ == 0:
        break

if count != n:
    print('Yes')
else:
    print('No')
#Branch on Condition - Sorting Three Numbers

num=list(map(int,input().split()))
bubble_sort(num)
print(num)

def bubble_sort(arr):
    change = True
    while change:
        change = False
        for i in range(len(arr) - 1):
            if arr[i] > arr[i + 1]:
                arr[i], arr[i + 1] = arr[i + 1], arr[i]
                change = True
    return arr


### FIXED CODE ###

#Branch on Condition - Sorting Three Numbers

num=list(map(int,input().split()))
num.sort()
print(num[0],num[1],num[2])
N,L = map(int,input().split())
deri = [L]
deru = []
for num in range(1,N):
    num2 = L + num
    deri.append(num2)

for n in deri[0:]:
    if n <= 0 : deru.append(n*(-1))
    elif n >= 0 : deru.append(n)
    else : deru.append(0)

deru.sort()
rmv = deru.pop(0)
deri.remove(rmv)
out = sum(deri)
print(out)

### FIXED CODE ###

N,L = map(int,input().split())
deri = [L]
for num in range(1,N):
    num2 = L + num
    deri.append(num2)

deri.sort() #おいしさの小さい順に並び替え
if (0 in deri) == True:
    deri.remove(0) #remove Zero
elif sum(deri) < 0:
    del deri[-1]
else:
    del deri[0]

deru = sum(deri)
print(deru)
m = list(map(int,input().split()))

s = [list(map(str,input().split())) for i in range(m[0])]
a=''
s.sort()
for i in range(m[1]):
  a=a+''.join(s[i]) 
print(a)

### FIXED CODE ###

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

s = [list(map(str,input().split())) for i in range(m[0])]
a=''
s.sort()
for i in range(m[0]):
  a=a+''.join(s[i]) 
print(a)
from math import gcd
n = int(input())
a = [i for i in map(int, input().split())]
ans = gcd(a[0], a[1])
for i in a[2:]:
    ans = gcd(ans, i)
print(ans)


### FIXED CODE ###

from fractions import gcd
n = int(input())
a = [i for i in map(int, input().split())]
ans = gcd(a[0], a[1])
if 2 < n:
    for i in a[2:]:
        ans = gcd(ans, i)
print(ans)
class Binary_Indexed_Tree:
    def __init__(self, n):
        self.size = n
        self.tree = [0 for _ in range(n+1)]

    # a[i]にxを加算(1 <= i <= n) 1-indexed
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & (-i)

    # a[1] から a[t] までの合計を得る (1 <= t <= n)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & (-i)

        return s




class RangeUpdate:
    def __init__(self, n):
        self.p = Binary_Indexed_Tree(n + 1)
        self.q = Binary_Indexed_Tree(n + 1)

    # a[s] から a[t] まで一律xを加算 (1 <= s <= t <= n)
    def add(self, s, t, x):
        t += 1
        self.p.add(s, -x * s)
        self.p.add(t, x * t)
        self.q.add(s, x)
        self.q.add(t, -x)

    # a[s] から a[t] までの合計を得る (1 <= s <= t <= n)
    def sum(self, s, t):
        t += 1
        return self.p.sum(t) + self.q.sum(t) * t - self.p.sum(s) - self.q.sum(s) * s

alpha_small_dict = {chr(i):i-97 for i in range(97, 97+26)} #辞書ver
n = int(input())
S = input()
data = [[0 for i in range(n)] for j in range(26)]

bit = [RangeUpdate(n) for i in range(26)]
for i,x in enumerate(S):
    bit[alpha_small_dict[x]].add(i+1,i+1,1)
    data[i][alpha_small_dict[x]] = 1
q = int(input())
for i in range(q):
    x,y,z = input().split()
    x,y = int(x),int(y)
    #print(x,y,z)
    if x == 1:
        num = alpha_small_dict[z]
        for j in range(26):
            if data[j][y-1] == 1:
                data[j][y-1] = 0
                bit[j].add(y,y,-1)
                break
        data[num][y-1] = 1
        bit[num].add(y,y,1)
    else:
        z = int(z)
        ans = 0
        for j in range(26):
            if bit[j].sum(y,z) >= 1:
                ans += 1
        print(ans)

### FIXED CODE ###

class Binary_Indexed_Tree:
    def __init__(self, n):
        self.size = n
        self.tree = [0 for _ in range(n+1)]

    # a[i]にxを加算(1 <= i <= n) 1-indexed
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & (-i)

    # a[1] から a[t] までの合計を得る (1 <= t <= n)
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & (-i)

        return s

alpha_small_dict = {chr(i):i-97 for i in range(97, 97+26)} #辞書ver
n = int(input())
S = input()
data = [[0 for i in range(n)] for j in range(26)]

bit = [Binary_Indexed_Tree(n) for i in range(26)]
for i,x in enumerate(S):
    bit[alpha_small_dict[x]].add(i+1,1)
    data[alpha_small_dict[x]][i] = 1
q = int(input())
for i in range(q):
    x,y,z = input().split()
    x,y = int(x),int(y)
    #print(x,y,z)
    if x == 1:
        num = alpha_small_dict[z]
        for j in range(26):
            if data[j][y-1] == 1:
                data[j][y-1] = 0
                bit[j].add(y,-1)
                break
        data[num][y-1] = 1
        bit[num].add(y,1)
    else:
        z = int(z)
        ans = 0
        for j in range(26):
            if bit[j].sum(z)-bit[j].sum(y-1) >= 1:
                ans += 1
        print(ans)
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()
 
n=ii()
a=lmi()
suma=sum(a)
Counter=[0]*(10**5)
for i in a:
  Counter[i]+=1
#print(Counter)
q=ii()
 
for i in range(q):
  b,c=mi()
  suma+=(c-b)*Counter[b]
  
  Counter[c]+=Counter[b]
  Counter[b]=0
  #print(Counter)
  print(suma)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
suma=sum(a)
q=int(input())
b=[]
c=[]
for i in range(q):
  b_,c_=map(int,input().split())
  b.append(b_)
  c.append(c_)

counter=[0]*(10**5+1)
for i in a:
  counter[i]+=1
new_sum=suma
for i in range(q):
  new_sum=new_sum-b[i]*counter[b[i]]+c[i]*counter[b[i]]
  
  counter[c[i]]+=counter[b[i]]
  counter[b[i]]=0
  print(new_sum)
x = map(int, raw_input().split(" ")
print x[0]+x[1]

### FIXED CODE ###

while True:
    try:
        x = map(int, raw_input().split(" "))
        print x[0]+x[1]
    except EOFError:
        break
import sys
import numpy as np

def main(N, S):
    dp = np.zeros((N + 1, N + 1), dtype=int)
    ans = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            dp[i, j] = min(j - i, dp[i - 1, j - 1] + 1) if S[i] == S[j] else 0
        ans = max(ans, np.max(dp[i]))
    return ans


if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', 'i8(i8,i8[:],i8[:,:])')(main)
    # b1: bool, i4: int32, i8: int64, double: f8, [:], [:, :]
    cc.compile()
else:
    from my_module import main
    N = int(input())
    S = np.array([ord(_) for _ in input()])
    print(main(N, S, dp))


### FIXED CODE ###

import itertools
N = int(input())
S = input()
dp = [[0] * N for _ in range(N)]
ans = 0
for i, j in itertools.combinations(range(N), 2):
    if S[i] == S[j]:
        dp[i][j] = dp[i - 1][j - 1] + 1
    else:
        dp[i][j] = 0
    ans = max(ans, min(j - i, dp[i][j]))
print(ans)
N, K = map(int, input().split())
S = input()
if S[K-1] == 'A':
  S[K-1] = 'a'
elif S[K-1] == 'B':
  S[K-1] = 'b'
else:
  S[K-1] = 'c'
print(S)

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower() + S[K:])
N, M = map(int, raw_input().split())
S = [True]*(N+1)
for _ in range(M):
  a = input()
  S[a] = False
T = [0]*(N+1)
T[0] = 1
T[1] = 1 if S[1] else 0
for i in range(2, N+1):
  if S[i]:
    T[i] = (T[i-1]+T[i-2])%1000000007
print(T[N])

### FIXED CODE ###

N, M = map(int, raw_input().split())
S = [True]*(N+1)
for _ in range(M):
  a = input()
  S[a] = False
T = [0]*(N+1)
T[0] = 1
T[1] = 1 if S[1] else 0
for i in range(2, N+1):
  if S[i]:
    T[i] = (T[i-1]+T[i-2])%1000000007
print T[N]
S,W = map(int, input().split())
if S>W:
  print("safe")
else:
  print("unsafe)

### FIXED CODE ###

S,W = map(int, input().split())
if S>W:
  print("safe")
else:
  print("unsafe")
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:
  if b==c:
    if a==c:
      print('Yes')
    else:
      print('No')
  else:
    print('No')
else:
  print('No')
import sys

N = int(sys.stdin.readline())

i = 1
s = 0

while i ** 2 <= N:
  if N // i == N % i:
    s += i
  i += 1
print(s)

### FIXED CODE ###

import sys

readline = sys.stdin.readline

N, K = map(int, readline().split())

ret = N - K + 1

print(ret)
s = input()
q = int(input())
query_d = {}
for i in range(q):
    if i == 0:
        query_d[0] = list(input().split())
    else:
        query = list(input().split())
        if (query[0] == '1') and (query_d[i-1][0] == '1'):
            query_d.pop(i-1)
        else:
            query_d[i] = query

for query in query_d.values():
    if int(query[0]) == 1:
        s = s[::-1]
    else:
        if int(query[1]) == 1:
            s = query[2] + s
        else:
            s = s + query[2]
print (s)

### FIXED CODE ###

from collections import deque
d = deque(input())
q = int(input())
reverse = False
for _ in range(q):
    query = list(input().split())
    if query[0] == '1':
        if reverse:
            reverse = False
        else:
            reverse = True
        continue
    else:
        if query[1] == '1':
            if reverse:
                d.append(query[2])
            else:
                d.appendleft(query[2])
        else:
            if reverse:
                d.appendleft(query[2])
            else:
                d.append(query[2])

if reverse:
    d = list(reversed(d))

print(''.join(map(str, d)))
while True:
(a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]
    
    if op == '?':
        break

    if op == '+':
        print(a + b)

    if op == '-':
        print(a - b)

    if op == '*':
        print(a * b)

    if op == '/':
        print(a // b)

### FIXED CODE ###

while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
   
    if op == '?':
        break
   
    if op == '+':
        print(a + b)
   
    if op == '-':
        print(a - b)
   
    if op == '*':
        print(a *b)
   
    if op == '/':
        print(a // b)
a, b = map(int, input().split())
  ans = a+b
     
if ans >=24:
  ans = ans-24
      
print(ans)

### FIXED CODE ###

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

m=a+b

if m>=24:
  print(int(m-24))
else:
  print(int(m))
n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k < n :
  print(k * x + (n - k) * y)
else:
  primt(n * x)

### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())
if k < n :
  print(k * x + (n - k) * y)
else:
  print(n * x)
n = int(input())
s = input()
dp = [0]*n
j = 1

for i in range(n):
    while s[i:j] in s[j:s]:
        j += 1
    dp[i] = j-i-1
print(max(dp))


### FIXED CODE ###

n = int(input())
s = input()
dp = [0]*n
j = 1

for i in range(n):
    while s[i:j] in s[j:n]:
        j += 1
    dp[i] = j-i-1
print(max(dp))
if S="SUN":
  print("0")
  elif S="MON":
  print("1")
  elif S="TUE":
  print("2")
  elif S="Wed":
  print("3")
  elif S="THU":
  print("4")
  elif S="FRI":
  print("5")
  elif S="SAT":
  print("6")


### FIXED CODE ###

S=input()
if S=="SUN":
  print(7)
elif S=="MON":
  print(6)
elif S=="TUE":
  print(5)
elif S=="WED":
  print(4)
elif S=="THU":
  print(3)
elif S=="FRI":
  print(2)
elif S=="SAT":
  print(1)
#"a" 97 "z" 122
s = list(ord(i) for i in input())
k = int(input())
for i in range(len(s)):
  if 123 - s[i] <= k:
    k -= 123-s[i]
    s[i] = 97

if k > 0:
  s[-1] += k
  if s[-1] >= 123: s[-1] = s[-1]-26
print("".join(list(map(chr, s))))

### FIXED CODE ###

#"a" 97 "z" 122
s = list(ord(i) for i in input())
k = int(input())

for i in range(len(s)-1):
  if s[i] == ord("a"): continue
  t = ord("z")+1-s[i]
  if k >= t:
    s[i] = 97
    k -= t
if k > 0:
  k %= 26
  s[-1] += k
  if s[-1] > ord("z"):
    s[-1] -= 26
print("".join(list(map(chr, s))))
A = input().split()
print(A[0]*A[1]/2)

### FIXED CODE ###

A = [int(n) for n in input().split()]
print(int(A[0]*A[1]/2))
import collections
H,W = list(map(int , input().split()))
D = []
for j in range(H):
    x=list(input())
    D.extend(x)
s = len((set(D)))
c = collections.Counter(D)
Q = []

for i in range(s):
    Q.append(c.most_common()[i][1])
if s == 1:
    print("Yes")
else:
    if ((H*W)%2 == 1):
        seigen = (H//2+1)*(W//2 +1)
        q = 0
        m = 0
        mm = (N-(H//2)*(W//2)*4)//2+1
        for k in range(s):
            q += (Q[k] % 2)
            if (Q[k] % 4)!= 0:
                m += 1
        if (q == 1)and(s<=seigen)and (m <= mm):
            print("Yes")
        else:
            print("No")
    elif ((H%2) == 0)and((W %2) ==0):
        q = 0
        for k in range(s):
            q += (Q[k] % 4)
        if ((s % 2) == 0)and(q == 0):
            print("Yes")
        else:
            print("No")

    else:
        q = 0
        e = 0
        if ((H%2) == 1):
            seigen = (H//2+1)*W
            seigen2 = (H//2+1)
        elif ((W%2) == 1):
            seigen = (W//2+1)*H
            seigen2 = (W//2+1)
        for k in range(s):
            q += (Q[k] % 2)
            if (Q[k] % 4)!= 0:
                e += 1
        if (q == 0)and(s<=seigen)and(e<=seigen2):
            print("Yes")
        else:
            print("No")


### FIXED CODE ###

import collections
H,W = list(map(int , input().split()))
D = []
for j in range(H):
    x=list(input())
    D.extend(x)
s = len(list((set(D))))
c = collections.Counter(D)
Q = []

for i in range(s):
    Q.append(c.most_common()[i][1])
if s == 1:
    print("Yes")
else:
    if ((H*W)%2 == 1):
        seigen = (H//2+1)*(W//2 +1)
        q = 0
        m = 0
        mm = (H*W-(H//2)*(W//2)*4)//2+1
        for k in range(s):
            q += (Q[k] % 2)
            if (Q[k] % 4)!= 0:
                m += 1
        if (q == 1)and(s<=seigen)and (m <= mm):
            print("Yes")
        else:
            print("No")
    elif ((H%2) == 0)and((W %2) ==0):
        seigen = (H*W)//4
        q = 0
        for k in range(s):
            q += (Q[k] % 4)
        if ((s <= seigen)and(q == 0)):
            print("Yes")
        else:
            print("No")

    else:
        q = 0
        e = 0
        if ((H%2) == 1):
            seigen = (H//2+1)*W
            seigen2 = W//2
        elif ((W%2) == 1):
            seigen = (W//2+1)*H
            seigen2 = H//2
        for k in range(s):
            q += (Q[k] % 2)
            if (Q[k] % 4)!= 0:
                e += 1
        if (q == 0)and(s<=seigen)and(e<=seigen2):
            print("Yes")
        else:
            print("No")
a = input()
b = input()
c = input()
A, B, C = len(a), len(b), len(c)
ab, bc, ac = [1] * 120000, [1] * 120000, [1] * 120000

for i in range(A):
    if a[i] == '?':
        continue
    for j in range(B):
        if b[i] == '?':
            continue
        if a[i] != b[j]:
            ab[i-j+6000]= 0
for i in range(B):
    if a[i] == '?':
        continue
    for j in range(C):
        if b[i] == '?':
            continue
        if b[i] != c[j]:
            bc[i-j+6000]= 0
for i in range(A):
    if a[i] == '?':
        continue
    for j in range(C):
        if b[i] == '?':
            continue
        if a[i] != c[j]:
            ac[i-j+6000]= 0
ans = 6000

for i in range(-2000, 2000):
    for j in range(-2000, 2000):
        if ab[i+6000] and bc[j-i+6000] and ac[j+6000]:
            L = min(0, min(i, j))
            R = max(A, max(B+i, C+j))
            ans = min(ans, R-L)
print(ans)
    

### FIXED CODE ###

a = input()
b = input()
c = input()
A, B, C = len(a), len(b), len(c)
ab, bc, ac = [1] * 16000, [1] * 16000, [1] * 16000

for i in range(A):
    if a[i] == '?':
        continue
    for j in range(B):
        if b[j] != '?' and a[i] != b[j]:
            ab[i-j+8000]= 0
for i in range(B):
    if b[i] == '?':
        continue
    for j in range(C):
        if c[j] != '?' and b[i] != c[j]:
            bc[i-j+8000]= 0
for i in range(A):
    if a[i] == '?':
        continue
    for j in range(C):
        if c[j] != '?' and a[i] != c[j]:
            ac[i-j+8000]= 0
ans = 6000

for i in range(-4000, 4000):
    for j in range(-4000, 4000):
        if ab[i+8000] and bc[j-i+8000] and ac[j+8000]:
            L = min(0, min(i, j))
            R = max(A, max(B+i, C+j))
            ans = min(ans, R-L)
print(ans)
count = 0

while True :
 x = int(input())
 count += 1
  if x == 0 : break
 print("Case { }: { }".format(count, x))

### FIXED CODE ###

i = 0

while True:
 n = int(input())
 i += 1
 if n == 0:
  break
 print("Case {}: {}".format(i, n))
from sys import stdin
 
x,y,z = stdin.readline().split( )

print (int(x)-int(z))/(int(y)+int(z))


### FIXED CODE ###

from sys import stdin
import math
 
x, y, z = stdin.readline().split()
 
print (math.floor(( ( int(x)-int(z) ) / ( int(y) + int(z) ) )))
import sys

N = int(input())
Atmp = [0] + list(map(int, input().split()))
A = {}

for i,a in enumerate(Atmp):
    A[i] = a

#print(A)

X = {}

for i in reversed(list(range(1,N+1))):
    Xsum = 0
    j = 2
    while(i*j < N):
        Xsum += X[i*j]
        j += 1
        continue
    odd = Xsum % 2
    if odd == A[i]:
        X[i] = 0
    else:
        X[i] = 1
    



def umeru(X, M, last):
    #print('---')
    for i in reversed(list(range(N//(M+1)+1, N//M+1))):
        if M == 1:
            X[i] = A[i]
        else:
            Xsum = 0
            j = 2
            while(i*j < N):
                Xsum += X[i*j]
                j += 1
                continue
            odd = Xsum % 2
            #print(M, i, odd, A[i])
            if odd == A[i]:
                X[i] = 0
            else:
                X[i] = 1
    #print(N,M,X)
    if last:
        return
    if N//(M+1) == 0:
        umeru(X, M+1, True)
    else:
        umeru(X, M+1, False)

#umeru(X, 1, False)
#print(X)

M = 0
for i in range(1, N+1):
    if X[i] == 1:
        M += 1

print(M)
if M == 0:
    sys.exit()

xxx = []
for i in range(1, N+1):
    if X[i] == 1:
        xxx.append(X[i])

print(' '.join(xxx))


### FIXED CODE ###

import sys

N = int(input())
Atmp = [0] + list(map(int, input().split()))
A = {}

for i,a in enumerate(Atmp):
    A[i] = a

#print(A)

X = {}

for i in reversed(list(range(1,N+1))):
    Xsum = 0
    j = 2
    while(i*j <= N):
        Xsum += X[i*j]
        j += 1
        continue
    odd = Xsum % 2
    if odd == A[i]:
        X[i] = 0
    else:
        X[i] = 1
    
M = 0
for i in range(1, N+1):
    if X[i] == 1:
        M += 1

print(M)
if M == 0:
    sys.exit()

xxx = []
for i in range(1, N+1):
    if X[i] == 1:
        xxx.append(str(i))

print(' '.join(xxx))
import sys
from numpy import inf

def insert(heap, key):
    heap.append(-inf)
    heapIncreaseKey(heap, key)

def parent(i):
    return (i - 1) // 2

def heapIncreaseKey(heap, key):
    heap[len(heap) - 1] = key
    i = len(heap) - 1
    while i > 0 and heap[parent(i)] < heap[i]:
        heap[i], heap[parent(i)] = heap[parent(i)], heap[i]
        i = parent(i)

def heapExtractMax(heap):
    if len(heap) < 1:
        return None
    else:
        MAX = heap[0]
        heap[0] = heap.pop()
        maxHeapify(heap, 0)

        return MAX

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)


heap = []
out = ''
while True:
    line = stdin.readline()
    if line[0] == 'i':
        insert(heap, int(line.split()[1]))
    elif line[0:2] == 'ex':
        print(str(heapExtractMax(heap)))
    else:
        break

### FIXED CODE ###

from sys import stdin
from heapq import heappop, heappush
readline = stdin.readline

heap = []
while True:
    line = readline()
    if line[1] == 'x':
        print(-heappop(heap))
    elif line[0] == 'i':
        heappush(heap, -int(line.split()[1]))
    else:
        break


'''
def insert(heap, key):
    heap.append(-1000000)
    heapIncreaseKey(heap, key)

def parent(i):
    return (i - 1) // 2

def heapIncreaseKey(heap, key):
    heap[len(heap) - 1] = key
    i = len(heap) - 1
    while i > 0 and heap[parent(i)] < heap[i]:
        heap[i], heap[parent(i)] = heap[parent(i)], heap[i]
        i = parent(i)

def heapExtractMax(heap):
    if len(heap) < 1:
        return None
    else:
        MAX = heap[0]
        heap[0] = heap.pop()
        maxHeapify(heap, 0)

        return MAX

def maxHeapify(heap, i):
    left = (i + 1) * 2 - 1
    right = (i + 1) * 2
    largest = left if left < len(heap) and heap[left] > heap[i] else i
    largest = right if right < len(heap) and heap[right] > heap[largest] else largest
    if largest != i:
        heap[i], heap[largest] = heap[largest], heap[i]
        maxHeapify(heap, largest)


heap = []
while True:
    line = sys.stdin.readline()
    if line[0] == 'i':
        insert(heap, int(line.split()[1]))
    elif line[0:2] == 'ex':
        print(str(heapExtractMax(heap)))
    else:
        break
'''
import sys,collections;sys.setrecursionlimit(10**7)
import itertools
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

H,W,D = Is()
d = dict()
for i in range(H):
    s = Is()
    for j,e in enumerate(s):
        d[e] = (i,j)
Q = I()
for q in range(Q):
    l,r = Is()
    maho = 0
    for k in range(l,r,D):
        maho += abs(d[k+D][0] - d[k][0]) + abs(d[k+D][1] - d[k][1])
    print(maho)

### FIXED CODE ###

import sys,collections;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n = I()
print(n//3)
k = input()
w = input()
l = len(w)
if l <= k:
	print(w)
else:
    print(w[:k]"...")


### FIXED CODE ###

k = int(input())
s = input()
if int(len(s)) <= k:
  	print(str(s))
else:
  	print(((str(s))[0:k]) + "...")
def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True
	

N = int(input())
count = 0
a_list = []

for i in range(5550):
	a = 10 * i + 1
	if is_prime(a):
		a_list.append(a)
		count += 1
		if count == N:
			break

print (' '.join(map(str, a_list)))

### FIXED CODE ###

import math

def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True
	

N = int(input())
count = 0
a_list = []

for i in range(5550):
	a = 10 * i + 1
	if is_prime(a):
		a_list.append(a)
		count += 1
		if count == N:
			break

print (' '.join(map(str, a_list)))