Harryxun/stf_run huggingface dataset:
KN = input("").split()
A = input("").split()

K = int(KN[0])
N = int(KN[1])
A_0 = int(A[0])
A_N = int(A[N-1])
L = A_0

for j in range(N):
    A_i = int(A[j+1])
    A_m = int(A[j])
    if A_i - A_m > L:
        L == A_i - A_m

if L > K - A_N + A_0:
    print(K-L)
else:
    print(K - A_N + A_0)



### FIXED CODE ###


X = int(input(""))

X500 = X//500
X_a = X%500

X5 = X_a//5

happy = X500*1000 + X5*5

print(happy)
s=input()
ng=False
for i in range(n):
  if i%2==0:
    if s[i]=='R':
      ng=True
  else:
    if s[i]=='L':
      ng= True
if ng:
  print('No')
else:
  print('Yes')


### FIXED CODE ###

s=input()
ng=False
for i in range(len(s)):
  if i%2==0:
    if s[i]=='L':
      ng=True
  else:
    if s[i]=='R':
      ng= True
if ng:
  print('No')
else:
  print('Yes')
def a(s,i):
    if i == n-1:
        return sum(map(int,s.split()))
    return a(s[i]+s[i+1],i+1)+ a(s[i]+"+"+s[i+1])

s = input()
n = len(s)
i=0
print(a(s[0],0))


### FIXED CODE ###

def dfs(i,s):
    if i==n-1:
        return sum(map(int,s.split('+')))
    return dfs(i+1,s+S[i+1])+dfs(i+1,s+'+'+S[i+1])

S=input()
n=len(S)
ans=dfs(0,S[0])
print(ans)
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = [1,2,3,4,5,6]

for i in range(6)
    for j in range(k, 6)
        if max <= price[j] - price[i]:
            print max

### FIXED CODE ###

import sys

n = int(raw_input())

min_R = int(raw_input())
nums = map(int, sys.stdin.readlines())

ans = -10**9

for num in nums:
    if num - min_R > ans:
        ans = num - min_R
    if num < min_R:
        min_R = num
        
print ans
def inpl(): return list(map(int, input().split()))
from bisect import bisect
from collections import defaultdict

N, Q = inpl()
S = [ord(s) - 65 for s in input()]

X = [[] for i in range(26)]
T = [[] for i in range(26)]

for i in range(Q):
    t, d = input().split()
    q = ord(t) - 65
    X[q].append(i)
    T[q].append(d == "R")

ranswer = set()

def dig(q, x):
    #print(q, x)
    global ranswer
    s = S[x]
    if X[s][0] == q:
        ranswer.add(x)

    if x > 0:
        s = S[x-1]
        i = bisect(X[s], q-1) - 1
        if i >= 0 and T[s][i] == True:
            dig(X[s][i], x-1)
    if x < N-1:
        s = S[x+1]
        i = bisect(X[s], q-1) - 1
        if i >= 0 and T[s][i] == False:
            dig(X[s][i], x+1)

for q, t in zip(X[S[0]], T[S[0]]):
    if t == False:
        dig(q, 0)
for q, t in zip(X[S[N-1]], T[S[N-1]]):
    if t == True:
        dig(q, N-1)

print(N - len(ranswer))

### FIXED CODE ###

def inpl(): return list(map(int, input().split()))

N, Q = inpl()
S = input()
T = [""]*(Q)
D = [-1]*(Q)
for i in range(Q):
    t, d = input().split()
    T[i] = t
    D[i] += 2*(d == "R")

def checkL(ix):
    for i in range(Q):
        if T[i] == S[ix]:
            ix += D[i]
        if ix == N:
            return True
        if ix < 0:
            return False
    return True

def checkR(ix):
    for i in range(Q):
        if T[i] == S[ix]:
            ix += D[i]
        if ix == N:
            return False
        if ix < 0:
            return True
    return True

