Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x = input()
print(x**3)

Fixed submission:
x = (int)(input())
print(x**3)
Buggy python submission (verdict: Runtime Error):
S = int(input())
h = S / 3600
m = (S - h * 3600) / 60
s = S - h * 3600 - s * 60
print(h, m, s, sep = ':')

Fixed submission:
S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 60
print(h, m, s, sep = ':')
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a > b:
    print("a > b")
else if a == b:
    print("a == b")
else if a < b:
    print("a < b")

Fixed submission:
a, b = map(int, input().split())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

Fixed submission:
a, b = map(int, input().split())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

Fixed submission:
a, b = map(int, input().split())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split)
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")

Fixed submission:
a, b = map(int, input().split())
if a > b:
    print("a > b")
elif a == b:
    print("a == b")
else:
    print("a < b")
Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input(), split())
if ((x + r) <= W) and ((y + r) <= H) :
    print("Yes")
else :
    print("No")

Fixed submission:
W, H, x, y, r = map(int, input().split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input(), split())
if ((x + r) <= W) and ((y + r) <= H) :
    print "Yes"
else :
    print "No"

Fixed submission:
W, H, x, y, r = map(int, input().split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input(), split())
if (x <= (W-r)) and (y <= (H-r)) :
    print ("Yes")
else :
    print ("No")

Fixed submission:
W, H, x, y, r = map(int, input().split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input(), split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")

Fixed submission:
W, H, x, y, r = map(int, input().split())
if ((x-r) >= 0) and ((x+r) <= W) :
    if((y-r) >= 0) and ((y+r) <= H) :
        print ("Yes")
    else :
        print ("No")
else :
    print ("No")
Buggy python submission (verdict: Runtime Error):
while True:
    x, y = map(int, input().split())
    if (x > y):
        print(y, x)
    else:
        print(x, y)

Fixed submission:
while True:
    x, y = map(int, input().split())
    if (x == y == 0):
        break
    elif (x > y):
        print(y, x)
    else:
        print(x, y)

Buggy python submission (verdict: Runtime Error):
while True:
    x, y = map(int, input().split())
    if (x == y == 0):
        break
    else if (x > y):
        print(y, x)
    else:
        print(x, y)

Fixed submission:
while True:
    x, y = map(int, input().split())
    if (x == y == 0):
        break
    elif (x > y):
        print(y, x)
    else:
        print(x, y)
Buggy python submission (verdict: Runtime Error):
n = int(input())
F = [1, 1] + [0] * [44 + 1]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])

Fixed submission:
n = int(input())
fib = [1, 1] + [0 for i in range(44)]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])

Buggy python submission (verdict: Runtime Error):
n = int(input())
F = [1, 1] + [0 for i in range(44)]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])

Fixed submission:
n = int(input())
fib = [1, 1] + [0 for i in range(44)]
for i in range(2, n + 1):
    fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n])
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]

m = [[0] * n for i in range(n)]

for l in range(2, n + 1):
    for i in range(n - k + 1):
        j = i + l - 1
        m[i][j] = float('inf')
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i][0] * p[k][1] * p[j][1])

print(m[0][n - 1])

Fixed submission:
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]

m = [[0] * n for i in range(n)]

for l in range(2, n + 1):
    for i in range(n - l + 1):
        j = i + l - 1
        m[i][j] = float('inf')
        for k in range(i, j):
            m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i][0] * p[k][1] * p[j][1])

print(m[0][n - 1])
Buggy python submission (verdict: Runtime Error):
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(n):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return c1[-1]

q = int(input())
for k in range(q):
    x = input()
    y = input()
    print(Ics(x, y))

Fixed submission:
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(b):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
r = []
for k in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    r.append(Ics(s1, s2))

print(*r, sep = "\n")

Buggy python submission (verdict: Runtime Error):
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(n):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
r = []
for k in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    r.append(Ics(s1, s2))

print(*r, sep = "\n")

Fixed submission:
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(b):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
r = []
for k in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    r.append(Ics(s1, s2))

print(*r, sep = "\n")

Buggy python submission (verdict: Runtime Error):
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(n):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return c1[-1]

q = int(input().rstrip())
r = []
for k in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    r.append(Ics(s1, s2))

print(*r, sep = "/n")

Fixed submission:
def Ics(x, y):
    a = len(x)
    b = len(y)
    c1 = [0] * (b + 1)

    for i in range(a):
        d = x[i]
        c2 = c1[:]
        for j in range(b):
            if d == y[j]:
                c1[j + 1] = c2[j] + 1
            elif c1[j + 1] < c1[j]:
                c1[j + 1] = c1[j]
    return (c1[-1])

