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

"""import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
"""


def main():
    S = input()
    Q = int(input())
    qi = [[0 for j in range(3)] for i in range(Q)]
    for i in range(Q):
        n = input()
        if n != 1:
            qi[i]= n.split()
        else:
            qi[i][0] = 1
  
#    for i in range(Q):
#        print(qi[i][0])

    for i in range(Q):
        #print("qi", i,  qi[i][0])
        #print("qi", i,  qi[i][0])
        if qi[i][0] == "1":
            S = S[::-1]
        elif qi[i][0] == "2":
            if qi[i][1] == "1":
                S = str(qi[i][2]) + S
            elif qi[i][1] == "2":
                S = S + str(qi[i][2]) 
    print(S)

if __name__ == "__main__":
	main()

### FIXED CODE ###

from collections import deque

def main():
    S = deque(input())
    
    Q = int(input())
    count = 1

    for i in range(Q):
        n = input()
        if n == "1":
            #qi[i][0] = 1
            count += 1
        else:
            q= list(n.split())
            if (count % 2 == 1 and q[1] == "1") or(count % 2 == 0 and q[1] == "2"):
                S.appendleft(q[2])
            else:
                S.append(q[2]) 

    if count % 2 == 0:
        S.reverse()
    print(''.join(S))

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

# original submission: https://atcoder.jp/contests/tokiomarine2020/submissions/14259812
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K > 4 * math.log2(N):
    for _ in range(N):
        print(N," ", end = "")
    print()
else:
    for i in range(K):
        cum_sum = [0]*N
        for j in range(N):
            left = max(0, j - A[j])
            right = min(N-1, j+A[j])
            cum_sum[left] += 1
            if right + 1 < N:
                cum_sum[right+1] -= 1
        A[0] = cum_sum[0]
        for j in range(N-1):
            cum_sum[j+1] += cum_sum[j]
            A[j+1] = cum_sum[j+1]

            
    for i in range(N):
        print(A[i], " ", end = "")
    print()
            


### FIXED CODE ###

# original submission: https://atcoder.jp/contests/tokiomarine2020/submissions/14259812
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

if K > 4 * math.log2(N):
    for _ in range(N):
        print(N," ", end = "")
    print()
else:
    for i in range(K):
        cum_sum = [0]*N
        for j in range(N):
            left = max(0, j - A[j])
            right = min(N-1, j+A[j])
            cum_sum[left] += 1
            if right + 1 < N:
                cum_sum[right+1] -= 1
        A[0] = cum_sum[0]
        for j in range(N-1):
            cum_sum[j+1] += cum_sum[j]
            A[j+1] = cum_sum[j+1]

            
    for i in range(N):
        print(A[i], " ", end = "")
    print()
### BUGGY CODE ###

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

for i in range(k):
    if (a >= 1):
        a = a - 1
    elif(b >= 1):
        b = b -1
    elif(a == 0, b == 0):
        print()

print(str(a) + ' ' + str(b))

### FIXED CODE ###

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

#Takahashi eats a, k times while Aoki doesn't eat b unless
#all of a's are gone.

if a+b <= k: #all cookies will be gone
    print(0,0)
else:
    if a <= k:
        print(0, b-(k-a))
    else:
        print(a-k, b)
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
li = list(set(a))
a.sort()
li.sort()
count = 0
for i in range(len(li)):
    tmp1= a.count(li[i])
    tmp2 = li[i]
    if tmp1 > tmp2:
        count += tmp1-tmp2
    elif tmp2 > tmp1:
        count += tmp1
print(count)


### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int,input().split()))
A = Counter(A)
keys = list(A.keys())
count = 0
for i in range(len(A)):
    if keys[i]!=A[keys[i]]:
        if keys[i]>A[keys[i]]:
            count += A[keys[i]]
        else:
            count += A[keys[i]]-keys[i]
print(count)
### BUGGY CODE ###

S = list(str(input()))
ans = 0
ans += S.count('0')

if len(S) > 4:
  for i in range(len(S)-4):
    for j in range(i+4,len(S)+1):
      if int(''.join(S[i:j])) % 2019 == 0:
        ans += 1
else:
  if int(''.join(S))%2019==0:
    ans += 1
