<jupyter_start><jupyter_text><jupyter_code>def func(diff):
    n=len(diff)
    if n==0:
        return 0
    mx=max(diff)
    print('mx', mx)
    if mx<=0:
        return 0
    mxS=0
    cS=0
    for i in diff:
        cS+=i
        if cS<=0:
            cS=0
        mxS=max(cS,mxS)
    return mxS


n=int(input())
arr=[]
diff=[]
ans=[0]
for i in range(n):
    arr.append(int(input()))
for i in range(n-1):
    diff.append(arr[i+1]-arr[i])

print('arr', arr)
print('diff', diff)    
ans=func(diff)
if ans<0:
    print("0")
else:
    print(ans)<jupyter_output>6
12
15
13
18
10
43
arr [12, 15, 13, 18, 10, 43]
diff [3, -2, 5, -8, 33]
mx 33
33
{'fraction_non_alphanumeric': 0.1794071762870515, 'fraction_numerical': 0.0748829953198128, 'mean_word_length': 2.3789473684210525, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '305051', 'license': 'Apache-2.0', 'n_tokens_mistral': 323, 'n_tokens_neox': 297, 'n_words': 73, 'path': 'Crazy_Share_Holder.ipynb', 'repo_name': 'AjeeshSMohan/it-cert-automation-practice', 'size': '641'}