Harryxun/stf_run huggingface dataset:
Q = int(input())
query = []
cal = []
intc = []
count = 0

for _ in range(Q):
    a = list(map(int, input().split()))
    if a[0]==1:
        intc.append(a[2])
        query.append(a[1])
        count += 1

    else:
        cal.append(count)


for c in cal:
    if c==1:
        print(query[0],intc[0])

    else:
        query = query[:c]
        query.sort()
        if c==2:
            print(query[0],sum(intc[:2])+query[1]-query[0])
        else:
            minx = int((c-1)/2)
            ans = -sum(query[:minx])+sum(query[minx+1:])+sum(intc[:c])
            print(query[minx],ans)

### FIXED CODE ###

from heapq import heapify, heappush, heappop
import sys
input = sys.stdin.readline
Q = int(input())
query = []
sumL, sumR = [], []
ans = 0
for _ in range(Q):
    a = list(map(int, input().split()))
    if a[0]==1:
        ans += a[2]
        if len(sumL)==0 or a[1] <= -sumL[0]:
            heappush(sumL, -a[1])
            ans += -sumL[0] - a[1]
        else:
            heappush(sumR, a[1])
            ans += sumL[0] + a[1]
    
        if len(sumR) > len(sumL):
            ans -= sumR[0] + sumL[0]
            heappush(sumL, -heappop(sumR))
            
        elif len(sumL) - len(sumR) >= 2:
            heappush(sumR, -heappop(sumL))

    else:
        print(-sumL[0],ans)
from collections import defaultdict
from bisect import bisect_right
N,K,*A = map(int, open(0).read().split())
a = A[0]
p = 0
ls = []
dic = defaultdict(list)
for i,c in enumerate(A):
  dic[c].append(i)
while True:
  ls.append(p)
  ind = bisect_right(dic[a],p%N)
  if ind==len(dic[a]):
    ind = 0
    p += N
  p = (p//N)*N+dic[a][ind]+1
  if p%N==0:
    M = p//N
    break
  a = A[p%N]
K %= M
X = N*K
I = bisect_right(ls,X)-1
X -= ls[I]
p = ls[I]%N
S = set()
cnt = 0
ans = []
while X:
  if A[p] not in S:
    S.add(A[p])
    ans.append(A[p])
    cnt += 1
  else:
    i = ans.index(A[p])
    ans = ans[:i]
    cnt = i
  X -= 1
  p += 1
  p %= N
print(' '.join(map(str,ans)))    

### FIXED CODE ###

from bisect import bisect_left
from collections import defaultdict
N, K, *A = map(int, open(0).read().split())
dic = defaultdict(list)
for i, a in enumerate(A):
  dic[a] += [i]
ls = []
ps = 0
m = A[0]
cycle = 0
while True:
  ls.append(ps+N*cycle+1)
  i = bisect_left(dic[m],ps+1)
  ps = dic[m][i%len(dic[m])]
  if i>=len(dic[m]):
    cycle += 1
  ps += 1
  ps %= N
  m = A[ps]
  if ps==0:
    cycle += 1
    break
k = K%cycle
j = bisect_left(ls,k*N)
if ls[j]==k*N:
  c = (ls[j]-1)%N
  print(A[c])
elif ls[j]==k*N+1:
  pass
else:
  c = (ls[j-1]-1)%N
  M = k*N-ls[j-1]
  ans = [A[c]]
  log = set(ans)
  ind = {}
  ind[A[c]] = 0
  cnt = 0
  while M:
    c += 1
    c %= N
    cnt += 1
    cnt %= N
    M -= 1
    if not A[c] in log:
      log.add(A[c])
      ind[A[c]] = cnt
      ans += [A[c]]
    else:
      log.remove(A[c])
      ans = ans[:ind[A[c]]]
      log = set(ans)
      cnt = ind[A[c]]-1
  print(*ans)
a,b,c = map(input().split())
print (c-(a-b))

### FIXED CODE ###

a,b,c = map(int,input().split())
print (max(0,c-(a-b)))
for i in range(h):
    for j in range(w):
        if s[i][j] == "0":
            for k in range(8):
                if 0 <= j+y[k] < w and 0 <= i+x[k] < h and s[i+x[k]][j+y[k]] == "#":
                    s[i][j] = str(int(s[i][j])+1)
                    
for i in range(h):
    print("".join(s[i]))

### FIXED CODE ###

h,w = map(int, input().split())
s = [list(input().replace(".","0")) for i in range(h)]
x = [1,1,0,-1,-1,-1,0,1]
y = [0,1,1,1,0,-1,-1,-1]

for i in range(h):
    for j in range(w):
        if s[i][j] == "0":
            for k in range(8):
                if 0 <= j+y[k] < w and 0 <= i+x[k] < h and s[i+x[k]][j+y[k]] == "#":
                    s[i][j] = str(int(s[i][j])+1)
                    
for i in range(h):
    print("".join(s[i]))
N = int(input())
an = list(map(int, input().split()))

if not 1 in an:
  print(-1)

count = 1
for i in an:
  if i == an[i]:
    count += 0
  elif i != an[i]:
    count += 1
print(count) 

### FIXED CODE ###

N = int(input())
an = list(map(int, input().split()))
enable = 0

if not 1 in an:
  enable = 1
  
count = 0
block = 1
for i in range(N):
  if an[i] != block:
    count += 1
  else:
    block += 1
    
if enable == 1:    
  print(-1)
else:
  print(count)
from fractions import gcd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0 for _ in range(n)]
    right = [0 for _ in range(n)]
    for i in range(1, n):
        l = math.gcd(a[i - 1], a[i])
        r = math.gcd(a[n - i - 1], a[n - i - 2])
        left[i] = l
        right[n - i - 2] = r

    m = max(left[0], right[n - 1])
    for i in range(n - 1):
        m = max(m, left[i - 1], right[i + 1])
    print(m)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from fractions import gcd