q = int(input().rstrip())
r = []
for k in range(q):
    s1 = input().rstrip()
    s2 = input().rstrip()
    r.append(Ics(s1, s2))

print(*r, sep = "\n")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(math.gcd(a, b))

Fixed submission:
x, y = map(int, input().split())
while True:
  if x >= y:
    x = x % y
  else:
    y = y % x
  if x % y == 0:
    print(y)
    break
  elif y % x == 0:
    print(x)
    break

Buggy python submission (verdict: Runtime Error):
a, b = map(int, iput().split())
print(gcd(a, b))

Fixed submission:
x, y = map(int, input().split())
while True:
  if x >= y:
    x = x % y
  else:
    y = y % x
  if x % y == 0:
    print(y)
    break
  elif y % x == 0:
    print(x)
    break

Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
while True:
  if x >= y:
    x = x % y
  else:
    y = y % x
  if x % y == 0:
    print(x)
    break
  elif y % x == 0:
    print(y)
  

Fixed submission:
x, y = map(int, input().split())
while True:
  if x >= y:
    x = x % y
  else:
    y = y % x
  if x % y == 0:
    print(y)
    break
  elif y % x == 0:
    print(x)
    break
Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  for j in range(x - 1):
    if x == 2:
      count += 1
    elif x % 2 == 0:
      continue
    else:
      if x % j != 0:
        count += 1
print(count)

Fixed submission:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  for j in range(x):
    if x == 2:
      count += 1
    elif x % 2 == 0:
      continue
    else:
      if x % j != 0:
        count += 1
print(count)

Fixed submission:
n = int(input())
count = 0
for i in range(n):
  x = int(input())
  if x == 2:
    count += 1
  elif x % 2 == 0:
    continue
  else:
    if pow(2, x - 1, x) == 1: 
      count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N)
  minj = i
  for j in range(i, N)
    if a[j] < a[minj]
      minj = j
  if a[i] != a[minj]
    a[minj], a[i] = a[i], a[minj]
    count += 1
print(" ".join(map(str, a)))
print(count)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N):
  minj = i
  for j in range(i, N):
    if a[j] < a[minj]:
      minj = j
  if a[i] != a[minj]:
    a[minj], a[i] = a[i], a[minj]
    count += 1
print(*a)
print(count)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N)
  minj = i
  for j in range(i, N)
    if a[j] < a[minj]
      minj = j
  if a[i] != a[minj]
    a[minj], a[i] = a[i], a[minj]
    count += 1
print(*a)
print(count)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(N):
  minj = i
  for j in range(i, N):
    if a[j] < a[minj]:
      minj = j
  if a[i] != a[minj]:
    a[minj], a[i] = a[i], a[minj]
    count += 1
print(*a)
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = map(int, input(). split())
q = int(input())
T = map(int, input(). split())

print(len(S & T))

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

Sum = 0

for i in T:
  if i in S:
    Sum += 1
print(Sum)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = list(map(int, input(). split()))
q = int(input())
T = list(map(int, input(). split()))

print(len(S & T))

Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

Sum = 0

for i in T:
  if i in S:
    Sum += 1
print(Sum)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

Sum = 0

for i in T:
  if i in S:
    Sum += 1
print(Sum)

Fixed submission:
n = int(input())
S = set(input().split())
q = int(input())
T = set(input().split())

print(len(S & T))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

Sum = 0

for i in T:
  if i in S:
    Sum += 1
print(Sum)

Fixed submission:
n = int(input())
S = set(input().split())
q = int(input())
T = set(input().split())

print(len(S & T))
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

def solve(i, m):
  if m == 0:
    return True
  if i >= n :
    return False
  res = solve(i + 1, m) or solve(i + 1, m - a[i])
  return res

for tmp_m in m:
  if sum(a) < tmp_m:
    print('no')
  elif solve(0, tmp_m):
    print('yes')
  else:
    print('no')

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

def solve(i, m):
  if m == 0:
    return True
  if i >= n :
    return False
  res = solve(i + 1, m) or solve(i + 1, m - A[i])
  return res

for tmp_m in m:
  if sum(A) < tmp_m:
    print('no')
  elif solve(0, tmp_m):
    print('yes')
  else:
    print('no')
Buggy python submission (verdict: Runtime Error):
x = input()
print x * x * x

