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

n,x,y=map(int,input().split())
l=[]
for i in range(n-1):
  for k in range (i+1,n):
      l.append(min(abs(x-1-i)+abs(y-1-k)+1,k-i))
for i in range(1,n):
  print(l.count(i))
      

### FIXED CODE ###

from collections import Counter
n,x,y=map(int,input().split())
l=[]
for i in range(n-1):
  for k in range (i+1,n):
      l.append(min(abs(x-1-i)+abs(y-1-k)+1,k-i))
S=Counter(l)
for i in range(1,n):
  print(S[i])
### BUGGY CODE ###

S = input().strip()
T = input().strip()

import bisect
from collections import defaultdict
ti = defaultdict(list)

for i, c in enumerate(T):
  ti[c].append(i)

dp = {}
dp[-1] = []

for c in S:
  ndp = {}
  for k, v in dp.items():
    #j = T.find(c, k+1)
    l = bisect.bisect_left(ti[c], k+1)
    if l < len(ti[c]):
      j = ti[c][l]
    else:
      j = -1
    if k not in ndp or (len(v) > len(ndp[k])):
      ndp[k] = v[:]
    if j != -1:
      if j not in ndp or (len(v) + 1 > len(ndp[j])):
        ndp[j] = v[:] + [c]
  dp = ndp

ans = ''
for s in list(map(lambda x: ''.join(x), dp.values())):
  if len(s) > len(ans):
    ans = s
print(ans)


### FIXED CODE ###

S = input().strip()
T = input().strip()


dp = [[0] * (len(T)+1) for _ in range(len(S)+1)]

for i, s in enumerate(S):
  for j, t in enumerate(T):
    if s == t:
      dp[i][j] = dp[i-1][j-1] + 1
    else:
      dp[i][j] = max(dp[i][j-1], dp[i-1][j])
ans = []
s = (len(S)-1, len(T)-1)
while True:
  x, y = s
  if x < 0 or y < 0:
    break
  if S[x] == T[y]:
    ans.append(S[x])
    s = (x-1, y-1)
  else:
    if dp[x-1][y] > dp[x][y-1]:
      s = (x-1, y)
    else:
      s = (x, y-1)

    
print(''.join(reversed(ans)))
### BUGGY CODE ###

# ABC171 E 

import itertools

n = int(input())
a_l = [list(format(int(x), "030b")) for x in input().split()]

for _d,_tp in enumerate(zip(*a_l)):
    if "1" not in _tp:
        continue
    if "0" not in _tp:
        continue
    else:
        _num = _tp.count("0")
        if _num % 2 == 1:
            for i in range(n):
                if a_l[i][_d] == "0":
                    a_l[i][_d] = "1"
                else:
                    a_l[i][_d] = "0"

print(*[int("".join(x), 2) for x in a_l])

### FIXED CODE ###

# ABC171 E 

import itertools

n = int(input())
a_l = [list(format(int(x), "030b")) for x in input().split()]

for _d,_tp in enumerate(zip(*a_l)):
    if "1" not in _tp:
        continue
    if "0" not in _tp:
        continue
    else:
        _num = _tp.count("0")
        if _num % 2 == 1:
            for i in range(n):
                if a_l[i][_d] == "0":
                    a_l[i][_d] = "1"
                else:
                    a_l[i][_d] = "0"

print(*[int("".join(x), 2) for x in a_l])
### BUGGY CODE ###

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

for i in range(n):
    if i != n-1:
        print(a_l.index(i+1)+1, end=" ")
    else:
        print(a_l.index(i+1)+1)


### FIXED CODE ###

n = int(input())
ans = [0]*n

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

for i in range(n):
    ans[a_l[i]-1] += i+1

st = ''
for a in ans:
    st += str(a)+' '

print(st)
### BUGGY CODE ###

MOD = 10 ** 9 + 7


