Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

Maximum Profit

You can obtain profits from foreign exchange margin transactions. For example,  if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) &times; 1000 = 8000 yen.

  Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .

Input

The first line contains an integer $n$. In the following $n$ lines, $R_t$ ($t = 0, 1, 2, ... n-1$) are given in order.

Output

Print the maximum value in a line.

Constraints

  
$2 \leq n \leq 200,000$

  
$1 \leq R_t \leq 10^9$

Sample Input 1

6
5
3
1
3
4
3

Sample Output 1

3

Sample Input 2

3
4
3
2

Sample Output 2

-1



Sample input:
6
5
3
1
3
4
3


Sample output:
3

Submission status: Runtime Error

Solution code:
n = input()
if n >= 2 and n <= 200000
   for i in range(0, n-1):
      R = map(int, raw_input().split())
   minv = R[0]
   maxv = R[1] - R[0]
   for j in range(1, n-1):
      maxv = max(maxv, R[j] - minv) 
      minv = min(minv, R[j])
print maxv - minv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in range(n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n-1)
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v]:
      maxv = R[v] - minv
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in range(n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n-1)
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v] - minv:
      maxv = R[v] 
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in xrange(n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n-1)
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v] - minv:
      maxv = R[v] 
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in irange(n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n-1):
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in range(0, n-1):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n):
   if minv > R[v]:
      minv = R[v]
   if maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in range(0, n-1):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n):
   if minv > R[v]:
      minv = R[v]
   elif maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in range(1, n):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n):
   if minv > R[v]:
      minv = R[v]
   elif maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv

Submission status: Runtime Error

Solution code:
n = input()
R = []
for i in range(1, n-1):
   R.append(int(raw_input()))

maxv = R[1] - R[0]
minv = R[0]

for v in range(1, n):
   if minv > R[v]:
      minv = R[v]
   elif maxv < R[v] - minv:
      maxv = R[v] - minv
print maxv

Submission status: Runtime Error

Solution code:
max = 0
n_max = 19999

price = [0]*n_max
for i in range(n_max):
  price[i] = int(raw_input())

for i in range(n_max):
  for j in range(j, n_max+1):
    if max <= price[j] - price[i]:
      max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 19999

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max):
    for j in range(k, n_max):
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 19

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max):
    for j in range(k, n_max):
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 10

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 7

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 6

price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0

n_max = int(raw_input())
price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0

n_max = int(raw_input())
price = [0]*n_max
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

n_max = int(raw_input())
price = []
for k in range(n_max):
    price.attend(int(raw_input())
    
for i in range(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
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(n_max)
    for j in range(i, n_max)
        if max <= price[j] - price[i]:
            max = price[j] - price[i]
print max

Submission status: Runtime Error

Solution code:
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(n_max)
    if max <= price[j] - price[i]:
    print max

Submission status: Runtime Error

Solution code:
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)
    if max <= price[j] - price[i]:
    print max

Submission status: Runtime Error

Solution code:
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):
    if max <= price[j] - price[i]:
    print max

Submission status: Runtime Error

Solution code:
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(n_max)
    for j in range(k, n_max)
        if max <= price[j] - price[i]:
            print max

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
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(j, 6)
        if max <= price[j] - price[i]:
            print max

Submission status: Runtime Error

Solution code:
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(j, 6)
        if max <= price[5] - price[i]:
            print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

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

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

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

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

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

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

for i in range(5)
    if max <= price[5] - price[i]:
        print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

for i in range(5)
  if max <= price[5] - price[i]:
    print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

for i in range(5)
  for i in range(5)
    if max <= price[5] - price[i]:
      print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

for i in range(5):
  for i in range(5):
    if max <= price[5] - price[i]:
      print max

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

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

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

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

Submission status: Runtime Error

Solution code:
max = 0
i = 0
j = 0
k = 0
n_max = 0

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

for i in range(5):
  if max <= price[5] - price[i]:
    print max

Submission status: Runtime Error

Solution code:
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(6):
????????????????if max <= price[j] - price[i]:
????????????????????????print max

Submission status: Runtime Error

Solution code:
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(6):
????????????if max <= price[j] - price[i]:
????????????????????print max

Submission status: Runtime Error

Solution code:
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(6):
????????????if max <= price[j] - price[i]:
????????????????????print max

Submission status: Runtime Error

