Go: package main

import "fmt"

func main() {
	var x1, x2, x3, y1, y2, y3, xp, yp float64
	for {
		v, _ := fmt.Scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp)
		// println(x1, x2, x3, y1, y2, y3, xp, yp)
		if v != 8 {
			break
		}
		ok1 := true
		ok2 := true
		if (x2-x1)*(yp-y1)-(xp-x1)*(y2-y1)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x3-x2)*(yp-y2)-(xp-x2)*(y3-y2)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if (x1-x3)*(yp-y3)-(xp-x3)*(y1-y3)<0 {
			ok1 = false
		} else {
			ok2 = false
		}
		if ok1 || ok2 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}

C++: #include <iostream>

using namespace std;


int main(){
	double x[3], y[3];
	double px, py;

	double ax, ay, bx, by;
	double s, t;

	while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> px >> py){
		ax = x[1]-x[0];
		ay = y[1]-y[0];
		bx = x[2]-x[0];
		by = y[2]-y[0];
		px = px-x[0];
		py = py-y[0];

		t = (px*by - py*bx)/(ax*by - ay*by);
		s = (px*ay - py*ax)/(ay*bx - ax*by);

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

	}
}

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

double Area(double* x1, double* y1, double* x2, double* y2){
  return (*x1 * *y2 - *x2 * *y1)/2.0;
}

double Segitiga(double* a, double * b, double* c, double* d, double* e, double* f){
  return abs (Area(a,b,c,d) + Area(c,d,e,f) + Area(e,f,a,b));
}

int main(){
  double a, b, c, d, e, f, g, h, ta, tb;
  cin >> a >> b >> c >> d >> e >> f >> g >> h;
  ta = Segitiga(&a, &b, &c, &d, &e, &f);
  tb = Segitiga(&a, &b, &c, &d, &g, &h) + Segitiga(&a, &b, &e, &f, &g, &h) + Segitiga(&c, &d, &e, &f, &g, &h);

  if(tb-ta < 1e-8)
    cout << "YES\n";
  else
    cout << "NO\n";
  
return 0;
}

C++: #include <iostream>
#include <cmath>
#include <complex>
using namespace std;
typedef complex<double> P;
double cp(P a, P b){
	return (conj(a)*b).imag();
}
int main(){
	P p[4];
	double x,y;
	while(cin >> x){
		cin >> y;
		p[0] = P(x,y);
		for(int i = 1; i < 4; ++i){
			cin >> x >> y;
			p[i] = P(x,y);
		}
		for(int i = 0 ;i < 3; ++i) p[i] -= p[3];
		if(cp(p[0],p[1])*cp(p[1],p[2]) > 0 && cp(p[0],p[1])*cp(p[2],p[0]) > 0) cout << "YES" << endl;
		else cout << "NO" << endl;
	}
}

C++: #include <iostream>
#include <set>
#include <cassert>
namespace boost {
template <class T>
struct integer_iterator {
    T a;
    bool operator != (integer_iterator const & it) const { return a != it.a; }
    T operator * () const { return a; }
    integer_iterator & operator ++ () { ++ a; return *this; }
    integer_iterator operator ++ (int) { return { a ++ }; }
};
template <class T>
struct integer_range {
    T l, r;
    typedef integer_iterator<T> iterator;
    iterator begin() const { return { l }; }
    iterator end  () const { return { r }; }
};
template <class T>
integer_range<T> irange(T l, T r) { assert (l <= r); return { l, r }; }
template <class T>
struct integer_iterator_with_step {
    T a, d, i;
    bool operator != (integer_iterator_with_step const & it) const { return a != it.a or d != it.d or i != it.i; }
    T operator * () const { return a+d*i; }
    integer_iterator_with_step & operator ++ () { ++ i; return *this; }
    integer_iterator_with_step operator ++ (int) { return { a, d, i ++ }; }
};
template <class T>
struct strided_integer_range {
    T l, r, s;
    typedef integer_iterator_with_step<T> iterator;
    iterator begin() const { return { l, s, 0 }; }
    iterator end  () const { return { l, s, (r - l) / s }; }
};
template <class T>
strided_integer_range<T> irange(T l, T r, T s) { assert (s > 0 ? l <= r : s < 0 ? l >= r : false); return { l, r, s }; }
}
#include <utility>
#include <cmath>
#define ttt template <typename T>
#define pca point<T> const &
ttt struct point { T x, y; };
ttt point<T> operator + (pca a, pca b) { return { a.x+b.x, a.y+b.y }; }
ttt point<T> operator - (pca a, pca b) { return { a.x-b.x, a.y-b.y }; }
ttt point<T> operator - (pca a) { return { -a.x, -a.y }; }
ttt point<T> operator * (T a, pca b) { return { a*b.x, a*b.y }; }
ttt std::pair<T,T> to_pair(pca a) { return { a.x, a.y }; }
ttt bool operator == (pca a, pca b) { return to_pair(a) == to_pair(b); }
ttt bool operator != (pca a, pca b) { return to_pair(a) != to_pair(b); }
ttt bool operator <  (pca a, pca b) { return to_pair(a) <  to_pair(b); }
ttt bool operator <= (pca a, pca b) { return to_pair(a) <= to_pair(b); }
ttt bool operator >= (pca a, pca b) { return to_pair(a) >= to_pair(b); }
ttt bool operator >  (pca a, pca b) { return to_pair(a) >  to_pair(b); }
ttt T length_squared(pca p) { return p.x*p.x + p.y*p.y; }
ttt double length(pca p) { return sqrt(length_squared(p)); }
ttt point<T> normalized(pca a) { return (1 / length(a)) * a; }
ttt T   dot(pca p, pca q) { return p.x * q.x + p.y * q.y; }
ttt T cross(pca p, pca q) { return p.x * q.y - p.y * q.x; }
ttt int ccw(pca a, pca b, pca c) { T x = cross(b - a, c - a); return x > 0 ? 1 : x < 0 ? -1 : 0; }
#undef ttt
#undef pca
template <typename T> std::istream & operator >> (std::istream & input, point<T> & p) { return input >> p.x >> p.y; }
template <typename T> std::ostream & operator << (std::ostream & output, const point<T> & p) { return output << p.x << ' ' << p.y; }
using namespace std;
using namespace boost;
int main() {
    while (true) {
        point<double> a, b, c, p;
        cin >> a >> b >> c >> p;
        if (not cin) break;
        set<int> s;
        s.insert(ccw(a,b,p));
        s.insert(ccw(b,c,p));
        s.insert(ccw(c,a,p));
        cout << (s.size() == 1 ? "YES" : "NO") << endl;
    }
    return 0;
}

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;
}