Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def partition(A,p,r):
    x=A[r][1]
    i=p-1
    for j in xrange(p,r):
        if A[j][1]<=x:
            i+=1
            A[i],A[j]=A[j],A[i]
    A[i+1],A[r]=A[r],A[i+1]
    return i+1

def quicksort(A,p,r):
    if p<r:
        q=partition(A,p,r)
        quicksort(A,p,q-1)
        quicksort(A,q+1,r)

def bubblesort(a,n):
    flag=1
    while flag:
        flag=0
        if n==0:
            break
        else :
            for i in xrange(n-1,0,-1):
                if a[i][1]<a[i-1][1]:
                    a[i-1],a[i]=a[i],a[i-1]
                    flag=1

n=input()
card_1=[[0]*2 for i in xrange(n)]

for i in xrange(n):
    card_1[i][0],card_1[i][1]=map(str,raw_input().split())
    card_1[i][1]=int(card_1[i][1])

card_2=list(card_1)
quicksort(card_1,0,n-1)
bubblesort(card_2,n)

if card_1==card_2:
    print("Stable")
else :
    print("Not stable")

for i in xrange(n):
    card_1[i]=map(str,card_1[i])
    print(" ".join(card_1[i]))

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

def quicksort(A,p,r):
    if p<r:
        q=partition(A,p,r)
        quicksort(A,p,q-1)
        quicksort(A,q+1,r)

def merge(A,left,mid,right):
    n1=mid-left
    n2=right-mid
    l=[A[left+i] for i in xrange(n1)]
    r=[A[mid+i] for i in xrange(n2)]
    l.append([0,float('inf')])
    r.append([0,float('inf')])
    i=0
    j=0
    for k in xrange(left,right):
        if l[i][1]<=r[j][1]:
            A[k]=l[i]
            i=i+1
        else:
            A[k]=r[j]
            j=j+1

def mergesort(A,left,right):
    if left+1<right:
        mid=(left+right)/2
        mergesort(A,left,mid)
        mergesort(A,mid,right)
        merge(A,left,mid,right)
        
n=input()
card_1=[[0]*2 for i in xrange(n)]

for i in xrange(n):
    card_1[i][0],card_1[i][1]=map(str,raw_input().split())
    card_1[i][1]=int(card_1[i][1])

card_2=list(card_1)
quicksort(card_1,0,n-1)
mergesort(card_2,0,n)

if card_1==card_2:
    print("Stable")
else :
    print("Not stable")

for i in xrange(n):
    card_1[i]=map(str,card_1[i])
    print(" ".join(card_1[i]))
Buggy python submission (verdict: Runtime Error):
v,e=map(int,raw_input().split())
dist=[[float("inf")]*v for _ in xrange(v)]
for i in xrange(e):
????????s,t,d=map(int,raw_input().split())
????????dist[s][t]=d

dp=[[float('inf')]*(v) for _ in xrange(1<<v)]
dp[1][0]=0
for i in xrange(1<<v):
????????for j in xrange(v):
????????????????if dp[i][j]==float('inf'):continue
????????????????for k in xrange(v):
????????????????????????if not (i>>k)&1:
????????????????????????    nexti=i|1<<k
????????????????????????    nextdist=dp[i][j]+dist[j][k]
????????????????????????    dp[nexti][k]=min(dp[nexti][k],nextdist)

ans=float('inf')
for i in xrange(v):
????????if dp[(1<<v)-1][i]==float('inf'):continue
????????ans=min(ans,dp[(1<<v)-1][i]+dist[i][0])
if ans==float('inf'):
????????print(-1)
else:
????????print(ans)

Fixed submission:
v,e=map(int,raw_input().split())
dist=[[float("inf")]*v for _ in xrange(v)]
for i in xrange(e):
    s,t,d=map(int,raw_input().split())
    dist[s][t]=d

dp=[[float('inf')]*(v) for _ in xrange(1<<v)]
dp[1][0]=0
for i in xrange(1<<v):
    for j in xrange(v):
        if dp[i][j]==float('inf'):continue
        for k in xrange(v):
            if not (i>>k)&1:
                nexti=i|1<<k
                nextdist=dp[i][j]+dist[j][k]
                dp[nexti][k]=min(dp[nexti][k],nextdist)

