Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
cnt = 0
for i in range(0, N-2):
    a = L[i]
    for j in range(i+1, N-1):
        b = L[j]
        for k in range(j+1, N):
            c = L[k]
            if a >= b + c or b >= c + a or c >= a + b:
                cnt += 1
                continue
                
print(N * (N - 1) * (N - 2) //  6 - cnt)

### FIXED CODE ###

N = int(input())
L = sorted(map(int, input().split()), reverse=True)
cnt = 0

for i in range(N - 2):
    c = L[i]
    
    for j in range(i + 1, N - 1):
        b = L[j]
        l = j
        r = N - 1
        
        while True:
            idx = -(-(l + r) // 2)
            
            if L[idx] > c - b:
                if l == idx:
                    break
                l = idx
            else:
                if r == idx:
                    break
                r = idx
                
        cnt += l - j
        
print(cnt)
### BUGGY CODE ###

from collections import deque

# 1から初めて、xがあるとき10x、x+1のいずれかが行えるとしてqueue

K = int(input())
q = deque()
q.append((1,1)) # 各桁の和、modulo K
visited = [False]*K

ans = 0

while ans == 0:
  s,x = q.popleft()
  visited[x] = True
  if x == 0:
    ans = s
    break
  q.appendleft((s,(10*x)%K))
  q.append((s+1,(x+1)%K))

print(ans)

### FIXED CODE ###

from collections import deque
 
# 1から初めて、xがあるとき10x、x+1のいずれかが行えるとしてqueue
 
K = int(input())
q = deque()
q.append((1,1)) # 各桁の和、modulo K
visited = [False]*K
 
ans = 0
 
while ans == 0:
  s,x = q.popleft()
  if visited[x]:
    continue
  visited[x] = True
  if x == 0:
    ans = s
    break
  q.appendleft((s,(10*x)%K))
  q.append((s+1,(x+1)%K))
 
print(ans)
### BUGGY CODE ###

import itertools

N = int(input())
l = list(map(int, input().split()))
t = list(itertools.combinations(l, 3))

count = 0
for i in t:
    i_s = sorted(i)
    a,b,c = i_s
    if a<b+c and b <a+c and c<a+b:
        count+=1
print(count)



### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans =0
for i in range(1,n):
    for j in range(i):
        p = l[i]+ l[j]
        q = bisect.bisect_left(l,p)
        ans += q-i-1

print(ans)
### BUGGY CODE ###

n=int(input())
l=list(map(int, input().split()))
count=0
l.sort()
l.reverse()


for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i]<l[j]+l[k]:
                count+=1
            else:
                break

print(count)
            
            


### FIXED CODE ###

import bisect

n=int(input())
l=list(map(int, input().split()))
count=0
l.sort()


for i in range(n):
    for j in range(i+1,n):
        k=l[i]+l[j]-1
        index = bisect.bisect_right(l,k,lo=j+1)
        count+=index-j-1
        

print(count)
### BUGGY CODE ###

x = int(input())
d = {0: None}
i = 0
while(True):
    flag = False
    i += 1
    d_keys = list(d.keys())
    for di in d_keys:
        xx = [di - i, di + i]
        if x in xx:
            flag = True
            break
        else:
            d[xx[0]] = None
            d[xx[1]] = None
    if flag:
        break
print(i)


### FIXED CODE ###

x = int(input())
xx = 0
i = 1
while(True):
    xx += i
    if xx >= x:
        print(i)
        break
    else:
        i += 1
### BUGGY CODE ###

import numpy as np
N,M=map(int,input().split())
A=[]
for _ in range(M):
    A.append(int(input()))

mod=10**9+7

dp=[0]*(N+1)
dp[0]=1
if 1 not in A:
    dp[1]=1
else:
    dp[1]=0

for i in range(2,N+1):
    if i in A:
        continue
    dp[i]=dp[i-1]+dp[i-2]
    dp[i]%=mod

print(int(dp[N]))

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for _ in range(M)])
INF = 1000000007

dp = [0] * (N + 1)
dp[0] = 1
if 1 not in a:
	dp[1] = 1
else:
	dp[1] = 0
for i in range(2, N + 1):
	if i in a:
		continue
	dp[i] = dp[i - 1] + dp[i - 2]
	dp[i] %= INF

