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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
using namespace std;

class Biv {
private:
  void set(Biv v) {
    x = v.x; y = v.y;
  }
public:
  string toString() {
    stringstream ss;
    ss << "(" << x << ", " << y << ")";
    return ss.str();
  }
  double x, y;
  Biv(double xx, double yy) {
    x = xx; y = yy;
  }
  Biv() {
    x = 0; y = 0;
  }
  void operator=(Biv v) { set(v); }
  Biv operator-() {
    return Biv(-x, -y);
  }
  Biv operator+(Biv v) {
    return Biv(x + v.x, y + v.y);
  }
  Biv operator-(Biv v) {
    return *this + (-v);
  }
  Biv multiple(double k) {
    return Biv(k * x, k * y);
  }
  Biv operator+=(Biv v) {
    set(*this + v); return *this;
  }
  Biv operator-=(Biv v) {
    set(*this - v); return *this;
  }
  friend ostream& operator<<(ostream& os, const Biv& v);
  double length() {
    return sqrt(x * x + y * y);
  }
  double arg() {
    if (x == 0) { return (y < 0) ? - M_PI / 2: M_PI / 2; }
    double val = atan(y / x);
    return (val > 0)? val:(M_PI + val);
  }
};

double dot(Biv a, Biv b) {
  return a.x * b.x + a.y * b.y;
}

double cross(Biv a, Biv b) {
  return a.x * b.y - a.y * b.x;
}

class Ttm {
private:
  void set(Ttm m) {
    a = m.a; b = m.b; c = m.c; d = m.d;
  }
public:
  double a, b, c, d;
  string toString() {
    stringstream ss;
    ss << "[" << a << "," << b << "," << c << "," << d << "]";
    return ss.str();
  }
  Ttm(double aa, double bb, double cc, double dd) {
    a = aa; b = bb; c = cc; d = dd;
  }
  Ttm() {
    a = 0; b = 0; c = 0; d = 0;
  }
  void operator=(Ttm m) { set(m); }
  Ttm operator-() {
    return Ttm(-a, -b, -c, -d);
  }
  Ttm operator+(Ttm m) {
    return Ttm(a+m.a, b+m.b, c+m.c, d+m.d);
  }
  Ttm operator-(Ttm m) {
    return *this + (-m);
  }
  Ttm operator*(Ttm m) {
    return Ttm(a*m.a+b*m.c, a*m.b+b+m.d, c*m.a+d*m.c, c*m.d+d*m.d);
  }
  Biv operator*(Biv v) {
    return Biv(a * v.x + b * v.y, c * v.x + d * v.y);
  }
  Ttm multiple(double k) {
    return Ttm(k*a, k*b, k*c, k*d);
  }
  Ttm operator+=(Ttm m) {
    set(*this + m); return *this;
  }
  Ttm operator-=(Ttm m) {
    set(*this - m); return *this;
  }
};

Ttm Rotate(double t) {
  return Ttm(cos(t), -sin(t), sin(t), cos(t));
}

bool in(Biv a, Biv b, Biv c, Biv p) {
  b -= a;
  c -= a;
  p -= a;
  
  if (cross(b,p) * cross(c,p) >= 0) {
     /*cout << "cross(" << b.toString() << "," << p.toString()
      << ") * cross(" << c.toString() << "," << p.toString() << ") > 0" << endl;*/
    return false; }
  /*cout << (c - b).toString() << endl;*/
  double t = (c - b).arg();
  /*cout << t << " "<< Rotate(-t).toString() << endl;*/
  b = Rotate(-t) * b;
  c = Rotate(-t) * c;
  p = Rotate(-t) * p;
  /*cout << "c="<<c.toString() << " ,p=" <<p.toString()<<endl;*/

  return p.y > c.y;
}


int main() {
  Biv p1, p2, p3, pp;

  while(cin >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y >> pp.x >> pp.y) {
    bool yes = in(p1, p2, p3, pp);

    cout << ( yes ? "YES" : "NO") << endl;
  }
}

C++: #include <iostream>

using namespace std;

