Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
cnt = 1
while 1:
    x = sys.stdin.readline().strip()
    if x == '0':
        break;
    print('Case {}:{}').format(cnt,x)
    cnt += 1

Fixed submission:
import sys
cnt = 1
while 1:
    x = sys.stdin.readline().strip()
    if x == '0':
        break;
    print('Case %d: %s'%(cnt,x))
    cnt += 1

Buggy python submission (verdict: Runtime Error):
import sys
cnt = 1
while 1:
    x = sys.stdin.readline().strip()
    if x == '0':
        break;
    print('Case {}:{}').format(cnt,x)
    cnt += 1

Fixed submission:
import sys
cnt = 1
while 1:
    x = sys.stdin.readline().strip()
    if x == '0':
        break;
    print('Case %d: %s'%(cnt,x))
    cnt += 1

Buggy python submission (verdict: Time Limit Exceeded):
import sys
cnt = 1
while 1:
    for x in sys.stdin.readline().strip():
        if x == 0:break
    print('Case{}:{}'.format(cnt,x))
    cnt += 1

Fixed submission:
import sys
cnt = 1
while 1:
    x = sys.stdin.readline().strip()
    if x == '0':
        break;
    print('Case %d: %s'%(cnt,x))
    cnt += 1
Buggy python submission (verdict: Runtime Error):
import sys
while 1:
    a,b = sys.stdin.readline().split()
    if a == 0 and b == 0:
        break
    if a<b:print(a,b)
    else:print(b,a)

Fixed submission:
import sys
while 1:
    a,b = [int(i) for i in sys.stdin.readline().split()]
    if a == 0 and b == 0:
        break
    if a > b:
        print(b,a)
    else:
        print(a,b)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input()split())
count = 0
for i in range(a,b+1):
    d = c % i
    if d == 0:
        count += 1

print('%d' %count)

Fixed submission:
a,b,c = map(int,input().split())
print(len([x for x in range(a,b+1) if (c % x ) == 0]))

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input(),split())
print(len([x for x in range(a,b+1) if (c % x) == 0]))

Fixed submission:
a,b,c = map(int,input().split())
print(len([x for x in range(a,b+1) if (c % x ) == 0]))
Buggy python submission (verdict: Runtime Error):
r = int(input())
print('{:.5f} {:.5f}'.format(3.14 * r**2,2*3.14*r))

Fixed submission:
r = float(input())
import math
print('{0:f} {1:f}'.format(r**2*math.pi,2*math.pi*r))

Buggy python submission (verdict: Runtime Error):
r = fload(input())
import math
print(r**2*math.pi,2 * math.pi*r)

Fixed submission:
r = float(input())
import math
print('{0:f} {1:f}'.format(r**2*math.pi,2*math.pi*r))
Buggy python submission (verdict: Runtime Error):
H,W  = map(int,input8).split())
print(('#' * W + '\n')*H)

Fixed submission:
import sys
while 1:
    H,W = map(int,sys.stdin.readline().split())
    if H == W == 0:
        break
    print(('#'*W + '\n')*H)

Buggy python submission (verdict: Runtime Error):
import sys
while 1:
    H,W = sys.stdin.readline().split()
    if H == 0 and W == 0:
        break
    print(('#' * W + '\n')*H)

Fixed submission:
import sys
while 1:
    H,W = map(int,sys.stdin.readline().split())
    if H == W == 0:
        break
    print(('#'*W + '\n')*H)

Buggy python submission (verdict: Runtime Error):
import sys
while 1
    H,W = sys.stdin.readline().split()
    if H == 0 and W == 0:
        break
    print(('#' * W + '\n')*H)

Fixed submission:
import sys
while 1:
    H,W = map(int,sys.stdin.readline().split())
    if H == W == 0:
        break
    print(('#'*W + '\n')*H)

Buggy python submission (verdict: Runtime Error):
import sys
while 1:
    H,W = map(int,sys.stdin.readline().split())
    print(('#'*W + '\n')*H)

Fixed submission:
import sys
while 1:
    H,W = map(int,sys.stdin.readline().split())
    if H == W == 0:
        break
    print(('#'*W + '\n')*H)
Buggy python submission (verdict: Runtime Error):
import sys
while 1:
    h,w = sys.stdin.readline().split()
    if h == w == 0:break
    print('#'*w)
    print(('#'+'.'*(w-2)+'#\n')*(h-2),end ='')
    print('#'*w)

Fixed submission:
while True:
    h,w = map(int,input().split())
    if h == w == 0:break
    print('#'*w)
    print(('#' + '.'*(w-2) + '#\n')*(h-2),end = '')
    print('#'*w + '\n')