print(ans)

### FIXED CODE ###

S = list(str(input()))
S.reverse()
mod = 2019
rem = [0]*mod
num = 0
rem[num] += 1
d = 1
ans = 0
for s in S:
  num += int(s) * d
  num %= mod
  d *= 10
  d %= mod
  rem[num] += 1
for r in rem:
  ans += r*(r-1)//2
print(ans)
### BUGGY CODE ###

n,p=map(int,input().split())
s=input()

count=0
if p==2:
    for i in range(n):
        if int(s[i])%2==0:
            count+=i+1
elif p==5:
    for i in range(n):
        if int(s[i])%5==0:
            count+=i+1
else:
    u=[]
    num=0
    for i in range(n):
        u.append(int(s[i:n])%p)
    u.append(0)
    for i in range(n):
        for j in range(i,n):
            if (u[i]-u[j+1])%p==0:
                count+=1
print(count)

### FIXED CODE ###

n,p=map(int,input().split())
s=input()

count=0
if p==2:
    for i in range(n):
        if int(s[i])%2==0:
            count+=i+1
elif p==5:
    for i in range(n):
        if int(s[i])%5==0:
            count+=i+1
else:
    lis=[1]
    for i in range(n-1):
        lis.append((lis[i]*10)%p)
    lis.reverse()
    for i in range(n):
        lis[i]=(int(s[i])*lis[i])%p
    unum=[1]
    for i in range(p-1):
        unum.append(0)
    num=0
    for i in range(n):
        num=(num+lis[n-i-1])%p
        unum[num]+=1
    for i in range(p):
        unumi=unum[i]
        count+=(unumi*(unumi-1))*0.5
print(round(count))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

d = 1000000000 + 7

s = 0
for i in range(N):
    for t in range(N-i-1):
        j = i + t + 1
        s += A[i] * A[j]
print(s % d)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

d = 1000000000 + 7

s = 0

sum_list = [A[0]]
for a in A[1:]:
    sum_list.append(a + sum_list[-1])
for i in range(N):
    s += A[i] * (sum_list[N-1] - sum_list[i])
print(s % d)
### BUGGY CODE ###

f=input
s=f()
n=int(f())
t=0
for i in range(n):
  q=f()
  if q[0]=='1': t=1-t
  elif int(q[2])+t==2: s+=q[4]
  else: s=q[4]+s
print(''.join([s,s[::-1]][t]))

### FIXED CODE ###

from collections import deque
f=input
s=deque(f())
n=int(f())
t=0
for i in range(n):
  q=f()
  if q[0]=='1': t=1-t
  elif int(q[2])+t==2: s.append(q[4])
  else: s.appendleft(q[4])
print(''.join([s,list(s)[::-1]][t]))
### BUGGY CODE ###

N,A,B = map(int,raw_input().split())
monsters = [0 for _ in xrange(N)]
for i in xrange(N):
    monsters[i] = int(raw_input())
cnt = 0
while(True):
    m = max(monsters)
    if m <=0:
        break
    midx = monsters.index(m)
    #print midx
    monsters[midx] -= A
    #print monsters
    
    for i in xrange(N):
        if i != midx:
            monsters[i] -= B
    cnt += 1
print cnt
    

### FIXED CODE ###

import sys
import math
input = sys.stdin.readline
N, A, B = map(int, input().split())
h_list = []
for _ in range(N):
    h_list.append(int(input()))

def compare(k):
    cnt = 0
    for h in h_list:
        tmp_h = h - k*B
        x = max(math.ceil(tmp_h/(A-B)),0)
        cnt += x
        if cnt > k:
            return False
    return True
def solve():
    ng = 0
    ok = math.ceil(max(h_list) / B)
    while abs(ok-ng) > 1:
        mid = (ng + ok) // 2
        res = compare(mid)
        if (res):
            ok = mid
        else:
            ng = mid
    return ok
print(solve())
### BUGGY CODE ###