ans=float('inf')
for i in xrange(v):
    if dp[(1<<v)-1][i]==float('inf'):continue
    ans=min(ans,dp[(1<<v)-1][i]+dist[i][0])
if ans==float('inf'):
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
def add_edge(frm,to):
    g[frm].append(to)
    rg[to].append(frm)

def dfs(now,used,back_track):
    used[now]=True
    for nx in g[now]:
        if not used[nx]:dfs(nx,used,back_track)
    back_track.append(now)

def rdfs(now,num_cmp,used,cmp):
    used[now]=True
    cmp[now]=num_cmp
    for nx in rg[now]:
        if not used[nx]:rdfs(nx,num_cmp,used,cmp)

def scc(n):
    used=[False]*n
    back_track=[]
    cmp=[-1]*n
    for v in xrange(n):
        if not used[v]:dfs(v,used,back_track)
    used=[False]*n
    num_cmp=0
    for v in back_track[::-1]:
        if not used[v]:
            rdfs(v,num_cmp,used,cmp)
            num_cmp+=1
    return num_cmp,cmp

n,m=map(int,raw_input().split())
g=[[] for _ in xrange(n)]
rg=[[] for _ in xrange(n)]

for i in xrange(m):
    s,t=map(int,raw_input().split())
    add_edge(s,t)
    
num,cmp=scc(n)
q=int(raw_input())
for i in xrange(q):
    u,v=map(int,raw_input().split())
    if cmp[u]==cmp[v]:
        print(1)
    else:
        print(0)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)

def add_edge(frm,to):
    g[frm].append(to)
    rg[to].append(frm)

def dfs(now,used,back_track):
    used[now]=True
    for nx in g[now]:
        if not used[nx]:dfs(nx,used,back_track)
    back_track.append(now)

def rdfs(now,num_cmp,used,cmp):
    used[now]=True
    cmp[now]=num_cmp
    for nx in rg[now]:
        if not used[nx]:rdfs(nx,num_cmp,used,cmp)

def scc(n):
    used=[False]*n
    back_track=[]
    cmp=[-1]*n
    for v in xrange(n):
        if not used[v]:dfs(v,used,back_track)
    used=[False]*n
    num_cmp=0
    for v in back_track[::-1]:
        if not used[v]:
            rdfs(v,num_cmp,used,cmp)
            num_cmp+=1
    return num_cmp,cmp

n,m=map(int,raw_input().split())
g=[[] for _ in xrange(n)]
rg=[[] for _ in xrange(n)]

for i in xrange(m):
    s,t=map(int,raw_input().split())
    add_edge(s,t)

num,cmp=scc(n)
q=int(raw_input())
for i in xrange(q):
    u,v=map(int,raw_input().split())
    if cmp[u]==cmp[v]:
        print(1)
    else:
        print(0)
Buggy python submission (verdict: Runtime Error):
from collections import deque

def Topologicalsort():
    for i in xrange(v):
        if indeg[i]==0 and color[i]==0:
            bfs(i)

def bfs(s):
    color[s]=2
    q.append(s)
    while len(q)>0:
        i=q.popleft()
        ans.append(i)
        for j in xrange(v):
            if m[i][j]!=-1 and color[j]==0 :
                indeg[j]-=1
                if indeg[j]==0:
                    q.append(m[i][j])
                    color[j]=1

v,e=map(int,raw_input().split())
m=[[-1]*v for i in xrange(v)]
indeg=[0]*v
color=[0]*v
start=[]
ans=deque()
q=deque()
for i in xrange(v):
    s,t=map(int,raw_input().split())
    m[s][t]=t
    indeg[t]+=1
Topologicalsort()
for i in ans:
    print(i)

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

from collections import deque

