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    <cmath>

using namespace std;

typedef struct V2D {
    double x;
    double y;
}vect2D;

vect2D make_vect2D(double, double);
double calc_CrossProductZ(vect2D *, vect2D *);

int main() {
    double x1, y1, x2, y2, x3, y3, xp, yp;
    double z1, z2, z3;
    vect2D v12, v23, v31, v1p, v2p, v3p;

    while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        v12 = make_vect2D(x2 - x1, y2 - y1);
        v23 = make_vect2D(x3 - x2, y3 - y2);
        v31 = make_vect2D(x1 - x3, y1 - y3);
        v1p = make_vect2D(xp - x1, yp - y1);
        v2p = make_vect2D(xp - x2, yp - y2);
        v3p = make_vect2D(xp - x3, yp - y3);

        z1 = calc_CrossProductZ(&v12, &v2p);
        z2 = calc_CrossProductZ(&v23, &v3p);
        z3 = calc_CrossProductZ(&v31, &v1p);

        if((z1 > 0 && z2 > 0 && z3 > 0) || (z1 < 0 && z2 < 0 && z3 < 0)) { cout << "YES" << endl; }
        else { cout << "NO" << endl; }
    }
 
    return 0;
}
 
vect2D make_vect2D(double dx, double dy) {
    vect2D res;
     
    res.x = dx;
    res.y = dy;
 
    return res;
}
 
double calc_CrossProductZ(vect2D *a, vect2D *b) {
    return (a->x * b->y - b->x * a->y);
}

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

#define d 0.0000000001

using namespace std;

double get2pDist(double, double, double, double);
double getplDist(double, double, double, double, double, double);
double getTriangle(double, double, double, double, double, double);

int main(){
	double x1, y1, x2, y2, x3, y3, xp, yp;
	while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		double S = getTriangle(x1, y1, x2, y2, x3, y3);
		double s =
			getTriangle(x1, y1, x2, y2, xp, yp)
			+ getTriangle(x2, y2, x3, y3, xp, yp)
			+ getTriangle(x3, y3, x1, y1, xp, yp);
		abs(S - s) < d ? cout << "YES" : cout << "NO";
	}
	return 0;
}

double get2pDist(double x1, double y1, double x2, double y2){
	return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));	
}

double getplDist(double x, double y, double x1, double y1, double x2, double y2){
	double a, b, c;
	a = y1 - y2;
	b = x2 - x1;
	c = x1 * y2 - x2 * y1;
	return abs(a * x + b * y + c) / sqrt(a * a + b * b);
}

double getTriangle(double x1, double y1, double x2, double y2, double x3, double y3){
	return (get2pDist(x1, y1, x2, y2)
	 * getplDist(x3, y3, x1, y1, x2, y2)) / 2;
}

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

int gaiseki(double,double,double,double,double,double);

int main() {
	double x[4],y[4];
	int n[3],ans;
	while ( cin >> x[0] ) {
		cin >> y[0];
		for ( int i = 1; i < 4; i++ ) {
			cin >> x[i] >> y[i];
		}
		//三角形の各辺の外積(求めたい点と始点、求めたい点と終点との外積)を取り、全て右か左だったら中に含まれる
		for ( int i = 0; i < 2; i++ ) 
			n[i] = gaiseki(x[i],y[i],x[i + 1],y[i + 1],x[3],y[3]);
		n[2] = gaiseki(x[2],y[2],x[0],y[0],x[3],y[3]);
		
		ans = 0;
		for ( int i = 0; i < 3; i++ ){
			ans += n[i];
		}
		
		if ( ans == 3 || ans == -3 )
			cout << "YES" << endl;
		else
			cout << "NO" << endl;
	}
	return 0;
}

