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 <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int(b+s*n);i+=s)
#define range_debug(i,n,m) (n>m?(n-m+1):(m-n+1))<<n<<(n>m?-1:1)
#define range(i,n,m) iota(i,(n>m?(n-m+1):(m-n+1)),n,(n>m?-1:1))
#define rep(i,n) iota(i,n,0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define trace(var) cout<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef long double Real;
typedef pair<Real, Real> P; // Point
typedef pair<P, P> L; // segment or line
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

/* inner dot */
Real dot(P&a, P&b) {
  return car(a) * car(b) + cdr(a) * cdr(b);
}
Real operator*(P&a, P&b) {
  return car(a) * car(b) + cdr(a) * cdr(b);
}

/* scalar multiple */
P operator*(P&a, Real c) {
  return cons(c * car(a), c * cdr(a));
}
P operator*(Real c, P&a) {
  return cons(c * car(a), c * cdr(a));
}

Real det(P&a, P&b) {
  return car(a) * cdr(b) - cdr(a) * car(b);
}

/* vector operator */
P operator+(P&a, P&b) {
  return cons(car(a) + car(b), cdr(a) + cdr(b));
}

P operator-(P&a) {
  return cons(-car(a), -cdr(a));
}

P operator-(P&a, P&b) {
  return cons(car(a) - car(b), cdr(a) - cdr(b));
}

/* distance */
Real Manhattan(P&a, P&b) {
  return abs(car(a) - car(b)) + abs(cdr(a) - cdr(b));
}
Real Euclidean(P&a, P&b) {
  P p = a - b;
  return sqrt(pow(car(p), 2) + pow(cdr(p), 2));
}

/* equality with EPS (default: 1e-9) */
bool eq(Real x, Real y) {
  return abs(x - y) < EPS;
}
bool operator==(P&a, P&b) {
  return eq(car(a), car(b)) && eq(cdr(a), cdr(b));
}

int sign(Real a) {
  if (eq(a, 0)) return 0;
  return a > 0 ? 1 : -1;
}

enum CCW {
  FRONT,
  BACK,
  RIGHT,
  LEFT,
  ON
};
CCW ccw(L&l, P&p) {
  P u = car(l);
  P v = cdr(l);

  P dif = p - u;
  P dir = v - u;

  if (eq(0, car(dir))) {
    if (eq(0, car(dif))) {
      Real k = cdr(dif) / cdr(dir);
      if (k > 1.0) return FRONT;
      if (k < 0.0) return BACK;
      return ON;
    } else {
      if (det(dir, dif) > 0.0) {
        return LEFT;
      }
      return RIGHT;
    }
  }

  Real k = car(dif) / car(dir);
  if (eq(cdr(dir) * k, cdr(dif))) {
    if (k > 1.0) return FRONT;
    if (k < 0.0) return BACK;
    return ON;
  } else {
    if (det(dir, dif) > 0.0) {
      return LEFT;
    }
    return RIGHT;
  }
}

Real magnitude(P&a) {
  return sqrt(pow(car(a), 2) + pow(cdr(a), 2));
}

Real arg(P a, P b) {
  Real x = dot(a, b) / magnitude(a) / magnitude(b);
  x = min<Real>(1, max<Real>(-1, x));
  return acos(x);
}

int main() {
  Real x1,y1,x2,y2,x3,y3,xp,yp;
  while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> xp >> yp, cin) {
    P a(x1, y1);
    P b(x2, y2);
    P c(x3, y3);
    P p(xp, yp);
    Real t0 = arg(b - a, c - a);
    Real t1 = arg(b - a, p - a);
    Real t2 = arg(p - a, c - a);
    if (t1 < t0 && t2 < t0) {
      t0 = arg(c - b, a - b);
      t1 = arg(c - b, p - b);
      t2 = arg(p - b, a - b);
      if (t1 < t0 && t2 < t0) {
        t0 = arg(b - c, a - c);
        t1 = arg(b - c, p - c);
        t2 = arg(p - c, a - c);
        if (t1 < t0 && t2 < t0) {
          cout << "YES" << endl;
          goto more;
        }
      }
    }
    cout << "NO" << endl;
more:;
  }
  return 0;
}