def main():
    n = int(input())
    a = list(map(int, input().split()))
    left = [0]
    right = [0]
    for i in range(1, n):
        g = gcd(left[-1], a[i - 1])
        left.append(g)
    for i in range(n - 2, -1, -1):
        g = gcd(right[-1], a[i + 1])
        right.append(g)
    right.reverse()
    m = 0
    for i in range(0, n):
        m = max(m, gcd(left[i], right[i]))
    print(m)
    
if __name__ == '__main__':
    main()
print(min(set(map(chr, range(97, 123))) - set(input())) or None)

### FIXED CODE ###

print(min(set(map(chr, range(97, 123))) - set(input()) or ["None"]))
a, b = map(int, input().split())
print(()(b-a)*(b-a+1)/2)-b)

### FIXED CODE ###

a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))
x = list(map(int,input().split()))
x = x.sort()
print("{0} {1} {2}".format(x[0],x[1],x[2])

### FIXED CODE ###

x = list(map(int,input().split()))
x = sorted(x)
print("{0} {1} {2}".format(x[0],x[1],x[2]))
#下1桁が小さい(しかし0でない)物を最後に残す
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
ListN.append(A)
ListN.append(B)
ListN.append(C)
ListN.append(D)
ListN.append(E)
ListN.sort()
while ListN[0]==0:
  ListN.pop(0)
  ListN.append(0)
Listn=[]
for i in range(1,5,1):
  if ListN[i]!=0
    Listn.append(10-int(ListN[i]))

s=0
for i in range(1,5,1):
  s+=Listn[i]

S+=s
print(S)

### FIXED CODE ###

#下1桁が小さい(しかし0でない)物を最後に残す
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
S=a+b+c+d+e
A=a%10
B=b%10
C=c%10
D=d%10
E=e%10
ListN=[]
if A!=0:
  ListN.append(A)
if B!=0:
  ListN.append(B)
if C!=0:
  ListN.append(C)
if D!=0:
  ListN.append(D)
if E!=0:
  ListN.append(E)

if len(ListN)==0:
  print(S)
else:
  Listn=[]
  ListN.sort()
  for i in range(1,len(ListN),1):
    q=10-int(ListN[i])
    S+=q
  print(S)
a, b = int(input())

def FizzBuzz(a, b):
  total = a*b
  if a*b%2 = 0:
    print('Even')
  else:
    print('Odd')

FizzBuzz(a,b)

### FIXED CODE ###

a, b = map(int, input().split())
 
def FizzBuzz(a, b):
  total = a*b
  if total % 2 == 0:
    print('Even')
  else:
    print('Odd')
 
FizzBuzz(a, b)
s = str(input())
K = int(input())

def find(str):
	lt = []
	for start in range(len(str)):
		for end in range(start + 1, len(str) + 1):
			lt.append(str[start:end])
	lt = list(set(lt))
	lt.sort()

	return lt

s_pt = list(set(list(s)))
s_pt.sort()
ans = []

for i in range(min(5, len(s_pt))):
	ind = [ix for ix, x in enumerate(s) if x == s_pt[i]]
	for j in ind:
		ans += find(s[j:min(j+5, len(s))])
	if len(ans) >= 5:
		break
ans = list(set(ans))
ans.sort()
print(ans[K-1])


### FIXED CODE ###

s = str(input())
K = int(input())

def find(str):
	lt = []
	for start in range(len(str)):
		for end in range(start + 1, len(str) + 1):
			lt.append(str[start:end])
	lt = list(set(lt))
	lt.sort()

	return lt

s_pt = list(set(list(s)))
s_pt.sort()
ans = []
for i in range(min(5, len(s_pt))):
	ind = [ix for ix, x in enumerate(s) if x == s_pt[i]]
	for j in ind:
		ans += find(s[j:min(j+5, len(s))])
	ans = list(set(ans))
	if len(ans) >= 5:
		break
ans = list(set(ans))
ans.sort()
print(ans[K-1])
score = [1999,1799,1599,1399,1199,999,799,599]

x = int(input())
i = 0

while(x <= score[i]):
      i += 1

print(i)

### FIXED CODE ###

score = [1800,1600,1400,1200,1000, 800, 600, 400]
ranks = [   1,   2,   3,   4,   5,   6,   7,   8]

x = int(input())
i = 0

while(x < score[i]):
      i += 1

print(ranks[i])
X = list(map(int, input().split()))
N = [X[1]-X[2]]*X[0]
Q = []
for i in range(X[2]):
  Q.append(int(input()))
for i in range(X[2]):
  N[Q[i]]+=1
for result in N:
  if(result >= 1):
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

X = list(map(int, input().split()))
N = [X[1]-X[2]]*X[0]
Q = []
for i in range(X[2]):
  Q.append(int(input()))
for i in range(X[2]):
  N[Q[i]-1]+=1
for result in N:
  if(result >= 1):
    print('Yes')
  else:
    print('No')
a,b = input().split()
if a == b == H:
    print("H")
elif a == H and b == D:
    print("D")
elif a == D and b == H:
    print("D")
else:
    print("H")
    

### FIXED CODE ###

a,b = input().split()
if a == b == "H":
    print("H")
elif a == "H" and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")
n = int(input())
obj= []
for i in range (n):
	obj.append(input())
dictOfElems = dict()
    # Iterate over each element in list
    for elem in obj:
        # If element exists in dict then increment its value else add it in dict
        if elem in dictOfElems:
            dictOfElems[elem] += 1
        else:
            dictOfElems[elem] = 1
print(len(dict))

### FIXED CODE ###

n = int(input())
obj= []
for i in range (n):
	obj.append(input())
dictOfElems = dict()
for elem in obj:
  if elem in dictOfElems:
    dictOfElems[elem] += 1
  else:
    dictOfElems[elem] = 1
print(len(dictOfElems))
l,n=map(int,input().split())
li=[input() for i in range(n)]
ans=sorted(li)
"""
for st in li :
  s += st
print(s)
"""
print(*ans,sep="")

### FIXED CODE ###

n,l=map(int,input().split())
li=[input() for i in range(n)]
ans=sorted(li)
"""
for st in li :
  s += st
print(s)
"""
print(*ans,sep="")
import sys
import math
Q = sys.stdin.readline()
for _ in range(int(Q)):
    cnt = 0
    N = int(sys.stdin.readline())
    digLeng = int(math.log10(N)) + 1
    while digLeng > 1:
        Nmax = 0
        for dig in range(digLeng):
            lNum = N // int(math.pow(10,dig))
            rNum = N % int(math.pow(10,dig))
            Nmax = max(Nmax,lNum * rNum)
        N = Nmax
        cnt += 1
        if N != 0:
            digLeng = int(math.log10(N)) + 1
        else:
            digLeng = 1
    print(cnt)

### FIXED CODE ###

import sys
import math
Q = sys.stdin.readline()
for _ in range(int(Q)):
    cnt = 0
    N = int(sys.stdin.readline())
    if N != 0:
        digLeng = int(math.log10(N)) + 1
    else:
        digLeng = 1
    while digLeng > 1:
        Nmax = 0
        for dig in range(digLeng):
            lNum = N // int(math.pow(10,dig))
            rNum = N % int(math.pow(10,dig))
            Nmax = max(Nmax,lNum * rNum)
        N = Nmax
        cnt += 1
        if N != 0:
            digLeng = int(math.log10(N)) + 1
        else:
            digLeng = 1
    print(cnt)
K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += N//K
r = N%K
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)