OK = N
NG = -1
while abs(OK-NG)>1:
    mid = (OK+NG)//2
    if checkL(mid):
        OK = mid
    else:
        NG = mid

Lans = OK*1

OK = -1
NG = N
while abs(OK-NG)>1:
    mid = (OK+NG)//2
    if checkR(mid):
        OK = mid
    else:
        NG = mid
print(max(OK-Lans+1, 0))
H = list(map(int, input().split())
print(max(H)-min(H))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
print(max(A)-min(A))
N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]

max_dist = 0
judge = []
for (x, y) in P:
    dist = abs(x) + abs(y)
    max_dist = max(max_dist, dist)
    judge.append(dist % 2 == 0)

if all(judge) or not any(judge):
    print(max_dist)
    print(*([1] * max_dist))
    for (x, y) in P:
        com = ''
        com += abs(x) * ('R' if x > 0 else 'L')
        com += abs(y) * ('U' if y > 0 else 'D')
        com += 'LR' * ((max_dist - abs(x) - abs(y)) // 2)
        print(com)
else:
    print(-1)


### FIXED CODE ###

N = int(input())
P = [tuple(map(int, input().split())) for _ in range(N)]

odd = []
for (x, y) in P:
    dist = abs(x) + abs(y)
    odd.append(dist % 2 != 0)

valid = True
even = False
if all(odd):
    pass
elif not any(odd):
    even = True
else:
    valid =False

if valid:

    M = 31
    if even:
        print(M+1)
        print(*([1 << m for m in range(M)] + [1]))
    else:
        print(M)
        print(*[1 << m for m in range(M)])

    for (x, y) in P:
        u = x + y
        v = x - y
        if even:
            u += 1
            v += 1
        if u >= 0 and v >= 0:
            A = 'R'
            B = 'U'
            C = 'D'
            D = 'L'
        elif u >= 0 and v < 0:
            v *= -1
            A = 'U'
            B = 'R'
            C = 'L'
            D = 'D'
        elif u < 0 and v >= 0:
            u *= -1
            A = 'D'
            B = 'L'
            C = 'R'
            D = 'U'
        elif u < 0 and v < 0:
            u *= -1
            v *= -1
            A = 'L'
            B = 'D'
            C = 'U'
            D = 'R'

        ans = ''
        wa = ((1 << M) - 1 - u) // 2
        sa = ((1 << M) - 1 - v) // 2
        for i in range(M):
            check = str(wa >> i & 1) + str(sa >> i & 1)
            if check == '00':
                ans += A
            elif check == '01':
                ans += B
            elif check == '10':
                ans += C
            elif check == '11':
                ans += D
        if even:
            ans += 'L'
        print(ans)
else:
    print(-1)
import math

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

if N == 0:
    print(X)
    exit()

p.sort()

minimum = p[0]
maximum = p[len(p) - 1]
# print(minimum, maximum)

if X < minimum or maximum < X:
    print(0)
    exit()

# answer = min(abs(X - minimum - 1), abs(X - maximum + 1))
for candidate in range(minimum, maximum):
    if candidate in p: continue

    diff_answer = abs(X - answer)
    diff_candidate = abs(X - candidate)
    # print(candidate, diff, answer)
    answer = candidate if diff_candidate < diff_answer else answer

print(answer)


### FIXED CODE ###

import math

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

if N == 0:
    print(X)
    exit()

p.sort()

minimum = p[0]
maximum = p[len(p) - 1]

if X < minimum or maximum < X:
    print(X)
    exit()

diff_min = abs(X - minimum - 1)
diff_max = abs(X - maximum + 1)
if diff_min == diff_max:
    answer = min(minimum - 1, maximum + 1)
else:
    answer = minimum - 1 if diff_min < diff_max else maximum + 1

for candidate in range(0, 100 + 2):
    if candidate in p : continue

    diff_candidate = abs(X - candidate)
    diff_answer = abs(X - answer)

    if diff_candidate == diff_answer:
        answer = min(candidate, answer)
    elif diff_candidate < diff_answer:
        answer = candidate

print(answer)
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, k = map(int, input().split())
p = [int(x) - 1 for x in input().split()]
c = [int(x) for x in input().split()]

ans = -float('inf')
for i in range(n):
    now = i
    cnt = 0
    c_sum = [0]
    s = set()
    while True:
        s.add(now)
        c_sum.append(c_sum[-1] + c[now])
        now = p[now]
        cnt += 1
        if now in s:
            break
    if k <= cnt:
        ans = max(ans, max(c_sum[1: min(k + 1, len(c_sum))]))
    else:
        temp = c_sum[-1]
        q = k // cnt
        temp *= q
        q = k - q*cnt
        temp += max(c_sum[1:q + 1])
        ans = max(ans, temp, max(c_sum[1:]))
print(ans)




    

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, k = map(int, input().split())
p = [int(x) - 1 for x in input().split()]
c = [int(x) for x in input().split()]

ans = -float('inf')
for i in range(n):
    now = i
    c_sum = [0]
    s = set()
    cnt = 0
    while True:
        s.add(now)
        c_sum.append(c_sum[-1] + c[now])
        cnt += 1
        now = p[now]
        if now in s:
            break
    c_sum = c_sum[1:]
    if k < cnt:
        ans = max(ans, max(c_sum[: k]))
    else:
        score = c_sum[-1]
        count = k // cnt
        k_ = k - count*cnt
        score *= count
        score_2 = score - c_sum[-1]
        score_2 += max(c_sum)
        if k_ > 0:
            score += max(0, max(c_sum[:k_]))
        ans = max(ans, score, max(c_sum), score_2)
print(ans)
l1=input().split(" ")
n=int(l1[0])
k=int(l1[1])
list=[range(n)]
kashi=[]
for i in range(k):
  tmp=input()
  num=input().split(" ")
  kashi.append(num)
kashi=set(kashi)
print(n-len(kashi))

### FIXED CODE ###

l1=input().split(" ")
n=int(l1[0])
k=int(l1[1])
list=[range(n)]
kashi=[]
for i in range(k):
  tmp=input()
  num=input().split(" ")
  for j in num:
    kashi.append(j)
kashi=set(kashi)
print(n-len(kashi))
s = input()
q = int(input())
lead = ''
end = ''
inversion_flg = -1

for j in range(q):
    query = input().split()
    if query[0] == "1":
        inversion_flg *= -1
    else:
        if inversion_flg == 1:
            if query[1] == "1":
                query[1] = "2"
            else:
                query[1] = "1"
        if query[1] == "1":
            lead += query[2]
        else:
            end += query[2]

lead = lead[::-1]
s = lead + s + end
if inversion_flg == 1:
    s = s[::-1]
print(s)


### FIXED CODE ###

a = input()
if a.count('A') == 2 or a.count('B') ==2:
    print('Yes')
else:
    print('No')
n = int(input())
list = []
i = 0
for k in range(n):
    d = int(input())
    if d in list:
        pass
    else:
        list.append(d)
print(len(list))


### FIXED CODE ###

str = input()
print(str[:3] + "8" + str[4:])
def comb(n, r):
    if r > n:
        return 0
    else:        
        return math.factorial(n)*math.factorial(r) // math.factorial(n - r)
  
m, n = map(int, input().split())
print(int(comb(m,2) + comb(n,2)))

### FIXED CODE ###

n, m = map(int, input().split())
print(int(n*(n-1)//2 + m*(m-1)//2))
N = int(input())
A = [int(a) for a in input().split()]

dic = {}
for a in A:
  dic[a] = dic.get(a,0) + 1

2p = []
ans = 0

for k in dic:
  if dic[k] >= 4:
    ans = max(ans,dic[k]**2)
  elif dic[k] >= 2:
    2p.append(dic[k])
if len(2p)>=2:
  2p.sort(reverse=True)
  ans = max(ans,2p[0]*2p[1])
print(ans)


### FIXED CODE ###

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

d = {}
for a in A:
  d[a] = d.get(a,0) + 1
B = [0,0]
for k in d:
  if d[k] >= 4:
    B.append(k)
    B.append(k)
  elif d[k] >=2:
    B.append(k)
B.sort()
print(B[-1]*B[-2])
import math 
n, m = map(int, input().split())
a = list(map(int, input().split()))
z = a[0]
for i in a:
    z = math.gcd(z, i)
for i in range(n):
    a[i]//=z
lcm = 1
a = set(a)
for i in a:
    lcm*=i
print(math.ceil((m//lcm)/2))

### FIXED CODE ###

def case():
    k, x = map(int, input().split())
    if 500*k < x:
        print("No")
    else:
        print("Yes")
case()
S, T = map(input().split())
A, B = map(int, input().split())
U = input()

print(S-1 T if U == S else S T-1)

### FIXED CODE ###

S, T = input().split()
A, B = map(int, input().split())
U = input()

print(A-1, B) if U == S else print(A, B-1)
a, b, k = map(int, input())
for i in range(k):
  if a > 0:
    a -= 1
  elif b > 0:
    b -= 0:
  else:
    break
    
print(" ".join(map(str, [a,b])))

### FIXED CODE ###

a, b, k = map(int, input().split())
 
if a >= k:
  print(a-k, b)
else:
  if a+b > k:
    print(0, b-(k-a))
  else:
    print(0,0)
from math import log10
n = int(input())
ans=0
l = log10(n)
if int(l)==l:
  ans=10
else:
  while n>0:
  ans+=n%10
  n//=10
print(ans)


### FIXED CODE ###

# python template for atcoder1
from math import log10
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

n = int(input())
ans = 0
l = log10(n)
if int(l) == l:
    ans = 10
else:
    while n > 0:
        ans += n % 10
        n //= 10
print(ans)
n = int(input())
lst = [list(map(int, input().split())) for _ in range(n-1)]

neighbor = [[] for _ in range(n+1)]
for edge in lst:
    neighbor[edge[0]].append((edge[1], edge[2]))
    neighbor[edge[1]].append((edge[0], edge[2]))

    
color = [-1] * (n+1)

#startをbwで塗る
def dfs(start, bw):
    color[start] = bw
    for pair in neighbor[start]:
        if color[pair[0]] != -1:
            continue
        elif pair[1] % 2 == 0:
            dfs(pair[0], bw)
        else:
            dfs(pair[0], (bw + 1) % 2)

dfs(1, 0)
        
for i in range(1, n+1):
    print(color[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

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

neighbor = [[] for _ in range(n+1)]
for edge in lst:
    neighbor[edge[0]].append((edge[1], edge[2]))
    neighbor[edge[1]].append((edge[0], edge[2]))

    
color = [-1] * (n+1)

#startをbwで塗る
def dfs(start, bw):
    color[start] = bw
    for pair in neighbor[start]:
        if color[pair[0]] != -1:
            continue
        elif pair[1] % 2 == 0:
            dfs(pair[0], bw)
        else:
            dfs(pair[0], (bw + 1) % 2)

dfs(1, 0)
        
for i in range(1, n+1):
    print(color[i])
import bisect
a,b=map(int,input().split())
c=list(map(int,input().split()))

n=[i for i in range(-1,101)]

m=sorted(list(set(n)^set(c)))
bisect.insort_right(m,a)

m=sorted(list(set(m)))

if b==0:
    print(a)

elif a==100:
    print(m[m.index(a)]-1)

elif abs(a-m[m.index(a)]-1)<abs(a-m[m.index(a)+1]):
    print(m[m.index(a)+1])

elif abs(a-m[m.index(a)]-1)==abs(a-m[m.index(a)+1]):
    print(m[m.index(a)]-1)

else:
    print(m[m.index(a)]-1)


### FIXED CODE ###

a,b=map(int,input().split())
c=list(map(int,input().split()))
ans=0
for i in range(100):
    if a-i not in c:
        ans=a-i
        break
    elif a+i not in c:
        ans=a+i
        break
print(ans)
a, b = map(int,input())
ma = max(2*a-1, a+b, 2*b-1)
print(ma)

### FIXED CODE ###

a, b = map(int,input().split())
ma = max(2*a-1, a+b, 2*b-1)
print(ma)
A = input()
B = input()
C = input()
print(A*B/2)

### FIXED CODE ###

a, b, c = map(int, input().split())
print(a*b//2)
import time
import random
N = int(input())
s = str(input())
maxlen = N//2
start = time.time()
def solve(tgt):
    for i in range(N-tgt*2+1):
        if s[i:i+tgt] in s[i+tgt:]:
            return True
    return False

ng = maxlen + 1
ok = 0
if N>650:
    ok = 2
first = 1
while ng-ok > 1:
    end = time.time()
    if end-start > 1.2:
        if ok < 2496:
            assert()
        r = random.random.randint(ok,ng-1)
        print(r)
        exit()
    tgt = (ok+ng)//2
    if N>=4800 and first == 1:
        tgt = 2492
        first = 0
    if solve(tgt):
        ok = tgt
    else:
        ng = tgt
print(ok)


### FIXED CODE ###

from collections import defaultdict as dd
N = int(input())
s = str(input())
maxlen = N//2

def solve(tgt):
    dic = dd(int)
    st = s[tgt:2*tgt]
    dic[st] += 1
    ls = [st]
    for char in s[2*tgt:]:
        st = st[1:]+char
        dic[st] += 1
        ls.append(st)
    st = s[:tgt]
    if dic[st] > 0:
        return True
    dic[ls[0]] -= 1
    for i,char in enumerate(s[tgt:N-tgt]):
        st = st[1:]+char
        if dic[st] > 0:
            return True
        dic[ls[i+1]] -= 1
    return False

ng = maxlen + 1
ok = 0
while ng-ok > 1:
    tgt = (ok+ng)//2
    if solve(tgt):
        ok = tgt
    else:
        ng = tgt
print(ok)
#!/usr/bin/env python
# coding: utf-8

# In[10]:


N,K = int(input()), int(input())
new = abs(N-K)
while(new<N):
    N = new 
    new = abs(new-K)
print(N)



### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[10]:


N,K = map(int,input().split())
new = N % K
n2 = K - new

print(min(new,n2))
a=[]
    for i in range(1, 10):
        for j in range(i+1, 10):
            a.append(i*j)
    n=int(input())
    if n in a:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

a = []
for i in range(1, 10):
    for j in range(i, 10):
        a.append(i * j)
n = int(input())
if n in a:
    print("Yes")
else:
    print("No")
def valid(i,j):
    if i>=0 and i<h and j>=0 and j<w:
        return 1
    return 0
def paths(i,j):

    if valid(i,j)==0 or  a[i][0][j]=='#':
        return 0
    if i==h-1 and j==w-1:
        return 1

    if dp[i][j]==-1:
           dp[i][j]=(paths(i+1,j)%m+paths(i,j+1)%m)%m
           return dp[i][j]
    else:
            return dp[i][j]



h,w=map(int,input().split())
a=[[]for _ in range(h)]
m=1000000007
for i in range(h):
   a[i].extend(input().split())
dp=[[-1 for _ in range(w)]for _ in range(h)]
print(paths(0,0))


### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)

def paths(i, j):

    if i == h - 1 and j == w - 1:
        return 1
    if a[i][0][j] == '#':
        return 0
    if i < h - 1 and j < w - 1:
        if dp[i][j] == -1:
            dp[i][j] = paths(i + 1, j) + paths(i, j + 1)
            return dp[i][j]
        else:
            return dp[i][j]
    elif i == h - 1 and j < w - 1:
        if dp[i][j] == -1:
            dp[i][j] = paths(i, j + 1)
            return dp[i][j]
        else:
            return dp[i][j]
    elif i < h - 1 and j == w - 1:
        if dp[i][j] == -1:
            dp[i][j] = paths(i + 1, j)
            return dp[i][j]
        else:
            return dp[i][j]


h, w = map(int, input().split())
a = [[] for _ in range(h)]
m = 1000000007
for i in range(h):
    a[i].append(input())
dp = [[-1 for _ in range(1000)] for _ in range(1000)]
print(paths(0, 0) % m)
import math

a, b, c, d = map(int, input().split())
lcm = int(c*d/math.gcd(c, d))
print((b-b//c-b//d+b//lcm)-(a-a//c-a//d+a//lcm))


### FIXED CODE ###

import fractions
a, b, c, d = map(int, input().split())
a = a-1
lcm = int(c*d/fractions.gcd(c, d))
ans = (b-b//c-b//d+b//lcm)-(a-a//c-a//d+a//lcm)
print(ans)
a = int(input()) 
b = [int(input()) for i in range(n)] 
for i in range(a):
  d=b[i]
  b.pop(i)
  print(max(b))
  b.insert(i,d)

### FIXED CODE ###

a = int(input()) 
b = [int(input()) for i in range(a)] 
 
m=max(b)
sorted(b)
s=sorted(b)[-2]
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    print(s)
import collections
s = input()
l = len(s)

d = [0] * l
for i in range(l-1,0,-1):
  d[i] = int(s[i:]) % 2019

ans = 0
for v in collections.Counter(d).values():
  ans += v*(v-1)/2

print(int(ans))


### FIXED CODE ###

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

if a > b:
  print('safe')
else:
  print('unsafe')
num = int(input())
 
if num = 1:
  print(1)
else:
  print(num*num*num)

### FIXED CODE ###

num = int(input())
 
if num == 1:
  print(1)
else:
  print(num**3)
n = int(input())
ls = [int(i) for i in input().split()]


from collections import defaultdict
d1 = defaultdict(int)
d2 = defaultdict(int)

for i in range(n):
    if i%2==0:
        d1[ls[i]]+=1
    else:
        d2[ls[i]]+=1


d1=sorted(d1.items())
d2=sorted(d2.items())


if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    if len(d1)==1 and len(d2)==1:
        print(min(n-d1[0][1],n-d2[0][1]))
    elif:len(d1)==1 and len(d2)==2:
        print(min(n-d1[0][1]-d2[1][1],n-d2[0][1]))
    elif len(d1)==2 and len(d2)==1:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]))
    else:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]-d2[1][1]))


### FIXED CODE ###

n = int(input())
ls = [int(i) for i in input().split()]


from collections import defaultdict
d1 = defaultdict(int)
d2 = defaultdict(int)

for i in range(n):
    if i%2==0:
        d1[ls[i]]+=1
    else:
        d2[ls[i]]+=1


d1=sorted(d1.items(),key=lambda x:x[1],reverse=True)
d2=sorted(d2.items(),key=lambda x:x[1],reverse=True)


if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    if len(d1)==1 and len(d2)==1:
        print(min(n-d1[0][1],n-d2[0][1]))
    elif len(d1)==1 and len(d2)==2:
        print(min(n-d1[0][1]-d2[1][1],n-d2[0][1]))
    elif len(d1)==2 and len(d2)==1:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]))
    else:
        print(min(n-d1[1][1]-d2[0][1],n-d1[0][1]-d2[1][1]))
a=10**9+7
import math 
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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


for _ in range(1,k+1):
  print(combinations_count(n-k+1,_)%a*combinations_count(k-1,_-1))

### FIXED CODE ###

mod=10**9+7
n,k=map(int,input().split())

from scipy.misc import comb

for i in range(1,k+1):
  print(comb(n-k+1,i,exact=True)*comb(k-1,i-1,exact=True)%mod)
import math

n = int(input())
r_t = [int(input().strip()) for i in range(n)]

r_i = r_t[0]
r_i_index = 0
diff = -math.inf
for _ in range(1, n):
    r_j = max(r_t[r_i_index+1:])

    tmp_diff = r_j - r_i

    if tmp_diff > diff:
        diff = tmp_diff

    for i in range(r_i_index, n):
        tmp_r_i = r_t[i]
        if tmp_r_i < r_i:
            r_i = tmp_r_i
            r_i_index = r_t.index(r_i)
            break

print(diff)


### FIXED CODE ###

import math

N = int(input())
R = [int(input().strip()) for _ in range(N)]

maxv = -math.inf
minv = R[0]
for i in range(1, N):

    tmp_maxv = R[i] - minv # 差額をセットする
    # 現在の最大差額と差額の大きい方を最大差額にする
    if maxv < tmp_maxv:
        maxv = tmp_maxv

    # 現在値が最小なら、最小値を更新する
    if R[i] < minv:
        minv = R[i]

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

a = [1] * A
b = [0] * B
c = [-1] * C

abc = a+ b +c

k = sum(abc[0:K])

print(k)

### FIXED CODE ###

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

if K <= A:
    print(K)
if A < K <= A + B:
    print(A)
if A + B < K <= A + B + C:
    print(2*A + B - K)
N = int(input())
A = []
B = []
for _ in range(N):
    A[i], B[i] = map(int, input().split())

if n / 2 == 0:
    Am = (A[N / 2] + A[(N / 2) + 1]) / 2
    Bm = (B[N / 2] + B[(N / 2) + 1]) / 2
    print((Bm - Am) * 2 + 1)
else:
    Am = A[(N + 1) / 2]
    Bm = B[(N + 1) / 2]
    print(Bm - Am + 1)

### FIXED CODE ###

import numpy as np
N = int(input())
A = np.zeros(N)
B = np.zeros(N)
for i in range(N):
    A[i], B[i] = map(int, input().split())

am = np.median(A)
bm = np.median(B)

if N % 2 == 0:
    print(int((bm - am) * 2 + 1))
else:
    print(int((bm - am) + 1))
s1,s2,s3 = (int(x) for x in input().split())

count1 = 0
for i in range(1,4,1):
    if s1 == 1:
        count1 = count1 + 1
    else:
        pass
    
print(count1)

### FIXED CODE ###

import numpy as np

s1s2s3=int(input())

count1 = 0

num = []

while s1s2s3 != 0:
    num.append(s1s2s3 % 10)
    s1s2s3 //= 10
num.reverse()

for i in range (len(num)):
    if  num[i-1] == 1:
        count1 = count1 + 1
    else:
        pass

print(count1)
import math 
import bisect
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=(left+right)//2

while(right-left>=1):
    numofcut=0
    mid=(left+right)//2
    for i in range(N):
        if A[i]%mid==0:
            numofcut+=A[i]//mid -1
        else:
            numofcut+=A[i]//mid
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=(left+right)//2

print(mid)

### FIXED CODE ###

import math 
N,K=map(int,input().split())
A=[int(x) for x in input().split()]
A=sorted(A)
left=0
right=max(A)
mid=max((left+right)//2,1)

while(right-left>=1):
    numofcut=0
    
    for i in range(N):
        if A[i]%mid==0:
            numofcut+=(A[i]//mid) -1
        else:
            numofcut+=A[i]//mid
    #print(numofcut)
    if numofcut>K:
        left=mid+1
    else:
        right=mid
    mid=max((left+right)//2,1)
    if mid==1:
        break
print(mid)
a = input()
if a == 'hi' or a == 'hihi' or a == 'hihihi' or a == 'hihihihi' or a == 'hihihihihi' or a == 'hihihihihi' 
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a = input()
if a == 'hi' or a == 'hihi' or a == 'hihihi' or a == 'hihihihi' or a == 'hihihihihi' or a == 'hihihihihi':
  print('Yes')
else:
  print('No')