Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    maxInt=0
    for i in B:
        if i>M:break
        idx=bisect.bisect(B,M-i)
        if i+B[idx-1]<=M:
            maxInt=max(maxInt,i+B[idx-1])
    print maxInt

Fixed submission:
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    t=bisect.bisect(B,M)-1
    maxInt=max(i+B[bisect.bisect(B,M-i)-1] for i in B[:t])
    print maxInt

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    maxInt=0
    for i in B:
        if i>M:break
        idx=bisect.bisect(B,M-i)
        maxInt=max(maxInt,i+B[idx-1])
    print maxInt

Fixed submission:
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    t=bisect.bisect(B,M)-1
    maxInt=max(i+B[bisect.bisect(B,M-i)-1] for i in B[:t])
    print maxInt

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set()
    for i in L:
        for j in L:
            S.add(i+j)
    B=sorted(S)
    maxInt=0
    for i in B:
        if i>M:break
        idx=bisect.bisect(B,M-i)
        maxInt=max(maxInt,i+B[idx-1])
    print maxInt

Fixed submission:
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    t=bisect.bisect(B,M)-1
    maxInt=max(i+B[bisect.bisect(B,M-i)-1] for i in B[:t])
    print maxInt

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    maxInt=0
    t=bisect.bisect(B,M)-1
    for i in B[:t]:
        idx=bisect.bisect(B,M-i)
        maxInt=max(maxInt,i+B[idx-1])
    print maxInt

Fixed submission:
import bisect
while True:
    N,M=map(int,raw_input().split())
    if N==M==0:break
    L=[input() for i in range(N)]
    L.append(0)
    S=set(i+j for i in L for j in L)
    B=sorted(S)
    t=bisect.bisect(B,M)-1
    maxInt=max(i+B[bisect.bisect(B,M-i)-1] for i in B[:t])
    print maxInt
Buggy python submission (verdict: Runtime Error):
W=[input() for i in range(10)].sort()
K=[input() for i in range(10)].sort()
print sum(W[:3]),sum(K[:3])

Fixed submission:
W=sorted([input() for i in range(10)],reverse=True)
K=sorted([input() for i in range(10)],reverse=True)
print sum(W[:3]),sum(K[:3])
Buggy python submission (verdict: Time Limit Exceeded):
from copy import deepcopy
dx=[0,0,1,-1]
dy=[1,-1,0,0]

def dfs(y,x):
    global cnt
    Ice_cp[y][x]=0
    cnt+=1
    for i in range(4):
        mx=x+dx[i]
        my=y+dy[i]
        if 0<=mx<m and 0<=my<n and Ice_cp[my][mx]==1:
            dfs(my,mx)
            if Ice_cp[y][x]==0:
                return cnt
    return cnt

while True:
    m=input()
    n=input()
    if n==m==0:break
    maxInt=0
    Ice=[map(int,raw_input().split()) for i in range(n)]
    for i in range(n):
        for j in range(m):
            cnt=0
            Ice_cp=deepcopy(Ice)
            if Ice_cp[i][j]==1:
                maxInt=max(maxInt,dfs(i,j))
    print maxInt

Fixed submission:
dx=[0,0,1,-1]
dy=[1,-1,0,0]

def dfs(y,x,cnt):
    global maxInt
    maxInt=max(maxInt,cnt)
    Ice[y][x]=0
    for i in range(4):
        mx=x+dx[i]
        my=y+dy[i]
        if mx<0 or m<=mx or my<0 or n<=my:
            continue
        if Ice[my][mx]==1:
            dfs(my,mx,cnt+1)
            Ice[my][mx]=1

while True:
    m=input()
    n=input()
    if n==m==0:break
    maxInt=0
    Ice=[map(int,raw_input().split()) for i in range(n)]
    for y in range(n):
        for x in range(m):
            if Ice[y][x]==1:
                dfs(y,x,1)
                Ice[y][x]=1
    print maxInt

Buggy python submission (verdict: Time Limit Exceeded):
from copy import deepcopy
dx=[0,0,1,-1]
dy=[1,-1,0,0]

def dfs(y,x,cnt):
    Ice_cp[y][x]=0
    cnt+=1
    for i in range(4):
        mx=x+dx[i]
        my=y+dy[i]
        if 0<=mx<m and 0<=my<n and Ice_cp[my][mx]==1:
            return dfs(my,mx,cnt)
    return cnt