def solve(k, s):
    res = 0
    factorial = [1] * (2 * 10 ** 6)
    factorial_inv = [1] * (2 * 10 ** 6)
    for i in range(1, 2 * 10 ** 6):
        factorial[i] = factorial[i - 1] * i % MOD
    factorial_inv[-1] = pow(factorial[-1], MOD - 2, MOD)
    for i in range(2 * 10 ** 6 - 1, 0, -1):
        factorial_inv[i - 1] = factorial_inv[i] * i % MOD
    # print(factorial[:5])
    # print(factorial_inv[:5])
    for i in range(k + 1):
        left = k - i + len(s) - 1
        right = len(s) - 1
        ncr = (factorial[left] * factorial_inv[right] * factorial_inv[left - right]) % MOD
        add = (ncr * pow(25, k - i, MOD) * pow(26, i, MOD)) % MOD
        res += add
        res %= MOD
    # print(res)
    return res


def main():
    k = int(input())
    s = input()
    res = solve(k, s)
    print(res)


def test():
    assert solve(1, "abc") == 25 + 25 + 25 + 26
    assert solve(5, "oof") == 575111451
    assert solve(37564, "whydidyoudesertme") == 318008117


if __name__ == "__main__":
    test()
    main()


### FIXED CODE ###

MOD = 10 ** 9 + 7


def solve(k, s):
    res = 0
    factorial = [1] * (2 * 10 ** 6)
    factorial_inv = [1] * (2 * 10 ** 6)
    for i in range(1, 2 * 10 ** 6):
        factorial[i] = factorial[i - 1] * i % MOD
    factorial_inv[-1] = pow(factorial[-1], MOD - 2, MOD)
    for i in range(2 * 10 ** 6 - 1, 0, -1):
        factorial_inv[i - 1] = factorial_inv[i] * i % MOD
    # print(factorial[:5])
    # print(factorial_inv[:5])
    for i in range(k + 1):
        left = k - i + len(s) - 1
        right = len(s) - 1
        ncr = (factorial[left] * factorial_inv[right] * factorial_inv[left - right]) % MOD
        add = (ncr * pow(25, k - i, MOD) * pow(26, i, MOD)) % MOD
        res += add
        res %= MOD
    # print(res)
    return res


def main():
    k = int(input())
    s = input()
    res = solve(k, s)
    print(res)


def test():
    assert solve(1, "abc") == 25 + 25 + 25 + 26
    assert solve(5, "oof") == 575111451
    assert solve(37564, "whydidyoudesertme") == 318008117


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

# coding: utf-8
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
d={}
t={}
for d_ in D:
    if str(d_) in d:
        d[str(d_)]+=1
    else:
        d[str(d_)] = 1
for t_ in T:
    if str(t_) in t:
        t[str(t_)]+=1
    else:
        t[str(t_)] = 1

D_=list(set(D))
T_=list(set(T))
flg=True
for a in T_:
    if a not in D_:
        flg=False
if flg:
    for t_ in list(set(T)):
        #print(t_)
        #print(t[str(t_)], d[str(t_)])
        if t[str(t_)] <= d[str(t_)]:
            pass
        else:
            flg=False
if flg:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

# coding: utf-8
import collections
n=int(input())
D=list(map(int,input().split()))
m=int(input())
T=list(map(int,input().split()))
T_=list(set(T))
c = collections.Counter(D)
c2 = collections.Counter(T)
flg=True
for t in T_:
    #print(c[t], c2[t])
    if c[t] < c2[t]:
        flg=False
if flg:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

total = 0
r = int(input())
for i in range(r):
    total += i
print(total)

### FIXED CODE ###

r = int(input())
r = r * (r-1) // 2 
print(int(r))
### BUGGY CODE ###

"""AtCoder Beginner Contest 178.

E
"""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


def calc(p1: list, p2: list) -> int:
    """Calc Manhattan Distance."""
    return abs(p2[1] - p1[1]) + abs(p2[0] - p1[0])


def main():
    """Run."""
    n = int(input())

    points = []

    ans = 0
    for _ in range(n):
        points.append(list(map(int, input().split(' '))))

    for i, p1 in enumerate(points):
        for p2 in points[i + 1:]:
            ans = max(ans, calc(p1, p2))

    print(ans)


main()


### FIXED CODE ###

"""AtCoder Beginner Contest 178.

E
"""

import sys


def input() -> str:  # noqa: A001
    """Input."""
    return sys.stdin.readline()[:-1]