Buggy python submission (verdict: Runtime Error):
H,W = map(int,input()split())
print('#'*W)
print(('#'+'.'*(W-2)+'#\n')*(H-2),end ='')
print('#'*W)

Fixed submission:
while True:
    h,w = map(int,input().split())
    if h == w == 0:break
    print('#'*w)
    print(('#' + '.'*(w-2) + '#\n')*(h-2),end = '')
    print('#'*w + '\n')

Buggy python submission (verdict: Runtime Error):
import sys
while 1:
    h,w = map(int,sys.stdin.readline().split())
    print('#'*w)
    print(('#' + '.' * (w-2) + '#\n')*(h-2),end = '')
    print('#'*w)

Fixed submission:
while True:
    h,w = map(int,input().split())
    if h == w == 0:break
    print('#'*w)
    print(('#' + '.'*(w-2) + '#\n')*(h-2),end = '')
    print('#'*w + '\n')
Buggy python submission (verdict: Runtime Error):
s = input()
p = input()
if s in (p**2):
    print('Yes')
else:
    print('No')

Fixed submission:
s,p = input()*2,input()
print('Yes' if p in s else 'No')
Buggy python submission (verdict: Runtime Error):
while 1:
    s = input()
    if s == '-':break
    n = input()
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)

Fixed submission:
while True:
    s = input()
    if s == '-':break
    n = int(input())
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)

Buggy python submission (verdict: Runtime Error):
while 1:
    s = input()
    if s == '-':break
    n = input()
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)

Fixed submission:
while True:
    s = input()
    if s == '-':break
    n = int(input())
    for i in range(n):
        h = int(input())
        s = s[h:] + s[:h]
    print(s)
Buggy python submission (verdict: Runtime Error):
s = input()
n = int(input())
for i in ragne(n):
    cmd = input().split()
    a,b = map(int,[cmd[1],cmd[2]])
    if cmd[0][0] == 'p':print(s)
    elif cmd[0] =='replace':
        s = s[:a] + cmd[3] + s[b+1:]
    elif cmd[0] =='reverse':
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]

Fixed submission:
s = input()
n = int(input())
for i in range(n):
    cmd = input().split()
    a,b = map(int,[cmd[1],cmd[2]])
    if cmd[0] == 'print':print(s[a:b+1])
    elif cmd[0] == 'reverse':s = s[:a] + s[a:b+1][::-1] + s[b+1:]
    elif cmd[0] == 'replace':s = s[:a] + cmd[3] + s[b+1:]
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for i in range(n):
    yakusuu = 0
    k = int(input())
    for j in range(1, k+1):
        if k % j == 0:
            yakusuu += 1
        if yakusuu > 2:
            break
    if yakusuu == 2:
        ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for i in range(n):
    k = int(input())
    j = 2
    flag = 0
    while k/j >= j:
        if k % j == 0:
            flag = 1
            break
        j += 1
    if flag == 0:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input().split(" ")
n = int(s[0])
k = int(s[1])
w = []
for i in range(n):
    w.append(int(input()))
mx = max(w)
while True:
    t = []
    t.append(w[0])
    for i in range(1,len(w)):
        if t[len(t)-1] + w[i] <= mx:
            t[len(t)-1] += w[i]
        else:
            t.append(w[i])
            if len(t) > k:
                break
    if len(t) > k:
        mx += 1
    else:
        break
print(mx)

Fixed submission:
def check(P,w,n):
    i = 0
    for j in range(k):
        s = 0
        while s + w[i] <= P:
            s += w[i]
            i += 1
            if i == n:
                return n
    return i

s = input().split(" ")
n = int(s[0])
k = int(s[1])
w = []
for i in range(n):
    a = int(input())
    w.append(a)

left = 0
right = 100000 * 10000
while right - left > 1:
    mid = int((right + left) / 2)
    v = check(mid,w,n)
    if v >= n:
        right = mid
    else:
        left = mid
print(right)

Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
s = input().split(" ")
n = int(s[0])
k = int(s[1])
w = []
total = 0
for i in range(n):
    a = int(input())
    w.append(a)
    total += a
mx = max(ceil(total / k), max(w))
while True:
    t = []
    t.append(w[0])
    for i in range(1,len(w)):
        if t[len(t)-1] + w[i] <= mx:
            t[len(t)-1] += w[i]
        else:
            t.append(w[i])
            if len(t) > k:
                break
    if len(t) > k:
        mx += 1
    else:
        break
print(mx)

Fixed submission:
def check(P,w,n):
    i = 0
    for j in range(k):
        s = 0
        while s + w[i] <= P:
            s += w[i]
            i += 1
            if i == n:
                return n
    return i