double area2(const double x[][2]){
        double y[3][2];
        for(int i = 0; i < 3; i++){
                for(int j = 0; j < 2; j++){
                        y[i][j] = x[i][j];
                }   
        }   
        for(int i = 0; i < 3; i++){
                y[i][0] -= y[2][0];
                y[i][1] -= y[2][1];
        }   
        double s = y[0][0]*y[1][1]-y[0][1]*y[1][0];
        if(s < 0){ 
                s = -s; 
        }   
        return s;
}
bool isIn(double x[][2]){
        double x1[][2] = {{x[0][0], x[0][1]}, {x[1][0], x[1][1]}, {x[3][0], x[3][1]}};
        double x2[][2] = {{x[0][0], x[0][1]}, {x[2][0], x[2][1]}, {x[3][0], x[3][1]}};
        double s = area2(x) - area2(x+1) - area2(x1) - area2(x2);
        return !s; 
}
int main(){
        while(!cin.eof()){
                double x[4][2];
                for(int i = 0; i < 4; i++){
                        for(int j = 0; j < 2; j++){
                                cin >> x[i][j];
                        }   
                }   
                if(isIn(x)){
                        cout << "YES" << endl;
                }else{
                        cout << "NO" << endl;
                }   
        }   
}

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

int main()
{
	double x1, y1, x2, y2, x3, y3, x, y;
	double ax, ay, bx, by;
	double z1, z2, z3; // ベクトルAとベクトルBの外積のz成分
	
	while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3 >> x >> y) {
		ax = x2 - x1;
		ay = y2 - y1;
		bx = x - x1;
		by = y - y1;
		z1 = ax * by - ay * bx;
		
		ax = x3 - x2;
		ay = y3 - y2;
		bx = x - x2;
		by = y - y2;
		z2 = ax * by - ay * bx;
		
		ax = x1 - x3;
		ay = y1 - y3;
		bx = x - x3;
		by = y - y3;
		z3 = ax * by - ay * bx;
		
		if ( ( (z1 > 0) && (z2 > 0) && (z3 > 0) ) || ( (z1 < 0) && (z2 < 0) && (z3 < 0) ) )
			cout << "YES\n";
		else
			cout << "NO\n";
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF INT_MAX/3
#define ALL(a) (a).begin(),(a).end()
#define CLR(a) memset(a,0,sizeof(a))

typedef long long int ll;

using namespace std;

int main(){

    double x[4],y[4];
    while(cin>>x[0]>>y[0]>>x[1]>>y[1]>>x[2]>>y[2]>>x[3]>>y[3]){
        double a[3],b[3],c[3],d[3];
        for(int i=0;i<3;i++){
            a[i]=x[(i+1)%3]-x[i];
            b[i]=y[(i+1)%3]-y[i];
        }
        for(int i=0;i<3;i++){
            c[i]=x[3]-x[i];
            d[i]=y[3]-y[i];
        }
        int suc=1;
        for(int i=0;i<3;i++){
            
            if((a[i]*b[(i+1)%3]-a[(i+1)%3]*b[i])*(a[i]*d[(i+1)%3]-c[(i+1)%3]*b[i])<0){
                suc=0;
                break;
            }
        }
        if(suc==0)
            cout<<"NO"<<endl;
        else
            cout<<"YES"<<endl;
    }

    return 0;
}

C++: #include<iostream>
#include<stdio.h>
#include<math.h>
#include<vector>
using namespace std;
#define EPS (1e-10)
#define equals(a,b) (fabs((a) - (b)) < EPS)
class Point{
public:
  double x,y;
  Point(double x = 0, double y = 0):x(x), y(y) {}
  Point operator + (Point p){
    return Point(x+p.x,y+p.y);
  }
  Point operator - (Point p){
    return Point(x-p.x,y-p.y);
  }
  Point operator * (double k){
    return Point(x*k,y*k);
  }
  Point operator / (double k){
    return Point(x/k,y/k);
  }
  bool operator == (const Point &p) const{
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};
typedef Point Vector;
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){
  return a.x * b.x + a.y * b.y;
}
double cross(Vector a,Vector b){
  return a.x * b.y - a.y * b.x;
}
// IN 2 ON 1 OUT 0
int contains(Polygon g,Point p){
  int n=g.size();
  bool x = false;
  for(int i=0;i<n;i++){
    Point a = g[i] - p, b = g[(i+1)%n] - p;
    if(fabs(cross(a,b))<EPS && dot(a,b) < EPS ) return 1;
    if(a.y > b.y ) swap(a,b);
    if(a.y<EPS && EPS < b.y && cross(a,b) > EPS) x = !x;
  }
  return ( x ? 2:0);
}
int main(){
  Point a,b,c,d;
  while(cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y){
    Polygon g;
    g.push_back(a);g.push_back(b);g.push_back(c);
    if(contains(g,d)==2) cout << "YES" <<endl;
    else cout << "NO" <<endl;
  }
  return 0;
}