Harryxun/stf_run huggingface dataset:
import math


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

minimum = x[0]
for i in range(len(x)):
    x[i] = x[i] - X
    minimum = min(x[i], minimum)
# print(x, minimum)

gcd = math.gcd(x[0], x[0])
for i in range(len(x)):
    gcd = math.gcd(gcd, x[i])
    # print(gcd)
print(gcd)


### FIXED CODE ###

import fractions

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

minimum = x[0]
for i in range(len(x)):
    x[i] = x[i] - X
    minimum = min(x[i], minimum)
# print(x, minimum)

gcd_value = fractions.gcd(x[0], x[0])
for i in range(len(x)):
    gcd_value = abs(fractions.gcd(gcd_value, x[i]))
    # print(gcd)
print(gcd_value)
import sys
# input = sys.stdin.readline

def main():
    N = int(input())
    S = input()
    
    for i in range(1, N-1):
        left = set(S[:i])
        right = set(S[i:])

        yield len(left & right)


print(max(main()))

### FIXED CODE ###

import sys
# input = sys.stdin.readline

def main():
    N = int(input())
    S = input()
    
    for i in range(N):
        left = set(S[:i])
        right = set(S[i:])

        yield len(left & right)


print(max(main()))
from sys import stdin

def main():
    h = [int(x) for x in stdin.readline().rstrip().split()]
    kyu = 8
    if 600 <= h and h < 800:
        kyu = 7
    if 800 <= h and h < 1000:
        kyu = 6
    if 1000 <= h and h < 1200:
        kyu = 5
    if 1200 <= h and h < 1400:
        kyu = 4
    if 1400 <= h and h < 1600:
        kyu = 3
    if 1600 <= h and h < 1800:
        kyu = 2
    if 1800 <= h and h < 2000:
        kyu = 1
    print(kyu)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin

def main():
    h = int(input())
    kyu = 8
    if 600 <= h and h < 800:
        kyu = 7
    if 800 <= h and h < 1000:
        kyu = 6
    if 1000 <= h and h < 1200:
        kyu = 5
    if 1200 <= h and h < 1400:
        kyu = 4
    if 1400 <= h and h < 1600:
        kyu = 3
    if 1600 <= h and h < 1800:
        kyu = 2
    if 1800 <= h and h < 2000:
        kyu = 1
    print(kyu)
    
if __name__ == "__main__":
    main()
a = [x for x in input().split()]
if a[0] == a[1]:
    if a[0] != a[2] and a[2] == a[3]:
        print("Yes")
    else:
        print("No")
else:
    if a[0] == a[2] and a[1] == a[3]:
        print("Yes")
    elif a[0] == a[3] and a[1] == a[2]:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

a = input()
if a[0] == a[1]:
    if a[0] != a[2] and a[2] == a[3]:
        print("Yes")
    else:
        print("No")
else:
    if a[0] == a[2] and a[1] == a[3]:
        print("Yes")
    elif a[0] == a[3] and a[1] == a[2]:
        print("Yes")
    else:
        print("No")
n,m,k=map(int,input().split())

L=[[] for i in range(1+n)]
N=[]
Ncnt=[0 for i in range(1+n)]
C=[0 for i in range(1+n)]

for inp in range(m):
    a,b=map(int,input().split())
    L[a].append(b)
    L[b].append(a)

for inp in range(k):
    a,b=map(int,input().split())
    N.append((a,b))

def tansa(x,gone,color):
    C[x]=color
    for nex in L[x]:
        if nex in gone:
            continue
        else:
            tansa(nex,gone+[nex],color)

now=1
for i in range(1,n):
    if C[i]==0:
        tansa(i,[i],now)
        now+=1

CC=sorted(C)

cnt=0
ccres=[]
for i in range(now):
    ccres.append(CC.index(i))
ccres.append(n+1)
dic={i:ccres[i+1]-ccres[i] for i in range(1,now)}

#print(C)
#print(dic)

for i in range(k):
    if C[N[i][1]] == C[N[i][0]]:
        Ncnt[N[i][1]]+=1
        Ncnt[N[i][0]]+=1

for i in range(1,n):
    print(dic[C[i]]-len(L[i])-Ncnt[i]-1,end=" ")
i=n
print(dic[C[i]]-len(L[i])-Ncnt[i]-1,end="")

### FIXED CODE ###

n,m,k=map(int,input().split())
BAD=[0 for i in range(n+1)]

E=[]
for inp in range(m):
    a,b=map(int,input().split())
    E.append((a,b))
    BAD[a]-=1
    BAD[b]-=1

