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

def tri(x1, y1, x2, y2, x3, y3):
    return math.fabs((x2-x1)*(y3-y1) - (y2-y1)*(x3-x1)) / 2

while True:
    try:
        x1, y1, x2, y2, x3, y3, xp, yp = map(float, input().split())
    except:
        break
    abc = tri(x1, y1, x2, y2, x3, y3)
    abp = tri(x1, y1, x2, y2, xp, yp)
    acp = tri(x1, y1, x3, y3, xp, yp)
    bcp = tri(x2, y2, x3, y3, xp, yp)
    print("YES" if abc>=abp+acp+bcp else "NO")

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 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]):
        print('YES')
    else:
        print('NO')

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

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 < 1e10 else 'NO')
	except EOFError:
		break

Python: from sys import stdin
for line in stdin:
    x1,y1,x2,y2,x3,y3,xp,yp = [float(i) for i in line.split()]
    ab_cross_ap = (x2-x1)*(y1-yp)-(y2-y1)*(x1-xp)
    bc_cross_bp = (x3-x2)*(y2-yp)-(y3-y2)*(x2-xp)
    ca_cross_cp = (x1-x3)*(y3-yp)-(y1-y3)*(x3-xp)
    if ab_cross_ap < 0 and bc_cross_bp < 0 and ca_cross_cp < 0:
        print("YES")
    else:
        print("NO")

Python: import sys
for a,b,c,d,e,f,g,h in[map(float,l.split()) for l in sys.stdin]:print["NO","YES"][((c-a)*(d-h)-(d-b)*(c-g)>0)==((e-c)*(f-h)-(f-d)*(e-g)>0)==((a-e)*(b-h)-(b-f)*(a-g)>0)]

Python: def cross(x, y):
    return (x.conjugate() * y).imag
 
def inside_triangle(p, x, y, z):
    a = cross(y-x, p-y)
    b = cross(z-y, p-z)
    c = cross(x-z, p-x)
    if a*b > 0 and b*c > 0:
        return True
    return False
 
import sys
 
for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    x = complex(x1, y1)
    y = complex(x2, y2)
    z = complex(x3, y3)
    p = complex(xp, yp)
    if inside_triangle(p, x, y, z):
        print('YES')
    else:
        print('NO')

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

while True:
	try:
		x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
		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: 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
    xp -= x1
    yp -= 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: def checker(x1,y1,x2,y2,xp,yp):
	r = 0
	vec = (x2 - x1) * (yp - y1) - (y2 - y1) * (xp - x1)
	if vec > 0:
		r = 1
	elif vec < 0:
		r = -1
	return r

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

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

while True:
    l=[float(i) for i in input().split()]
    if not l: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) or g(ca,cb)<g(ca,cp):
        print("NO")
    else:
        print("YES")

Python: import math
import cmath
def dot(a:complex,b:complex):
  return (a.conjugate()*b).real
def cross(a:complex,b:complex):
  return (a.conjugate()*b).imag
next=[1,2,0]
try:
  while True:
    l=list(map(float,input().split()))
    p=[complex(l[2*j],l[2*j+1]) for j in range(4)]
    flg_ans=True
    sgn=1 if cross(p[0]-p[3],p[1]-p[3])>0 else -1
    for i in range(3):
      flg_ans=flg_ans and (sgn*cross(p[i]-p[3],p[next[i]]-p[3]))>0
    print('YES' if flg_ans else 'NO')
except EOFError:
  pass

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

while True:
	try:
		x1,y1,x2,y2,x3,y3,xp,yp = map(float,raw_input().split())
		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: 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.283 <= t1.get_acos_a() + t2.get_acos_a() + t3.get_acos_a() <= 6.284:
            print("YES")
        else:
            print("NO")

    except:
        break