Go: package main

import (
        "fmt"
)

func main() {
        var x1, y1, x2, y2, x3, y3, px, py float64
        var oax, oay, obx, oby, opx, opy float64
        var det float64
        var s, t float64

        for {
                _, err := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &px, &py)
                if err != nil {
                        break
                }
                oax = x2 - x1
                oay = y2 - y1
                obx = x3 - x1
                oby = y3 - y1
                opx = px - x1
                opy = py - y1
                det = oax*oby - obx*oay

                if det == 0 {
                        fmt.Printf("NO\n")
                } else {
                        s = (oby*opx - obx*opy) / det
                        t = (oax*opy - oay*opx) / det

                        if (s+t < 1 && s > 0 && t > 0) {
                                fmt.Printf("YES\n")
                        } else {
                                fmt.Printf("NO\n")
                        }
                }
        }
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

bool flag;
double x1, yt1, x2, y2, x3, y3, xp, yp;
double v[3][2];

double inpr(double v1[2], double v2[2]) {
	return v1[0] * v2[0] + v1[1] * v2[1];
}

int main() {
	x2 = -123456;
	cin >> x1 >> yt1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;

	while (x2 != -123456) {
		flag = true;
		v[0][0] = -(y2 - yt1);
		v[0][1] = x2 - x1;		
		
		v[1][0] = x3 - x1;
		v[1][1] = y3 - yt1;

		v[2][0] = xp - x1;
		v[2][0] = yp - yt1;

		if (inpr(v[0], v[1]) * inpr(v[0], v[2]) > 0) flag = false;
		
		v[0][0] = -(y3 - y2);
		v[0][1] = x3 - x2;		
		
		v[1][0] = x1 - x2;
		v[1][1] = yt1 - y2;

		v[2][0] = xp - x2;
		v[2][0] = yp - y2;

		if (inpr(v[0], v[1]) * inpr(v[0], v[2]) > 0) flag = false;
		
		v[0][0] = -(yt1 - y3);
		v[0][1] = x1 - x3;		
		
		v[1][0] = x2 - x3;
		v[1][1] = y2 - y3;

		v[2][0] = xp - x3;
		v[2][0] = yp - y3;

		if (inpr(v[0], v[1]) * inpr(v[0], v[2]) > 0) flag = false;

		if (flag) cout << "YES" << endl;
		else cout << "NO" << endl;

		x2 = -123456;
		cin >> x1 >> yt1 >> x2 >> y2 >> x3 >> y3;
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

C++: #include<iostream>
#include<cstdio>
using namespace std;
int main() {
	double x[3], y[3], p, q;
	while (cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>p>>q) {
		bool f = true;
		for (int i = 0; i < 3; i++) {
			if ((x[i % 3] - p)*(y[(i + 1) % 3] - q) - (y[i % 3] - q)*(x[(i + 1) % 3] - p) <= 0)f = false;
		}
		if (f)puts("YES");
		else puts("NO");
	}
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

double distance(double x1, double y1, double x2, double y2,
                double xp, double yp){
    if(x1 == x2) {
        return abs(xp - x1);
    } else {
        double a = ( y2 - y1 ) / ( x2 - x1 );
        double b = y1 - a * x1;
        return abs(a*xp-yp-b) / sqrt(1+a*a);
    }
}

int main(){
    vector<double> p(6);
    double xp, yp;
    while(cin >> p[0] >> p[1] >> p[2] >> p[3] >> p[4] >> p[5] >> xp >> yp){
        bool yes = true;
        for(int i = 0; i < 3; i++){
            double d1 = distance(p[0], p[1], p[2], p[3], p[4], p[5]);
            double d2 = distance(p[0], p[1], p[2], p[3], xp, yp);
            yes &= d2 < d1;
            rotate(p.begin(), p.begin()+2, p.end());
        }
        cout << (yes ? "YES" : "NO") << endl;
    }
}

C++: #include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){
	double x1,x2,x3,y1,y2,y3,xp,yp;
	double a,b,c,ap,bp,cp;
	double as,bs,cs,os;
	double A,B,C,O;
	double ans;
	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
		b=sqrt((x3-x1)*(x3-x1)+(y1-y3)*(y1-y3));
		c=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
		ap=sqrt((x1-xp)*(x1-xp)+(y1-yp)*(y1-yp));
		bp=sqrt((xp-x2)*(xp-x2)+(yp-y2)*(yp-y2));
		cp=sqrt((x3-xp)*(x3-xp)+(yp-y3)*(yp-y3));
		as=(a+ap+bp)/2;
		bs=(c+bp+cp)/2;
		cs=(b+ap+cp)/2;
		os=(a+b+c)/2;
		A=sqrt(as*(as-a)*(as-ap)*(as-bp));
		B=sqrt(bs*(bs-c)*(bs-bp)*(bs-cp));
		C=sqrt(cs*(cs-b)*(cs-ap)*(cs-cp));
		O=sqrt(os*(os-a)*(os-b)*(os-c));
		if(sqrt(A+B+C-O)<1e-9)cout<<"YES\n";
		else cout<<"NO\n";
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;

int main ()
{
    double x1, x2, x3, y1, y2, y3, xp, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double a = hypot(x2 - x1, y2 - y1);
        double c = hypot(x3 - x1, y3 - y1);
        double b = hypot(x3 - x2, y3 - y2);
        double x = hypot(xp - x1, yp - y1);
        double y = hypot(xp - x2, yp - y2);
        double z = hypot(xp - x3, yp - y3);

        if (a + b < x + z) {
            cout << "NO" << endl;
        } else if (a + c < y + z) {
            cout << "NO" << endl;
        } else if (c + b < y + z) {
            cout << "NO" << endl;
	} else {
            cout << "YES" << endl;
	}
    }

    return 0;
}

C++: #include<iostream>

using namespace std;

int main(void) {
	double x[3] = { 0,0,0 };
	double y[3] = { 0,0,0 };
	double xp = 0, yp = 0;
	int flag[3] = { 0,0,0 };

	while (cin >> x[0]>> y[0]>> x[1]>> y[1]>> x[2]>> y[2]>> xp>> yp) {
		for (int i = 0; i < 3; i++) {
			int temp1 = (i + 1) % 3;
			int temp2 = (i + 2) % 3;
			double checkI = (y[temp1] - y[i]) * (x[temp2] - x[i]) - (x[temp1] - x[i]) * (y[temp2] - y[i]);
			double checkP = (y[temp1] - y[i]) * (xp - x[i]) - (x[temp1] - x[i]) * (yp - y[i]);

			if (checkI * checkP > 0) {
				flag[i] = 1;
			}
		}
		if (flag[0] == 1 && flag[1] == 1 && flag[2] == 1) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
		flag[0] = 0;
		flag[1] = 0;
		flag[2] = 0;
	}
	

	return 0;
}

C++: #include<stdio.h>
/// http://www5d.biglobe.ne.jp/~tomoya03/shtml/algorithm/Hougan.htm
/// http://www.sousakuba.com/Programming/gs_hittest_point_triangle.html
struct Vector2D{
    double x;
    double y;
};

Vector2D sub(const Vector2D a, const Vector2D b){
    Vector2D ret;
    ret.x = a.x-b.x;
    ret.y = a.y-b.y;
    return ret;
}

bool hittest_point(Vector2D A, Vector2D B, Vector2D C, Vector2D P){
    Vector2D AB = sub(B, A);
    Vector2D BP = sub(P, B);

    Vector2D BC = sub(C, B);
    Vector2D CP = sub(P, C);

    Vector2D CA = sub(A, C);
    Vector2D AP = sub(P, A);

    // Cross Product
    double c1 = AB.x * BP.y - AB.y * BP.x;
    double c2 = BC.x * CP.y - BC.y * CP.x;
    double c3 = CA.x * AP.y - CA.y * AP.x;

    if((c1>=0 && c2>=0 && c3 >=0) || (c1<0 && c2 <0 && c3<0)){
        return true;
    }else{
        return false;
    }
}

int main(){
    Vector2D A, B, C, P;
    while(~scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &A.x, &A.y,&B.x, &B.y, &C.x, &C.y,&P.x, &P.y)){
        if(hittest_point(A, B,C,P)){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    return 0;
}

C++: #include<iostream>
using namespace std;

int main()
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)
    {
        double s = ((y3-y1)*(xp-x1)+(x1-x3)*(yp-y1))/((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));
        double t = ((y1-y2)*(xp-x1)+(x2-x1)*(yp-y1))/((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));
        if( s>=0 && t>=0 && s+t<=1 ){cout << "YES\n";}
        else{cout << "NO\n"; }
    }

    return 0;
}