B=[] 
for inp in range(k):
    a,b=map(int,input().split())
    B.append((a,b))
    
uf=[i for i in range(n+1)]
def uf_find(x,uf=uf):
    while uf[x]!=x:
        x=uf[x]
    return x       


res=[]

for ele in E:
    if uf_find(ele[0]) == uf_find(ele[1]):
        continue
    else:
        res.append((ele[0],ele[1])) #write result
        
        if uf_find(ele[0])>uf_find(ele[1]):
            uf[uf_find(ele[0])]=uf_find(ele[1])
        else:
            uf[uf_find(ele[1])]=uf_find(ele[0])

SCO=[0 for i in range(n+1)]
for i in range(1,n+1):
    SCO[uf_find(i)]+=1


for bl in B:
    if uf_find(bl[0])==uf_find(bl[1]):
        BAD[bl[0]]-=1
        BAD[bl[1]]-=1

ANS=[str(SCO[uf_find(i)] + BAD[i] -1) for i in range(1,n+1)]
print(" ".join(ANS))
N, u, v = map(int, input().split())
tree = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  tree[a-1].append(b-1)
  tree[b-1].append(a-1)
#print(tree)

def calc_dist(dlist, n, dist, nnode):
  for c in tree[n]:
    if c == nnode:
      continue
    dlist[c] = dist
    calc_dist(dlist, c, dist+1, n)
    
u_dist_list = [0] * N
calc_dist(u_dist_list, u-1, 1, -1)
#print(u_dist_list)

v_dist_list = [0] * N
calc_dist(v_dist_list, v-1, 1, -1)
#print(v_dist_list)

ans = 0
for i in range(N):
  if (v_dist_list[i] - u_dist_list[i]) > 0 and v_dist_list[i] > ans:
    ans = v_dist_list[i] - 1
    
print(ans)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**6)

N, u, v = map(int, input().split())
tree = [[] for _ in range(N)]
for _ in range(N-1):
  a, b = map(int, input().split())
  tree[a-1].append(b-1)
  tree[b-1].append(a-1)
#print(tree)

def calc_dist(dlist, n, dist, nnode):
  for c in tree[n]:
    if c == nnode:
      continue
    dlist[c] = dist
    calc_dist(dlist, c, dist+1, n)
    
u_dist_list = [0] * N
calc_dist(u_dist_list, u-1, 1, -1)
#print(u_dist_list)

v_dist_list = [0] * N
calc_dist(v_dist_list, v-1, 1, -1)
#print(v_dist_list)

ans = 0
for i in range(N):
  if (v_dist_list[i] - u_dist_list[i]) > 0 and v_dist_list[i] > ans:
    ans = v_dist_list[i] - 1
    
print(ans)
number = input().split()
if number[0] + number[1] + number[2] >= 22:
  print(bust)
else:
  print(win)  

### FIXED CODE ###

number = input().split()
if int(number[0]) + int(number[1]) + int(number[2]) >= 22:
  print('bust')
else:
  print('win')
strList = input()
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print(Yes)
else:
  print(No)


### FIXED CODE ###

strList = list(input())
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print("Yes")
else:
  print("No")
n = len(s)
cou = [0 for i in range(n+1)]
cou[1]= s[-1]
coum = [0 for i in range(2019)]
for i in range(1,n):
  cou[i+1] = s[n-i-1]+ str(cou[i])
  a = int(cou[i+1])
  coum[a%2019] += 1
coum[0] += 1
coum[int(s[-1])]+= 1
ans = 0
for i in coum:
    ans += i*(i-1)*0.5
print(int(ans))

### FIXED CODE ###

s,w = map(int,input().split())
if s<=w:
  print("unsafe")
else:
  print("safe")
import sys
import bisect
import math
input = sys.stdin.readline

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

mc = max(l)[1]
mc_sqrt = math.sqrt(mc)

prime = [i for i in range(2, mc + 1)]
c = 0
while True:
    if c >= len(prime):
        break
    t = prime[c]
    prime = [v for v in prime if v == t or v % t != 0]
    c = c + 1
    if c >= mc_sqrt:
        break
        
cum = [0 for i in range(mc + 1)]
for i in range(len(cum)):
    prime_index = bisect.bisect_left(prime, i)
    
    n2 = (i + 1) / 2
    prime_index2 = bisect.bisect_left(prime, n2)
    if len(prime) > prime_index and len(prime) > prime_index2 and prime[prime_index] == i and prime[prime_index2] == n2:
        cum[i] = cum[i - 1] + 1
    else:
        cum[i] = cum[i - 1]
        