while True:
    m=input()
    n=input()
    if n==m==0:break
    maxInt=0
    Ice=[map(int,raw_input().split()) for i in range(n)]
    for i in range(n):
        for j in range(m):
            cnt=0
            Ice_cp=deepcopy(Ice)
            if Ice_cp[i][j]==1:
                maxInt=max(maxInt,dfs(i,j,cnt))
    print maxInt

Fixed submission:
dx=[0,0,1,-1]
dy=[1,-1,0,0]

def dfs(y,x,cnt):
    global maxInt
    maxInt=max(maxInt,cnt)
    Ice[y][x]=0
    for i in range(4):
        mx=x+dx[i]
        my=y+dy[i]
        if mx<0 or m<=mx or my<0 or n<=my:
            continue
        if Ice[my][mx]==1:
            dfs(my,mx,cnt+1)
            Ice[my][mx]=1

while True:
    m=input()
    n=input()
    if n==m==0:break
    maxInt=0
    Ice=[map(int,raw_input().split()) for i in range(n)]
    for y in range(n):
        for x in range(m):
            if Ice[y][x]==1:
                dfs(y,x,1)
                Ice[y][x]=1
    print maxInt
Buggy python submission (verdict: Runtime Error):
import itertools
while True:
    n=input()
    k=input()
    if n==k==0:break
    L=[raw_input() for i in range(n)]
    S=set()
    for t in itertools.permutations(L,k):
        S.add("".join(t))
    print len(S)

Fixed submission:
import itertools
while True:
    n=raw_input()
    if n=="0 0":break
    else:
        k=input()
    if k==0:break
    L=[raw_input() for i in range(int(n))]
    S=set()
    for t in itertools.permutations(L,k):
        S.add("".join(t))
    print len(S)

Buggy python submission (verdict: Runtime Error):
import itertools
while True:
    n=raw_input()
    if n in "0":break
    try:
        k=input()
    except SyntaxError:
        break
    L=[raw_input() for i in range(int(n))]
    S=set()
    for t in itertools.permutations(L,k):
        S.add("".join(t))
    print len(S)

Fixed submission:
import itertools
while True:
    n=raw_input()
    if n=="0 0":break
    else:
        k=input()
    if k==0:break
    L=[raw_input() for i in range(int(n))]
    S=set()
    for t in itertools.permutations(L,k):
        S.add("".join(t))
    print len(S)
Buggy python submission (verdict: Runtime Error):
N=input()
L=[[0]*N for i in range(N)]
R,B,Y=1,2,3
C=R
for y in range(N/2+1):
    for x in range(y,N-y):
        L[y][x]=C
        L[N-y-1][x]=C
    C=C%3+1
C=R
for x in range(N/2+1):
    for y in range(x,N-x):
        L[y][x]=C
        L[y][N-x-1]=C
    C=C%3+1

for i in range(input()):
    a,b=map(int,raw_input().split())
    print L[b-1][a-1]

Fixed submission:
N=input()
for i in range(input()):
    a,b=map(int,raw_input().split())
    print min(a-1,N-a,b-1,N-b)%3+1
Buggy python submission (verdict: Runtime Error):
n = input()
s = map(int, raw_input().split())
ans = s[-1]
dp = [[0] * 21 for i in range(n)]
dp[0][s[0]] = 1
for i in range(1, n-1):
    for j in range(21):
        if dp[i-1][j] == 0: continue
        vp = j + s[i]
        vm = j - s[i]
        if vp <= 20:
            dp[i][vp] += dp[i-1][j]
        if 0 <= vm:
            dp[i][vm] += dp[i-1][j]