print(dp[N])
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

H, W = map(int,input().split())
sth, stw = 0, 0
glh, glw = H-1, W-1

INF = 0
Gmap = [list(input()) for _ in range(H)]
Dist = [[INF]*W for _ in range(H)]
Seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (0,1)}
init_q =[]
mod = 10**9+7

from collections import deque

def bfs(init):
    next_q = deque([])
    for i in init:
        next_q.append(i)
        Dist[i[0]][i[1]] = 1

    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h,w = next_q.popleft()
        if Seen[h][w]==1:
            continue
        Seen[h][w]=1
        for d in direc:
            hs, ws = h + d[0], w + d[1]
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.':
                next_q.append([hs,ws])
                Dist[hs][ws] += Dist[h][w]
                Dist[hs][ws] %= mod
    return Dist

def main():
    #固定
    init_q.append([sth, stw])

    ret = bfs(init_q)
    print(ret[glh][glw])


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque
mod=10**9+7
H,W = map(int,input().split())
Gd = [list(input()) for _ in range(H)]
INF = 0
direc = [[1,0],[0,1]]
def dfs(start):
  Dis = [[INF]*W for _ in range(H)]
  Dis[start[0]][start[1]]=1
  q = deque([])# スタック
  q.append(start)
  while len(q)!=0:
    h,w = q.popleft()# スタック取りだし（先頭）
    for d in direc:
      hs, ws = h + d[0], w + d[1]
      if not (0<=hs<H and 0<=ws<W):
        continue
      if Gd[hs][ws]=='.':
        if Dis[hs][ws]==INF:
          q.append([hs,ws])
        Dis[hs][ws] = (Dis[hs][ws] + Dis[h][w])%mod
  return Dis[H-1][W-1]
print(dfs([0,0]))
### BUGGY CODE ###

H, W = map(int, input().split()) # 横に2個
state = [[0 if a == '.' else 1 for a in list(input())] for _ in range(H)]

checked = [[False for _ in range(W+1)] for _ in range(H+1)]
qs = []
for h in range(H):
    for w in range(W):
        if state[h][w] == 1:
            qs.append([h, w])
            checked[h][w] = True
for h in range(H+1):
    checked[h][W] = True
for w in range(W+1):
    checked[H][w] = True

c = -1
while qs:
    qqs = []
    for h,w in qs:
        checked[h][w] = True
        next = [[h+1, w], [h-1, w], [h, w+1], [h, w-1]]
        for hn, wn in next:
            if not checked[hn][wn]:
                qqs.append([hn, wn])
    c += 1
    qs = qqs

print(c)





### FIXED CODE ###

import sys
input = sys.stdin.readline

B = int(1E8)

def main():

    H, W = map(int, input().split())
    
    l = 0
    q = []
    checked = []
    for h in range(H):
        S = input()
        L = []
        for w in range(W):
            if S[w] == '#':
                l += 1
                L.append(True)
                q.append(B*h+w)
            else:
                L.append(False)
        checked.append(L)

    Next = [[[] for _ in range(W)] for _ in range(H)]
    for h in range(H):
        for w in range(W):
            if h != 0:
                Next[h][w].append(B*(h-1) + w)
            if h != H-1:
                Next[h][w].append(B*(h+1) + w)
            if w != 0:
                Next[h][w].append(B*h + w-1)
            if w != W-1:
                Next[h][w].append(B*h + w+1)

    c = -1
    for _ in range(H+W+2):
        qq = []
        if len(q) == 0:
            break
        for hw in q:
            h, w = hw//B, hw%B
            for nhw in Next[h][w]:
                nh, nw = nhw//B, nhw%B
                if not checked[nh][nw]:
                    qq.append(B*nh + nw)
                    checked[nh][nw] = True
        q = qq
        c += 1

    print(c)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

n, q = map(int, input().split())
default = 2**31 - 1

mindict = {}
answer_stk = []

for i in range(q) :
    query, x, y = map(int, input().split())
    
    if query == 0 :
        mindict[x] = y
    else :
        min_between = default
        for k in mindict.keys() :
            if k >= x and k <= y :
                min_between = min(min_between, mindict[k])
                
        answer_stk.append(min_between)
        
for a in answer_stk :
    print(a)
                
    


### FIXED CODE ###

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