import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(readline())
    A = list(map(int, readline().split()))

    def primes(n):
        is_prime = [True] * (n + 1)
        is_prime[0] = False
        is_prime[1] = False
        for i in range(2, int(n ** 0.5) + 1):
            if not is_prime[i]:
                continue
            for j in range(i * 2, n + 1, i):
                is_prime[j] = False
        return [i for i in range(n + 1) if is_prime[i]]

    prime_list = primes(10**6)

    lcm_dic = {}
    Alist = []

    for a in A:
        a_dic = {}
        for num in prime_list:
            if num > a ** 0.5 + 1:
                if a in a_dic:
                    a_dic[a] += 1
                    break
                else:
                    a_dic[a] = 1
                    break
            while a % num == 0:
                if num in a_dic:
                    a //= num
                    a_dic[num] += 1
                else:
                    a //= num
                    a_dic[num] = 1
        Alist.append(a_dic)
        for k, v in a_dic.items():
            if k not in lcm_dic:
                lcm_dic[k] = v
            else:
                lcm_dic[k] = max(lcm_dic[k], v)

    ans = 0
    for ad in Alist:
        tmpnum = 1
        for k, v in lcm_dic.items():
            if k in ad:
                tmpnum *= k ** (v - ad[k])
                tmpnum %= mod
            else:
                tmpnum *= k ** v
                tmpnum %= mod
        ans += tmpnum
        ans %= mod
    print(ans)




if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    N = int(readline())
    A = list(map(int, readline().split()))

    lcmnum = 1
    def gcd(a, b):
        if (a == 0):
            return b
        return gcd(b%a, a)

    def lcm(x, y):
        return (x * y) // gcd(x, y)
    for a in A:
        lcmnum = lcm(lcmnum, a)

    ans = 0
    for a in A:
        a = lcmnum // a
        ans += a
    ans %= mod

    print(ans)




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

# Debug Print
isdbg  = True
def dprint(*value,sep=' ',end='\n'):
    if isdbg:
        print(*value,sep=sep,end=end)
    
# 入力を格納
H,W,N = map(int,input().split())
    
#XY = [[0 for i in range(W)] for i in range(H)]
BL = {}
for i in range(N):
    x1,y1 = map(int,input().split())
    #XY[x1-1][y1-1] = 1
    BL[str(x1-1) + "," + str(y1-1)] = x1+y1-2
    
    
# 初期位置
#if isdbg:
#    for i in range(W):
#        for j in range(H):
#            dprint(XY[i][j],end='')
#        dprint()

TL = sorted(BL.items(), key=lambda x: x[1])
#print(TL)
    
if len(TL) == 0:
    print(H)
    exit(0)
    
min = H
for b in TL:
    x,y = map(int,b[0].split(','))
    sx = x-1
    sy = y
    
    isflg = True
    #dprint("\t",sx,sy)

    if str(sx)+","+str(sy) in BL :          
        isflg = False  
         
    while sx > 0 and sy > 0 :
        sx = sx - 1
        sy = sy - 1
        if str(sx)+","+str(sy) in BL :          
            isflg = False  
            break

    if isflg and sy == 0:
        if min> x:
            min = x

print(min)

### FIXED CODE ###

# Debug Print
isdbg  = False
#isdbg  = True
def dprint(*value,sep=' ',end='\n'):
    if isdbg:
        print(*value,sep=sep,end=end)
    
# 入力を格納
H,W,N = map(int,input().split())

if isdbg:
    XY = [[0 for i in range(W)] for i in range(H)]
BL = {}
for i in range(N):
    x1,y1 = map(int,input().split())
    if isdbg:
        XY[x1-1][y1-1] = 1

    if x1-1 in BL :
        BL[x1-1].append(y1-1)
    else:
        BL[x1-1] = [y1-1]

TL = sorted(BL.items(),key= lambda x: x[0])

# 初期位置
if isdbg:
    for i in range(W):
        for j in range(H):
            dprint(XY[i][j],end='')
        dprint()
#print(TL)

maxr = 1
for i in range(H-1):

    if i+1 in BL:
        l = BL[i+1]
        l.sort()
        #print(l,maxr)
        for ll in l :
            if maxr > ll:
                print(i+1)
                exit(0)
            elif maxr == ll:
                maxr -= 1
                break
            else:
                break
        
    maxr += 1

print(H)
### BUGGY CODE ###