### FIXED CODE ###

K = int(input())
N = 50
num = [i for i in range(N)]
for i in range(N):
    num[i] += K//N
r = K%N
for i in range(r):
    num[i] += N
    for j in range(N):
        if j != i:
            num[j] -= 1
print(N)
print(*num)
n,k = map(int,input().split())
p = [i-1 for i in list(map(int,input().split()))]
c = list(map(int,input().split()))
ans = -float("inf")
for i in range(n):
    now = i
    cnt = [0]
    for j in range(n):
        nxt = p[now]
        cnt.append(cnt[j]+c[nxt])
        now = nxt
        if now == i:
            break
    m = len(cnt)-1
    if k <= m:
        s = max(cnt[1:(k+1)])
    elif cnt[-1] < 0:
        s = max(cnt[1:])
    else:
        t = k//m
        s = (t-1)*cnt[-1]+max(cnt[1:])
        s = max(s, t*cnt[-1]+max(cnt[:(k-t*m+1)]))
    ans = max(ans,s)
print(ans)

### FIXED CODE ###

s = input()
if s == "RRS" or s == "SRR":
    print(2)
elif s == "RRR":
    print(3)
elif s == "SSS":
    print(0)
else:
    print(1)
N,L = map(int, input().split())

apple = [L+i for i in range(N)]
print(apple)
min = 500
for k in range(len(apple)):
    if abs(apple[k])<min:
        min = abs(apple[k])