Solution code:
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(6):
????????????  if max <= price[j] - price[i]:
????????????????????  print max

Submission status: Runtime Error

Solution code:
n = raw_input()
n = int(n)
minv = raw_input()
minv = iny(minv)
maxv = -1000000000
  
for j in range(n-1):
  num = raw_input()
  num = int(num)  
  diff = num - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = num
  
print maxv

Submission status: Runtime Error

Solution code:
n = int(input())

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

Max = R[2] - R[1]

for i in range(n):
    for j in range(i+1,n):
        if R[j] - R[i] >  Max : Max =  R[j] - R[i]
        
print Max

Submission status: Runtime Error

Solution code:
n = int(input())

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

Max = R[2] - R[1]

for i in range(n):
    for j in range(i+1,n):
        if R[j] - R[i] >  Max : Max =  R[j] - R[i]
        
print Max

Submission status: Runtime Error

Solution code:
N = int(raw_input())
R = []
for i in range(N)
    R.append(int(raw_input()))

max = R[1] - R[0]
for i in range(N - 1)
    for j in range(i)
        dif = R[i+1] - R[j]
        if dif > max:
            max = dif

print max

Submission status: Runtime Error

Solution code:
N = int(raw_input())
R = []
for i in range(N):
    R[i] = (int(raw_input()))

max = R[1] - R[0]
for i in range(N - 1):
    for j in range(i):
        dif = R[i+1] - R[j]
        if dif > max:
            max = dif

print max

Submission status: Runtime Error

Solution code:
N = int(raw_input())
max = 0
min = 0
for i in range(N):
    R.append(int(raw_input()))

min = R[0]
max = R[1]
dif = R[1] - R[0]
for i in range(N - 1):
    if R[i+1] > max:
        max = R[i+1]
        dif = max - min
    if R[i] < min:
        min = R[i]
        dif = max - min

print dif

Submission status: Runtime Error

Solution code:
N = int(raw_input())
min = int(raw_input())
max = int(raw_input())
dif = max - min
for i in range(N):
    R = int(raw_input())
    if R - min > dif:
        dif = R - min
    if R < min:
        min = R

print dif

Submission status: Runtime Error

Solution code:
n = input()
maximum = 0
minimum = 0

for i in range(n):
  tmp = imput()
  maximum = max(maximum, tmp)
  minimum = min(minimum, tmp)

print maximum

Submission status: Runtime Error

Solution code:
n = input()
maximum = 0
minimum = 0

for i in range(n):
  tmp = imput()
  maximum = max(maximum, tmp)
  minimum = min(minimum, tmp)

print maximum-minimum

Submission status: Runtime Error

Solution code:
n = input()
maxi = 0
mini = 10**9


for i in range(n):
  tmp = input()
  maxi = max(maxi, tmp)
  mini = min(mini, tmp)

ans = maxi - min

print ans

Submission status: Runtime Error

Solution code:
n = int(raw_input())
maxv = int(raw_input())
minv = int(raw_input())
maxv = -10**9

for j in range(0,n-1):
   nums = int(raw_input())
   deff = nums - minv
   if maxv < deff:
     maxv = deff
   if minv > nums:
     minv = nums
print maxv

Submission status: Runtime Error

Solution code:
n = int(raw_input())
maxv = int(raw_input())
minv = int(raw_input())
maxv = -10**9

 for j in range(0,n-1):
   nums = int(raw_input())
   diff = nums - minv
   maxv = max(maxv,diff)
   minv = min(minv,nums)
 print maxv

Submission status: Runtime Error

Solution code:
n = int(raw_input())
minv = int(raw_input())
maxv = -10**9

 for j in range(0,n-1):
   nums = int(raw_input())
   diff = nums - minv
   maxv = max(maxv,diff)
   minv = min(minv,nums)
 print maxv

Submission status: Runtime Error

Solution code:
 n = int(raw_input())
 maxv = -10**9
 minv = 10**9

 for j in range(0,n-1):
   nums = int(raw_input())
   diff = nums - minv
   maxv = max(maxv,diff)
   minv = min(minv,nums)
 print maxv

Submission status: Runtime Error

Solution code:
 n = int(raw_input())
 maxv = -10**9
 minv = 10**9

 for j in range(n-1):
   nums = int(raw_input())
   diff = nums - minv
   maxv = max(maxv,diff)
   minv = min(minv,nums)
 print maxv