Fixed submission:
x = (int)(input())
print(x**3)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = a * b
t = a * 2 + b * 2
print(s t)

Fixed submission:
a, b = map(int, input().split())
print(a * b, a * 2 + b * 2)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split)
if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else:
 print("a == b")

Fixed submission:
a, b = map(int, input().split())
if a < b:
 print("a < b")
elif a > b:
 print("a > b")
else:
 print("a == b")
Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split()))
  if x - r > 0 && x + r < W && y - r > 0 && y + r < H:
    print(Yes)
  else:
    print(No)

Fixed submission:
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split()))
  if x - r > 0 && x + r < W:
    if y - r > 0 && y + r < H:
      print(Yes)
  else:
    print(No)

Fixed submission:
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split()))
  if x - r > 0 and x + r < W:
    if y - r > 0 and y + r < H:
      print(Yes)
  else:
    print(No)

Fixed submission:
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split()))
  if x - r > 0 and x + r < W:
    if y - r > 0 and y + r < H:
      print("Yes")
  else:
    print("No")

Fixed submission:
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split())
  if r <= x <= W - r and r <= y <= H - r
    print("Yes")
  else:
    print("No")

Fixed submission:
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r
  print("Yes")
else:
  print("No")

Fixed submission:
W, H, x, y, r = map(int, input().split())
if r <= x <= W - r and r <= y <= H - r:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
while True:
  [x, y] = map(int(input().split()))
  if x == y == 0:
    break
  print(min(x, y) max(x, y))

Fixed submission:
while True:
  [x, y] = map(int, input().split())
  if x == y == 0:
    break
  print(min(x, y), max(x, y))

Buggy python submission (verdict: Runtime Error):
while True:
  [x, y] = map(int, input().split())
  if x == y == 0:
    break
  print(min(x, y) max(x, y))

Fixed submission:
while True:
  [x, y] = map(int, input().split())
  if x == y == 0:
    break
  print(min(x, y), max(x, y))
Buggy python submission (verdict: Runtime Error):
while True:
 n, x = map(int(input().split()))
 if n == x == 0:
  break
 count = 0
 for a in range(1, n):
  for b in range(a + 1, n):
   for c in range(b + 1, n):
    Sum = a + b + c
    if Sum == x:
     count += 1
 print(count)

Fixed submission:
while True:
 n, x = map(int, input().split())
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n + 1):
  for b in range(a + 1, n + 1):
   for c in range(b + 1, n + 1):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)

Buggy python submission (verdict: Runtime Error):
while True:
 n, x = map(int(input().split()))
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n):
  for b in range(a + 1, n):
   for c in range(b + 1, n):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)

Fixed submission:
while True:
 n, x = map(int, input().split())
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n + 1):
  for b in range(a + 1, n + 1):
   for c in range(b + 1, n + 1):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)

Buggy python submission (verdict: Runtime Error):
while True:
 n, x = map(int(input().split()))
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n):
  for b in range(1, n):
   for c in range(1, n):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)

Fixed submission:
while True:
 n, x = map(int, input().split())
 if n == x == 0:
  break
 Sum = 0
 count = 0
 for a in range(1, n + 1):
  for b in range(a + 1, n + 1):
   for c in range(b + 1, n + 1):
    Sum = a + b + c
    if Sum == x:
     count = count + 1
 print(count)
Buggy python submission (verdict: Runtime Error):
def main():
    r = int(input())
    pi = 3.141592653589
    print("{:.5f}".format(2 * pi * r),
          "{:.5f}".format(pi * r * r))

if __name__ == "__main__":
    main()

Fixed submission:
import math


def main():
    r = float(input())
    print("{:.6f}".format(math.pi * r * r),
          "{:.6f}".format(2 * math.pi * r))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = map(int, input().split())
    print(" ".join(sorted(a, reverse=True)))

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a = map(int, input().split())
    print(" ".join(map(str, list(a)[::-1])))

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]

for i in range(len(a)):
    v = a[i]
    j = i 

    while j >= 0 and a[j]>v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v

print(" ".join(a))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

for i in range(len(a)):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j]>v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(" ".join([str(i) for i in a]))

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
print(" ".join(a))

for i in range(len(a)-1):
    v = a[i]
    j = i 

    while j >= 0 and a[j]>v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(" ".join(a))

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

for i in range(len(a)):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j]>v:
        a[j+1] = a[j]
        j-=1
    a[j+1]=v
    print(" ".join([str(i) for i in a]))
