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 (1) {
    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]);
    double pab = cross_product(a-p, b-p);
    double pbc = cross_product(b-p, c-p);
    double pca = cross_product(c-p, a-p);
    bool ok = (pab * pbc >= 0 && pab * pca >= 0);
    cout << (ok ? "YES" : "NO") << endl;
  }
  return 0;
}

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 tri1 = cross_product(a-p,b-p) > 0;
    bool tri2 = cross_product(b-p,c-p) > 0;
    bool tri3 = cross_product(c-p,a-p) > 0;
 
    bool tri4 = cross_product(a-p,b-p) < 0;
    bool tri5 = cross_product(b-p,c-p) < 0;
    bool tri6 = cross_product(c-p,a-p) < 0;
 
    bool ok = tri1*tri2*tri3;
    if (ok != 1) ok = tri4*tri5*tri6;
 
    cout << (ok ? "YES" : "NO") << endl;
  }
}

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

class Triangle{
	float m_x[3],m_y[3],m_xp,m_yp;
	float m_vx[3],m_vy[3];//点Pからの相対座標
	float m_nv1,m_nv2, m_rot,m_rot_sum,m_cos_sita;
	int m_p1,m_p2;
	bool m_pointIsSetted;
public:
	Triangle(){m_pointIsSetted=false;m_rot_sum=0;}
	void setPoint(float x1, float y1, float x2, float y2, float x3, float y3){
		m_x[0]=x1; m_y[0]=y1;
		m_x[1]=x2; m_y[1]=y2;
		m_x[2]=x3; m_y[2]=y3;
		m_pointIsSetted=true;
	}
	bool isPointIn(float xp,float yp){
		m_xp=xp;m_yp=yp;

		//点Pからの相対座標の計算
		for(int i=0;i<3;++i){
			m_vx[i]=m_x[i]-xp;
			m_vy[i]=m_y[i]-yp;
		}

		m_rot_sum = 0;
		for(int i=0;i<3;++i){
			m_p1=i;
			if(i==2)m_p2=0; else m_p2=i+1;
			m_nv1=sqrt(pow(m_vx[m_p1],2.0)+pow(m_vy[m_p1],2.0));
			m_nv2=sqrt(pow(m_vx[m_p2],2.0)+pow(m_vy[m_p2],2.0));

			m_cos_sita = (m_vx[m_p1]*m_vx[m_p2]+m_vy[m_p1]*m_vy[m_p2]) / (m_nv1*m_nv2);
			m_rot = acos( m_cos_sita );
			if(m_cos_sita<0){m_rot=-m_rot;}
			m_rot_sum += m_rot;
#ifdef debug
			cout<<m_p1<<"  "<<m_p2<<endl;
			cout<<"cos_sita: "<<m_cos_sita<<endl;
			cout<<"sita: "<<m_rot<<endl;
			cout<<"sum of rot: "<<m_rot_sum<<endl;
#endif
		}

		if(abs(m_rot_sum)>6.0){return true;}else{return false;}

	}
};

int main(){

	float x1,y1,x2,y2,x3,y3,xp,yp;
	Triangle oTri;

	while(cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp){
		oTri.setPoint(x1,y1,x2,y2,x3,y3);
		if(oTri.isPointIn(xp,yp)){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}


	}
	return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

struct vector2D
{
	double x, y;

	vector2D(double x, double y)
	{
		this->x = x;
		this->y = y;
	}
};

vector2D vec(double ax, double ay, double bx, double by)
{
	return vector2D(bx - ax, by - ay);
}

double outer(vector2D a, vector2D b)
{
	return a.x * b.y - a.y * b.x;
}

int main()
{
	vector<double> x(3);
	vector<double> y(3);
	double xp, yp;
	for (;cin >> x.at(0) >> y.at(0) >> x.at(1) >> y.at(1) >> x.at(2) >> y.at(2) >> xp >> yp;)
	{
		vector2D ab = vec(x.at(1), y.at(1), x.at(0), y.at(0));
		vector2D bc = vec(x.at(2), y.at(2), x.at(1), y.at(1));
		vector2D ca = vec(x.at(0), y.at(0), x.at(2), y.at(2));

		vector2D ap = vec(xp, yp, x.at(0), y.at(0));
		vector2D bp = vec(xp, yp, x.at(1), y.at(1));
		vector2D cp = vec(xp, yp, x.at(2), y.at(2));


		if ((outer(ab, bp) >= 0 && outer(bc, cp) >= 0 && outer(ca, ap) >= 0) || (outer(ab, bp) <= 0 && outer(bc, cp) <= 0 && outer(ca, ap) <= 0))
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
}

C++: #include <iostream>
#include <complex>
#include <cmath>
using namespace std;
typedef complex<double> P;

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

P vector_coord(P a, P b, P x){
  return P(-cross(b,x),cross(a,x))/cross(a,b);
}

int main(){
  double a1,b1,a2,b2,a3,b3,x1,y1;
  while(cin >>a1 >>b1 >>a2 >>b2 >>a3 >>b3>> x1>>y1){
  P o=P(a1,b1);
  P a=P(a2,b2)-o;
  P b=P(a3,b3)-o;
  P x=P(x1,y1);
  P v = vector_coord(a,b,x);
  if (0<v.real()&&0<v.imag()&&v.real()+v.imag()<1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  }
  return 0;
}

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

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 && d2 > 0);
            rotate(p.begin(), p.begin()+2, p.end());
        }
        cout << (yes ? "YES" : "NO") << endl;
    }
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
	double x[4] = {-1000}, y[4] = {-1000},xp,yp;
	double max_x, min_x, max_y, min_y;
	
	while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x[1], &y[1], &x[2], &y[2], &x[3], &y[3], &xp, &yp) != EOF){
		
		sort(x, x + 4);
		sort(y, y + 4);
		
		max_x = x[3];
		max_y = y[3];
		min_x = x[1];
		min_y = y[1];
		
		if (min_x < xp && xp < max_x && min_y < yp && yp < max_y){
			printf("YES\n");
		}
		else printf("NO\n");
	}
}

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

int main(){

	typedef struct{
		double x, y;
	}_point;

	double a, b, s, t, r_p3, r_p2, eps;
	_point p1, p2, p3, p;
	
	eps = 10e-6;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> p.x >> p.y){
		p2.x -= p1.x;
		p2.y -= p1.y;
		p3.x -= p1.x;
		p3.y -= p1.y;
		p.x -= p1.x;
		p.y -= p1.y;
		r_p2 = sqrt(p2.x * p2.x + p2.y * p2.y);
		r_p3 = sqrt(p3.x * p3.x + p3.y * p3.y);
		if(p2.x > eps){
			s = p.y - p.x * p2.y / p2.x;
			t = p3.y - p3.x * p2.y / p2.x;
			a = (s / t);
			b = (p.x - a * p3.x) / p2.x;
		}
		else {
			a = p.x / p3.x;
			b = (p.y - a * p3.y) / p2.y;
		}

		if(a > 0.0 && b > 0.0 && a + b < 1.0) cout << "YES" << endl;
		else cout << "NO" << endl;
  }

  return 0;
}