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 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:(a1*b1+a2*b2)/((a1**2+a2**2)**0.5*(b1**2+b2**2)**0.5)
        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: if __name__ == '__main__':
	while True:
		try:
			x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
			r = 0
			vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
			if vec > 0:
				r += 1
			elif vec < 0:
				r -= 1
			vec = (x3 - x2) * (yp - y2) - (y3 - y2) * (xp - x2)
			if vec > 0:
				r += 1
			elif vec < 0:
				r -= 1
			vec = (x1 - x3) * (yp - y3) - (y1 - y3) * (xp - x3)
			if vec > 0:
				r += 1
			elif vec < 0:
				r -= 1
			if r == 3 or r == -3:
				print("YES")
			else:
				print("NO")
		except EOFError:
			break

Python: import numpy

while True:
    try:
        x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
        s1 = (x2-x1)*(yp-y1) - (y2-y1)*(xp-x1)
        s2 = (x3-x2)*(yp-y2) - (y3-y2)*(xp-x2)
        s3 = (x1-x3)*(yp-y3) - (y1-y3)*(xp-x3)
        if numpy.sign(s1) == numpy.sign(s2) and numpy.sign(s1) == numpy.sign(s3):
            print("YES")
        else:
            print("NO")
    except:
        break

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

import sys
import math

def norm(x1,y1,x2,y2):
    r = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
    return r

def judge(x1,y1,x2,y2,x3,y3,xp,yp):
    r1 = norm(x1,y1,x2,y2)
    r2 = norm(x2,y2,x3,y3)
    r3 = norm(x3,y3,x1,y1)

    d1 = norm(xp,yp,x1,y1)
    d2 = norm(xp,yp,x2,y2)
    d3 = norm(xp,yp,x3,y3)

    if d1 > r1 or d1 > r3:
        print('NO')
    elif d2 > r1 or d2 > r2:
        print('NO')
    elif d3 > r3 or d3 > r2:
        print('NO')
    else:
        print('YES')

array = []
for i in sys.stdin:
    array.append(i)

for i in range(len(array)):
    tmp = array[i]
    x1,y1,x2,y2,x3,y3,xp,yp = map(float,tmp.split(' '))
    judge(x1,y1,x2,y2,x3,y3,xp,yp)

Python: import sys


def outer(vec_a, vec_b):
    return vec_a[0] * vec_b[1] - vec_a[1] * vec_b[0]

try:
    while True:
        x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
        vec_12 = [x2-x1, y2-y1]
        vec_23 = [x3-x2, y3-y2]
        vec_31 = [x1-x3, y1-y3]
        vec_1p = [xp-x1, yp-y1]
        vec_2p = [xp-x2, yp-y2]
        vec_3p = [xp-x3, yp-y3]
        if (outer(vec_12, vec_1p) > 0 and
                outer(vec_23, vec_2p) > 0 and
                outer(vec_31, vec_3p) > 0):
            print('YES')
        else:
            print('NO')

except:
    sys.exit()

Python: g=lambda a,b:a[0]*b[1]-a[1]*b[0]

while True:
    try:l=[float(i) for i in input().split()]
    except:break
    ba=[l[0]-l[2],l[1]-l[3]]
    ab=[-i for i in ba]
    cb=[l[2]-l[4],l[3]-l[5]]
    bc=[-i for i in cb]
    ca=[l[0]-l[4],l[1]-l[5]]
    ac=[-i for i in ca]
    ap=[l[6]-l[0],l[7]-l[1]]
    bp=[l[6]-l[2],l[7]-l[3]]
    cp=[l[6]-l[4],l[7]-l[5]]
    if g(ab,ac)<g(ab,ap) or g(ba,bc)<g(ba,bp):
        print("NO")
    else:
        print("YES")

Python: import math
while True:
    try:
        x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
    except:
        break
    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))
    s = lambda a1, a2, b1, b2: abs(a1 * b2 - a2 * b1)
    if abs(sum(s(x[i], y[i], x[i + 1], y[i + 1]) for i in range(3)) - s(x[1] - x[0], y[1] - y[0], x[2] - x[0], y[2] - y[0])) < 1e-5:
        print('YES')
    else:
        print('NO')

Python: def Cramer(a11, a12, a13, a21, a22, a23):
	den = a11 * a22 - a12 * a21
	return (a13 * a22 - a12 * a23) / den, (a11 * a23 - a13 * a21) / den

while True:
	try:
		x1, y1, x2, y2, x3, y3, xp, yp = [eval(item) for item in input().split()]
		u, v = Cramer(x3 - x1, x2 - x1, xp - x1, y3 - y1, y2 - y1, yp - y1)
		print('YES' if u >= 0.0 and v >= 0.0 and abs(u + v - 1.0) < 1e10 else 'NO')
	except EOFError:
		break

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

Python: if __name__ == '__main__':
    while True:
        try:
            x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
            ab = [x2-x1, y2-y1]
            bp = [xp-x2, yp-y2]
            bc = [x3-x2, y3-y2]
            cp = [xp-x3, yp-y3]
            ca = [x1-x3, y1-y3]
            ap = [xp-x1, yp-y1]
            c1 = ab[0]*bp[1] - ab[1]*bp[0]
            c2 = bc[0]*cp[1] - bc[1]*cp[0]
            c3 = ca[0]*ap[1] - ca[1]*ap[0]
            if (c1 > 0 and c2 > 0 and c3 > 0) or (c1 < 0 and c2 < 0 and c3 < 0):
                print("YES")
            else:
                print("NO")
        except EOFError:
            break

Python: 
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 sys

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

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

class Line(object):
    def __init__(self, p1, p2):
        self.p1 = p1
        self.p2 = p2
        self.epsilon = 1e-8

    def is_over(self, p):
        if abs(self.p2.x - self.p1.x) < self.epsilon:
            return self.p1.x > p.x
        elif abs(self.p2.y - self.p1.y) < self.epsilon:
            return self.p1.y > p.y
        else:
            a = (self.p2.y - self.p1.y) / (self.p2.x - self.p1.x)
            b = self.p1.y
            y = a * (p.x - self.p1.x) + b
            return y > p.y

def run():
    for i in sys.stdin:
        x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, i.split()))
        p1, p2, p3, p = P(x1, y1), P(x2, y2), P(x3, y3), P(xp, yp)
        l_12 = Line(p1, p2)
        l_23 = Line(p2, p3)
        l_31 = Line(p3, p1)

        res = l_12.is_over(p3) == l_12.is_over(p)
        res &= l_23.is_over(p1) == l_23.is_over(p)
        res &= l_31.is_over(p2) == l_31.is_over(p)

        if res:
            print('YES')
        else:
            print('NO')

if __name__ == '__main__':
    run()