for x, y in l:
    p = cum[x] - cum[x - 1]
    if x != y:
        p += cum[y] - cum[x]
    print(p)

### FIXED CODE ###

import sys
import bisect
import math
input = sys.stdin.readline

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

mc = 0
for v in l:
    mc = max(mc, v[1])
mc_sqrt = math.sqrt(mc)

prime = [i for i in range(2, mc + 1)]
c = 0
while True:
    if c >= len(prime):
        break
    t = prime[c]
    prime = [v for v in prime if v == t or v % t != 0]
    c = c + 1
    if c >= mc_sqrt:
        break
        
cum = [0 for i in range(mc + 1)]
for i in range(len(cum)):
    prime_index = bisect.bisect_left(prime, i)
    
    n2 = (i + 1) / 2
    prime_index2 = bisect.bisect_left(prime, n2)
    if len(prime) > prime_index and len(prime) > prime_index2 and prime[prime_index] == i and prime[prime_index2] == n2:
        cum[i] = cum[i - 1] + 1
    else:
        if i - 1 < 0:
            cum[i] = 0
        else:
            cum[i] = cum[i - 1]

for t in l:
    x, y = t[0], t[1]
    p = 0
    if 0 <= x - 1:
        p = cum[x] - cum[x - 1]
    if x != y:
        p += cum[y] - cum[x]
    print(p)
S = list(input())
T = list(input())

for i in range(len(s)):
  if T[i] != S[i]:
    print('No')
    exit(0)
print('Yes')

### FIXED CODE ###

S = list(input())
T = list(input())

for i in range(len(S)):
  if T[i] != S[i]:
    print('No')
    exit(0)
print('Yes')
from collections import deque
import sys
sys.setrecursionlimit(100000000)
 
h,w=map(int, input().split())  
s=[list(input()) for i in range(h)]
v=[]
def bfs():
    d = [[float("inf")] * w for i in range(h)]
    que = deque([])
    #黒だったらスタートキューに入れる
    for i in range(h):
        for j in range(w):
            if s[i][j]=='#':
                que.append((i, j))
                d[i][j]=0
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    
    
    while que:
        p = que.popleft()
         # 黒にする4方向をループ
        for i in range(4):
            ny = p[0] + dx[i]
            nx = p[1] + dy[i]
 
            if 0<=nx<w and 0<=ny<h and d[ny][nx] == float("inf"):
                que.append((ny, nx))
                d[nx][ny] = d[p[0]][p[1]] + 1
                
    for i in range(h):
        v.append(max(d[i]))
    return max(v)
res=bfs()
print(res)

### FIXED CODE ###

from collections import deque
 
h, w = map(int, input().split())
s = [input() for i in range(h)]
 
d = [[h+w for j in range(w)] for i in range(h)]
que = deque()
 
#黒だったらスタートキューに入れる
for i in range(h):
  for j in range(w):
    if s[i][j]=='#':
        que.append((i, j))
        d[i][j] = 0
 
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
 
 
while que:
    p = que.popleft()
    # 黒にする4方向をループ
    for i in range(4):
        nx = p[1] + dx[i]
        ny = p[0] + dy[i]
 
        if (0<=nx<w) and (0<=ny<h) and (d[ny][nx]==h+w):
            que.append((ny, nx))
            d[ny][nx] = d[p[0]][p[1]] + 1
 
res = max(map(max, d))
print(res)
params = input().split(' ')
n = eval(params[1])

AC = set()
WA = {}

penalties = 0
points = 0

for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])
    status = submission[1]
    
    if p in AC:
        continue
    
    if status == 'AC':
        AC.add(p)
        points += 1
        penalties += getPenalties(p)
    
    elif p in WA:
        WA[p] += 1

    else:
        WA[p] = 1

print(points, penalties)


def getPenalties(x):
    if x in WA:
        return WA[x]
    return 0


### FIXED CODE ###

params = input().split(' ')
m = eval(params[0])
n = eval(params[1])

penaltyCount = []

for i in range(m):
    penaltyCount.append(0)

penalties = 0
points = 0

for i in range(n):
    submission = input().split(' ')
    p = eval(submission[0])-1
    status = submission[1]
    
    if penaltyCount[p] == -1:
        continue

    if status == 'AC':
        penalties += penaltyCount[p]
        penaltyCount[p] = -1
        points += 1
    else:
        penaltyCount[p] += 1