Submission status: Runtime Error

Solution code:
n = input()
maxv = -10**9
minv = R[]

for i in range(n-1):
  maxv = max(maxv, R[i]-minv)
  minv = min(minv, R[i])

print maxv

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
min = R[]

for i in range(n-1):
 if max <= R[i] - min:
  max = R[i] - min
 if R[i] <= min:
  min = R[i]

print max

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
min = R[]

for i in range(0, n-1):
 if R[i] <= min:
   min = R[i]
 if max <= R[i] - min:
  max = R[i] - min

print max

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
min = R[]

for i in range(0, n-1):
 R[i] = input()
 if R[i] <= min:
   min = R[i]
 if max <= R[i] - min:
  max = R[i] - min

print max

Submission status: Runtime Error

Solution code:
 n = int(raw_input())
 maxv = -1*10**9
 minv = 10**9

 for j in range(n-1):
   num = int(raw_input())
   diff = num - minv
   maxv = max(maxv,diff)
   minv = min(minv,num)
 print maxv

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
min = 0
 
for i in range(0, n-1):
 R[i] = input()
 if R[i] <= min:
   min = R[i]
 if max <= R[i] - min:
  max = R[i] - min
 
print max

Submission status: Runtime Error

Solution code:
 n = int(raw_input())
 maxv = -1*10**9
 minv = int(raw_input())

 for j in range(n-1):
   num = int(raw_input())
   diff = num - minv
   maxv = max(maxv,diff)
   minv = min(minv,num)
 print maxv

Submission status: Runtime Error

Solution code:
 n = int(raw_input())
 maxv = -1*10**9
 minv = int(raw_input())

 for j in range(n-1):
   num = int(raw_input())
   maxv = max(maxv,num - minv)
   minv = min(minv,num)
 print maxv

Submission status: Runtime Error

Solution code:
 n = int(raw_input())
 maxv = -1*10**9
 minv = int(raw_input())

 for j in range(n-1):
   num = int(raw_input())
   maxv = max(maxv, num - minv)
   minv = min(minv, num)


 print maxv

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
 
for i in range(0, n-1):
 R[i] = input()
 min = R[0]

for i in range(0, n-1):
 if R[i] <= min:
   min = R[i]
 if max <= R[i] - min:
  max = R[i] - min
 
print max

Submission status: Runtime Error

Solution code:
  n = int(raw_input())
  maxv = -1*10**9
  minv = int(raw_input())

  for j in range(n-1):
    num = int(raw_input())
    maxv = max(maxv, num - minv)
    minv = min(minv, num)

  print maxv

Submission status: Runtime Error

Solution code:
  n = int(raw_input())
  maxv = -1*10**9
  minv = 10**9

  for j in range(n-1):
    num = int(raw_input())
    maxv = max(maxv, num - minv)
    minv = min(minv, num)

  print maxv

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
min = input()
 
for i in range(n-1):
 if R[i] <= min:
  min = R[i]
 if max <= R[i] - min:
  max = R[i] - min
 
print max

Submission status: Runtime Error