def Topologicalsort(n):     #n??????????????°
    start=deque()
    for i in xrange(n):
        if indeg[i]==0 :
            start.append(i)
    while len(start)>0:
        i=start.popleft()
        ans.append(i)
        for j in g[i]:
            indeg[j]-=1
            if indeg[j]==0:
                start.append(j)
    return ans

v,e=map(int,raw_input().split())
g=[[]for i in xrange(v)]
indeg=[0]*v
ans=[]
for i in xrange(e):
    s,t=map(int,raw_input().split())
    g[s].append(t)
    indeg[t]+=1
    
ans=Topologicalsort(v)
for i in ans:
    print(i)

Buggy python submission (verdict: Runtime Error):
from collections import deque

def Topologicalsort():
    for i in xrange(v):
        if indeg[i]==0 and color[i]==0:
            bfs(i)

def bfs(s):
    color[s]=2
    q.append(s)
    while len(q)>0:
        i=q.popleft()
        ans.append(i)
        for j in xrange(v):
            if m[i][j]!=-1:
                indeg[j]-=1
                if indeg[j]==0  and color[j]==0:
                    q.append(m[i][j])
                    color[j]=1

v,e=map(int,raw_input().split())
m=[[-1]*v for i in xrange(v)]
indeg=[0]*v
color=[0]*v
ans=deque()
q=deque()
for i in xrange(v):
    s,t=map(int,raw_input().split())
    m[s][t]=t
    indeg[t]+=1
Topologicalsort()
for i in ans:
    print(i)

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

from collections import deque

def Topologicalsort(n):     #n??????????????°
    start=deque()
    for i in xrange(n):
        if indeg[i]==0 :
            start.append(i)
    while len(start)>0:
        i=start.popleft()
        ans.append(i)
        for j in g[i]:
            indeg[j]-=1
            if indeg[j]==0:
                start.append(j)
    return ans

v,e=map(int,raw_input().split())
g=[[]for i in xrange(v)]
indeg=[0]*v
ans=[]
for i in xrange(e):
    s,t=map(int,raw_input().split())
    g[s].append(t)
    indeg[t]+=1
    
ans=Topologicalsort(v)
for i in ans:
    print(i)
Buggy python submission (verdict: Runtime Error):
ct=-1
a=[0]*100000
b=[0]*100000
c=[0]*100000
while True:
    ct+=1
    a[ct],b[ct],c[ct]=map(str,raw_input().split())
    if b[ct]==?:
        break
    else:
        continue
for i in xrange(ct):
    if b[i]=="+":
        print(int(a[i])+int(c[i]))
    elif b[i]=="-":
        print(int(a[i])-int(c[i]))
    elif b[i]=="*":
        print(int(a[i])*int(c[i]))
    else:
        print(int(a[i])/int(c[i]))
    

Fixed submission:
ct=-1
a=[0]*100000
b=[0]*100000
c=[0]*100000
while True:
    ct+=1
    a[ct],b[ct],c[ct]=map(str,raw_input().split())
    if b[ct]=="?":
        break
    else:
        continue
for i in xrange(ct):
    if b[i]=="+":
        print(int(a[i])+int(c[i]))
    elif b[i]=="-":
        print(int(a[i])-int(c[i]))
    elif b[i]=="*":
        print(int(a[i])*int(c[i]))
    else:
        print(int(a[i])/int(c[i]))
Buggy python submission (verdict: Runtime Error):
n=input()
a=map(int,raw_input().split())
a.reverse()
print(' '.join(a))

Fixed submission:
n=input()
a=map(str,raw_input().split())
a.reverse()
print(' '.join(a))
Buggy python submission (verdict: Runtime Error):
word=raw_input()
sen=[]
ct=0
while 1:
    sen=map(str,raw_input().split(" "))
    if sen[-1:0]=="END_OF_TEXT":
        break
    else:continue
for i in sen:
    i.lower()
    if i==word:
        ct+=1
    else:continue
print(ct)

Fixed submission:
w=raw_input()
ct=0
while 1:
    s=raw_input()
    if s=='END_OF_TEXT':
        break
    s=s.split()
    for i in s:
        if i.lower()==w :
            ct+=1