apple.remove(min)
print(sum(apple))

### FIXED CODE ###

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

apple = [L+i for i in range(N)]
min = 500
for k in range(len(apple)):
    if abs(apple[k])<abs(min):
        min = apple[k]

apple.remove(min)
print(sum(apple))
m, n = map(int, input().split())
M = list(map(int, input().split()))
M.sort()
M.reverse()
A = []
for i in range(n):
    A.append(M[i])
print(sum(A))


### FIXED CODE ###

a, b = map(int,input().split())
print("Possible" if(a+b)%3==0 or a%3==0 or b%3==0 else "Impossible")
def sp(road,used,node,goal,path):
    if node == goal:
        return True
    for x in road[node]:
        if used[x]!=1:
            used[x]=1
            if sp(road,used,x,goal,path):
                used[x]=2
                path.append(x)
                return True

def dps(road,used,node):
    for x in road[node]:
        if used[x]!=2:
            used[x]=2
            return dps(road,used,x)+1
    return 0
    
N=int(input())
road=[[] for _ in range(N)]
used=[0 for _ in range(N)]

for i in range(N-1):
    a,b=list(map(int,input().split()))
    road[a-1].append(b-1)
    road[b-1].append(a-1)

path=[]
sp(road,used,0,N-1,path)

mid=len(path)//2+len(path)%2

