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: def f(a,b,c,d,e,f,g,h):return ((a-c)*(f-b)+(b-d)*(a-e))*((a-c)*(h-b)+(b-d)*(a-g))
while 1:
    try:x1,y1,x2,y2,x3,y3,xp,yp=map(float,input().split())
    except:break
    x=(x1+x2+x3)/3
    y=(y1+y2+y3)/3
    print(['YES','NO'][f(x1,y1,x2,y2,xp,yp,x,y)<0 or f(x1,y1,x3,y3,xp,yp,x,y)<0 or f(x2,y2,x3,y3,xp,yp,x,y)<0])

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: def vec(s,t):
    return [t[0]-s[0], t[1]-s[1]]

def area(a,b):
    return a[0]*b[1] - a[1]*b[0]

while True:
    try:
        l = [float(x) for x in input().split()]

        a = [l[0],l[1]]
        b = [l[2],l[3]]
        c = [l[4],l[5]]
        p = [l[6],l[7]]

        x = area(vec(p,a),vec(p,b))
        y = area(vec(p,b),vec(p,c))
        z = area(vec(p,c),vec(p,a))

        if (x<0 and y<0 and z<0) or (x>0 and y>0 and z>0):
            print('YES')
        else:
            print('NO')
    except:
        break

Python: import sys

def sameside(x1, y1, x2, y2, ax, ay, bx, by):
    if x1 != x2:
        aupper = (ay > (y1-y2)/(x1-x2) * (ax-x1) + y1)
        bupper = (by > (y1-y2)/(x1-x2) * (bx-x1) + y1)
    else:
        aupper = ax < x1
        bupper = bx < x1
    return aupper == bupper

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = list(map(float, line.split()))
    if sameside(x1, y1, x2, y2, x3, y3, xp, yp) and sameside(x2, y2, x3, y3, x1, y1, xp, yp) and sameside(x3, y3, x1, y1, x2, y2, xp, yp):
        print("YES")
    else:
        print("NO")

Python: import math
import sys


def get_triangle_area(x1, y1, x2, y2, x3, y3):
    l1 = math.sqrt(abs(x1-x2)**2+abs(y1-y2)**2)
    l2 = math.sqrt(abs(x2-x3)**2+abs(y2-y3)**2)
    l3 = math.sqrt(abs(x3-x1)**2+abs(y3-y1)**2)
    s = (l1+l2+l3)/2
    return math.sqrt(s*(s-l1)*(s-l2)*(s-l3))


for l in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, l.split())
    s1 = get_triangle_area(x1, y1, x2, y2, x3, y3)
    s2 = get_triangle_area(xp, yp, x1, y1, x2, y2)
    s2 += get_triangle_area(xp, yp, x2, y2, x3, y3)
    s2 += get_triangle_area(xp, yp, x3, y3, x1, y1)
    print("YES" if round(s1, 5) == round(s2, 5) else "NO")

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

Python: # ２点(a, b) (c, d)を通る直線の傾きと切片を返す
def func(a, b, c, d):
    k = (d - b) / (c - a)
    h = d - k * c
    return k, h


# ２点と通る直線のf(x)を返す
def fx(a, b, c, d, x):
    k, h = func(a, b, c, d)
    return k * x + h


def main():
    import sys
    for dataset in sys.stdin:
        ans = 'NO'
        try :
            a, b, c, d, e, f, px, py = map(float, dataset.split())
        except:
            break
        T = [(a, b), (c, d), (e, f)]
        T.sort(key=lambda x: (x[0], x[1]))
        a, b, c, d, e, f = T[0][0], T[0][1], T[1][0], T[1][1], T[2][0], T[2][1]
        # 共通なxを持つ２点が存在するか判定し、する場合
        if a == c:
            if  a < px and fx(a, b, e, f, px) < py and fx(c, d, e, f, px) > py:
                ans = 'YES'
        elif c == e:
            if px < e and fx(a, b, c, d, px) < py and fx(a, b, e, f, px) > py:
                ans = 'YES'
        else:  # ３点において共通のxを持たない場合
            if fx(a, b, e, f, c) < d:  # 中間点が残り２点を通る直線より上にあるケース
                if fx(a, b, c, d, px) > py and fx(c, d, e, f, px) > py and fx(a, b, e, f, px) < py:
                    ans = 'YES'
            else:
                if fx(a, b, c, d, px) < py and fx(c, d, e, f, px) < py and fx(a, b, e, f, px) > py:
                    ans = 'YES'

        print(ans)


if __name__ == '__main__':
    main()

Python: length=[float(0) for i in range(3)]
while 1:
    try:
        x1,y1,x2,y2,x3,y3,x4,y4=[float(i) for i in input().split( )]
        x12=x1-x2
        y12=y1-y2
        x23=x2-x3
        y23=y2-y3
        x31=x3-x1
        y31=y3-y1
        x14=x1-x4
        y14=y1-y4
        x24=x2-x4
        y24=y2-y4
        x34=x3-x4
        y34=y3-y4
        gai1=x12*y14-x14*y12
        gai2=x23*y24-x24*y23
        gai3=x31*y34-x34*y31
        if (((gai1>0)and(gai2>0)and(gai3>0))or((gai1<0)and(gai2<0)and(gai3<0))):
            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: import sys
  
for s in sys.stdin:
    x1,y1,x2,y2,x3,y3,xp,yp = [ float(x) for x in s.split() ]

    v12 = (x2-x1, y2-y1)
    v23 = (x3-x2, y3-y2)
    v31 = (x1-x3, y1-y3)
    v1p = (xp-x1, yp-y1)
    v2p = (xp-x2, yp-y2)
    v3p = (xp-x3, yp-y3)
    cp1 = v12[0]*v1p[1] - v1p[0]*v12[1]
    cp2 = v23[0]*v2p[1] - v2p[0]*v23[1]
    cp3 = v31[0]*v3p[1] - v3p[0]*v31[1]

    if cp1 > 0 and cp2 > 0 and cp3 > 0:
        print('YES')
    elif cp1 < 0 and cp2 < 0 and cp3 < 0:
        print('YES')
    else:
        print('NO')

Python: try:
    while True:
        li = [float(x) for x in input().split()]
        lix = [li[i] for i in range(6) if i % 2 == 0]
        liy = [li[i] for i in range(6) if i % 2 != 0]
        x, y = li[6], li[7]
        if min(lix) <= x <= max(lix) and min(liy) <= y <= max(liy):
            print("YES")
        else:
            print("NO")
except EOFError:
    pass

Python: def cross(a,b):
    return (a.conjugate()*b).imag
def is_in_triangle(X1,Y1,X2,Y2,X3,Y3,Xp,Yp):
    z1 = complex(X1-Xp,Y1-Yp)
    z2 = complex(X2-Xp,Y2-Yp)
    z3 = complex(X3-Xp,Y3-Yp)
    if cross(z1,z2) * cross(z2,z3) > 0:
        if cross(z2,z3) * cross(z3,z1) > 0:
            return True
    else:
        return False
lst = []
try:
    while True:
        P = tuple(map(float,input().strip().split()))
        lst.append(P)
except EOFError:
    pass
N = len(lst)
for i in range(N):
    if is_in_triangle(*lst[i]):
        print("YES")
    else:
        print("NO")