print(ct)
Buggy python submission (verdict: Runtime Error):
length = int(input())
eles = [int(l) for l in input().split()]
is_stable = 'Stable'

import copy
_copy = copy.deepcopy(eles)

for i in range(length):
    for j in range(length-1, 0, -1):
        if _copy[j][1] < _copy[j-1][1]:
            _copy[j], _copy[j-1] = _copy[j-1], _copy[j]

print(*_copy)
print(is_stable)

__copy = copy.deepcopy(eles)

for i in range(length-1):
    _min = i
    for l in range(i, length):
        if __copy[l][1] < __copy[_min][1]:
            _min = l
            is_stable = 'Not Stable'
    __copy[i], __copy[_min] = __copy[_min], __copy[i]

print(*__copy)
print(is_stable)

Fixed submission:
length = int(input())
eles = [l for l in input().split()]
is_stable = 'Stable'

_copy = eles[::]

for i in range(length):
    for j in range(length-1, 0, -1):
        if _copy[j][1] < _copy[j-1][1]:
            _copy[j], _copy[j-1] = _copy[j-1], _copy[j]

print(*_copy)
print(is_stable)

__copy = eles[::]
for i in range(length-1):
    _min = i
    for l in range(i, length):
        if __copy[l][1] < __copy[_min][1]:
            _min = l
    if __copy[i][1] > __copy[_min][1]:
        __copy[i], __copy[_min] = __copy[_min], __copy[i]

print(*__copy)

for i in range(length -1):
    if _copy[i] != __copy[i]:
        is_stable = 'Not stable'

print(is_stable)
Buggy python submission (verdict: Runtime Error):
from collections import deque

_l = deque(input().split(' '))

last = _l.pop()

second = _l.pop()
d = _l.pop()
c = _l.pop()

first = _l.pop()
b = _l.pop()
a = _l.pop()

print(eval("({}{}{}){}({}{}{})".format(a, first, b, last, c, second, d)))

Fixed submission:
import re

stack = []
_l = input().split(' ')

for c in _l:
    if re.match(r"(\+|\-|\/|\*)", c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))
    else:
        stack += [c]

print(stack[0])

Buggy python submission (verdict: Runtime Error):
import re

stack = []
_l = input().split(' ')

for c in _l:
    stack += [c]
    if re.match('/(+|-|/|*)/', c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))

print(stack[0])

Fixed submission:
import re

stack = []
_l = input().split(' ')

for c in _l:
    if re.match(r"(\+|\-|\/|\*)", c):
        f = stack.pop()
        z = stack.pop()
        stack.append(eval("{}{}{}".format(z, c, f)))
    else:
        stack += [c]

print(stack[0])
Buggy python submission (verdict: Runtime Error):
import numpy as np
import sys

for i in sys.stdin:
    a,b,c,d,e,f = map(float, i.split())
    A = np.array([[ a, b],
        [ d, e]])
    B = np.array([c,f])
    X = np.linalg.solve(A,B)
    print "{0:.3f}".format(X[0]),"{0:.3f}".format(X[1])

Fixed submission:
import sys
 
out = []
for line in sys.stdin.readlines():
    List = map(float, line.strip().split())
 
    [a, b, c, d, e, f] = List
 
    x = (b*f-c*e)/(b*d-a*e)
    y = (a*f-c*d)/(a*e-b*d)
 
    out.append("%.3f %.3f" % (x+0, y+0))
 
for i in xrange(len(out)):
    print out[i]

Buggy python submission (verdict: Runtime Error):

import numpy as np
import sys

for i in sys.stdin:
    a,b,c,d,e,f = map(float, i.split())
    A = np.array([[ a, b],
        [ d, e]])
    B = np.array([c,f])
    X = np.linalg.solve(A,B)
    print "{0:.3f}".format(X[0]),"{0:.3f}".format(X[1])

Fixed submission:
import sys
 
out = []
for line in sys.stdin.readlines():
    List = map(float, line.strip().split())
 
    [a, b, c, d, e, f] = List
 
    x = (b*f-c*e)/(b*d-a*e)
    y = (a*f-c*d)/(a*e-b*d)
 
    out.append("%.3f %.3f" % (x+0, y+0))
 
