Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

Python: import sys

def cross_product(a, b):
    ax, ay = a
    bx, by = b
    return ax * by - ay * bx


def sub(a, b):
    a1, a2 = a
    b1, b2 = b
    return b1 - a1, b2 - a2


def judge(p1, p2, p3, pp):

    cnt = 0
    for a, b in ((p1, p2), (p2, p3), (p3, p1)):
        vec1 = sub(a, b)
        vec2 = sub(a, pp)
        if cross_product(vec2, vec1) > 0:
            cnt += 1
    if cnt == 0 or cnt == 3:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    for line in sys.stdin:
        inputs = [float(s) for s in line.split()]
        p1 = (inputs.pop(0), inputs.pop(0))
        p2 = (inputs.pop(0), inputs.pop(0))
        p3 = (inputs.pop(0), inputs.pop(0))
        pp = (inputs.pop(0), inputs.pop(0))
        judge(p1, p2, p3, pp)

Python: out=[]
while True:
	try:
		k=list(map(float,input().split(" ")))
	except:
		break

	O_x,O_y=k[0],k[1]
	A_x,A_y=k[2],k[3]
	B_x,B_y=k[4],k[5]
	P_x,P_y=k[6],k[7]

# P in triangle OAB
# iff  s+t<1 and s>0 and t>0 (OP=sOA+tOB)

	OA=(A_x-O_x,A_y-O_y)
	OB=(B_x-O_x,B_y-O_y)
	OP=(P_x-O_x,P_y-O_y)

	keisuu=1/( OA[0]*OB[1] - OA[1]*OB[0] )

	s=keisuu*(  OB[1]*OP[0]-OB[0]*OP[1] )
	t=keisuu*( -OA[1]*OP[0]+OA[0]*OP[1] )

	if s>0 and t>0 and s+t>0:
		out.append("YES")
	else:
		out.append("NO")

for i in out:
	print(i)

Python: out=[]
while True:
	try:
		k=list(map(float,input().split(" ")))
	except:
		break

	O_x,O_y=k[0],k[1]
	A_x,A_y=k[2],k[3]
	B_x,B_y=k[4],k[5]
	P_x,P_y=k[6],k[7]

# P in triangle OAB
# iff  s+t<1 and s>0 and t>0 (OP=sOA+tOB)

	OA=(A_x-O_x,A_y-O_y)
	OB=(B_x-O_x,B_y-O_y)
	OP=(P_x-O_x,P_y-O_y)

	keisuu=1/( OA[0]*OB[1] - OA[1]*OB[0] )

	s=keisuu*(  OB[1]*OP[0]-OB[0]*OP[1] )
	t=keisuu*( -OA[1]*OP[0]+OA[0]*OP[1] )

	if s>0 and t>0 and s+t<1:
		out.append("YES")
	else:
		out.append("NO")

for i in out:
	print(i)

Python: import sys
def f(a,b,c,d):z=(c-a)*(y-d)-(d-b)*(x-c);return[-1*(z==0),1][z>0]
for e in sys.stdin:
 p,q,r,s,t,u,x,y=map(float,e.split())
 print(['NO','YES'][f(p,q,r,s)==f(r,s,t,u)==f(t,u,p,q)])

Python: def f(x):
    x1, y1, x2, y2, x3, y3, xp, yp = x
    ax = x3 - x1
    ay = y3 - y1
    bx = x2 - x1
    by = y2 - y1
    k = (by * xp - bx * yp) / (ax * by - ay * bx)
    l = (ay * xp - ax * yp) / (ay * bx - ax * by)
    if (k > 0 and l > 0 and k + l < 1):
        print('YES')
    else:
        print('NO')
while True:
    try:
        point = list(map(float, input().split()))
        f(point)
    except EOFError:
        break

Python: E = 10**-10

def cp(a, b):
    c = [a[1]*b[2] - a[2]*b[1],
        a[2]*b[0] - a[0]*b[2],
        a[0]*b[1] - a[1]*b[0]]
    return c

while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp = [float(i) for i in input().split()]
        ax = x3-x1
        ay = y3-y1
        bx = x1-x2
        by = y1-y2
        cx = x2-x3
        cy = y2-y3
        pax = xp-x1
        pay = yp-y1
        pbx = xp-x2
        pby = yp-y2
        pcx = xp-x3
        pcy = yp-y3
        ca = [bx,by,0]
        ab = [cx,cy,0]
        bc = [ax,ay,0]
        pa = [pax,pay,0]
        pb = [pbx,pby,0]
        pc = [pcx,pcy,0]
        cp1 = cp(ca,pa)[2]
        cp2 = cp(ab,pb)[2]
        cp3 = cp(bc,pc)[2]
        if abs(cp1 - abs(cp1)) < E:
            sig1 = 1
        elif abs(cp1 + abs(cp1)) < E:
            sig1 = -1
        if abs(cp2 - abs(cp2)) < E:
            sig2 = 1
        elif abs(cp2 + abs(cp2)) < E:
            sig2 = -1
        if abs(cp3 - abs(cp3)) < E:
            sig3 = 1
        elif abs(cp3 + abs(cp3)) < E:
            sig3 = -1
        if abs(sig1 + sig2 + sig3) == 3:
            print('YES')
        else:
            print('NO')
    except EOFError:
        break

