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>
using namespace std;
int main()
{
    float x1,y1,x2,y2,x3,y3,x,y,a,b,c;
    while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>x>>y)
    {
        a=((y-y2)*(x-x1)-(y-y1)*(x-x2))*((y3-y2)*(x3-x1)-(y3-y1)*(x3-x2));
        b=((y-y3)*(x-x2)-(y-y2)*(x-x3))*((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3));
        c=((y-y3)*(x-x1)-(y-y1)*(x-x3))*((y2-y3)*(x2-x1)-(y2-y1)*(x2-x3));
        if(a>0&&b>0&&c>0)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}

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

int test(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp)
{
    double xa = (x2 - x1);
    double ya = (y2 - y1);
    double xb = (x3 - x1);
    double yb = (y3 - y1);
    double xc = (xp - x1);
    double yc = (yp - y1);
    double d = 1.0 / (xa*yb - xb*ya);
    double k = d * (yb * xc - xb * yc);
    double m = d * (-ya * xc + xa * yc);
    return (k >= 0.0 && m >= 0.0)? 1 : 0;
}

int main(void)
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        int tmp = 1;
        tmp *= test(x1, y1, x2, y2, x3, y3, xp, yp);
        tmp *= test(x2, y2, x1, y1, x3, y3, xp, yp);
        tmp *= test(x3, y3, x1, y1, x2, y2, xp, yp);
        cout << ((tmp ==1)? "YES" : "NO") << endl;
    }
    return 0;
}

C++: #include<iostream>

using namespace std;

float KXmax(float x[3]){
	float max=x[0];
	if(max<x[1]){
		max=x[1];
	}
	if(max<x[2]){
		max=x[2];
	}
	return max;
}

float KXmin(float x[3]){
	float min=x[0];
	if(min>x[1]){
		min=x[1];
	}
	if(min>x[2]){
		min=x[2];
	}
	return min;
}

float KYmax(float y[3]){
	float max=y[0];
        if(max<y[1]){
		max=y[1];
	}
	if(max<y[2]){
		max=y[2];
	}
	return max;
}

float KYmin(float y[3]){
	float min=y[0];
	if(min>y[1]){
		min=y[1];
	}
	if(min>y[2]){
		min=y[2];
	}
	return min;	
}

int main()
{
	float x[3],y[3],p1,p2,Xmax,Xmin,Ymax,Ymin;
	
	for(int i=1;i<=100;i++){
		cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>p1>>p2;
		Xmax=KXmax(x);		
		Xmin=KXmin(x);
		Ymax=KYmax(y);
		Ymin=KYmin(y);
		
		if((Xmin<=p1&&Xmax>=p1) && (Ymin<=p2&&Ymax>=p2)){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
		
	}
		
	return 0;
}

C++: #include<iostream>
#include<cmath>
#define N 0.00000001
using namespace std;

int main(){
  double x1,y1,x2,y2,x3,y3,px,py;
  while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>px>>py){
    double s1=0,s2=0,s3=0,s=0,a=0,b=0,c=0,a1=0,b1=0,c1=0,a2=0,b2=0,c2=0,a3=0,b3=0,c3=0;
    a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s=(a+b+c)/2;
    s=sqrt(s*(s-a)*(s-b)*(s-c));

    a1=sqrt((px-x2)*(px-x2)+(py-y2)*(py-y2));
    b1=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
    c1=sqrt((x3-px)*(x3-px)+(y3-py)*(y3-py));
    s1=(a1+b1+c1)/2;
    s1=sqrt(s1*(s1-a1)*(s1-b1)*(s1-c1));

    a2=sqrt((x1-px)*(x1-px)+(y1-py)*(y1-py));
    b2=sqrt((px-x3)*(px-x3)+(py-y3)*(py-y3));
    c2=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
    s2=(a2+b2+c2)/2;
    s2=sqrt(s2*(s2-a2)*(s2-b2)*(s2-c2));

    a3=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    b3=sqrt((x2-px)*(x2-px)+(y2-py)*(y2-py));
    c3=sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
    s3=(a3+b3+c3)/2;
    s3=sqrt(s3*(s3-a3)*(s3-b3)*(s3-c3));

    if(-N<s1<N||-N<s2<N||-N<s3<N)cout<<"NO"<<endl;
    else if((s1+s2+s3)>s-N &&(s1+s2+s3)<s+N )cout<<"YES"<<endl;
    else  cout<<"NO"<<endl; 
  }
  return 0;
}

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

int main(){
	double x[3], y[3], xp, yp;
	while (cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> xp >> yp){
		bool ans = true;
		//???????????¨????????????
		double gaiseki[3];	//gaiseki[i]???????????????P0P1??¨????????????P0Q????????????z??§?¨?
		for (int i = 0; i<3; i++){
			int k = (i + 1) % 3;
			double vx, vy, vpx, vpy;
			vx = x[k] - x[i];
			vy = y[k] - y[i];
			vpx = xp - x[i];
			vpy = yp - y[i];
			gaiseki[i] = vx*vpy - vy*vpx;
			if (gaiseki[i] <= 0) ans = false;
		}
		if (ans){
			cout << "YES" << endl;
		} else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define NITENKAN(a, b) sqrt(((a.first - b.first) * (a.first - b.first)) + ((a.second - b.second) * (a.second - b.second)))
using namespace std;

bool checkTriIn(pair<double, double> vA, pair<double, double> vB, pair<double, double> vC, pair<double, double> P){
	pair<double, double> center((vA.first + vB.first + vC.first / 3), (vA.second + vB.second + vC.second / 3));

	vector<pair<double, double> > triangleLine;
	vector<pair<double, double> > centerToVertex;
	pair<double, double> vAvB(vB.first - vA.first, vB.second - vA.second);
	pair<double, double> vBvC(vC.first - vB.first, vC.second - vB.second);
	pair<double, double> vCvA(vA.first - vC.first, vA.second - vC.second);

	triangleLine.push_back(vAvB);
	triangleLine.push_back(vBvC);
	triangleLine.push_back(vCvA);

	pair<double, double> centerP(P.first - center.first, P.second - center.second);
	pair<double, double> centerA(vA.first - center.first, vA.second - center.second);
	pair<double, double> centerB(vB.first - center.first, vB.second - center.second);
	pair<double, double> centerC(vC.first - center.first, vC.second - center.second);

	centerToVertex.push_back(centerA);
	centerToVertex.push_back(centerB);
	centerToVertex.push_back(centerC);

	for(int i = 0; i < 3; i++){
		double cross = triangleLine[i].first * centerP.second - centerP.first * triangleLine[i].second;
		if(cross == 0) continue;
		double r = triangleLine[i].first * centerToVertex[i].second - centerToVertex[i].first * triangleLine[i].second;
		r /= cross;
		double s = centerP.first * centerToVertex[i].second - centerToVertex[i].first * centerP.second;
		s /= cross;

		if(r > 0 && r <= 1 && s > 0 && s <= 1){
			return true;
		}
	}
	return false;
}

int main(){
	pair<double, double> vA, vB, vC, P;

	while(cin >> vA.first >> vA.second >> vB.first >> vB.second >> vC.first >> vC.second >> P.first >> P.second){
		if(checkTriIn(vA, vB, vC, P)){
			cout << "YES" << endl;
		}
		else{
			cout << "NO" << endl;
		}
	}
}