for i in xrange(len(out)):
    print out[i]

Buggy python submission (verdict: Runtime Error):

import numpy as np
import sys

printf = sys.stdout.write

for i in sys.stdin:
    try:
        a,b,c,d,e,f = map(float, i.split())
    except:
        printf(i)
        break

    A = np.array([[ a, b],
        [ d, e]])
    B = np.array([c,f])
    X = np.linalg.solve(A,B)
    print "{0:.3f}".format(X[0]),"{0:.3f}".format(X[1])

Fixed submission:
import sys
 
out = []
for line in sys.stdin.readlines():
    List = map(float, line.strip().split())
 
    [a, b, c, d, e, f] = List
 
    x = (b*f-c*e)/(b*d-a*e)
    y = (a*f-c*d)/(a*e-b*d)
 
    out.append("%.3f %.3f" % (x+0, y+0))
 
for i in xrange(len(out)):
    print out[i]
Buggy python submission (verdict: Runtime Error):
import sys

def gcd(a,b):
    if a == b:
        return a
    else:
        return gcd(b, abs(a-b))

def lcm(a,b,g):
    return a*b/g

if __name__ == "__main__":
    for i in sys.stdin:
        a,b = map(int, i.split())
        print gcd(a,b),lcm(a,b,gcd(a,b))

Fixed submission:
import sys
for i in sys.stdin:
    m, n = map(int, i.split())
    t1, t2 = m, n
    while True:
        if m % n == 0:
            break
        m, n = n, m % n
    a = n
    b = (t1/ a) * t2
    print("{} {}".format(a, b))

Buggy python submission (verdict: Runtime Error):
#encoding=utf-8
import sys

printf = sys.stdout.write
ans = []
def gcd(a,b):
    if a == b:
        return a
    else:
        return gcd(b, abs(a-b))

def lcm(a,b,g):
    return a*b/g

if __name__ == "__main__":
    for i in sys.stdin:
        a,b = map(int, i.split())
        ans.append(gcd(a,b))
        ans.append(lcm(a,b,gcd(a,b)))
        
    for i in xrange(0,len(ans)  - 2,2):
        printf(str(ans[i]) + " " + str(ans[i + 1]) + "\n")
        
    printf(str(ans[len(ans) - 2]) + " " + str(ans[len(ans) - 1]))

Fixed submission:
import sys
for i in sys.stdin:
    m, n = map(int, i.split())
    t1, t2 = m, n
    while True:
        if m % n == 0:
            break
        m, n = n, m % n
    a = n
    b = (t1/ a) * t2
    print("{} {}".format(a, b))
Buggy python submission (verdict: Runtime Error):
#encoding=utf-8

inp = input()
x = 100000
for i in xrange(inp):
	x = x * 1.05
	if int(x % 1000) != 0:
		x += 1000 - int(x % 1000)

print int(x)

Fixed submission:
#encoding=utf-8

inp = input()
x = 100000
for i in xrange(inp):
	x = x * 1.05
	if int(x % 1000) != 0:
		x += 1000 - int(x % 1000)

print int(x)
Buggy python submission (verdict: Time Limit Exceeded):

import sys

def prime(x):
    count = 0
    for n in range(2, x + 1):
        isprime = True
        for i in range(2, n):
            if n % i == 0:
                isprime = False
                break
        if isprime:
            count += 1
    return count
       
if __name__ == "__main__":
    for i in sys.stdin:
        x = int(i)
        print prime(x)
        

Fixed submission:
import sys
n=10**6
p=[1]*n
p[0],p[1]=0,0
for i in xrange(2,int(n**0.5)+1):
    if p[i]==1:
        for j in xrange(i**2,n,i):
            p[j]=0
for i in xrange(2,n):
    p[i]+=p[i-1]
for line in sys.stdin.readlines():
    print p[int(line)]

Buggy python submission (verdict: Time Limit Exceeded):

import sys