def calc(p1: list, p2: list) -> int:
    """Calc Manhattan Distance."""
    return abs(p2[1] - p1[1]) + abs(p2[0] - p1[0])


def main():
    """Run."""
    n = int(input())

    patterns = {
        'lt': (1, 1),
        'rt': (-1, 1),
        'lb': (-1, -1),
        'rb': (1, -1),
    }

    points: dict = {k: None for k in patterns.keys()}

    for _ in range(n):
        p = list(map(int, input().split(' ')))

        for k, (x, y) in patterns.items():
            max_p = points[k]

            if max_p:
                max_p_pos = (max_p[0] * x) + (max_p[1] * y)
                p_pos = (p[0] * x) + (p[1] * y)
                if max_p_pos < p_pos:
                    points[k] = p
            else:
                points[k] = p

    ans = 0
    for i, p1 in enumerate(points.values()):
        for p2 in list(points.values())[i + 1:]:
            ans = max(ans, calc(p1, p2))

    print(ans)


main()
### BUGGY CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
l = list((i+1)/2 for i in l)
#print(l)
ma = 0
for i in range(n-k+1):
  a = sum(l[i:k+i])
 # print(l[i:k+i],a)
  ma = max(ma,a)
print(ma)

### FIXED CODE ###

from itertools import accumulate
n,k = map(int,input().split())
l = list(map(int,input().split()))
l = list((i+1)/2 for i in l)
rui = list(accumulate([0]+l))
#print(l)
#print(rui)
ma = 0
for i in range(n-k+1):
  a = rui[i+k]-rui[i]
  ma = max(ma,a)
print(ma)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(4100000)

N, Q = map(int,input().split())
edge = [[] for i in range(N+1)]

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

cnt = [0 for i in range(N+1)]

for i in range(Q):
    p, x = map(int,input().split())
    cnt[p] += x

def dfs(parent,i,add):
    for k in edge[i]:
        if k != parent:
            cnt[k] += add
            dfs(i,k,cnt[k])
    

dfs(-1,1,cnt[1])

ans = cnt[1:]