Buggy python submission (verdict: Time Limit Exceeded):
s=[2]
a=[int(i) for i in range(2,100000000) if pow(2 ,int(i)-1, int(i)) ==1]

while a!=[]:
    t=a[0]
    a=[i for i in a if i % t !=0]
    s.append(t)
 
n=int(input())
x=0
for i  in range(n):
    if int(input()) in s:
        x+=1
print(x)
 

Fixed submission:
s=[2]
a=[int(i) for i in range(2,10000) if pow(2 ,int(i)-1, int(i)) ==1]

while a!=[]:
    t=a[0]
    a=[i for i in a if i % t !=0]
    s.append(t)

n=int(input())
x=0
for i  in range(n):
    y=0
    t = int(input())
    for j in s:
        if t % j ==0 and t !=j:
           break
    else:
        x+=1
print(x)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split(" ")]
x=0
for i in range(n):
    mi=i
    for j in range(i,n):
        if a[j] < a[mi]:
            mi = j
    if i != mi:
        x+=1
        a[i],a[mi]=a[mi],[i]

print(" ".join([str(i) for i in a]))
print(x)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split(" ")]
x=0

for i in range(n):
    mi = i
    for j in range(i, n):
        if a[j] < a[mi]:
            mi = j
    
    if i != mi:
        x += 1
        a[i], a[mi] = a[mi] , a[i]

print(" ".join([str(i) for i in a]))
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-


if __name__ == '__main__':

    
    def lcs(X, Y):
        m = len(X)
        n = len(Y)
        c = [[-1 for i in range(n+1)] for j in range(m+1)]
        X = " " + X
        Y = " " + Y
        for i in range(m+1):
            c[i][0] = 0
        for j in range(1, n+1):
            c[0][j] = 0
        for i  in range(1, m+1):
            for j in range(1, n+1):
                if X[i] == Y[j]:
                    c[i][j] = c[i-1][j-1] + 1
                else:
                    c[i][j] = max(c[i-1][j], c[i][j-1])
        
        return c[m][n]

    q = int(input())
    for _ in range(q):
        X = input()
        Y = input()
        print(lcs(X,Y))




Fixed submission:
# -*- coding: utf-8 -*-


if __name__ == '__main__':

    
    def lcs(X, Y):
        m = len(X)
        n = len(Y)
        c = [[-1 for i in range(n+1)] for j in range(m+1)]
        X = " " + X
        Y = " " + Y
        for i in range(m+1):
            c[i][0] = 0
        for j in range(1, n+1):
            c[0][j] = 0
        for i  in range(1, m+1):
            for j in range(1, n+1):
                if X[i] == Y[j]:
                    c[i][j] = c[i-1][j-1] + 1
                else:
                    c[i][j] = max(c[i-1][j], c[i][j-1])
        return c[m][n]

    def lcs2(X, Y):
        n = len(Y)
        dp = [0]*(n+1)
    
        for c in X:
            tmp = dp[:]
            for j in range(n):
                if c == Y[j]:
                    dp[j+1] = tmp[j] + 1
                elif dp[j+1] < dp[j]:
                    dp[j+1] = dp[j]
    
        return dp[-1]

    q = int(input())
    for _ in range(q):
        X = input()
        Y = input()
        print(lcs2(X,Y))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def maximum_profit_1(n, R):
    maxv = R[1] - R[0]
    for j in range(1, n):
        for i in range(j):
            maxv = max(maxv, R[j]-R[i])

    return maxv

def maximum_profit_2(n, R):
    minv = R[0]
    for j in range(1, N):
        maxv = max(maxv, R[j]-minv)
        minv = min(minv, R[j])

    return maxv

if __name__ == '__main__':

    n = int(input())
    R = [ int(input()) for i in range(n)]

    ans = maximum_profit_2(n ,R)
    print(ans)


Fixed submission:
# -*- coding: utf-8 -*-

def maximum_profit_1(n, R):
    maxv = R[1] - R[0]
    for j in range(1, n):
        for i in range(j):
            maxv = max(maxv, R[j]-R[i])

    return maxv

def maximum_profit_2(n, R):
    minv = R[0]
    maxv = R[1] - R[0]
    for j in range(1, n):
        maxv = max(maxv, R[j]-minv)
        minv = min(minv, R[j])

    return maxv

if __name__ == '__main__':

    n = int(input())
    R = [ int(input()) for i in range(n)]

    ans = maximum_profit_2(n ,R)
    print(ans)