print dp[n-2][ans

Fixed submission:
n = input()
s = map(int, raw_input().split())
ans = s[-1]
dp = [[0] * 21 for i in range(n)]
dp[0][s[0]] = 1
for i in range(1, n-1):
    for j in range(21):
        if dp[i-1][j] == 0: continue
        vp = j + s[i]
        vm = j - s[i]
        if vp <= 20:
            dp[i][vp] += dp[i-1][j]
        if 0 <= vm:
            dp[i][vm] += dp[i-1][j]
print dp[n-2][ans]
Buggy python submission (verdict: Runtime Error):
S=raw_input()
N=len(S)
for k in range(N/3,0,-1):
    s="J"*k+"O"*k+"I"*k
    if S.count(s)>0:
        print k
        break
else:
    print 0

Fixed submission:
S=raw_input()
N=len(S)
i,k=0,0
while i<N:
    L=[0]*3
    s="JOI"
    for j in range(len(s)):
        while i<N and S[i]==s[j]:
            L[j]+=1
            i+=1
    if L[0]>=L[1] and L[2]>=L[1]:
        k=max(L[1],k)
print k
Buggy python submission (verdict: Runtime Error):
def permutations(iterable, r=None):
    pool = tuple(iterable)
    n = len(pool)
    r = n if r is None else r
    if r > n:
        return
    indices = range(n)
    cycles = range(n, n-r, -1)
    yield tuple(pool[i] for i in indices[:r])
    while n:
        for i in reversed(range(r)):
            cycles[i] -= 1
            if cycles[i] == 0:
                indices[i:] = indices[i+1:] + indices[i:i+1]
                cycles[i] = n - i
            else:
                j = cycles[i]
                indices[i], indices[-j] = indices[-j], indices[i]
                yield tuple(pool[i] for i in indices[:r])
                break
        else:
            return


L=[input() for i in range(input())]
S=[]
for i in permutations(L,2):
    S.append(int("".join(map(str,i))))
print sorted(S)[2]

Fixed submission:
n = input()
h = sorted(input() for i in range(n))[:4]
h = map(str, h)
ans = []
for i in range(3):
    for j in range(i+1, 4):
        ans.append(int(h[i]+h[j]))
        ans.append(int(h[j]+h[i]))
print sorted(ans)[2]

Buggy python submission (verdict: Runtime Error):
def permutations(iterable, r=None):
    pool = tuple(iterable)
    n = len(pool)
    r = n if r is None else r
    if r > n:
        return
    indices = range(n)
    cycles = range(n, n-r, -1)
    yield tuple(pool[i] for i in indices[:r])
    while n:
        for i in reversed(range(r)):
            cycles[i] -= 1
            if cycles[i] == 0:
                indices[i:] = indices[i+1:] + indices[i:i+1]
                cycles[i] = n - i
            else:
                j = cycles[i]
                indices[i], indices[-j] = indices[-j], indices[i]
                yield tuple(pool[i] for i in indices[:r])
                break
        else:
            return


L=[input() for i in range(input())]
S=[1000000000,1000000000,1000000000]
for i in permutations(L,2):
    S.append(int("".join(map(str,i))))
    S=sorted(S)[:3]
print S[2]

Fixed submission:
n = input()
h = sorted(input() for i in range(n))[:4]
h = map(str, h)
ans = []
for i in range(3):
    for j in range(i+1, 4):
        ans.append(int(h[i]+h[j]))
        ans.append(int(h[j]+h[i]))
print sorted(ans)[2]

Buggy python submission (verdict: Runtime Error):
import itertools
L=[input() for i in range(input())]
S=[1000000000,1000000000,1000000000]
for i in itertools.permutations(L,2):
    S.append(int("".join(map(str,i))))
    S=sorted(S)[:3]
print S[2]

Fixed submission:
n = input()
h = sorted(input() for i in range(n))[:4]
h = map(str, h)
ans = []
for i in range(3):
    for j in range(i+1, 4):
        ans.append(int(h[i]+h[j]))
        ans.append(int(h[j]+h[i]))
print sorted(ans)[2]
Buggy python submission (verdict: Runtime Error):
while True:
    n=input()
    if n==0:break
    A=map(int,raw_input().split())
    S=set(A)
    for c in S:
        if A.count(c)>n/2:
            print c
            break
    else:
        print "NO COLOR"

Fixed submission:
while True:
    n=input()
    if n==0:break
    A=map(int,raw_input().split())
    A.sort()
    cnt=0
    pre=A[0]
    for c in A:
        if c==pre:
            cnt+=1
            if cnt>n/2:
                print c
                break
        else:
            cnt=1
            pre=c
    else:
        print "NO COLOR"
Buggy python submission (verdict: Runtime Error):
while True:
    name,typ=raw_input().split()
    if name=="EndOfInput" and typ=="X":break
    L=[]
    if "_" in name:
        L=name.split("_")
    elif  name[0].islower():
        temp=""
        for ch in name:
            if ch.islower():
                temp+=ch
            else:
                L.append(temp)
                temp=""
                temp+=ch
        L.append(temp)
    else:
        temp=name[0]
        for ch in name[1:]:
            if ch.islower():
                temp+=ch
            else:
                L.append(temp)
                temp=""
                temp+=ch
        L.append(temp)

    if typ=="D":
        print "_".join(map(lambda s:s.lower(),L))
    elif typ=="U":
        print "".join(map(lambda s:s.capitalize(),L))
    else:
        print L[1]+"".join(map(lambda s:s.capitalize(),L[1:]))

Fixed submission:
import re
while True:
    name,typ=raw_input().split()
    if name=="EndOfInput" and typ=="X":break
    if "_" in name:
        L=name.split("_")
    else:
        L=re.findall("[A-Z][a-z]*",name[0].upper()+name[1:])

    if typ=="D":
        print "_".join(map(lambda s:s.lower(),L))
    elif typ=="U":
        print "".join(map(lambda s:s.capitalize(),L))
    else:
        print L[0].lower()+"".join(map(lambda s:s.capitalize(),L[1:]))
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    n,a,b=map(int,raw_input().split())
    if n==a==b==0:break
    L=[False]*(n+1)
    for i in range(n/a+1):
        for j in range(n/b+1):
            t=i*a+j*b
            if t<=n:
                L[t]=True
    print L.count(False)

Fixed submission:
while True:
    n,a,b=map(int,raw_input().split())
    if n==a==b==0:break
    L=[True]*(n+1)
    for i in range(a):
        x=b*i
        if x>n:break
        while x<=n:
            L[x]=False
            x+=a
    print L.count(True)

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    n,a,b=map(int,raw_input().split())
    if n==a==b==0:break
    count=n
    for i in range(1,n+1):
        x=i
        while x>=0:
            if x%a==0:
                count-=1
                break
            x-=b
    print count

Fixed submission:
while True:
    n,a,b=map(int,raw_input().split())
    if n==a==b==0:break
    L=[True]*(n+1)
    for i in range(a):
        x=b*i
        if x>n:break
        while x<=n:
            L[x]=False
            x+=a
    print L.count(True)
Buggy python submission (verdict: Time Limit Exceeded):
while True:
    z=input()
    if z==0:break
    z3=pow(z,3)
    maxInt=0
    for x in range(1,z):
        x3=pow(x,3)
        for y in range(1,z):
            y3=pow(y,3)
            if x3+y3<=z3:
                maxInt=max(maxInt,x3+y3)
    print z3-maxInt

Fixed submission:
from bisect import bisect
L=[0]*1112
y=[pow(i,3) for i in range(1,1111)]
for z in range(1,1112):
    z3=pow(z,3)
    maxInt=0
    for x in range(1,z):
        x3=pow(x,3)
        diff=z3-x3
        y3=y[bisect(y,diff)-1]
        maxInt=max(maxInt,x3+y3)
    L[z]=z3-maxInt
while True:
    z=input()
    if z==0:break
    print L[z]
Buggy python submission (verdict: Runtime Error):
while True:
    N,Q=map(int,raw_input().split())
    if N==Q==0:break
    T=[0]*51
    for i in range(N):
        L=map(int,raw_input().split())
        for j in L[1:]:
            T[j]+=1
    m=max(T)
    print 0 if m<Q else T.index(m)

Fixed submission:
while True:
    N,Q=map(int,raw_input().split())
    if N==Q==0:break
    T=[0]*101
    for i in range(N):
        L=map(int,raw_input().split())
        for j in L[1:]:
            T[j]+=1
    m=max(T)
    print 0 if m<Q else T.index(m)
Buggy python submission (verdict: Time Limit Exceeded):
mv=((1,0),(0,1))

def dfs(x,y,ans):
    global res
    ans=max(ans,int(str(ans)+C[y][x]))
    res=max(ans,res)
    for dx,dy in mv:
        mx=x+dx
        my=y+dy
        if mx<0 or mx>=W or my<0 or my>=H:
            continue
        if C[my][mx].isdigit():
            dfs(mx,my,ans)

while True:
    W,H=map(int,raw_input().split())
    if W==H==0:break
    C=[raw_input() for i in range(H)]
    res=0
    for i in range(H):
        for j in range(W):
            if C[i][j].isdigit() and C[i][j]!="0":
                dfs(j,i,0)
    print res

Fixed submission:
while True:
    W,H=map(int,raw_input().split())
    if W==H==0:break
    C=[raw_input() for i in range(H)]
    table=[[""]*W for i in range(H)]
    ans=0
    for y in range(H):
        for x in range(W):
            if C[y][x].isdigit():
                a,b,c=table[y-1][x],table[y][x-1],C[y][x]
                if a==b=="":
                    table[y][x]=c
                elif a=="":
                    table[y][x]=b+c
                elif b=="":
                    table[y][x]=a+c
                elif int(a)>=int(b):
                    table[y][x]=a+c
                elif int(a)<int(b):
                    table[y][x]=b+c
                ans=ans if ans>int(table[y][x]) else int(table[y][x])
    print ans
Buggy python submission (verdict: Runtime Error):
import math
def prodR(s,a,c,N):
    R=[s]
    for i in range(1,N+1):
        R.append((a*R[i-1]+c)%256)
    return R[1:]

def entropy(R,I,N):
    O=[(I[i]+R[i])%256 for i in range(N)]
    L=[0]*256
    for i in O:
        L[i]+=1
    H=-sum(float(L[i])/N*math.log(float(L[i])/N,2) for i in range(256) if L[i]!\
=0)
    return H

while True:
    N=input()
    if N==0:break
    I=map(int,raw_input().split())
    maxInt=1e10
    for s in range(16):
        for a in range(16):
            for c in range(16):
                R=prodR(s,a,c,N)
                H=entropy(R,I,N)
                if maxInt>H:
                    maxInt=H
                    ans=s,a,c
    print "%d %d %d"%(ans[0],ans[1],ans[2])

Fixed submission:
import math
def prodR(s,a,c,N):
    R=[s]
    for i in range(1,N+1):
        R.append((a*R[i-1]+c)%256)
    return R[1:]

def entropy(R,I,N):
    O=[(I[i]+R[i])%256 for i in range(N)]
    L=[0]*256
    for i in O:
        L[i]+=1
    H=-sum(float(L[i])/N*math.log(float(L[i])/N,2) for i in range(256) if L[i]!=0)
    return H

while True:
    N=input()
    if N==0:break
    I=map(int,raw_input().split())
    maxInt=1e10
    for s in range(16):
        for a in range(16):
            for c in range(16):
                R=prodR(s,a,c,N)
                H=entropy(R,I,N)
                if maxInt>H:
                    maxInt=H
                    ans=s,a,c
    print "%d %d %d"%(ans[0],ans[1],ans[2])
Buggy python submission (verdict: Runtime Error):
import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxInt=0
for comb in itertools.permutations(range(N),M):
    dist=0
    for i in range(M-1):
        for j in range(i+1,M):
            t=comb[i]
            s=comb[j]
            dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
    maxInt=max(maxInt,dist)
print maxInt

Fixed submission:
import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxV=0.0
for comb in itertools.combinations(range(N),M):
    dist=0.0
    for i in range(M-1):
        for j in range(i+1,M):
            t=comb[i]
            s=comb[j]
            dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
    maxV=max(maxV,dist)
print maxV

Buggy python submission (verdict: Runtime Error):
import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxV=0.0
for comb in itertools.permutations(range(N),M):
    dist=0.0
    for i in range(M-1):
        for j in range(i+1,M):
            t=comb[i]
            s=comb[j]
            dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
    maxV=max(maxV,dist)
print maxV

Fixed submission:
import itertools
N,M=map(int,raw_input().split())
data=[map(float,raw_input().split()) for i in range(N)]
maxV=0.0
for comb in itertools.combinations(range(N),M):
    dist=0.0
    for i in range(M-1):
        for j in range(i+1,M):
            t=comb[i]
            s=comb[j]
            dist+=pow(data[t][0]-data[s][0],2)+pow(data[t][1]-data[s][1],2)+pow\
(data[t][2]-data[s][2],2)
    maxV=max(maxV,dist)
print maxV
Buggy python submission (verdict: Runtime Error):
N,M=map(int,raw_input().split())
L=[input() for i in range(N)]
for i in range(M):
    print L[N-i-1]

Fixed submission:
N,M=map(int,raw_input().split())
L=[input() for i in range(N)]
S=set()
cnt=0
for i in range(N):
    if L[N-i-1] not in S:
        print L[N-i-1]
        S.add(L[N-i-1])
        cnt+=1
    if cnt==M:
        break
Buggy python submission (verdict: Runtime Error):
data = raw_input().split(' ')
data = sorted(map(int, data))[::-1]
print ' '.join(data)

Fixed submission:
data = raw_input().split(' ')
data = map(str, sorted(map(int, data))[::-1])
print ' '.join(data)
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
for i in range(n):
    x0, y0, x1, y1, x2, y2, x3, y3 = raw_input().split()
    if float(y1-y0)/(x1-x0) == float(y3-y2)/(x3-x2):
        print 'YES'
    else:
        print 'NO'    

Fixed submission:
n = int(raw_input())
for i in range(n):
    x0, y0, x1, y1, x2, y2, x3, y3 = map(float, raw_input().split(' '))
    if x0==x1 or x2==x3:
        if x0==x1 and x2==x3:
            print 'YES'
        else:
            print 'NO'
    elif abs(float(y1-y0)/(x1-x0) - float(y3-y2)/(x3-x2)) < 1e-10:
        print 'YES'
    else:
        print 'NO'

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
for i in range(n):
    x0, y0, x1, y1, x2, y2, x3, y3 = map(float, raw_input().split())
    if float(y1-y0)/(x1-x0) == float(y3-y2)/(x3-x2):
        print 'YES'
    else:
        print 'NO'    

Fixed submission:
n = int(raw_input())
for i in range(n):
    x0, y0, x1, y1, x2, y2, x3, y3 = map(float, raw_input().split(' '))
    if x0==x1 or x2==x3:
        if x0==x1 and x2==x3:
            print 'YES'
        else:
            print 'NO'
    elif abs(float(y1-y0)/(x1-x0) - float(y3-y2)/(x3-x2)) < 1e-10:
        print 'YES'
    else:
        print 'NO'

Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
for i in range(n):
    x0, y0, x1, y1, x2, y2, x3, y3 = map(float, raw_input().split(' '))
    if float(y1-y0)/(x1-x0) == float(y3-y2)/(x3-x2):
        print 'YES'
    else:
        print 'NO'    

Fixed submission:
n = int(raw_input())
for i in range(n):
    x0, y0, x1, y1, x2, y2, x3, y3 = map(float, raw_input().split(' '))
    if x0==x1 or x2==x3:
        if x0==x1 and x2==x3:
            print 'YES'
        else:
            print 'NO'
    elif abs(float(y1-y0)/(x1-x0) - float(y3-y2)/(x3-x2)) < 1e-10:
        print 'YES'
    else:
        print 'NO'
Buggy python submission (verdict: Runtime Error):
while 1:
    n = int(raw_input())
    max = 0
    for i in range(n):
        tmax = max + int(raw_input())
        if tmax > max:
            max = tmax
    print tmax

Fixed submission:
while(1):
    N = int(input())
    if N==0: break
    sums = []
    nums = []
    s = 0
    for i in range(N):
        n = int(input())
        nums.append(n)
        s += n
        if s<0: s=0
        sums.append(s)
    if max(nums) >= 0:
        print(max(sums))
    else:
        print(max(nums))
Buggy python submission (verdict: Runtime Error):
import math
n = int(raw_input())

for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' '))
    d = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if d+rb <= ra:
        print 2
    elif: d+ra <= rb:
        print -2
    elif: d > ra+rb:
        print 0
    else:
        print 1
    

Fixed submission:
import math
n = int(raw_input())

for i in range(n):
    xa, ya, ra, xb, yb, rb = map(float, raw_input().split(' '))
    d = math.sqrt((xa-xb)**2 + (ya-yb)**2)
    if d+rb < ra:
        print 2
    elif d+ra < rb:
        print -2
    elif d > ra+rb:
        print 0
    else:
        print 1