print(points, penalties)
N = int(input())
S = [input() for i in range(N)]
return len(set(S))

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]
print(len(set(S)))
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)
def gau(n):
    return (n-1)*(n-2)//2

def main():
    N = int(input())
    A = list(map(int,input().split()))
    from collections import defaultdict
    dic = defaultdict(int)
    for i in range(len(A)):
        dic[A[i]]+=1
    klis = sorted(dic.keys(),key=lambda x: -x)
    klis
    for i in len(klis):
        if i == 0 and dic[i] != 1:
            print("No")
            exit()
        elif dic[i] > N-(i-1):
            print("No")
            exit()
    print("Yes")
if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import exit, stderr, stdin
input = stdin.readline
from collections import defaultdict
from sys import stderr
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return
def main():
    N = int(input())
    S = [int(a) for a in input().split()]
    S = sorted(S)
    exist = [S.pop()]
    debug(S)
    debug(exist)
    for i in range(N):
        next_exist = []
        next_s = []
        for p in exist[::-1]:
            while S:
                x = S.pop()
                if x < p:
                    next_exist.append(x)
                    break
                else:
                    next_s.append(x)
        exist += next_exist
        exist.sort()
        S += next_s[::-1]

    if len(exist) == 2**N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

if __name__ == "__main__":
    main()
N = int(input())
a = [int(input()) for _ in range(N)]
ans = 1
seen = [0] * N
seen[0] = 1
now = a[0]

while True:
    if now == 1 or seen[now] == 1:
        print(-1)
        break
    if now == 2:
        print(ans)
        break
    now = a[now-1]
    seen[now] = 1
    ans += 1

### FIXED CODE ###

N = int(input())
button_list = [int(input()) for i in range(N)]
button =  1
count = 0

while True:
    button = button_list[button-1]
    count += 1
    if button == 2:
        break
    if count == N:
        print(-1)
        exit()
print(count)
a, b, k = [int(i) for i in input().split()]

tmp = list(range(a, b+1))

ans = tmp[:k]
ans.extend(tmp[-1*k:])

for i in list(set(ans)):
    print(i)


### FIXED CODE ###

a, b, k = [int(i) for i in input().split()]

if k < b-a+1:
    tmp1 = list(range(a, a+k))
    tmp2 = list(range(b-k+1, b+1))
    tmp1.extend(tmp2)
    tmp = sorted(list(set(tmp1)))
    
else:
    tmp = list(range(a, b+1))
    
for i in tmp:
    print(i)
N,A,B = list(map(int,input().split()))
s = 0
for i in range(1,N+1):
  lis = list(str(i))
  if A <= sum(lis) and sum(lis) <= B:
    s += i
print (s)
    

### FIXED CODE ###

N,A,B = list(map(int,input().split()))
s = 0
for i in range(1,N+1):
  lis = list(map(int,list(str(i))))
  if A <= sum(lis) and sum(lis) <= B:
    s += i
print (s)
n=int(input())
X=[]
Y=[]
H=[]
MAX=100
for i in range(n):
    x,y,h=map(int,input().split())
    X.append(x)
    Y.append(y)
    H.append(h)
for posX in range(MAX+1):
    for posY in range(MAX+1):
        needH=-1
        for i in range(n):
            if H[i]>0:
                tmp=H[i]+abs(X[i]-posX)+abs(Y[i]-posY)
                if needH==-1:
                    needH=tmp
                else:
                    if needH!=tmp:
                        needH=-2
                        break
  
        if needH==-2:
            continue
        for i in range(n):
            if H[i]==0:    
                dis=abs(X[i]-posX)+abs(Y[i]-posY)
                if needH>dist:
                    needH=-2
                    break         
        if needH==-2:
            continue
        print(posX,posY,needH)
        exit()
~                                                                                         
~              

### FIXED CODE ###

import sys
n=int(input())
X=[]
Y=[]
H=[]
MAX=100
for i in range(n):
    x,y,h=map(int,input().split())
    X.append(x)
    Y.append(y)
    H.append(h)
for posX in range(MAX+1):
    for posY in range(MAX+1):
        needH=-1
        for i in range(n):
            if H[i]>0:
                tmp=H[i]+abs(X[i]-posX)+abs(Y[i]-posY)
                if needH==-1:
                    needH=tmp
                else:
                    if needH!=tmp:
                        needH=-2
                        break
                 
        if needH==-2:
            continue
        for i in range(n):
            if H[i]==0: 
                dis=abs(X[i]-posX)+abs(Y[i]-posY)
                if needH>dis:
                    needH=-2
                    break 
        if needH==-2:
            continue
        print(posX,posY,needH)
