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 <complex>
#include <cmath>
using namespace std;
typedef complex<double> xy_t;
double cross_product(xy_t a, xy_t b){ return (conj(a)*b).imag();}
double x[4],y[4];
int main() {
	while(true){
		for(int i=0; i<4;++i) cin >> x[i] >> y[i];
		if(!cin) break;
		xy_t a(x[0],y[0]),b(x[1],y[1]),c(x[2],y[2]),p(x[3],y[3]);
		bool ok = cross_product(a-p,b-p)*cross_product(b-p,c-p)>0
				  && cross_product(b-p,c-p)*cross_product(c-p,a-p)>0;
		cout << (ok ? "YES" : "NO") << endl;
	}
	return 0;
}

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

class point{
public:
	double x;
	double y;
	point(double px, double py){
		x = px;
		y = py;
	}
};

double cross(point a, point b, point c, point d){
	return (b.x - a.x) * (d.y - c.y) - (b.y - a.y) * (d.x - c.x);
}

bool pn(double a){
	if (a > 0)
		return true;
	else
		return false;
}

int main()
{
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		point a = point(x1, y1);
		point b = point(x2, y2);
		point c = point(x3, y3);
		point p = point(xp, yp);
		if ((pn(cross(p, a, b, a)) && pn(cross(p, b, c, b)) && pn(cross(p, c, a, c))) ||
			(pn(cross(p, a, b, a) * (-1)) && pn(cross(p, b, c, b) * (-1)) && pn(cross(p, c, a, c) * (-1)))){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}

	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);
const int INF = INT_MAX/10;

#include <complex>
typedef complex<double> P;
typedef vector<P> vP;
typedef vector<double> vd;

#define EQ(x,y) (abs((x)-(y))<EPS)

double rad(double deg) {
	return deg*PI/180.0;
}

double dot(P a, P b) {
	return (a.real()*b.real() + a.imag()*b.imag());
}

double cross(P a, P b) {
	return (a.real()*b.imag() - a.imag()*b.real());
}

double distance_ls_p(P a, P b, P c) {
	if(dot(b-a, c-a) < -EPS) return abs(c-a);
	if(dot(a-b, c-b) < -EPS) return abs(c-b);
	return abs(cross(b-a, c-a)) / abs(b-a);
}

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
		P a(x1, y1), b(x2, y2), c(x3, y3), p(xp, yp);

		double S1 = abs(a-b) * distance_ls_p(a, b, c);
		double S2 = abs(a-b) * distance_ls_p(a, b, p);
		S2 += abs(b-c) * distance_ls_p(b, c, p);
		S2 += abs(c-a) * distance_ls_p(c, a, p);

		if(EQ(S1, S2)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <math.h>

using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)

bool judge(double x[3], double y[3]) {
	double rad1 = atan2(y[0], x[0]);
	double rad2 = atan2(y[1], x[1]);
	double rad3 = atan2(y[2], x[2]);
	if(rad3 < rad1 && rad2 < rad3 || rad1 < rad3 && rad3 < rad2) return true;
	else return false;
}

int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf\n", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) != EOF) {
		double x[3], y[3];
		x[0] = x2 - x1;
		y[0] = y2 - y1; 
		x[1] = x3 - x1;
		y[1] = y3 - y1;
		x[2] = xp - x1;
		y[2] = yp - y1;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		x[0] = x1 - x2;
		y[0] = y1 - y2;
		x[1] = x3 - x2;
		y[1] = y3 - y2;
		x[2] = xp - x2;
		y[2] = yp - y2;
		if(!judge(x, y)) {
			cout << "NO" << endl;
			continue;
		}
		cout << "YES" << endl;
	}
	return 0;
}

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

double length(double, double, double, double);

double triangle(double x1, double y1, double x2, double y2, double x3, double y3) {
    double a = length(x1, y1, x3, y3);
    double b = length(x2, y2, x3, y3);
    double c = length(x1, y1, x2, y2);

    double d = (a + b - c) / sqrt(a * b) / 2.0; // cos(radian)

    // cout << d << endl;

    return d;
}

double length(double x, double y, double ox, double oy) {
    return pow(x - ox, 2) + pow(y - oy, 2);
}

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        double ta = triangle(x1, y1, x2, y2, xp, yp);
        double tb = triangle(x1, y1, x3, y3, xp, yp);
        double tc = triangle(x2, y2, x3, y3, xp, yp);

        if ((ta < 0 && tb < 0) || (tb < 0 && tc < 0) || (tc < 0 && ta < 0)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }

        if (cin.eof()) break;
    }

    return 0;
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<sstream>
#include<functional>
#include<map>
#include<set>
#include<cmath>

#define REP(i,s,e) for(int i=int(s);i<int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

#define EPS 1e-9

using namespace std;

bool intriangle(double x1,double y1,double x2,double y2,double x3,double y3,double xp,double yp){

double d=(x1-xp)*(x1-xp)+(y1-yp)*(y1-yp);
double a=(y1-yp)/(x1-xp);
double b=(y3-y2)/(x3-x2);
double x=(y2-yp-b*(x2-xp))/(a-b);
double y=(a*(y2-yp)-a*b*(x2-xp))/(a-b);

if(x1!=xp && x2!=x3 && a!=b && d<(x-x1+xp)*(x-x1+xp)+(y-y1+yp)*(y-y1+yp) && min(x2-xp,x3-xp)<x && max(x2-xp,x3-xp)>x)
return true;

else if(x1==xp && x2!=x3 && abs(y1-yp)<abs(y1-y2+b*(x2-xp)) && (x2-xp)*(x3-xp)<0)
return true;

else if(x1!=xp && x2==x3 && d<(x2-x1)*(x2-x1)+(a*(x2-xp)-y1+yp)*(a*(x2-xp)-y1+yp) && min(y1-yp,y3-yp)<a*(x2-xp) && max(y1-yp,y3-yp)>a*(x2-xp))
return true;
else return false;

}

int main(){

	double x1,y1,x2,y2,x3,y3,xp,yp;

	while(true){

	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp;

	if(cin.fail()) break;

	if(intriangle(x1,y1,x2,y2,x3,y3,xp,yp))
	cout << "YES" << endl;
	else cout << "NO" << endl;

	}

	return 0;
}