C++: #include <stdio.h>

#define EPSILON 1.0e-6

int main(int argc, char** argv)
{
  double x1, y1, x2, y2, x3, y3, xp, yp;

  while (fscanf(stdin,
		"%lf %lf %lf %lf %lf %lf %lf %lf",
		&x1, &y1, &x2, &y2, &x3, &y3, &xp, &yp) == 8) {

    double s = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);

    double u = ((xp - x1) * (y3 - yp) - (yp - y1) * (x3 - xp)) / s;
    double v = ((x2 - x1) * (yp - y2) - (y2 - y1) * (xp - x2)) / s;

    if (u > -EPSILON && v > -EPSILON && u + v < 1.0 + EPSILON) {
      fputs("YES\n", stdout);
    }
    else {
      fputs("NO\n", stdout);
    }
  }
}

C++: #include <cstdio>
#include <cmath>
using namespace std;
typedef long long lint;

struct point { double x, y; };

int main()
{
    point p[4];

    while (~scanf("%lf %lf", &p->x, &p->y)){
        for (int i = 1; i < 4; i++) scanf("%lf %lf", &p[i].x, &p[i].y);

        double p_side[3], side[3];
        for (int i = 0; i < 3; i++){
            p_side[i] = sqrt((p[i].x - p[3].x) * (p[i].x - p[3].x) + (p[i].y - p[3].y) * (p[i].y - p[3].y));
            side[i] = sqrt((p[(i + 1) % 3].x - p[i].x) * (p[(i + 1) % 3].x - p[i].x) + (p[(i + 1) % 3].y - p[i].y) * (p[(i + 1) % 3].y - p[i].y));
        }

        double p_s[3], s;
        for (int i = 0; i < 3; i++){
            double tmp = (p_side[i] + p_side[(i + 1) % 3] + side[i]) / 2;
            p_s[i] = sqrt(tmp * (tmp - p_side[i]) * (tmp - p_side[(i + 1) % 3]) * (tmp - side[i]));
        }
        double tmp = (side[0] + side[1] + side[2]) / 2;
        s = sqrt(tmp * (tmp - side[0]) * (tmp - side[1]) * (tmp - side[2]));

//        printf("%.20f\n", fabs(s - p_s[0] - p_s[1] - p_s[2]));
        if (fabs(s - p_s[0] - p_s[1] - p_s[2]) < 1e-10) puts("YES");
        else puts("NO");
    }

    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

struct Point : public complex<double>
{
public:
  Point() { this->real(0);  this->imag(0); }
  Point(const double& x, const double& y) { this->real(x);  this->imag(y); }
  Point(const complex<double> w)  { this->real(w.real());  this->imag(w.imag()); }
  inline double dot(Point p){ return (conj(*this) * p).real(); }
  inline double det(Point p){ return (conj(*this) * p).imag(); }
};

namespace std
{
  bool operator < (const Point& a, const Point& b)
  {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

int ccw(Point a, Point b, Point c)
{
  b -= a;
  c -= a;
  if(b.det(c) > 0.0)    return  1;
  if(b.det(c) < 0.0)    return -1;
  if(b.dot(c) < 0.0)    return  2;
  if(norm(b) < norm(c)) return -2;
  return 0.0;
}

double x[3], y[3];
double p[3];

int main()
{
  while(cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2] >> p[0] >> p[1]){
    Point z[3];
    rep(i, 3) z[i] = Point(x[i] - p[i], y[i] - p[i]);
    bool ok = false;

    if(z[1].dot(z[1]-z[0]) > 0 && z[2].dot(z[2] - z[1]) > 0 && z[0].dot(z[0] - z[2]) > 0) ok = true;
    if(z[1].dot(z[1]-z[0]) < 0 && z[2].dot(z[2] - z[1]) < 0 && z[0].dot(z[0] - z[2]) < 0) ok = true;

    puts(ok ? "YES" : "NO");
  }

  return 0;
}