Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
slist = []
if (a >= b):
    for i in range(1,b+1):
        if (a%i == 0 and b%i == 0):
            slist.append(i)
elif(a < b):
    for i in range(1, a):
        if (a%i == 0 and b%i == 0):
            slist.append(i)
print(slist[-1])
        
            


Fixed submission:
a, b = map(int, input().split())
slist = []
if (a > b):
    c = a%b
    d = b
    while (c != 0 and d != 0):
        if (c < d):
            d = d%c
        elif (c > d):
            c = c%d
    if(c == 0):
        print(d)
    elif(d == 0):
        print(c)
        
    
elif(a < b):
    c = a
    d = b%a
    while (c != 0 and d != 0):
        if (c < d):
             d = d%c
        elif (c > d):
            c = c%d
    if(c == 0):
        print(d)
    elif(d == 0):
        print(c)
        
else:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = []
for i in range(n):
    j = i-1
    while (j >= 0):
        m = rlist[i] - rlist[j]
        mlist.append(m)
        j -= 1
mlist.sort()
print(mlist[-1])
        
        



Fixed submission:
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = [rlist[1] - rlist[0]]
mini = rlist[0]
for i in range(1,n):
    if(rlist[i-1] < mini):
        mini = rlist[i-1]
    m = rlist[i] - mini
    if(m>mlist[-1]):
        mlist.append(m)