n,k,q = map(int,input().split())
a=[int(input()) for _ in range(q)]
point=[k for i in range(n)]
for i in range(q):
    for j in range(n):
        if(j!=(a[i]-1)):
            point[j]-=1

for i in range(n):
    if(point[i]>0):
        print("Yes")
    else:
        print("No")






### FIXED CODE ###

n,k,q = map(int,input().split())
a=[int(input()) for _ in range(q)]
point=[k-q for i in range(n)]
for i in range(q):
    point[a[i]-1]+=1
 
for i in range(n):
    if(point[i]>0):
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    dp=[[[False]*1001 for _ in range(4)] for _ in range(n+1)]
    dp[0][0][0]=True
    
    for j in range(4):
        for k in range(1000):
            for i in range(n):
                if dp[i][j][k]==False:
                    continue
                dp[i+1][j][k]=True
                if j!=3:
                    dp[i+1][j+1][10*k+int(s[i])]=True
    ans=0
    for i in range(1000):
        if dp[n][3][i]:
            ans+=1
    print(ans)

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    ans=0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                if str(i) in s:
                    index_i=s.index(str(i))
                    s1=s[index_i+1:]
                    if str(j) in s1:
                        index_j=s1.index(str(j))
                        s2=s1[index_j+1:]
                        if str(k) in s2:
                            ans+=1
    print(ans)

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

import sys
sys.setrecursionlimit(10**8)
h, w = [int(i) for i in sys.stdin.readline().split()]
s_ls = []
bl_ls = []
for i in range(h):
    s = [1 if i == "#" else -1 for i in sys.stdin.readline().strip()]
    for j, k in enumerate(s):
        if k == 1:
            bl_ls.append((i, j))
    s_ls.append(s)

memo_ls = dict()
def dfs(y, x, col):
    if (y, x) in memo_ls:
        return memo_ls[(y, x)]
    res = 0
    if col == -1:
        res += 1
    already.add((y, x))
    for move_y, move_x in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
        next_y = y + move_y
        next_x = x + move_x
        if 0 <= next_x < w and 0 <= next_y < h and s_ls[next_y][next_x] == (-1) * col and (next_y, next_x) not in already:
            res += dfs(next_y, next_x, (-1) * col)
    return res

ans = 0
for bl in bl_ls:
    already = set()
    res = dfs(bl[0], bl[1], 1)
    ans += res
    for al in list(already):
        memo_ls[al] = res
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
h, w = [int(i) for i in sys.stdin.readline().split()]
s_ls = []
bl_ls = []
for i in range(h):
    s = [1 if i == "#" else -1 for i in sys.stdin.readline().strip()]
    for j, k in enumerate(s):
        if k == 1:
            bl_ls.append((i, j))
    s_ls.append(s)

memo_ls = dict()
def dfs(y, x, col):
    if (y, x) in memo_ls:
        return memo_ls[(y, x)]
    res = 0
    if col == -1:
        res += 1
    already.add((y, x))
    for move_y, move_x in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
        next_y = y + move_y
        next_x = x + move_x
        if 0 <= next_x < w and 0 <= next_y < h and s_ls[next_y][next_x] == (-1) * col and (next_y, next_x) not in already:
            res += dfs(next_y, next_x, (-1) * col)
    return res

ans = 0
for bl in bl_ls:
    already = set()
    stack = [(bl[0], bl[1], 1, 0)]
    cnt = 0
    while len(stack) > 0:
        y, x, col, _sum = stack.pop(-1)
        if (y, x) in memo_ls:
            cnt = memo_ls[(y, x)]
            break
        if col == -1:
            cnt += 1
        already.add((y, x))
        for move_y, move_x in [(0, 1), (0, -1), (1, 0), (-1, 0)]:
            next_y = y + move_y
            next_x = x + move_x
            if 0 <= next_x < w and 0 <= next_y < h and s_ls[next_y][next_x] == (-1) * col and (
            next_y, next_x) not in already:
                stack.append((next_y, next_x, (-1) * col, _sum))
                already.add((next_y, next_x))
    res = cnt
    ans += res
    for al in list(already):
        memo_ls[al] = res
print(ans)
### BUGGY CODE ###

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