int gaiseki(double x1,double y1,double x2,double y2,double xp,double yp) {
	double ans;
	ans =  xp * ( y1 - y2 ) + x1 * ( y2 - yp ) + x2 * ( yp - y1 );
	if ( ans > 0 ) return 1; //右側
	else return 0; //左側(＝だと線上だが、今回は考えなくて良い)
}

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

int main() {
double x1, y1, x2, y2, x3, y3, xp ,yp,ss,s1,s2,s3;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
ss=fabs((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1));
s1=fabs((x3-xp)*(y2-yp)-(x2-xp)*(y3-yp));
s2=fabs((x3-xp)*(y1-yp)-(x1-xp)*(y3-yp));
s3=fabs((x2-xp)*(y1-yp)-(x1-xp)*(y2-yp));

if(fabs(s1+s2+s3-ss)<0.001){
	cout<<"YES"<<endl;
}
else{
	cout<<"NO"<<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 <cstdio>

int main(){
  double x[4],y[4],s[3];
  while(1){
    for(int i=0; i<4; i++)
      if(scanf("%lf %lf",&x[i],&y[i]) == EOF)
	goto outer;

    for(int i=0; i<3; i++){
      int j=(i+1)%3;
      s[i] = (x[i]-x[j])*(y[j]-y[3])-(y[i]-y[j])*(x[j]-x[3]);
    }

    if((s[0]>0&&s[1]>0&&s[2]>0)||(s[0]<0&&s[1]<0&&s[2]<0))
      printf("YES\n");
    else
      printf("NO\n");
  }
 outer: ;
}

C++: #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string.h>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;

double x[5];
double y[5];

int main()
{
	while (cin >> x[0] >> y[0]) {
		for (int i = 1; i < 4; i++) {
			cin >> x[i] >> y[i];
		}

		double abc = fabs((x[1] - x[0])*(y[2] - y[0]) - (x[2] - x[0])*(y[1] - y[0]));
		double pab = fabs((x[0] - x[3])*(y[1] - y[3]) - (x[1] - x[3])*(y[0] - y[3]));
		double pbc = fabs((x[1] - x[3])*(y[2] - y[3]) - (x[2] - x[3])*(y[1] - y[3]));
		double pca = fabs((x[2] - x[3])*(y[0] - y[3]) - (x[0] - x[3])*(y[2] - y[3]));

		if (fabs(abc - pab - pbc - pca) < EPS)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<math.h>
using namespace std;
int main() {
	double x1, y1, x2, y2, x3, y3, xp, yp, a, b, c, d, e, f, s1, s2, s3,s4, S1, S2, S3,S4;
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp){
		a = pow((pow(x1 - xp, 2) + pow(y1 - yp, 2)), 1.0 / 2);
		b = pow((pow(x2 - xp, 2) + pow(y2 - yp, 2)), 1.0 / 2);
		c = pow((pow(x3 - xp, 2) + pow(y3 - yp, 2)), 1.0 / 2);
		d = pow((pow(x2 - x3, 2) + pow(y2 - y3, 2)), 1.0 / 2);
		e = pow((pow(x1 - x3, 2) + pow(y1 - y3, 2)), 1.0 / 2);
		f = pow((pow(x1 - x2, 2) + pow(y1 - y2, 2)), 1.0 / 2);
		s1 = (b + c + d) / 2;
		s2 = (a + c + e) / 2;
		s3 = (a + b + f) / 2;
		s4 = (d + e + f) / 2;
		S1 = pow(s1*(s1 - b)*(s1 - c)*(s1 - d), 1.0 / 2);
		S2 = pow(s2*(s2 - a)*(s2 - c)*(s2 - e), 1.0 / 2);
		S3 = pow(s3*(s3 - a)*(s3 - b)*(s3 - f), 1.0 / 2);
		S4 = pow(s4*(s4 - d)*(s4 - e)*(s4 - f), 1.0 / 2);
		if ((S4+0.001>S1+S2+S3)&&(S1 + S2 + S3 > S4-0.001)) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	return 0;
}