print(mlist[-1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = []
for i in range(n):
    m = rlist[i] - min(rlist[:i])
    mlist.append(m)
mlist.sort()
print(mlist[-1])


Fixed submission:
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = [rlist[1] - rlist[0]]
mini = rlist[0]
for i in range(1,n):
    if(rlist[i-1] < mini):
        mini = rlist[i-1]
    m = rlist[i] - mini
    if(m>mlist[-1]):
        mlist.append(m)
print(mlist[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = []
for i in range(n):
    if(i != 0):
        m = rlist[i] - min(rlist[:i])
        mlist.append(m)
mlist.sort()
print(mlist[-1])


Fixed submission:
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = [rlist[1] - rlist[0]]
mini = rlist[0]
for i in range(1,n):
    if(rlist[i-1] < mini):
        mini = rlist[i-1]
    m = rlist[i] - mini
    if(m>mlist[-1]):
        mlist.append(m)
print(mlist[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = [rlist[1] - rlist[0]]
for i in range(1,n):
    m = rlist[i] - min(rlist[:i])
    if(m > mlist[-1]):
        mlist.append(m)
        
print(mlist[-1])


Fixed submission:
n = int(input())
rlist = []
for i in range(n):
    r = int(input())
    rlist.append(r)
mlist = [rlist[1] - rlist[0]]
mini = rlist[0]
for i in range(1,n):
    if(rlist[i-1] < mini):
        mini = rlist[i-1]
    m = rlist[i] - mini
    if(m>mlist[-1]):
        mlist.append(m)
print(mlist[-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
nlist = list(map(int, input().split()))
def BubbleSort(C, n):
    c = 0
    for i in range(n-1):
        for w in range(i+1, n):
            j = n-k+i
            if (C[j] < C[j-1]):
                a = C[j]
                C[j] = C[j-1]
                C[j-1] = a
                c += 1
BubbleSort(nlist, n)
for i in range(n):
    if (i == n-1):
        print('{}'.format(nlist[i]), end = '')
    else : 
        print('{}'.format(nlist[i]), end = ' ')
print()
print(c)


Fixed submission:
n = int(input())
nlist = list(map(int, input().split()))
def BubbleSort(C, n):
    c = 0
    for i in range(n-1):
        for w in range(i+1, n):
            j = n-w+i
            if (C[j] < C[j-1]):
                a = C[j]
                C[j] = C[j-1]
                C[j-1] = a
                c += 1
    C.append(c)
BubbleSort(nlist, n)
for i in range(n):
    if (i == n-1):
        print('{}'.format(nlist[i]), end = '')
    else : 
        print('{}'.format(nlist[i]), end = ' ')
print()
print(nlist[-1])
Buggy python submission (verdict: Runtime Error):
def insertionSort(A, n, g):
    cnti = 0
    for i in range(g, n):
        v = A[i]
        j = i-g
        while (j >= 0 and A[j] > v):
            A[j + g] = A[j]
            j -= g
            cnti += 1
        A[j+g] = v
    return cnti
def shellSort(A,n):
    cnt = 0
    G = []
    for k in range(int((n/3)) +1):
        h = 3*k + 1
        if (h <= n and len(G) < 100):
            G.append(h)
        elif(len(G) == 100):
            break    
    G.reverse()
    m = len(G)
    for i in range(m):
        cnt += insertionSort(A, n, G[i])
    print(m)
    for i in range(m):
        if (i == m-1):
            print('{}'.format(G[i]), end = '')
        else:
            print('{}'.format(G[i]), end = ' ')
    return cnt
        
        
        
n = int(input())
nlist = []
for i in range(n):
    x = int(input())
    nlist.append(x)
    
c = shellSort(nlist,n)
print()
print(c)
for i in nlist:
    print(i)


Fixed submission:
def insertionSort(A, n, g):
    cnti = 0
    for i in range(g, n):
        v = A[i]
        j = i-g
        while (j >= 0 and A[j] > v):
            A[j + g] = A[j]
            j -= g
            cnti += 1
        A[j+g] = v
    return cnti
def shellSort(A,n):
    cnt = 0
    G = [1]
    h = 1
    for k in range(int(n**0.33333333)+1):
        h = 3*h + 1  ## h=1,4,13,40,121,364 ... 왜 이게 효율이 좋은지는 모르겠음(다른 사이트 봄)
        if (h <= n and len(G) < 100):
            G.append(h)
        elif(len(G) == 100):
            break    
    G.reverse()
    m = len(G)
    for i in range(m):
        cnt += insertionSort(A, n, G[i])
    print(m)
    for i in range(m):
        if (i == m-1):
            print('{}'.format(G[i]), end = '')
        else:
            print('{}'.format(G[i]), end = ' ')
    return cnt
        
        
        
n = int(input())
nlist = []
for i in range(n):
    x = int(input())
    nlist.append(x)
    
c = shellSort(nlist,n)
print()
print(c)
for i in nlist:
    print(i)
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()))
c = 0
for i in T:
    if i in S:
        c+= 1
print(c)


Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
c = 0
for i in range(q):
    l = 0
    r = n
    t = T[i]
    while r-l > 1:
        m = (r + l)//2
        if (S[m] > t):
            r = m
        else:
            l = m
    if (S[l] == T[i]):
        c += 1
print(c)

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()))
s = []
for i in range(max(S) + 1):
    if i in S:
        s.append(i)
c = 0
for i in T:
    if (i in s):
        c += 1
    
print(c)


Fixed submission:
n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))
c = 0
for i in range(q):
    l = 0
    r = n
    t = T[i]
    while r-l > 1:
        m = (r + l)//2
        if (S[m] > t):
            r = m
        else:
            l = m
    if (S[l] == T[i]):
        c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = {}
for i in range(n):
    order = list(map(str, input().split()))
    if (order[0][0] == 'i'):
        s.add(order[1])
    else:
        if order[1] in s:
            print('yes')
        else:
            print('no')
        
        


Fixed submission:
n = int(input())
s = {2}
s.remove(2)
for i in range(n):
    order = list(map(str, input().split()))
    if (order[0][0] == 'i'):
        s.add(order[1])
    else:
        if order[1] in s:
            print('yes')
        else:
            print('no')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
wlist = []
for i in range(n):
    wlist.append(int(input()))

ma = sum(wlist)
mi = max(wlist)
while (ma - mi > 1 or gobigger != 1):
    mid = (ma + mi)//2
    truck = [0for i in range(k)] ## k개
    i = 0
    gobigger = 0
    for w in wlist:
        if(truck[i] + w <= mid):
            truck[i] = truck[i] + w
        else:
            i = i+1
            if (i == k):
                gobigger = 1
                break
            truck[i] = truck[i] + w
    if (gobigger == 1):
        mi = mid
    else:
        ma = mid
    
print(ma)


Fixed submission:
n, k = map(int, input().split())
wlist = []
for i in range(n):
    wlist.append(int(input()))

ma = sum(wlist) + 1
mi = max(wlist) - 1
while (ma - mi > 1):
    mid = (ma + mi)//2
    truck = [0for i in range(k)] ## k개
    i = 0
    gobigger = 0
    for w in wlist:
        if(truck[i] + w <= mid):
            truck[i] = truck[i] + w
        else:
            i = i+1
            if (i == k):
                gobigger = 1
                break
            truck[i] = truck[i] + w
    if (gobigger == 1):
        mi = mid
    else:
        ma = mid
    
print(ma)
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>

main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a<b){
        printf("a < b\n");
    }
    else if (a > b){
        printf("a > b\n");
    }
    else {
        printf("a == b\n");
    }
}


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):
#include<stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a<b)
    {
        printf("a < b");
    }
    else if (a > b){
        printf("a > b");
    }
    else if (a == b)
    {
        printf("a == b");
    }
    printf("\n");
    return 0;
}


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):
#include <stdio.h>