print(*ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(parent,i,add):
    for k in graph[i]:
        if k != parent:
            value[k] += add
            dfs(i,k,value[k])
    

dfs(0,1,value[1])

ans = value[1:]

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

import numpy as np
D,G=list(map(int,input().split()))
p=np.zeros(D)
c=np.zeros(D)
for i in range(D):
    a,b=list(map(int,input().split()))
    p[i]=a
    c[i]=b
    
def solve(x):  
    score=0
    cost=0
    no_use_list=[] #全問解かない点数を格納
    
    b=str(format(x,'010b'))
    for i in range(1,D+1):
        if b[-i]=="1": #全問解答する
            score+=100*i*p[i-1]+c[i-1]
            cost+=p[i-1]
        else:
            no_use_list.append(i-1)

    if score<G: #足りていない場合
        no_use_list=no_use_list[::-1]
        for j in no_use_list:
            no_solve=p[j]-1
            while(no_solve!=0):
                score+=100*(j+1)
                cost+=1
                if score>=G:
                    return cost
                no_solve-=1
                
    if score<G:
        return 10**9+7
    return cost

min_cost=10**9+7
for x in range(2**D):
    cost=solve(x)
    if cost<min_cost:
        min_cost=cost
print(int(min_cost))

### FIXED CODE ###

import numpy as np
D,G=list(map(int,input().split()))
p=np.zeros(D)
c=np.zeros(D)
for i in range(D):
    a,b=list(map(int,input().split()))
    p[i]=a
    c[i]=b
    
def calc(i,j):
    if i//j==0:
        return 1
    else:
        return i//j
      
min_cost=10**9+7
for x in range(2**D):
    score=0
    cost=0
    max_no_use=0
    
    b=str(format(x,'010b'))
    for i in range(1,D+1):
        if b[-i]=="1":
            score+=100*i*p[i-1]+c[i-1]
            cost+=p[i-1]
        else:
            max_no_use=abs(i)-1
    shortage=G-score
    if shortage>0:
        add=calc(shortage,100*(max_no_use+1))
        if add<=p[max_no_use]-1:
            cost+=add
            if min_cost>cost:
                min_cost=cost
    else:
        if min_cost>cost:
            min_cost=cost
print(int(min_cost))
### BUGGY CODE ###

import math
S = input()
n = len(S)
x = 0
Timod_list = []

for i in range(n):
  Ti_list = S[i:n+1]
  Ti_str = ""
  for y in Ti_list:
    Ti_str = Ti_str + y
  Ti = int(Ti_str)
  Timod = Ti % 2019
  Timod_list = Timod_list + [Timod]

Timod_list.sort()
Timodlist_len= len(Timod_list)

Tlist0 = Timod_list.count(0)
x = x + Tlist0

Timod_lists = [x for x in Timod_list if Timod_list.count(x) > 1]
Timodlists_len = len(Timod_lists)

for j in range(Timodlists_len):
  Tlist = Timod_lists.count(Timod_lists[j])
  x = x + 1 / 2 * math.factorial(Tlist) / Tlist
    
x = int(x)
print(x) 

### FIXED CODE ###

S = input()
Sliststr = list(S)
Slist = [int(s) for s in Sliststr]
Smod = [0]
mod10 = [1]
count = [0]*2019
ans = 0
for i in range(len(S)-1):
  mod10.append(mod10[i]*10%2019)
for i in range(len(S)):
  Smod.append((Smod[i]+Slist[-i-1]*mod10[i])%2019)
for i in range(len(Smod)):
  count[Smod[i]] += 1
for i in range(2019):
  ans += count[i] * (count[i]-1) // 2
print(ans)
### BUGGY CODE ###

s = int(input())
min = s - 1
i = 1
while i < s:
    if s % i == 0:
       t = i + (s // i) - 2
       if t < min:
           min = t
    i += 1
print(min)


### FIXED CODE ###

s = int(input())
min = s - 1
sqr = s ** 0.5
i = int(sqr)
while i >= 1:
    if s % i == 0:
       t = i + (s // i) - 2
       break
    i -= 1
print(t)
### BUGGY CODE ###

def carriable_baggage(baggage, baggage_num, truck_capacity, truck_num):
    """Return the number of baggae which trucks can carry."""
    laden_baggage = 0
    for i in range(truck_num):
        laden_weight = 0
        while laden_weight + baggage[laden_baggage] <= truck_capacity:
            laden_weight += baggage[laden_baggage]
            laden_baggage += 1
            if laden_baggage == baggage_num:
                return baggage_num
    return laden_baggage

def min_capacity(baggage, baggage_num, truck_num):
    """Return the minimum value of maximum load capacity of trucks."""
    left = max(baggage)
    right = sum(baggage)
    while left != right:
        mid = (left + right) // 2
        v = carriable_baggage(baggage, baggage_num, mid, truck_num)
        if v >= baggage_num:
            right = mid;
        else:
            left = mid
    return right


import sys

n, k = map(int, sys.stdin.readline().split())

T = list(map(int, sys.stdin))

P = min_capacity(T, n, k)

print(P)

### FIXED CODE ###

def carriable_baggage(baggage, baggage_num, truck_capacity, truck_num):
    """Return the number of baggae which trucks can carry."""
    laden_baggage = 0
    for i in range(truck_num):
        laden_weight = 0
        while laden_weight + baggage[laden_baggage] <= truck_capacity:
            laden_weight += baggage[laden_baggage]
            laden_baggage += 1
            if laden_baggage == baggage_num:
                return baggage_num
    return laden_baggage

def min_capacity(baggage, baggage_num, truck_num):
    """Return the minimum value of maximum load capacity of trucks."""
    left = 0
    right = 1000000000
    while right - left > 1:
        mid = (left + right) // 2
        v = carriable_baggage(baggage, baggage_num, mid, truck_num)
        if v >= baggage_num:
            right = mid
        else:
            left = mid
    return right


import sys

n, k = map(int, sys.stdin.readline().split())

T = list(map(int, sys.stdin))

P = min_capacity(T, n, k)

print(P)
### BUGGY CODE ###

R,G,B,N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if N-r*R-g*G >= 0 and (N-r*R-g*G) % B == 0:
            ans += 1

print(ans)



### FIXED CODE ###

R,G,B,N = map(int, input().split())
ans = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if N-r*R-g*G >= 0 and (N-r*R-g*G) % B == 0:
            ans += 1

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

n,k=map(int,input().split())
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]
A.sort()
F.sort()

def chk(x):
  ct=0
  for i in range(n):
    a,f=A[i],F[-i-1]
    ct+=max(0,a-x//f)
  if ct<=k:
    return True
  else:
    return False


l,r=0,A[-1]*F[-1]
while r-l>1:
  m=(l+r)//2
  if chk(m):
    r=m
  else:
    l=m

if chk(l):
  print(l)
else:
  print(r)

### FIXED CODE ###

n,k=map(int,input().split())
A=[int(i) for i in input().split()]
F=[int(i) for i in input().split()]
A.sort()
F.sort()

def chk(x):
  ct=0
  for i in range(n):
    a,f=A[i],F[-i-1]
    ct+=max(0,a-x//f)
    if ct>k:
      return False
  if ct<=k:
    return True
  else:
    return False
l=0
r=0
for i in range(n):
  r=max(r,A[i]*F[-i-1])

while r-l>1:
  m=(l+r)//2
  if chk(m):
    r=m
  else:
    l=m

if chk(l):
  print(l)
else:
  print(r)
### BUGGY CODE ###

N,K=map(int,input().split())
p=list(map(int,input().split()))
m=0
S=0
t=0
x=0

for i in range(N-K+1):
  for k in range(K):
    S+=(1+p[i+k])/2
    if (i+k)==(i+K-1):
      if m<S:
        m=S
      S=0



print(m)

### FIXED CODE ###

def main():
    """"ここに今までのコード"""
import sys
input = sys.stdin.readline

N,K=map(int,input().split())
p=list(map(int,input().split()))
t=0
k=sum(p[0:K])

if N==K:
  print((k+K)/2)
else:
  for i in range(N-K):
    k-=p[i]
    k+=p[i+K]
    if k>t:
      t=k
    
  print((K+t)/2)

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

#!/usr/bin/env python3
import sys
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)


N, X = map(int, input().split())
x = [0] + list(map(int, input().split()))


def f(k):
    debug("compute %s" % k)
    s = 0
    for l in range(k):
        n = (N-l) // k
        s += x[l+k*n]
        debug(s)
        for i in range(1, n+2):
            if l+k*(n-i) < 0:
                y = 0
            else:
                y = x[l+k*(n-i)]
            s += ((i+1)**2)*(x[l+k*(n-i+1)] - y)
            debug(s)
    return s


candidates = [f(k) + k*X + N*X for k in range(1, N+1)]
debug(candidates)
ans = min(candidates)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
import sys
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)


N, X = map(int, input().split())
x = [0] + list(map(int, input().split()))


r = [0, 0]
rr = 0
for j in range(1, N+1):
    rr += x[j]
    r.append(rr)


def f(k):
    # debug("compute %s" % k)
    s = 0
    m = N // k + 1
    # s += 2*(r[N+1] - r[(m-1)*k])
    # for l in range(k):
    #     n = (N-l) // k
    #     s += x[l+k*n]*2
    s += 2*(r[N+1] - r[N-k+1])
    for i in range(1, m+1):
        # if k*(m-i+1) > N:
        #     t = r[N+1]
        # else:
        #     t = r[k*(m-i+1)]
        t = r[N-k*(i-1)+1]
        if N-k*i+1 < 0:
            u = 0
        else:
            u = r[N-k*i+1]
        s += (2*i+1)*(t-u)
    return s


# def f(k):
#     # debug("compute %s" % k)
#     s = 0
#     # m = N // k + 1
#     # s += 2*(r[N+1] - r[(m-1)*k])
#     for l in range(k):
#         n = (N-l) // k
#         s += x[l+k*n]*2
#         for i in range(1, n+2):
#             s += (2*i+1)*x[l+k*(n-i+1)]
#     return s


# def g(k):
#     s = 0
#     for l in range(k):
#         n = (N-l) // k
#         s += x[l+k*n]
#         for i in range(1, n+2):
#             if l+k*(n-i) < 0:
#                 y = 0
#             else:
#                 y = x[l+k*(n-i)]
#             s += ((i+1)**2)*(x[l+k*(n-i+1)] - y)
#     return s


candidates = [f(k) + k*X + N*X for k in range(1, N+1)]
debug(candidates)

# cand = [g(k) + k*X + N*X for k in range(1, N+1)]
# debug(cand)

ans = min(candidates)
print(ans)
### BUGGY CODE ###

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

all_sum = 0
for i in range(n):
  for j in range(i + 1, n):
    all_sum += a[i] * a[j]

print(all_sum % (10 ** 9 + 7))

### FIXED CODE ###

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

all_sum = 0
count = 1

for i in range(n - 1):
  s -= a[i]
  all_sum += a[i] * s

print(all_sum % (10 ** 9 + 7))
### BUGGY CODE ###

n = int(input())
s = [input() for _ in range(n)]

d = {}
for i in s:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1

l = []
for k in d.keys():
    if d[k] == max(d.values()):
        l.append(k)
        
for ans in sorted(l):
    print(ans)

### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]

d = {}
for i in s:
    if i not in d:
        d[i] = 1
    else:
        d[i] += 1
        
m = max(d.values())

l = []
for k in d.keys():
    if d[k] == m:
        l.append(k)

l_s = sorted(l)
                
for ans in l_s:
    print(ans)
### BUGGY CODE ###

from collections import deque
n = int(input())
a_list = [None for _ in range(n)]
num = 0
day = 0
for i in range(n):
    a_list[i] = deque([int(i) - 1 for i in input().split()])

while (num < n * (n - 1) // 2):
    visit = set([])
    day += 1
    for j in range(n):
        if j not in visit:
            if len(a_list[j]) > 0:
                k = a_list[j][0]
                if k not in visit:
                    if a_list[k][0] == j:
                        num += 1
                        visit = visit.union({a_list[k].popleft(), a_list[j].popleft()})                                                
    if (len(visit) == 0):
        day = -1
        break
print(day)

### FIXED CODE ###

from collections import deque
n = int(input())
a_list = []
for i in range(n):
    a_list.append(deque([int(aa) - 1 for aa in input().split()]))
day = 0
battle = 0
for _ in range(n * (n - 1) // 2):
    if battle == n * (n - 1) // 2:
        break
    day += 1
    battle_today = 0
    tomorrow = set([])
    if (day == 1):
        player = set([i for i in range(n)])
    for i in player:
        if len(a_list[i]) == 0:
            continue
        j = a_list[i][0]
        if (i == a_list[j][0]) & (j not in tomorrow) & (len(a_list[j]) > 0) & (i not in tomorrow):
            tomorrow.add(i)
            tomorrow.add(a_list[i][0])
            battle += 1
            battle_today += 1
            a_list[i].popleft()
            a_list[j].popleft()
    player = tomorrow
    if battle_today == 0:
        day = -1
        break
print(day)
### BUGGY CODE ###

def calcMax(i):
  now = numbers[i] 

  future_max = max(numbers[i+1:])
  #print(numbers[i+1:])
  t = numbers[i+1:]
  #print((max(t)))
  return future_max - now

n = int(input())

numbers = []
for i in range(n):
  numbers.append(int(input()))

m = -1000000001
p = -1000000001
for i in range(len(numbers) - 1):
    if numbers[i-1] >= numbers[i] or i == 0:
      temp = calcMax(i)
      #print("temp: " + str(temp))
      if temp > m:
          m = temp

print (m)


### FIXED CODE ###

def calcMax(i):
  now = numbers[i]

  future_max = max(numbers[i+1:])
  #print(numbers[i+1:])
  t = numbers[i+1:]
  #print((max(t)))
  return future_max - now

n = int(input())

numbers = []
for i in range(n):
  numbers.append(int(input()))

m = -1000000001
ti = 1000000001
for i in range(len(numbers) - 1):
    if numbers[i] < ti:
      if (i == 0 or i == len(numbers) - 1 or (numbers[i-1] >= numbers[i] and numbers[i] <= numbers[i+1])):
        temp = calcMax(i)
        #print("temp: " + str(temp))
        if temp > m:
            m = temp
            ti = numbers[i]

print (m)