Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy python submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy python submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = []
for b in an:
  if b != "" and b != " ":
    ani.append(int(b))
if len(ani) == 1:
  print("0")
else:
  print(f(0,0,ani,0))

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy python submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(f(0,0,ani,0))

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy python submission (verdict: Runtime Error):
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
print(f(0,0,ani,0))

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))

Buggy python submission (verdict: Runtime Error):
def f(i,ans,l):
  if (i+1) == (len(l)-1):
    return max(ans,l[i+1]-l[i])
  else:
    return f(i+1,max(ans,l[i+1]-l[i]),l)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
print(str(f(0,0,ani)))

Fixed submission:
import sys
sys.setrecursionlimit(2000000)
def f(i,ans,l,t):
  if (i+1) == (len(l)-1):
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return t+ans
    else:
      return t
  else:
    if (ans+l[i]) > l[i+1]:
      ans = ans + l[i]-l[i+1]
      return f(i+1,ans,l,t+ans)
    else:
      return f(i+1,0,l,t)
n = input("")
an = input("").split(" ")
ani = [int(a) for a in an]
if len(ani) == 1:
  print("0")
else:
  print(str(f(0,0,ani,0)))