int main(void)
{
    int W,H,x,y,r;
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

    if (x>=r && y>=r)
    {
        if (x+r<=W && y+r<=H)
        {
            printf("Yes");
        }
        else
        {
            printf("No");
        }
    }
    else
    {
        printf("No");
    }
    return 0;
}



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


Fixed submission:
while True:
    try:
        a, b = (int(x) for x in input().split())
        print(len(str(a + b)))
    except:
        break;
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	N = int(input())
	l = input().split()

	for i in range(N):
		l[i] = int(l[i])

	for i in range(N - 1):
		v = l[i]
		j = i - 1
		while j >= 0 and l[l] > v:
			A[j + 1] = A[j]
			j -= 1
		A[j + 1] = v
		print(l[0],l[1],l[2],l[3],[4],l[5])


Fixed submission:
def listprint(lists):
	global N
	count = 0
	for i in lists:
		count += 1
		if count < N:
			print(i, end = ' ')
		if count == N:
			print(i)

if __name__ == '__main__':
	N = int(input())
	l = input().split()

	for i in range(N):
		l[i] = int(l[i])

	listprint(l)

	for i in range(1, N):
		v = l[i]
		j = i - 1

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

		l[j + 1] = v
		listprint(l)

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	N = int(input())
	l = input().split()

	for i in range(N):
		l[i] = int(l[i])

	for i in range(1, N - 1):
		v = l[i]
		j = i - 1
		while j >= 0 and l[l] > v:
			A[j + 1] = A[j]
			j -= 1
		A[j + 1] = v
		print(l[0],l[1],l[2],l[3],[4],l[5])


Fixed submission:
def listprint(lists):
	global N
	count = 0
	for i in lists:
		count += 1
		if count < N:
			print(i, end = ' ')
		if count == N:
			print(i)

if __name__ == '__main__':
	N = int(input())
	l = input().split()

	for i in range(N):
		l[i] = int(l[i])

	listprint(l)

	for i in range(1, N):
		v = l[i]
		j = i - 1

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

		l[j + 1] = v
		listprint(l)
Buggy python submission (verdict: Runtime Error):
n = input()
print(n ** 3)


Fixed submission:
s = input()
n = int(s)
print(n ** 3)

Buggy python submission (verdict: Runtime Error):
n = input()
print(n ** 3)


Fixed submission:
s = input()
n = int(s)
print(n ** 3)