f=[0]+path[:mid]
s=[N-1]+path[mid:]

black=mid
for x in f:
    black+=dps(road,used,x)
white=len(path)-mid
for x in s:
    white+=dps(road,used,x)

if black>white:
    print('Fennec')
else:
    print('Snuke')

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**9)

def dps(road,dist,node,d):
    for x in road[node]:
        if dist[x]<0:
            dist[x]=d
            dps(road,dist,x,d+1)
    
N=int(input())
road=[[] for _ in range(N)]
f_d=[-1 for _ in range(N)]
s_d=[-1 for _ in range(N)]
f_d[0]=0
s_d[-1]=0

for i in range(N-1):
    a,b=list(map(int,input().split()))
    road[a-1].append(b-1)
    road[b-1].append(a-1)

dps(road,f_d,0,1)
dps(road,s_d,N-1,1)

white=0
black=0

for i in range(N):
    if f_d[i]<=s_d[i]:
        black+=1
    else:
        white+=1

if black>white:
    print('Fennec')
else:
    print('Snuke')
N, K = map(int, input().split())
l = []
l += map(int, input().split())
ans = 0
while True:
  if max(l) >= K:
    l.remove(max(l))
    ans += 1
    
print(ans)
    

### FIXED CODE ###

N, K = map(int, input().split())
li = list(map(int, input().split()))
ans = 0
for i in range(N):
  if li[i] >= K:
    ans += 1
print(ans)
A,B,N=map(int,input().split())
if B==1 or A==1:
    ans = 0
elif A==10**6 and B ==10**12
    ans = 10**6
else:
    while N%B==0:
        N = N-1
    ans = (A*N)//B - A*(N//B)
print(ans)

### FIXED CODE ###

import math
A,B,N=map(float,input().split())
if N >= B:
    N = B-1
ans = math.floor(A*N/B) - A*math.floor(N/B)
print(int(ans))
S=input()
s=abcdefghijklmnopqrstuvwxyz
c=0
if S[0]=="A" and "C" in S[2:len(S-1)]:
  i=S.find("C")
  S=S[1:i]+S[i+1:]
  if S.islower():
    c=1
print("AC" if c==1 else "WA")

### FIXED CODE ###

S=input()
c=0
if S[0]=="A" and "C" in S[2:len(S)-1]:
  i=S.find("C")
  S=S[1:i]+S[i+1:]
  if S.islower():
    c=1
print("AC" if c==1 else "WA")
n,y = map(int,input().split())
total = 0
for i in range(n+1):
	for j in range(n+1-i):
		k = n - i - j
		total = i*10000 + j*5000 + k*1000
		if total == y:
			print(i,j,k)
			break
		total = 0
	else:
		continue
	break
else:
	print("-1 -1 -1")

### FIXED CODE ###

s = list(input())

s[3] = '8'
print(''.join(s))
SAN=7
MON=6
TUE=5
WED=4
THU=3
FRI=2
SAT=1
x=input()	
print(x)

### FIXED CODE ###

SUN=7
MON=6
TUE=5
WED=4
THU=3
FRI=2
SAT=1
x=input()	
print(x)
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)

### FIXED CODE ###

import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = input().split(",")
print(*li)
a, b = input().split()
c = int(a+b)
d = math.sqrt(c)
if d%1 == 0:
  print("Yes"):
  else:
    print("No"):

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
a, b, x = map(int, input().split())
count = len(list(filter(lambda t: t % x == 0, list(range(a, b + 1)))))
print(count)

### FIXED CODE ###

s = input().split()[1]
print('A'+s[0]+'C')
from functools import partial


def divise(n, divisor):
    if n == divisor:
        return n
    elif n % divisor == 0:
        return 0
    else:
        return n

number = int(input())
origin = [int(input()) for x in range(number)]

divised = origin

for i in range(2, max(origin)+1):
    divised = list(map(functools.partial(divise, divisor=i), divised))