s = input().split(" ")
n = int(s[0])
k = int(s[1])
w = []
for i in range(n):
    a = int(input())
    w.append(a)

left = 0
right = 100000 * 10000
while right - left > 1:
    mid = int((right + left) / 2)
    v = check(mid,w,n)
    if v >= n:
        right = mid
    else:
        left = mid
print(right)
Buggy python submission (verdict: Runtime Error):
import math
s = input().split(" ")
n = list(map(int,s))
d = math.sqrt((n[0]-n[2])**2 + (n[1]-n[3])**2)
print(d)

Fixed submission:
import math
s = input().split(" ")
n = list(map(float,s))
d = math.sqrt((n[0]-n[2])**2 + (n[1]-n[3])**2)
print(d)
Buggy python submission (verdict: Runtime Error):
def insertionSort(N,A):
    for i in range(0,N):
        innum = A[i]
        j = j -1
        while j>0 and A[i] > innum:
            A[j+1] = A[j]
            j = j -1
        A[j+1] = innum
        B[k] = A
    return B

if __name__ == "__main__":
    N = input()
    A = input()
    for i in range(0,B.length()):
        print(B[i])
    

Fixed submission:
N = int(input())
A = (input()).split()
for i in range(0,N):
    A[i] = int(A[i])
for i in range(0,N):
    innum = A[i]
    j = i - 1
    while j>=0 and innum < A[j]:
        A[j+1] = A[j]
        j = j -1
    A[j+1] = innum
    for j in range(0,N):
        if j < N-1:
            print(A[j], end=" ")
        else:
            print(A[j])
Buggy python submission (verdict: Time Limit Exceeded):
if __name__ == "__main__":
      S = (input()).split()
      n = int(S[0])
      q = int(S[1])
      head = 0
      tail = n-1
      que = []
      runtime = 0
      totaltime = 0
      fin = []
      for i in range(0, n):
            que.append((input()).split())
            totaltime = totaltime + int((que[i])[1])
      while runtime < totaltime:
            # now job
            nowjob = que[head]
            jobtime = int(nowjob[1])
            if jobtime > q :
                  jobtime = jobtime - q
                  (que[head])[1] = jobtime
                  tail = head
                  head = (head + 1) % n
                  runtime = runtime + q
            else :
                  runtime = runtime + jobtime
                  if jobtime != 0:
                        fin.append([(que[head])[0], runtime])
                  (que[head])[1] = 0
                  head = (head + 1) % n
      for i in range(0, n):
            print("{} {}".format((fin[i])[0], (fin[i])[1]))

Fixed submission:
if __name__ == "__main__":
      S = (input()).split()
      n = int(S[0])
      q = int(S[1])
      head = 0
      tail = n-1
      que = []
      runtime = 0
      fin = []

      for i in range(0, n):
            que.append((input()).split())

      while head <= tail:
            nowjob = que[head]
            jobtime = int(nowjob[1])
            if jobtime > q :
                  jobtime = jobtime -q
                  jobname = nowjob[0]
                  que.append([jobname, jobtime])
                  runtime = runtime + q
                  head = head + 1
                  tail = tail + 1
            else :
                  runtime = runtime + jobtime
                  fin.append([(que[head])[0], runtime])
                  head = head + 1
      for i in range(0,n):
            print("{} {}".format((fin[i])[0], (fin[i])[1]))
Buggy python submission (verdict: Runtime Error):
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if s[mid] == key:
                  m.append(key)
                  break
            elif key < s[mid]:
                  right = mid
            else:
                  left = mid + 1
print(len(m))

Fixed submission:
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if int(s[mid]) == key:
                  m.append(key)
                  break
            elif key < int(s[mid]):
                  right = mid
            else:
                  left = mid + 1

print(len(m))

Buggy python submission (verdict: Runtime Error):
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if s[mid] == key:
                  m.append(key)
                  break
            elif key < s[mid]:
                  right = mid
            else:
                  left = mid + 1
print(len(m))

Fixed submission:
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if int(s[mid]) == key:
                  m.append(key)
                  break
            elif key < int(s[mid]):
                  right = mid
            else:
                  left = mid + 1

print(len(m))

Buggy python submission (verdict: Runtime Error):
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if int(s[mid]) == key:
                  m.append(key)
                  break
            elif int(key) < s[mid]:
                  right = mid
            else:
                  left = mid + 1
print(len(m))

Fixed submission:
n1 = int(input())
s = (input()).split()
n2 = int(input())
t = (input()).split()
m = []