import math

x, y = map(int, input().split())
m = (2*x-y)/3
n = (-x+2*y)/3

if m.is_integer() == n.is_integer() == True:
    ans = math.factorial(m+n)//(math.factorial(m) * math.factorial(n))
else:
    ans = 0

print(int(ans%(10**9+7)))

### FIXED CODE ###

MAX = 1000010
finv = [0] * MAX
inv = [0] * MAX
def COMinit():
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD

def COM(n, k):
    res = 1
    for i in range(k):
        res = res * (n-i) % MOD
    return res * finv[k] % MOD

MOD = 10**9+7
x, y = map(int, input().split())
s, t = (-x+2*y)/3, (2*x-y)/3

if s < 0 or t < 0:
    ans = 0
elif not (s.is_integer() and t.is_integer()):
    ans = 0
else:
    s, t = int(s), int(t)
    COMinit()
    ans = COM((s+t), s)

print(ans)
a, b=map(int, input().split())
c = a // (b // 2)
c = c //2 + c% 2
d = a // b
print(c**3 + d **3)

### FIXED CODE ###

a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c%2
except Exception as  e:
    c = 0
if b % 2 == 1:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
print(c**3 + d**3)
n=int(input())
s=list(map(int,input().split()))
ans=0
z=list(set(s))
m=len(z)
for i in range(m):
    ans+=s.count(z[i])*(2**(m-1))
print(ans-m+1)

    

### FIXED CODE ###

n=int(input())
s=list(input())
mod=10**9+7
z=list(set(s))
ans=1

m=len(z)
for i in range(m):   
    ans*=(s.count(z[i])+1)%mod
    ans=ans%mod
print((ans-1)%mod)
n, *CSF = map(int, open(0).read().split())
A = []
for i in range(0, 3*(n-1), 3):
    t = 0
    for c, s, f in zip(CSF[i::3], CSF[i+1::3], CSF[i+2::3]):
        if t <= s:
            t = s + c
        else:
            t = ceil((t-s) / f) * f + s + c
    A.append(t)
A.append(0)
print(*A, sep='\n')

### FIXED CODE ###

from math import ceil
n, *CSF = map(int, open(0).read().split())
A = []
for i in range(0, 3*(n-1), 3):
    t = 0
    for c, s, f in zip(CSF[i::3], CSF[i+1::3], CSF[i+2::3]):
        if t <= s:
            t = s + c
        else:
            t = ceil((t-s) / f) * f + s + c
    A.append(t)
A.append(0)
print(*A, sep='\n')
def regtri(a, b, c):
    if a == b && b == c:
        returm 'Yes'
    else:
        return 'No'

a, b, c = (int(i) for i in input().split())
regtri(a, b, c)

### FIXED CODE ###

def regtri(a, b, c):
    if a == b and b == c:
        return 'Yes'
    else:
        return  'No'
 
a, b, c = (int(i) for i in input().split())
print(regtri(a, b, c))
import collections
N=int(input())
A=collections.Counter(list(map(int,input().split())))
if N%2==0:
  for i in range(0,N,2):
    if i%2==0 and A[i]==0:
      pass
    elif i%2==a and A[i]==2:
      pass
    else:
        print(0);exit()
else:
  for i in range(N):
    if i==0 and A[i]==1:
      continue
    if i%2==0 and A[i]==2:
      pass
    elif i%2==1 and A[i]==0:
      pass
    else:
      print(0);exit()