MOD = 10**9 + 7

ans = 0
for i in range(1, N):
    for j in range(i+1, N+1):
        # print("{}:{}".format(i, j))
        ans += A[i-1] * A[j-1]
        ans %= MOD
print(ans)

### FIXED CODE ###

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

MOD = 10 ** 9 + 7

ans = 0
s = sum(A)
for a in A:
    s -= a
    ans += s * a
    ans %= MOD

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

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

for i in range(n):
    if i % 2 == n % 2:
        b.append(A[i])
    else:
        b.insert(0, A[i])


print(" ".join(map(str, b)))

### FIXED CODE ###

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

if n % 2 != 0:
    r = A[1::2]
    l = A[::2]
else:
    r = A[::2]
    l = A[1::2]
l.reverse()
print(" ".join(map(str, l + r)))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

def solve():
    N = II()
    A = LI()

    cost = {}
    for a in A:
        if cost.get(a, -1) == -1:
            cost[a] = 1
        else:
            cost[a] = 0

    A = sorted(A)

    memo = {}
    ans = 0
    for a in A:
        for i in range(1, int(a ** 0.5) + 1):
            if a % i: continue
            if memo.get(i, -1) != -1 or memo.get(a//i, -1) != -1:
                break
        else:
            ans += cost[a]

        memo[a] = 1
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

def solve():
    N = II()
    A = LI()

    mx = max(A)

    memo = [0] * (mx + 1)
    for a in A:
        for i in range(a, mx+1, a):
            memo[i] += 1
    # print(memo)

    ans = 0
    for a in A:
        if memo[a] == 1:
            ans += 1
    print(ans)

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

import numpy as np
import sys

N = int(input())
As = [list(map(int,input().split())) for i in range(N)]

As = np.array(As)-1


current_waitings = As[:,0]

game_counter = np.zeros(N).astype('int')

day = 0
completed_players = []
res = N*(N-1)//2
while res:
    day_player = []
    no_game = True
    for i,e1 in enumerate(current_waitings):
        if i in completed_players:
            continue
        if current_waitings[e1] == i and e1 not in day_player and i not in day_player:
            no_game = False
            res -= 1
            day_player.append(i)
            day_player.append(e1)
            if game_counter[i] == N-2:
                completed_players.append(i)
            if game_counter[i] <= N-3:
                game_counter[i] += 1
            if game_counter[e1] == N-2:
                completed_players.append(e1)
            if game_counter[e1] <= N-3:
                game_counter[e1] += 1
            current_waitings[i] = As[i][game_counter[i]]
            current_waitings[e1] = As[e1][game_counter[e1]]
    if no_game:
        print(-1)
        sys.exit()
    day += 1
print(day)


### FIXED CODE ###

from collections import deque
def solve():
    n = int(input())
    a = []
    for i in range(n):
        ai = [int(j)-1 for j in input().split()]
        a.append(deque(ai))
    d = set()
    q = deque()
    for i in range(n):
        ai = a[i].popleft()
        if i < ai:
            q.append((i, ai))
        else:
            q.append((ai, i))
    ans = 0
    while q:
        ans += 1
        nxt_q = deque()
        while q:
            i, ai = q.pop()
            if (i, ai) in d:
                if a[i]:
                    ni = a[i].popleft()
                    if i < ni:
                        nxt_q.append((i, ni))
                    else:
                        nxt_q.append((ni, i))
                if a[ai]:
                    ni = a[ai].popleft()
                    if ai < ni:
                        nxt_q.append((ai, ni))
                    else:
                        nxt_q.append((ni, ai))
            else:
                d.add((i, ai))
        q = nxt_q
    if any(i for i in a):
        ans = -1
    print(ans)

solve()
### BUGGY CODE ###

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

a=-999999999
for i in range(1,n):
	for j in range(i):
		if a<Rt[i]-Rt[j]:
			a=Rt[i]-Rt[j]
		
print(a)


### FIXED CODE ###

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

maxv=Rt[1]-Rt[0]
minv=Rt[0]
for j in range(1,n):
	maxv=max(maxv,Rt[j]-minv)
	minv=min(minv,Rt[j])
		
print(maxv)