# max_num
INF = 2**31 - 1

# generate seg tree
seg_size = 2

while seg_size < n :
    seg_size *= 2
    
seg_size = seg_size * 2 - 1
seg_tree = [INF for x in range(seg_size)]

answer_stk = []

# update 
def update(i, x) :
    # leaf for index @ i
    idx = seg_size // 2 + i
    seg_tree[idx] = x
    
    while idx :
        idx = (idx - 1) // 2
        l_child = seg_tree[idx * 2 + 1]
        r_child = seg_tree[idx * 2 + 2]
        
        seg_tree[idx] = min(l_child, r_child)

# query
def query(s, t, l, r, curnode) :
    # no overlap then return INF
    if s > r or t < l :
        return INF
    
    # full overlap then return current node
    if s <= l and t >= r :
        return seg_tree[curnode]
    
    # partial overlap then return min for next
    else :
        l_child = curnode * 2 + 1
        r_child = curnode * 2 + 2
        
        l_value = query(s, t, l, (l + r) // 2, l_child)
        r_value = query(s, t, (l + r) // 2 + 1, r, r_child)
        
        return min(l_value, r_value)
    
# do main query
for i in range(q) :
    q, x, y = map(int, input().split())
    
    # update
    if q == 0 :
        update(x, y)
        
    # query 
    else :
        answer_stk.append(query(x, y, 0, seg_size // 2, 0))
        
for a in answer_stk :
    print(a)
### BUGGY CODE ###

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

i=n-1
while i>=0:
	if A[i]==1:
		break
	i-=1

if i==-1:
	print(0)
elif i==0:
	print(1)
	print(1)
else:
	i=(i+1)//2-1
	while i>=0:
		B=[A[j] for j in range(i,n,i+1)]
		r=sum(B[1:])
		
		A[i]=A[i]^r%2
		
		i-=1
		C=[m for m,k in enumerate(A,1) if k!=0]
		print(len(C))
		print(*C)	

### FIXED CODE ###

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

i=n-1
while i>=0:
    if A[i]==1:
        s=i
        break
    i-=1

if i==-1:
    print(0)
elif s==0:
    print(1)
    print(1)
else:
    i=(s+1)//2-1
    while i>=0:
        B=[A[j] for j in range(i,n,i+1)]
        r=sum(B[1:])
        if r%2==0 and A[i]==0:
            A[i]=0
        elif r%2==0 and A[i]==1:
            A[i]=1
        elif r%2==1 and A[i]==0:
            A[i]=1
        else:
            A[i]=0
        i-=1
    C=[m for m,k in enumerate(A,1) if k!=0]
    print(len(C))
    print(*C)
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
for _ in range(q):
    l,r = map(int,input().split())
    print(s[l-1:r].count('AC'))

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
t = [0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
for i in range(q):
    l,r = map(int,input().split())
    print(t[r-1]-t[l-1])
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))

for i in range(k):
  b=[0]*n
  for j in range(n):
    for m in range(j-a[j],j+a[j]+1):
      if 0<=m<=n-1:
        b[m]=b[m]+1
  a=b
for i in a:
  print(i,end=' ')

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for _ in range(min(k,41)):
  b=[0]*(n+1)
  for i in range(n):
    l=max(0,i-a[i])
    r=min(n,i+a[i]+1)
    b[l]+=1
    b[r]-=1
  for i in range(n-1):
    b[i+1]+=b[i]
  a=b[:n]
print(*a)
### BUGGY CODE ###

def main():
    n,k = map(int,input().split())
    a = [int(i) for i in input().split()]
    ruiseki = [1]
    for i in range(n):
        ruiseki.append(ruiseki[-1]*a[i])
    #ruiseki.pop(0)
    
    ans = [ruiseki[k]/ruiseki[0]]
    for i in range(k+1,n+1):
        tmp = ruiseki[i]/ruiseki[i-k]
        if ans[-1] >= tmp:
            print('No')
        else:
            print('Yes')
        ans.append(tmp)
    
main()

### FIXED CODE ###

def main():
    n,k = map(int,input().split())
    a = [int(i) for i in input().split()]
    """
    ruiseki = [1]
    for i in range(n):
        ruiseki.append(ruiseki[-1]*a[i])
    #ruiseki.pop(0)
    
    ans = [ruiseki[k]/ruiseki[0]]
    for i in range(k+1,n+1):
        tmp = ruiseki[i]/ruiseki[i-k]
        if ans[-1] >= tmp:
            print('No')
        else:
            print('Yes')
        ans.append(tmp)
    """
    for i in range(k,n):
        if a[i]>a[i-k]:
            print('Yes')
        else:
            print('No')
main()
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    for j in range(a[i], n):
        if j-i == a[i]+a[j]:
            ans += 1
print(ans)

### FIXED CODE ###

import bisect
n = int(input())
a = list(map(int, input().split()))
ans = 0
l_dp = []
r_dp = []
for i in range(n):
    l_dp.append(a[i]+i)
    r_dp.append(n-i-1-a[n-i-1])
r_dp.sort()
for i in l_dp:
    if i < 0 or i >= n: continue
    l_index = bisect.bisect_left(r_dp, i)
    r_index = bisect.bisect_right(r_dp, i)
    ans += r_index - l_index
print(ans)
### BUGGY CODE ###

# D
import numpy as np
N = int(input())
X = np.zeros(N, dtype=int)
Y = np.zeros(N, dtype=int)

for i in range(N):
    x, y = map(int, input().split())
    X[i] = x
    Y[i] = y

# edges
X_s = np.argsort(X)
Y_s = np.argsort(Y)

edge_list = []
edge_weight = []
for i in range(N-1):
    edge_list.append([X_s[i], X_s[i+1]])
    edge_weight.append(min(abs(X[X_s[i+1]] - X[X_s[i]]), abs(Y[X_s[i+1]] - Y[X_s[i]])))
    edge_list.append([Y_s[i], Y_s[i+1]])
    edge_weight.append(min(abs(X[Y_s[i+1]] - X[Y_s[i]]), abs(Y[Y_s[i+1]] - Y[Y_s[i]])))
    
# sort edges
sel = np.argsort(np.array(edge_weight))

# union find tree
uf = dict()
for i in range(N):
    uf[i] = i

res = 0
flg = np.zeros(N)

for s in sel:
    m, n = edge_list[s]
    # find union
    gr_m = m
    gr_m_list = []
    gr_n = n
    gr_n_list = []
    while gr_m != uf[gr_m]:
        gr_m_list.append(gr_m)
        gr_m = uf[gr_m]
    for m_ in gr_m_list:
        uf[m_] = gr_m
        
    while gr_n != uf[gr_n]:
        gr_n_list.append(gr_n)
        gr_n = uf[gr_n]
    for n_ in gr_n_list:
        uf[n_] = gr_n
    if gr_m == gr_n:
        pass
    else:
        res += edge_weight[s]
        uf[gr_n] = gr_m
print(res)

### FIXED CODE ###

# D
import numpy as np
N = int(input())
X = []
Y = []

for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)

# edges
X_s = np.argsort(np.array(X))
Y_s = np.argsort(np.array(Y))

edge_list = []
edge_weight = []
for i in range(N-1):
    edge_list.append([X_s[i], X_s[i+1]])
    edge_weight.append(X[X_s[i+1]] - X[X_s[i]])
    edge_list.append([Y_s[i], Y_s[i+1]])
    edge_weight.append(Y[Y_s[i+1]] - Y[Y_s[i]])
    
# sort edges
sel = np.argsort(np.array(edge_weight))

# union find tree
uf = np.arange(N)


res = 0
flg = np.zeros(N)

for s in sel:
    m, n = edge_list[s]
    # find union
    gr_m = m
    gr_m_list = []
    gr_n = n
    gr_n_list = []
    while gr_m != uf[gr_m]:
        gr_m_list.append(gr_m)
        gr_m = uf[gr_m]
    for m_ in gr_m_list:
        uf[m_] = gr_m
        
    while gr_n != uf[gr_n]:
        gr_n_list.append(gr_n)
        gr_n = uf[gr_n]
    for n_ in gr_n_list:
        uf[n_] = gr_n
        
    if gr_m == gr_n:
        pass
    else:
        res += edge_weight[s]
        uf[gr_n] = gr_m
print(res)
### BUGGY CODE ###

import fractions

N = int(input())
ints = list(map(int, input().split()))
ints.sort(reverse=True)

gcd = 0
result = 1
holed_ints = []
for i in range(N):
    holed_ints = ints[:i] + ints[i+1:]
    gcd = 0
    for j in range(N-1):
        gcd = fractions.gcd(gcd, holed_ints[j])
        if gcd == 1:
            break
    if gcd > result:
        result = gcd

print(result)

### FIXED CODE ###

import fractions

integral_count = int(input())
blackboard_integers = list(map(int, input().split()))

gcd_integers = list(set(blackboard_integers))

gcd = 0
result = 1
for i in range(len(gcd_integers)):
    gcd = 0
    if blackboard_integers.count(gcd_integers[i]) >= 2:
        for n in gcd_integers:
            gcd = fractions.gcd(gcd, n)
    else:
        for n in gcd_integers[:i]:
            gcd = fractions.gcd(gcd, n)
        for n in gcd_integers[i+1:]:
            gcd = fractions.gcd(gcd, n)
    if gcd > result:
        result = gcd

print(result)
### BUGGY CODE ###

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()

 
for m in range(M):
    B,C = map(int,input().split())
    for i in range(B):
        if A[i] > C:
            break
        A[i] = C
    A.sort()
 
print(sum(A))

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
BC = [list(map(int, input().split())) for _ in range(M)]
BC.sort(key=lambda x:x[1], reverse=True)
 
ans = 0
b,c = BC.pop(0)
for i,a in enumerate(A):
    if b>=1:
        if c > a:
            ans += c
            b -= 1
        else:
            ans += a
    if b<=0:
        if len(BC)==0:
            ans += sum(A[i+1:])
            break
        else:
            b,c = BC.pop(0)
 
print(ans)
### BUGGY CODE ###

def countc(color,num):
  cnt=0
  if color=='#':
    for i in range(num):
      if S[i]=='#':
        cnt+=1
  else:
    for j in range(num,N):
      if S[j]=='.':
        cnt+=1
  return cnt


import sys
input=sys.stdin.readline
N=int(input())
S=input()[:-1]
c=N*2
for i in range(N+1):
  c = min(c,countc('#',i)+countc('.',i))
print(c)

### FIXED CODE ###

import sys
input=sys.stdin.readline
N=int(input())
S=input()
w=S.count('.')
c=w
for i in range(N):
  if S[i]=='.':
    w-=1
  else:
    w+=1
  c=min(c,w)
print(c)
### BUGGY CODE ###

import queue
from collections import deque
import numpy as np
n, x, y = map(int,input().split())
g = [[] for _ in range(n)] 
for i in range(n):
    if i == 0:
        g[i] = [i+1]
    elif i == n-1:
        g[i] = [i-1]
    else:
        g[i] = [i-1,i+1]
g[x-1].append(y-1)
g[y-1].append(x-1)

# if n%2==0:
#     ma = int(n/2)
# else:
#     ma = int((n+1)/2)
# print(ma)
d = []
ans = [0]*n
for i in range(n):
    start = i
    dist = [-1] * n
    dist[start] = 0
    # que = queue.Queue()
    # que.put(start)
    q = deque([start])
    while q:
        # v = que.get()
        v = q.popleft()
        for nv in g[v]:
            if dist[nv] != -1:
                continue
            dist[nv] = dist[v]+1
            # que.put(nv)
            q.append(nv)
    for i in dist:
        ans[i] += 1
    # d.append(dist)
# d = np.array(d).flatten()
for i in range(1,n):
    # print(int(np.count_nonzero(d==i)/2))
    print(int(ans[i]/2))


### FIXED CODE ###

def main():
    from collections import deque
    n,x,y=map(int,input().split())
    e=[[]for _ in range(n)]
    for i in range(n-1):
        e[i]+=i+1,
        e[i+1]+=i,
    e[x-1]+=y-1,
    e[y-1]+=x-1,
    a=[0]*n
    for s in range(n):
        d=[-1]*n
        d[s]=0
        q=deque([s])
        add,pop=q.append,q.popleft
        while q:
            v=pop()
            for w in e[v]:
                if d[w]<0:
                    d[w]=d[v]+1
                    add(w)
        for i in d:a[i]+=1
    print(' '.join(str(i//2)for i in a[1:]))
main()
### BUGGY CODE ###

n,m,k = map(int,input().split())
mod = 998244353
f = [m]
for i in range(1,n):
    f.append((f[i-1]*(m-1))%mod)
p = [1]
buns = 1
bunb = 1
for i in range(k):
    buns *= (n-1-i)
    buns %= mod
    bunb *= pow(i+1,mod-2,mod)
    p.append((bunb*buns)%mod)
ans = 0 
for i in range(k+1):
    ans += f[n-1-i]*p[i]
    ans %= mod
print(ans)

### FIXED CODE ###

def cmb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod

n,m,k = map(int,input().split())

mod = 998244353
fact = [1, 1]
factinv = [1, 1]
inv = [0,1]
rui = [1,m-1]

for i in range(2,n+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((inv[mod % i] * (mod - (mod // i))) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)
    rui.append(rui[-1]*(m-1) % mod)

ans = 0
for i in range(k+1):
    ans += cmb(n-1,i,mod)*m*rui[n-1-i]
    ans %= mod
print(ans)
### BUGGY CODE ###

import itertools
import numpy as np

res = 999999999999999999

H, W, K = [int(i) for i in input().split()]
arr = np.zeros((H, W), int)
for h in range(H):
  for w, v in enumerate(input()):
  	arr[h, w] = int(v)

for p in itertools.product([0, 1], repeat = H-1):
  sp = np.zeros((sum(p)+1, W), int)
  row = 0
  sp[0] += arr[0]
  for j in range(H-1):
    if p[j]:
      row += 1
    sp[row] += arr[j+1]
  if np.max(sp) > K:
    continue
  
  sum_arr = np.zeros(len(sp), int)
  cut_cnt = sum(p)
  for c in range(W):
    sum_arr += sp[:, c]
    if max(sum_arr) > K:
      sum_arr = sp[:, c]
      cut_cnt += 1
  if cut_cnt < res:
    res = cut_cnt
print(res)

### FIXED CODE ###

import itertools
import numpy as np

res = 999999999999999999

H, W, K = [int(i) for i in input().split()]
arr = []
for h in range(H):
  arr.append([int(v) for v in input()])

arr = np.vstack(arr)

for p in itertools.product([0, 1], repeat = H-1):
  if sum(p) > res:
    continue
  sp = np.zeros((sum(p)+1, W), int)
  row = 0
  sp[0] += arr[0]
  for j in range(H-1):
    if p[j]:
      row += 1
    sp[row] += arr[j+1]
  if np.max(sp) > K:
    continue
  
  sum_arr = np.zeros(len(sp), int)
  cut_cnt = sum(p)
  for c in range(W):
    sum_arr += sp[:, c]
    if max(sum_arr) > K:
      sum_arr = sp[:, c]
      cut_cnt += 1
      if cut_cnt > res:
        break
  if cut_cnt < res:
    res = cut_cnt
print(res)
### BUGGY CODE ###

import math
def comb(n,r):
   return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def main():
   N = int(input())
   a = list(map(int, input().split()))
   a.sort()
   if N==2:
      return str(max(a))+" "+str(min(a))

   k = a[N//2-1]
   kk = a[N//2]
   A = a[N-1]
   if comb(A,k) > comb(A,kk):
      return str(A)+" "+str(k)
   return str(a[N-1])+" "+str(kk)



print(main())



### FIXED CODE ###


def main():
   N = int(input())
   a = list(map(int, input().split()))
   a.sort()
   A = a.pop()
   k = A/2
   for i in a:
      if k - i == 0:
         B = i
         break
      else:
         sa = k - i
         if sa < 0:
            if abs(B-k)>abs(sa):
               B = i
            break
         B = i
   return str(A)+" "+str(B)
         


print(main())
### BUGGY CODE ###

k, s = map(int, input().split())

ans = 0
for x in range(k+1):
    if x > s:
        break
    if x+k+k < s:
        continue
    for y in range(k+1):
        xy = x+y
        if xy > s:
            break
        if xy+k < s:
            continue
        for z in range(k+1):
            xyz = x+y+z
            if xyz > s:
                break
            if xyz == s:
                ans += 1
print(ans)

### FIXED CODE ###

k, s = map(int, input().split())
 
ans = 0
for x in range(k+1):
    for y in range(k+1):
        ans += max(0, 0<=s-x-y<=k)
print(ans)