print(pow(2,N//2,10**9+7 ))

### FIXED CODE ###

import collections
N=int(input())
A=collections.Counter(list(map(int,input().split())))
if N%2==0:
  for i in range(0,N,2):
    if i%2==0 and A[i]==0:
      pass
    elif i%2==1 and A[i]==2:
      pass
    else:
        print(0);exit(0)
else:
  for i in range(N):
    if i==0 and A[i]==1:
      continue
    if i%2==0 and A[i]==2:
      pass
    elif i%2==1 and A[i]==0:
      pass
    else:
      print(0);exit(0)
print(pow(2,N//2,10**9+7 ))
pi = 3.1415926535

a = input()
ans = a * 2 * pi
print(ans)

### FIXED CODE ###

#copy
import math

R = int(input())
print(R * 2 * math.pi)
X = int(input)

if X >= 30:
  print('yes')
else:
  print('no')
  

### FIXED CODE ###

import sys

X = int(input())

if X >= 30:
  print('Yes')
else:
  print('No')
a,b=int(input())
print((a+b)*2,a*b)


### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,(a+b)*2)
x = list(map(int,input().split()))

while x[1] != 0 and x[2] != 0:
    x.sort()
    print(x[1],x[2])
    x = list(map(int, input().split()))


### FIXED CODE ###

while True :
    x, y = sorted(map(int, input().split()))
    if x == y and y == 0 : break
    print(x, y)
import sys
def median_of_medians(A, i):

    #divide A into sublists of len 5
    sublists = [A[j:j+5] for j in range(0, len(A), 5)]
    medians = [sorted(sublist)[len(sublist)//2] for sublist in sublists]
    if len(medians) <= 5:
        pivot = sorted(medians)[len(medians)//2]
    else:
        #the pivot is the median of the medians
        pivot = median_of_medians(medians, len(medians)//2)

    #partitioning step
    low = [j for j in A if j < pivot]
    high = [j for j in A if j > pivot]

    k = len(low)
    if i < k:
        return median_of_medians(low,i)
    elif i > k:
        return median_of_medians(high,i-k-1)
    else: #pivot = k
        return pivot

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
if n ==  1:
  print(a[0])
elif n == 2:
  a.sort()
  print(a[-1])
else:
  print (median_of_medians(a, n//2+1))

### FIXED CODE ###

import sys
class BIT:
    def __init__(self, node_size):
        self._node = node_size+1
        self.bit = [0]*self._node

    def add(self, index, add_val):
        while index < self._node:
            self.bit[index] += add_val
            index += index & -index

    def sum(self, index):
        res = 0
        while index > 0:
            res += self.bit[index]
            index -= index & -index
        return res
def cheak(x):
  c = [0] * n
  for i in range(n):
    if a[i] >= x:
      c[i] = 1
    else:
      c[i] = -1
  ru = [0] * (n+1)
  for i in range(1,n+1):
    ru[i] = c[i-1] + ru[i-1]
  ans = 0
  bit = BIT(n+2)
  MIN = min(ru)
  for i in range(len(ru)):
    ans += i - bit.sum(ru[i]-MIN+1)
    bit.add(ru[i]-MIN+1, 1)
  if ans <= n*(n+1)//4:
    return 1
  else:
    return 0
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
b = sorted(a)
dai = n-1
syo = 0
while True:
  if dai-syo <= 1:
    break
  kon = b[(dai+syo)//2]
  d = cheak(kon)
  if d == 1:
    syo = (dai+syo)//2
  else:
    dai = (dai+syo)//2
if cheak(b[dai]) == 1:
  print(b[dai])
else:
  print(b[syo])
import re

S = input()

a = [-1] * (len(S) + 1)

zero_pos = []
if S[0] == "<":
    zero_pos.append(0)
    a[0] = 0
if S[-1] == ">":
    zero_pos.append(len(S) + 1)
    a[-1] = 0
for i in range(len(S)):
    if S[i:i+2] == "><":
        zero_pos.append(i + 1)
        a[i + 1] = 0

for j in zero_pos:
    if j == len(S):
        a[j + 1] = 1
    elif j > len(S):
        continue
    elif j == len(S) - 1:
        a[-1] = 1
    elif j == 0:
        v = 0
        while S[j + 1] == "<":
            a[j + 1] = v + 1
            j += 1
            v += 1
    else:
        v = 0
        while S[j + 1] == "<":
            a[j + 1] = v + 1
            j += 1
            v += 1
        a[j + 1] = v + 1

for k in zero_pos:
    if k == 0:
        continue
    elif k == len(S) + 1:
        v = 0
        while S[k - 2] == ">":
            a[k - 2] = v + 1
            k -= 1
            v += 1
    else:
        v = 0
        while a[k - 1] == -1:
            a[k - 1] = v + 1
            k -= 1
            v += 1

sum = 0
for m in a:
    sum += int(m)
print(sum)






### FIXED CODE ###

S = input()

a = [-1] * (len(S) + 1)

# find zero positions
if S[0] == "<":
    a[0] = 0

if S[-1] == ">":
    a[-1] = 0

for i in range(len(S)):
    if S[i:i+2] == "><":
        a[i + 1] = 0

for i in range(len(S)):
    if S[i] == "<":
        a[i + 1] = a[i] + 1

for i in reversed(range(len(S))):
    if S[i] == ">" and a[i + 1] >= 0:
        a[i] = max(a[i], a[i + 1] + 1)

print(sum(a))