Solution code:
  n = int(raw_input())
  maxv = -1*10**9
  minv = 10**9

  for i in range(n-1):
    num = int(raw_input())
    maxv = max(maxv, num - minv)
    minv = min(minv, num)

  print maxv

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = set()
max = -10^9
x=0
for i in range(n-1)
    l.add(int(raw_input())

for s in range(n-1)
 for t in range(s-1)
  x= l[n-s]-l[n-t]
  if max<x:
   max=x
printf('%d')%(max)

Submission status: Runtime Error

Solution code:
n = input()
max = -10**9
 
for i in range(0, n-1):
 R[i] = input()

min = R[0]

for i in range(0, n-1):
 if R[i] <= min:
  min = R[i]
 if max <= R[i] - min:
  max = R[i] - min
 
print max

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = set()
max = -10^9
x=0
for i in range(n-1)
    l.add(int(raw_input())

for s in range(n-1)
 for t in range(s-1)
  x= l[n-s-1]-l[n-t-1]
  if max<x:
   max=x
printf('%d')%(max)

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = []
max = -10^9
x=0
for i in range(n-1)
    l.append(int(raw_input())

for s in range(n-1)
 for t in range(s-1)
  x= l[n-s-1]-l[n-t-1]
  if max<x:
   max=x
printf('%d')%(max)

Submission status: Runtime Error

Solution code:
n = input()
n_max = -10**9
 
for i in range(0, n-1):
 R[i] = input()

n_min = R[0]

for i in range(0, n-1):
 if R[i] <= n_min:
  n_min = R[i]
 if max <= R[i] - n_min:
  n_max = R[i] - n_min
 
print n_max

Submission status: Runtime Error

Solution code:
n = input()
n_max = -10**9
 
for i in range(0, n-1):
 R[i] = input()

n_min = R[0]

for i in range(0, n-1):
 if R[i] <= n_min:
  n_min = R[i]
 if n_max <= R[i] - n_min:
  n_max = R[i] - n_min
 
print n_max

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = []
max = -10^9
x=0
for i in range(n-1):
    l.append(int(raw_input())

for s in range(n-1):
 for t in range(s-1):
  x= l[n-s-1] - l[n-t-1]
  if max<x:
   max=x
printf('%d')%(max)

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = []
max = -10^9
x=0
for i in (n-1):
    l.append(int(raw_input())

for s in (n-1):
 for t in (s-1):
  x= l[n-s-1] - l[n-t-1]
  if max<x:
   max=x
printf('%d')%(max)

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = []
max = -10^9
x=0
for i in range(n-1):
    l.append(int(raw_input())

for s in range(n-1):
 for t in range(s-1):
  x= l[n-s-1] - l[n-t-1]
  if max<x:
   max=x
printf'%d'%(max)

Submission status: Runtime Error

Solution code:
n = int(raw_input())
l = []
max = -10^9
x=0
for i in range(n-1):
    l.append(int(raw_input())

for s in range(n-1):
 for t in range(s-1):
  x= l[n-s-1] - l[n-t-1]
  if max<x:
   max=x
print'%d'%(max)

Submission status: Runtime Error

Solution code:
  n = int(raw_input())
  maxv = -1*10**9
  minv = 10**9

  for j in range(n-1):
    num = int(raw_input())
    if maxv < num - minv:
      maxv = num -minv
    if minv > num:
      minv = num

  print maxv

Submission status: Runtime Error

Solution code:
  n = input()
  maxv = -1*10**9
  minv = 10**9

  for j in range(n-1):
    num = input()
    if maxv < num - minv:
      maxv = num -minv
    if minv > num:
      minv = num

  print maxv

Submission status: Runtime Error

Solution code:
  n = input()
  maxv = -1*10**9
  minv = input()

  for j in range(n-1):
    num = input()
    if maxv < num - minv:
      maxv = num - minv
    if minv > num:
      minv = num

  print maxv

Submission status: Runtime Error

Solution code:
  n = input()
  maxv = -1*10**9
  minv = 10**9

  for j in range(0, n-1):
    num = input()
    if maxv < num - minv:
      maxv = num -minv
    if minv > num:
      minv = num

  print maxv

Submission status: Runtime Error

Solution code:
  n = input()
  maxv = -1*10**9
  minv = input()

  for j in range(0, n-1):
    nums = input()
    if maxv < nums - minv:
      maxv = nums - minv
    if nums < minv:
      minv = nums

  print maxv

Submission status: Runtime Error

Solution code:
  n = input()
  max = -1*10**9
  min = input()

  for i in range(0, n-1):
    a = input()
    if max < a - min:
      max = a - min
    if a < min:
      min = a

  print max

Submission status: Runtime Error

Solution code:
  n = input()
  max = -(10**9)
  min = input()

  for i in range(0, n-1):
    a = input()
    if max < a - min:
      max = a - min
    if a < min:
      min = a

  print max

Submission status: Runtime Error

Solution code:
  n = input()
  max = -(10**9)
  min = input()

  for i in range(0, n-1):
    a = input()
    if max < a - min:
      max = a - min
    if a < min
      min = a

  print max

Submission status: Runtime Error

Solution code:
  n = input()
  n_max = -(10**9)
  n_min = input()

  for i in range(0, n-1):
    R = input()
    if n_max < R - n_min:
      n_max = R - n_min
    if R < n_min
      n_min = R

  print n_max

Submission status: Runtime Error

Solution code:
  n = input()
  n_max = -(10**9)
  n_min = input()

  for i in range(0, n-1):
   R = input()
   if n_max < R - n_min:
    n_max = R - n_min
   if R < n_min:
    n_min = R

  print n_max

Submission status: Runtime Error

Solution code:
  n = input()
  n_max = -1000000000
  n_min = input()

  for i in range(0, n-1):
   R = input()
   if n_max < R - n_min:
    n_max = R - n_min
   if R < n_min:
    n_min = R

  print n_max

Submission status: Runtime Error

Solution code:
  n = input()
  n_max = -(1000000000)
  n_min = input()

  for i in range(0, n-1):
   R = input()
   if n_max < R - n_min:
    n_max = R - n_min
   if R < n_min:
    n_min = R

  print n_max

Submission status: Runtime Error

Solution code:
n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if num < minv:
    minv = nums
  
print maxv

Submission status: Runtime Error

Solution code:
n = int(raw_input())
max = -10^9
min = 10^9
ans = -10^9
for i in range(n):
 x[i] = int(raw_input())
for s in range(n-1):
 for t in range(n-1):
  if ans < (x[n-1-s]-x[n-1-t]):
   ans=x[n-1-s]-x[n-1-t]
print ans

Submission status: Runtime Error

Solution code:
n = int(raw_input())
max = -10^9
min = 10^9
ans = -10^9
for i in range(n):
 x[i] = int(raw_input())
for s in range(n):
 for t in range(n):
  if ans < (x[n-1-s]-x[n-1-t]):
   ans=x[n-1-s]-x[n-1-t]
print ans

Submission status: Runtime Error

Solution code:
n = (int)input()
while n > 0:
a[n] = (int)input()
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print "max"

Submission status: Runtime Error

Solution code:
n = (int)input()
while n > 0:
a[n] = (int)input()
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print "max"

Submission status: Runtime Error

Solution code:
n = (int)input()
i = 0
while n > i:
  a[i] = (int)input()
  i+=1
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print "max"

Submission status: Runtime Error

Solution code:
n = (int)input()
i = 0
while n > i:
  a.append((int)input())
  i+=1
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print "max"

Submission status: Runtime Error

Solution code:
n = (int)input()
i = 0
while n > i:
  a.append((int)input())
  i+=1
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = (int)input()
a = []
for i in range(n):
     a.append((int)input())
  i+=1
for j in range(n):
     a.append((int)input())
   j+=1
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = (input()
a = []
for i in range(n):
     a.append(input())
  i+=1
for j in range(n):
     a.append(input())
   j+=1
j = 1
i = 0
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = (input()
a = []
j = 1
i = 0
for i in range(n):
     a.append(input())
  i+=1
for j in range(n):
     a.append(input())
   j+=1
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = (input()
a = []
for i in range(n):
     a.append(input())
  i+=1
for j in range(n):
     a.append(input())
   j+=1
max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = (input()
a = []
for i in range(n):
     a.append(input())
 
for j in range(n):
     a.append(input())

max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = (input()
a = []
for i in range(n):
    a.append(input()) 
    for j in range(n):
     a.append(input())

max = a[j]-a[i]
 while i < n:
    while  j < n:
       if max < a[j]-a[i]:
          max = a[j]-a[i]
        j+ = 1
     i+ = 1
  print  max

Submission status: Runtime Error

Solution code:
n = input():
a = []
a = [input for i in range(n)]
i = 0
j = 1
max = a[j]-a[i]
while n > i:
   j = i+1
   while n > j:
        if max < a[j]-a[i]:
           max = a[j]-a[i]
        j+=1
    i+=1

print max

Submission status: Runtime Error

Solution code:
n = input()
a = []
a = [input for i in range(n)]
i = 0
j = 1
max = a[j]-a[i]
while n-1 > i:
   j = i+1
   while n-1 > j:
        if max < a[j]-a[i]:
           max = a[j]-a[i]
        j+=1
    i+=1

print max

Submission status: Runtime Error

Solution code:
n = input()
a = []
a = [input for i in range(n)]
i = 0
j = 1
max = a[j]-a[i]
while n > i:
   j = i+1
   while n > j:
        if max < a[j]-a[i]:
           max = a[j]-a[i]
        j+=1
    i+=1

print max

Submission status: Runtime Error

Solution code:
n = input()
max = -1 * 10**9
min = input()
 
 
for i in range(n-1):
  tmp = input()
  max = max(maxi, tmp - min)
  min = min(mini, tmp)
 
print max

Submission status: Runtime Error

Solution code:
n=input()
 a = []
for i in range(n):
    a.append(int(raw_input())

max= -1*10**9
min = a[0]

for i in range(n-1):
  max = max(max, max - a[i])
  min = min(min, a[i])
 
print max

Submission status: Runtime Error

Solution code:
n = input()
 a = []
  for i in range(n):
    l.append(int(raw_input())
 
  Min = a[0]
  Max = -1*10**9
  for j in range(1,N):
   Max = max(Max,a[j]-Min)
   Min = min(Min,a[j])
  print Max

Submission status: Runtime Error

Solution code:
 n=input()
for i in range(n):
    if i==0:
        num_1=input()
    elif i==1:
        num_2=input()
        maxv=num_2 - num_1
        MIN=min(num_1,num_2)
    else:
        num_3=input()
        if (num_3-MIN)>maxv:
            maxv=num_3-MIN
        if (num_3)<MIN:
            MIN=num_3
print(maxv)

Submission status: Runtime Error

Solution code:
n = int(raw_input())
a = []
a.append(int(raw_input()))
Min = a[0]
Max = -1*10**9
for j in range(1,n):
    a.append(int(raw_input()))
    Max = max(Max,R[j]-Min)
    Min = min(Min,R[j])
print Max

Submission status: Runtime Error

Solution code:
num = input()
max = 1 - 1000000000
for i in range (len (num)):
    for j in range (len (num)):
        if (max > (num[i] - num[j])):
            max = num[i] - num[j]
print max

Submission status: Runtime Error

Solution code:
num = raw_input()
max = 1 - 1000000000
for i in range (len (num)):
    for j in range (len (num)):
        if (max > (num[i] - num[j])):
            max = num[i] - num[j]
print max

Submission status: Runtime Error

Solution code:
n = input()
m = [0] * n
max = [0] * n
kijun = [0] * n
rieki = [0] * n
max_rieki = 0
for i in xrange(n):
 m[i] = input()


for i in xrange(n-1):
 max[i] = m[i+1] #0???i
 kijun[i] = m[i]
 for j in xrange(i+1,n): #1 wo i+1 n-1 wo n-1+i
  if max[i] < m[j]:
      max[i] = m[j]
 rieki[i] = max[i] - kijun[i]
max_rieki = rieki[0]
for i in xrange(1,n):
  if rieki[i] > max_rieki:
   max_rieki = rieki[i]
print max_rieki

Submission status: Runtime Error

Solution code:
n = input()
m = [0] * n
max = [0] * n
kijun = [0] * n
rieki = [0] * n
max_rieki = 0
for i in xrange(n):
 m[i] = raw_input()


for i in xrange(n-1):
 max[i] = m[i+1] #0???i
 kijun[i] = m[i]
 for j in xrange(i+1,n): #1 wo i+1 n-1 wo n-1+i
  if max[i] < m[j]:
      max[i] = m[j]
 rieki[i] = max[i] - kijun[i]
max_rieki = rieki[0]
for i in xrange(1,n):
  if rieki[i] > max_rieki:
   max_rieki = rieki[i]
print max_rieki

Submission status: Runtime Error

Solution code:
n = input()
m = [0] * n
max = [0] * n
kijun = [0] * n
rieki = [0] * n
max_rieki = 0
for i in xrange(n):
 m[i] = raw_input()


for i in xrange(n-1):
 max[i] = m[i+1]
 kijun[i] = m[i]
 for j in xrange(i+1,n):
  if max[i] < m[j]:
      max[i] = m[j]
 rieki[i] = max[i] - kijun[i]
max_rieki = rieki[0]
for i in xrange(1,n):
  if rieki[i] > max_rieki:
   max_rieki = rieki[i]
print max_rieki

Submission status: Runtime Error

Solution code:
num = raw_input()
max = 1 - 1000000000
n   = len(input)

for i in range (n - 1):
    for j in range (i + 1, n):
        if (max > (num[i] - num[j])):
            max = num[i] - num[j]

print max

Submission status: Runtime Error

Solution code:
def main(){
 
    int n, max, min, i;
    int R[200000];
 
    n = input()
    for i in n-1:
        R[i] = input()
 
    max = R[1] - R[0]
    min = R[0]
 
    for i+1 in n-1:
        if R[i]-min>max:
            max = R[i] - min
        if R[i]<min
            min = R[i]
 
    print "%d" % max
 
    return 0

}