Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def insertionSort(A, n, g):
    global count
    for i in range(g,n):
        v = A[i]
        j = i - g
        #間隔gずつ選択ソートを行っていく
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j -= g
            count += 1
        A[j+g] = v

def shellSort(A, n):
    global count
    G = [i for i in range(1,n) if i % 3 == 1]   #シェルソートで用いる配列Gはmod3 == 1の倍数のを用いる
    m = len(G)
    G = G[::-1]
    for i in G:
        insertionSort(A, n, i)
    return A, G, m 

#input data
n = int(input())
A = [int(input()) for i in range(n)]
count = 0

A, G, m = shellSort(A, n)
print (m)
print (G)
print (cnt)
for i in range(len(A)):
    print (A[i])

Fixed submission:
import math

def insertionSort(A, n, g):
    cnt = 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
            cnt += 1
        A[j + g] = v
    return cnt


def shellSort(A, n):
    cnt = 0
    j = int(math.log(2 * n + 1, 3)) + 1
    G = list(reversed([(3 ** i - 1)// 2 for i in range(1, j)]))
    m = len(G)
    for i in range(m):
        cnt += insertionSort(A, n, G[i])
    return A, cnt, G, m

n = int(input())
A = [int(input()) for i in range(n)]
ans, count, G, m = shellSort(A, n)
print(m)
print(' '.join(map(str,G)))
print(count)
[print(i) for i in A]

Buggy python submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for i in range(n)]
count = 0


def insertionSort(A, n, g):
    global count
    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
            count += 1
        A[j+g] = v

def shellSort(A, n):
    global count
    G = [i for i in range(1,n) if i % 3 == 1]  
    m = len(G)
    G = G[::-1]
    for i in G:
        insertionSort(A, n, i)
    return A, G, m 


A, G, m = shellSort(A, n)
print (m)
print (G)
print (cnt)
for i in range(len(A)):
    print (A[i])

Fixed submission:
import math

def insertionSort(A, n, g):
    cnt = 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
            cnt += 1
        A[j + g] = v
    return cnt


def shellSort(A, n):
    cnt = 0
    j = int(math.log(2 * n + 1, 3)) + 1
    G = list(reversed([(3 ** i - 1)// 2 for i in range(1, j)]))
    m = len(G)
    for i in range(m):
        cnt += insertionSort(A, n, G[i])
    return A, cnt, G, m

n = int(input())
A = [int(input()) for i in range(n)]
ans, count, G, m = shellSort(A, n)
print(m)
print(' '.join(map(str,G)))
print(count)
[print(i) for i in A]
Buggy python submission (verdict: Runtime Error):
# -*- conding:utf-8 -*-
tmp = input().strip().split()
stack = []
for i in tmp:
    l -= 1
    if stack.pop() == "+":
        stack.append(stack.pop() + stack.pop())
    elif stack.pop() == "-":
        stack.append(-stack.pop() + stack.pop())
    elif stack.pop() == "*":
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print (stack[0])

Fixed submission:
tmp = input().strip().split()
stack = []
for i in tmp:
    if i == '+':
        stack.append(stack.pop() + stack.pop())
    elif i == '-':
        stack.append(-stack.pop() + stack.pop())
    elif i == '*':
        stack.append(stack.pop() * stack.pop())
    else:
        stack.append(int(i))

print (stack[0])
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
q_list = collections.deque()
for i in range(n):
    name, time = input().split()
    q_list.append([name, int(time)])

time = 0
while q_list:
    if q_list[0][1] == 0:
        q_list.popleft()
    elif q_list[0][1] == 100:
        time += 100
        print (q_list[0][0], time)
        q_list[0][1] = 0
        q_list.rotate(-1)
    elif q_list[0][1] < 100:
        time += q_list[0][1]
        q_list[0][1] = 0
        print (q_list[0][0], time)
        q_list.rotate(-1)
    else:
        q_list[0][1] -= 100
        time += 100
        q_list.rotate(-1)

Fixed submission:
from collections import deque


n, q = map(int, input().split())
n_t = deque()
for i in range(n):
    s, j = input().split()
    n_t.append([str(s), int(j)])

timer = 0

while n_t:
    s, i = n_t.popleft()
    if i > q:
        i -= q
        timer += q
        n_t.append([s, i])
    else:
        timer += i
        print("{0} {1}".format(s, timer))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def linerSearch(S, key):
    tmp = S[::1]
    i = 0
    tmp.append(key)
    while S[i] != key:
        i += 1
    if i == len(tmp)-1:
        return False
    return True

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

count = 0

for i in range(q):
    if linerSearch(S, T[i]):
        count += 1

print(count)

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


def linerSearch(S, key):
    i = 0
    S.append(key)
    while S[i] != key:
        i += 1
    if i == len(S)-1:
        S.pop()
        return False
    S.pop()
    return True

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

count = 0

for i in range(q):
    if linerSearch(S, T[i]):
        count += 1

print (count)
Buggy python submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-


def binarySearch(A, key):
    left, right = 0, n
    while left < right:
        mid = (left + right) / 2
        if A[mid] == key:
            return True
        elif key < A[mid]:
            right = mid
        else:
            left = mid += 1
    return False

n = int(input())
S = [int(i) for i in range(n)]
q = int(input())
T = [int(i) for i in range(q)]

count = 0

for i in T:
    if (S,i):
        count += 1

print (count)

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


def binarySearch(A, key):
    left, right = 0, n
    while left < right:
        mid = int((left + right) / 2)
        if A[mid] == key:
            return True
        elif key < A[mid]:
            right = mid
        else:
            left = mid + 1
    return False

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

count = 0

for i in T:
    if binarySearch(S,i):
        count += 1

print (count)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- conding:utf-8 -*-


from collections import deque

q_list = deque()
n = int(input())
for i in range(n):
    tmp = input().split()
    if tmp[0] == "find":
        if tmp[1] in q_list:
            print("yes")
        else:
            print ("no")
    else:
        q_list.append(tmp[1])

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


se = set()
n = int(input())
tmp = [input().split() for i in range(n)]


for i in tmp:
    cmd, v = i
    if cmd == "find":
        if v in se:
            print("yes")
        else:
            print ("no")
    else:
        se.add(v)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- conding:utf-8 -*-


from collections import deque

q_list = deque()
n = int(input())
tmp = [input().split() for i in range(n)]

for i in tmp:
    cmd, v = i
    if cmd == "find":
        if v in q_list:
            print("yes")
        else:
            print ("no")
    else:
        q_list.append(v)

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


se = set()
n = int(input())
tmp = [input().split() for i in range(n)]


for i in tmp:
    cmd, v = i
    if cmd == "find":
        if v in se:
            print("yes")
        else:
            print ("no")
    else:
        se.add(v)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
theta = math.pi / 3
p1 = [0, 0]
p2 = [100, 0]


def kock(d, p1, p2):
    if d == 0:
        return

    sx = (p1[0] + 2 * p2[0]) / 3
    tx = (2 * p1[0] + p2[0]) / 3
    sy = (p1[1] + 2 * p2[1]) / 3
    ty = (2 * p1[1] + p2[1]) / 3
    s = [sx, sy]
    t = [tx, ty]

    ux = (t[0] - s[0]) * math.cos(theta) + (t[1] - s[1]) * math.sin(theta) + sx
    uy = (t[1] - s[1]) * math.cos(theta) - (t[0] - s[0]) * math.sin(theta) + sy
    u = [ux, uy]

    kock(n - 1, p1, s)
    print("{0} {1}".format(s[0], s[1], '.8f'))
    kock(n - 1, s, u)
    print("{0} {1}".format(u[0], u[1], '.8f'))
    kock(n -1 ,u, t)
    print("{0} {1}".format(t[0], t[1], '.8f'))
    kock(n - 1, t, p2)

if __name__ == '__main__':
    print("0.0000000 0.0000000")
    kock(n, p1, p2)
    print("100.0000000 0.0000000")

Fixed submission:
import math

n = int(input())
theta = math.pi / 3
p1 = [0, 0]
p2 = [100, 0]


def kock(d, p1, p2):
    if d == 0:
        return

    sx = (2*p1[0] + p2[0]) / 3
    tx = (p1[0] + 2 * p2[0]) / 3
    sy = (2 * p1[1] + p2[1]) / 3
    ty = (p1[1] + 2 * p2[1]) / 3
    s = [sx, sy]
    t = [tx, ty]

    ux = (t[0] - s[0]) * math.cos(theta) - (t[1] - s[1]) * math.sin(theta) + sx
    uy = (t[1] - s[1]) * math.cos(theta) + (t[0] - s[0]) * math.sin(theta) + sy
    u = [ux, uy]

    kock(d - 1, p1, s)
    print("{0:.8f} {1:.8f}".format(*s))
    kock(d - 1, s, u)
    print("{0:.8f} {1:.8f}".format(*u))
    kock(d -1 ,u, t)
    print("{0:.08f} {1:.8f}".format(*t))
    kock(d - 1, t, p2)

if __name__ == '__main__':
    print("0.00000000 0.00000000")
    kock(n, p1, p2)
    print("100.00000000 0.00000000")
Buggy python submission (verdict: Runtime Error):
from collections import deque

n = int(input())
A = deque(map(int, input().split()))
num = list(sorted(A, reverse=True))

count = 0
for i in range(n - 1):
    count += len(A) - 1 - A.index(num[i])
    A.remove(num[i])

print(count)

Fixed submission:
def merge(A, left, mid, right):
    global count
    banpei = 1000000001
    L = A[left:mid]
    l = len(L)
    L += [banpei]
    R = A[mid:right] + [banpei]

    i, j = 0, 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
            count += l - i
    return count


def merge_Sort(A, left, right):
    if 1 < right - left:
        mid = (left + right) // 2
        merge_Sort(A, left, mid)
        merge_Sort(A, mid, right)
        merge(A, left, mid, right)

n = int(input())
A = list(map(int, input().split()))
count = 0
merge_Sort(A, 0, n)
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int, input().split()))
num = list(sorted(A, reverse=True))

count = 0
for i in range(n - 1):
    count += len(A) - 1 - A.index(num[i])
    A.remove(num[i])

print(count)

Fixed submission:
def merge(A, left, mid, right):
    global count
    banpei = 1000000001
    L = A[left:mid]
    l = len(L)
    L += [banpei]
    R = A[mid:right] + [banpei]

    i, j = 0, 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
            count += l - i
    return count


def merge_Sort(A, left, right):
    if 1 < right - left:
        mid = (left + right) // 2
        merge_Sort(A, left, mid)
        merge_Sort(A, mid, right)
        merge(A, left, mid, right)

n = int(input())
A = list(map(int, input().split()))
count = 0
merge_Sort(A, 0, n)
print(count)

Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
A = deque(map(int, input().split()))
num = list(sorted(A, reverse=True))

count = 0
for i in range(n - 1):
    count += len(A) - 1 - A.index(num[i])
    A.remove(num[i])

print(count)

Fixed submission:
def merge(A, left, mid, right):
    global count
    banpei = 1000000001
    L = A[left:mid]
    l = len(L)
    L += [banpei]
    R = A[mid:right] + [banpei]

    i, j = 0, 0
    for k in range(left, right):
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1
            count += l - i
    return count


def merge_Sort(A, left, right):
    if 1 < right - left:
        mid = (left + right) // 2
        merge_Sort(A, left, mid)
        merge_Sort(A, mid, right)
        merge(A, left, mid, right)

n = int(input())
A = list(map(int, input().split()))
count = 0
merge_Sort(A, 0, n)
print(count)
Buggy python submission (verdict: Runtime Error):


def counting_sort(A, k):
    B = [0 for i in range(len(A))]
    C = [0 for i in range(0, k + 1)]

    # C[i]???i???????????°????¨??????????
    for j in range(1, n):
        C[A[j]] += 1

    # C[i]???i??\????????°???????????°????¨??????????
    for i in range(1, k + 1):
        C[i] +=  C[i - 1]

    for j in reversed(range(1, n)):
        B[C[A[j]]] = A[j]
        C[A[j]] -= 1
    return B
n = int(input())
A = list(map(int, input().split()))
k = max(A)

print(counting_sort(A, B, k))

Fixed submission:


def counting_sort(A, k):
    n = len(A)
    B = ['0' for i in range(n + 1)]
    C = [0 for i in range(0, k + 1)]

    # C[i]???i???????????°????¨??????????
    for j in range(0, n):
        C[A[j]] += 1

    # C[i]???i??\????????°???????????°????¨??????????
    for i in range(0, k):
        C[i + 1] +=  C[i]

    for j in reversed(range(0, n)):
        B[C[A[j]]] = str(A[j])
        C[A[j]] -= 1
    return ' '.join(B[1:])

n = int(input())
A = list(map(int, input().split()))
k = max(A)
print(counting_sort(A, k))
Buggy python submission (verdict: Runtime Error):


def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1


n = int(input())
A = list(map(int, input().split()))

q =partition(A, 1, len(A) - 1)

print(*A[:q] + " [{0}] " + *A[q + 1:])

Fixed submission:


def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1


n = int(input())
A = list(map(int, input().split()))

q =partition(A, 0, len(A) - 1)

print(*A[:q], end = ' ')
print('[{0}]'.format(A[q]), end = ' ')
print(*A[q + 1:])

Buggy python submission (verdict: Runtime Error):


def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1


n = int(input())
A = list(map(int, input().split()))

q =partition(A, 1, len(A) - 1)

print(*A[:q] + " [{0}] " + *A[q + 1:])

Fixed submission:


def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r] = A[r], A[i + 1]
    return i + 1


n = int(input())
A = list(map(int, input().split()))

q =partition(A, 0, len(A) - 1)

print(*A[:q], end = ' ')
print('[{0}]'.format(A[q]), end = ' ')
print(*A[q + 1:])
Buggy python submission (verdict: Runtime Error):

class Node:
    def __init__(self, num, parent, children):
        self.id = num
        self.parent = -1
        self.depth = 0
        self.type = None
        self.children = children

    def show_info(self):
        print('node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(self.id, self.parent, self.depth,self.type, self.children))


def set_node(i_s):
    num, children = i_s[0], i_s[2:]
    node = Node(num, -1, children)
    T[num] = node
    for n in children:
        T[-1] -= n


def set_pdt(n_i, parent, depth):
    node = T[n_i]
    node.parent = parent
    node.depth = depth
    if node.children:
        node.type = 'internal node'
        for n in node.children:
            set_pdt(n, n_i, depth + 1)
    else:
        node.type = 'leaf'



n = int(input())
tree = [list(map(int, input().split())) for i in range(n)]
T = [None] * n

T += [int(n * (n - 1) / 2)]

for i in range(n):
    set_node(tree[i])
set_pdt(1, -1, 0)

T[0].type ='root'

for n in T[:-1]:
    n.show_info()

Fixed submission:


class Node:
    def __init__(self, num, children):
        self.num = num
        self.children = children
        self.parents = -1
        self.type = None
        self.depth = 0

    def output(self):
        print('node {0}: parent = {1}, depth = {2}, {3}, {4}'.format(self.num,
                                                                      self.parents,
                                                                      self.depth,
                                                                      self.type,
                                                                      self.children))


def set_node(num, children):
    node = Node(num, children)
    T[num] = node
    for n in children:
        T[-1] -= n  # ?????£???T[-1]???root???????????????????????????


def set_pdt(n_i, parent, depth):
    node = T[n_i]
    node.parents = parent
    node.depth = depth
    if node.children:
        node.type = 'internal node'
        for n in node.children:
            set_pdt(n, n_i, depth + 1)
    else:
        node.type = 'leaf'


n = int(input())
tree = [list(map(int, input().split())) for i in range(n)]
T = [None] * n
T += [n * (n - 1) // 2]
for j in tree:
    set_node(j[0], j[2:])

set_pdt(T[-1], -1, 0)

T[T[-1]].type = 'root'

for n in T[:-1]:
    n.output()
Buggy python submission (verdict: Runtime Error):
lst=[0 for i in range(50)]
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                lst[a+b+c+d] += 1
while i:
    try:
        print(lst[int(input())])
    except:
        break


Fixed submission:
lst=[0 for i in range(51)]
for a in range(10):
    for b in range(10):
        for c in range(10):
            for d in range(10):
                lst[a+b+c+d] += 1
while 1:
    try:
        print(lst[int(input())])
    except:
        break
Buggy python submission (verdict: Time Limit Exceeded):
import math

def prime_judge(n):
    if n==1:
        return False
    elif n==2:
        return True
    elif n%2==0:
        return False
    else:
        sqrt_num=math.ceil(math.sqrt(n))+1
        for i in range(3,sqrt_num, 2):
            if n%i==0:
                return False
        return True

def prime_count(n):
    count=0
    for i in range(1,n+1):
        if prime_judge(i):
            count+=1
    print(count)

while 1:
    try:
        prime_count(int(input()))        
    except EOFError:
        break


Fixed submission:
def prime_judge(n):
    if n==1:
        return False
    elif n==2:
        return True
    elif n%2==0:
        return False
    else:
        sqrt_num=int(n**0.5)+1
        for i in range(3,sqrt_num, 2):
            if n%i==0:
                return False
        return True

prime=[0]
for i in range(1,1000000):
    if prime_judge(i):
        prime.append(prime[-1]+1)
    else:
        prime.append(prime[-1])

while 1:
    try:
        print(prime[int(input())])     
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
import math

def prime_judge(n):
    if n==1:
        return False
    elif n==2:
        return True
    elif n%2==0:
        return False
    else:
        sqrt_num=math.ceil(math.sqrt(n))+1
        for i in range(3,sqrt_num, 2):
            if n%i==0:
                return False
        return True

def prime_count(n):
    count=0
    for i in range(1,n+1):
        if prime_judge(i):
            count+=1
    print(count)

while 1:
    try:
        prime_count(int(input()))        
    except:
        break


Fixed submission:
def prime_judge(n):
    if n==1:
        return False
    elif n==2:
        return True
    elif n%2==0:
        return False
    else:
        sqrt_num=int(n**0.5)+1
        for i in range(3,sqrt_num, 2):
            if n%i==0:
                return False
        return True

prime=[0]
for i in range(1,1000000):
    if prime_judge(i):
        prime.append(prime[-1]+1)
    else:
        prime.append(prime[-1])

while 1:
    try:
        print(prime[int(input())])     
    except:
        break
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):
while True:
    n = input()
    if n == 0:
        break

    rs = {}
    for i in range(n):
        arr = input().split(' ')
        s = arr[0] * arr[1]
        rs[arr[0]] = (rs[arr[0]] or 0) + s

    top = [k for k, v in rs.items if v > 1000000]
    if len(top) == 0:
        print('NA')
    else:
        for i in top:
            print(i)

Fixed submission:
while True:
  n = int(input())
  if n == 0:
    break
  c = 0
  l = []
  d = {}
  for i in range(n):
    num,x,y = map(int,input().split())
    if num in d:
      d[num] = d[num] + x*y
    else:
      d[num] = x*y
      l.append(num)
  for i in l:
    if d[i] >= 1000000:
      print(i)
      c += 1
  if c == 0:
    print('NA')
Buggy python submission (verdict: Runtime Error):
for i in range(1, 10):
    for j in range(1, 10):
        print(i + "x" + j + "=" + i * j)

Fixed submission:
for i in range(1, 10):
    for j in range(1, 10):
        print("{}x{}={}".format(i, j, i*j))
Buggy python submission (verdict: Runtime Error):
x = input()
print (x**3)

Fixed submission:
print(int(input()) ** 3)

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

Fixed submission:
print(int(input()) ** 3)
Buggy python submission (verdict: Runtime Error):
def area(ls):
    return ls[0] * ls[1]

def per(ls):
    return (2 * ls[0]) + (2 * ls[1])


if __name__ == '__main__':
    data = list(map(int, input().split()))
    s = area(data)
    l = per(data)
    print(s, l)

Fixed submission:
def area(ls):
    return ls[0] * ls[1]

def per(ls):
    return (2 * ls[0]) + (2 * ls[1])


if __name__ == '__main__':
    data = list(map(int, input().split()))
    s = area(data)
    l = per(data)
    print(s, l)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python3
import sys

def Dnum():
    
    str = " "
    while(str != '\n'):
        str = sys.stdin.readline()
        cnt = 0
        list = str.split(" ")
        num = int(list[0])+int(list[1])
        while(num >= 1):
            cnt=cnt+1
            num = num/10
        print(cnt)

Dnum()

Fixed submission:
#@ /usr/bin/env python3.4
import sys
list = sys.stdin.readlines()
for i in list:
    num = i[:-1].split(' ', 2)
    print(len(str(int(num[0])+int(num[1]))))
Buggy python submission (verdict: Runtime Error):
import sys

#inputNum = sys.stdin.readlines()[:-1]
inputNum = open('sample.txt', 'r')

for i in inputNum:
    new = []
    n = i[:-1].split(' ', 6)
    for s in n:
        new.append(float(s))
    k = new[0]
    q = 0
    for a in new[0:3]:
        new[q] = a/k
        q = q + 1
    l = new[3]
    for a in new[3:6]:
        new[q] = a - l*new[q-3]
        q = q + 1
    if new[4] == 0:
        y = new[5]
    else:
        y = new[5]/new[4]
    x = new[2]-(new[1]*y)
    print("{0:.3f}".format(x),"{0:.3f}".format(y))

Fixed submission:
import sys

inputNum = sys.stdin.readlines()

for i in inputNum:
    new = []
    n = i[:-1].split(' ', 6)
    for s in n:
        new.append(float(s))
    k = new[0]
    q = 0
    for a in new[0:3]:
        new[q] = a/k
        q = q + 1
    l = new[3]
    for a in new[3:6]:
        new[q] = a - l*new[q-3]
        q = q + 1
    if new[4] == 0:
        y = new[5]
    else:
        y = new[5]/new[4]
    x = new[2]-(new[1]*y)
    print("{0:.3f}".format(x)+" "+"{0:.3f}".format(y))
Buggy python submission (verdict: Runtime Error):
import sys
list = sys.stdin.readlines()

e=0
GCD = 0
def Euclide(a, b):
    if b == 0:
        return a
    if a < b:
        tmp = a
        a = b
        b = tmp
    e = a%b
    return Euclide(b, e)
    
def LCM(a, b, c):
    return int(a/c*b)

for i in list:
    a = i[0]
    b = i[1]
    GCD = Euclide(a, b)
    print(str(GCD)+" "+str(LCM(a, b, GCD)))

Fixed submission:
import sys
list = sys.stdin.readlines()

e=0
GCD = 0
def Euclide(a, b):
    if b == 0:
        return a
    if a < b:
        tmp = a
        a = b
        b = tmp
    e = a%b
    return Euclide(b, e)

for i in list:
    i = i.split(' ')
    GCD = Euclide(int(i[0]), int(i[1]))
    print(str(GCD)+" "+str(int(int(i[0])/GCD*int(i[1]))))