def prime(q):
    count = 0
    for i in xrange(1,q+1):
        if i == 2:
            count += 1
        if pow(2, i-1, i) == 1:
            count += 1
    return count 


if __name__ == "__main__":
    for i in sys.stdin:
        x = int(i)
        print prime(x)
        

Fixed submission:
import sys
n=10**6
p=[1]*n
p[0],p[1]=0,0
for i in xrange(2,int(n**0.5)+1):
    if p[i]==1:
        for j in xrange(i**2,n,i):
            p[j]=0
for i in xrange(2,n):
    p[i]+=p[i-1]
for line in sys.stdin.readlines():
    print p[int(line)]
Buggy python submission (verdict: Runtime Error):
import turtle
k = turtle.Turtle()
k.speed(0)
k.left(90)
while True:
    x = map(int,raw_input().split(","))
    if x[0] == 0 and x[1] == 0:
        break
    else:
        k.fd(x[0])
        k.right(x[1])
        continue
print int(k.xcor())
print int(k.ycor())

Fixed submission:
import math
 
x, y ,angle = 0, 0, 90
while True:
  line = map(int, raw_input().split(','))
  if line[0] == 0 and line[1] == 0: break
  radian = math.radians(angle)
  x += math.cos(radian) * line[0]
  y += math.sin(radian) * line[0]
  angle -= line[1]
 
print(int(x))
print(int(y))
Buggy python submission (verdict: Runtime Error):
#encoding=utf-8

def inp(i):
    split_word = i.split()
    return split_word

def rot(split_word):
    for i in xrange(len(split_word)):
        tako = ""
        if len(split_word[i]) == 4 or len(split_word[i]) == 3:
            num = ord(split_word[i][0]) - ord("t")
            for j in xrange(len(split_word[i])):
                tako +=  chr(ord(split_word[i][j]) - num)
            if tako == "that" or tako == "the" or tako == "this":
                return proce(split_word, num)
        else:
            pass
        num = 0

def proce(split_word, num):
    ans = ""
    for i in xrange(len(split_word)):
        for j in xrange(len(split_word[i])):
            if split_word[i][j] < ord("a") or ord("z") < split_word[i][j]:
                ans += split_word[i][j]
            else:
                ans += str(chr(ord(split_word[i][j]) - num))
        ans += " "
    return ans


if __name__ == "__main__":
    import sys
    for i in sys.stdin:
        word = inp(i)
        ans = rot(word)
        print ans[0:(len(ans) - 1)]

Fixed submission:
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'that' in s):
    s = s.translate(tbl)
  print s[:-1]

Buggy python submission (verdict: Runtime Error):
#encoding=utf-8

def inp(i):
    split_word = i.split()
    return split_word

def rot(split_word):
    for i in xrange(len(split_word)):
        tako = ""
        if len(split_word[i]) == 4 or len(split_word[i]) == 3:
            num = ord(split_word[i][0]) - ord("t")
            for j in xrange(len(split_word[i])):
                tako +=  chr(ord(split_word[i][j]) - num)
            if tako == "that" or tako == "the" or tako == "this":
                return proce(split_word, num)
        else:
            pass
        num = 0

def proce(split_word, num):
    ans = ""
    for i in xrange(len(split_word)):
        for j in xrange(len(split_word[i])):
            if split_word[i][j] < ord("a") or ord("z") < split_word[i][j]:
                ans += split_word[i][j]
            else:
                ans += str(chr(ord(split_word[i][j]) - num))
        ans += " "
    return ans


if __name__ == "__main__":
    import sys
    for i in sys.stdin:
        word = inp(i)
        ans = rot(word)
        print ans[0:(len(ans) - 1)]

Fixed submission:
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
  while not('the' in s or 'this' in s or 'that' in s):
    s = s.translate(tbl)
  print s[:-1]
Buggy python submission (verdict: Runtime Error):
x = input()
for i in xrange(x):
	grad1,grad2 = 0, 0
	x1,y1,x2,y2,x3,y3,x4,y4 = map(float, raw_input().split())
	grad1, grad2 = ((y1 - y2)/(x1 - x2)), ((y3 - y4)/(x3 - x4))
	if grad1 == grad2:
		print "YES"
	else:
		print "NO"