Buggy python submission (verdict: Runtime Error):
s = raw_input()
n = int(s)
print(n ** 3)


Fixed submission:
s = input()
n = int(s)
print(n ** 3)

Buggy python submission (verdict: Runtime Error):
n = input()
print(n * n * n)


Fixed submission:
s = input()
n = int(s)
print(n ** 3)
Buggy python submission (verdict: Runtime Error):
l = input().split()
a = l[0]
b = l[1]

L = 2 * (a + b)
S = a * b

print(S, L)


Fixed submission:
l = input().split()
a, b = int(l[0]), int(l[1])
print(a * b, 2 * (a + b))

Buggy python submission (verdict: Runtime Error):
l = map(int, raw_input().split())
S = l[0] * l[1]
L = 2 * (l[0] + l[1])

print(S, L)


Fixed submission:
l = input().split()
a, b = int(l[0]), int(l[1])
print(a * b, 2 * (a + b))

Buggy python submission (verdict: Runtime Error):
l = map(int, input().split())
S = l[0] * l[1]
L = 2 * (l[0] + l[1])
 
print(S, L)


Fixed submission:
l = input().split()
a, b = int(l[0]), int(l[1])
print(a * b, 2 * (a + b))
Buggy python submission (verdict: Runtime Error):
S = input()
S = int(S)
  
h = S//3600
S = S - h * 3600
m = S // 60
s = S - m * 60
  
print("%d:%d:%d" %(h, m, s))


Fixed submission:
if __name__ == '__main__':
	S = int(input())
	h = S // 3600
	S %= 3600
	m = S // 60
	S %= 60
	
	print("%d:%d:%d" %(h, m, S))

Buggy python submission (verdict: Runtime Error):
S = input()
 
h = S//3600
S = S - h * 3600
m = S // 60
s = S - m * 60
 
print("%d:%d:%d" %(h,m,s))


Fixed submission:
if __name__ == '__main__':
	S = int(input())
	h = S // 3600
	S %= 3600
	m = S // 60
	S %= 60
	
	print("%d:%d:%d" %(h, m, S))

Buggy python submission (verdict: Runtime Error):
S = input()
 
h = S//3600
S = S - h * 3600
m = S // 60
s = S - m * 60
 
print("%d:%d:%d" %(h,m,s))


Fixed submission:
if __name__ == '__main__':
	S = int(input())
	h = S // 3600
	S %= 3600
	m = S // 60
	S %= 60
	
	print("%d:%d:%d" %(h, m, S))
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	a, b, c = input().split()
	a, b, c = int(a), int(b), int(c)

	ans = [a, b, c].sorted()
	print(ans[0], ans[1], ans[2])


Fixed submission:
if __name__ == '__main__':
	a, b, c = input().split()
	a, b, c = int(a), int(b), int(c)

	ans = sorted([a, b, c])
	print(ans[0], ans[1], ans[2])
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	l = input().split()
	
	for i in range(l):
		l[i] = int(l[i])
	W, H, x, y, r = (l[i] for i in range(5))

	if r <= x <= W -r and r <= y <= H - r:
		print("Yes")
	else:
		print("No")



Fixed submission:
if __name__ == '__main__':
	l = input().split()

	for i in range(len(l)):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	l = input().split()

	for i in range(l):
		l[i] = int(l[i])
	W, H, x, y, r = (l[i] for i in range(5))

	if r <= x and x <= W - r and r <= y and y <= H - r:
		print("Yes")
	else:
		print("No")



Fixed submission:
if __name__ == '__main__':
	l = input().split()

	for i in range(len(l)):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	l = input().split()

	for i in range(l):
		l[i] = int(l[i])
	(W, H, x, y, r) = (l[i] for i in range(5))

	if r <= x and x <= W - r and r <= y and y <= H - r:
		print("Yes")
	else:
		print("No")



Fixed submission:
if __name__ == '__main__':
	l = input().split()

	for i in range(len(l)):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	l = input().split()

	for i in range(l):
		l[i] = int(l[i])
	(W, H, x, y, r) = (l[i] for i in range(5))

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")



