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>
#include <algorithm>
#include <vector>

using namespace std;

double EPS = 1e-10;

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) {
		return 0;
	}
	return a + b;
}

struct P {
	double x, y;
	P() {}
	P(double x, double y) : x(x), y(y) {
	}
	P operator + (P p) {
		return P(add(x, p.x), add(y, p.y));
	}
	P operator - (P p) {
		return P(add(x, -p.x), add(y, -p.y));
	}
	P operator * (double d) {
		return P(x * d, y * d);
	}
	double dot(P p) {
		return add(x * p.x, y * p.y);
	}
	double det(P p) {
		return add(x * p.y, -y * p.x);
	}
};

bool cmp_x(const P& p, const P& q) {
	if (p.x != q.x) {
		return p.x < q.x;
	}
	return p.y < q.y;
}

vector<P> convex_hull(P* ps, int n) {
	sort(ps, ps + n, cmp_x);
	int k = 0;
	vector<P> qs(n * 2);

	for (int i = 0; i < n; i++) {
		while (k > 1 && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0) {
			k--;
		}
		qs[k++] = ps[i];
	}
	for (int i = n-2, t = k; i >= 0; i--) {
		while (k > t && (qs[k-1] - qs[k-2]).det(ps[i] - qs[k-1]) <= 0) {
			k--;
		}
		qs[k++] = ps[i];
	}
	qs.resize(k-1);
	return qs;
}

P ps[10];

int main() {
	while (cin >> ps[0].x >> ps[0].y >> ps[1].x >> ps[1].y >> ps[2].x >> ps[2].y >> ps[3].x >> ps[3].y) {
		P pp = ps[3];
		vector<P> qs = convex_hull(ps, 4);
		if (qs.size() == 4) {
			cout << "NO" << endl;
		} else {
			bool hantei = true;
			for (int i = 0; i < 3; i++) {
				if (qs[i].x == pp.x && qs[i].y == pp.y) {
					hantei = false;
					break;
				}
			}
			if (hantei) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  double a,b,c,d,e,f,x,y;
  double s,t;

  while(cin>>a>>b>>c>>d>>e>>f>>x>>y){
    s=((e-d)*(x-c)-(e-c)*(y-d))/((a-c)*(e-d)-(e-c)*(b-d));
    t=((a-c)*(y-d)-(b-d)*(x-c))/((a-c)*(e-d)-(e-c)*(b-d));

    if(0<s+t&&s+t<1){
      cout<<"YES"<<endl;
    }
    else{
      cout<<"NO"<<endl;
    }
  }
  return 0;
}

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

constexpr double pi = 3.14159265358979323846;

struct vec2d
{
    double x, y;

    double dot(vec2d const & other)
    {
        return x * other.x + y * other.y;
    }

    double norm()
    {
        return sqrt(x * x + y * y);
    }
};

int main()
{
    double x1, y1, x2, y2, x3, y3, xp, yp;
    vec2d v1p, v2p, v3p;
    vec2d v12, v23, v31;
    double a121p, a232p, a313p;
    vec2d v32, v21, v13;
    double a323p, a212p, a131p;

    while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp) {
        v1p = vec2d{xp - x1, yp - y1};
        v2p = vec2d{xp - x2, yp - y2};
        v3p = vec2d{xp - x3, yp - y3};

        v12 = vec2d{x2 - x1, y2 - y1};
        v23 = vec2d{x3 - x2, y3 - y2};
        v31 = vec2d{x1 - x3, y1 - y3};

        v32 = vec2d{x2 - x3, y2 - y3};
        v21 = vec2d{x1 - x2, y1 - y2};
        v13 = vec2d{x3 - x1, y3 - y1};

        a121p = acos(v12.dot(v1p) / (v12.norm() * v1p.norm()));
        a232p = acos(v23.dot(v2p) / (v23.norm() * v2p.norm()));
        a313p = acos(v31.dot(v3p) / (v31.norm() * v3p.norm()));

        a323p = acos(v32.dot(v3p) / (v32.norm() * v3p.norm()));
        a212p = acos(v21.dot(v2p) / (v21.norm() * v2p.norm()));
        a131p = acos(v13.dot(v1p) / (v13.norm() * v1p.norm()));

        if (a121p < pi / 2 && a232p < pi / 2 && a313p < pi / 2 && a323p < pi / 2 && a212p < pi / 2 && a131p < pi / 2) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

double relative(double ax,double ay,double bx,double by){
    return ax*by-ay*bx;
}

int main(void){
    double x1, y1, x2, y2, x3, y3, xp, yp;
    while((cin>>x1>>y1>>x2>>y2>>x3>>y3>>xp>>yp)){
        double r1=relative(x1-x3, y1-y3, xp-x1, yp-x1);
        double r2=relative(x2-x1, y2-y1, xp-x2, yp-y2);
        double r3=relative(x3-x2, y3-y2, xp-x3, yp-y3);
        if((r1<0&&(r2<0&&r3<0)) || (r1>0&&(r2>0&&r3>0))) cout << "YES" <<"\n";
        else cout << "NO" << "\n";
    }
}

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++: #include <iostream>
#include <math.h>
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) {
        double c[3];
        c[0] = (x[1]-x[0]) * (yp-y[1]) - (y[1]-y[0]) * (xp-x[1]);
        c[1] = (x[2]-x[1]) * (yp-y[2]) - (y[2]-y[1]) * (xp-x[2]);
        c[2] = (x[0]-x[2]) * (yp-y[0]) - (y[0]-y[2]) * (xp-x[0]);
        
        if ((c[0]>0 && c[1]>0 && c[2]>0)||(c[0]<0 && c[1]<0 && c[2]<0)) {
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
    }
    
}