Fixed submission:
n = int(raw_input())
for l in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float,raw_input().split())
    if abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3))< 1e-10:
        print "YES"
    else:
        print "NO"

Buggy python submission (verdict: Runtime Error):
 for i in xrange(input()):
	grad1, grad2 = 0, 0
	x1,y1,x2,y2,x3,y3,x4,y4=map(float,raw_input().split())
	grad1, grad2 =	(y1 - y2)*(x3 - x4) , (y3 - y4)*(x1 - x2)
	if grad1 - grad2 == 0:
		print "YES"
	else:
		print "NO"

Fixed submission:
n = int(raw_input())
for l in range(n):
    x1,y1,x2,y2,x3,y3,x4,y4 = map(float,raw_input().split())
    if abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3))< 1e-10:
        print "YES"
    else:
        print "NO"
Buggy python submission (verdict: Runtime Error):

import sys

while True:
	x = input()
	num, ans = [], []
	if x == 0: break
	else:
		for j in xrange(x):
			num.append(input())
		for j in xrange(x):
			if num[j] > 0:
				for k in xrange(j + 1,x + 1):
# 					print num[j:k]
# 					print sum(num[j:k])
 					ans.append(sum(num[j:k]))
			else:
				pass
		print max(ans)

Fixed submission:
while True:
    n = input()
    if n == 0: break
    a = [ input() for i in xrange(n) ]
    m = -100000
    for i in xrange(n):
        s = 0
        for j in xrange(i, n):
            s += a[j]
            m = max(m, s)
    print m
Buggy python submission (verdict: Runtime Error):
#encoding=utf-8

import statistics as st
word1 = []
word = raw_input().split()
print st.mode(word)
for i in xrange(len(word)):
	word1.append(len(word[i]))
for i in xrange(len(word)):
	if len(word[i]) == max(word1):
		print word[i]

Fixed submission:
s = raw_input().split()
maxLength, maxCount = 0, 0
word1, word2, count = "", "", {}
for i in range(len(s)):
	count[s[i]] = 0
for i in range(len(s)):
	count[s[i]] += 1
	if(len(s[i]) > maxLength):
		maxLength = len(s[i])
		word2 = s[i]
for i in range(len(s)):
	if(count[s[i]] > maxCount):
		maxCount = count[s[i]]
		word1 = s[i]
print word1, word2

Buggy python submission (verdict: Runtime Error):
import statistics as st
word1 = []
word = raw_input().split()
for i in xrange(len(word)):
	word1.append(len(word[i]))
for i in xrange(len(word)):
	if len(word[i]) == max(word1):
		print st.mode(word), word[i]
		break

Fixed submission:
s = raw_input().split()
maxLength, maxCount = 0, 0
word1, word2, count = "", "", {}
for i in range(len(s)):
	count[s[i]] = 0
for i in range(len(s)):
	count[s[i]] += 1
	if(len(s[i]) > maxLength):
		maxLength = len(s[i])
		word2 = s[i]
for i in range(len(s)):
	if(count[s[i]] > maxCount):
		maxCount = count[s[i]]
		word1 = s[i]
print word1, word2

Buggy python submission (verdict: Runtime Error):
import statistics as st
word1 = []
word = raw_input().split()
for i in xrange(len(word)):
	word1.append(len(word[i]))
for i in xrange(len(word)):
	if len(word[i]) == max(word1):
		print(st.mode(word), word[i])
		break

Fixed submission:
s = raw_input().split()
maxLength, maxCount = 0, 0
word1, word2, count = "", "", {}
for i in range(len(s)):
	count[s[i]] = 0
for i in range(len(s)):
	count[s[i]] += 1
	if(len(s[i]) > maxLength):
		maxLength = len(s[i])
		word2 = s[i]
for i in range(len(s)):
	if(count[s[i]] > maxCount):
		maxCount = count[s[i]]
		word1 = s[i]
print word1, word2