for i in range(0, n2):
      left = 0
      right = n1
      key = int(t[i])
      while left < right:
            mid = int((left + right)/2)
            if int(s[mid]) == key:
                  m.append(key)
                  break
            elif key < int(s[mid]):
                  right = mid
            else:
                  left = mid + 1

print(len(m))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

m = L[1]-L[0]

for x in range(n-1):

    for i in range(x,n-1):

        if m <= L[i+1]-L[x]:
            m = L[i+1]-L[x]
        else:
            pass

print (m)

Fixed submission:
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

ma = L[1]-L[0]
mi = L[0]
for x in range(n-1):
    ma = max([ma,L[x+1]-mi])
    mi = min(mi,L[x+1])


print (ma)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

m = L[1]-L[0]

for x in range(n-1):

    for i in range(x,n-1):

        if m <= L[i+1]-L[x]:
            m = L[i+1]-L[x]
        else:
            pass

print (m)

Fixed submission:
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

ma = L[1]-L[0]
mi = L[0]
for x in range(n-1):
    ma = max([ma,L[x+1]-mi])
    mi = min(mi,L[x+1])


print (ma)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

m = L[1]-L[0]

for x in range(n-1):

    for i in range(x,n-1):
        m = max([m,L[i+1]-L[x]])

print (m)

Fixed submission:
n = int(input())
L =[]
for i in range(n):
    x = int(input())
    L.append(x)

ma = L[1]-L[0]
mi = L[0]
for x in range(n-1):
    ma = max([ma,L[x+1]-mi])
    mi = min(mi,L[x+1])


print (ma)
Buggy python submission (verdict: Runtime Error):
import math

x1,y1,x2,y2= map(int,(input().split()))

D=(x2-x1)**2+(y2-y1)**2
d= math.sqrt(D)
print(d)

Fixed submission:
import math

x1,y1,x2,y2= map(float,(input().split()))

D=(x2-x1)**2+(y2-y1)**2
d= math.sqrt(D)
print(d)
Buggy python submission (verdict: Runtime Error):
a,b= map(int, input(),split())
print(a*b,2*(a+b))

Fixed submission:
a,b= map(int, input().split())
print(a*b,2*(a+b))

Buggy python submission (verdict: Runtime Error):
a,b= map(int, input(),split())
print(a*b,2*(a+b))

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

Fixed submission:
a,b,c=map(int,input().split())
if a >b:
    x = a
    a = b
    b= x
else:
    pass

if b >c:
    y = c
    c=b
    b=y
else:
    pass
if a > b:
    x = a
    a = b
    b = x
else:
    pass

print (a,b,c)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print(int(a/b),a%b,a/b)

Fixed submission:
a,b = map(int, input().split())

print(int(a/b),a%b,round(a/b,5))
Buggy python submission (verdict: Runtime Error):
r = int(input())
p = 3.141592
print(r*r*p,2*r*p)

Fixed submission:
import math
r = float(input())
p = math.pi
print(round(r*r*p,6),round(2*r*p,6))

Buggy python submission (verdict: Runtime Error):
r = int(input())
p = 3.141592
print(round(r*r*p,6),round(2*r*p,6))

Fixed submission:
import math
r = float(input())
p = math.pi
print(round(r*r*p,6),round(2*r*p,6))

Buggy python submission (verdict: Runtime Error):
r = int(input())
p = 3.141592
print(round(r*r*p,6),round(2*r*p,6))

Fixed submission:
import math
r = float(input())
p = math.pi
print(round(r*r*p,6),round(2*r*p,6))
Buggy python submission (verdict: Runtime Error):
num=int(input())
r_1=int(input())
r_2=int(input())
max_profit=r_2 - r_1
min_value=min(r_1,r_2)

for i in range(n-2):
    x=int(input())
    t=x - min_value
    if max_profit>t:
        max_profit=t
    if x<min_value:
        min_value=x
print(max_profit)

Fixed submission:
num=int(input())
r_1=int(input())
r_2=int(input())

max_profit=r_2-r_1
if r_1<r_2:
    min_value=r_1
else:
    min_value=r_2

for i in range(2,num):
    x=int(input())
    t=x-min_value
    if max_profit<t:
        max_profit=t
    if x<min_value:
        min_value=x
        
print(max_profit)

Buggy python submission (verdict: Runtime Error):
num=int(input())
r_1=int(input())
r_2=int(input())
max_profit=r_2 - r_1
if r_1<r_2:
    min_value=r_1
else:
    min_value=r_2

for i in range(n-2):
    x=int(input())
    t=x - min_value
    if max_profit<t:
        max_profit=t
    if x<min_value:
        min_value=x
        
