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 area(x1,y1,x2,y2,x3,y3):
    return abs((x1*(y2-y3) + x2*(y3-y1)+ x3*(y1-y2))/2.0)
for line in sys.stdin.readlines():
    x1, y1, x2, y2, x3, y3, xp, yp=map(float,line.split())
    a1=area(x1,y1,x2,y2,xp,yp)
    a2=area(x3,y3,x2,y2,xp,yp)
    a3=area(x1,y1,x3,y3,xp,yp)
    a=area(x1,y1,x2,y2,x3,y3)
    if(a==(a1+a2+a3)):
        print("YES")
    else:
        print("NO")

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 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: 
import math

PI = math.pi
EPS = 10**-10

def edge(a, b):
    return ((a[0]-b[0])**2+(a[1]-b[1])**2)**.5

def area(a, b, c):
    s = (a+b+c)/2
    return (s*(s-a)*(s-b)*(s-c))**.5

def LawOfCosines(a, b, c): #余弦定理
    return math.acos( (b*b+c*c-a*a) / (2.0*b*c) );

def is_same(x, y): 
    return abs(x-y) < EPS

class Triangle:
    def __init__(self, p):
        a, b, c = p
        self.a = a
        self.b = b
        self.c = c

        self.edgeA = edge(b, c)
        self.edgeB = edge(c, a)
        self.edgeC = edge(a, b)

        self.area = area(self.edgeA, self.edgeB, self.edgeC)

        self.angleA = LawOfCosines(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = LawOfCosines(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = LawOfCosines(self.edgeC, self.edgeA, self.edgeB)

    def circumscribeadCircleRadius(self): #外接円の半径を返す
        return self.edgeA / math.sin(self.angleA) / 2.0

    def circumscribedCircleCenter(self): #外接円の中心の座標を返す
        a = math.sin(2.0*self.angleA);
        b = math.sin(2.0*self.angleB);
        c = math.sin(2.0*self.angleC);
        X = (self.a[0] * a + self.b[0] * b + self.c[0] * c) / (a+b+c);
        Y = (self.a[1] * a + self.b[1] * b + self.c[1] * c) / (a+b+c);
        return X, Y

    def inscribedCircleRadius(self): #内接円の半径
        return 2 * self.area / (self.edgeA + self.edgeB + self.edgeC)

    def inscribedCircleCenter(self): #内接円の中心の座標
        points = [self.a, self.b, self.c]
        edges = [self.edgeA, self.edgeB, self.edgeC]
        s = sum(edges)
        return [sum([points[j][i]*edges[j] for j in range(3)])/s for i in range(2)]

    def isInner(self, p): #点が三角形の内側か判定
        cross = lambda a, b: a[0]*b[1]-a[1]*b[0]

        c1 = 0
        c2 = 0
        points = [self.a, self.b, self.c]
        for i in range(3):
            a = [points[i][0]-points[(i+1)%3][0], points[i][1]-points[(i+1)%3][1]]
            b = [points[i][0]-p[0],  points[i][1]-p[1]]
            c = cross(a, b)
            if c > 0:
                c1 += 1
            elif c < 0:
                c2 += 1
        if c1 == 3 or c2 == 3:
            return True
        else:
            return c1+c2 != 3 and (c1 == 0 or c2 == 0)

if __name__ == "__main__":
    while True:
        try:
            c = list(map(float, input().split()))
            points = [(c[i], c[i+1]) for i in range(0, 6, 2)]
            point = [c[6], c[7]] 
            t = Triangle(points)
            print(["NO","YES"][t.isInner(point)])
        except:
            break

Python: import sys
f = sys.stdin

def take2(iterable):
    i = iter(iterable)
    while True:
        yield next(i), next(i)
def cross(a, b):
    return a.real * b.imag - a.imag * b.real
def in_triangle(a, b, c, p):
    v1 = cross(a - b, b - p)
    v2 = cross(b - c, c - p)
    v3 = cross(c - a, a - p)
    return 0 < v1 * v2 and 0 < v2 * v3

for line in f:
    a, b, c, p = [x + y *1j for x, y in take2(map(float, line.split()))]
    print('YES' if in_triangle(a,b,c,p) else 'NO')

Python: from collections import namedtuple

Point = namedtuple('Point', ('x', 'y'))

def sign (p1, p2, p3):
  return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);

while True:
  try:
    x = list(map(float, input().split()))
    p1 = Point(x[0], x[1])
    p2 = Point(x[2], x[3])
    p3 = Point(x[4], x[5])
    pp = Point(x[6], x[7])
    b1 = sign(pp, p1, p2) < 0.0
    b2 = sign(pp, p2, p3) < 0.0
    b3 = sign(pp, p3, p1) < 0.0
    if (b1 == b2) and(b2 == b3):
      print('YES')
    else:
      print('NO')
  except:
    break

Python: def point(a,b):
    return a[0]*b[0]+a[1]*b[1]
def euclid(a):
    return (a[0]**2+a[1]**2)**(1/2)
def cos(a,b):
    return point(a,b)/(euclid(a)*euclid(b))
while 1:
    try:
        ax,ay,bx,by,cx,cy,px,py = map(float, input().split(" "))
        ab = [bx-ax, by-ay]
        ac = [cx-ax, cy-ay]
        ba = [ax-bx, ay-by]
        bc = [cx-bx, cy-by]
        ap = [px-ax, py-ay]
        bp = [px-bx, py-by]
        if min(cos(ab,ap),cos(ac,ap)) > cos(ab,ac) and min(cos(ba,bp),cos(bc,bp)) > cos(ba,bc):
            print("YES")
        else:
            print("NO")
    except:
        break

Python: def r(x1, y1, x2, y2, x3, y3):
    return x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2) > 0

while True:
    try:
        line = input()
    except:
        break

    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.strip().split())

    abc = r(x1, y1, x2, y2, x3, y3)
    pab = r(xp, yp, x1, y1, x2, y2)
    pbc = r(xp, yp, x2, y2, x3, y3)
    pca = r(xp, yp, x3, y3, x1, y1)

    print('YES' if abc == pab == pbc == pca else 'NO')