for j in range(number):
    if divised[j] == 0:
        origin.pop(j)
    else:
        pass

print(len(origin))

### FIXED CODE ###

def is_prime(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            return False
        i += 1
    return True

count = 0

number = int(input())
for i in range(number):
    n = int(input())
    if is_prime(n):
        count = count + 1

print(count)
#  --*-coding:utf-8-*--


import math

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

g = math.gcd(math.gcd(a,b), c)
a //= g
b //= g
c //= g

if math.sqrt(a) + math.sqrt(b)  < math.sqrt(c):
    print('Yes')
else:
    print('No')




### FIXED CODE ###

#  --*-coding:utf-8-*--


import math

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

if c < a + b:
    print('No')
elif 4*a*b < (c - a - b)**2:
    print('Yes')
else:
    print('No')
def f():
    # A枚に達する
    a = A - 1
    # 増殖に使える時間
    b = K - a
    # A->Bにd回変換
    d, m = divmod(b, 2)
    return A + (B - A) * d + m

def g():
    return 1 + K

if (A + 2) < B:
    print(f())
else:
    print(g())

### FIXED CODE ###

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

def f():
    # A枚に達する
    a = A - 1
    # 増殖に使える時間
    b = K - a
    # A->Bにd回変換
    d, m = divmod(b, 2)
    return A + (B - A) * d + m

def g():
    return 1 + K

if (A + 2) < B:
    print(f())
else:
    print(g())
n = int(input())
s = input()

e = [0 for _ in range(n)]
w = [0 for _ in range(n)]

for i in range(1, n):
    w[i] = w[i - 1] + 1 if S[i - 1] == 'W' else w[i - 1]
    e[-i - 1] = e[-i] + 1 if S[-i] == 'E' else e[-i]

res = [0 for _ in range(n)]

for i in range(n):
    res = w[i] + e[i]

print(min(res))


### FIXED CODE ###

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

e = [0 for _ in range(n)]
w = [0 for _ in range(n)]

for i in range(1, n):
    w[i] = w[i - 1] + 1 if s[i - 1] == 'W' else w[i - 1]
    e[-i - 1] = e[-i] + 1 if s[-i] == 'E' else e[-i]

res = [0 for _ in range(n)]

for i in range(n):
    res[i] = w[i] + e[i]

print(min(res))
# -*- coding: utf-8 -*-
import sys

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

dp = [0] * max(A)

for a in A:
    if dp[a-1] != 0:
        print('NO')
        break
    dp[a-1] = 1
else:
    print('YES')

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

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

dp = {}

for a in A:
    if a-2 in dp:
        print('NO')
        break
    dp[a-2] = 1
else:
    print('YES')
n,c = map(int,raw_input().split())

arr = [[0 for i in range((10**5) * 2)] for i in range(c)]

for i in range(n):
	s,t,ch = map(int,raw_input().split())
	arr[ch-1][s*2-1] = 1
	arr[ch-1][t*2] = -1

for i in range(c):
	for j in range(1,(10**5)*2):
		arr[i][j] = arr[i][j-1] + arr[i][j]



ans = 0
for i in range((10**5*2)):
	count = 0
	for j in range(c):
		if arr[j][i] > 0 :
			count += 1

	ans = max(ans,count)

print ans



### FIXED CODE ###

n, c = map(int, input().split())

r = [[0 for i in range(c)] for j in range(100000)] 
for dummy in range(n): 
    s, t, c = map(int, input().split())
    for j in range(s - 1, t):
        r[j][c - 1] = 1 

ans = 0
for i in range(100000):
    if sum(r[i]) > ans:
        ans = sum(r[i]) 

print(ans)
li = list(map(int,input().split()))
a = li[0]
b = li[1]
c = li[2]

list = []

for i in range(a + 1):
  ans = 0
  tmp = i

  while(i >= 1):
    ans += i % 10
    i = math.floor(i / 10)

  if b <= ans <= c:
    list.append(tmp)

data = 0
for e in list:
  data += e

print(data)

### FIXED CODE ###

import math

li = list(map(int,input().split()))
a = li[0]
b = li[1]
c = li[2]

list = []

for i in range(a + 1):
  ans = 0
  tmp = i

  while(i >= 1):
    ans += i % 10
    i = math.floor(i / 10)

  if b <= ans <= c:
    list.append(tmp)

data = 0
for e in list:
  data += e

print(data)
import numpy
print(input()*2*numpy.pi())

### FIXED CODE ###

import numpy
print(int(input())*2*numpy.pi)
A, B = map(int(input().split()))
print(A*B)


### FIXED CODE ###

A, B = map(int, input().split())
print(A*B)
a, b, c = input().split()
print((s1[0] + s2[0] + s3[0]).upper())

### FIXED CODE ###

a, b, c = input().split()
print((a[0] + b[0] + c[0]).upper())
import sys
h,w=map(int,input().split())
dr=[input()+'.' for _ in range(h)]
dr.append('.'*h)
frag='Yes'

if h==1 and w==1:
  print('Yes')
  sys.exit()

if dr[0][0]=='#':
  if dr[1][0]!='#' and dr[0][1]!='#':
    print('No')
    sys.exit()
for j in range(1,w-1):
  if dr[0][j]=='#':
    if dr[0][j+1]!='#' and dr[1][j]!='#' and dr[0][j-1]!='#':
      print('No')
      sys.exit()
if dr[0][w-1]=='#':
  if dr[1][w-1]!='#' and dr[0][w-2]!='#':
    print('No')
    sys.exit()
for i in range(1,h-2):
  if dr[i][0]=='#':
    if dr[i+1][0]!='#' and dr[i][1]!='#' and dr[i-1][0]!='#':
      print('No')
      sys.exit()
  for i in range(1,w-1):
    if dr[i][j]=='#':
      if dr[i][j+1]!='#' and dr[i+1][j]!='#' and dr[i-1][j]!='#' and dr[i][j-1]!='#':
        print('No')
        sys.exit()
  if dr[i][w-1]=='#':
    if dr[i+1][w-1]!='#' and dr[i-1][w-1]!='#' and dr[i][w-2]!='#':
      print('N0')
      sys.exit()
for j in range(w-1):
  if dr[h-1][j]=='#':
    if dr[h-1][j+1]!='#' and dr[h-1][j-1]!='#' and dr[h-2][j]!='#':
      print('No')
      sys.exit()
if dr[h-1][w-1]=='#':
  if dr[h-1][w-2]!='#' and dr[h-2][w-1]!='#':
    print('N0')
    sys.exit()
print('Yes')

### FIXED CODE ###

h,w=map(int,input().split())
a=['.'*(w+2)]+['.'+input()+'.' for _ in range(h)]+['.'*(w+2)]
for i in range(h):
  for j in range(w):
    if a[i][j]=='#':
      if not(a[i+1][j]=='#' or a[i-1][j]=='#' or a[i][j+1]=='#' or a[i][j-1]=='#'):
        print('No')
        exit()
print('Yes')
n = input()

n = int(n[1:])
if n > 0:
    ans = 1000 - n
else:
    ans = 0

print(ans)

### FIXED CODE ###

n = int(input())

if n >= 1000:
    n = int(str(n)[1:])

if n > 0:
    ans = 1000 - n
else:
    ans = 0

print(ans)
def main():
    N = int(input())
    x = sorted([(int(input()), i) for i in range(N)])
    ans = [0] * N
    for i in range(N//2):
        ans[x[i][1]] = x[N//2][0]
    for i in range(N//2, N):
        ans[x[i][1]] = x[N//2 - 1][0]
    for i in range(N):
        print(ans[i])

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    x = list(map(int, input().split()))
    x = sorted([(x[i], i) for i in range(N)])
    ans = [0] * N
    for i in range(N//2):
        ans[x[i][1]] = x[N//2][0]
    for i in range(N//2, N):
        ans[x[i][1]] = x[N//2 - 1][0]
    for i in range(N):
        print(ans[i])

if __name__ == "__main__":
    main()