Fixed submission:
if __name__ == '__main__':
	l = input().split()

	for i in range(len(l)):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
	l = input().split()

	for i in range(l):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")



Fixed submission:
if __name__ == '__main__':
	l = input().split()

	for i in range(len(l)):
		l[i] = int(l[i])
	W, H, x, y, r = l[0], l[1], l[2], l[3], l[4]

	if x >= r and y >= r:
		if x <= W - r and y <= H - r:
			print("Yes")
		else:
			print("No")
	else:
		print("No")
Buggy python submission (verdict: Runtime Error):
def pushBack(lists, x):
	return lists.insert(-1, x)

def randomAccess(lists, p):
	print(lists[p])

def popBack(lists):
	return lists.pop(-1)

if __name__ == '__main__':
	l = list()
	n = int(input())
	for i in range(n):
		j= input().split()

		if int(j[0]) == 0:
			pushBack(l, x)
		elif int(j[0]) == 1:
			randomAccess(l, x)
		else:
			popBack(l)



Fixed submission:
def pushBack(lists, x):
    return lists.insert(len(lists), x)

def randomAccess(lists, p):
    print(lists[p])

def popBack(lists):
    return lists.pop(len(lists) - 1)

if __name__ == '__main__':
    l = list()
    n = int(input())
    for i in range(n):
        j= input().split()

        if int(j[0]) == 0:
            pushBack(l, int(j[1]))
        elif int(j[0]) == 1:
            randomAccess(l, int(j[1]))
        else:
            popBack(l)
Buggy python submission (verdict: Runtime Error):
from collections import deque

if __name__ == '__main__':
    n, q = input().split()
    n, q = int(n), int(q)
    S = [deque([]) for i in range(n)]

    for i in range(q):
        query = input().split()

        if query[0] == '0':
            S[int(query[1])].append(query[2])

        else:
            if len(S) == 0:
                pass
            elif query[0] == '1':
                print(S[int(query[1])][-1])
            else:
                S[int(query[1])].pop()


Fixed submission:
from collections import deque

if __name__ == '__main__':
    n, q = input().split()
    n, q = int(n), int(q)
    S = [deque([]) for i in range(n)]

    for i in range(q):
        query = input().split()

        if query[0] == '0':
            S[int(query[1])].append(query[2])

        else:
            if len(S[int(query[1])]) == 0:
                pass
            elif query[0] == '1':
                print(S[int(query[1])][-1])
            else:
                S[int(query[1])].pop()
Buggy python submission (verdict: Runtime Error):
x = input()

for i in range(2):
   if i == 0:
       y = x
   
   y = x * y

print(y)


Fixed submission:
number = int(input())
n = 0
if 1 <= number and number <= 100:
    for i in range(2):
        if i == 0:
            n = number
        n = number * n
    print(n)
Buggy python submission (verdict: Runtime Error):
area_input = input()
vertical = 0
side = 0
area_list = area_input.split(',')

if 1 <= vertical && side <= 100:
  for i in area_list:
    vertical = area_list[0]
    side = area_list[1]
  
  area = int(vertical) * int(side)
  langth = 2 * (int(vertical) + int(vertical))
  
  print(str(area) + " " + str(langth))



Fixed submission:
number = input()

number_list = number.split(' ')

a = int(number_list[0])
b = int(number_list[1])

if 1 <= a <= 100 and 1 <= b <= 100:
    menseki = a * b
    nagasa = 2 * (a + b)

    print(str(menseki) + " " + str(nagasa))
Buggy python submission (verdict: Runtime Error):
import math

def run():
    n = int(input())
    for _ in range(n):
        x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
        u1 = (x1-x3)*(x2-x1)*(x3-x2)
        u2 = (x2-x1)*(y3-y2)*(y3+y2)
        u3 = (x3-x2)*(y2-y1)*(y2+y1)
        v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2
        Py = (-u1 + u2 - u3) / v / 2
        Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / (x2-x1) / 2
        r = math.sqrt((Px-x1)**2 + (Py-y1)**2)
        print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3)))