Python: import sys
for e in sys.stdin:
 p,q,r,s,t,u,x,y=map(float,e.split())
 a=((x-p)*(u-q)-(y-q)*(t-p))/((r-p)*(u-q)-(s-q)*(t-p))
 b=(x-p-a*(r-p))/(t-p)
 print(['NO','YES'][0<a<1-b and 0<b<1-a])

Python: # -*- coding: utf-8 -*-

import sys
import os
import math

def cross(a, b):
    ax = a[0]
    ay = a[1]
    bx = b[0]
    by = b[1]
    return ax * by - ay * bx


for s in sys.stdin:
    s = s.strip()
    ax, ay, bx, by, cx, cy, px, py = map(float, s.split())
    # point A, B, C, P
    AP = (px - ax, py - ay)
    BP = (px - bx, py - by)
    CP = (px - cx, py - cy)

    BA = (ax - bx, ay - by)
    AC = (cx - ax, cy - ay)
    CB = (bx - cx, by - cy)

    v0 = cross(BP, BA)
    v1 = cross(CP, CB)
    v2 = cross(AP, AC)

    if v0 > 0 and v1 > 0 and v2 > 0:
        print('YES')
    elif v0 < 0 and v1 < 0 and v2 < 0:
        print('YES')
    else:
        print('NO')

Python: import sys
for e in sys.stdin:
 p,q,r,s,t,u,x,y=map(float,e.split())
 f=lambda h,i,j,k:(h-p)*(i-q)-(j-q)*(k-p)
 a,b=f(x,u,y,t)/f(r,u,s,t),f(x,s,y,r)/f(t,s,u,r)
 print(['NO','YES'][0<a<1-b and 0<b<1-a])

Python: def gai(a,b,c,d):
    S = a*d - b*c
    return(S)
while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp  = map(float,input().split())
        if gai(x1 - x2,y1 - y2,x1 - xp,y1 - yp) < 0 and gai(x2 - x3,y2 - y3,x2 - xp,y2 - yp) < 0 and gai(x3 - x1,y3 - y1,x3 - xp,y3 - yp) < 0:
            print("YES")
        elif gai(x1 - x2,y1 - y2,x1 - xp,y1 - yp) > 0 and gai(x2 - x3,y2 - y3,x2 - xp,y2 - yp) > 0 and gai(x3 - x1,y3 - y1,x3 - xp,y3 - yp) > 0:
            print("YES")
        else:
            print("NO")
    except EOFError:
        break

Python: import math
while True:
    try:
        x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
        x = [x1, x3, x3, x1]
        y = [y1, y2, y3, y1]
        x = list(map(lambda x:x-xp, x))
        y = list(map(lambda y:y-yp, y))
        cos = lambda a1,a2,b1,b2:max(min((a1*b1+a2*b2)/((a1**2+a2**2)**0.5*(b1**2+b2**2)**0.5),1),-1)
        if sum(math.acos(cos(x[i], y[i], x[i+1], y[i+1])) for i in range(3)) < 2 * math.pi:
            print('NO')
        else:
            print('YES')
    except:
        break

Python: while(True):

    x1,y1,x2,y2,x3,y3,xp,yp=[float(p) for p in input().split()]

    x_vector_1to2=x2-x1;
    y_vector_1to2=y2-y1;
    x_vector_1to3=x3-x1;
    y_vector_1to3=y3-y1;
    x_vector_p=xp-x1;
    y_vector_p=yp-y1;

    def renritu(p,q,r,s,t,u):  # renritu(p,q,r,s,t,u) px + qy = r  sx+ty=u
        a=p; b=q; c=r; d=s; e=t; f=u;
        a1=a*d; b1=b*d; c1=c*d; d1=d*a; e1=e*a; f1=f*a;
        res_y=b1-e1;
        if res_y != 0 :
            res_y =(c1-f1)/res_y;
            res_x =(c-b*res_y)/a;
            return(res_x,res_y)
        else:
            return(-1,-1)

    res=renritu(x_vector_1to2,x_vector_1to3,x_vector_p,y_vector_1to2,y_vector_1to3,y_vector_p)
    if res[0] >0 and res[1] >0 and (res[0]+res[1])<1:
        print("YES")
    else:
        print("NO")

Python: import math
while True:
    try:
        x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
        x = [x1, x3, x3, x1]
        y = [y1, y2, y3, y1]
        x = list(map(lambda x:x-xp, x))
        y = list(map(lambda y:y-yp, y))
        cos = lambda a1,a2,b1,b2:max(min((a1*b1+a2*b2)/((a1**2+a2**2)**0.5*(b1**2+b2**2)**0.5),1),-1)
        if sum(math.acos(cos(x[i], y[i], x[i+1], y[i+1])) for i in range(3)) < 2 * math.pi - 1e-6:
            print('NO')
        else:
            print('YES')
    except:
        break