print(max_profit)

Fixed submission:
num=int(input())
r_1=int(input())
r_2=int(input())

max_profit=r_2-r_1
if r_1<r_2:
    min_value=r_1
else:
    min_value=r_2

for i in range(2,num):
    x=int(input())
    t=x-min_value
    if max_profit<t:
        max_profit=t
    if x<min_value:
        min_value=x
        
print(max_profit)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
commands=[input().split() for i in range(n)]
    
List=[]
def command(list_command):
    global List
    if 'insert' in list_command:
        List.insert(0,list_command[1])
    elif 'delete' in list_command:
        try:
            t=List.index(list_command[1])
            del List[t]
        except:
            pass
    elif 'deleteFirst' in list_command:
        del List[0]
    elif 'deleteLast' in list_command:
        del List[-1]
    return True
    
for i in commands:
    command(i)
print(*List)

Fixed submission:
from collections import deque
n=int(input())
commands=[input().split() for i in range(n)]
    
List=deque()
for list_command in commands:
    if 'insert' in list_command:
        List.appendleft(list_command[1])
    elif 'delete' in list_command:
        try:
            List.remove(list_command[1])
        except:
            pass
    elif 'deleteFirst' in list_command:
        List.popleft()
    elif 'deleteLast' in list_command:
        List.pop()
  
print(*List)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
n=int(input())
commands=[input().split() for i in range(n)]
    
List=deque()
def command(list_command):
    global List
    if 'insert' in list_command:
        List.appendleft(list_command[1])
    elif 'delete' in list_command:
        try:
            List.remove(list_command[1])
        except:
            pass
    elif 'deleteFirst' in list_command:
        List.popleft()
    elif 'deleteLast' in list_command:
        List.pop()
    return True
    
for i in commands:
    command(i)
print(*List)

Fixed submission:
from collections import deque
n=int(input())
commands=[input().split() for i in range(n)]
    
List=deque()
for list_command in commands:
    if 'insert' in list_command:
        List.appendleft(list_command[1])
    elif 'delete' in list_command:
        try:
            List.remove(list_command[1])
        except:
            pass
    elif 'deleteFirst' in list_command:
        List.popleft()
    elif 'deleteLast' in list_command:
        List.pop()
  
print(*List)
Buggy python submission (verdict: Runtime Error):
n=int(input())
z=list(map(int,input().split()))
for i in range(1,n):
    v=z[i]
    j=i-1
    while j>=0 and z[j]>v:
        z[j+1]=z[j]
        j-=1
        
    z[j+1]=v
    print(''.join(z))

Fixed submission:
n=int(input())
z=list(map(int,input().split()))
print(' '.join(list(map(str,z))))
for i in range(1,n):
    v=z[i]
    j=i-1
    while j>=0 and z[j]>v:
        z[j+1]=z[j]

        j-=1
        z[j+1]=v
    print(' '.join(list(map(str, z))))
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
z=[]
for i in range(min(a,b)):
    if a%(i+1)==0 and b%(i+1)==0:
        z+=[i+1]
print(max(z))

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

a,b=list(map(int,input().split()))
print(gcd(a,b))

Buggy python submission (verdict: Runtime Error):
z=list(map(int,input().split()))
z.sort()
a=0

while True:
    a=z[1]-z[0]
    if z[0]%a==0:
        z[1] = z[0]
        z[0] = a
        z.sort()
        break
    z[1]=z[0]
    z[0]=a
    z.sort()

print(z[0])

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

a,b=list(map(int,input().split()))
print(gcd(a,b))

Buggy python submission (verdict: Runtime Error):
z=list(map(int,input().split()))
z.sort()
a=0

while True:
    a=z[1]-z[0]
    if z[0]%a==0:
        z[1] = z[0]
        z[0] = a
        z.sort()
        break
    z[1]=z[0]
    z[0]=a
    z.sort()

print(z[0])

Fixed submission:
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

a,b=list(map(int,input().split()))
print(gcd(a,b))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
z=[]
for i in range(n):
    z+=[int(input())]
a=0
zz=[]
zzz=[]
while True:
    if a==len(z):
        break
    j=a+1
    for i in z[j:]:
        
        zz+=[i-z[a]]
        
    zzz+=[max(zz)]
    a+=1
print(max(zzz))

Fixed submission:
n=int(input())
r_min=int(input())
r_t=int(input())
g_max=r_t-r_min
r_min=min(r_t,r_min)

for _ in range(n-2):
    r_t=int(input())
    g_max=max(g_max,r_t-r_min)
    r_min=min(r_t,r_min)

print(g_max)