if __name__ == '__main__':
    run()




Fixed submission:
import math

class P(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def width(self, p):
        return math.sqrt((self.x - p.x)**2 + (self.y - p.y)**2)

    def __repr__(self):
        return '{0:.3f} {1:.3f}'.format(self.x, self.y)

def calc_cos(a,b,c):
    return (b**2 + c**2 - a**2) / (2*b*c)

def calc_sin(c):
    return math.sqrt(1 - c**2)

def calc_2sin(s,c):
    return 2 * s * c

def run():
    n = int(input())
    for _ in range(n):
        x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
        p1, p2, p3 = P(x1, y1), P(x2, y2), P(x3, y3)
        a, b, c = p1.width(p2), p2.width(p3), p3.width(p1)
        cosA, cosB, cosC = calc_cos(a,b,c), calc_cos(b,c,a), calc_cos(c,a,b)
        sinA, sinB, sinC = calc_sin(cosA), calc_sin(cosB), calc_sin(cosC)
        sin2A, sin2B, sin2C = calc_2sin(sinA, cosA), calc_2sin(sinB, cosB), calc_2sin(sinC, cosC)

        r = a / sinA / 2

        x = (p1.x * sin2B + p2.x * sin2C + p3.x * sin2A) / (sin2A + sin2B + sin2C)
        y = (p1.y * sin2B + p2.y * sin2C + p3.y * sin2A) / (sin2A + sin2B + sin2C)

        print('{0:.3f} {1:.3f} {2:.3f}'.format(x,y,r))

if __name__ == '__main__':
    run()
Buggy python submission (verdict: Time Limit Exceeded):
import math

def max_price(price):
    res = -math.inf
    for idx_j, j in enumerate(price):
        for i in range(idx_j):
            if j - price[i] > res:
                res = j - price[i]
    return res

def run():
    n = int(input())
    price = [int(input()) for _ in range(n)]
    print(max_price(price))

if __name__ == '__main__':
    run()


Fixed submission:
import math

class MaxPrice(object):
    
    def __init__(self):
        self.min_price = math.inf
        self.max_price = -math.inf
        self.max_diff = -math.inf

    def set_price(self, p):
        if self.max_price < p:
            self.max_price = p
        else:
            if self.max_diff < p - self.max_price:
                self.max_diff = p - self.max_price

        if p < self.min_price:
            self.min_price = p
        else:
            if self.max_diff < p - self.min_price:
                self.max_diff = p - self.min_price

def run():
    n = int(input())
    mp = MaxPrice()
    for i in range(n):
        p = int(input())
        mp.set_price(p)
    print(mp.max_diff)

if __name__ == '__main__':
    run()
Buggy python submission (verdict: Runtime Error):
import math
x1, y1, x2, y2 = map(int, input().split())
print(math.sqrt((y2-y1)**2 + (x2-x1)**2))



Fixed submission:
x1, y1, x2, y2 = map(float, input().split())
print(((y2-y1)**2 + (x2-x1)**2)**(1/2))

Buggy python submission (verdict: Runtime Error):
import math
x1, y1, x2, y2 = map(int, input().split())
print(((y2-y1)**2 + (x2-x1)**2)**(1/2))



Fixed submission:
x1, y1, x2, y2 = map(float, input().split())
print(((y2-y1)**2 + (x2-x1)**2)**(1/2))

Buggy python submission (verdict: Runtime Error):
x1, y1, x2, y2 = map(int, input().split())
print(((y2-y1)**2 + (x2-x1)**2)**(1/2))



Fixed submission:
x1, y1, x2, y2 = map(float, input().split())
print(((y2-y1)**2 + (x2-x1)**2)**(1/2))