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: # coding: utf-8

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: 
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: # Aizu Problem 0012: Point in Triangle
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def point_in_triangle(trig, x, y):
    x1, y1, x2, y2, x3, y3 = trig[:]
    a = ((y2 - y3)*(x - x3) + (x3 - x2)*(y - y3)) / ((y2 - y3)*(x1 - x3) + (x3 - x2)*(y1 - y3))
    b = ((y3 - y1)*(x - x3) + (x1 - x3)*(y - y3)) / ((y2 - y3)*(x1 - x3) + (x3 - x2)*(y1 - y3))
    c = 1 - a - b
    return 0 < a < 1 and 0 < b < 1 and 0 < c < 1

          
for line in sys.stdin:
    inp = [float(_) for _ in line.split()]
    print("YES" if point_in_triangle(inp[:6], inp[6], inp[7]) else "NO")

Python: while True:
    try:
        ax, ay, bx, by, cx, cy, px, py = map(float, input().split())
        a = (bx - ax) * (py - ay) - (by - ay) * (px - ax)
        b = (cx - bx) * (py - by) - (cy - by) * (px - bx)
        c = (ax - cx) * (py - cy) - (ay - cy) * (px - cx)
        if (a < 0 and b < 0 and c < 0) or (a > 0 and b > 0 and c > 0):
            print("YES")
        else:
            print("NO")
    except:
        break

Python: import math
from sys import stdin

def length(u,v):
    x0=u[0]
    y0=u[1]
    x1=v[0]
    y1=v[1]
    return(math.sqrt(((x1-x0)**2+(y1-y0)**2)))

def s(a,b,c):
    l=length(a,b)
    m=length(b,c)
    n=length(c,a)
    o = (l+m+n)/2.0
    p=o*(o-l)*(o-m)*(o-n)
    q=math.sqrt(p)
    return(q)

if __name__ == "__main__": 
   eps=1e-5
   for line in stdin:
        v=list(map(float,line.split()))
        a=(v[0],v[1])
        b=(v[2],v[3])
        c=(v[4],v[5])
        p=(v[6],v[7])
        s0=s(a,b,c)
        s1=s(p,a,b)
        s2=s(p,b,c)
        s3=s(p,c,a)
        if abs(s0 - (s1+s2+s3))< eps:
            print("YES")
        else:
            print("NO")

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
def gaiseki(x0, y0, x1, y1):
    return x0*y1 - y0*x1
def muki(x0, y0, x1, y1, x2, y2):
    return gaiseki(x1-x0, y1-y0, x2-x1, y2-y1) > 0
for line in sys.stdin:
    x0, y0, x1, y1, x2, y2, xp, yp = map(float, line.split())
    m0 = muki(xp, yp, x0, y0, x1, y1)
    m1 = muki(xp, yp, x1, y1, x2, y2)
    m2 = muki(xp, yp, x2, y2, x0, y0)
    if m0 == m1 and m1 == m2:
        print('YES')
    else:
        print('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;
    
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: from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

for line in stdin:
    sets = [float(s) for s in line.split()]
    xa, xb = sorted(sets[:5:2])[::2]
    ya, yb = sorted(sets[1:6:2])[::2]
    if xa < sets[6] < xb and ya < sets[7] < yb:
        print('YES')
    else:
        print('NO')

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

def main():
    while True:
        try:
            ax,ay,bx,by,cx,cy,px,py=map(float,input().split())
            A=(bx-ax)*(py-ay)-(by-ay)*(px-ax)
            B=(cx-bx)*(py-by)-(cy-by)*(px-bx)
            C=(ax-cx)*(py-cy)-(ay-cy)*(px-cx)

            if ((A<=0)and(B<=0)and(C<=0))or((A>0)and(B>0)and(C>0)):
                print("YES")
            else:
                print("NO")

            

        except:
            break
            
    
if __name__ == '__main__':
    main()

Python: try:
    while True:
        li = [float(x) for x in input().split()]
        if li:
            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 cross3(a, b, c):
    return (b[0] - a[0])*(c[1] - a[1]) - (b[1] - a[1])*(c[0] - a[0])
for line in open(0).readlines():
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    p1 = (x1, y1); p2 = (x2, y2); p3 = (x3, y3); pp = (xp, yp)
    if cross3(p1, p2, p3) < 0:
        p1, p2 = p2, p1
    if cross3(p1, p2, pp) > 0 and cross3(p1, pp, p3) > 0 and cross3(p2, p3, pp) > 0:
        print("YES")
    else:
        print("NO")

Python: import sys

def isleft(ox, oy, ax, ay, px, py):
    oax, oay = ax - ox, ay - oy
    opx, opy = px - ox, py - oy
    if oax * opy > oay * opx:
        return 1
    else:
        return 0

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
#    A, B, C, P = (x1, y1), (x2, y2), (x3, y3), (xp, yp)
#    if isleft(*A, *B, *P) == isleft(*B, *C, *P) == isleft(*C, *A, *P):
    if isleft(x1, y1, x2, y2, xp, yp) == isleft(x2, y2, x3, y3, xp, yp) == isleft(x3, y3, x1, y1, xp, yp):
        print("YES")
    else:
        print("NO")