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: while True:
    try:
        p = list(map(float,input().split()))
    except EOFError:
        break
    a = p[2] - p[0]
    b = p[4] - p[0]
    c = p[6] - p[0]
    d = p[3] - p[1]
    e = p[5] - p[1]
    f = p[7] - p[1]
    s = (c*e-b*f)/(a*e-b*d)
    t = (a*f-c*d)/(a*e-b*d)

    print("YES" if s>0 and s<1 and t>0 and t<1 and s+t<1 else "NO")

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:
        res_x=c/a;
        return(res_x,0)
    
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: 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 u + v <= 1.0 else 'NO')
	except EOFError:
		break

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

Python: def linecheck(x1, y1, x2, y2, xp, yp):
	if yp - y1 > (xp - x1) * (y2 - y1) / (x2 - x1):
		return 1
	elif yp - y1 < (xp - x1) * (y2 - y1) / (x2 - x1):
		return -1

while True:
	try:
		x1, y1, x2, y2, x3, y3, xp, yp = map(float, raw_input().split())

		if x1 == x2:
			if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
				judge = -1
			else:
				judge = 1
			judge *= linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
		elif x2 == x3:
			if (x1 < xp and xp < x3) or (x1 > xp and xp > x3):
				judge = -1
			else:
				judge = 1
			judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp)
		elif x3 == x1:
			if (x1 < xp and xp < x2) or (x1 > xp and xp > x2):
				judge = -1
			else:
				judge = 1
			judge *= linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)
		else:
			judge = linecheck(x1, y1, x2, y2, xp, yp) * linecheck(x1, y1, x3, y3, xp, yp) * linecheck(x2, y2, x3, y3, xp, yp)

		if judge > 0:
			print("YES")
		elif judge < 0:
			print("NO")

	except EOFError:
		break

Python: global r

def checker(x1,y1,x2,y2,xp,yp):
	vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
	if vec > 0:
		return int(1)
	elif vec < 0:
		return int(-1)

if __name__ == '__main__':
	while True:
		try:
			x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
			r = 0
			r += checker(x1,y1,x2,y2,xp,yp)
			r += checker(x2, y2, x3, y3, xp, yp)
			r += checker(x3, y3, x1, y1, xp, yp)
			if r == 3 or r == -3:
				print("YES")
			else:
				print("NO")
		except EOFError:
			break

Python: from decimal import Decimal as D
import sys

def S(P,Q,R):
    #      R
    #
    #P
    #          Q

    PQ=[Q[0]-P[0],Q[1]-P[1]]
    PR=[R[0]-P[0],R[1]-P[1]]
    s=PQ[0]*PR[1]-PQ[1]*PR[0]
    return s

while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp=[D(i) for i in input().split(" ")]
        A=[x1,y1]
        B=[x2,y2]
        C=[x3,y3]
        P=[xp,yp]

        if (S(A,B,P)>0 and S(B,C,P)>0 and S(C,A,P)>0) or (S(A,B,P)<0 and S(B,C,P)<0 and S(C,A,P)<0):
            print("YES")
        else:
            print("NO")
    except EOFError:
        sys.exit()

Python: import sys
def f(h,i,j,k):z=(j-h)*(y-k)-(k-i)*(x-j);return([-1,1][z>0],0)[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: import math


class Triangle:
    def __init__(self, x1, y1, x2, y2, x3, y3):
        self.x1 = x1
        self.x2 = x2
        self.x3 = x3
        self.y1 = y1
        self.y2 = y2
        self.y3 = y3
        self.a = math.sqrt((x1-x2) ** 2 + (y1 - y2) ** 2)
        self.b = math.sqrt((x2-x3) ** 2 + (y2 - y3) ** 2)
        self.c = math.sqrt((x1-x3) ** 2 + (y1 - y3) ** 2)

    def get_acos_a(self):
        val = (-self.a ** 2 + self.b ** 2 + self.c ** 2) / (2 * self.b * self.c)
        return math.acos(val)


while(1):

    try:
        x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, input().split()))
        t1 = Triangle(x1, y1, x2, y2, xp, yp)
        t2 = Triangle(x2, y2, x3, y3, xp, yp)
        t3 = Triangle(x3, y3, x1, y1, xp, yp)

        if 6.28318530 <= t1.get_acos_a() + t2.get_acos_a() + t3.get_acos_a() <= 6.28318531:
            print("YES")
        else:
            print("NO")

    except:
        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:(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: import sys

def crossMulti(p1, p2):
    return p1[0] * p2[1] - p1[1] * p2[0]
           
lines = sys.stdin.readlines()
for line in lines:
    Zd = []
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    Ps = [(x2-x1, y2-y1),(x3-x2, y3-y2),(x1-x3, y1-y3)]
    Px = [(xp-x1, yp-y1),(xp-x2, yp-y2),(xp-x3, yp-y3)]
    for p in range(3):
        Zd.append(crossMulti(Ps[p], Px[p]))
    Zd = [x > 0 for x in Zd]

    if (Zd[0] and Zd[1] and Zd[2]) or not(Zd[0] or Zd[1] or Zd[2]):
        print('YES')
    else:
        print('NO')

Python: import math
def lm(x,y,xa,ya,xb,yb):
    if (xb-xa)==0:return abs(x-xb)
    d=(yb-ya)/(xb-xa)
    return abs(d*xa+xa - y + d*x) / math.hypot(d,-1)
while True:
    r=input()
    if r=="":break
    x1,y1,x2,y2,x3,y3,xp,yp=[float(i) for i in r.split()]
    a=bool(lm(x1,y1,x2,y2,x3,y3)<lm(xp,yp,x2,y2,x3,y3))
    b=bool(lm(x2,y2,x1,y1,x3,y3)<lm(xp,yp,x1,y1,x3,y3))
    c=bool(lm(x3,y3,x1,y1,x2,y2)<lm(xp,yp,x1,y1,x2,y2))
    if a or b or c:
        print("NO")
    else:
        print("YES")